add label above project files
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 May 2008 06:49:17 +0000 (08:49 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 May 2008 06:49:17 +0000 (08:49 +0200)
add “auto-detect” mime type to front of list

src/net/pterodactylus/jsite/gui/FileManager.java
src/net/pterodactylus/jsite/i18n/jSite.properties
src/net/pterodactylus/jsite/i18n/jSite_de.properties

index 6b48fa1..d84b6d2 100644 (file)
@@ -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 &lt;bombe@freenetproject.org&gt;
  */
-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<String> 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.
         * 
index 1a513eb..b1b897c 100644 (file)
@@ -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
index 3572501..097d21a 100644 (file)
@@ -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