de.schlichtherle.truezip.key.pbe.swing.KeyPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truezip-driver-zip Show documentation
Show all versions of truezip-driver-zip Show documentation
The file system driver family for ZIP and related archive file types.
Add the JAR artifact of this module to the run time class path to
make its file system drivers available for service location in the
client API modules.
/*
* Copyright (C) 2005-2013 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package de.schlichtherle.truezip.key.pbe.swing;
import de.schlichtherle.truezip.key.pbe.SafePbeParameters;
import de.schlichtherle.truezip.swing.EnhancedPanel;
import de.schlichtherle.truezip.swing.PanelEvent;
import de.schlichtherle.truezip.swing.PanelListener;
import javax.annotation.CheckForNull;
import java.net.URI;
/**
* Abstract panel for prompting for authentication keys.
*
* @author Christian Schlichtherle
*/
public abstract class KeyPanel extends EnhancedPanel {
private static final long serialVersionUID = 2762934728646652873L;
private Feedback feedback;
public KeyPanel() {
addPanelListener(new KeyPanelListener());
}
/**
* Returns the feedback to run when this panel is shown in its ancestor
* window.
*/
public Feedback getFeedback() {
return feedback;
}
/**
* Sets the feedback to run when this panel is shown in its ancestor
* window.
*/
public void setFeedback(final Feedback feedback) {
this.feedback = feedback;
}
private void runFeedback() {
final Feedback feedback = getFeedback();
if (null != feedback)
feedback.run(this);
}
/**
* Getter for property {@code resource}.
*
* @return Value of property {@code resource}.
*/
public abstract URI getResource();
/**
* Setter for property {@code resource}.
*
* @param resource New value of property {@code resource}.
*/
public abstract void setResource(final URI resource);
/**
* Getter for property {@code error}.
*/
public abstract @CheckForNull String getError();
/**
* Setter for property error.
*
* @param error New value of property error.
*/
public abstract void setError(final @CheckForNull String error);
abstract boolean updateParam(final SafePbeParameters, ?> param);
private static class KeyPanelListener implements PanelListener {
@Override
public void ancestorWindowShown(final PanelEvent evt) {
((KeyPanel) evt.getSource()).runFeedback();
}
@Override
public void ancestorWindowHidden(PanelEvent evt) {
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy