|
|
|
@ -23,6 +23,8 @@ import de.srsoftware.tools.gui.DateChooser;
@@ -23,6 +23,8 @@ import de.srsoftware.tools.gui.DateChooser;
|
|
|
|
|
import de.srsoftware.tools.gui.SelectComboBox; |
|
|
|
|
|
|
|
|
|
import static de.srsoftware.belegscanner.Application.*; |
|
|
|
|
import static javax.swing.BoxLayout.X_AXIS; |
|
|
|
|
import static javax.swing.BoxLayout.Y_AXIS; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* create the application's toolbar |
|
|
|
@ -66,7 +68,7 @@ public class Toolbar extends JPanel {
@@ -66,7 +68,7 @@ public class Toolbar extends JPanel {
|
|
|
|
|
public Toolbar(Worker worker) { |
|
|
|
|
this.worker = worker; |
|
|
|
|
worker.setToolbar(this); |
|
|
|
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
|
|
|
|
setLayout(new BoxLayout(this, Y_AXIS)); |
|
|
|
|
add(datePicker()); |
|
|
|
|
add(input(t("Category"),catPicker = categoryPicker())); |
|
|
|
|
add(input(t("Path"),pathPicker = pathPicker())); |
|
|
|
@ -75,11 +77,18 @@ public class Toolbar extends JPanel {
@@ -75,11 +77,18 @@ public class Toolbar extends JPanel {
|
|
|
|
|
add(new ImproveSelector(worker)); |
|
|
|
|
add(new RotationSelector(worker)); |
|
|
|
|
add(new TypeSelector(worker)); |
|
|
|
|
add(scanButton()); |
|
|
|
|
var buttonBox = new JPanel(); |
|
|
|
|
buttonBox.setLayout(new BoxLayout(buttonBox,X_AXIS)); |
|
|
|
|
buttonBox.add(scanButton()); |
|
|
|
|
buttonBox.add(Box.createRigidArea(new Dimension(10,10))); |
|
|
|
|
buttonBox.add(helpButton()); |
|
|
|
|
add(buttonBox); |
|
|
|
|
add(Box.createGlue()); |
|
|
|
|
Arrays.stream(getComponents()).filter(c -> c instanceof JPanel).map(JPanel.class::cast).forEach(p -> p.setBorder(BORDER)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SelectComboBox categoryPicker() { |
|
|
|
|
return new SelectComboBox(worker.getCategories().keySet()).onUpdateText(worker::setCat).onDelete(worker::dropCategory); |
|
|
|
|
} |
|
|
|
@ -106,6 +115,16 @@ public class Toolbar extends JPanel {
@@ -106,6 +115,16 @@ public class Toolbar extends JPanel {
|
|
|
|
|
.forEach(this::remove); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* create help button |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private Component helpButton() { |
|
|
|
|
var button = new JButton(t("help")); |
|
|
|
|
button.addActionListener(ev -> worker.showHelp()); |
|
|
|
|
return button; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* creates a labeled input field |
|
|
|
|
* @param caption |
|
|
|
@ -116,7 +135,7 @@ public class Toolbar extends JPanel {
@@ -116,7 +135,7 @@ public class Toolbar extends JPanel {
|
|
|
|
|
component.setMaximumSize(new Dimension(600, 40)); |
|
|
|
|
component.setToolTipText(t("Press Shift + Delete to remove an entry.")); |
|
|
|
|
JPanel panel = new JPanel(); |
|
|
|
|
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); |
|
|
|
|
panel.setLayout(new BoxLayout(panel, X_AXIS)); |
|
|
|
|
panel.add(new JLabel(caption+": ")); |
|
|
|
|
panel.add(component); |
|
|
|
|
return panel; |
|
|
|
|