import de.todesbaum.util.swing.TWizardPage;
/**
+ * Wizard page that shows the progress of an insert.
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class ProjectInsertPage extends TWizardPage implements InsertListener, ClipboardOwner {
+ /** The project inserter. */
private ProjectInserter projectInserter;
+ /** The “copy URI” action. */
private Action copyURIAction;
+
+ /** The “request URI” textfield. */
private JTextField requestURITextField;
+
+ /** The “start time” label. */
private JLabel startTimeLabel;
+
+ /** The progress bar. */
private JProgressBar progressBar;
+
+ /** The start time of the insert. */
private long startTime = 0;
+ /**
+ * Creates a new progress insert wizard page.
+ *
+ * @param wizard
+ * The wizard this page belongs to
+ */
public ProjectInsertPage(final TWizard wizard) {
super(wizard);
createActions();
projectInserter.addInsertListener(this);
}
+ /**
+ * Creates all used actions.
+ */
private void createActions() {
copyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
});
}
+ /**
+ * Initializes the page.
+ */
private void pageInit() {
setLayout(new BorderLayout(12, 12));
add(createProjectInsertPanel(), BorderLayout.CENTER);
}
+ /**
+ * Creates the main panel.
+ *
+ * @return The main panel
+ */
private JComponent createProjectInsertPanel() {
JComponent projectInsertPanel = new JPanel(new GridBagLayout());
this.wizard.setQuitName(I18n.getMessage("jsite.wizard.quit"));
}
+ /**
+ * Starts the insert.
+ */
public void startInsert() {
wizard.setNextEnabled(false);
copyURIAction.setEnabled(false);
}
/**
+ * Sets whether to activate the debug mode.
+ *
* @param debug
- * The debug to set.
+ * <code>true</code> to activate the debug mode,
+ * <code>false</code> to deactivate.
*/
public void setDebug(boolean debug) {
projectInserter.setDebug(debug);
}
/**
+ * Sets the project to insert.
+ *
* @param project
- * The project to set.
+ * The project to insert
*/
public void setProject(final Project project) {
projectInserter.setProject(project);
});
}
+ /**
+ * Sets the freenet interface to use.
+ *
+ * @param freenetInterface
+ * The freenet interface to use
+ */
public void setFreenetInterface(Freenet7Interface freenetInterface) {
projectInserter.setFreenetInterface(freenetInterface);
}
// ACTIONS
//
+ /**
+ * Copies the request URI of the project to the clipboard.
+ */
private void actionCopyURI() {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(requestURITextField.getText()), this);
* {@inheritDoc}
*/
public void lostOwnership(Clipboard clipboard, Transferable contents) {
+ /* ignore. */
}
}