* use MigLayout in RenamePanel

* some layout improvements in other panels
This commit is contained in:
Reinhard Pointner 2008-10-20 18:42:52 +00:00
parent bc0e354a7a
commit a77ff635da
7 changed files with 44 additions and 71 deletions

View File

@ -13,6 +13,8 @@ public class FileBotPanel extends JPanel {
public FileBotPanel(String title, Icon icon) { public FileBotPanel(String title, Icon icon) {
super(null);
this.name = title; this.name = title;
this.icon = icon; this.icon = icon;
} }

View File

@ -32,7 +32,7 @@ public class AnalyzePanel extends FileBotPanel {
toolsPanel.setBorder(BorderFactory.createTitledBorder("Tools")); toolsPanel.setBorder(BorderFactory.createTitledBorder("Tools"));
setLayout(new MigLayout("insets 0,gapx 50, fill")); setLayout(new MigLayout("insets 0, gapx 50, fill"));
add(fileTreePanel, "grow"); add(fileTreePanel, "grow");
add(toolsPanel, "grow"); add(toolsPanel, "grow");

View File

@ -12,7 +12,6 @@ import java.util.logging.Logger;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JSpinner; import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel; import javax.swing.SpinnerNumberModel;
@ -42,7 +41,7 @@ public class SplitPanel extends ToolPanel implements ChangeListener {
public SplitPanel() { public SplitPanel() {
super("Split"); super("Split");
setLayout(new MigLayout("nogrid, flowx, insets 0, fill", "align center")); setLayout(new MigLayout("insets 0, nogrid, fill", "align center"));
JScrollPane treeScrollPane = new JScrollPane(tree); JScrollPane treeScrollPane = new JScrollPane(tree);
treeScrollPane.setBorder(BorderFactory.createEmptyBorder()); treeScrollPane.setBorder(BorderFactory.createEmptyBorder());
@ -50,9 +49,6 @@ public class SplitPanel extends ToolPanel implements ChangeListener {
JSpinner spinner = new JSpinner(spinnerModel); JSpinner spinner = new JSpinner(spinnerModel);
spinner.setEditor(new JSpinner.NumberEditor(spinner, "#")); spinner.setEditor(new JSpinner.NumberEditor(spinner, "#"));
JPanel spinnerPanel = new JPanel(new MigLayout("nogrid, flowx"));
spinnerPanel.setOpaque(false);
LoadingOverlayPane loadingOverlayPane = new LoadingOverlayPane(treeScrollPane, ResourceManager.getIcon("loading")); LoadingOverlayPane loadingOverlayPane = new LoadingOverlayPane(treeScrollPane, ResourceManager.getIcon("loading"));
loadingOverlayPane.setBorder(new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM)); loadingOverlayPane.setBorder(new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM));

View File

@ -58,7 +58,7 @@ public class ListPanel extends FileBotPanel {
fromSpinner.setEditor(new JSpinner.NumberEditor(fromSpinner, "#")); fromSpinner.setEditor(new JSpinner.NumberEditor(fromSpinner, "#"));
toSpinner.setEditor(new JSpinner.NumberEditor(toSpinner, "#")); toSpinner.setEditor(new JSpinner.NumberEditor(toSpinner, "#"));
setLayout(new MigLayout("nogrid, flowx, insets dialog, fill", "align center")); setLayout(new MigLayout("insets dialog, nogrid, fill", "align center"));
add(new JLabel("Pattern:"), "gapbefore indent"); add(new JLabel("Pattern:"), "gapbefore indent");
add(textField, "gap related, wmin 2cm"); add(textField, "gap related, wmin 2cm");
@ -71,9 +71,9 @@ public class ListPanel extends FileBotPanel {
add(list, "grow"); add(list, "grow");
// panel with buttons that will be added inside the list component // panel with buttons that will be added inside the list component
JPanel buttonPanel = new JPanel(new MigLayout("insets 5px, nogrid, flowx, fill", "align center")); JPanel buttonPanel = new JPanel(new MigLayout("insets 1.2mm, nogrid, fill", "align center"));
buttonPanel.add(new JButton(new LoadAction(list.getTransferablePolicy()))); buttonPanel.add(new JButton(new LoadAction(list.getTransferablePolicy())));
buttonPanel.add(new JButton(new SaveAction(list.getExportHandler())), "gap unrelated"); buttonPanel.add(new JButton(new SaveAction(list.getExportHandler())), "gap related");
list.add(buttonPanel, BorderLayout.SOUTH); list.add(buttonPanel, BorderLayout.SOUTH);

View File

@ -10,12 +10,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JViewport; import javax.swing.JViewport;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.border.EmptyBorder;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager; import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.ui.FileBotList; import net.sourceforge.filebot.ui.FileBotList;
import net.sourceforge.filebot.ui.panel.rename.entry.ListEntry; import net.sourceforge.filebot.ui.panel.rename.entry.ListEntry;
@ -29,17 +29,6 @@ class RenameList<E extends ListEntry> extends FileBotList<E> {
public RenameList() { public RenameList() {
Box buttons = Box.createHorizontalBox();
buttons.setBorder(new EmptyBorder(5, 5, 5, 5));
buttons.add(Box.createGlue());
buttons.add(new JButton(downAction));
buttons.add(new JButton(upAction));
buttons.add(Box.createHorizontalStrut(10));
buttons.add(loadButton);
buttons.add(Box.createGlue());
add(buttons, BorderLayout.SOUTH);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addMouseListener(dndReorderMouseAdapter); list.addMouseListener(dndReorderMouseAdapter);
@ -49,6 +38,14 @@ class RenameList<E extends ListEntry> extends FileBotList<E> {
viewport.setBackground(list.getBackground()); viewport.setBackground(list.getBackground());
getRemoveAction().setEnabled(true); getRemoveAction().setEnabled(true);
JPanel buttonPanel = new JPanel(new MigLayout("insets 1.2mm, nogrid, fill", "align center"));
buttonPanel.add(new JButton(downAction));
buttonPanel.add(new JButton(upAction), "gap 0");
buttonPanel.add(loadButton, "gap 10px");
add(buttonPanel, BorderLayout.SOUTH);
} }

View File

@ -2,8 +2,6 @@
package net.sourceforge.filebot.ui.panel.rename; package net.sourceforge.filebot.ui.panel.rename;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font; import java.awt.Font;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -11,8 +9,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultListSelectionModel; import javax.swing.DefaultListSelectionModel;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JList; import javax.swing.JList;
@ -25,6 +21,7 @@ import javax.swing.SwingUtilities;
import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener; import javax.swing.event.ListDataListener;
import net.miginfocom.swing.MigLayout;
import net.sourceforge.filebot.ResourceManager; import net.sourceforge.filebot.ResourceManager;
import net.sourceforge.filebot.ui.FileBotPanel; import net.sourceforge.filebot.ui.FileBotPanel;
import net.sourceforge.filebot.ui.panel.rename.entry.FileEntry; import net.sourceforge.filebot.ui.panel.rename.entry.FileEntry;
@ -75,57 +72,38 @@ public class RenamePanel extends FileBotPanel {
similarityPanel.setVisible(false); similarityPanel.setVisible(false);
similarityPanel.setMetrics(matchAction.getMetrics()); similarityPanel.setMetrics(matchAction.getMetrics());
Box box = new Box(BoxLayout.X_AXIS); // create Match button
JButton matchButton = new JButton(matchAction);
matchButton.addMouseListener(new MatchPopupListener());
matchButton.setVerticalTextPosition(SwingConstants.BOTTOM);
matchButton.setHorizontalTextPosition(SwingConstants.CENTER);
box.add(namesList); // create Rename button
box.add(Box.createHorizontalStrut(10)); JButton renameButton = new JButton(renameAction);
box.add(createCenterBox()); renameButton.setVerticalTextPosition(SwingConstants.BOTTOM);
box.add(Box.createHorizontalStrut(10)); renameButton.setHorizontalTextPosition(SwingConstants.CENTER);
Box subBox = Box.createVerticalBox(); setLayout(new MigLayout("insets 0, gapx 10px, fill", "", "align 33%"));
subBox.add(similarityPanel); add(namesList, "grow");
subBox.add(filesList);
box.add(subBox); // make buttons larger
matchButton.setMargin(new Insets(3, 14, 2, 14));
renameButton.setMargin(new Insets(6, 11, 2, 11));
add(box, BorderLayout.CENTER); add(matchButton, "cell 1 0, flowy");
add(renameButton, "cell 1 0, gapy 30px");
add(filesList, "grow");
namesListComponent.getModel().addListDataListener(repaintOnDataChange); namesListComponent.getModel().addListDataListener(repaintOnDataChange);
filesListComponent.getModel().addListDataListener(repaintOnDataChange); filesListComponent.getModel().addListDataListener(repaintOnDataChange);
} }
private Box createCenterBox() {
Box centerBox = Box.createVerticalBox();
JButton matchButton = new JButton(matchAction);
matchButton.addMouseListener(new MatchPopupListener());
matchButton.setMargin(new Insets(3, 14, 2, 14));
matchButton.setVerticalTextPosition(SwingConstants.BOTTOM);
matchButton.setHorizontalTextPosition(SwingConstants.CENTER);
matchButton.setAlignmentX(Component.CENTER_ALIGNMENT);
JButton renameButton = new JButton(renameAction);
renameButton.setMargin(new Insets(6, 11, 2, 11));
renameButton.setVerticalTextPosition(SwingConstants.BOTTOM);
renameButton.setHorizontalTextPosition(SwingConstants.CENTER);
renameButton.setAlignmentX(Component.CENTER_ALIGNMENT);
centerBox.add(Box.createGlue());
centerBox.add(matchButton);
centerBox.add(Box.createVerticalStrut(30));
centerBox.add(renameButton);
centerBox.add(Box.createGlue());
centerBox.add(Box.createGlue());
return centerBox;
}
private final ListDataListener repaintOnDataChange = new ListDataListener() { private final ListDataListener repaintOnDataChange = new ListDataListener() {
public void contentsChanged(ListDataEvent e) { public void contentsChanged(ListDataEvent e) {
repaintBoth();
} }
@ -139,7 +117,7 @@ public class RenamePanel extends FileBotPanel {
} }
public void repaintBoth() { private void repaintBoth() {
namesList.repaint(); namesList.repaint();
filesList.repaint(); filesList.repaint();
} }

View File

@ -38,15 +38,15 @@ public class SfvPanel extends FileBotPanel {
setBorder(BorderFactory.createTitledBorder("SFV")); setBorder(BorderFactory.createTitledBorder("SFV"));
setLayout(new MigLayout("nogrid, flowx, insets 0, fill", "", "align bottom")); setLayout(new MigLayout("insets 0, nogrid, fill", "", "align bottom"));
add(new JScrollPane(sfvTable), "grow, gap bottom 5, wrap"); add(new JScrollPane(sfvTable), "grow, gap bottom 5px, wrap");
add(new JButton(loadAction), "gap right 5, gap bottom 4, gap left 15"); add(new JButton(loadAction), "gap 15px, gap bottom 4px");
add(new JButton(saveAction), "gap right 5, gap bottom 4"); add(new JButton(saveAction), "gap rel, gap bottom 4px");
add(new JButton(clearAction), "gap right 5, gap bottom 4"); add(new JButton(clearAction), "gap rel, gap bottom 4px");
add(totalProgressPanel, "gap left push, gap bottom 2, gap right 7, hidemode 3"); add(totalProgressPanel, "gap left indent:push, gap bottom 2px, gap right 7px, hidemode 3");
// Shortcut DELETE // Shortcut DELETE
TunedUtil.putActionForKeystroke(this, KeyStroke.getKeyStroke("pressed DELETE"), removeAction); TunedUtil.putActionForKeystroke(this, KeyStroke.getKeyStroke("pressed DELETE"), removeAction);