From 1c5c5607584dcf99ffe5c6e9b540ac7ea1cd1ea1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 27 May 2008 08:49:17 +0200 Subject: [PATCH] =?utf8?q?add=20label=20above=20project=20files=20add=20?= =?utf8?q?=E2=80=9Cauto-detect=E2=80=9D=20mime=20type=20to=20front=20of=20?= =?utf8?q?list?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/net/pterodactylus/jsite/gui/FileManager.java | 34 +++++++++++++++++++--- src/net/pterodactylus/jsite/i18n/jSite.properties | 3 ++ .../pterodactylus/jsite/i18n/jSite_de.properties | 13 +++++---- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/net/pterodactylus/jsite/gui/FileManager.java b/src/net/pterodactylus/jsite/gui/FileManager.java index 6b48fa1..d84b6d2 100644 --- a/src/net/pterodactylus/jsite/gui/FileManager.java +++ b/src/net/pterodactylus/jsite/gui/FileManager.java @@ -44,6 +44,8 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.event.TreeModelListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; @@ -64,7 +66,7 @@ import net.pterodactylus.util.swing.SwingUtils; * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ -public class FileManager extends JDialog implements I18nable { +public class FileManager extends JDialog implements I18nable, TreeSelectionListener { /** Logger. */ private static final Logger logger = Logging.getLogger(FileManager.class.getName()); @@ -78,6 +80,9 @@ public class FileManager extends JDialog implements I18nable { /** The “close” action. */ private I18nAction closeAction; + /** The “project files” label. */ + private I18nLabel projectFilesLabel; + /** The tree that shows the files. */ private JTree fileTree; @@ -159,19 +164,29 @@ public class FileManager extends JDialog implements I18nable { */ private Component createFileManagerPanel() { JPanel fileManagerPanel = new JPanel(new BorderLayout(12, 12)); - fileManagerPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(12, 12, 12, 12))); + JPanel fileTreePanel = new JPanel(new BorderLayout(12, 12)); + fileManagerPanel.add(fileTreePanel, BorderLayout.LINE_START); + fileTree = new JTree(fileTreeModel); - fileManagerPanel.add(new JScrollPane(fileTree), BorderLayout.LINE_START); fileTree.setShowsRootHandles(false); + fileTreePanel.add(new JScrollPane(fileTree), BorderLayout.CENTER); + + projectFilesLabel = new I18nLabel("fileManager.label.projectFiles", fileTree); + JPanel projectFilesLabelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); + fileTreePanel.add(projectFilesLabelPanel, BorderLayout.NORTH); + projectFilesLabelPanel.add(projectFilesLabel); JPanel propertiesPanel = new JPanel(new GridBagLayout()); fileManagerPanel.add(propertiesPanel, BorderLayout.CENTER); + propertiesPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(12, 12, 12, 12))); insertCheckBox = new JCheckBox(insertAction); propertiesPanel.add(insertCheckBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); - mimeTypeComboBox = new JComboBox(MimeTypes.getAllMimeTypes().toArray(new String[0])); + List allMimeTypes = MimeTypes.getAllMimeTypes(); + allMimeTypes.add(0, "auto-detect"); + mimeTypeComboBox = new JComboBox(allMimeTypes.toArray(new String[0])); mimeTypeLabel = new I18nLabel("fileManager.label.mimeType", mimeTypeComboBox); propertiesPanel.add(mimeTypeLabel, 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(mimeTypeComboBox, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0)); @@ -208,6 +223,17 @@ public class FileManager extends JDialog implements I18nable { setTitle(I18n.get("fileManager.title", project.getName())); } + // + // INTERFACE TreeSelectionListener + // + + /** + * {@inheritDoc} + */ + public void valueChanged(TreeSelectionEvent treeSelectionEvent) { + /* TODO - implement */ + } + /** * Model for the tree of files. * diff --git a/src/net/pterodactylus/jsite/i18n/jSite.properties b/src/net/pterodactylus/jsite/i18n/jSite.properties index 1a513eb..b1b897c 100644 --- a/src/net/pterodactylus/jsite/i18n/jSite.properties +++ b/src/net/pterodactylus/jsite/i18n/jSite.properties @@ -328,6 +328,9 @@ fileManager.button.close.longDescription: Close the file manager fileManager.label.mimeType.name: MIME Type fileManager.label.mimeType.mnemonic: VK_M +fileManager.label.projectFiles.name: Project Files +fileManager.label.projectFiles.mnemonic: VK_F + fileManager.checkbox.insertFile.name: Insert file fileManager.checkbox.insertFile.mnemonic: VK_I fileManager.checkbox.insertFile.accelerator: Ctrl-VK_I diff --git a/src/net/pterodactylus/jsite/i18n/jSite_de.properties b/src/net/pterodactylus/jsite/i18n/jSite_de.properties index 3572501..097d21a 100644 --- a/src/net/pterodactylus/jsite/i18n/jSite_de.properties +++ b/src/net/pterodactylus/jsite/i18n/jSite_de.properties @@ -196,11 +196,11 @@ 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 -projectPanel.button.editFiles.name: Edit Files -projectPanel.button.editFiles.mnemonic: VK_E -projectPanel.button.editFiles.accelerator: Ctrl-VK_E -projectPanel.button.editFiles.shortDescription: Edit physical and virtual files -projectPanel.button.editFiles.longDescription: Edit physical and virtual files +projectPanel.button.editFiles.name: Verwalten +projectPanel.button.editFiles.mnemonic: VK_V +projectPanel.button.editFiles.accelerator: Ctrl-VK_V +projectPanel.button.editFiles.shortDescription: Verwaltet physikalische und virtuelle Dateien +projectPanel.button.editFiles.longDescription: Verwaltet physikalische und virtuelle Dateien # the "edit node" dialog editNodeDialog.title: Edit Node @@ -328,6 +328,9 @@ fileManager.button.close.longDescription: Beendet die Dateiverwaltung fileManager.label.mimeType.name: MIME Type fileManager.label.mimeType.mnemonic: VK_M +fileManager.label.projectFiles.name: Projektdateien +fileManager.label.projectFiles.mnemonic: VK_D + fileManager.checkbox.insertFile.name: Datei einf\u00fcgen fileManager.checkbox.insertFile.mnemonic: VK_E fileManager.checkbox.insertFile.accelerator: Ctrl-VK_E -- 2.7.4