From: David ‘Bombe’ Roden Date: Sat, 24 May 2008 11:38:15 +0000 (+0200) Subject: add base path textfield to project panel X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=80e93840dac03f7775bdf3053e04639e45cfcf91;p=jSite2.git add base path textfield to project panel --- diff --git a/src/net/pterodactylus/jsite/gui/ProjectPanel.java b/src/net/pterodactylus/jsite/gui/ProjectPanel.java index 13246f1..d0fb1af 100644 --- a/src/net/pterodactylus/jsite/gui/ProjectPanel.java +++ b/src/net/pterodactylus/jsite/gui/ProjectPanel.java @@ -24,6 +24,7 @@ import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; +import java.awt.event.ActionEvent; import java.util.logging.Logger; import javax.swing.BorderFactory; @@ -35,6 +36,7 @@ import javax.swing.event.DocumentListener; import javax.swing.text.Document; import net.pterodactylus.jsite.i18n.I18nable; +import net.pterodactylus.jsite.i18n.gui.I18nAction; import net.pterodactylus.jsite.i18n.gui.I18nLabel; import net.pterodactylus.jsite.project.Project; import net.pterodactylus.util.logging.Logging; @@ -58,6 +60,9 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { /** The project to show. */ private final Project project; + /** The “change base path” action. */ + private I18nAction changeBasePathAction; + /** The “name” label. */ private I18nLabel nameLabel; @@ -70,6 +75,12 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { /** The “description” textfield. */ private JTextField descriptionTextField; + /** The “base path” label. */ + private I18nLabel basePathLabel; + + /** The “base path” textfield. */ + private JTextField basePathTextField; + /** * Creates a new project panel. * @@ -82,6 +93,7 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { super(new BorderLayout(12, 12)); this.swingInterface = swingInterface; this.project = project; + initActions(); initComponents(); } @@ -103,6 +115,22 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { // /** + * Initializes all actions. + */ + private void initActions() { + changeBasePathAction = new I18nAction("projectPanel.button.changeBasePath") { + + /** + * {@inheritDoc} + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + changeBasePath(); + } + }; + } + + /** * Initializes all components of the panel. */ private void initComponents() { @@ -127,15 +155,23 @@ 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, 1, 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, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 6, 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, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0)); + propertiesPanel.add(descriptionTextField, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0)); + + basePathTextField = new JTextField(project.getBasePath()); + basePathTextField.setEditable(false); + basePathLabel = new I18nLabel("projectPanel.label.basePath"); + JButton changeBasePathButton = new JButton(changeBasePathAction); + 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(new JPanel(), new GridBagConstraints(0, 2, 2, 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, 3, 3, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); return propertiesPanel; } @@ -170,6 +206,17 @@ public class ProjectPanel extends JPanel implements DocumentListener, I18nable { } // + // PRIVATE ACTIONS + // + + /** + * Lets the user select a new base path and repopulates the file list. + */ + private void changeBasePath() { + /* TODO - edit base path */ + } + + // // INTERFACE I18nable // diff --git a/src/net/pterodactylus/jsite/i18n/jSite.properties b/src/net/pterodactylus/jsite/i18n/jSite.properties index 7fd5ab2..5e10f82 100644 --- a/src/net/pterodactylus/jsite/i18n/jSite.properties +++ b/src/net/pterodactylus/jsite/i18n/jSite.properties @@ -174,6 +174,15 @@ projectPanel.label.name.mnemonic: VK_N projectPanel.label.description.name: Description projectPanel.label.description.mnemonic: VK_D +projectPanel.label.basePath.name: Base Path +projectPanel.label.basePath.mnemonic: VK_B + +projectPanel.button.changeBasePath.name: Change +projectPanel.button.changeBasePath.mnemonic: VK_C +projectPanel.button.changeBasePath.accelerator: Ctrl-VK_C +projectPanel.button.changeBasePath.shortDescription: Changes the path the files are read from +projectPanel.button.changeBasePath.longDescription: Changes the path the files are read from + # # the "manage nodes" dialog # diff --git a/src/net/pterodactylus/jsite/i18n/jSite_de.properties b/src/net/pterodactylus/jsite/i18n/jSite_de.properties index 06ef092..c026e62 100644 --- a/src/net/pterodactylus/jsite/i18n/jSite_de.properties +++ b/src/net/pterodactylus/jsite/i18n/jSite_de.properties @@ -174,6 +174,15 @@ projectPanel.label.name.mnemonic: VK_N projectPanel.label.description.name: Beschreibung projectPanel.label.description.mnemonic: VK_B +projectPanel.label.basePath.name: Basispfad +projectPanel.label.basePath.mnemonic: VK_B + +projectPanel.button.changeBasePath.name: \u00c4ndern +projectPanel.button.changeBasePath.mnemonic: VK_N +projectPanel.button.changeBasePath.accelerator: Ctrl-VK_N +projectPanel.button.changeBasePath.shortDescription: \u00c4ndert den Basispfad, aus dem die Dateien gelesen werden +projectPanel.button.changeBasePath.longDescription: \u00c4ndert den Basispfad, aus dem die Dateien gelesen werden + # # the "manage nodes" dialog #