X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fgui%2FProjectPage.java;h=ceee143f16449bdea8671d4a42976bcc605da657;hb=d6e49b13a2167ff00dd43be64faf0598f1f967ea;hp=98ad847d04d9fca07fc91aeff21497881705b430;hpb=0e88169c3e8decfcd99f39f5ecf3a85df50c3fca;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java index 98ad847..ceee143 100644 --- a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java @@ -33,6 +33,8 @@ import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.io.IOException; import java.text.MessageFormat; +import java.util.List; +import java.util.Map.Entry; import javax.swing.AbstractAction; import javax.swing.Action; @@ -57,12 +59,13 @@ import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.DocumentFilter; +import net.pterodactylus.util.swing.SortedListModel; +import de.todesbaum.jsite.application.FileOption; import de.todesbaum.jsite.application.Freenet7Interface; -import de.todesbaum.jsite.application.KeyDialog; import de.todesbaum.jsite.application.Project; +import de.todesbaum.jsite.application.WebOfTrustInterface; import de.todesbaum.jsite.i18n.I18n; import de.todesbaum.jsite.i18n.I18nContainer; -import de.todesbaum.util.swing.SortedListModel; import de.todesbaum.util.swing.TLabel; import de.todesbaum.util.swing.TWizard; import de.todesbaum.util.swing.TWizardPage; @@ -77,6 +80,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** The freenet interface. */ private Freenet7Interface freenetInterface; + /** The web of trust interface. */ + private WebOfTrustInterface webOfTrustInterface; + /** The “browse” action. */ private Action projectLocalPathBrowseAction; @@ -143,6 +149,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D I18nContainer.getInstance().registerRunnable(new Runnable() { + @Override public void run() { setHeading(I18n.getMessage("jsite.project.heading")); setDescription(I18n.getMessage("jsite.project.description")); @@ -206,6 +213,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D private void createActions() { projectLocalPathBrowseAction = new AbstractAction(I18n.getMessage("jsite.project.action.browse")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionLocalPathBrowse(); @@ -217,6 +225,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectAddAction = new AbstractAction(I18n.getMessage("jsite.project.action.add-project")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionAdd(); @@ -227,6 +236,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectDeleteAction = new AbstractAction(I18n.getMessage("jsite.project.action.delete-project")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionDelete(); @@ -238,6 +248,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectCloneAction = new AbstractAction(I18n.getMessage("jsite.project.action.clone-project")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionClone(); @@ -249,6 +260,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectCopyURIAction = new AbstractAction(I18n.getMessage("jsite.project.action.copy-uri")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionCopyURI(); @@ -260,6 +272,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectManageKeysAction = new AbstractAction(I18n.getMessage("jsite.project.action.manage-keys")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionManageKeys(); @@ -271,6 +284,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D projectResetEditionAction = new AbstractAction(I18n.getMessage("jsite.project.action.reset-edition")) { + @Override @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { actionResetEdition(); @@ -282,6 +296,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D I18nContainer.getInstance().registerRunnable(new Runnable() { + @Override @SuppressWarnings("synthetic-access") public void run() { projectLocalPathBrowseAction.putValue(Action.NAME, I18n.getMessage("jsite.project.action.browse")); @@ -407,6 +422,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D I18nContainer.getInstance().registerRunnable(new Runnable() { + @Override public void run() { projectInformationLabel.setText("" + I18n.getMessage("jsite.project.project.information") + ""); projectNameLabel.setText(I18n.getMessage("jsite.project.project.name") + ":"); @@ -427,7 +443,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D * @param projects * The list of projects */ - public void setProjects(Project[] projects) { + public void setProjects(List projects) { projectListModel.clear(); for (Project project : projects) { projectListModel.add(project); @@ -439,8 +455,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D * * @return The list of projects */ - public Project[] getProjects() { - return projectListModel.toArray(new Project[projectListModel.size()]); + public List getProjects() { + return projectListModel; } /** @@ -454,6 +470,16 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D } /** + * Sets the web of trust interface to use. + * + * @param webOfTrustInterface + * The web of trust interface to use + */ + public void setWebOfTrustInterface(WebOfTrustInterface webOfTrustInterface) { + this.webOfTrustInterface = webOfTrustInterface; + } + + /** * Returns the currently selected project. * * @return The currently selected project @@ -606,6 +632,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D KeyDialog keyDialog = new KeyDialog(freenetInterface, wizard); keyDialog.setPrivateKey(selectedProject.getInsertURI()); keyDialog.setPublicKey(selectedProject.getRequestURI()); + keyDialog.setProjects(getProjects()); + keyDialog.setOwnIdentities(webOfTrustInterface.getOwnIdentities()); keyDialog.setVisible(true); if (!keyDialog.wasCancelled()) { String originalPublicKey = selectedProject.getRequestURI(); @@ -614,6 +642,9 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D selectedProject.setRequestURI(keyDialog.getPublicKey()); if (!originalPublicKey.equals(selectedProject.getRequestURI()) || !originalPrivateKey.equals(selectedProject.getInsertURI())) { selectedProject.setEdition(-1); + for (Entry fileOption : selectedProject.getFileOptions().entrySet()) { + fileOption.getValue().setLastInsertHash(null); + } } updateCompleteURI(); } @@ -653,6 +684,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** * {@inheritDoc} */ + @Override public void valueChanged(ListSelectionEvent listSelectionEvent) { int selectedRow = projectList.getSelectedIndex(); Project selectedProject = (Project) projectList.getSelectedValue(); @@ -692,6 +724,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** * {@inheritDoc} */ + @Override public void insertUpdate(DocumentEvent documentEvent) { setTextField(documentEvent); } @@ -699,6 +732,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** * {@inheritDoc} */ + @Override public void removeUpdate(DocumentEvent documentEvent) { setTextField(documentEvent); } @@ -706,6 +740,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** * {@inheritDoc} */ + @Override public void changedUpdate(DocumentEvent documentEvent) { setTextField(documentEvent); } @@ -717,6 +752,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D /** * {@inheritDoc} */ + @Override public void lostOwnership(Clipboard clipboard, Transferable contents) { /* ignore. */ }