private void createActions() {
okAction = new AbstractAction(I18n.getMessage("jsite.general.ok")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionOk();
cancelAction = new AbstractAction(I18n.getMessage("jsite.general.cancel")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionCancel();
generateAction = new AbstractAction(I18n.getMessage("jsite.key-dialog.button.generate")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionGenerate();
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
keysLabel.setText(I18n.getMessage("jsite.key-dialog.label.keys"));
privateKeyLabel.setText(I18n.getMessage("jsite.key-dialog.label.private-key"));
* <p>
* Projects are compared by their name only.
*/
+ @Override
public int compareTo(Project project) {
return name.compareToIgnoreCase(project.name);
}
/**
* {@inheritDoc}
*/
+ @Override
public void run() {
fireProjectInsertStarted();
List<ScannedFile> files = fileScanner.getFiles();
/**
* {@inheritDoc}
*/
+ @Override
public void fileScannerFinished(FileScanner fileScanner) {
if (!fileScanner.isError()) {
new Thread(this).start();
/**
* {@inheritDoc}
*/
+ @Override
public Iterator<Issue> iterator() {
return issues.iterator();
}
/**
* {@inheritDoc}
*/
+ @Override
public void run() {
Connection connection = freenetInterface.getConnection("jSite-" + ++counter + "-UpdateChecker");
try {
*
* @see FileScannerListener#fileScannerFinished(FileScanner)
*/
+ @Override
public void run() {
files = new ArrayList<ScannedFile>();
error = false;
private void scanFiles(File rootDir, List<ScannedFile> fileList) throws IOException {
File[] files = rootDir.listFiles(new FileFilter() {
+ @Override
@SuppressWarnings("synthetic-access")
public boolean accept(File file) {
return !project.isIgnoreHiddenFiles() || !file.isHidden();
/**
* {@inheritDoc}
*/
+ @Override
public int compareTo(ScannedFile scannedFile) {
return filename.compareTo(scannedFile.filename);
}
setDescription(I18n.getMessage("jsite.node-manager.description"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
setHeading(I18n.getMessage("jsite.node-manager.heading"));
setDescription(I18n.getMessage("jsite.node-manager.description"));
private void createActions() {
addNodeAction = new AbstractAction(I18n.getMessage("jsite.node-manager.add-node")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
addNode();
deleteNodeAction = new AbstractAction(I18n.getMessage("jsite.node-manager.delete-node")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
deleteNode();
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
addNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.node-manager.add-node"));
deleteNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.node-manager.delete-node"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
nodeInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.node-manager.node-information") + "</b></html>");
nodeNameLabel.setText(I18n.getMessage("jsite.node-manager.name") + ":");
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("null")
public void valueChanged(ListSelectionEvent e) {
Object source = e.getSource();
/**
* {@inheritDoc}
*/
+ @Override
public void insertUpdate(DocumentEvent e) {
updateTextField(e);
}
/**
* {@inheritDoc}
*/
+ @Override
public void removeUpdate(DocumentEvent e) {
updateTextField(e);
}
/**
* {@inheritDoc}
*/
+ @Override
public void changedUpdate(DocumentEvent e) {
updateTextField(e);
}
/**
* {@inheritDoc}
*/
+ @Override
public void stateChanged(ChangeEvent e) {
Object source = e.getSource();
Node selectedNode = getSelectedNode();
/**
* {@inheritDoc}
*/
+ @Override
public void run() {
setHeading(I18n.getMessage("jsite.preferences.heading"));
setDescription(I18n.getMessage("jsite.preferences.description"));
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
selectDefaultTempDirectory();
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
selectCustomTempDirectory();
};
chooseTempDirectoryAction = new AbstractAction(I18n.getMessage("jsite.preferences.temp-directory.choose")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent e) {
chooseTempDirectory();
};
nextToJarFileAction = new AbstractAction(I18n.getMessage("jsite.preferences.config-directory.jar")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionevent) {
configurationLocation = ConfigurationLocation.NEXT_TO_JAR_FILE;
};
homeDirectoryAction = new AbstractAction(I18n.getMessage("jsite.preferences.config-directory.home")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionevent) {
configurationLocation = ConfigurationLocation.HOME_DIRECTORY;
};
customDirectoryAction = new AbstractAction(I18n.getMessage("jsite.preferences.config-directory.custom")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
configurationLocation = ConfigurationLocation.CUSTOM;
};
useEarlyEncodeAction = new AbstractAction(I18n.getMessage("jsite.preferences.insert-options.use-early-encode")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
useEarlyEncode = useEarlyEncodeCheckBox.isSelected();
};
priorityAction = new AbstractAction(I18n.getMessage("jsite.preferences.insert-options.priority")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
priority = (PriorityClass) insertPriorityComboBox.getSelectedItem();
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
selectDefaultTempDirectoryAction.putValue(Action.NAME, I18n.getMessage("jsite.preferences.temp-directory.default"));
/**
* {@inheritDoc}
*/
+ @Override
public void run() {
tempDirectoryLabel.setText("<html><b>" + I18n.getMessage("jsite.preferences.temp-directory") + "</b></html>");
configurationDirectoryLabel.setText("<html><b>" + I18n.getMessage("jsite.preferences.config-directory") + "</b></html>");
private void createActions() {
scanAction = new AbstractAction(I18n.getMessage("jsite.project-files.action.rescan")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionScan();
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
scanAction.putValue(Action.NAME, I18n.getMessage("jsite.project-files.action.rescan"));
}
}
+ @Override
public void changedUpdate(DocumentEvent documentEvent) {
storeText(documentEvent);
}
+ @Override
public void insertUpdate(DocumentEvent documentEvent) {
storeText(documentEvent);
}
+ @Override
public void removeUpdate(DocumentEvent documentEvent) {
storeText(documentEvent);
}
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
ignoreHiddenFilesCheckBox.setText(I18n.getMessage("jsite.project-files.ignore-hidden-files"));
ignoreHiddenFilesCheckBox.setSelected(project.isIgnoreHiddenFiles());
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
setHeading(MessageFormat.format(I18n.getMessage("jsite.project-files.heading"), project.getName()));
setDescription(I18n.getMessage("jsite.project-files.description"));
* <p>
* Updates the file list.
*/
+ @Override
public void fileScannerFinished(FileScanner fileScanner) {
final boolean error = fileScanner.isError();
if (!error) {
final List<ScannedFile> files = fileScanner.getFiles();
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
projectFileList.setListData(files.toArray());
}
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
wizard.setPreviousEnabled(true);
/**
* {@inheritDoc}
*/
+ @Override
public void actionPerformed(ActionEvent actionEvent) {
Object source = actionEvent.getSource();
if ((source instanceof JCheckBox) && ("ignore-hidden-files".equals(((JCheckBox) source).getName()))) {
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("null")
public void valueChanged(ListSelectionEvent e) {
ScannedFile scannedFile = (ScannedFile) projectFileList.getSelectedValue();
/**
* {@inheritDoc}
*/
+ @Override
public void changedUpdate(DocumentEvent documentEvent) {
processDocumentUpdate(documentEvent);
}
/**
* {@inheritDoc}
*/
+ @Override
public void insertUpdate(DocumentEvent documentEvent) {
processDocumentUpdate(documentEvent);
}
/**
* {@inheritDoc}
*/
+ @Override
public void removeUpdate(DocumentEvent documentEvent) {
processDocumentUpdate(documentEvent);
}
setDescription(I18n.getMessage("jsite.insert.description"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
setHeading(I18n.getMessage("jsite.insert.heading"));
setDescription(I18n.getMessage("jsite.insert.description"));
private void createActions() {
copyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionCopyURI();
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
copyURIAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.copy-uri"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.insert.project-information") + "</b></html>");
progressBar.setFont(progressBar.getFont().deriveFont(Font.PLAIN));
projectInserter.start(new ProgressListener() {
+ @Override
public void onProgress(final long copied, final long length) {
SwingUtilities.invokeLater(new Runnable() {
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
int divisor = 1;
projectInserter.setProject(project);
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
requestURITextField.setText(project.getFinalRequestURI(1));
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertStarted(final Project project) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
startTimeLabel.setText(DateFormat.getDateTimeInstance().format(new Date()));
/**
* {@inheritDoc}
*/
+ @Override
public void projectUploadFinished(Project project) {
startTime = System.currentTimeMillis();
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
progressBar.setString(I18n.getMessage("jsite.insert.starting"));
/**
* {@inheritDoc}
*/
+ @Override
public void projectURIGenerated(Project project, final String uri) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
copyURIAction.setEnabled(true);
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertProgress(Project project, final int succeeded, final int failed, final int fatal, final int total, final boolean finalized) {
insertedBlocks = succeeded;
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
if (total == 0) {
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertFinished(Project project, boolean success, Throwable cause) {
running = false;
if (success) {
}
SwingUtilities.invokeLater(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
progressBar.setValue(progressBar.getMaximum());
/**
* {@inheritDoc}
*/
+ @Override
public void lostOwnership(Clipboard clipboard, Transferable contents) {
/* ignore. */
}
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
setHeading(I18n.getMessage("jsite.project.heading"));
setDescription(I18n.getMessage("jsite.project.description"));
private void createActions() {
projectLocalPathBrowseAction = new AbstractAction(I18n.getMessage("jsite.project.action.browse")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionLocalPathBrowse();
projectAddAction = new AbstractAction(I18n.getMessage("jsite.project.action.add-project")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionAdd();
projectDeleteAction = new AbstractAction(I18n.getMessage("jsite.project.action.delete-project")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionDelete();
projectCloneAction = new AbstractAction(I18n.getMessage("jsite.project.action.clone-project")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionClone();
projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionCopyURI();
projectManageKeysAction = new AbstractAction(I18n.getMessage("jsite.project.action.manage-keys")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionManageKeys();
projectResetEditionAction = new AbstractAction(I18n.getMessage("jsite.project.action.reset-edition")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
actionResetEdition();
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
public void run() {
projectInformationLabel.setText("<html><b>" + I18n.getMessage("jsite.project.project.information") + "</b></html>");
projectNameLabel.setText(I18n.getMessage("jsite.project.project.name") + ":");
/**
* {@inheritDoc}
*/
+ @Override
public void valueChanged(ListSelectionEvent listSelectionEvent) {
int selectedRow = projectList.getSelectedIndex();
Project selectedProject = (Project) projectList.getSelectedValue();
/**
* {@inheritDoc}
*/
+ @Override
public void insertUpdate(DocumentEvent documentEvent) {
setTextField(documentEvent);
}
/**
* {@inheritDoc}
*/
+ @Override
public void removeUpdate(DocumentEvent documentEvent) {
setTextField(documentEvent);
}
/**
* {@inheritDoc}
*/
+ @Override
public void changedUpdate(DocumentEvent documentEvent) {
setTextField(documentEvent);
}
/**
* {@inheritDoc}
*/
+ @Override
public void lostOwnership(Clipboard clipboard, Transferable contents) {
/* ignore. */
}
* Returns a combined list of {@link #i18nRunnables} and
* {@link #i18nPostRunnables}, in that order.
*/
+ @Override
public Iterator<Runnable> iterator() {
List<Runnable> allRunnables = new ArrayList<Runnable>();
allRunnables.addAll(i18nRunnables);
projectInserter.setProject(currentProject);
projectInserter.start(new ProgressListener() {
+ @Override
public void onProgress(long copied, long length) {
System.out.print("Uploaded: " + copied + " / " + length + " bytes...\r");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertStarted(Project project) {
outputWriter.println("Starting Insert of project \"" + project.getName() + "\".");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectUploadFinished(Project project) {
outputWriter.println("Project \"" + project.getName() + "\" has been uploaded, starting insert...");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectURIGenerated(Project project, String uri) {
outputWriter.println("URI: " + uri);
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) {
outputWriter.println("Progress: " + succeeded + " done, " + failed + " failed, " + fatal + " fatal, " + total + " total" + (finalized ? " (finalized)" : "") + ", " + ((succeeded + failed + fatal) * 100 / total) + "%");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertFinished(Project project, boolean success, Throwable cause) {
outputWriter.println("Request URI: " + project.getFinalRequestURI(0));
finished = true;
for (final Locale locale : SUPPORTED_LOCALES) {
languageActions.put(locale, new AbstractAction(I18n.getMessage("jsite.menu.language." + locale.getLanguage()), IconLoader.loadIcon("/flag-" + locale.getLanguage() + ".png")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
switchLanguage(locale);
}
manageNodeAction = new AbstractAction(I18n.getMessage("jsite.menu.nodes.manage-nodes")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
showPage(PageType.PAGE_NODE_MANAGER);
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
optionsPreferences();
/**
* {@inheritDoc}
*/
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent actionEvent) {
showLatestUpdate();
};
aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) {
+ @Override
@SuppressWarnings("synthetic-access")
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), getVersion().toString()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon);
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes"));
I18nContainer.getInstance().registerRunnable(new Runnable() {
+ @Override
@SuppressWarnings("synthetic-access")
public void run() {
languageMenu.setText(I18n.getMessage("jsite.menu.languages"));
/**
* {@inheritDoc}
*/
+ @Override
public void valueChanged(ListSelectionEvent e) {
JList list = (JList) e.getSource();
int selectedRow = list.getSelectedIndex();
/**
* {@inheritDoc}
*/
+ @Override
public void wizardNextPressed(TWizard wizard) {
String pageName = wizard.getPage().getName();
if ("page.node-manager".equals(pageName)) {
/**
* {@inheritDoc}
*/
+ @Override
public void wizardPreviousPressed(TWizard wizard) {
String pageName = wizard.getPage().getName();
if ("page.project".equals(pageName) || "page.preferences".equals(pageName)) {
/**
* {@inheritDoc}
*/
+ @Override
public void wizardQuitPressed(TWizard wizard) {
if (((ProjectPage) pages.get(PageType.PAGE_PROJECTS)).wasUriCopied() || ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).wasUriCopied()) {
JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.use-clipboard-now"));
/**
* {@inheritDoc}
*/
+ @Override
public void nodesUpdated(Node[] nodes) {
nodeMenu.removeAll();
ButtonGroup nodeButtonGroup = new ButtonGroup();
/**
* {@inheritDoc}
*/
+ @Override
public void nodeSelected(Node node) {
for (Component menuItem : nodeMenu.getMenuComponents()) {
if (menuItem instanceof JMenuItem) {
/**
* {@inheritDoc}
*/
+ @Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source instanceof JRadioButtonMenuItem) {
/**
* {@inheritDoc}
*/
+ @Override
public void foundUpdateData(Version foundVersion, long versionTimestamp) {
logger.log(Level.FINEST, "Found version {0} from {1,date}.", new Object[] { foundVersion, versionTimestamp });
if (foundVersion.compareTo(VERSION) > 0) {
/**
* {@inheritDoc}
*/
+ @Override
public int compareTo(Version version) {
int lessComponents = Math.min(components.length, version.components.length);
for (int index = 0; index < lessComponents; index++) {