|
From: <de...@us...> - 2016-10-12 15:39:54
|
Revision: 9433
http://sourceforge.net/p/fudaa/svn/9433
Author: deniger
Date: 2016-10-12 15:39:52 +0000 (Wed, 12 Oct 2016)
Log Message:
-----------
CRUE-715: Fonction annuler dans certains ?\195?\169diteurs de branches...
Ajout des fonctions de clone pour permettre l'annulation des modifications
Modified Paths:
--------------
trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonCalcSansPrtBrancheBarrageFilEau.java
trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBranche.java
trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBrancheSaintVenant.java
trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheBarrageFilEauPanel.java
trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheSaintVenantPanel.java
Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonCalcSansPrtBrancheBarrageFilEau.java
===================================================================
--- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonCalcSansPrtBrancheBarrageFilEau.java 2016-10-12 14:33:23 UTC (rev 9432)
+++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/DonCalcSansPrtBrancheBarrageFilEau.java 2016-10-12 15:39:52 UTC (rev 9433)
@@ -34,7 +34,7 @@
*/
public java.util.Collection<ElemSeuil> getElemSeuil() {
if (elemSeuil == null) {
- elemSeuil = new java.util.HashSet<ElemSeuil>();
+ elemSeuil = new java.util.HashSet<>();
}
return elemSeuil;
}
Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBranche.java
===================================================================
--- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBranche.java 2016-10-12 14:33:23 UTC (rev 9432)
+++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBranche.java 2016-10-12 15:39:52 UTC (rev 9433)
@@ -1,13 +1,15 @@
-/***********************************************************************
+/** *********************************************************************
* Module: RelationEMHSectionDansBranche.java Author: deniger Purpose: Defines the Class RelationEMHSectionDansBranche
- ***********************************************************************/
-
+ ********************************************************************** */
package org.fudaa.dodico.crue.metier.emh;
import java.util.Collections;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
-public class RelationEMHSectionDansBranche extends RelationEMH<CatEMHSection> {
+public class RelationEMHSectionDansBranche extends RelationEMH<CatEMHSection> implements Cloneable {
+
private double xp;
private EnumPosSection pos;
@@ -18,6 +20,21 @@
return pos;
}
+ public RelationEMHSectionDansBranche cloneValuesOnly() {
+ RelationEMHSectionDansBranche cloned = null;
+ try {
+ cloned = clone();
+ } catch (CloneNotSupportedException ex) {
+ Logger.getLogger(RelationEMHSectionDansBranche.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return cloned;
+ }
+
+ @Override
+ public RelationEMHSectionDansBranche clone() throws CloneNotSupportedException {
+ return (RelationEMHSectionDansBranche) super.clone();
+ }
+
/**
*
* @return une map contenant les données spécifiques de la branche. Utile pour les relatiosn de saint-venant
@@ -36,7 +53,9 @@
this.pos = pos;
}
- /** @pdOid a1909c6f-b4b5-4153-932b-ee7d864dfe17 */
+ /**
+ * @pdOid a1909c6f-b4b5-4153-932b-ee7d864dfe17
+ */
public double getXp() {
return xp;
}
@@ -49,4 +68,4 @@
xp = newXp;
}
-}
\ No newline at end of file
+}
Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBrancheSaintVenant.java
===================================================================
--- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBrancheSaintVenant.java 2016-10-12 14:33:23 UTC (rev 9432)
+++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/RelationEMHSectionDansBrancheSaintVenant.java 2016-10-12 15:39:52 UTC (rev 9433)
@@ -7,6 +7,8 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.fudaa.dodico.crue.common.annotation.PropertyDesc;
import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier;
import org.fudaa.dodico.crue.config.ccm.CrueConfigMetierConstants;
@@ -32,6 +34,22 @@
return coefDiv;
}
+ public RelationEMHSectionDansBrancheSaintVenant cloneValuesOnly() {
+ RelationEMHSectionDansBrancheSaintVenant cloned = null;
+ try {
+ cloned = clone();
+ } catch (CloneNotSupportedException ex) {
+ Logger.getLogger(RelationEMHSectionDansBrancheSaintVenant.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return cloned;
+ }
+
+ @Override
+ public RelationEMHSectionDansBrancheSaintVenant clone() throws CloneNotSupportedException {
+ final RelationEMHSectionDansBrancheSaintVenant cloned = (RelationEMHSectionDansBrancheSaintVenant) super.clone();
+ return cloned;
+ }
+
/**
*
* @return une map contenant les données spécifiques de la branche. Utile pour les relatiosn de saint-venant
@@ -102,4 +120,4 @@
public void setCoefConv(final double newCoefConv) {
coefConv = newCoefConv;
}
-}
\ No newline at end of file
+}
Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheBarrageFilEauPanel.java
===================================================================
--- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheBarrageFilEauPanel.java 2016-10-12 14:33:23 UTC (rev 9432)
+++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheBarrageFilEauPanel.java 2016-10-12 15:39:52 UTC (rev 9433)
@@ -150,7 +150,7 @@
Collection<ElemSeuil> elemSeuilAvecPdc = dcsp.getElemSeuil();
CrueConfigMetier ccm = getCcm();
for (ElemSeuil elemSeuilAvecPdcNode : elemSeuilAvecPdc) {
- nodes.add(new ElemSeuilAduNode(elemSeuilAvecPdcNode, ccm, perspectiveServiceModelling));
+ nodes.add(new ElemSeuilAduNode(elemSeuilAvecPdcNode.clone(), ccm, perspectiveServiceModelling));
}
}
Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheSaintVenantPanel.java
===================================================================
--- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheSaintVenantPanel.java 2016-10-12 14:33:23 UTC (rev 9432)
+++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheSaintVenantPanel.java 2016-10-12 15:39:52 UTC (rev 9433)
@@ -39,7 +39,7 @@
* @author fred
*/
public class ModellingEMHBrancheSaintVenantPanel extends JPanel implements ModellingEMHBrancheSpecificEditor, Observer, ExplorerManager.Provider {
-
+
ModellingScenarioService modellingScenarioService = Lookup.getDefault().lookup(
ModellingScenarioService.class);
PerspectiveServiceModelling perspectiveServiceModelling = Lookup.getDefault().lookup(PerspectiveServiceModelling.class);
@@ -51,7 +51,7 @@
List<ItemVariableView> dcspProperties;
List<ItemVariableView> dptgProperties;
private DisableSortHelper sortDisabler;
-
+
ModellingEMHBrancheSaintVenantPanel(CatEMHBranche branche, ModellingEMHBrancheTopComponent parent) {
super(new BorderLayout(10, 10));
setPreferredSize(new Dimension(600, 800));
@@ -68,13 +68,13 @@
}
JPanel pnTop = createTopPanel(dcsp, ccm, dptg, branche);
add(pnTop, BorderLayout.NORTH);
-
+
RelationEMHSectionDansBranche sectionAval = branche.getSectionAval();
final ItemVariable propertyXp = ccm.getProperty(CrueConfigMetierConstants.PROP_XP);
List<Node> nodes = new ArrayList<Node>();
nodes.add(createLabelNode(NbBundle.getMessage(ModellingEMHBrancheSaintVenantPanel.class, "Amont.DisplayName")));
final boolean isSaintVenant = branche.getBrancheType().equals(EnumBrancheType.EMHBrancheSaintVenant);
-
+
List<RelationEMHSectionDansBranche> listeSectionsSortedXP = branche.getListeSectionsSortedXP(ccm);
ListRelationSectionContentFactoryNode factory = new ListRelationSectionContentFactoryNode();
//on ne s'occupe pas de la section aval:
@@ -84,9 +84,10 @@
sectionNode.setDisplayName(propertyXp.format(relation.getXp(), DecimalFormatEpsilonEnum.COMPARISON));
ModellingEMHBrancheStricklerPanel.removeWrite((AbstractNodeFirable) sectionNode);
nodes.add(sectionNode);
- RelationEMHSectionDansBrancheSaintVenant relationSaintVenant = isSaintVenant ? (RelationEMHSectionDansBrancheSaintVenant) relation : new RelationEMHSectionDansBrancheSaintVenant(
- ccm);
- CommonObjectNode<RelationEMHSectionDansBrancheSaintVenant> node = new CommonObjectNode<RelationEMHSectionDansBrancheSaintVenant>(
+ RelationEMHSectionDansBrancheSaintVenant relationSaintVenant = isSaintVenant ? ((RelationEMHSectionDansBrancheSaintVenant) relation).
+ cloneValuesOnly() : new RelationEMHSectionDansBrancheSaintVenant(
+ ccm);
+ CommonObjectNode<RelationEMHSectionDansBrancheSaintVenant> node = new CommonObjectNode<>(
relationSaintVenant, ccm, perspectiveServiceModelling);
node.addPropertyChangeListener(new PropertyChangeListener() {
@Override
@@ -96,7 +97,7 @@
});
nodes.add(node);
}
-
+
avalNode = factory.create(branche, sectionAval, ccm);
avalNode.setDisplayName(propertyXp.format(sectionAval.getXp(), DecimalFormatEpsilonEnum.COMPARISON));
ModellingEMHBrancheStricklerPanel.removeWrite((AbstractNodeFirable) avalNode);
@@ -114,10 +115,10 @@
view.getOutline().setRootVisible(false);
em.setRootContext(NodeHelper.createNode(nodes, "SECTIONS"));
parent.getLookup();
-
+
add(view);
}
-
+
private JPanel createTopPanel(DonCalcSansPrtBrancheSaintVenant dcsp, final CrueConfigMetier ccm, DonPrtGeoBrancheSaintVenant dptg,
CatEMHBranche branche) throws MissingResourceException {
JPanel pnTop = new JPanel(new BuGridLayout(4, 10, 10));
@@ -140,16 +141,16 @@
distance.addObserver(this);
return pnTop;
}
-
+
@Override
public ExplorerManager getExplorerManager() {
return em;
}
-
+
private Node createLabelNode(String name) {
return new DelimiteurNode(name);
}
-
+
@Override
public void update(Observable o, Object arg) {
parent.setModified(true);
@@ -160,11 +161,11 @@
Exceptions.printStackTrace(exception);
}
}
-
+
private CrueConfigMetier getCcm() {
return modellingScenarioService.getSelectedProjet().getPropDefinition();
}
-
+
@Override
public void setEditable(boolean editable) {
for (ItemVariableView object : dcspProperties) {
@@ -191,7 +192,7 @@
}
return res;
}
-
+
@Override
public void fillWithData(BrancheEditionContent content) {
DonCalcSansPrtBrancheSaintVenant dcsp = new DonCalcSansPrtBrancheSaintVenant(getCcm());
@@ -203,7 +204,7 @@
content.setDcsp(dcsp);
content.setDptgSaintVenant(dptg);
}
-
+
@Override
public JComponent getComponent() {
return this;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|