X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fgui%2FProjectPage.java;h=1da83d2bcea148af7974006cbb680b6722d9e710;hb=7ec476fcc83a2ebe74a9faf3251d9d60fd03f58e;hp=9345dbf5d21ac56c484a8ba287b784c1325ee866;hpb=ea076c18c3ebebc991f4075320a1db9bdba543c9;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 9345dbf..1da83d2 100644
--- a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
+++ b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
@@ -1,5 +1,5 @@
/*
- * jSite - ProjectPage.java - Copyright © 2006â2012 David Roden
+ * jSite - ProjectPage.java - Copyright © 2006â2014 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -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;
@@ -58,9 +60,10 @@ 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.TLabel;
@@ -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. */
}