X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FFileManager.java;h=d84b6d2589cb931c680cc0b164d042815edd7b76;hb=751f589bf2b601b1a34bf0f075a6c6bb2e1e1f66;hp=580aedd5bee9c138b91ba3f479614808cf530adf;hpb=13c5648feec9d69eff5a237c9ac360060fc8d0e8;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/FileManager.java b/src/net/pterodactylus/jsite/gui/FileManager.java index 580aedd..d84b6d2 100644 --- a/src/net/pterodactylus/jsite/gui/FileManager.java +++ b/src/net/pterodactylus/jsite/gui/FileManager.java @@ -36,6 +36,7 @@ import java.util.logging.Logger; import javax.swing.BorderFactory; import javax.swing.JButton; +import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFrame; @@ -43,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; @@ -63,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()); @@ -77,9 +80,18 @@ 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; + /** The “insert” action. */ + private I18nAction insertAction; + + /** The “insert” checkbox. */ + private JCheckBox insertCheckBox; + /** The “mime type” label. */ private I18nLabel mimeTypeLabel; @@ -122,6 +134,14 @@ public class FileManager extends JDialog implements I18nable { setVisible(false); } }; + insertAction = new I18nAction("fileManager.checkbox.insertFile") { + /** + * {@inheritDoc} + */ + public void actionPerformed(ActionEvent actionEvent) { + /* TODO - implements. */ + } + }; } /** @@ -144,21 +164,34 @@ 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])); - 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)); + 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)); - 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)); + propertiesPanel.add(new JPanel(), new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); return fileManagerPanel; } @@ -190,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. *