Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
4fc552d0
by Tony Chemit at 2021-01-18T17:41:08+01:00
7 changed files:
- client/core/src/main/java/fr/ird/observe/client/util/init/DefaultUIInitializer.java
- client/core/src/main/java/fr/ird/observe/client/util/init/UIInitHelper.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/ContentUIInitializer.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUI.jaxx
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUI.jcss
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetDetailCompositionUIInitializer.java
Changes:
| ... | ... | @@ -172,7 +172,7 @@ public class DefaultUIInitializer<UI extends JComponent & JAXXObject> extends UI |
| 172 | 172 |
|
| 173 | 173 |
protected void init(NumberEditor editor) {
|
| 174 | 174 |
initializerContext.checkFirstPass();
|
| 175 |
- editor.init();
|
|
| 175 |
+ UIInitHelper.init(editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton());
|
|
| 176 | 176 |
}
|
| 177 | 177 |
|
| 178 | 178 |
protected void init(DateTimeEditor editor) {
|
| ... | ... | @@ -175,11 +175,11 @@ public class UIInitHelper { |
| 175 | 175 |
}
|
| 176 | 176 |
|
| 177 | 177 |
|
| 178 |
- public static void init(JAXXObject ui, ObserveSwingValidator<?> validator, TemperatureEditor editor, boolean autoPopupNumberEditor, boolean showTimeEditorSlider) {
|
|
| 178 |
+ public static void init(JAXXObject ui, ObserveSwingValidator<?> validator, TemperatureEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton) {
|
|
| 179 | 179 |
NumberEditor numberEditor = editor.getEditor();
|
| 180 | 180 |
numberEditor.setShowReset(true);
|
| 181 | 181 |
numberEditor.setAutoPopup(autoPopupNumberEditor);
|
| 182 |
- numberEditor.setShowPopupButton(showTimeEditorSlider);
|
|
| 182 |
+ numberEditor.setShowPopupButton(showPopupButton);
|
|
| 183 | 183 |
String propertyName = editor.getName();
|
| 184 | 184 |
JLabel label = (JLabel) ui.getObjectById(propertyName + "Label");
|
| 185 | 185 |
Objects.requireNonNull(label, "can't find label for temperature editor " + editor);
|
| ... | ... | @@ -188,10 +188,10 @@ public class UIInitHelper { |
| 188 | 188 |
editor.getModel().addPropertyChangeListener("format", e -> validator.doValidate());
|
| 189 | 189 |
}
|
| 190 | 190 |
|
| 191 |
- public static void init(NumberEditor editor, boolean autoPopupNumberEditor, boolean showTimeEditorSlider) {
|
|
| 191 |
+ public static void init(NumberEditor editor, boolean autoPopupNumberEditor, boolean showPopupButton) {
|
|
| 192 | 192 |
editor.setShowReset(true);
|
| 193 | 193 |
editor.setAutoPopup(autoPopupNumberEditor);
|
| 194 |
- editor.setShowPopupButton(showTimeEditorSlider);
|
|
| 194 |
+ editor.setShowPopupButton(showPopupButton);
|
|
| 195 | 195 |
editor.init();
|
| 196 | 196 |
}
|
| 197 | 197 |
|
| ... | ... | @@ -236,7 +236,7 @@ public class ContentUIInitializer<UI extends ContentUI> extends UIInitializerSup |
| 236 | 236 |
if (ui instanceof EditableContentUI) {
|
| 237 | 237 |
validator = ((EditableContentUI<?>) ui).getValidator();
|
| 238 | 238 |
}
|
| 239 |
- UIInitHelper.init(ui, validator, editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowTimeEditorSlider());
|
|
| 239 |
+ UIInitHelper.init(ui, validator, editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton());
|
|
| 240 | 240 |
}
|
| 241 | 241 |
|
| 242 | 242 |
protected void init(JToolBar editor) {
|
| ... | ... | @@ -281,7 +281,7 @@ public class ContentUIInitializer<UI extends ContentUI> extends UIInitializerSup |
| 281 | 281 |
|
| 282 | 282 |
protected void init(NumberEditor editor) {
|
| 283 | 283 |
initializerContext.checkFirstPass();
|
| 284 |
- UIInitHelper.init(editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowTimeEditorSlider());
|
|
| 284 |
+ UIInitHelper.init(editor, getClientConfig().isAutoPopupNumberEditor(), getClientConfig().isShowNumberEditorButton());
|
|
| 285 | 285 |
}
|
| 286 | 286 |
|
| 287 | 287 |
public JComponent getActionContainer() {
|
| ... | ... | @@ -329,7 +329,7 @@ |
| 329 | 329 |
</JTabbedPane>
|
| 330 | 330 |
</cell>
|
| 331 | 331 |
</row>
|
| 332 |
- <row>
|
|
| 332 |
+ <row weighty="1">
|
|
| 333 | 333 |
<cell weighty="1" fill="both">
|
| 334 | 334 |
<BigTextEditor id="comment"/>
|
| 335 | 335 |
</cell>
|
| ... | ... | @@ -137,6 +137,10 @@ |
| 137 | 137 |
_showTimeEditorSlider:false;
|
| 138 | 138 |
}
|
| 139 | 139 |
|
| 140 |
+#snapWeight {
|
|
| 141 |
+ enabled:{Objects.equals(true, branchlineBean.getWeightedSnap())};
|
|
| 142 |
+}
|
|
| 143 |
+ |
|
| 140 | 144 |
#swivelWeight {
|
| 141 | 145 |
enabled:{Objects.equals(true, branchlineBean.getWeightedSwivel())};
|
| 142 | 146 |
}
|
| ... | ... | @@ -105,12 +105,15 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 105 | 105 |
ResetAction.installAction(ui, ui.getReset(), new DefaultResetAdapter<>() {
|
| 106 | 106 |
@Override
|
| 107 | 107 |
public void onUpdate(SetDetailCompositionUI ui) {
|
| 108 |
-// BranchlineDto branchline = ui.getBranchlinesTableModel().getSelectedRow();
|
|
| 108 |
+ BranchlineDto branchline = ui.getBranchlinesTableModel().getSelectedRow();
|
|
| 109 | 109 |
onBranchlineChanged(null);
|
| 110 | 110 |
ui.getSectionsTableModel().clear();
|
| 111 | 111 |
ui.getBasketsTableModel().clear();
|
| 112 | 112 |
ui.getBranchlinesTableModel().clear();
|
| 113 | 113 |
super.onUpdate(ui);
|
| 114 |
+ if (branchline != null && ui.getMainTabbedPane().getSelectedIndex() == 2) {
|
|
| 115 |
+ onBranchlineChanged(branchline);
|
|
| 116 |
+ }
|
|
| 114 | 117 |
}
|
| 115 | 118 |
});
|
| 116 | 119 |
ResetAction<SetDetailCompositionUI> action = ResetAction.prepareAction(new DefaultResetAdapter<>() {
|
| ... | ... | @@ -145,10 +148,10 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 145 | 148 |
// TODO Use a cache of templates on setLongline (session scope)
|
| 146 | 149 |
model.getStates().getSectionTemplatesTableModel().setData(new ArrayList<>());
|
| 147 | 150 |
|
| 148 |
- BranchlineDto selectedRow = model.getStates().getBranchlinesTableModel().getSelectedRow();
|
|
| 149 |
- if (ui.getMainTabbedPane().getSelectedIndex() == 2) {
|
|
| 150 |
- onBranchlineChanged(selectedRow);
|
|
| 151 |
- }
|
|
| 151 |
+// BranchlineDto selectedRow = model.getStates().getBranchlinesTableModel().getSelectedRow();
|
|
| 152 |
+// if (ui.getMainTabbedPane().getSelectedIndex() == 2) {
|
|
| 153 |
+// onBranchlineChanged(selectedRow);
|
|
| 154 |
+// }
|
|
| 152 | 155 |
}
|
| 153 | 156 |
|
| 154 | 157 |
@Override
|
| ... | ... | @@ -394,7 +397,7 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 394 | 397 |
ui.getValidator().setChanged(true);
|
| 395 | 398 |
}
|
| 396 | 399 |
|
| 397 |
- void onTimerChanged(Boolean newValue) {
|
|
| 400 |
+ void onTimerChanged(boolean newValue) {
|
|
| 398 | 401 |
if (Objects.equals(true, newValue)) {
|
| 399 | 402 |
// with timer
|
| 400 | 403 |
ui.getBranchlineBean().setTimeSinceContact(0);
|
| ... | ... | @@ -403,4 +406,24 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 403 | 406 |
ui.getBranchlineBean().setTimeSinceContact(null);
|
| 404 | 407 |
}
|
| 405 | 408 |
}
|
| 409 |
+ |
|
| 410 |
+ void onWeightedSnapChanged(boolean newValue) {
|
|
| 411 |
+ if (Objects.equals(true, newValue)) {
|
|
| 412 |
+ // with timer
|
|
| 413 |
+ ui.getBranchlineBean().setSnapWeight(0F);
|
|
| 414 |
+ } else {
|
|
| 415 |
+ // without timer
|
|
| 416 |
+ ui.getBranchlineBean().setSnapWeight(null);
|
|
| 417 |
+ }
|
|
| 418 |
+ }
|
|
| 419 |
+ |
|
| 420 |
+ void onWeightedSwivelChanged(boolean newValue) {
|
|
| 421 |
+ if (Objects.equals(true, newValue)) {
|
|
| 422 |
+ // with timer
|
|
| 423 |
+ ui.getBranchlineBean().setSwivelWeight(0F);
|
|
| 424 |
+ } else {
|
|
| 425 |
+ // without timer
|
|
| 426 |
+ ui.getBranchlineBean().setSwivelWeight(null);
|
|
| 427 |
+ }
|
|
| 428 |
+ }
|
|
| 406 | 429 |
}
|
| ... | ... | @@ -257,6 +257,18 @@ public class SetDetailCompositionUIInitializer extends ContentSimpleUIInitialize |
| 257 | 257 |
ui.getHandler().onTimerChanged(((BeanCheckBox) e.getSource()).isSelected());
|
| 258 | 258 |
}
|
| 259 | 259 |
});
|
| 260 |
+ UIInitHelper.setAction(ui.getWeightedSnap(), new AbstractAction() {
|
|
| 261 |
+ @Override
|
|
| 262 |
+ public void actionPerformed(ActionEvent e) {
|
|
| 263 |
+ ui.getHandler().onWeightedSnapChanged(((BeanCheckBox) e.getSource()).isSelected());
|
|
| 264 |
+ }
|
|
| 265 |
+ });
|
|
| 266 |
+ UIInitHelper.setAction(ui.getWeightedSwivel(), new AbstractAction() {
|
|
| 267 |
+ @Override
|
|
| 268 |
+ public void actionPerformed(ActionEvent e) {
|
|
| 269 |
+ ui.getHandler().onWeightedSwivelChanged(((BeanCheckBox) e.getSource()).isSelected());
|
|
| 270 |
+ }
|
|
| 271 |
+ });
|
|
| 260 | 272 |
SetDefaultTimerTimeOnBoard.init(ui, ui.getSetDefaultTimerTimeOnBoard(), new SetDefaultTimerTimeOnBoard<SetDetailCompositionUI>() {
|
| 261 | 273 |
@Override
|
| 262 | 274 |
protected Date getHaulingStartTimeStamp(SetDetailCompositionUI ui) {
|