add mime type combo box
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 May 2008 00:03:51 +0000 (02:03 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 May 2008 00:03:51 +0000 (02:03 +0200)
src/net/pterodactylus/jsite/gui/FileManager.java

index 7ce0d41..580aedd 100644 (file)
@@ -22,6 +22,9 @@ package net.pterodactylus.jsite.gui;
 import java.awt.BorderLayout;
 import java.awt.Component;
 import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -33,6 +36,7 @@ import java.util.logging.Logger;
 
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
+import javax.swing.JComboBox;
 import javax.swing.JDialog;
 import javax.swing.JFrame;
 import javax.swing.JPanel;
@@ -45,10 +49,12 @@ import javax.swing.tree.TreePath;
 import net.pterodactylus.jsite.i18n.I18n;
 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.Entry;
 import net.pterodactylus.jsite.project.Project;
 import net.pterodactylus.util.data.Node;
 import net.pterodactylus.util.data.Tree;
+import net.pterodactylus.util.io.MimeTypes;
 import net.pterodactylus.util.logging.Logging;
 import net.pterodactylus.util.swing.SwingUtils;
 
@@ -74,6 +80,12 @@ public class FileManager extends JDialog implements I18nable {
        /** The tree that shows the files. */
        private JTree fileTree;
 
+       /** The “mime type” label. */
+       private I18nLabel mimeTypeLabel;
+
+       /** The “mime type” combo box. */
+       private JComboBox mimeTypeComboBox;
+
        /**
         * Creates a new file manager.
         * 
@@ -89,7 +101,8 @@ public class FileManager extends JDialog implements I18nable {
                fileTreeModel = new FileTreeModel();
                initActions();
                initComponents();
-               SwingUtils.repackCentered(this);
+               pack();
+               SwingUtils.center(this);
        }
 
        //
@@ -134,8 +147,18 @@ public class FileManager extends JDialog implements I18nable {
                fileManagerPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(12, 12, 12, 12)));
 
                fileTree = new JTree(fileTreeModel);
+               fileManagerPanel.add(new JScrollPane(fileTree), BorderLayout.LINE_START);
                fileTree.setShowsRootHandles(false);
-               fileManagerPanel.add(new JScrollPane(fileTree), BorderLayout.CENTER);
+
+               JPanel propertiesPanel = new JPanel(new GridBagLayout());
+               fileManagerPanel.add(propertiesPanel, BorderLayout.CENTER);
+
+               mimeTypeComboBox = new JComboBox(MimeTypes.getAllMimeTypes().toArray(new String[0]));
+               mimeTypeLabel = new I18nLabel("projectPanel.label.mimeType", mimeTypeComboBox);
+               propertiesPanel.add(mimeTypeLabel, 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(mimeTypeComboBox, 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(new JPanel(), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
 
                return fileManagerPanel;
        }