From f90ad0c003cda73146628ac6d4e9d1cfa8164d85 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 3 Jun 2008 18:29:36 +0200 Subject: [PATCH] start node selection in project --- src/net/pterodactylus/jsite/gui/ProjectPanel.java | 55 ++++++++++++++++------ src/net/pterodactylus/jsite/i18n/jSite.properties | 3 ++ .../pterodactylus/jsite/i18n/jSite_de.properties | 3 ++ 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/src/net/pterodactylus/jsite/gui/ProjectPanel.java b/src/net/pterodactylus/jsite/gui/ProjectPanel.java index d009471..c3b9a78 100644 --- a/src/net/pterodactylus/jsite/gui/ProjectPanel.java +++ b/src/net/pterodactylus/jsite/gui/ProjectPanel.java @@ -28,8 +28,11 @@ import java.awt.event.ActionEvent; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.AbstractAction; +import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.JTextField; @@ -47,7 +50,7 @@ import net.pterodactylus.util.logging.Logging; /** * A panel that contains all information about a project and lets the user edit * the properties of the project. - * + * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { @@ -86,9 +89,18 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { /** The “base path” textfield. */ private JTextField basePathTextField; + /** The “node” label. */ + private I18nLabel nodeLabel; + + /** The “node” action. */ + private Action nodeAction; + + /** The “node” combo box. */ + private JComboBox nodeComboBox; + /** * Creates a new project panel. - * + * * @param swingInterface * The Swing interface * @param project @@ -109,7 +121,7 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { /** * Returns the project that is displayed in this panel. - * + * * @return The project of this panel */ public Project getProject() { @@ -144,6 +156,15 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { editFiles(); } }; + nodeAction = new AbstractAction() { + + /** + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + public void actionPerformed(ActionEvent actionEvent) { + /* TODO */ + } + }; } /** @@ -161,7 +182,7 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { /** * Creates the properties panel. - * + * * @return The properties panel */ private JPanel createPropertiesPanel() { @@ -171,32 +192,38 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { nameTextField.getDocument().addDocumentListener(this); nameLabel = new I18nLabel("projectPanel.label.name", nameTextField); propertiesPanel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); - propertiesPanel.add(nameTextField, new GridBagConstraints(1, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 6, 0, 0), 0, 0)); + propertiesPanel.add(nameTextField, new GridBagConstraints(1, 0, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 12, 0, 0), 0, 0)); descriptionTextField = new JTextField(project.getDescription()); descriptionTextField.getDocument().addDocumentListener(this); descriptionLabel = new I18nLabel("projectPanel.label.description", descriptionTextField); - propertiesPanel.add(descriptionLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 0, 0, 0), 0, 0)); - propertiesPanel.add(descriptionTextField, new GridBagConstraints(1, 1, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0)); + propertiesPanel.add(descriptionLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 0, 0, 0), 0, 0)); + propertiesPanel.add(descriptionTextField, new GridBagConstraints(1, 1, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 12, 0, 0), 0, 0)); basePathTextField = new JTextField(project.getBasePath()); basePathTextField.setEditable(false); basePathLabel = new I18nLabel("projectPanel.label.basePath"); JButton changeBasePathButton = new JButton(changeBasePathAction); JButton editFilesButton = new JButton(editFilesAction); - propertiesPanel.add(basePathLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 0, 0, 0), 0, 0)); - propertiesPanel.add(basePathTextField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(6, 6, 0, 0), 0, 0)); - propertiesPanel.add(changeBasePathButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0)); - propertiesPanel.add(editFilesButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0)); + propertiesPanel.add(basePathLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 0, 0, 0), 0, 0)); + propertiesPanel.add(basePathTextField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(12, 12, 0, 0), 0, 0)); + propertiesPanel.add(changeBasePathButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 12, 0, 0), 0, 0)); + propertiesPanel.add(editFilesButton, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 12, 0, 0), 0, 0)); + + nodeComboBox = new JComboBox(); + nodeComboBox.addActionListener(nodeAction); + nodeLabel = new I18nLabel("projectPanel.label.node", nodeComboBox); + propertiesPanel.add(nodeLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 0, 0, 0), 0, 0)); + propertiesPanel.add(nodeComboBox, new GridBagConstraints(1, 3, 3, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(12, 12, 0, 0), 0, 0)); - propertiesPanel.add(new JPanel(), new GridBagConstraints(0, 3, 4, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); + propertiesPanel.add(new JPanel(), new GridBagConstraints(0, 4, 4, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); return propertiesPanel; } /** * Creates the button panel. - * + * * @return The button panel */ private JPanel createButtonPanel() { @@ -211,7 +238,7 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { /** * Updates the project from changes in the text fields. - * + * * @param document * The document that was changed */ diff --git a/src/net/pterodactylus/jsite/i18n/jSite.properties b/src/net/pterodactylus/jsite/i18n/jSite.properties index aef5ea9..2cfa7c1 100644 --- a/src/net/pterodactylus/jsite/i18n/jSite.properties +++ b/src/net/pterodactylus/jsite/i18n/jSite.properties @@ -202,6 +202,9 @@ projectPanel.label.description.mnemonic: VK_D projectPanel.label.basePath.name: Base Path projectPanel.label.basePath.mnemonic: VK_B +projectPanel.label.node.name: Node +projectPanel.label.node.mnemonic: VK_O + projectPanel.basePathInformation.scanning: Scanning the base path\u2026 projectPanel.basePathInformation.fileCount: Found {0} file{0,choice,0#s|1#|2#s}. diff --git a/src/net/pterodactylus/jsite/i18n/jSite_de.properties b/src/net/pterodactylus/jsite/i18n/jSite_de.properties index a050603..c483ebc 100644 --- a/src/net/pterodactylus/jsite/i18n/jSite_de.properties +++ b/src/net/pterodactylus/jsite/i18n/jSite_de.properties @@ -202,6 +202,9 @@ projectPanel.label.description.mnemonic: VK_B projectPanel.label.basePath.name: Basispfad projectPanel.label.basePath.mnemonic: VK_B +projectPanel.label.node.name: Node +projectPanel.label.node.mnemonic: VK_O + projectPanel.basePathInformation.scanning: Durchsuche den Basispfad\u2026 projectPanel.basePathInformation.fileCount: {0} Datei{0,choice,0#en|1#|2#en} gefunden. -- 2.7.4