Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
1786594d
by Tony Chemit at 2020-12-17T23:44:36+01:00
-
bf7c28c9
by Tony Chemit at 2020-12-17T23:46:05+01:00
-
453c24b9
by Tony Chemit at 2020-12-18T00:17:50+01:00
-
8ad27d89
by Tony Chemit at 2020-12-18T00:58:37+01:00
15 changed files:
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/actions/mode/ChangeModeExecutor.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/TripActionHelper.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/TripUIHelper.java
- client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/list/ContentListUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/landing/LandingUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SampleUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetGlobalCompositionUIHandler.java
- 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/SetDetailCompositionUIModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetGlobalCompositionUIHandler.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/composition/CompositionAutoSelectRowAndShowPopupAction.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/composition/SetDetailCompositionUIValidationHelper.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/composition/basket/BasketTableModel.java
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/composition/branchline/BranchlineTableModel.java
- pom.xml
Changes:
| ... | ... | @@ -121,7 +121,8 @@ public class ChangeModeExecutor<U extends ContentUI> { |
| 121 | 121 |
|
| 122 | 122 |
protected void afterOpenReselectNode(NavigationTree tree, NavigationNode selectedNode, String id) {
|
| 123 | 123 |
log.info("Will reselect node: " + selectedNode);
|
| 124 |
- SwingUtilities.invokeLater(() -> tree.reSelectSafeNode(selectedNode));
|
|
| 124 |
+// SwingUtilities.invokeLater(() -> tree.reSelectSafeNode(selectedNode));
|
|
| 125 |
+ tree.reSelectSafeNode(selectedNode);
|
|
| 125 | 126 |
}
|
| 126 | 127 |
|
| 127 | 128 |
}
|
| ... | ... | @@ -137,11 +137,17 @@ public abstract class TripActionHelper implements WithClientUIContext { |
| 137 | 137 |
NavigationNode tripNode = tree.getSelectedNode().upToReferenceNode(getReferenceType());
|
| 138 | 138 |
tree.selectSafeNode(tripNode);
|
| 139 | 139 |
TripUI<?> tripUI = (TripUI<?>) ui.getHandler().getDataSourceEditor().getModel().getContent();
|
| 140 |
+ if (tripNode.getInitializer().getEditNodeId() == null) {
|
|
| 141 |
+ ((ContentUI) tripUI).getMode().doClick();
|
|
| 142 |
+ tripUI = (TripUI<?>) ui.getHandler().getDataSourceEditor().getModel().getContent();
|
|
| 143 |
+ }
|
|
| 140 | 144 |
// set availability flag to true
|
| 141 | 145 |
tripUI.getModel().set(availabilityPropertyName, true);
|
| 142 | 146 |
// go to meta-data tab
|
| 143 | 147 |
TabInfo tabInfo = tabGetter.apply(tripUI);
|
| 144 |
- SwingUtilities.invokeLater(() -> tripUI.selectTab(tabInfo));
|
|
| 148 |
+ TripUI<?> finalTripUI = tripUI;
|
|
| 149 |
+ SwingUtilities.invokeLater(() -> finalTripUI.selectTab(tabInfo));
|
|
| 150 |
+ |
|
| 145 | 151 |
}
|
| 146 | 152 |
}
|
| 147 | 153 |
|
| ... | ... | @@ -91,6 +91,9 @@ public class TripUIHelper<D extends DataDto, U extends ContentOpenableUI<D, U> & |
| 91 | 91 |
}
|
| 92 | 92 |
|
| 93 | 93 |
private void buildTripMap() {
|
| 94 |
+ if (ui.getModel().getStates().isCreatingMode()) {
|
|
| 95 |
+ return;
|
|
| 96 |
+ }
|
|
| 94 | 97 |
SwingUtilities.invokeLater(() -> {
|
| 95 | 98 |
getClientUIContext().getBusyModel().addTask("Build map");
|
| 96 | 99 |
try {
|
| ... | ... | @@ -144,7 +144,8 @@ public abstract class ContentListUIHandler<D extends DataDto, R extends DataDtoR |
| 144 | 144 |
Class<? extends DataDtoReference> referenceType = ui.getModel().getSource().getScope().getMainReferenceType();
|
| 145 | 145 |
NavigationNode referenceNode = tree.getSelectedNode().downToReferenceNode(referenceType, id);
|
| 146 | 146 |
log.info(String.format("Will reselect node: %s", selectedNode));
|
| 147 |
- SwingUtilities.invokeLater(() -> tree.reSelectSafeNode(referenceNode));
|
|
| 147 |
+// SwingUtilities.invokeLater(() -> tree.reSelectSafeNode(referenceNode));
|
|
| 148 |
+ tree.reSelectSafeNode(referenceNode);
|
|
| 148 | 149 |
}
|
| 149 | 150 |
|
| 150 | 151 |
@Override
|
| ... | ... | @@ -57,7 +57,7 @@ class LandingUIHandler extends GeneratedLandingUIHandler { |
| 57 | 57 |
@Override
|
| 58 | 58 |
public void onMainTabChanged(int previousIndex, int selectedIndex) {
|
| 59 | 59 |
super.onMainTabChanged(previousIndex, selectedIndex);
|
| 60 |
- ui.getLandingPartUI().getSelectToolbar().setVisible(selectedIndex == 1);
|
|
| 60 |
+ ui.getLandingPartUI().getSelectToolbar().setVisible(selectedIndex == 1 && ui.getLandingPartUI().getTableModel().getRowCount() > 1);
|
|
| 61 | 61 |
}
|
| 62 | 62 |
|
| 63 | 63 |
@Override
|
| ... | ... | @@ -55,7 +55,7 @@ class SampleUIHandler extends GeneratedSampleUIHandler { |
| 55 | 55 |
@Override
|
| 56 | 56 |
public void onMainTabChanged(int previousIndex, int selectedIndex) {
|
| 57 | 57 |
super.onMainTabChanged(previousIndex, selectedIndex);
|
| 58 |
- ui.getSamplePartUI().getSelectToolbar().setVisible(selectedIndex == 1);
|
|
| 58 |
+ ui.getSamplePartUI().getSelectToolbar().setVisible(selectedIndex == 1 && ui.getSamplePartUI().getTableModel().getRowCount()>1);
|
|
| 59 | 59 |
}
|
| 60 | 60 |
|
| 61 | 61 |
@Override
|
| ... | ... | @@ -56,6 +56,15 @@ class SetGlobalCompositionUIHandler extends GeneratedSetGlobalCompositionUIHandl |
| 56 | 56 |
getContentOpen().initTabUI(ui.getBaitsCompositionUI(), ui.getBaitsCompositionPanel(), 3);
|
| 57 | 57 |
}
|
| 58 | 58 |
|
| 59 |
+ @Override
|
|
| 60 |
+ public void onMainTabChanged(int previousIndex, int selectedIndex) {
|
|
| 61 |
+ super.onMainTabChanged(previousIndex, selectedIndex);
|
|
| 62 |
+ ui.getFloatlinesCompositionUI().getSelectToolbar().setVisible(selectedIndex == 0 && ui.getFloatlinesCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 63 |
+ ui.getBranchlinesCompositionUI().getSelectToolbar().setVisible(selectedIndex == 1 && ui.getBranchlinesCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 64 |
+ ui.getHooksCompositionUI().getSelectToolbar().setVisible(selectedIndex == 2 && ui.getHooksCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 65 |
+ ui.getBaitsCompositionUI().getSelectToolbar().setVisible(selectedIndex == 3 && ui.getBaitsCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 66 |
+ }
|
|
| 67 |
+ |
|
| 59 | 68 |
@Override
|
| 60 | 69 |
protected void installResetAction() {
|
| 61 | 70 |
ResetForm.installAction(ui, ui.getReset(), new DefaultResetAdapter<SetGlobalCompositionUI>() {
|
| ... | ... | @@ -76,7 +76,6 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 76 | 76 |
private final PropertyChangeListener branchlineDetailChanged;
|
| 77 | 77 |
private final PropertyChangeListener modelCanGenerateChanged;
|
| 78 | 78 |
private final JVetoableTabbedPane.ChangeSelectedIndex tabbedPaneWillChanged;
|
| 79 |
- public SetDetailCompositionUIValidationHelper validationHelper;
|
|
| 80 | 79 |
|
| 81 | 80 |
|
| 82 | 81 |
SetDetailCompositionUIHandler() {
|
| ... | ... | @@ -106,7 +105,6 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 106 | 105 |
|
| 107 | 106 |
@Override
|
| 108 | 107 |
public void onInit(SetDetailCompositionUI ui) {
|
| 109 |
- this.validationHelper = new SetDetailCompositionUIValidationHelper(ui);
|
|
| 110 | 108 |
super.onInit(ui);
|
| 111 | 109 |
ui.getSectionTemplatesTable().setCellSelectionEnabled(false);
|
| 112 | 110 |
ui.get$objectMap().put(DefaultUIInitializer.SUB_TABBED_PANE, ui.getBranchlineDetailUI().getSubTabbedPane());
|
| ... | ... | @@ -118,7 +116,7 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 118 | 116 |
|
| 119 | 117 |
@Override
|
| 120 | 118 |
protected void installResetAction() {
|
| 121 |
- ResetForm.installAction(ui, ui.getReset(), new DefaultResetAdapter<SetDetailCompositionUI>() {
|
|
| 119 |
+ ResetForm.installAction(ui, ui.getReset(), new DefaultResetAdapter<>() {
|
|
| 122 | 120 |
@Override
|
| 123 | 121 |
public void onUpdate(SetDetailCompositionUI ui) {
|
| 124 | 122 |
BranchlineDto branchline = ui.getBranchlinesTableModel().getSelectedRow();
|
| ... | ... | @@ -157,6 +155,7 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 157 | 155 |
Form<BranchlineDto> branchlineDtoForm = Form.newFormDto(BranchlineDto.class, null);
|
| 158 | 156 |
|
| 159 | 157 |
BranchlineUIModel branchlineUIModel = model.getBranchlineUIModel();
|
| 158 |
+ branchlineUIModel.setMode(model.getStates().getMode());
|
|
| 160 | 159 |
Optional<FormDefinition<BranchlineDto>> optionalFormDefinition = ObserveBusinessProject.get().getOptionalFormDefinition(BranchlineDto.class);
|
| 161 | 160 |
optionalFormDefinition.ifPresent(t -> branchlineObsUI.getModel().getReferenceCache().loadReferentialReferenceSetsInModel(t, true));
|
| 162 | 161 |
branchlineUIModel.setForm(branchlineDtoForm);
|
| ... | ... | @@ -171,7 +170,8 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 171 | 170 |
// TODO Use a cache of templates on setLongline (session scope)
|
| 172 | 171 |
model.getSectionTemplatesTableModel().setData(new ArrayList<>());
|
| 173 | 172 |
|
| 174 |
- branchlineObsUI.edit(null);
|
|
| 173 |
+ BranchlineDto selectedRow = model.getBranchlinesTableModel().getSelectedRow();
|
|
| 174 |
+ branchlineObsUI.edit(selectedRow);
|
|
| 175 | 175 |
}
|
| 176 | 176 |
|
| 177 | 177 |
@Override
|
| ... | ... | @@ -180,6 +180,7 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 180 | 180 |
SetDetailCompositionUIModel model = getModel();
|
| 181 | 181 |
List<SectionWithTemplateDto> section = SectionWithTemplateDto.getSectionTemplates(model.getStates().getBean().getSection());
|
| 182 | 182 |
model.getSectionsTableModel().setData(section);
|
| 183 |
+ SetDetailCompositionUIValidationHelper validationHelper = model.getValidationHelper();
|
|
| 183 | 184 |
validationHelper.setObjectValueAdjusting(true);
|
| 184 | 185 |
try {
|
| 185 | 186 |
model.getSectionTemplatesTableModel().onSectionTemplatesTableModelModified(false);
|
| ... | ... | @@ -306,10 +307,6 @@ public class SetDetailCompositionUIHandler extends GeneratedSetDetailComposition |
| 306 | 307 |
}
|
| 307 | 308 |
}
|
| 308 | 309 |
|
| 309 |
- public SetDetailCompositionUIValidationHelper getValidationHelper() {
|
|
| 310 |
- return validationHelper;
|
|
| 311 |
- }
|
|
| 312 |
- |
|
| 313 | 310 |
protected void editBranchline(BranchlineDto branchline) {
|
| 314 | 311 |
boolean changed = ui.getValidator().isChanged();
|
| 315 | 312 |
try {
|
| ... | ... | @@ -246,7 +246,7 @@ public class SetDetailCompositionUIModel extends GeneratedSetDetailCompositionUI |
| 246 | 246 |
public void init(ContentUI ui, DefaultUIInitializerResult initializerResult) {
|
| 247 | 247 |
super.init(ui, initializerResult);
|
| 248 | 248 |
SetDetailCompositionUI ui1 = (SetDetailCompositionUI) ui;
|
| 249 |
- validationHelper = ui1.getHandler().getValidationHelper();
|
|
| 249 |
+ validationHelper = new SetDetailCompositionUIValidationHelper(ui1);
|
|
| 250 | 250 |
getSectionTemplatesTableModel().init(ui1);
|
| 251 | 251 |
getSectionsTableModel().init();
|
| 252 | 252 |
getBasketsTableModel().init(ui1);
|
| ... | ... | @@ -56,6 +56,15 @@ class SetGlobalCompositionUIHandler extends GeneratedSetGlobalCompositionUIHandl |
| 56 | 56 |
getContentOpen().initTabUI(ui.getBaitsCompositionUI(), ui.getBaitsCompositionPanel(), 3);
|
| 57 | 57 |
}
|
| 58 | 58 |
|
| 59 |
+ @Override
|
|
| 60 |
+ public void onMainTabChanged(int previousIndex, int selectedIndex) {
|
|
| 61 |
+ super.onMainTabChanged(previousIndex, selectedIndex);
|
|
| 62 |
+ ui.getFloatlinesCompositionUI().getSelectToolbar().setVisible(selectedIndex == 0 && ui.getFloatlinesCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 63 |
+ ui.getBranchlinesCompositionUI().getSelectToolbar().setVisible(selectedIndex == 1 && ui.getBranchlinesCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 64 |
+ ui.getHooksCompositionUI().getSelectToolbar().setVisible(selectedIndex == 2 && ui.getHooksCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 65 |
+ ui.getBaitsCompositionUI().getSelectToolbar().setVisible(selectedIndex == 3 && ui.getBaitsCompositionUI().getTableModel().getRowCount() > 1);
|
|
| 66 |
+ }
|
|
| 67 |
+ |
|
| 59 | 68 |
@Override
|
| 60 | 69 |
protected void installResetAction() {
|
| 61 | 70 |
ResetForm.installAction(ui, ui.getReset(), new DefaultResetAdapter<SetGlobalCompositionUI>() {
|
| ... | ... | @@ -26,7 +26,7 @@ import fr.ird.observe.client.datasource.editor.api.content.data.simple.ContentSi |
| 26 | 26 |
import fr.ird.observe.client.datasource.editor.api.content.ui.table.EditableTableModelSupport;
|
| 27 | 27 |
import fr.ird.observe.client.datasource.editor.api.content.ui.table.popup.AutoSelectRowAndShowPopupActionSupport;
|
| 28 | 28 |
import fr.ird.observe.client.datasource.editor.ll.data.observation.SetDetailCompositionUI;
|
| 29 |
-import fr.ird.observe.dto.data.DataDto;
|
|
| 29 |
+import fr.ird.observe.dto.IdDto;
|
|
| 30 | 30 |
import fr.ird.observe.dto.data.ll.observation.SetDetailCompositionDto;
|
| 31 | 31 |
|
| 32 | 32 |
import javax.swing.JMenuItem;
|
| ... | ... | @@ -57,11 +57,11 @@ public class CompositionAutoSelectRowAndShowPopupAction extends AutoSelectRowAnd |
| 57 | 57 |
|
| 58 | 58 |
@Override
|
| 59 | 59 |
protected void beforeOpenPopup(int modelRowIndex, int modelColumnIndex) {
|
| 60 |
- @SuppressWarnings("unchecked") EditableTableModelSupport<DataDto> model = (EditableTableModelSupport<DataDto>) getTable().getModel();
|
|
| 60 |
+ @SuppressWarnings("unchecked") EditableTableModelSupport<IdDto> model = (EditableTableModelSupport<IdDto>) getTable().getModel();
|
|
| 61 | 61 |
boolean selectionNotEmpty = !model.isSelectionEmpty();
|
| 62 | 62 |
boolean selectedRowIsNotEmpty = false;
|
| 63 | 63 |
if (selectionNotEmpty) {
|
| 64 |
- DataDto selectedData = model.getSelectedRow();
|
|
| 64 |
+ IdDto selectedData = model.getSelectedRow();
|
|
| 65 | 65 |
selectedRowIsNotEmpty = model.isRowNotEmpty(selectedData);
|
| 66 | 66 |
}
|
| 67 | 67 |
|
| ... | ... | @@ -60,7 +60,7 @@ public class SetDetailCompositionUIValidationHelper { |
| 60 | 60 |
|
| 61 | 61 |
public SetDetailCompositionUIValidationHelper(SetDetailCompositionUI ui) {
|
| 62 | 62 |
this.model = ui.getModel();
|
| 63 |
- this.errorTableModel = (ContentMessageTableModel) ui.getErrorTableModel();
|
|
| 63 |
+ this.errorTableModel = ui.getErrorTableModel();
|
|
| 64 | 64 |
SwingValidator<SectionDto> sectionValidator = ui.getSectionValidator();
|
| 65 | 65 |
SwingValidator<BasketDto> basketValidator = ui.getBasketValidator();
|
| 66 | 66 |
SwingValidator<BranchlineDto> branchlineValidator = ui.getBranchlineValidator();
|
| ... | ... | @@ -60,7 +60,7 @@ public class BasketTableModel extends LonglineCompositionTableModelSupport<Baske |
| 60 | 60 |
}
|
| 61 | 61 |
|
| 62 | 62 |
public void init(SetDetailCompositionUI ui) {
|
| 63 |
- validationHelper = ui.getHandler().getValidationHelper();
|
|
| 63 |
+ validationHelper = ui.getModel().getValidationHelper();
|
|
| 64 | 64 |
|
| 65 | 65 |
PropertyChangeListener basketsTableModelModified = evt -> {
|
| 66 | 66 |
Boolean newValue = (Boolean) evt.getNewValue();
|
| ... | ... | @@ -132,6 +132,8 @@ public class BranchlineTableModel extends LonglineCompositionTableModelSupport<B |
| 132 | 132 |
result = !isGenerateHaulingIds();
|
| 133 | 133 |
break;
|
| 134 | 134 |
case 2:
|
| 135 |
+ case 3:
|
|
| 136 |
+ // can always change length ?
|
|
| 135 | 137 |
result = true;
|
| 136 | 138 |
break;
|
| 137 | 139 |
default:
|
| ... | ... | @@ -155,7 +155,7 @@ |
| 155 | 155 |
|
| 156 | 156 |
<!-- <lib.version.java4all.topia>1.31</lib.version.java4all.topia>-->
|
| 157 | 157 |
<!-- <lib.version.java4all.eugene>3.0-alpha-38</lib.version.java4all.eugene>-->
|
| 158 |
- <lib.version.java4all.jaxx>3.0-alpha-85-SNAPSHOT</lib.version.java4all.jaxx>
|
|
| 158 |
+ <lib.version.java4all.jaxx>3.0-alpha-85</lib.version.java4all.jaxx>
|
|
| 159 | 159 |
<!--<lib.version.java4all.application-context>1.0.3-SNAPSHOT</lib.version.java4all.application-context>-->
|
| 160 | 160 |
<!--<lib.version.java4all.application-template>1.0.2-SNAPSHOT</lib.version.java4all.application-template>-->
|
| 161 | 161 |
<!--<lib.version.java4all.i18n>4.0-beta-3-SNAPSHOT</lib.version.java4all.i18n>-->
|