From d53dd1ffecd7d30bb2d39681ec18ae86b66997b9 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 11 Mar 2016 04:51:27 +0000 Subject: [PATCH] Rename "Analyze" panel to "Tools" panel --- .../net/filebot/ui/analyze/AnalyzePanel.java | 31 +++++-------------- .../ui/analyze/AnalyzePanelBuilder.java | 14 +++++---- .../ui/analyze/FileTreeCellRenderer.java | 2 +- .../net/filebot/ui/analyze/MediaInfoTool.java | 25 +++++++++++++++ source/net/filebot/ui/analyze/Tool.java | 4 +-- 5 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 source/net/filebot/ui/analyze/MediaInfoTool.java diff --git a/source/net/filebot/ui/analyze/AnalyzePanel.java b/source/net/filebot/ui/analyze/AnalyzePanel.java index 4cfcfebd..fb723c98 100644 --- a/source/net/filebot/ui/analyze/AnalyzePanel.java +++ b/source/net/filebot/ui/analyze/AnalyzePanel.java @@ -1,9 +1,5 @@ package net.filebot.ui.analyze; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JTabbedPane; @@ -15,36 +11,23 @@ public class AnalyzePanel extends JComponent { private final JTabbedPane toolsPanel = new JTabbedPane(); public AnalyzePanel() { - toolsPanel.setBorder(BorderFactory.createTitledBorder("Tools")); - setLayout(new MigLayout("insets dialog, gapx 50, fill")); add(fileTreePanel, "grow, sizegroupx column"); add(toolsPanel, "grow, sizegroupx column"); - addTool(new ExtractTool()); - addTool(new TypeTool()); - addTool(new SplitTool()); - addTool(new AttributeTool()); - putClientProperty("transferablePolicy", fileTreePanel.getTransferablePolicy()); - fileTreePanel.addPropertyChangeListener("filetree", filetreeListener); - } - - private void addTool(Tool tool) { - toolsPanel.addTab(tool.getName(), tool); - } - - private final PropertyChangeListener filetreeListener = new PropertyChangeListener() { - - @Override - public void propertyChange(PropertyChangeEvent evt) { + fileTreePanel.addPropertyChangeListener("filetree", evt -> { // stopped loading, refresh tools for (int i = 0; i < toolsPanel.getTabCount(); i++) { Tool tool = (Tool) toolsPanel.getComponentAt(i); tool.updateRoot(fileTreePanel.getFileTree().getRoot().getFile()); } - } - }; + }); + } + + public void addTool(Tool tool) { + toolsPanel.addTab(tool.getName(), tool); + } } diff --git a/source/net/filebot/ui/analyze/AnalyzePanelBuilder.java b/source/net/filebot/ui/analyze/AnalyzePanelBuilder.java index 5c5e9942..9fcff711 100644 --- a/source/net/filebot/ui/analyze/AnalyzePanelBuilder.java +++ b/source/net/filebot/ui/analyze/AnalyzePanelBuilder.java @@ -1,31 +1,33 @@ package net.filebot.ui.analyze; - import javax.swing.Icon; import javax.swing.JComponent; import net.filebot.ResourceManager; import net.filebot.ui.PanelBuilder; - public class AnalyzePanelBuilder implements PanelBuilder { @Override public String getName() { - return "Analyze"; + return "Filter"; } - @Override public Icon getIcon() { return ResourceManager.getIcon("panel.analyze"); } - @Override public JComponent create() { - return new AnalyzePanel(); + AnalyzePanel panel = new AnalyzePanel(); + panel.addTool(new MediaInfoTool()); + panel.addTool(new TypeTool()); + panel.addTool(new SplitTool()); + panel.addTool(new AttributeTool()); + panel.addTool(new ExtractTool()); + return panel; } } diff --git a/source/net/filebot/ui/analyze/FileTreeCellRenderer.java b/source/net/filebot/ui/analyze/FileTreeCellRenderer.java index 1942d052..acb5e270 100644 --- a/source/net/filebot/ui/analyze/FileTreeCellRenderer.java +++ b/source/net/filebot/ui/analyze/FileTreeCellRenderer.java @@ -9,7 +9,7 @@ import net.filebot.ResourceManager; import net.filebot.util.ui.FancyTreeCellRenderer; import net.filebot.util.ui.GradientStyle; -public class FileTreeCellRenderer extends FancyTreeCellRenderer { +class FileTreeCellRenderer extends FancyTreeCellRenderer { public FileTreeCellRenderer() { super(GradientStyle.TOP_TO_BOTTOM); diff --git a/source/net/filebot/ui/analyze/MediaInfoTool.java b/source/net/filebot/ui/analyze/MediaInfoTool.java new file mode 100644 index 00000000..2e4d2ff3 --- /dev/null +++ b/source/net/filebot/ui/analyze/MediaInfoTool.java @@ -0,0 +1,25 @@ +package net.filebot.ui.analyze; + +import java.io.File; + +import javax.swing.table.TableModel; + +class MediaInfoTool extends Tool { + + public MediaInfoTool() { + super("MediaInfo"); + } + + @Override + protected TableModel createModelInBackground(File root) throws InterruptedException { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void setModel(TableModel model) { + // TODO Auto-generated method stub + + } + +} diff --git a/source/net/filebot/ui/analyze/Tool.java b/source/net/filebot/ui/analyze/Tool.java index 4a6a4b6b..4f83653f 100644 --- a/source/net/filebot/ui/analyze/Tool.java +++ b/source/net/filebot/ui/analyze/Tool.java @@ -13,14 +13,14 @@ import javax.swing.JComponent; import javax.swing.SwingWorker; import javax.swing.tree.TreeNode; +import org.apache.commons.io.FileUtils; + import net.filebot.ui.analyze.FileTree.FileNode; import net.filebot.ui.analyze.FileTree.FolderNode; import net.filebot.util.ExceptionUtilities; import net.filebot.util.FileUtilities; import net.filebot.util.ui.LoadingOverlayPane; -import org.apache.commons.io.FileUtils; - abstract class Tool extends JComponent { private UpdateModelTask updateTask = null;