branch develop-5.x updated (67a4c13 -> d6af5b0)
This is an automated email from the git hooks/post-receive script. New change to branch develop-5.x in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git from 67a4c13 Synchro avancée de référentiel : griser les boutons des modes de fonctionnement non pertinents (Fixes #8881) new d6af5b0 Droits sur synchro avancée de marée (Fixes #8884) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit d6af5b0fde0ebd8d772fe1a293f459c223b4ebaa Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Dec 16 11:17:20 2016 +0100 Droits sur synchro avancée de marée (Fixes #8884) Summary of changes: .../application/swing/ui/admin/AdminUIModel.java | 44 +++++++++------------- .../synchronize/data/DataSynchroUIHandler.java | 19 +++++++++- .../ng/ReferentialSynchroUIHandler.java | 4 +- 3 files changed, 37 insertions(+), 30 deletions(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop-5.x in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit d6af5b0fde0ebd8d772fe1a293f459c223b4ebaa Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Dec 16 11:17:20 2016 +0100 Droits sur synchro avancée de marée (Fixes #8884) --- .../application/swing/ui/admin/AdminUIModel.java | 44 +++++++++------------- .../synchronize/data/DataSynchroUIHandler.java | 19 +++++++++- .../ng/ReferentialSynchroUIHandler.java | 4 +- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIModel.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIModel.java index c809b25..0327bfd 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIModel.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/AdminUIModel.java @@ -109,7 +109,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { /** la source de données sur laquel on veut travailler */ protected ObserveDataSourceInformation localSourceInformation; - protected ObserveDataSourceInformation centralSourceInformation; /** la source de données dite central (contenant le référentiel valide) */ protected ObserveSwingDataSource centralSource; @@ -885,27 +884,6 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { return localSourceInformation; } - public ObserveDataSourceInformation getCentralSourceInformation() { - if (centralSourceInformation == null) { - - ObserveSwingDataSource centralSource = getSafeCentralSource(false); - - try { - - centralSourceInformation = centralSource.checkCanConnect(); - - } catch (Exception e) { - //FIXME ! il faut faire quelque chose dans ce cas précis, au moins avertir l'utilisateur - if (log.isErrorEnabled()) { - log.error("unable to find central source information", e); - } - } - - } - - return centralSourceInformation; - } - public ObserveSwingDataSource getCentralSource() { return centralSource; } @@ -1142,26 +1120,40 @@ public class AdminUIModel extends WizardExtModel<AdminStep> { // les deux bases (source et referentiel) doivent etre different validate = validateNotSameDataSources(); + boolean atLeastOneWrite = false; ObserveDataSourceInformation leftDataSourceInformation = getLocalSourceInformation(); - if (!(leftDataSourceInformation.canReadData() && leftDataSourceInformation.canWriteData())) { + if (!(leftDataSourceInformation.canReadData())) { if (log.isDebugEnabled()) { - log.debug("can not read and write data on left data source"); + log.debug("can not read data on left data source"); } return false; } + if (leftDataSourceInformation.canWriteData()) { + atLeastOneWrite = true; + } + if (centralSourceModel.getDataSourceInformation() != null) { ObserveDataSourceInformation rightDataSourceInformation = centralSourceModel.getDataSourceInformation(); - if (!(rightDataSourceInformation.canReadData() && rightDataSourceInformation.canWriteData())) { + if (!(rightDataSourceInformation.canReadData())) { if (log.isDebugEnabled()) { - log.debug("can not read and write data on right data source"); + log.debug("can not read data on right data source"); } return false; } + if (rightDataSourceInformation.canWriteData()) { + atLeastOneWrite = true; + } } + if (!atLeastOneWrite) { + if (log.isDebugEnabled()) { + log.debug("can not write data on any side"); + } + return false; + } } if (validate && containsOperation(AdminStep.REFERENTIAL_SYNCHRONIZE)) { diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/data/DataSynchroUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/data/DataSynchroUIHandler.java index 81f6577..259ff0f 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/data/DataSynchroUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/data/DataSynchroUIHandler.java @@ -55,6 +55,7 @@ import org.apache.commons.logging.LogFactory; import javax.swing.DefaultListModel; import javax.swing.border.TitledBorder; +import java.awt.Color; import java.util.List; import java.util.Map; @@ -232,14 +233,28 @@ public class DataSynchroUIHandler extends AdminTabUIHandler { ObserveSwingDataSource rightSource = getModel().getSafeCentralSource(true); stepModel.setRightSource(rightSource); - tabUI.getLeftTreePane().setBorder(new TitledBorder(getModel().getLocalSourceModel().getLabel())); + TitledBorder leftBorder = new TitledBorder(getModel().getLocalSourceModel().getLabel()); + boolean leftCanWriteData = getModel().getLocalSourceModel().getDataSourceInformation().canWriteData(); + leftBorder.setTitleColor(leftCanWriteData ? Color.GREEN : Color.RED); + tabUI.getLeftTreePane().setBorder(leftBorder); + if (!leftCanWriteData) { + tabUI.getCopyToLeft().setVisible(false); + tabUI.getDeleteFromRight().setVisible(false); + } stepModel.populateLeftSelectionModel(); updateSelectionModel(tabUI, tabUI.getLeftTreeHelper(), tabUI.getLeftTree(), leftSource, stepModel.getLeftSelectionDataModel(), tabUI.getLeftSelectionModel()); sendMessage(t("observe.actions.synchro.referential.message.data.leftData.loaded")); configUI.getLocalSourceConfig().setBorder(new TitledBorder(getModel().getLocalSourceLabel())); - tabUI.getRightTreePane().setBorder(new TitledBorder(getModel().getCentralSourceModel().getLabel())); + TitledBorder rightBorder = new TitledBorder(getModel().getCentralSourceModel().getLabel()); + boolean rightCanWriteData = getModel().getCentralSourceModel().getDataSourceInformation().canWriteData(); + rightBorder.setTitleColor(rightCanWriteData ? Color.GREEN : Color.RED); + tabUI.getRightTreePane().setBorder(rightBorder); + if (!rightCanWriteData) { + tabUI.getCopyToRight().setVisible(false); + tabUI.getDeleteFromLeft().setVisible(false); + } stepModel.populateRightSelectionModel(); updateSelectionModel(tabUI, tabUI.getRightTreeHelper(), tabUI.getRightTree(), rightSource, stepModel.getRightSelectionDataModel(), tabUI.getRightSelectionModel()); sendMessage(t("observe.actions.synchro.referential.message.data.rightData.loaded")); diff --git a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/referential/ng/ReferentialSynchroUIHandler.java b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/referential/ng/ReferentialSynchroUIHandler.java index bc340a0..6e83bd6 100644 --- a/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/referential/ng/ReferentialSynchroUIHandler.java +++ b/application-swing/src/main/java/fr/ird/observe/application/swing/ui/admin/synchronize/referential/ng/ReferentialSynchroUIHandler.java @@ -103,13 +103,13 @@ public class ReferentialSynchroUIHandler extends AdminTabUIHandler { if (model.getCentralSourceModel().getDbMode() == null) { return; } - boolean leftToRightEnabled = Optional.ofNullable(model.getCentralSourceInformation()) + boolean leftToRightEnabled = Optional.ofNullable(model.getCentralSourceModel().getDataSourceInformation()) .map(ObserveDataSourceInformation::canWriteReferential) .orElse(false); if (log.isDebugEnabled()) { log.debug("Update synchro modes: leftToRight: " + leftToRightEnabled); } - boolean rightToLeftEnabled = Optional.ofNullable(model.getLocalSourceInformation()) + boolean rightToLeftEnabled = Optional.ofNullable(model.getLocalSourceModel().getDataSourceInformation()) .map(ObserveDataSourceInformation::canWriteReferential) .orElse(false); if (log.isDebugEnabled()) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm