Rename "Analyze" panel to "Tools" panel

This commit is contained in:
Reinhard Pointner 2016-03-11 04:51:27 +00:00
parent 1251fbd657
commit d53dd1ffec
5 changed files with 43 additions and 33 deletions

View File

@ -1,9 +1,5 @@
package net.filebot.ui.analyze; package net.filebot.ui.analyze;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
@ -15,36 +11,23 @@ public class AnalyzePanel extends JComponent {
private final JTabbedPane toolsPanel = new JTabbedPane(); private final JTabbedPane toolsPanel = new JTabbedPane();
public AnalyzePanel() { public AnalyzePanel() {
toolsPanel.setBorder(BorderFactory.createTitledBorder("Tools"));
setLayout(new MigLayout("insets dialog, gapx 50, fill")); setLayout(new MigLayout("insets dialog, gapx 50, fill"));
add(fileTreePanel, "grow, sizegroupx column"); add(fileTreePanel, "grow, sizegroupx column");
add(toolsPanel, "grow, sizegroupx column"); add(toolsPanel, "grow, sizegroupx column");
addTool(new ExtractTool());
addTool(new TypeTool());
addTool(new SplitTool());
addTool(new AttributeTool());
putClientProperty("transferablePolicy", fileTreePanel.getTransferablePolicy()); putClientProperty("transferablePolicy", fileTreePanel.getTransferablePolicy());
fileTreePanel.addPropertyChangeListener("filetree", filetreeListener); fileTreePanel.addPropertyChangeListener("filetree", evt -> {
}
private void addTool(Tool<?> tool) {
toolsPanel.addTab(tool.getName(), tool);
}
private final PropertyChangeListener filetreeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
// stopped loading, refresh tools // stopped loading, refresh tools
for (int i = 0; i < toolsPanel.getTabCount(); i++) { for (int i = 0; i < toolsPanel.getTabCount(); i++) {
Tool<?> tool = (Tool<?>) toolsPanel.getComponentAt(i); Tool<?> tool = (Tool<?>) toolsPanel.getComponentAt(i);
tool.updateRoot(fileTreePanel.getFileTree().getRoot().getFile()); tool.updateRoot(fileTreePanel.getFileTree().getRoot().getFile());
} }
});
}
public void addTool(Tool<?> tool) {
toolsPanel.addTab(tool.getName(), tool);
} }
};
} }

View File

@ -1,31 +1,33 @@
package net.filebot.ui.analyze; package net.filebot.ui.analyze;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import net.filebot.ResourceManager; import net.filebot.ResourceManager;
import net.filebot.ui.PanelBuilder; import net.filebot.ui.PanelBuilder;
public class AnalyzePanelBuilder implements PanelBuilder { public class AnalyzePanelBuilder implements PanelBuilder {
@Override @Override
public String getName() { public String getName() {
return "Analyze"; return "Filter";
} }
@Override @Override
public Icon getIcon() { public Icon getIcon() {
return ResourceManager.getIcon("panel.analyze"); return ResourceManager.getIcon("panel.analyze");
} }
@Override @Override
public JComponent create() { 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;
} }
} }

View File

@ -9,7 +9,7 @@ import net.filebot.ResourceManager;
import net.filebot.util.ui.FancyTreeCellRenderer; import net.filebot.util.ui.FancyTreeCellRenderer;
import net.filebot.util.ui.GradientStyle; import net.filebot.util.ui.GradientStyle;
public class FileTreeCellRenderer extends FancyTreeCellRenderer { class FileTreeCellRenderer extends FancyTreeCellRenderer {
public FileTreeCellRenderer() { public FileTreeCellRenderer() {
super(GradientStyle.TOP_TO_BOTTOM); super(GradientStyle.TOP_TO_BOTTOM);

View File

@ -0,0 +1,25 @@
package net.filebot.ui.analyze;
import java.io.File;
import javax.swing.table.TableModel;
class MediaInfoTool extends Tool<TableModel> {
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
}
}

View File

@ -13,14 +13,14 @@ import javax.swing.JComponent;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import org.apache.commons.io.FileUtils;
import net.filebot.ui.analyze.FileTree.FileNode; import net.filebot.ui.analyze.FileTree.FileNode;
import net.filebot.ui.analyze.FileTree.FolderNode; import net.filebot.ui.analyze.FileTree.FolderNode;
import net.filebot.util.ExceptionUtilities; import net.filebot.util.ExceptionUtilities;
import net.filebot.util.FileUtilities; import net.filebot.util.FileUtilities;
import net.filebot.util.ui.LoadingOverlayPane; import net.filebot.util.ui.LoadingOverlayPane;
import org.apache.commons.io.FileUtils;
abstract class Tool<M> extends JComponent { abstract class Tool<M> extends JComponent {
private UpdateModelTask updateTask = null; private UpdateModelTask updateTask = null;