private JLabel browserError;
public BrowserControls(final ImageBrowserScrollPane browserScroll, ComboFrame frame) {
super(BoxLayout.X_AXIS);
AbstractImageBrowser browser = browserScroll.getBrowser();
RotateButtons rotators = new RotateButtons(browser);
ToggleTitleBorder.setBorder(rotators, LOCALE.get("RotateBorderTitle"));
BoxedButton rater = new BoxedButton(LOCALE.get("RateBorderTitle"), new RatingButton(browser));
CopyPasteButtons copyPaste = new CopyPasteButtons(browser);
ToggleTitleBorder.setBorder(copyPaste, LOCALE.get("CopyToolsBorderTitle"));
SortCtrl sort = new SortCtrl(browser);
ToggleTitleBorder.setBorder(sort, LOCALE.get("SortBorderTitle"));
SizeSlider sizeSlider = new SizeSlider(browser);
ToggleTitleBorder.setBorder(sizeSlider, LOCALE.get("SizeBorderTitle"));
// Use the centering layout only when the SizeSlider is working,
// so other size changes (like when files come and go) don't result
// in scroll jumps:
sizeSlider.addMouseListener(
new MouseAdapter() {
public void mousePressed(MouseEvent e) {
browserScroll.setCenteringLayout(true);
}
public void mouseReleased(MouseEvent e) {
browserScroll.setCenteringLayout(false);
}
}
);
BoxedButton collapse = new BoxedButton(LOCALE.get("CollapseBorderTitle"), new CollapseButton(frame));
BoxedButton latest = new BoxedButton(LOCALE.get("SelectBorderTitle"), new SelectLatestButton(browser));
BoxedButton trash = new BoxedButton(LOCALE.get("TrashBorderTitle"), new TrashButton(browser));
browserScroll.setCenteringLayout(false);
browserError = new JLabel();
browser.addBrowserListener(
new ImageBrowserListener() {
public void selectionChanged(ImageBrowserEvent event) {
// Clear any lingering error messages from a prior events
browserError.setText("");
}
public void imageDoubleClicked(ImageBrowserEvent event) {
}
public void browserError(String message) {
browserError.setText(message);
}
}
);
// add(Box.createHorizontalGlue());
add(Box.createHorizontalStrut(8));
add(rotators);
add(Box.createHorizontalStrut(8));
add(rater.box);
add(Box.createHorizontalStrut(8));
add(trash.box);
add(Box.createHorizontalStrut(8));
add(new Separator());
add(Box.createHorizontalStrut(8));
add(copyPaste);
add(Box.createHorizontalStrut(8));
add(Box.createHorizontalGlue());
add(browserError);
add(Box.createHorizontalStrut(8));
add(collapse.box);
add(Box.createHorizontalStrut(8));
add(latest.box);
add(Box.createHorizontalStrut(8));
add(new Separator());
add(Box.createHorizontalStrut(8));
add(sizeSlider);
add(Box.createHorizontalStrut(8));
add(sort);
add(Box.createHorizontalStrut(8));
// add(Box.createHorizontalGlue());
// Add space above and below, to tune the layout:
Border border = BorderFactory.createEmptyBorder(0, 0, 3, 0);
setBorder(border);
ImageDatumComparator comp = sort.getSort();
boolean inverted = sort.getSortInverted();
int size = sizeSlider.getValue();
browser.setSort(comp);
browser.setSortInverted(inverted);
browser.setCharacteristicSize(size);
}