|
|
@@ -22,6 +22,7 @@ import java.awt.Insets;
|
|
|
@FieldDefaults(level=AccessLevel.PRIVATE)
|
|
|
public class RestPanel extends JPanel {
|
|
|
ObservableListener<JFormattedTextField, Rest> durationController;
|
|
|
+ ObservableListener<JFormattedTextField, Rest> upToController;
|
|
|
|
|
|
JComboBox<Rest.Where> jcbLocation;
|
|
|
|
|
|
@@ -30,9 +31,9 @@ public class RestPanel extends JPanel {
|
|
|
|
|
|
public RestPanel() {
|
|
|
GridBagLayout gridBagLayout = new GridBagLayout();
|
|
|
- gridBagLayout.columnWidths = new int[]{0, 0, 0, 0};
|
|
|
+ gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0};
|
|
|
gridBagLayout.rowHeights = new int[]{0, 0};
|
|
|
- gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
|
|
|
+ gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
|
|
|
gridBagLayout.rowWeights = new double[]{0.0, Double.MIN_VALUE};
|
|
|
setLayout(gridBagLayout);
|
|
|
|
|
|
@@ -55,13 +56,21 @@ public class RestPanel extends JPanel {
|
|
|
gbc_panelDuration.gridx = 2;
|
|
|
gbc_panelDuration.gridy = 0;
|
|
|
add(panelDuration, gbc_panelDuration);
|
|
|
-
|
|
|
+
|
|
|
+ DurationPanel panelUpTo = new DurationPanel("and up to");
|
|
|
+ GridBagConstraints gbc_panelUpTo = new GridBagConstraints();
|
|
|
+ gbc_panelUpTo.gridx = 3;
|
|
|
+ gbc_panelUpTo.gridy = 0;
|
|
|
+ add(panelUpTo, gbc_panelUpTo);
|
|
|
+
|
|
|
jcbLocation.addItemListener(e -> {
|
|
|
panelDuration.txtTime.setEditable(!e.getItem().equals(Rest.Where.NONE));
|
|
|
this.model.setWhere(Rest.Where.class.cast(e.getItem()));
|
|
|
});
|
|
|
durationController = ObservableController.from(panelDuration.txtTime,
|
|
|
Rest::getDuration, Rest::setDuration);
|
|
|
+ upToController = ObservableController.from(panelUpTo.txtTime,
|
|
|
+ Rest::getUpTo, Rest::setUpTo);
|
|
|
|
|
|
panelDuration.txtTime.setEditable(false);
|
|
|
}
|
|
|
@@ -75,6 +84,7 @@ public class RestPanel extends JPanel {
|
|
|
this.model = rest;
|
|
|
jcbLocation.setSelectedItem(rest.getWhere());
|
|
|
durationController.setObserved(rest);
|
|
|
+ upToController.setObserved(rest);
|
|
|
}
|
|
|
|
|
|
@Override
|