Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
1f63ebe6
by tchemit at 2019-09-16T12:11:41Z
7 changed files:
- client-core/src/main/java/fr/ird/observe/client/ui/admin/AdminTabUIHandler.java
- client-core/src/main/java/fr/ird/observe/client/ui/admin/AdminUIHandler.java
- + client-core/src/main/java/fr/ird/observe/client/ui/admin/actions/SelectData.java
- client-core/src/main/java/fr/ird/observe/client/ui/admin/config/ConfigModel.java
- client-core/src/main/java/fr/ird/observe/client/ui/admin/config/ConfigUIHandler.java
- client-core/src/main/java/fr/ird/observe/client/ui/admin/config/SelectDataUIHandler.java
- client-core/src/main/java/fr/ird/observe/client/ui/admin/export/actions/Start.java
Changes:
| ... | ... | @@ -61,8 +61,6 @@ public class AdminTabUIHandler<U extends AdminTabUI> { |
| 61 | 61 |
|
| 62 | 62 |
AdminStep step = ui.getStep();
|
| 63 | 63 |
|
| 64 |
- //FIXME ? ui.addPropertyChangeListener(parentUI);
|
|
| 65 |
- |
|
| 66 | 64 |
log.debug(String.format("common for [%s] for main ui %s@%d", step, parentUI.getClass().getName(), System.identityHashCode(ui)));
|
| 67 | 65 |
|
| 68 | 66 |
String stepLabel = I18nEnumHelper.getLabel(step);
|
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 |
*/
|
| 22 | 22 |
package fr.ird.observe.client.ui.admin;
|
| 23 | 23 |
|
| 24 |
+import fr.ird.observe.client.ui.admin.actions.SelectData;
|
|
| 24 | 25 |
import fr.ird.observe.client.ui.admin.config.ConfigUI;
|
| 25 | 26 |
import fr.ird.observe.client.ui.admin.config.SelectDataUI;
|
| 26 | 27 |
import fr.ird.observe.client.ui.admin.consolidate.ConsolidateUI;
|
| ... | ... | @@ -180,32 +181,18 @@ public class AdminUIHandler implements UIHandler<AdminUI> { |
| 180 | 181 |
|
| 181 | 182 |
AdminUIModel model = ui.getModel();
|
| 182 | 183 |
|
| 183 |
- if (oldStep == null
|
|
| 184 |
- && newStep == AdminStep.CONFIG
|
|
| 185 |
- && (model.containsOperation(AdminStep.REFERENTIAL_SYNCHRONIZE) || model.containsOperation(AdminStep.DATA_SYNCHRONIZE))) {
|
|
| 186 |
- |
|
| 187 |
- ConfigUI configUI = (ConfigUI) ui.getStepUI(AdminStep.CONFIG);
|
|
| 184 |
+ if (oldStep == null && newStep == AdminStep.CONFIG && (model.containsOperation(AdminStep.REFERENTIAL_SYNCHRONIZE) || model.containsOperation(AdminStep.DATA_SYNCHRONIZE))) {
|
|
| 188 | 185 |
|
| 189 | 186 |
model.getConfigModel().getLocalSourceModel().setLabelPrefix(t("observe.storage.config.left.storage"));
|
| 190 | 187 |
model.getConfigModel().getCentralSourceModel().setLabelPrefix(t("observe.storage.config.right.storage"));
|
| 191 | 188 |
|
| 192 |
-// configUI.getLocalSourceConfig().setBorder(new TitledBorder(model.getConfigModel().getLocalSourceLabel()));
|
|
| 193 |
-// configUI.getCentralSourceConfig().setBorder(new TitledBorder(model.getConfigModel().getCentralSourceLabel()));
|
|
| 194 |
- |
|
| 195 | 189 |
}
|
| 196 | 190 |
|
| 197 |
- if (oldStep == null
|
|
| 198 |
- && newStep == AdminStep.CONFIG
|
|
| 199 |
- && model.containsOperation(AdminStep.EXPORT_DATA)) {
|
|
| 200 |
- |
|
| 201 |
- ConfigUI configUI = (ConfigUI) ui.getStepUI(AdminStep.CONFIG);
|
|
| 191 |
+ if (oldStep == null && newStep == AdminStep.CONFIG && model.containsOperation(AdminStep.EXPORT_DATA)) {
|
|
| 202 | 192 |
|
| 203 | 193 |
model.getConfigModel().getLocalSourceModel().setLabelPrefix(t("observe.storage.config.exportSource.storage"));
|
| 204 | 194 |
model.getConfigModel().getCentralSourceModel().setLabelPrefix(t("observe.storage.config.exportTarget.storage"));
|
| 205 | 195 |
|
| 206 |
-// configUI.getLocalSourceConfig().setBorder(new TitledBorder(model.getConfigModel().getLocalSourceLabel()));
|
|
| 207 |
-// configUI.getCentralSourceConfig().setBorder(new TitledBorder(model.getConfigModel().getCentralSourceLabel()));
|
|
| 208 |
- |
|
| 209 | 196 |
}
|
| 210 | 197 |
|
| 211 | 198 |
if (oldStep != null && oldStep.ordinal() < AdminStep.REFERENTIAL_SYNCHRONIZE.ordinal() && newStep == AdminStep.REFERENTIAL_SYNCHRONIZE) {
|
| ... | ... | @@ -238,7 +225,7 @@ public class AdminUIHandler implements UIHandler<AdminUI> { |
| 238 | 225 |
|
| 239 | 226 |
if (ui.getModel().getStepState(AdminStep.ACTIVITY_LONGLINE_PAIRING) == WizardState.PENDING) {
|
| 240 | 227 |
ActivityLonglinePairingUI tabUI = (ActivityLonglinePairingUI) ui.getStepUI(AdminStep.ACTIVITY_LONGLINE_PAIRING);
|
| 241 |
- tabUI.getPrepare().doClick();
|
|
| 228 |
+ SwingUtilities.invokeLater(tabUI.getPrepare()::doClick);
|
|
| 242 | 229 |
}
|
| 243 | 230 |
|
| 244 | 231 |
}
|
| ... | ... | @@ -256,7 +243,7 @@ public class AdminUIHandler implements UIHandler<AdminUI> { |
| 256 | 243 |
|
| 257 | 244 |
if (ui.getModel().getStepState(AdminStep.VALIDATE) == WizardState.PENDING) {
|
| 258 | 245 |
ValidateUI tabUI = (ValidateUI) ui.getStepUI(AdminStep.VALIDATE);
|
| 259 |
- tabUI.getStart().doClick();
|
|
| 246 |
+ SwingUtilities.invokeLater(tabUI.getStart()::doClick);
|
|
| 260 | 247 |
}
|
| 261 | 248 |
|
| 262 | 249 |
}
|
| ... | ... | @@ -265,7 +252,11 @@ public class AdminUIHandler implements UIHandler<AdminUI> { |
| 265 | 252 |
|
| 266 | 253 |
if (ui.getModel().getStepState(AdminStep.SAVE_LOCAL) == WizardState.PENDING) {
|
| 267 | 254 |
SaveLocalUI tabUI = (SaveLocalUI) ui.getStepUI(AdminStep.SAVE_LOCAL);
|
| 268 |
- SwingUtilities.invokeLater(tabUI.getStart()::doClick);
|
|
| 255 |
+ if (tabUI.getStepModel().isLocalSourceNeedSave()) {
|
|
| 256 |
+ SwingUtilities.invokeLater(tabUI.getStart()::doClick);
|
|
| 257 |
+ } else {
|
|
| 258 |
+ SwingUtilities.invokeLater(tabUI.getContinueAction()::doClick);
|
|
| 259 |
+ }
|
|
| 269 | 260 |
}
|
| 270 | 261 |
|
| 271 | 262 |
}
|
| ... | ... | @@ -304,7 +295,8 @@ public class AdminUIHandler implements UIHandler<AdminUI> { |
| 304 | 295 |
|
| 305 | 296 |
// préparation de l'arbre de sélection
|
| 306 | 297 |
SelectDataUI selectDataUI = (SelectDataUI) ui.getStepUI(AdminStep.SELECT_DATA);
|
| 307 |
- selectDataUI.getHandler().onSelectDataOpen();
|
|
| 298 |
+ SelectData action = SelectData.init(selectDataUI,null, SelectData.class);
|
|
| 299 |
+ action.run();
|
|
| 308 | 300 |
}
|
| 309 | 301 |
|
| 310 | 302 |
}
|
| 1 |
+package fr.ird.observe.client.ui.admin.actions;
|
|
| 2 |
+ |
|
| 3 |
+/*-
|
|
| 4 |
+ * #%L
|
|
| 5 |
+ * ObServe :: Client core
|
|
| 6 |
+ * %%
|
|
| 7 |
+ * Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
|
|
| 8 |
+ * %%
|
|
| 9 |
+ * This program is free software: you can redistribute it and/or modify
|
|
| 10 |
+ * it under the terms of the GNU General Public License as
|
|
| 11 |
+ * published by the Free Software Foundation, either version 3 of the
|
|
| 12 |
+ * License, or (at your option) any later version.
|
|
| 13 |
+ *
|
|
| 14 |
+ * This program is distributed in the hope that it will be useful,
|
|
| 15 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 16 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 17 |
+ * GNU General Public License for more details.
|
|
| 18 |
+ *
|
|
| 19 |
+ * You should have received a copy of the GNU General Public
|
|
| 20 |
+ * License along with this program. If not, see
|
|
| 21 |
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
|
|
| 22 |
+ * #L%
|
|
| 23 |
+ */
|
|
| 24 |
+ |
|
| 25 |
+import fr.ird.observe.client.db.ObserveSwingDataSource;
|
|
| 26 |
+import fr.ird.observe.client.ui.admin.config.SelectDataUI;
|
|
| 27 |
+import fr.ird.observe.client.ui.tree.selection.SelectionTree;
|
|
| 28 |
+ |
|
| 29 |
+import javax.swing.SwingUtilities;
|
|
| 30 |
+import java.awt.event.ActionEvent;
|
|
| 31 |
+ |
|
| 32 |
+public class SelectData extends AdminTabUIActionSupport<SelectDataUI> implements Runnable {
|
|
| 33 |
+ |
|
| 34 |
+ public SelectData() {
|
|
| 35 |
+ super(null, null, null, null);
|
|
| 36 |
+ }
|
|
| 37 |
+ |
|
| 38 |
+ @Override
|
|
| 39 |
+ protected void doActionPerformed(ActionEvent e, SelectDataUI ui) {
|
|
| 40 |
+ run();
|
|
| 41 |
+ }
|
|
| 42 |
+ |
|
| 43 |
+ @Override
|
|
| 44 |
+ public void run() {
|
|
| 45 |
+ getParentUI().getModel().setBusy(true);
|
|
| 46 |
+ try {
|
|
| 47 |
+ SwingUtilities.invokeLater(this::run0);
|
|
| 48 |
+ } finally {
|
|
| 49 |
+ getParentUI().getModel().setBusy(false);
|
|
| 50 |
+ }
|
|
| 51 |
+ }
|
|
| 52 |
+ |
|
| 53 |
+ private void run0() {
|
|
| 54 |
+ SelectionTree selectTree = ui.getSelectTree();
|
|
| 55 |
+ selectTree.clearSelection();
|
|
| 56 |
+ |
|
| 57 |
+ SwingUtilities.invokeLater(selectTree::grabFocus);
|
|
| 58 |
+ |
|
| 59 |
+ if (selectTree.getTreeModel().isNotEmpty()) {
|
|
| 60 |
+ |
|
| 61 |
+ selectTree.setSelectionRow(0);
|
|
| 62 |
+ }
|
|
| 63 |
+ ObserveSwingDataSource localSource = ui.getModel().getConfigModel().getLocalSourceModel().getSafeSource(true);
|
|
| 64 |
+ if (localSource.isLocal()) {
|
|
| 65 |
+ SwingUtilities.invokeLater(selectTree::expandAll);
|
|
| 66 |
+ }
|
|
| 67 |
+ }
|
|
| 68 |
+}
|
| ... | ... | @@ -96,8 +96,7 @@ public class ConfigModel extends AdminActionModel { |
| 96 | 96 |
@Override
|
| 97 | 97 |
public void validate() {
|
| 98 | 98 |
super.validate();
|
| 99 |
- ConfigModel.this.firePropertyChange(VALID_PROPERTY_NAME, isValid());
|
|
| 100 |
- ConfigModel.this.firePropertyChange(VALID_STEP_PROPERTY_NAME, isValidStep());
|
|
| 99 |
+ ConfigModel.this.firePropertyChange(AdminUIModel.VALID_STEP_PROPERTY_NAME, isValidStep());
|
|
| 101 | 100 |
}
|
| 102 | 101 |
|
| 103 | 102 |
};
|
| ... | ... | @@ -126,8 +125,7 @@ public class ConfigModel extends AdminActionModel { |
| 126 | 125 |
@Override
|
| 127 | 126 |
public void validate() {
|
| 128 | 127 |
super.validate();
|
| 129 |
- ConfigModel.this.firePropertyChange(VALID_PROPERTY_NAME, isValid());
|
|
| 130 |
- ConfigModel.this.firePropertyChange(VALID_STEP_PROPERTY_NAME, isValidStep());
|
|
| 128 |
+ ConfigModel.this.firePropertyChange(AdminUIModel.VALID_STEP_PROPERTY_NAME, isValidStep());
|
|
| 131 | 129 |
}
|
| 132 | 130 |
};
|
| 133 | 131 |
centralSourceModel.setLabelPrefix(n("observe.storage.config.referentiel.storage"));
|
| ... | ... | @@ -46,7 +46,8 @@ public class ConfigUIHandler extends AdminTabUIHandler<ConfigUI> implements UIHa |
| 46 | 46 |
UIHelper.setLayerUI(ui.getConfig(), parentUI.getConfigBlockLayerUI());
|
| 47 | 47 |
UIHelper.setLayerUI(ui.getContent(), null);
|
| 48 | 48 |
AdminUIModel model = ui.getModel();
|
| 49 |
- model.addPropertyChangeListener("operations", e -> isOperationSelected(model.getOperations(), ui.EXPORT_DATA));
|
|
| 49 |
+ model.addPropertyChangeListener(AdminUIModel.OPERATIONS_PROPERTY_NAME, e -> isOperationSelected(model.getOperations(), ui.EXPORT_DATA));
|
|
| 50 |
+ ui.getModel().getConfigModel().addPropertyChangeListener(AdminUIModel.VALID_STEP_PROPERTY_NAME, e-> model.validate());
|
|
| 50 | 51 |
|
| 51 | 52 |
}
|
| 52 | 53 |
|
| ... | ... | @@ -27,8 +27,6 @@ import fr.ird.observe.client.ui.tree.selection.SelectionTree; |
| 27 | 27 |
import fr.ird.observe.client.ui.util.UIHelper;
|
| 28 | 28 |
import org.nuiton.jaxx.runtime.spi.UIHandler;
|
| 29 | 29 |
|
| 30 |
-import javax.swing.SwingUtilities;
|
|
| 31 |
- |
|
| 32 | 30 |
/**
|
| 33 | 31 |
* Created on 28/11/16.
|
| 34 | 32 |
*
|
| ... | ... | @@ -52,21 +50,4 @@ public class SelectDataUIHandler extends AdminTabUIHandler<SelectDataUI> impleme |
| 52 | 50 |
// UIHelper.initUI(tabUI.getSelectTreePane(), tree);
|
| 53 | 51 |
}
|
| 54 | 52 |
|
| 55 |
- |
|
| 56 |
- public void onSelectDataOpen() {
|
|
| 57 |
- |
|
| 58 |
- SelectionTree selectTree = ui.getSelectTree();
|
|
| 59 |
- selectTree.clearSelection();
|
|
| 60 |
- |
|
| 61 |
- SwingUtilities.invokeLater(selectTree::grabFocus);
|
|
| 62 |
- |
|
| 63 |
- if (selectTree.getTreeModel().isNotEmpty()) {
|
|
| 64 |
- |
|
| 65 |
- selectTree.setSelectionRow(0);
|
|
| 66 |
- }
|
|
| 67 |
- if (ui.getModel().getConfigModel().getLocalSourceModel().getSafeSource(true).isLocal()) {
|
|
| 68 |
- SwingUtilities.invokeLater(selectTree::expandAll);
|
|
| 69 |
- }
|
|
| 70 |
- |
|
| 71 |
- }
|
|
| 72 | 53 |
}
|
| ... | ... | @@ -88,10 +88,12 @@ public class Start extends ExportUIActionSupport { |
| 88 | 88 |
DecoratorService decoratorService = getDecoratorService();
|
| 89 | 89 |
ReferentialReferenceDecorator<ProgramReference> programDecorator = decoratorService.getReferentialReferenceDecorator(ProgramReference.class);
|
| 90 | 90 |
|
| 91 |
- int stepCount = 4 + 2 * tripEntries.size();
|
|
| 91 |
+ int stepCount = 6 + 2 * tripEntries.size();
|
|
| 92 | 92 |
|
| 93 | 93 |
ProgressModel progressModel = stepModel.getProgressModel();
|
| 94 | 94 |
progressModel.setStepsCount(stepCount);
|
| 95 |
+ progressModel.setCurrentStep(0);
|
|
| 96 |
+ |
|
| 95 | 97 |
|
| 96 | 98 |
progressModel.incrementsCurrentStep();
|
| 97 | 99 |
try (ObserveSwingDataSource localDataSource = openSource(stepModel.getSource())) {
|
| ... | ... | @@ -137,6 +139,7 @@ public class Start extends ExportUIActionSupport { |
| 137 | 139 |
|
| 138 | 140 |
}
|
| 139 | 141 |
}
|
| 142 |
+ progressModel.incrementsCurrentStep();
|
|
| 140 | 143 |
|
| 141 | 144 |
sendMessage(t("observe.actions.operation.message.done", new Date()));
|
| 142 | 145 |
|