You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(46) |
Jul
(37) |
Aug
(154) |
Sep
(140) |
Oct
(132) |
Nov
(104) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(113) |
Feb
(73) |
Mar
(102) |
Apr
(106) |
May
(114) |
Jun
(67) |
Jul
(116) |
Aug
(48) |
Sep
(108) |
Oct
(296) |
Nov
(56) |
Dec
(53) |
2010 |
Jan
(95) |
Feb
(31) |
Mar
(40) |
Apr
(12) |
May
(10) |
Jun
(27) |
Jul
(19) |
Aug
(81) |
Sep
(48) |
Oct
(45) |
Nov
(40) |
Dec
(7) |
2011 |
Jan
(16) |
Feb
(32) |
Mar
(55) |
Apr
(38) |
May
(24) |
Jun
(37) |
Jul
(12) |
Aug
(16) |
Sep
(97) |
Oct
(90) |
Nov
(101) |
Dec
(89) |
2012 |
Jan
(18) |
Feb
(2) |
Mar
(54) |
Apr
(69) |
May
(97) |
Jun
(131) |
Jul
(70) |
Aug
(48) |
Sep
(48) |
Oct
(119) |
Nov
(194) |
Dec
(60) |
2013 |
Jan
(73) |
Feb
(35) |
Mar
(42) |
Apr
(28) |
May
(7) |
Jun
(17) |
Jul
(27) |
Aug
(10) |
Sep
(38) |
Oct
(12) |
Nov
(4) |
Dec
(16) |
2014 |
Jan
(33) |
Feb
(37) |
Mar
(19) |
Apr
(3) |
May
(47) |
Jun
(26) |
Jul
(22) |
Aug
|
Sep
(10) |
Oct
(30) |
Nov
(24) |
Dec
(19) |
2015 |
Jan
(13) |
Feb
(16) |
Mar
(36) |
Apr
(19) |
May
(5) |
Jun
(5) |
Jul
(3) |
Aug
(11) |
Sep
(22) |
Oct
(7) |
Nov
(14) |
Dec
|
2016 |
Jan
|
Feb
(26) |
Mar
(13) |
Apr
(61) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(27) |
Nov
(14) |
Dec
(21) |
2017 |
Jan
(30) |
Feb
(4) |
Mar
(3) |
Apr
(5) |
May
(69) |
Jun
(29) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <bma...@us...> - 2016-11-18 11:01:37
|
Revision: 9454 http://sourceforge.net/p/fudaa/svn/9454 Author: bmarchan Date: 2016-11-18 11:01:34 +0000 (Fri, 18 Nov 2016) Log Message: ----------- Fix : Blocage IHM lors du calcul de vitesses. Modified Paths: -------------- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeAverageAction.java Modified: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeAverageAction.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeAverageAction.java 2016-11-08 10:13:19 UTC (rev 9453) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeAverageAction.java 2016-11-18 11:01:34 UTC (rev 9454) @@ -9,6 +9,8 @@ import java.awt.event.ActionEvent; +import javax.swing.SwingUtilities; + import org.fudaa.ctulu.CtuluLog; import org.fudaa.ctulu.gui.CtuluDialog; import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; @@ -100,8 +102,14 @@ diProgress_.dispose(); } - impl.message(PivResource.getS("Calcul termin\xE9"), PivResource.getS("Le calcul s'est termin\xE9 avec succ\xE8s"), false); - impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_REAL_VIEW); + // Lanc\xE9 \xE0 la fin, car l'interface se bloque si on ne le fait pas. + // Probl\xE8me de thread swing probablement... + SwingUtilities.invokeLater(new Runnable() { + public void run() { + impl.message(PivResource.getS("Calcul termin\xE9"), PivResource.getS("Le calcul s'est termin\xE9 avec succ\xE8s"), false); + impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_REAL_VIEW); + } + }); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-24 14:43:42
|
Revision: 9452 http://sourceforge.net/p/fudaa/svn/9452 Author: deniger Date: 2016-10-24 14:43:39 +0000 (Mon, 24 Oct 2016) Log Message: ----------- code plus securis?\195?\169 pour la gestion des traductions. Modified Paths: -------------- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/ui/OrdCalcScenarioUiState.java trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/pdt/DurationPropertyEditor.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingComputeDataTopComponent.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/action/ModellingSaveAction.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculDuplicateNodeAction.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/action/Bundle.properties Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/ui/OrdCalcScenarioUiState.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/ui/OrdCalcScenarioUiState.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/ui/OrdCalcScenarioUiState.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -20,7 +20,7 @@ private final LinkedHashMap<String, CalcOrdCalcUiState> calcOrdCalcUiStates = new LinkedHashMap<>(); public void addCalcOrdCalcUiStates(String calcId, OrdCalc calcOrdCalcUiState) { - calcOrdCalcUiStates.put(calcId, new CalcOrdCalcUiState(calcId, calcOrdCalcUiState)); + calcOrdCalcUiStates.put(calcId.toUpperCase(), new CalcOrdCalcUiState(calcId, calcOrdCalcUiState)); } /** @@ -31,6 +31,12 @@ return new ArrayList<>(calcOrdCalcUiStates.keySet()); } + public void addAll(OrdCalcScenarioUiState other) { + if (other != null) { + calcOrdCalcUiStates.putAll(other.calcOrdCalcUiStates); + } + } + /** * * @return la liste des ordCalc UI dans l'ordre Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -108,7 +108,7 @@ protected Result sortCalcWithSavedUi(OrdCalcScenario ocal, List<Calc> clonedCalcs, OrdCalcScenarioUiState uiOCalData) { Result res = new Result(); - Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfNom(clonedCalcs); + Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfId(clonedCalcs); final List<String> calcNameInOrder = uiOCalData.getCalcNameInOrder(); boolean isCoherent = isUiSavedCalcAccordingToCalcs(clonedCalcs, calcNameInOrder); if (!isCoherent) { @@ -118,9 +118,9 @@ List<OrdCalc> ordCalcsInScenario = ocal.getOrdCalc(); Set<String> namesOfActiveCalcul = new HashSet<>(); for (OrdCalc ordCalc : ordCalcsInScenario) { - String calcName = ordCalc.getCalc().getNom(); - namesOfActiveCalcul.add(calcName); - final Calc calc = clonedCalcsByName.get(calcName); + String calcId = ordCalc.getCalc().getId(); + namesOfActiveCalcul.add(calcId); + final Calc calc = clonedCalcsByName.get(calcId); res.ordCalcs.add(ordCalc.deepCloneButNotCalc(calc)); } final List<CalcOrdCalcUiState> uiStates = uiOCalData.getUiStates(); @@ -128,13 +128,13 @@ final String calcName = uiState.getCalcId(); if (!namesOfActiveCalcul.contains(calcName)) { final OrdCalc ordCalcSaved = uiState.getOrdCalc(); - final Calc calc = clonedCalcsByName.get(calcName); + final Calc calc = clonedCalcsByName.get(calcName.toUpperCase()); assert calc != null : "uiOrdCalc: should not be null as the method isUiSavedCalcAccordingToCalcs should have tested it"; res.ordCalcsInUI.add(ordCalcSaved.deepCloneButNotCalc(calc)); } } for (String calcName : calcNameInOrder) { - final Calc calc = clonedCalcsByName.get(calcName); + final Calc calc = clonedCalcsByName.get(calcName.toUpperCase()); assert calc != null : "should not be null as the method isUiSavedCalcAccordingToCalcs should have tested it"; res.calcs.add(calc); } @@ -149,10 +149,10 @@ */ protected boolean isUiSavedCalcAccordingToCalcs(Collection<Calc> clonedCalcs, final Collection<String> calcNameInOrder) { //on va d'abord voir si le tout est cohérent: - Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfNom(clonedCalcs); if (clonedCalcs.size() == calcNameInOrder.size()) { + Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfId(clonedCalcs); for (String string : calcNameInOrder) { - if (!clonedCalcsByName.containsKey(string)) { + if (!clonedCalcsByName.containsKey(string.toUpperCase())) { return false; } } Modified: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/pdt/DurationPropertyEditor.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/pdt/DurationPropertyEditor.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/pdt/DurationPropertyEditor.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -49,7 +49,7 @@ @Override public void propertyChange(PropertyChangeEvent evt) { - if (PropertyEnv.PROP_STATE.equals(evt.getPropertyName()) + if (durationEditor != null && PropertyEnv.PROP_STATE.equals(evt.getPropertyName()) && evt.getNewValue() == PropertyEnv.STATE_VALID) { setValue(durationEditor.getDuration()); } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingComputeDataTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingComputeDataTopComponent.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingComputeDataTopComponent.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -7,6 +7,8 @@ import java.beans.PropertyChangeEvent; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import org.fudaa.ctulu.CtuluLogGroup; @@ -129,21 +131,40 @@ @Override public void valideModificationHandler() { Node[] nodes = getExplorerManager().getRootContext().getChildren().getNodes(); + //contiendra tous les calculs. Dans un premier temps ne contient que les permanents List<Calc> newCalcs = new ArrayList<>(); + //que les transitoires + List<Calc> newCalcsTransitoire = new ArrayList<>(); + //contiendra tous les ordres de calcul. Dans un premier temps ne contient que les permanents List<OrdCalc> newOrdCalcs = new ArrayList<>(); - //contiendra les données persistées dans l'éditeur ( données ui uniquement). + //que les transitoires + List<OrdCalc> newOrdCalcsTransitoire = new ArrayList<>(); + //contiendra les données persistées dans l'éditeur ( données ui uniquement). Ne contient que les permanents au début OrdCalcScenarioUiState uiStates = new OrdCalcScenarioUiState(); + //que les tansitoires + OrdCalcScenarioUiState uiStatesTransitoire = new OrdCalcScenarioUiState(); for (Node node : nodes) { CalculNode calculNode = (CalculNode) node; - newCalcs.add(calculNode.getCalc()); + final boolean isCalculPermanent = calculNode.getCalc().isPermanent(); + OrdCalcScenarioUiState uiStatesToUse = isCalculPermanent ? uiStates : uiStatesTransitoire; + List<Calc> newCalcsToUse = isCalculPermanent ? newCalcs : newCalcsTransitoire; + List<OrdCalc> newOrdCalcsToUse = isCalculPermanent ? newOrdCalcs : newOrdCalcsTransitoire; + newCalcsToUse.add(calculNode.getCalc()); CalculOcalNode ocalNode = calculNode.getOcalNode(); if (ocalNode != null) { - newOrdCalcs.add(ocalNode.getOrdCalc()); - uiStates.addCalcOrdCalcUiStates(calculNode.getCalc().getId(), ocalNode.getOrdCalc()); + newOrdCalcsToUse.add(ocalNode.getOrdCalc()); + uiStatesToUse.addCalcOrdCalcUiStates(calculNode.getCalc().getId(), ocalNode.getOrdCalc()); } else if (calculNode.getOldUsedOrdCalc() != null) { - uiStates.addCalcOrdCalcUiStates(calculNode.getCalc().getId(), calculNode.getOldUsedOrdCalc()); + uiStatesToUse.addCalcOrdCalcUiStates(calculNode.getCalc().getId(), calculNode.getOldUsedOrdCalc()); + } else { + Logger.getLogger(ModellingComputeDataTopComponent.class.getName()).log(Level.SEVERE, "calc without ocal data"); } } + //pour mettre dans l'ordre les permanents puis les transitoires + uiStates.addAll(uiStatesTransitoire); + newOrdCalcs.addAll(newOrdCalcsTransitoire); + newCalcs.addAll(newCalcsTransitoire); + OrdCalcScenario ocalTemp = new OrdCalcScenario(); DonCLimMScenario dclmTemp = new DonCLimMScenario(); for (OrdCalc ordCalc : newOrdCalcs) { @@ -281,11 +302,11 @@ fac.addNewCalc(calc); } } + private class CalcNodeListener implements NodeListener { public void reorderChildren() { expandedNodesManager.saveState(); - //on s'assure que les permanents sont avant les transitoire setModified(true); expandedNodesManager.restoreState(); } @@ -348,10 +369,8 @@ public boolean canMoveEndBeAdded(Node[] selectedNodes) { for (Node node : selectedNodes) { if (!node.getClass().equals(CalculNode.class)) { - return false; } - return ((CalculNode) node).isActivated(); } return true; } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/action/ModellingSaveAction.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/action/ModellingSaveAction.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/action/ModellingSaveAction.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -72,6 +72,9 @@ PerspectiveServiceModelling perpective = Lookup.getDefault().lookup(PerspectiveServiceModelling.class); perpective.setDirty(false); + } else { + DialogHelper.showError(NbBundle.getMessage(ModellingSaveAction.class, "ModellingSaveAction.ErrorMessage", + scenarioService.getManagerScenarioLoaded().getNom())); } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculDuplicateNodeAction.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculDuplicateNodeAction.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculDuplicateNodeAction.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -40,7 +40,7 @@ calc.setNom(nameFinder.findUniqueName(nodesName, calc.getNom(), 2)); CalculNodeFactory fac = new CalculNodeFactory(targetNode.outlineView); CalculOcalNode ocalNode = targetNode.getOcalNode(); - OrdCalc ordCalc = null; + OrdCalc ordCalc; if (ocalNode != null) { ordCalc = ocalNode.getOrdCalc(); } else { Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java 2016-10-24 14:43:39 UTC (rev 9452) @@ -22,6 +22,7 @@ import org.fudaa.dodico.crue.metier.emh.DonLoiHYConteneur; import org.fudaa.dodico.crue.metier.emh.Loi; import org.fudaa.dodico.crue.metier.emh.OrdCalc; +import org.fudaa.dodico.crue.metier.factory.OrdCalcFactory; import org.fudaa.dodico.crue.metier.helper.CalcHelper; import org.fudaa.dodico.crue.metier.helper.OrdCalcCloner; import org.fudaa.dodico.crue.metier.helper.OrdCalcCloner.Result; @@ -95,7 +96,12 @@ CalculNode node = new CalculNode(outlineView, createChildren(calc, ordCalcByCalc, donLoiHYConteneurCloned), calc, ccm, perspectiveServiceModelling); if (!node.isActivated()) { - node.setOldUsedOrdCalc(uiOrdCalcByCalc.get(calc)); + OrdCalc saved = uiOrdCalcByCalc.get(calc); + if (saved == null) { + saved = OrdCalcFactory.createDefaultOcal(calc, ccm); + } + node.setOldUsedOrdCalc(saved); + } nodes.add(node); } @@ -109,6 +115,7 @@ node = new CalculNode(outlineView, createChildren(newCalc, Collections.<Calc, OrdCalc>emptyMap(), donLoiHYConteneurCloned), newCalc, ccm, perspectiveServiceModelling); + node.setOldUsedOrdCalc(OrdCalcFactory.createDefaultOcal(newCalc, ccm)); ExplorerManager newManager = ExplorerManager.find(outlineView); final Node[] newNodeArray = new Node[]{node}; newManager.getRootContext().getChildren().add(newNodeArray); Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/action/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/action/Bundle.properties 2016-10-24 14:43:04 UTC (rev 9451) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/action/Bundle.properties 2016-10-24 14:43:39 UTC (rev 9452) @@ -19,6 +19,7 @@ Export.EndMessageDetails=Fichiers g\u00e9n\u00e9r\u00e9s {0} ExportCrue10.EndMessageDetails=Fichiers g\u00e9n\u00e9r\u00e9s {0} dans la version de grammaire {1} ModellingSaveAction.SucceedMessage=Sc\u00e9nario {0} sauv\u00e9 +ModellingSaveAction.ErrorMessage=Echec lors de la sauvegarde du sc\u00e9nario {0}. V\u00e9rifier le compte-rendu d''op\u00e9ration. ModellingCloseAction.ActivatedIsModified=La vue active contient des donn\u00e9es non valid\u00e9es ModellingCloseAction.IsModified=Des donn\u00e9es ne sont pas enregistr\u00e9es ModellingCloseAction.Confirm=Voulez-vous ignorer les modifications et fermer le sc\u00e9nario ? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-24 14:43:07
|
Revision: 9451 http://sourceforge.net/p/fudaa/svn/9451 Author: deniger Date: 2016-10-24 14:43:04 +0000 (Mon, 24 Oct 2016) Log Message: ----------- code plus securis?\195?\169 pour la gestion des traductions. Modified Paths: -------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogRecord.java Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogRecord.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogRecord.java 2016-10-24 09:50:23 UTC (rev 9450) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLogRecord.java 2016-10-24 14:43:04 UTC (rev 9451) @@ -4,6 +4,8 @@ import java.util.Date; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; @@ -19,7 +21,11 @@ msg = record.getMsg(); } if (!ArrayUtils.isEmpty(args)) { - msg = MessageFormat.format(msg, args); + try { + msg = MessageFormat.format(msg, args); + } catch (Exception ex) { + Logger.getLogger(CtuluLogRecord.class.getName()).log(Level.INFO, "cant localized message: " + msg, ex); + } } } if (msg == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-24 09:50:25
|
Revision: 9450 http://sourceforge.net/p/fudaa/svn/9450 Author: deniger Date: 2016-10-24 09:50:23 +0000 (Mon, 24 Oct 2016) Log Message: ----------- corrections tests unitaires Added Paths: ----------- trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.csv trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.xlsx Added: trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.csv =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.csv (rev 0) +++ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.csv 2016-10-24 09:50:23 UTC (rev 9450) @@ -0,0 +1,2 @@ +A;;B;C;D +E;F;;G;H Added: trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.xlsx =================================================================== (Binary files differ) Index: trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.xlsx =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.xlsx 2016-10-24 09:39:58 UTC (rev 9449) +++ trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.xlsx 2016-10-24 09:50:23 UTC (rev 9450) Property changes on: trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/fudaa/fudaa/crue/modelling/calcul/example.xlsx ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 9449 http://sourceforge.net/p/fudaa/svn/9449 Author: deniger Date: 2016-10-24 09:39:58 +0000 (Mon, 24 Oct 2016) Log Message: ----------- corrections tests unitaires Modified Paths: -------------- trunk/soft/fudaa-crue/ui-report/src/test/java/org/fudaa/fudaa/crue/report/formule/FormuleContentManagerDefaultBuilderTest.java Modified: trunk/soft/fudaa-crue/ui-report/src/test/java/org/fudaa/fudaa/crue/report/formule/FormuleContentManagerDefaultBuilderTest.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/test/java/org/fudaa/fudaa/crue/report/formule/FormuleContentManagerDefaultBuilderTest.java 2016-10-24 09:36:14 UTC (rev 9448) +++ trunk/soft/fudaa-crue/ui-report/src/test/java/org/fudaa/fudaa/crue/report/formule/FormuleContentManagerDefaultBuilderTest.java 2016-10-24 09:39:58 UTC (rev 9449) @@ -33,7 +33,7 @@ FormuleParametersExpr expr2 = new FormuleParametersExpr(); expr2.setDisplayName("expr2"); - expr2.setFormule("1+MaxSurT(\"Vol\")+Q+MoySurT(\"Splan\")"); + expr2.setFormule("1+MaxSurTousC_T(\"Vol\")+Q+MoySurTousC_T(\"Splan\")"); ReportGlobalServiceContrat reportGlobalServiceContrat = Lookup.getDefault().lookup(ReportGlobalServiceContrat.class); FormuleContentManagerDefaultBuilder builder = new FormuleContentManagerDefaultBuilder(Arrays.asList(expr1, expr2), reportGlobalServiceContrat); CtuluLogResult<FormuleContentManager> create = builder.create(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-21 14:42:14
|
Revision: 9447 http://sourceforge.net/p/fudaa/svn/9447 Author: deniger Date: 2016-10-21 14:42:11 +0000 (Fri, 21 Oct 2016) Log Message: ----------- Utilisation de la notation diamond Modified Paths: -------------- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java trunk/soft/fudaa-crue/crue-emh/src/test/java/org/fudaa/dodico/crue/metier/helper/OrdCalcClonerTest.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java 2016-10-21 09:28:45 UTC (rev 9446) +++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/helper/OrdCalcCloner.java 2016-10-21 14:42:11 UTC (rev 9447) @@ -4,11 +4,14 @@ package org.fudaa.dodico.crue.metier.helper; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; import org.fudaa.dodico.crue.common.transformer.TransformerHelper; import org.fudaa.dodico.crue.metier.comparator.ObjetNommeByNameComparator; import org.fudaa.dodico.crue.metier.emh.Calc; @@ -16,6 +19,9 @@ import org.fudaa.dodico.crue.metier.emh.EMHScenario; import org.fudaa.dodico.crue.metier.emh.OrdCalc; import org.fudaa.dodico.crue.metier.emh.OrdCalcScenario; +import org.fudaa.dodico.crue.metier.emh.ui.CalcOrdCalcUiState; +import org.fudaa.dodico.crue.metier.emh.ui.OrdCalcScenarioUiState; +import org.fudaa.dodico.crue.metier.etude.ManagerEMHScenario; /** * @@ -25,21 +31,42 @@ public static class Result { + /** + * contient les ordre de calcul definit dans le scenario* + */ public List<OrdCalc> ordCalcs = new ArrayList<>(); + /** + * contient les ordCalc definit dans le fichier ui ocal persistant les editions de l'utilisateur* + */ + public List<OrdCalc> ordCalcsinUI = new ArrayList<>(); + /** + * les calculs dans l ordre attendu. + */ public List<Calc> calcs = new ArrayList<>(); } - public Result cloneAndSort(EMHScenario scenario) { - return cloneOrdCalcAndCalc(scenario.getDonCLimMScenario(), scenario.getOrdCalcScenario()); + public Result cloneAndSort(EMHScenario scenario, ManagerEMHScenario managerEMHScenario) { + return cloneOrdCalcAndCalc(scenario.getDonCLimMScenario(), scenario.getOrdCalcScenario(), managerEMHScenario.getUiOCalData()); } - public Result cloneOrdCalcAndCalc(DonCLimMScenario dclm, OrdCalcScenario ocal) { - Result res = new Result(); + public Result cloneOrdCalcAndCalc(DonCLimMScenario dclm, OrdCalcScenario ocal, OrdCalcScenarioUiState uiOCalData) { List<Calc> calcs = dclm.getCalc(); List<Calc> clonedCalcs = new ArrayList<>(); for (Calc calc : calcs) { clonedCalcs.add(calc.deepClone()); } + Result res = null; + if (uiOCalData == null) { + res = sortCalcWithNoSavedUi(ocal, clonedCalcs); + } else { + res = sortCalcWithSavedUi(ocal, clonedCalcs, uiOCalData); + } + return res; + + } + + protected Result sortCalcWithNoSavedUi(OrdCalcScenario ocal, List<Calc> clonedCalcs) { + Result res = new Result(); Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfNom(clonedCalcs); List<OrdCalc> ordCalcs = ocal.getOrdCalc(); List<Calc> pseudoPermActivated = new ArrayList<>(); @@ -47,10 +74,10 @@ List<Calc> transActivated = new ArrayList<>(); List<Calc> transNonActivated = new ArrayList<>(); - Set<String> actifCalc = new HashSet<>(); + Set<String> namesOfActiveCalcul = new HashSet<>(); for (OrdCalc ordCalc : ordCalcs) { String calcName = ordCalc.getCalc().getNom(); - actifCalc.add(calcName); + namesOfActiveCalcul.add(calcName); final Calc calc = clonedCalcsByName.get(calcName); res.ordCalcs.add(ordCalc.deepCloneButNotCalc(calc)); if (ordCalc.isPseudoPermanent()) { @@ -60,7 +87,7 @@ } } for (Calc calc : clonedCalcs) { - if (!actifCalc.contains(calc.getNom())) { + if (!namesOfActiveCalcul.contains(calc.getNom())) { if (calc.isPermanent()) { pseudoPermNonActivated.add(calc); } else { @@ -78,4 +105,59 @@ res.calcs.addAll(transNonActivated); return res; } + + protected Result sortCalcWithSavedUi(OrdCalcScenario ocal, List<Calc> clonedCalcs, OrdCalcScenarioUiState uiOCalData) { + Result res = new Result(); + Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfNom(clonedCalcs); + final List<String> calcNameInOrder = uiOCalData.getCalcNameInOrder(); + boolean isCoherent = isUiSavedCalcAccordingToCalcs(clonedCalcs, calcNameInOrder); + if (!isCoherent) { + Logger.getLogger(OrdCalcCloner.class.getName()).log(Level.WARNING, "The ocal ui file is not coherent with the ocal data"); + return sortCalcWithNoSavedUi(ocal, clonedCalcs); + } + List<OrdCalc> ordCalcsInScenario = ocal.getOrdCalc(); + Set<String> namesOfActiveCalcul = new HashSet<>(); + for (OrdCalc ordCalc : ordCalcsInScenario) { + String calcName = ordCalc.getCalc().getNom(); + namesOfActiveCalcul.add(calcName); + final Calc calc = clonedCalcsByName.get(calcName); + res.ordCalcs.add(ordCalc.deepCloneButNotCalc(calc)); + } + final List<CalcOrdCalcUiState> uiStates = uiOCalData.getUiStates(); + for (CalcOrdCalcUiState uiState : uiStates) { + final String calcName = uiState.getCalcId(); + if (!namesOfActiveCalcul.contains(calcName)) { + final OrdCalc ordCalcSaved = uiState.getOrdCalc(); + final Calc calc = clonedCalcsByName.get(calcName); + assert calc != null : "uiOrdCalc: should not be null as the method isUiSavedCalcAccordingToCalcs should have tested it"; + res.ordCalcsinUI.add(ordCalcSaved.deepCloneButNotCalc(calc)); + } + } + for (String calcName : calcNameInOrder) { + final Calc calc = clonedCalcsByName.get(calcName); + assert calc != null : "should not be null as the method isUiSavedCalcAccordingToCalcs should have tested it"; + res.calcs.add(calc); + } + return res; + } + + /** + * + * @param clonedCalcs la liste des calculs presents dans l'etude + * @param calcNameInOrder la liste des calculs presents dans le fichier ui-ocal permettant de persister les editions de l'utilisateur + * @return true si les 2 données sont coherentes et si on peut les utiliser. + */ + protected boolean isUiSavedCalcAccordingToCalcs(Collection<Calc> clonedCalcs, final Collection<String> calcNameInOrder) { + //on va d'abord voir si le tout est cohérent: + Map<String, Calc> clonedCalcsByName = TransformerHelper.toMapOfNom(clonedCalcs); + if (clonedCalcs.size() == calcNameInOrder.size()) { + for (String string : calcNameInOrder) { + if (!clonedCalcsByName.containsKey(string)) { + return false; + } + } + return true; + } + return false; + } } Modified: trunk/soft/fudaa-crue/crue-emh/src/test/java/org/fudaa/dodico/crue/metier/helper/OrdCalcClonerTest.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/test/java/org/fudaa/dodico/crue/metier/helper/OrdCalcClonerTest.java 2016-10-21 09:28:45 UTC (rev 9446) +++ trunk/soft/fudaa-crue/crue-emh/src/test/java/org/fudaa/dodico/crue/metier/helper/OrdCalcClonerTest.java 2016-10-21 14:42:11 UTC (rev 9447) @@ -3,12 +3,19 @@ */ package org.fudaa.dodico.crue.metier.helper; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetierLoaderDefaultTest; +import org.fudaa.dodico.crue.metier.emh.Calc; import org.fudaa.dodico.crue.metier.emh.CalcPseudoPerm; import org.fudaa.dodico.crue.metier.emh.CalcPseudoPermBrancheOrificeManoeuvre; import org.fudaa.dodico.crue.metier.emh.DonCLimMScenario; import org.fudaa.dodico.crue.metier.emh.OrdCalcPseudoPermIniCalcCI; +import org.fudaa.dodico.crue.metier.emh.OrdCalcPseudoPermIniCalcPrecedent; import org.fudaa.dodico.crue.metier.emh.OrdCalcScenario; +import org.fudaa.dodico.crue.metier.emh.ui.OrdCalcScenarioUiState; import org.fudaa.dodico.crue.metier.helper.OrdCalcCloner.Result; import static org.junit.Assert.*; import org.junit.Test; @@ -27,18 +34,96 @@ DonCLimMScenario dclm = new DonCLimMScenario(); OrdCalcScenario ocal = new OrdCalcScenario(); CalcPseudoPerm pseudo = new CalcPseudoPerm(); - final CalcPseudoPermBrancheOrificeManoeuvre calcPseudoPermBrancheOrificeManoeuvre = new CalcPseudoPermBrancheOrificeManoeuvre(CrueConfigMetierLoaderDefaultTest.DEFAULT); + final CalcPseudoPermBrancheOrificeManoeuvre calcPseudoPermBrancheOrificeManoeuvre = new CalcPseudoPermBrancheOrificeManoeuvre( + CrueConfigMetierLoaderDefaultTest.DEFAULT); pseudo.addCalcPseudoPermBrancheOrificeManoeuvre(calcPseudoPermBrancheOrificeManoeuvre); OrdCalcPseudoPermIniCalcCI ci = new OrdCalcPseudoPermIniCalcCI(); ci.setCalcPseudoPerm(pseudo); dclm.addCalcPseudoPerm(pseudo); ocal.addOrdCalc(ci); OrdCalcCloner cloner = new OrdCalcCloner(); - Result cloneOrdCalcAndCalc = cloner.cloneOrdCalcAndCalc(dclm, ocal); + Result cloneOrdCalcAndCalc = cloner.cloneOrdCalcAndCalc(dclm, ocal, null); assertEquals(1, cloneOrdCalcAndCalc.calcs.size()); assertEquals(1, cloneOrdCalcAndCalc.ordCalcs.size()); assertTrue(cloneOrdCalcAndCalc.calcs.get(0) == cloneOrdCalcAndCalc.ordCalcs.get(0).getCalc()); assertFalse(cloneOrdCalcAndCalc.calcs.get(0) == pseudo); assertFalse(cloneOrdCalcAndCalc.ordCalcs.get(0) == ci); } + + @Test + public void testCloneOrdCalcAndCalcUI() { + DonCLimMScenario dclm = new DonCLimMScenario(); + OrdCalcScenario ocal = new OrdCalcScenario(); + CalcPseudoPerm pseudo = new CalcPseudoPerm(); + pseudo.setNom("CC_P1"); + final CalcPseudoPermBrancheOrificeManoeuvre calcPseudoPermBrancheOrificeManoeuvre = new CalcPseudoPermBrancheOrificeManoeuvre( + CrueConfigMetierLoaderDefaultTest.DEFAULT); + pseudo.addCalcPseudoPermBrancheOrificeManoeuvre(calcPseudoPermBrancheOrificeManoeuvre); + OrdCalcPseudoPermIniCalcCI ordCalc = new OrdCalcPseudoPermIniCalcCI(); + ordCalc.setCalcPseudoPerm(pseudo); + dclm.addCalcPseudoPerm(pseudo); + ocal.addOrdCalc(ordCalc); + + CalcPseudoPerm pseudo2 = new CalcPseudoPerm(); + pseudo2.setNom("CC_P2"); + dclm.addCalcPseudoPerm(pseudo2); + + + OrdCalcScenarioUiState ui = new OrdCalcScenarioUiState(); + //ici dans l'ordre on inverse les calcul + ui.addCalcOrdCalcUiStates("CC_P2", new OrdCalcPseudoPermIniCalcPrecedent()); + ui.addCalcOrdCalcUiStates("CC_P1", new OrdCalcPseudoPermIniCalcPrecedent()); + //donc + int idxCCP2 = 0; + int idxCCP1 = 1; + + OrdCalcCloner cloner = new OrdCalcCloner(); + Result cloneOrdCalcAndCalc = cloner.cloneOrdCalcAndCalc(dclm, ocal, ui); + //test des calculs: + assertEquals(2, cloneOrdCalcAndCalc.calcs.size()); + //attention l'ordre est inversion + assertTrue(cloneOrdCalcAndCalc.calcs.get(idxCCP2) == cloneOrdCalcAndCalc.ordCalcsinUI.get(0).getCalc()); + assertFalse(cloneOrdCalcAndCalc.calcs.get(idxCCP2) == pseudo2); + + assertTrue(cloneOrdCalcAndCalc.calcs.get(idxCCP1) == cloneOrdCalcAndCalc.ordCalcs.get(0).getCalc()); + assertFalse(cloneOrdCalcAndCalc.calcs.get(idxCCP1) == pseudo); + + //les ordres de calcul + assertEquals(1, cloneOrdCalcAndCalc.ordCalcs.size()); + assertEquals("CC_P1", cloneOrdCalcAndCalc.ordCalcs.get(0).getCalc().getId()); + assertTrue(cloneOrdCalcAndCalc.ordCalcs.get(0) instanceof OrdCalcPseudoPermIniCalcCI); + assertFalse(cloneOrdCalcAndCalc.ordCalcs.get(0) == ordCalc); + //les ordres de calcul UI + assertEquals(1, cloneOrdCalcAndCalc.ordCalcsinUI.size()); + assertEquals("CC_P2", cloneOrdCalcAndCalc.ordCalcsinUI.get(0).getCalc().getId()); + assertTrue(cloneOrdCalcAndCalc.ordCalcsinUI.get(0) instanceof OrdCalcPseudoPermIniCalcPrecedent); + + } + + @Test + public void testIsUiSavedCalcAccordingToCalcs() { + OrdCalcCloner cloner = new OrdCalcCloner(); + List<String> calcInOrder = Arrays.asList("CC_P1", "CC_P2"); + Collection<Calc> calcs = createCalcs("CC_P1"); + assertFalse(cloner.isUiSavedCalcAccordingToCalcs(calcs, calcInOrder)); + calcs = createCalcs("CC_P1", "CC_P2"); + assertTrue(cloner.isUiSavedCalcAccordingToCalcs(calcs, calcInOrder)); + calcs = createCalcs("CC_P1", "CC_P3"); + assertFalse(cloner.isUiSavedCalcAccordingToCalcs(calcs, calcInOrder)); + } + + private static Calc createCalc(String id) { + CalcPseudoPerm res = new CalcPseudoPerm(); + res.setNom(id); + return res; + } + + private static Collection<Calc> createCalcs(String... ids) { + List<Calc> calcs = new ArrayList<>(); + for (String id : ids) { + calcs.add(createCalc(id)); + } + return calcs; + } + } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java 2016-10-21 09:28:45 UTC (rev 9446) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java 2016-10-21 14:42:11 UTC (rev 9447) @@ -47,6 +47,12 @@ private final DonLoiHYConteneur donLoiHYConteneurCloned; private final Map<String, Loi> clonedLoisByName; + public CalculNodeFactory(OutlineView outlineView) { + this.outlineView = outlineView; + donLoiHYConteneurCloned = (DonLoiHYConteneur) outlineView.getClientProperty(DonLoiHYConteneur.class); + clonedLoisByName = TransformerHelper.toMapOfNom(donLoiHYConteneurCloned.getLois()); + } + protected Children createChildren(Calc calc, Map<Calc, OrdCalc> ordCalcByCalcs, DonLoiHYConteneur donLoiHYConteneur) { List<Node> nodes = new ArrayList<>(); List<DonCLimM> listeDCLM = calc.getlisteDCLM(); @@ -68,19 +74,14 @@ return NodeHelper.createArray(nodes); } - public CalculNodeFactory(OutlineView outlineView) { - this.outlineView = outlineView; - donLoiHYConteneurCloned = (DonLoiHYConteneur) outlineView.getClientProperty(DonLoiHYConteneur.class); - clonedLoisByName = TransformerHelper.toMapOfNom(donLoiHYConteneurCloned.getLois()); - } - public List<CalculNode> createNodes() { if (modellingScenarioService.getScenarioLoaded() == null) { return Collections.emptyList(); } List<CalculNode> nodes = new ArrayList<>(); OrdCalcCloner cloner = new OrdCalcCloner(); - Result cloneOrdCalcAndCalc = cloner.cloneAndSort(modellingScenarioService.getScenarioLoaded()); + Result cloneOrdCalcAndCalc = cloner. + cloneAndSort(modellingScenarioService.getScenarioLoaded(), modellingScenarioService.getManagerScenarioLoaded()); final Map<Calc, OrdCalc> ordCalcByCalc = CalcHelper.getOrdCalcByCalc(cloneOrdCalcAndCalc.ordCalcs); //TODO trier les calculs ici: final CrueConfigMetier ccm = modellingScenarioService.getSelectedProjet().getPropDefinition(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-18 06:47:05
|
Revision: 9443 http://sourceforge.net/p/fudaa/svn/9443 Author: deniger Date: 2016-10-18 06:47:03 +0000 (Tue, 18 Oct 2016) Log Message: ----------- ajout icones sur les menus Modified Paths: -------------- trunk/framework/pom.xml Modified: trunk/framework/pom.xml =================================================================== --- trunk/framework/pom.xml 2016-10-17 21:38:37 UTC (rev 9442) +++ trunk/framework/pom.xml 2016-10-18 06:47:03 UTC (rev 9443) @@ -372,7 +372,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.10</version> + <version>4.12</version> <scope>test</scope> </dependency> </dependencies> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2016-10-17 21:37:59
|
Revision: 9441 http://sourceforge.net/p/fudaa/svn/9441 Author: bmarchan Date: 2016-10-17 21:37:58 +0000 (Mon, 17 Oct 2016) Log Message: ----------- Passage ?\195?\160 version 1.9-SNAPSHOT Modified Paths: -------------- trunk/soft/fudaa-lspiv/pom.xml Modified: trunk/soft/fudaa-lspiv/pom.xml =================================================================== --- trunk/soft/fudaa-lspiv/pom.xml 2016-10-14 12:35:26 UTC (rev 9440) +++ trunk/soft/fudaa-lspiv/pom.xml 2016-10-17 21:37:58 UTC (rev 9441) @@ -3,8 +3,8 @@ <modelVersion>4.0.0</modelVersion> <properties> - <fudaa-framework.version>1.7-SNAPSHOT</fudaa-framework.version> - <fudaa-mesh.version>1.7-SNAPSHOT</fudaa-mesh.version> + <fudaa-framework.version>1.9-SNAPSHOT</fudaa-framework.version> + <fudaa-mesh.version>1.9-SNAPSHOT</fudaa-mesh.version> <javaCompiler>1.7</javaCompiler> <targetJdk>1.7</targetJdk> </properties> @@ -80,11 +80,12 @@ <dependency> <groupId>org.fudaa.business.fudaa-ef</groupId> <artifactId>ef-core</artifactId> + <version>1.9-SNAPSHOT</version> </dependency> <dependency> <groupId>org.fudaa.business.fudaa-sig</groupId> <artifactId>fudaa-sig</artifactId> - <version>1.7-SNAPSHOT</version> + <version>1.9-SNAPSHOT</version> </dependency> <dependency> <groupId>org.fudaa.framework.ebli</groupId> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2016-10-14 12:35:29
|
Revision: 9440 http://sourceforge.net/p/fudaa/svn/9440 Author: bmarchan Date: 2016-10-14 12:35:26 +0000 (Fri, 14 Oct 2016) Log Message: ----------- Actions Import Ortho parameters et Import Compute parameters Modified Paths: -------------- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivUtils.java Added Paths: ----------- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineComputeParamAction.java trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineOrthoParamAction.java trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportComputeParamAction.java trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportOrthoParamAction.java Removed Paths: ------------- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeParamAction.java trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivOrthoParamAction.java Modified: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java 2016-10-13 21:22:53 UTC (rev 9439) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivImplementation.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -47,13 +47,15 @@ import org.fudaa.fudaa.piv.action.PivComputeAverageAction; import org.fudaa.fudaa.piv.action.PivComputeFlowAction; import org.fudaa.fudaa.piv.action.PivComputeLaunchAction; -import org.fudaa.fudaa.piv.action.PivComputeParamAction; +import org.fudaa.fudaa.piv.action.PivDefineComputeParamAction; +import org.fudaa.fudaa.piv.action.PivDefineOrthoParamAction; import org.fudaa.fudaa.piv.action.PivExportImagesAction; +import org.fudaa.fudaa.piv.action.PivImportComputeParamAction; import org.fudaa.fudaa.piv.action.PivImportGRPAction; import org.fudaa.fudaa.piv.action.PivImportGridAction; +import org.fudaa.fudaa.piv.action.PivImportOrthoParamAction; import org.fudaa.fudaa.piv.action.PivImportTransectAction; import org.fudaa.fudaa.piv.action.PivOrthoLaunchAction; -import org.fudaa.fudaa.piv.action.PivOrthoParamAction; import org.fudaa.fudaa.piv.action.PivOrthoVerifyGRPAction; import org.fudaa.fudaa.piv.action.PivSelectImagesAction; import org.fudaa.fudaa.piv.action.PivShow3DTransectAction; @@ -88,8 +90,8 @@ protected static BuInformationsSoftware isPIV_ = new BuInformationsSoftware(); static { isPIV_.name = "LSPIV"; - isPIV_.version = "1.4.5"; - isPIV_.date = "2016-03-23"; + isPIV_.version = "1.5.0"; + isPIV_.date = "2016-10-13"; isPIV_.rights = PivResource.getS("Tous droits r\xE9serv\xE9s")+". CEREMA (c)1999-2016"; isPIV_.license = "GPL2"; isPIV_.languages = "en,fr"; @@ -168,8 +170,10 @@ setEnabledForAction("IMPORT_GRP", bprjOpen && bprjHasSrcImg); setEnabledForAction("VERIFY_GRP", bprjOpen && project.getOrthoPoints()!=null); setEnabledForAction("DEFINE_ORTHO_PARAM", bprjOpen && project.getOrthoPoints()!=null && bprjHasSrcImg); + setEnabledForAction("IMPORT_ORTHO_PARAM", bprjOpen && project.getOrthoPoints()!=null && bprjHasSrcImg); setEnabledForAction("COMPUTE_ORTHO", bprjOpen); setEnabledForAction("DEFINE_PIV_PARAM", bprjOpen && bprjHasTransfImg); + setEnabledForAction("IMPORT_PIV_PARAM", bprjOpen && bprjHasTransfImg); setEnabledForAction("DEFINE_GRID", bprjOpen && bprjHasTransfImg); setEnabledForAction("IMPORT_GRID", bprjOpen && bprjHasTransfImg); setEnabledForAction("IMPORT_TRANSECT", bprjOpen && bprjHasTransfImg); @@ -790,19 +794,38 @@ sm.add(bt); mn.add(sm); mn.add(new PivOrthoVerifyGRPAction(this)); - mn.add(new PivOrthoParamAction(this)); + + sm=new BuMenu(PivResource.getS("Param\xE8tres de transformation"),"mnTRF",true); + bt=new PivDefineOrthoParamAction(this).buildMenuItem(EbliComponentFactory.INSTANCE); + bt.setText(PivResource.getS("D\xE9finir...")); + sm.add(bt); + bt=new PivImportOrthoParamAction(this).buildMenuItem(EbliComponentFactory.INSTANCE); + bt.setText(PivResource.getS("Importer...")); + sm.add(bt); + mn.add(sm); + mn.add(new PivOrthoLaunchAction(this)); mn.addSeparator(PivResource.getS("Analyse LSPIV")); - mn.add(new PivComputeParamAction(this)); + + sm=new BuMenu(PivResource.getS("Param\xE8tres de calcul"),"mnCAL",true); + bt=new PivDefineComputeParamAction(this).buildMenuItem(EbliComponentFactory.INSTANCE); + bt.setText(PivResource.getS("D\xE9finir...")); + sm.add(bt); + bt=new PivImportComputeParamAction(this).buildMenuItem(EbliComponentFactory.INSTANCE); + bt.setText(PivResource.getS("Importer...")); + sm.add(bt); + mn.add(sm); + sm=new BuMenu(PivResource.getS("Points de grille"),"mnGRP"); bt=get2dFrame().getVisuPanel().getComputeGridDefinitionAction().buildMenuItem(EbliComponentFactory.INSTANCE); bt.setText(PivResource.getS("D\xE9finir...")); sm.add(bt); - bt=new PivImportGridAction((this)).buildMenuItem(EbliComponentFactory.INSTANCE); + bt=new PivImportGridAction(this).buildMenuItem(EbliComponentFactory.INSTANCE); bt.setText(PivResource.getS("Importer...")); sm.add(bt); mn.add(sm); + mn.add(new PivComputeLaunchAction(this)); mn.addSeparator(PivResource.getS("Post-traitement")); Modified: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivUtils.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivUtils.java 2016-10-13 21:22:53 UTC (rev 9439) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/PivUtils.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -51,6 +51,16 @@ */ public static BuFileFilter FILE_FLT_GRID; /** + * Un filtre des fichiers img_ref.dat, utilis\xE9e lors de l'import + * par boite de dialogue. + */ + public static BuFileFilter FILE_FLT_TRANSF_PARAMS; + /** + * Un filtre des fichiers PIV_param.dat, utilis\xE9e lors de l'import + * par boite de dialogue. + */ + public static BuFileFilter FILE_FLT_COMPUTE_PARAMS; + /** * Un filtre des fichiers images, utilis\xE9e lors de la selection * des fichiers par boite de dialogue. */ @@ -69,12 +79,14 @@ * Initialise les champs statiques d\xE9pendants du language. */ static { - PivUtils.FILE_FLT_PROJ=new BuFileFilter("lspiv.zip",PivResource.getS("Fichier projet")); - PivUtils.FILE_FLT_PGM=new BuFileFilter("pgm",PivResource.getS("Fichiers images en niveaux de gris")); - PivUtils.FILE_FLT_IMAGES=new BuFileFilter(new String[]{"jpg","jpeg","gif","png","pgm","tif","tiff","bmp"},PivResource.getS("Fichiers images")); - PivUtils.FILE_FLT_GRID=new BuFileFilter("dat",PivResource.getS("Fichier grid")); - PivUtils.FILE_FLT_GRP=new BuFileFilter("dat",PivResource.getS("Fichier GRP")); - PivUtils.FILE_FLT_BATHY=new BuFileFilter(new String[]{"dat",FILE_FLT_TRANS_BTH.getFirstExt()},PivResource.getS("Fichier bathy")); + FILE_FLT_PROJ=new BuFileFilter("lspiv.zip",PivResource.getS("Fichier projet")); + FILE_FLT_PGM=new BuFileFilter("pgm",PivResource.getS("Fichiers images en niveaux de gris")); + FILE_FLT_IMAGES=new BuFileFilter(new String[]{"jpg","jpeg","gif","png","pgm","tif","tiff","bmp"},PivResource.getS("Fichiers images")); + FILE_FLT_GRID=new BuFileFilter("dat",PivResource.getS("Fichier grid")); + FILE_FLT_GRP=new BuFileFilter("dat",PivResource.getS("Fichier GRP")); + FILE_FLT_BATHY=new BuFileFilter(new String[]{"dat",FILE_FLT_TRANS_BTH.getFirstExt()},PivResource.getS("Fichier bathy")); + FILE_FLT_TRANSF_PARAMS=new BuFileFilter("dat",PivResource.getS("Fichier params transformation")); + FILE_FLT_COMPUTE_PARAMS=new BuFileFilter("dat",PivResource.getS("Fichier params calcul")); } /** Deleted: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeParamAction.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeParamAction.java 2016-10-13 21:22:53 UTC (rev 9439) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeParamAction.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -1,63 +0,0 @@ -/* - * @creation 3 juil. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package org.fudaa.fudaa.piv.action; - -import java.awt.event.ActionEvent; - -import org.fudaa.ctulu.gui.CtuluDialog; -import org.fudaa.ebli.commun.EbliActionSimple; -import org.fudaa.fudaa.piv.PivComputeParamPanel; -import org.fudaa.fudaa.piv.PivImplementation; -import org.fudaa.fudaa.piv.PivResource; -import org.fudaa.fudaa.piv.PivVisuPanel; -import org.fudaa.fudaa.piv.metier.PivComputeParameters; - -/** - * Une action pour saisir les parametres de calcul. - * - * @author Bertrand Marchand (mar...@de...) - * @version $Id$ - */ -public class PivComputeParamAction extends EbliActionSimple { - PivImplementation impl; - - public PivComputeParamAction(PivImplementation _impl) { - super(PivResource.getS("Param\xE8tres de calcul..."), null, "DEFINE_PIV_PARAM"); - impl=_impl; - setEnabled(false); - } - - /** - * Affiche le panneau des param\xE8tres de calcul. - * @param _e L'evenement pour l'action. - */ - public void actionPerformed(final ActionEvent _e) { - impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_TRANSF_VIEW); - - PivComputeParamPanel pn=new PivComputeParamPanel(impl.get2dFrame().getVisuPanel()) { - - @Override - public void apply() { - PivComputeParameters params=new PivComputeParameters(); - retrieveComputeParams(params); - impl.getCurrentProject().setComputeParameters(params); - } - }; - - PivComputeParameters params=impl.getCurrentProject().getComputeParameters(); - if (params==null) - params=new PivComputeParameters(); - pn.setComputeParams(params); - - pn.affiche(impl.getFrame(), PivResource.getS("Param\xE8tres de calcul"), CtuluDialog.OK_CANCEL_APPLY_OPTION); - } - - public String getEnableCondition() { - return PivResource.getS("Il doit exister au moins une image transform\xE9e"); - } -} Copied: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineComputeParamAction.java (from rev 9280, trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivComputeParamAction.java) =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineComputeParamAction.java (rev 0) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineComputeParamAction.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -0,0 +1,63 @@ +/* + * @creation 3 juil. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.piv.action; + +import java.awt.event.ActionEvent; + +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.piv.PivComputeParamPanel; +import org.fudaa.fudaa.piv.PivImplementation; +import org.fudaa.fudaa.piv.PivResource; +import org.fudaa.fudaa.piv.PivVisuPanel; +import org.fudaa.fudaa.piv.metier.PivComputeParameters; + +/** + * Une action pour saisir les parametres de calcul. + * + * @author Bertrand Marchand (mar...@de...) + * @version $Id$ + */ +public class PivDefineComputeParamAction extends EbliActionSimple { + PivImplementation impl; + + public PivDefineComputeParamAction(PivImplementation _impl) { + super(PivResource.getS("Param\xE8tres de calcul..."), null, "DEFINE_PIV_PARAM"); + impl=_impl; + setEnabled(false); + } + + /** + * Affiche le panneau des param\xE8tres de calcul. + * @param _e L'evenement pour l'action. + */ + public void actionPerformed(final ActionEvent _e) { + impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_TRANSF_VIEW); + + PivComputeParamPanel pn=new PivComputeParamPanel(impl.get2dFrame().getVisuPanel()) { + + @Override + public void apply() { + PivComputeParameters params=new PivComputeParameters(); + retrieveComputeParams(params); + impl.getCurrentProject().setComputeParameters(params); + } + }; + + PivComputeParameters params=impl.getCurrentProject().getComputeParameters(); + if (params==null) + params=new PivComputeParameters(); + pn.setComputeParams(params); + + pn.affiche(impl.getFrame(), PivResource.getS("Param\xE8tres de calcul"), CtuluDialog.OK_CANCEL_APPLY_OPTION); + } + + public String getEnableCondition() { + return PivResource.getS("Il doit exister au moins une image transform\xE9e"); + } +} Copied: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineOrthoParamAction.java (from rev 9320, trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivOrthoParamAction.java) =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineOrthoParamAction.java (rev 0) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivDefineOrthoParamAction.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -0,0 +1,73 @@ +/* + * @creation 3 juil. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.piv.action; + +import java.awt.event.ActionEvent; + +import org.fudaa.ctulu.CtuluLog; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.piv.PivImplementation; +import org.fudaa.fudaa.piv.PivOrthoParamPanel; +import org.fudaa.fudaa.piv.PivResource; +import org.fudaa.fudaa.piv.PivVisuPanel; + +/** + * Une action pour saisir les parametres de l'orthorectification. + * + * @author Bertrand Marchand (mar...@de...) + * @version $Id$ + */ +public class PivDefineOrthoParamAction extends EbliActionSimple { + PivImplementation impl; + + /** + * Constructeur. + * @param _impl L'implementation. + */ + public PivDefineOrthoParamAction(PivImplementation _impl) { + super(PivResource.getS("Param\xE8tres de transformation..."), null, "DEFINE_ORTHO_PARAM"); + impl=_impl; + setEnabled(false); + } + + public String getEnableCondition() { + return PivResource.getS("Il doit exister au moins une image source"); + } + + /** + * Affichage du panneau des param\xE8tres d'orthorectification. + * @param _e L'evenement pour l'action. + */ + public void actionPerformed(final ActionEvent _e) { + // On ne saisit les donn\xE9es que dans le rep\xE8re de calcul + if (impl.getCurrentProject().getTransformationParameters().isCurrentSystemInitial()) { + impl.error(PivResource.getS("Erreur"), PivResource.getS("Les param\xE8tres ne peuvent \xEAtre saisis\nque dans le rep\xE8re de calcul.")); + return; + } + + if (!isValide()) return; + + impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_REAL_VIEW); + + PivOrthoParamPanel pnParams=new PivOrthoParamPanel(impl); + + // La fenetre est affich\xE9e en mode non modal, le traitement est fait dans la + // fenetre elle meme. + pnParams.affiche(impl.getFrame(), PivResource.getS("Param\xE8tres de transformation"),CtuluDialog.OK_CANCEL_APPLY_OPTION); + } + + public boolean isValide() { + String mes=impl.getCurrentProject().areOrthoPointsOk(); + if (mes!=null) { + impl.error(PivResource.getS("Erreur"), mes); + return false; + } + return true; + } +} Added: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportComputeParamAction.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportComputeParamAction.java (rev 0) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportComputeParamAction.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -0,0 +1,95 @@ +/* + * @creation 3 juil. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.piv.action; + +import java.awt.event.ActionEvent; +import java.io.File; + +import org.fudaa.ctulu.CtuluIOResult; +import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.piv.PivImplementation; +import org.fudaa.fudaa.piv.PivResource; +import org.fudaa.fudaa.piv.PivUtils; +import org.fudaa.fudaa.piv.PivVisuPanel; +import org.fudaa.fudaa.piv.io.PivParamReader; +import org.fudaa.fudaa.piv.metier.PivComputeParameters; + +/** + * Une action pour importer les parametres de calcul. + * + * @author Bertrand Marchand (mar...@de...) + * @version $Id: PivImportGridAction.java 9083 2015-03-17 13:05:54Z bmarchan $ + */ +public class PivImportComputeParamAction extends EbliActionSimple { + PivImplementation impl; + CtuluFileChooser fcParams; + + /** + * Constructeur + * @param _impl L'implementation. + */ + public PivImportComputeParamAction(PivImplementation _impl) { + super(PivResource.getS("Import des param\xE8tres de calcul..."), null, "IMPORT_PIV_PARAM"); + + impl=_impl; + setEnabled(false); + } + + /** + * Selectionne le fichier d'import, et remplace les parametres. + * @param _e L'evenement pour l'action. + */ + @Override + public void actionPerformed(final ActionEvent _e) { + if (!isValide()) { + return; + } + + if (!impl.question(PivResource.getS("Param\xE8tres de calcul"), PivResource.getS("Les param\xE8tres de filtres seront aussi import\xE9s.\nVoulez-vous continuer ?"))) { + return; + } + + // Selection du fichier + if (fcParams==null) + fcParams = new CtuluFileChooser(true); + + fcParams.setAcceptAllFileFilterUsed(true); + fcParams.setFileFilter(PivUtils.FILE_FLT_COMPUTE_PARAMS); + fcParams.setMultiSelectionEnabled(false); + fcParams.setDialogTitle(PivResource.getS("S\xE9lection d'un fichier de parametres de calcul")); + if (fcParams.showOpenDialog(impl.getFrame()) == CtuluFileChooser.CANCEL_OPTION) { + return; + } + File paramsFile=fcParams.getSelectedFile(); + + CtuluIOResult<Object[]> ret = new PivParamReader().read(paramsFile, null); + if (ret.getAnalyze().containsErrorOrSevereError()) { + impl.error(ret.getAnalyze().getResume()); + return; + } + + PivComputeParameters params=(PivComputeParameters)ret.getSource()[0]; + + impl.getCurrentProject().setComputeParameters(params); + + impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_TRANSF_VIEW); + } + + /** + * @return true Si toutes les donn\xE9es sont pr\xE9sentes pour un lancement. + */ + public boolean isValide() { + return true; + } + + @Override + public String getEnableCondition() { + return PivResource.getS("Il doit exister au moins une image transform\xE9e"); + } +} Property changes on: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportComputeParamAction.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportOrthoParamAction.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportOrthoParamAction.java (rev 0) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportOrthoParamAction.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -0,0 +1,107 @@ +/* + * @creation 3 juil. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.piv.action; + +import java.awt.event.ActionEvent; +import java.io.File; + +import org.fudaa.ctulu.CtuluIOResult; +import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.piv.PivImplementation; +import org.fudaa.fudaa.piv.PivResource; +import org.fudaa.fudaa.piv.PivUtils; +import org.fudaa.fudaa.piv.PivVisuPanel; +import org.fudaa.fudaa.piv.io.PivHReader; +import org.fudaa.fudaa.piv.io.PivImgRefReader; +import org.fudaa.fudaa.piv.metier.PivOrthoParameters; + +/** + * Une action pour importer les parametres de transformation. + * + * @author Bertrand Marchand (mar...@de...) + * @version $Id: PivImportGridAction.java 9083 2015-03-17 13:05:54Z bmarchan $ + */ +public class PivImportOrthoParamAction extends EbliActionSimple { + PivImplementation impl; + CtuluFileChooser fcParams; + + /** + * Constructeur + * @param _impl L'implementation. + */ + public PivImportOrthoParamAction(PivImplementation _impl) { + super(PivResource.getS("Import des param\xE8tres d'orthorectification..."), null, "IMPORT_ORTHO_PARAM"); + + impl=_impl; + setEnabled(false); + } + + /** + * Selectionne le fichier d'import, et remplace les parametres. + * @param _e L'evenement pour l'action. + */ + @Override + public void actionPerformed(final ActionEvent _e) { + if (!isValide()) { + return; + } + + // Selection du fichier + if (fcParams==null) + fcParams = new CtuluFileChooser(true); + + fcParams.setAcceptAllFileFilterUsed(true); + fcParams.setFileFilter(PivUtils.FILE_FLT_TRANSF_PARAMS); + fcParams.setMultiSelectionEnabled(false); + fcParams.setDialogTitle(PivResource.getS("S\xE9lection d'un fichier de parametres de transformation")); + if (fcParams.showOpenDialog(impl.getFrame()) == CtuluFileChooser.CANCEL_OPTION) { + return; + } + File imgrefFile=fcParams.getSelectedFile(); + + CtuluIOResult<PivOrthoParameters> ret = new PivImgRefReader().read(imgrefFile, null); + if (ret.getAnalyze().containsErrorOrSevereError()) { + impl.error(ret.getAnalyze().getResume()); + return; + } + + PivOrthoParameters params=ret.getSource(); + + // Lecture du fichier h.dat associ\xE9. + File hFile = new File(imgrefFile.getParentFile(), "h.dat"); + if (hFile.exists()) { + CtuluIOResult<Double> ret2 = new PivHReader().read(hFile, null); + if (ret.getAnalyze().containsErrorOrSevereError()) { + impl.error(ret.getAnalyze().getResume()); + return; + } + + params.setWaterElevation(ret2.getSource()); + } + else { + impl.warn(PivResource.getS("Fichier manquant"), PivResource.getS("Le fichier h.dat correspondant est manquant.\nLe niveau d'eau ne sera pas initialis\xE9.")); + } + + impl.getCurrentProject().setOrthoParameters(params); + + impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_REAL_VIEW); + } + + /** + * @return true Si toutes les donn\xE9es sont pr\xE9sentes pour un lancement. + */ + public boolean isValide() { + return true; + } + + @Override + public String getEnableCondition() { + return PivResource.getS("Il doit exister au moins une image source"); + } +} Property changes on: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivImportOrthoParamAction.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Deleted: trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivOrthoParamAction.java =================================================================== --- trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivOrthoParamAction.java 2016-10-13 21:22:53 UTC (rev 9439) +++ trunk/soft/fudaa-lspiv/src/main/java/org/fudaa/fudaa/piv/action/PivOrthoParamAction.java 2016-10-14 12:35:26 UTC (rev 9440) @@ -1,73 +0,0 @@ -/* - * @creation 3 juil. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package org.fudaa.fudaa.piv.action; - -import java.awt.event.ActionEvent; - -import org.fudaa.ctulu.CtuluLog; -import org.fudaa.ctulu.gui.CtuluDialog; -import org.fudaa.ebli.commun.EbliActionSimple; -import org.fudaa.fudaa.piv.PivImplementation; -import org.fudaa.fudaa.piv.PivOrthoParamPanel; -import org.fudaa.fudaa.piv.PivResource; -import org.fudaa.fudaa.piv.PivVisuPanel; - -/** - * Une action pour saisir les parametres de l'orthorectification. - * - * @author Bertrand Marchand (mar...@de...) - * @version $Id$ - */ -public class PivOrthoParamAction extends EbliActionSimple { - PivImplementation impl; - - /** - * Constructeur. - * @param _impl L'implementation. - */ - public PivOrthoParamAction(PivImplementation _impl) { - super(PivResource.getS("Param\xE8tres de transformation..."), null, "DEFINE_ORTHO_PARAM"); - impl=_impl; - setEnabled(false); - } - - public String getEnableCondition() { - return PivResource.getS("Il doit exister au moins une image source"); - } - - /** - * Affichage du panneau des param\xE8tres d'orthorectification. - * @param _e L'evenement pour l'action. - */ - public void actionPerformed(final ActionEvent _e) { - // On ne saisit les donn\xE9es que dans le rep\xE8re de calcul - if (impl.getCurrentProject().getTransformationParameters().isCurrentSystemInitial()) { - impl.error(PivResource.getS("Erreur"), PivResource.getS("Les param\xE8tres ne peuvent \xEAtre saisis\nque dans le rep\xE8re de calcul.")); - return; - } - - if (!isValide()) return; - - impl.get2dFrame().getVisuPanel().setViewMode(PivVisuPanel.MODE_REAL_VIEW); - - PivOrthoParamPanel pnParams=new PivOrthoParamPanel(impl); - - // La fenetre est affich\xE9e en mode non modal, le traitement est fait dans la - // fenetre elle meme. - pnParams.affiche(impl.getFrame(), PivResource.getS("Param\xE8tres de transformation"),CtuluDialog.OK_CANCEL_APPLY_OPTION); - } - - public boolean isValide() { - String mes=impl.getCurrentProject().areOrthoPointsOk(); - if (mes!=null) { - impl.error(PivResource.getS("Erreur"), mes); - return false; - } - return true; - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-13 08:59:26
|
Revision: 9438 http://sourceforge.net/p/fudaa/svn/9438 Author: deniger Date: 2016-10-13 08:59:24 +0000 (Thu, 13 Oct 2016) Log Message: ----------- ajout icones sur les menus Modified Paths: -------------- trunk/framework/pom.xml Modified: trunk/framework/pom.xml =================================================================== --- trunk/framework/pom.xml 2016-10-13 08:51:22 UTC (rev 9437) +++ trunk/framework/pom.xml 2016-10-13 08:59:24 UTC (rev 9438) @@ -372,7 +372,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>3.8.1</version> + <version>4.10</version> <scope>test</scope> </dependency> </dependencies> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 9437 http://sourceforge.net/p/fudaa/svn/9437 Author: deniger Date: 2016-10-13 08:51:22 +0000 (Thu, 13 Oct 2016) Log Message: ----------- ajout icones sur les menus Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java 2016-10-13 08:37:36 UTC (rev 9436) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java 2016-10-13 08:51:22 UTC (rev 9437) @@ -19,6 +19,7 @@ import org.fudaa.ctulu.gui.CtuluTableSimpleExporter; import org.fudaa.ctulu.table.CtuluTable; import org.fudaa.ctulu.table.CtuluTableModelDefault; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.crue.common.helper.CrueProgressUtils; import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; import org.fudaa.fudaa.crue.modelling.list.ListNodeAddPopupFactory; @@ -32,7 +33,7 @@ * * @author Frederic Deniger */ -public class ModellingListCiniTopComponentPopupFactory extends NodePopupFactory { +public final class ModellingListCiniTopComponentPopupFactory extends NodePopupFactory { ModellingListCiniTopComponent tc; @@ -64,6 +65,7 @@ menuItemPaste.setToolTipText(NbBundle.getMessage(ModellingListCiniTopComponentPopupFactory.class, "button.importFromClipboard.tooltip")); menuItemPaste.setEnabled(tc.isEditable()); menuItemPaste.setAccelerator(getPasteKeyStroke()); + menuItemPaste.setIcon(EbliResource.EBLI.getToolIcon("crystal_coller")); menuItemPaste.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -72,6 +74,7 @@ }); final JMenuItem menuItemImport = new JMenuItem(NbBundle.getMessage(ModellingListCiniTopComponentPopupFactory.class, "button.import.name")); menuItemImport.setToolTipText(NbBundle.getMessage(ModellingListCiniTopComponentPopupFactory.class, "button.importCini.tooltip")); + menuItemImport.setIcon(EbliResource.EBLI.getToolIcon("crystal_importer")); menuItemImport.setEnabled(tc.isEditable()); menuItemImport.addActionListener(new ActionListener() { @Override @@ -86,6 +89,7 @@ exportTable(); } }); + menuItemExport.setIcon(EbliResource.EBLI.getToolIcon("crystal_exporter")); res.add(menuItemPaste); res.add(menuItemImport); res.addSeparator(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-13 08:37:39
|
Revision: 9436 http://sourceforge.net/p/fudaa/svn/9436 Author: deniger Date: 2016-10-13 08:37:36 +0000 (Thu, 13 Oct 2016) Log Message: ----------- CRUE-667: Import de conditions aux limites Modified Paths: -------------- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilPopupMenuReceiver.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.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/loi/ModellingProfilSectionMenuReceiver.java trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/loi/Bundle.properties trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportListCLimMsTopExportPopupBuilder.java Removed Paths: ------------- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java trunk/soft/fudaa-crue/ui-modelling/src/test/resources/org/ Deleted: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -1,126 +0,0 @@ -/* -GPL 2 - */ -package org.fudaa.fudaa.crue.common.helper; - -import com.Ostermiller.util.CSVParser; -import com.memoire.bu.BuFileFilter; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.JFileChooser; -import org.apache.commons.lang.StringUtils; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.fudaa.ctulu.CtuluLibFile; -import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.gui.CtuluFileChooser; -import org.openide.util.Exceptions; - -/** - * Lit a un fichier et le traduit en tableau a 2 dimension. - * - * @author Frederic Deniger - */ -public class TablerFileReader { - - public static CtuluFileChooser createTablerFileChooser() { - final BuFileFilter ftCsv = new BuFileFilter(new String[]{"csv", "txt"}, CtuluResource.CTULU.getString("Texte CSV")); - final BuFileFilter ftXsl = new BuFileFilter(new String[]{"xls"}, CtuluResource.CTULU.getString("Fichier Excel 97-2003")); - final BuFileFilter ftXslx = new BuFileFilter(new String[]{"xlsx"}, CtuluResource.CTULU.getString("Fichier Excel")); - ftCsv.setExtensionListInDescription(true); - ftXsl.setExtensionListInDescription(true); - ftXslx.setExtensionListInDescription(true); - CtuluFileChooser fileChooser = new CtuluFileChooser(true); - fileChooser.addChoosableFileFilter(ftCsv); - fileChooser.addChoosableFileFilter(ftXsl); - fileChooser.addChoosableFileFilter(ftXslx); - fileChooser.setFileFilter(ftXslx); - fileChooser.setAcceptAllFileFilterUsed(false); - fileChooser.setMultiSelectionEnabled(false); - fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); - return fileChooser; - } - - public String[][] readFile(File file) { - final String nameToLowerCase = file.getName().toLowerCase(); - if (nameToLowerCase.endsWith("xlsx") || nameToLowerCase.endsWith("xls")) { - List<String[]> rows = new ArrayList<>(); - InputStream is = null; - try { - is = new FileInputStream(file); - Workbook wb = WorkbookFactory.create(is); - Sheet sheetAt = wb.getSheetAt(0); - int maxCol = 0; - for (Row row : sheetAt) { - maxCol = Math.max(maxCol, row.getLastCellNum()); - } - for (Row row : sheetAt) { - List<String> cols = new ArrayList<>(); - for (int i = 0; i < maxCol; i++) { - cols.add(getValue(row.getCell(i, Row.CREATE_NULL_AS_BLANK))); - } - rows.add(cols.toArray(new String[cols.size()])); - } - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } finally { - CtuluLibFile.close(is); - } - final String[][] toArray = rows.toArray(new String[rows.size()][]); - return toArray; - - } else { - return readCsv(file); - } - } - - protected String getValue(Cell cell) { - switch (cell.getCellType()) { - case Cell.CELL_TYPE_BLANK: - return ""; - case Cell.CELL_TYPE_NUMERIC: - return Double.toString(cell.getNumericCellValue()); - case Cell.CELL_TYPE_STRING: - return cell.getStringCellValue(); - default: - try { - return Double.toString(cell.getNumericCellValue()); - } catch (Exception ex) { - Logger.getLogger(TablerFileReader.class.getName()).log(Level.INFO, "message {0}", ex); - try { - return cell.getStringCellValue(); - } catch (Exception ex1) { - Logger.getLogger(TablerFileReader.class.getName()).log(Level.INFO, "message {0}", ex1); - - } - } - } - return StringUtils.EMPTY; - } - - protected String[][] readCsv(File file) { - Reader reader = null; - String[][] values = null; - try { - reader = new FileReader(file); - values = new CSVParser(new BufferedReader(reader), ';').getAllValues(); - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } finally { - CtuluLibFile.close(reader); - } - return values; - } - -} Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilPopupMenuReceiver.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilPopupMenuReceiver.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilPopupMenuReceiver.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -28,9 +28,17 @@ return sectionController; } + /** + * a redefinir si on veut ajouter un item pour l'import de fichier + */ + protected void addImportItem() { + + } + @Override protected void addItems() { super.addItems(); + addImportItem(); popupMenu.addSeparator(); openFrt = new OpenFrt(sectionController); popupMenu.add(openFrt); Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -5,7 +5,7 @@ import com.Ostermiller.util.CSVParser; import java.io.File; -import org.fudaa.fudaa.crue.common.helper.TablerFileReader; +import org.fudaa.ctulu.table.CtuluExcelCsvFileReader; import org.fudaa.fudaa.crue.modelling.calcul.importer.CLimMsImporter; import org.fudaa.fudaa.crue.views.DonClimMTableModel; import org.netbeans.api.progress.ProgressHandle; @@ -41,7 +41,7 @@ } values = CSVParser.parse(initValues, sep); } else if (file != null) { - values = new TablerFileReader().readFile(file); + values = new CtuluExcelCsvFileReader(file).readFile(); } if (values == null) { return null; Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -3,20 +3,19 @@ */ package org.fudaa.fudaa.crue.modelling.calcul; -import com.memoire.bu.BuFileFilter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.MissingResourceException; import javax.swing.JFileChooser; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; import org.fudaa.ctulu.gui.CtuluPopupListener; import org.fudaa.ctulu.gui.CtuluTableSimpleExporter; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.crue.common.helper.CrueProgressUtils; import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; -import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import org.fudaa.fudaa.crue.views.DonClimMTableModel; import org.fudaa.fudaa.crue.views.LoiDisplayer; import org.fudaa.fudaa.crue.views.LoiDisplayerInstaller; @@ -54,7 +53,7 @@ if (!tc.isEditable()) { return; } - CtuluFileChooser fileChooser = TablerFileReader.createTablerFileChooser(); + CtuluFileChooser fileChooser = CtuluFileChooserCsvExcel.createOpenFileChooser(); final int res = fileChooser.showDialog(CtuluUIForNetbeans.DEFAULT.getParentComponent(), NbBundle.getMessage( ModellingListCLimMsTopExportImportPopupBuilder.class, "button.import.name")); @@ -69,9 +68,9 @@ } } - protected JMenuItem createExportMenuItem() throws MissingResourceException { final JMenuItem menuItemExport = new JMenuItem(NbBundle.getMessage(ModellingListCLimMsTopExportImportPopupBuilder.class, "button.export.name")); + menuItemExport.setIcon(EbliResource.EBLI.getToolIcon("crystal_exporter")); menuItemExport.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -85,6 +84,7 @@ final JMenuItem menuItemImport = new JMenuItem(NbBundle.getMessage(ModellingListCLimMsTopExportImportPopupBuilder.class, "button.import.name")); menuItemImport.setToolTipText(NbBundle.getMessage(ModellingListCLimMsTopExportImportPopupBuilder.class, "button.importClimMs.tooltip")); menuItemImport.setEnabled(tc.isEditable()); + menuItemImport.setIcon(EbliResource.EBLI.getToolIcon("crystal_importer")); menuItemImport.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -6,7 +6,7 @@ import com.Ostermiller.util.CSVParser; import java.io.File; import org.fudaa.ctulu.CtuluLog; -import org.fudaa.fudaa.crue.common.helper.TablerFileReader; +import org.fudaa.ctulu.table.CtuluExcelCsvFileReader; import org.fudaa.fudaa.crue.common.log.LogsDisplayer; import org.fudaa.fudaa.crue.modelling.calcul.importer.CiniImporter; import org.netbeans.api.progress.ProgressHandle; @@ -43,7 +43,7 @@ } values = CSVParser.parse(initValues, sep); } else if (file != null) { - values = new TablerFileReader().readFile(file); + values = new CtuluExcelCsvFileReader(file).readFile(); } if (values == null) { return null; Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -15,12 +15,12 @@ import javax.swing.JPopupMenu; import javax.swing.KeyStroke; import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; import org.fudaa.ctulu.gui.CtuluTableSimpleExporter; import org.fudaa.ctulu.table.CtuluTable; import org.fudaa.ctulu.table.CtuluTableModelDefault; import org.fudaa.fudaa.crue.common.helper.CrueProgressUtils; import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; -import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import org.fudaa.fudaa.crue.modelling.list.ListNodeAddPopupFactory; import org.fudaa.fudaa.crue.views.export.OutlineViewExportTableModel; import org.openide.explorer.view.NodePopupFactory; @@ -54,11 +54,11 @@ @Override public JPopupMenu createPopupMenu(int row, int column, Node[] selectedNodes, Component component) { JPopupMenu res = super.createPopupMenu(row, column, selectedNodes, component); - if(res.getComponentCount() == 1) { + if (res.getComponentCount() == 1) { // ajout du séparateur uniquement si un item est présent avant res.addSeparator(); } - + final JMenuItem menuItemPaste = new JMenuItem(NbBundle.getMessage(ModellingListCiniTopComponentPopupFactory.class, "button.importFromClipboard.name")); menuItemPaste.setToolTipText(NbBundle.getMessage(ModellingListCiniTopComponentPopupFactory.class, "button.importFromClipboard.tooltip")); @@ -119,7 +119,7 @@ if (!tc.isEditable()) { return; } - CtuluFileChooser fileChooser = TablerFileReader.createTablerFileChooser(); + CtuluFileChooser fileChooser = CtuluFileChooserCsvExcel.createOpenFileChooser(); final int res = fileChooser.showDialog(CtuluUIForNetbeans.DEFAULT.getParentComponent(), NbBundle.getMessage(ModellingListCiniTopComponent.class, "button.import.name")); if (res == JFileChooser.APPROVE_OPTION) { 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-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/emh/ModellingEMHBrancheBarrageFilEauPanel.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -44,7 +44,7 @@ * * @author fred */ -public class ModellingEMHBrancheBarrageFilEauPanel extends JPanel implements ModellingEMHBrancheSpecificEditor, Observer { +public final class ModellingEMHBrancheBarrageFilEauPanel extends JPanel implements ModellingEMHBrancheSpecificEditor, Observer { ModellingScenarioService modellingScenarioService = Lookup.getDefault().lookup( ModellingScenarioService.class); @@ -76,7 +76,7 @@ JPanel top = new JPanel(new BuGridLayout(4, 10, 10)); add(top, BorderLayout.NORTH); - properties = ItemVariableView.create(DecimalFormatEpsilonEnum.COMPARISON,dcsp, getCcm(), DonCalcSansPrtBrancheNiveauxAssocies.PROP_QLIMINF, + properties = ItemVariableView.create(DecimalFormatEpsilonEnum.COMPARISON, dcsp, getCcm(), DonCalcSansPrtBrancheNiveauxAssocies.PROP_QLIMINF, DonCalcSansPrtBrancheNiveauxAssocies.PROP_QLIMSUP); for (ItemVariableView propertyEditorPanel : properties) { propertyEditorPanel.addObserver(this); @@ -145,7 +145,7 @@ private class SeuilView extends DefaultOutlineViewEditor { protected void initWith(DonCalcSansPrtBrancheBarrageFilEau dcsp) { - List<ElemSeuilAduNode> nodes = new ArrayList<ElemSeuilAduNode>(); + List<ElemSeuilAduNode> nodes = new ArrayList<>(); if (dcsp != null) { Collection<ElemSeuil> elemSeuilAvecPdc = dcsp.getElemSeuil(); CrueConfigMetier ccm = getCcm(); @@ -164,7 +164,7 @@ } List<ElemSeuil> getElemSeuil() { - List<ElemSeuil> res = new ArrayList<ElemSeuil>(); + List<ElemSeuil> res = new ArrayList<>(); Node[] nodes = getExplorerManager().getRootContext().getChildren().getNodes(); for (Node node : nodes) { ElemSeuil elemSeuil = node.getLookup().lookup(ElemSeuil.class); @@ -228,7 +228,7 @@ try { String toCopy = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); String[][] parse = CSVParser.parse(toCopy, '\t'); - List<ElemSeuilAduNode> contents = new ArrayList<ElemSeuilAduNode>(); + List<ElemSeuilAduNode> contents = new ArrayList<>(); for (String[] strings : parse) { if (strings.length >= 1) { ElemSeuil newContent = new ElemSeuil(ccm); Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ModellingProfilSectionMenuReceiver.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ModellingProfilSectionMenuReceiver.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ModellingProfilSectionMenuReceiver.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -15,7 +15,9 @@ import org.fudaa.dodico.crue.metier.algo.DonPrtGeoProfilSectionInverser; import org.fudaa.dodico.crue.metier.emh.DonPrtGeoProfilSection; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.crue.common.helper.DialogHelper; import org.fudaa.fudaa.crue.common.view.ItemVariableView; import org.fudaa.fudaa.crue.loi.section.ProfilPopupMenuReceiver; @@ -33,6 +35,7 @@ private InverseProfil inverseAction; private SimplifyProfil simplifyAction; + EbliActionSimple importAction; private final ProfilSectionTopComponent topComponent; public ModellingProfilSectionMenuReceiver(ProfilSectionLoiUiController loiUiController, final ProfilSectionTopComponent topComponent) { @@ -41,11 +44,25 @@ } @Override + protected void addImportItem() { + importAction = new EbliActionSimple(NbBundle.getMessage(ModellingProfilSectionMenuReceiver.class, "tableImportAction"), + EbliResource.EBLI.getToolIcon("crystal_importer"), "IMPORT") { + @Override + public void actionPerformed(ActionEvent _e) { + topComponent.getLoiUIController().getTableGraphePanel().tableImport(); + } + + }; + importAction.setDefaultToolTip("<html>" + EbliLib.getS("Importer depuis un fichier Excel/csv") + "<br><b>" + EbliLib.getS( + "Toutes les valeurs actuelles seront remplacées")); + popupMenu.add(importAction); + } + + @Override protected void addItems() { super.addItems(); popupMenu.addSeparator(); inverseAction = new InverseProfil(); - simplifyAction = new SimplifyProfil(); popupMenu.add(inverseAction); popupMenu.add(simplifyAction); @@ -56,6 +73,7 @@ super.updateItemStateBeforeShow(); EGCourbe selectedComponent = getPanel().getGraphe().getSelectedComponent(); final boolean editable = selectedComponent != null && selectedComponent.getModel().isModifiable(); + importAction.setEnabled(editable); inverseAction.setEnabled(editable); simplifyAction.setEnabled(editable); } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/loi/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/loi/Bundle.properties 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/loi/Bundle.properties 2016-10-13 08:37:36 UTC (rev 9436) @@ -66,4 +66,5 @@ simplifySectionProfilAction=Simplifier le profil seuilSimplifyCasierProfilLabel=Seuil de simplification ProfilCasier seuilSimplifyProfilSectionLabel=Seuil de simplification ProfilSection -profileInverseAction=Inverser le profil \ No newline at end of file +profileInverseAction=Inverser le profil +tableImportAction=Importer depuis un fichier Excel/csv \ No newline at end of file Modified: trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -6,7 +6,7 @@ import java.io.File; import java.io.IOException; import org.fudaa.ctulu.CtuluLibFile; -import org.fudaa.fudaa.crue.common.helper.TablerFileReader; +import org.fudaa.ctulu.table.CtuluExcelCsvFileReader; import static org.junit.Assert.*; import org.junit.Test; @@ -28,7 +28,7 @@ protected void testContent(File f) { assertNotNull(f); - String[][] values = new TablerFileReader().readFile(f); + String[][] values = new CtuluExcelCsvFileReader(f).readFile(); assertEquals(2, values.length); assertEquals(5, values[0].length); assertArrayEquals(new String[]{"A", "", "B", "C", "D"}, values[0]); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportListCLimMsTopExportPopupBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportListCLimMsTopExportPopupBuilder.java 2016-10-13 08:36:59 UTC (rev 9435) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/ReportListCLimMsTopExportPopupBuilder.java 2016-10-13 08:37:36 UTC (rev 9436) @@ -10,6 +10,7 @@ import javax.swing.JPopupMenu; import org.fudaa.ctulu.gui.CtuluPopupListener; import org.fudaa.ctulu.gui.CtuluTableSimpleExporter; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; import org.fudaa.fudaa.crue.views.LoiDisplayer; import org.fudaa.fudaa.crue.views.LoiDisplayerInstaller; @@ -37,7 +38,6 @@ menu.add(createExportMenuItem()); } - protected void exportTable() { DonClimMExportTableModel exportModel = new DonClimMExportTableModel(tc.tableModel, tc.getCcm()); CtuluTableSimpleExporter.doExport(';', exportModel, CtuluUIForNetbeans.DEFAULT); @@ -45,6 +45,7 @@ protected JMenuItem createExportMenuItem() throws MissingResourceException { final JMenuItem menuItemExport = new JMenuItem(NbBundle.getMessage(ReportListCLimMsTopExportPopupBuilder.class, "button.export.name")); + menuItemExport.setIcon(EbliResource.EBLI.getToolIcon("crystal_exporter")); menuItemExport.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-13 08:37:01
|
Revision: 9435 http://sourceforge.net/p/fudaa/svn/9435 Author: deniger Date: 2016-10-13 08:36:59 +0000 (Thu, 13 Oct 2016) Log Message: ----------- CRUE-667: Import de conditions aux limites Modified Paths: -------------- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2016-10-13 08:36:32 UTC (rev 9434) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2016-10-13 08:36:59 UTC (rev 9435) @@ -35,23 +35,43 @@ final BuFileFilter ftXslx_; final Component parentComponent; - public CtuluFileChooserCsvExcel(CtuluUI _ui) { - this(_ui == null ? null : _ui.getParentComponent()); + public static CtuluFileChooserCsvExcel createSaveFileChooser() { + CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel((CtuluUI) null); + fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + return fileChooser; } - public BuFileFilter getFtCsv() { - return ftCsv_; + public static CtuluFileChooserCsvExcel createSaveFileChooser(CtuluUI ui) { + CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel(ui); + fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + return fileChooser; } - public BuFileFilter getFtXsl() { - return ftXsl_; + public static CtuluFileChooserCsvExcel createOpenFileChooser() { + CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel((CtuluUI) null); + fileChooser.setDialogType(JFileChooser.OPEN_DIALOG); + fileChooser.setTester(null); + return fileChooser; } - public BuFileFilter getFtXslx() { - return ftXslx_; + public static CtuluFileChooserCsvExcel createOpenFileChooser(Component parentComponent) { + CtuluFileChooserCsvExcel fileChooser = new CtuluFileChooserCsvExcel(parentComponent); + fileChooser.setDialogType(JFileChooser.OPEN_DIALOG); + fileChooser.setTester(null); + return fileChooser; } + public CtuluFileChooserCsvExcel() { + this((Component) null); + + } + + public CtuluFileChooserCsvExcel(CtuluUI _ui) { + this(_ui == null ? null : _ui.getParentComponent()); + } + public CtuluFileChooserCsvExcel(Component parentComponent) { + super(true); this.parentComponent = parentComponent; ftCsv_ = new BuFileFilter(new String[]{"csv", "txt"}, CtuluResource.CTULU.getString("Texte CSV")); ftCsv_.setExtensionListInDescription(true); @@ -74,6 +94,18 @@ setTester(tester); } + public BuFileFilter getFtCsv() { + return ftCsv_; + } + + public BuFileFilter getFtXsl() { + return ftXsl_; + } + + public BuFileFilter getFtXslx() { + return ftXslx_; + } + /** * @return true si le format excel est choisi */ Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java 2016-10-13 08:36:32 UTC (rev 9434) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableSimpleExporter.java 2016-10-13 08:36:59 UTC (rev 9435) @@ -53,7 +53,7 @@ } public static void doExport(final char separator, final CtuluTableModelInterface _t, final CtuluUI _ui, final Window _f) { - final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(_ui); + final CtuluFileChooserCsvExcel choose = CtuluFileChooserCsvExcel.createSaveFileChooser(_ui); final File f = choose.getDestFile(); if (f == null) { return; Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2016-10-13 08:36:32 UTC (rev 9434) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGCsvFileImporter.java 2016-10-13 08:36:59 UTC (rev 9435) @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Arrays; import javax.swing.JFileChooser; +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; import org.fudaa.ctulu.table.CtuluExcelCsvFileReader; @@ -23,23 +24,29 @@ this.panel = aThis; } - void importCsv() { - final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(panel); + void importTablerFile() { + final CtuluFileChooserCsvExcel choose = CtuluFileChooserCsvExcel.createOpenFileChooser(panel); choose.setDialogType(JFileChooser.OPEN_DIALOG); choose.setTester(null); final File f = choose.getDestFile(); if (f == null) { return; } - final String[][] values = new CtuluExcelCsvFileReader(f).readFile(); + final CtuluExcelCsvFileReader ctuluExcelCsvFileReader = new CtuluExcelCsvFileReader(f); + final String[][] values = ctuluExcelCsvFileReader.readFile(); if (values == null) { return; } + boolean isCsv = !ctuluExcelCsvFileReader.isExcel(); panel.t_.deleteAllValues(); panel.t_.clearSelection(); ArrayList tab = new ArrayList(values.length); for (int i = 0; i < values.length; i++) { String[] value = values[i]; + //ignore les commentaire + if (isCsv && CtuluLibArray.isNotEmpty(value) && value[0] != null && value[0].startsWith("#")) { + continue; + } //la premier ligne peut \xEAtre les entetes if (i == 0) { if (!CtuluLibString.isNumeric(value[0])) { Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2016-10-13 08:36:32 UTC (rev 9434) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableGraphePanel.java 2016-10-13 08:36:59 UTC (rev 9435) @@ -725,8 +725,8 @@ t_.paste(); } - protected void tableImport() { - new EGCsvFileImporter(this).importCsv(); + public void tableImport() { + new EGCsvFileImporter(this).importTablerFile(); } EbliActionSimple actionDelete; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-13 08:36:34
|
Revision: 9434 http://sourceforge.net/p/fudaa/svn/9434 Author: deniger Date: 2016-10-13 08:36:32 +0000 (Thu, 13 Oct 2016) Log Message: ----------- CRUE-667: Import de conditions aux limites Modified Paths: -------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java Added Paths: ----------- trunk/framework/ctulu-common/src/test/java/org/fudaa/ctulu/table/ trunk/framework/ctulu-common/src/test/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReaderTest.java trunk/framework/ctulu-common/src/test/resources/ trunk/framework/ctulu-common/src/test/resources/org/ trunk/framework/ctulu-common/src/test/resources/org/fudaa/ trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/ trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/ trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.csv trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.xlsx Property Changed: ---------------- trunk/framework/ctulu-common/ Index: trunk/framework/ctulu-common =================================================================== --- trunk/framework/ctulu-common 2016-10-12 15:39:52 UTC (rev 9433) +++ trunk/framework/ctulu-common 2016-10-13 08:36:32 UTC (rev 9434) Property changes on: trunk/framework/ctulu-common ___________________________________________________________________ Modified: svn:ignore ## -2,3 +2,4 ## .project target .settings +nbproject Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java 2016-10-12 15:39:52 UTC (rev 9433) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibArray.java 2016-10-13 08:36:32 UTC (rev 9434) @@ -42,6 +42,10 @@ return _array == null || _array.length == 0; } + public static boolean isNotEmpty(final Object[] _array) { + return !isEmpty(_array); + } + public static int getNbItem(final Object[] _o) { return _o == null ? 0 : _o.length; } @@ -593,7 +597,8 @@ } return r; } - public static int getMax(final int[] _d,int np) { + + public static int getMax(final int[] _d, int np) { if (_d == null || _d.length == 0) { return 0; } @@ -836,10 +841,8 @@ } /** - * Cherche l'index de la chaine - * <code>_string</code> dans le tableau - * <code>_stringArray</code>. Renvoie - * <code>-1</code> si l'un des deux parametres est nuls. + * Cherche l'index de la chaine <code>_string</code> dans le tableau <code>_stringArray</code>. Renvoie <code>-1</code> si l'un des deux parametres + * est nuls. * * @return index si l'action du composant est trouvee dans le tableau, -1 sinon * @param _obj objet a trouver @@ -1040,4 +1043,4 @@ } return _t; } -} \ No newline at end of file +} Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java 2016-10-12 15:39:52 UTC (rev 9433) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReader.java 2016-10-13 08:36:32 UTC (rev 9434) @@ -13,6 +13,8 @@ import java.io.Reader; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.commons.lang.StringUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; @@ -34,18 +36,22 @@ } public String[][] readFile() { - final String nameToLowerCase = file.getName().toLowerCase(); - if (nameToLowerCase.endsWith("xlsx") || nameToLowerCase.endsWith("xls")) { - List<String[]> rows = new ArrayList<String[]>(); + boolean isXls = isExcel(); + if (isXls) { + List<String[]> rows = new ArrayList<>(); InputStream is = null; try { is = new FileInputStream(file); Workbook wb = WorkbookFactory.create(is); Sheet sheetAt = wb.getSheetAt(0); + int maxCol = 0; for (Row row : sheetAt) { - List<String> cols = new ArrayList<String>(); - for (Cell cell : row) { - cols.add(getValue(cell)); + maxCol = Math.max(maxCol, row.getLastCellNum()); + } + for (Row row : sheetAt) { + List<String> cols = new ArrayList<>(); + for (int i = 0; i < maxCol; i++) { + cols.add(getValue(row.getCell(i, Row.CREATE_NULL_AS_BLANK))); } rows.add(cols.toArray(new String[cols.size()])); } @@ -62,6 +68,12 @@ } } + public boolean isExcel() { + final String nameToLowerCase = file.getName().toLowerCase(); + final boolean isXls = nameToLowerCase.endsWith("xlsx") || nameToLowerCase.endsWith("xls"); + return isXls; + } + protected String[][] readCsv() { String[][] values = null; Reader reader = null; @@ -78,25 +90,26 @@ protected String getValue(Cell cell) { switch (cell.getCellType()) { + case Cell.CELL_TYPE_BLANK: + return StringUtils.EMPTY; case Cell.CELL_TYPE_NUMERIC: return Double.toString(cell.getNumericCellValue()); case Cell.CELL_TYPE_STRING: return cell.getStringCellValue(); - case Cell.CELL_TYPE_BLANK: - return null; default: try { return Double.toString(cell.getNumericCellValue()); } catch (Exception ex) { - FuLog.error(ex); + Logger.getLogger(CtuluExcelCsvFileReader.class.getName()).log(Level.INFO, "message {0}", ex); try { return cell.getStringCellValue(); } catch (Exception ex1) { - FuLog.error(ex); + Logger.getLogger(CtuluExcelCsvFileReader.class.getName()).log(Level.INFO, "message {0}", ex1); } } } return StringUtils.EMPTY; } + } Added: trunk/framework/ctulu-common/src/test/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReaderTest.java =================================================================== --- trunk/framework/ctulu-common/src/test/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReaderTest.java (rev 0) +++ trunk/framework/ctulu-common/src/test/java/org/fudaa/ctulu/table/CtuluExcelCsvFileReaderTest.java 2016-10-13 08:36:32 UTC (rev 9434) @@ -0,0 +1,40 @@ +/* +GPL 2 + */ +package org.fudaa.ctulu.table; + +import java.io.File; +import java.io.IOException; +import junit.framework.TestCase; +import org.fudaa.ctulu.CtuluLibFile; +import static org.junit.Assert.assertArrayEquals; +import org.junit.Test; +/** + * + * @author Frederic Deniger + */ +public class CtuluExcelCsvFileReaderTest extends TestCase { + + @Test + public void testReadXls() throws IOException { + File f = CtuluLibFile.getFileFromJar("/org/fudaa/ctulu/table/tabler.xlsx", File.createTempFile("tabler", ".xlsx")); + String[][] values = new CtuluExcelCsvFileReader(f).readFile(); + assertEquals(38, values.length); + assertEquals(11, values[10].length); + assertArrayEquals(new String[]{"Cc_P10", "Qapp", "245.0", "Qapp", "115.0", "", "", "Zimp", "26.24", "Qapp", "-2189.0"}, values[10]); + assertArrayEquals(new String[]{"Cc_P37", "Qapp", "8600.0", "Qapp", "2400.0", "Qapp", "1500.0", "Zimp", "34.56", "", ""}, values[37]); + + } + + @Test + public void testReadCsv() throws IOException { + File f = CtuluLibFile.getFileFromJar("/org/fudaa/ctulu/table/tabler.csv", File.createTempFile("example", ".csv")); + String[][] values = new CtuluExcelCsvFileReader(f).readFile(); + assertEquals(38, values.length); + assertEquals(11, values[10].length); + assertArrayEquals(new String[]{"Cc_P10", "Qapp", "245", "Qapp", "115", "", "", "Zimp", "26,24", "Qapp", "-2189"}, values[10]); + assertArrayEquals(new String[]{"Cc_P37", "Qapp", "8600", "Qapp", "2400", "Qapp", "1500", "Zimp", "34,56", "", ""}, values[37]); + + } + +} Added: trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.csv =================================================================== --- trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.csv (rev 0) +++ trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.csv 2016-10-13 08:36:32 UTC (rev 9434) @@ -0,0 +1,38 @@ +Calcul;Nd_BARDM (Type);Nd_BARDM (Valeur);Nd_NAR1 (Type);Nd_NAR1 (Valeur);Nd_USIDM (Type);Nd_USIDM (Valeur);Nd_AVBAR2 (Type);Nd_AVBAR2 (Valeur);Nd_USINE (Type);Nd_USINE (Valeur) +Cc_P1;Qapp;60;Qapp;10;Qapp;460;Zimp;26,02;Qapp;-525 +Cc_P2;Qapp;60;Qapp;10;Qapp;480;Zimp;26,02;Qapp;-545 +Cc_P3;Qapp;60;Qapp;13;Qapp;700;Zimp;26,05;Qapp;-768 +Cc_P4;Qapp;60;Qapp;15;Qapp;900;Zimp;26,06;; +Cc_P5;Qapp;60;Qapp;18;Qapp;1200;Zimp;26,08;; +Cc_P6;Qapp;60;Qapp;20;Qapp;1220;;;; +Cc_P7;Qapp;60;Qapp;30;Qapp;1435;Zimp;26,12;; +Cc_P8;Qapp;60;Qapp;60;Qapp;1600;Zimp;26,15;; +Cc_P9;Qapp;120;Qapp;100;Qapp;1840;Zimp;26,21;; +Cc_P10;Qapp;245;Qapp;115;;;Zimp;26,24;Qapp;-2189 +Cc_P11;Qapp;405;Qapp;155;Qapp;1840;Zimp;26,26;Qapp;-2280 +Cc_P12;Qapp;650;Qapp;184;Qapp;1840;Zimp;26,42;; +Cc_P13;Qapp;850;Qapp;200;Qapp;1840;Zimp;26,54;; +Cc_P14;Qapp;1140;Qapp;212;Qapp;1840;Zimp;26,85;; +Cc_P15;Qapp;1540;Qapp;220;Qapp;1840;Zimp;27,41;; +Cc_P16;Qapp;1720;Qapp;240;Qapp;1840;Zimp;27,85;; +Cc_P17;Qapp;1760;Qapp;250;Qapp;1840;Zimp;27,95;; +Cc_P18;Qapp;2070;Qapp;290;Qapp;1840;Zimp;28,42;; +Cc_P19;Qapp;2460;Qapp;300;Qapp;1840;Zimp;28,88;; +Cc_P20;Qapp;2640;Qapp;520;Qapp;1840;Zimp;29,33;; +Cc_P21;Qapp;3310;Qapp;660;Qapp;1840;Zimp;30,18;; +Cc_P22;Qapp;3475;Qapp;660;Qapp;1840;Zimp;30,38;; +Cc_P23;Qapp;3500;Qapp;830;Qapp;1840;Zimp;30,48;; +Cc_P24;Qapp;3540;Qapp;830;Qapp;1840;Zimp;30,57;; +Cc_P25;Qapp;3610;Qapp;850;Qapp;1840;Zimp;30,67;; +Cc_P26;Qapp;3860;Qapp;1000;Qapp;1840;Zimp;31;; +Cc_P27;Qapp;4160;Qapp;1200;Qapp;1840;Zimp;31,38;; +Cc_P28;Qapp;4480;Qapp;1200;Qapp;1770;Zimp;31,43;; +Cc_P29;Qapp;4830;Qapp;1300;Qapp;1670;Zimp;31,67;; +Cc_P30;Qapp;5500;Qapp;1400;Qapp;1500;Zimp;32,06;; +Cc_P31;Qapp;6000;Qapp;1700;Qapp;1500;Zimp;32,58;; +Cc_P32;Qapp;6300;Qapp;1800;Qapp;1500;Zimp;32,83;; +Cc_P33;Qapp;6550;Qapp;1880;Qapp;1500;Zimp;32,03;; +Cc_P34;Qapp;6600;Qapp;1900;Qapp;1500;Zimp;33,07;; +Cc_P35;Qapp;7100;Qapp;1900;Qapp;1500;Zimp;33,55;; +Cc_P36;Qapp;7700;Qapp;2300;Qapp;1500;Zimp;34,06;; +Cc_P37;Qapp;8600;Qapp;2400;Qapp;1500;Zimp;34,56;; Added: trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.xlsx =================================================================== (Binary files differ) Index: trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.xlsx =================================================================== --- trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.xlsx 2016-10-12 15:39:52 UTC (rev 9433) +++ trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.xlsx 2016-10-13 08:36:32 UTC (rev 9434) Property changes on: trunk/framework/ctulu-common/src/test/resources/org/fudaa/ctulu/table/tabler.xlsx ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <de...@us...> - 2016-10-12 14:33:26
|
Revision: 9432 http://sourceforge.net/p/fudaa/svn/9432 Author: deniger Date: 2016-10-12 14:33:23 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-719 Import-Export des conditions initiales Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java Added Paths: ----------- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java Added: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java (rev 0) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/helper/TablerFileReader.java 2016-10-12 14:33:23 UTC (rev 9432) @@ -0,0 +1,126 @@ +/* +GPL 2 + */ +package org.fudaa.fudaa.crue.common.helper; + +import com.Ostermiller.util.CSVParser; +import com.memoire.bu.BuFileFilter; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.io.Reader; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JFileChooser; +import org.apache.commons.lang.StringUtils; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluFileChooser; +import org.openide.util.Exceptions; + +/** + * Lit a un fichier et le traduit en tableau a 2 dimension. + * + * @author Frederic Deniger + */ +public class TablerFileReader { + + public static CtuluFileChooser createTablerFileChooser() { + final BuFileFilter ftCsv = new BuFileFilter(new String[]{"csv", "txt"}, CtuluResource.CTULU.getString("Texte CSV")); + final BuFileFilter ftXsl = new BuFileFilter(new String[]{"xls"}, CtuluResource.CTULU.getString("Fichier Excel 97-2003")); + final BuFileFilter ftXslx = new BuFileFilter(new String[]{"xlsx"}, CtuluResource.CTULU.getString("Fichier Excel")); + ftCsv.setExtensionListInDescription(true); + ftXsl.setExtensionListInDescription(true); + ftXslx.setExtensionListInDescription(true); + CtuluFileChooser fileChooser = new CtuluFileChooser(true); + fileChooser.addChoosableFileFilter(ftCsv); + fileChooser.addChoosableFileFilter(ftXsl); + fileChooser.addChoosableFileFilter(ftXslx); + fileChooser.setFileFilter(ftXslx); + fileChooser.setAcceptAllFileFilterUsed(false); + fileChooser.setMultiSelectionEnabled(false); + fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + return fileChooser; + } + + public String[][] readFile(File file) { + final String nameToLowerCase = file.getName().toLowerCase(); + if (nameToLowerCase.endsWith("xlsx") || nameToLowerCase.endsWith("xls")) { + List<String[]> rows = new ArrayList<>(); + InputStream is = null; + try { + is = new FileInputStream(file); + Workbook wb = WorkbookFactory.create(is); + Sheet sheetAt = wb.getSheetAt(0); + int maxCol = 0; + for (Row row : sheetAt) { + maxCol = Math.max(maxCol, row.getLastCellNum()); + } + for (Row row : sheetAt) { + List<String> cols = new ArrayList<>(); + for (int i = 0; i < maxCol; i++) { + cols.add(getValue(row.getCell(i, Row.CREATE_NULL_AS_BLANK))); + } + rows.add(cols.toArray(new String[cols.size()])); + } + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } finally { + CtuluLibFile.close(is); + } + final String[][] toArray = rows.toArray(new String[rows.size()][]); + return toArray; + + } else { + return readCsv(file); + } + } + + protected String getValue(Cell cell) { + switch (cell.getCellType()) { + case Cell.CELL_TYPE_BLANK: + return ""; + case Cell.CELL_TYPE_NUMERIC: + return Double.toString(cell.getNumericCellValue()); + case Cell.CELL_TYPE_STRING: + return cell.getStringCellValue(); + default: + try { + return Double.toString(cell.getNumericCellValue()); + } catch (Exception ex) { + Logger.getLogger(TablerFileReader.class.getName()).log(Level.INFO, "message {0}", ex); + try { + return cell.getStringCellValue(); + } catch (Exception ex1) { + Logger.getLogger(TablerFileReader.class.getName()).log(Level.INFO, "message {0}", ex1); + + } + } + } + return StringUtils.EMPTY; + } + + protected String[][] readCsv(File file) { + Reader reader = null; + String[][] values = null; + try { + reader = new FileReader(file); + values = new CSVParser(new BufferedReader(reader), ';').getAllValues(); + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } finally { + CtuluLibFile.close(reader); + } + return values; + } + +} Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java 2016-10-12 13:18:00 UTC (rev 9431) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java 2016-10-12 14:33:23 UTC (rev 9432) @@ -4,28 +4,12 @@ package org.fudaa.fudaa.crue.modelling.calcul; import com.Ostermiller.util.CSVParser; -import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.apache.commons.lang.StringUtils; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; -import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import org.fudaa.fudaa.crue.modelling.calcul.importer.CLimMsImporter; import org.fudaa.fudaa.crue.views.DonClimMTableModel; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressRunnable; -import org.openide.util.Exceptions; /** * @@ -57,7 +41,7 @@ } values = CSVParser.parse(initValues, sep); } else if (file != null) { - values = readFile(); + values = new TablerFileReader().readFile(file); } if (values == null) { return null; @@ -69,74 +53,4 @@ return importer.importData(); } - protected String getValue(Cell cell) { - switch (cell.getCellType()) { - case Cell.CELL_TYPE_BLANK: - return ""; - case Cell.CELL_TYPE_NUMERIC: - return Double.toString(cell.getNumericCellValue()); - case Cell.CELL_TYPE_STRING: - return cell.getStringCellValue(); - default: - try { - return Double.toString(cell.getNumericCellValue()); - } catch (Exception ex) { - Logger.getLogger(ModellingListCLimMsProgressRunnable.class.getName()).log(Level.INFO, "message {0}", ex); - try { - return cell.getStringCellValue(); - } catch (Exception ex1) { - Logger.getLogger(ModellingListCLimMsProgressRunnable.class.getName()).log(Level.INFO, "message {0}", ex1); - - } - } - } - return StringUtils.EMPTY; - } - - protected String[][] readFile() { - final String nameToLowerCase = file.getName().toLowerCase(); - if (nameToLowerCase.endsWith("xlsx") || nameToLowerCase.endsWith("xls")) { - List<String[]> rows = new ArrayList<String[]>(); - InputStream is = null; - try { - is = new FileInputStream(file); - Workbook wb = WorkbookFactory.create(is); - Sheet sheetAt = wb.getSheetAt(0); - int maxCol = 0; - for (Row row : sheetAt) { - maxCol = Math.max(maxCol, row.getLastCellNum()); - } - for (Row row : sheetAt) { - List<String> cols = new ArrayList<String>(); - for (int i = 0; i < maxCol; i++) { - cols.add(getValue(row.getCell(i, Row.CREATE_NULL_AS_BLANK))); - } - rows.add(cols.toArray(new String[cols.size()])); - } - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } finally { - CtuluLibFile.close(is); - } - final String[][] toArray = rows.toArray(new String[rows.size()][]); - return toArray; - - } else { - return readCsv(); - } - } - - protected String[][] readCsv() { - Reader reader = null; - String[][] values = null; - try { - reader = new FileReader(file); - values = new CSVParser(new BufferedReader(reader), ';').getAllValues(); - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } finally { - CtuluLibFile.close(reader); - } - return values; - } } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java 2016-10-12 13:18:00 UTC (rev 9431) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java 2016-10-12 14:33:23 UTC (rev 9432) @@ -16,6 +16,7 @@ import org.fudaa.ctulu.gui.CtuluTableSimpleExporter; import org.fudaa.fudaa.crue.common.helper.CrueProgressUtils; import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; +import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import org.fudaa.fudaa.crue.views.DonClimMTableModel; import org.fudaa.fudaa.crue.views.LoiDisplayer; import org.fudaa.fudaa.crue.views.LoiDisplayerInstaller; @@ -53,20 +54,7 @@ if (!tc.isEditable()) { return; } - final BuFileFilter ftCsv = new BuFileFilter(new String[]{"csv", "txt"}, CtuluResource.CTULU.getString("Texte CSV")); - final BuFileFilter ftXsl = new BuFileFilter(new String[]{"xls"}, CtuluResource.CTULU.getString("Fichier Excel 97-2003")); - final BuFileFilter ftXslx = new BuFileFilter(new String[]{"xlsx"}, CtuluResource.CTULU.getString("Fichier Excel")); - ftCsv.setExtensionListInDescription(true); - ftXsl.setExtensionListInDescription(true); - ftXslx.setExtensionListInDescription(true); - CtuluFileChooser fileChooser = new CtuluFileChooser(true); - fileChooser.addChoosableFileFilter(ftCsv); - fileChooser.addChoosableFileFilter(ftXsl); - fileChooser.addChoosableFileFilter(ftXslx); - fileChooser.setFileFilter(ftXslx); - fileChooser.setAcceptAllFileFilterUsed(false); - fileChooser.setMultiSelectionEnabled(false); - fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + CtuluFileChooser fileChooser = TablerFileReader.createTablerFileChooser(); final int res = fileChooser.showDialog(CtuluUIForNetbeans.DEFAULT.getParentComponent(), NbBundle.getMessage( ModellingListCLimMsTopExportImportPopupBuilder.class, "button.import.name")); @@ -81,6 +69,7 @@ } } + protected JMenuItem createExportMenuItem() throws MissingResourceException { final JMenuItem menuItemExport = new JMenuItem(NbBundle.getMessage(ModellingListCLimMsTopExportImportPopupBuilder.class, "button.export.name")); menuItemExport.addActionListener(new ActionListener() { Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java 2016-10-12 13:18:00 UTC (rev 9431) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniImportProgressRunnable.java 2016-10-12 14:33:23 UTC (rev 9432) @@ -4,17 +4,13 @@ package org.fudaa.fudaa.crue.modelling.calcul; import com.Ostermiller.util.CSVParser; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; -import java.io.Reader; -import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.CtuluLog; +import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import org.fudaa.fudaa.crue.common.log.LogsDisplayer; import org.fudaa.fudaa.crue.modelling.calcul.importer.CiniImporter; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressRunnable; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; /** @@ -22,24 +18,23 @@ * @author Frederic Deniger */ public class ModellingListCiniImportProgressRunnable implements ProgressRunnable<Object> { - + private File file; private final ModellingListCiniTopComponent topComponent; private String initValues; - + public ModellingListCiniImportProgressRunnable(File file, ModellingListCiniTopComponent topComponent) { this.file = file; this.topComponent = topComponent; } - + public ModellingListCiniImportProgressRunnable(String initValues, ModellingListCiniTopComponent topComponent) { this.topComponent = topComponent; this.initValues = initValues; } - + @Override public Object run(ProgressHandle handle) { - Reader reader = null; String[][] values = null; if (initValues != null) { char sep = '\t'; @@ -48,14 +43,7 @@ } values = CSVParser.parse(initValues, sep); } else if (file != null) { - try { - reader = new FileReader(file); - values = new CSVParser(new BufferedReader(reader), ';').getAllValues(); - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } finally { - CtuluLibFile.close(reader); - } + values = new TablerFileReader().readFile(file); } if (values == null) { return null; @@ -72,8 +60,9 @@ title = NbBundle.getMessage(ModellingListCiniImportProgressRunnable.class, "cini.importClipboard.bilan"); } LogsDisplayer.displayError(importData, title); - + } return null; } + } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java 2016-10-12 13:18:00 UTC (rev 9431) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCiniTopComponentPopupFactory.java 2016-10-12 14:33:23 UTC (rev 9432) @@ -3,7 +3,6 @@ */ package org.fudaa.fudaa.crue.modelling.calcul; -import com.memoire.bu.BuFileFilter; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -15,13 +14,13 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.KeyStroke; -import org.fudaa.ctulu.CtuluResource; import org.fudaa.ctulu.gui.CtuluFileChooser; import org.fudaa.ctulu.gui.CtuluTableSimpleExporter; import org.fudaa.ctulu.table.CtuluTable; import org.fudaa.ctulu.table.CtuluTableModelDefault; import org.fudaa.fudaa.crue.common.helper.CrueProgressUtils; import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; +import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import org.fudaa.fudaa.crue.modelling.list.ListNodeAddPopupFactory; import org.fudaa.fudaa.crue.views.export.OutlineViewExportTableModel; import org.openide.explorer.view.NodePopupFactory; @@ -120,14 +119,7 @@ if (!tc.isEditable()) { return; } - final BuFileFilter ftCsv = new BuFileFilter(new String[]{"txt", "csv"}, CtuluResource.CTULU.getString("Texte CSV")); - ftCsv.setExtensionListInDescription(true); - CtuluFileChooser fileChooser = new CtuluFileChooser(true); - fileChooser.addChoosableFileFilter(ftCsv); - fileChooser.setFileFilter(ftCsv); - fileChooser.setAcceptAllFileFilterUsed(false); - fileChooser.setMultiSelectionEnabled(false); - fileChooser.setDialogType(JFileChooser.SAVE_DIALOG); + CtuluFileChooser fileChooser = TablerFileReader.createTablerFileChooser(); final int res = fileChooser.showDialog(CtuluUIForNetbeans.DEFAULT.getParentComponent(), NbBundle.getMessage(ModellingListCiniTopComponent.class, "button.import.name")); if (res == JFileChooser.APPROVE_OPTION) { Modified: trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java 2016-10-12 13:18:00 UTC (rev 9431) +++ trunk/soft/fudaa-crue/ui-modelling/src/test/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnableTest.java 2016-10-12 14:33:23 UTC (rev 9432) @@ -6,6 +6,7 @@ import java.io.File; import java.io.IOException; import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.fudaa.crue.common.helper.TablerFileReader; import static org.junit.Assert.*; import org.junit.Test; @@ -27,8 +28,7 @@ protected void testContent(File f) { assertNotNull(f); - ModellingListCLimMsProgressRunnable runnable = new ModellingListCLimMsProgressRunnable(f, null); - String[][] values = runnable.readFile(); + String[][] values = new TablerFileReader().readFile(f); assertEquals(2, values.length); assertEquals(5, values[0].length); assertArrayEquals(new String[]{"A", "", "B", "C", "D"}, values[0]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 13:18:03
|
Revision: 9431 http://sourceforge.net/p/fudaa/svn/9431 Author: deniger Date: 2016-10-12 13:18:00 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-673 Affichage des r?\195?\169sultats: probl?\195?\168me d'axes verticaux dupliqu?\195?\169s Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilder.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderCourbe.java Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java 2016-10-12 11:55:12 UTC (rev 9430) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingNetworkTopComponent.java 2016-10-12 13:18:00 UTC (rev 9431) @@ -244,7 +244,7 @@ return; } updating = true; - Set<Long> selectedUid = new HashSet<>(resultatEMHsSelected.allInstances()); + Set<Long> selectedUid = new HashSet<Long>(resultatEMHsSelected.allInstances()); selectEMHs(selectedUid); updating = false; } Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilder.java 2016-10-12 11:55:12 UTC (rev 9430) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilder.java 2016-10-12 13:18:00 UTC (rev 9431) @@ -5,8 +5,10 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetierConstants; @@ -49,8 +51,8 @@ super(uiController, loiLabelsManager); } - protected EGAxeVertical getOrCreateAxeVerticalZ(ReportLongitudinalConfig content) { - return getOrCreateAxeVerticalConfigured(getVariableZ().getNature(), content, null); + protected EGAxeVertical getOrCreateAxeVerticalZ(ReportLongitudinalConfig content, Map<String, EGAxeVertical> saved) { + return getOrCreateAxeVerticalConfigured(getVariableZ().getNature(), content, saved); } ReportLongitudinalPositionBrancheContent result; @@ -67,7 +69,8 @@ @Override public List<EGCourbeSimple> getInternCourbes(ReportLongitudinalConfig content, ProgressHandle progress) { - ReportLongitudinalGrapheBuilderCourbe courbeBuilder = new ReportLongitudinalGrapheBuilderCourbe(reportService.getCcm(), this, content); + Map<String, EGAxeVertical> saved = new HashMap<>(); + ReportLongitudinalGrapheBuilderCourbe courbeBuilder = new ReportLongitudinalGrapheBuilderCourbe(reportService.getCcm(), this, content, saved); EGAxeVertical axeZ = courbeBuilder.getAxeZ(); uiController.configureAxeH(reportService.getCcm().getProperty(CrueConfigMetierConstants.PROP_XP), true); double xpInit = 0; @@ -84,7 +87,7 @@ } uiController.getGraphe().setHorizontalBanner(new ReportLongitudinalBanner(content, result)); final List<EGCourbeSimple> res = createNonTimeStepCourbes(content, axeZ, courbeBuilder, progress); - res.addAll(createCourbesOnCurrentTimeStep(content, progress)); + res.addAll(createCourbesOnCurrentTimeStep(content, progress, saved)); return res; } @@ -123,16 +126,18 @@ @Override public List<EGCourbeSimple> getInternCourbesAfterTimeChanged(ReportLongitudinalConfig content, ProgressHandle progress) { + Map<String, EGAxeVertical> saved = new HashMap<>(); List<EGCourbeSimple> res = retrieveCourbesNonTimeStep(); - res.addAll(createCourbesOnCurrentTimeStep(content, progress)); + res.addAll(createCourbesOnCurrentTimeStep(content, progress, saved)); return res; } - private List<EGCourbeSimple> createCourbesOnCurrentTimeStep(ReportLongitudinalConfig content, ProgressHandle progress) { + private List<EGCourbeSimple> createCourbesOnCurrentTimeStep(ReportLongitudinalConfig content, ProgressHandle progress, + Map<String, EGAxeVertical> saved) { if (Boolean.FALSE.equals(content.getCurrentTimeDisplayed())) { return Collections.emptyList(); } - ReportLongitudinalGrapheBuilderCourbe courbeBuilder = new ReportLongitudinalGrapheBuilderCourbe(reportService.getCcm(), this, content); + ReportLongitudinalGrapheBuilderCourbe courbeBuilder = new ReportLongitudinalGrapheBuilderCourbe(reportService.getCcm(), this, content, saved); if (result == null) { return Collections.emptyList(); } @@ -181,11 +186,11 @@ return keys; } - EGAxeVertical getRightAxis(ReportLongitudinalConfig content) { + EGAxeVertical getRightAxis(ReportLongitudinalConfig content, Map<String, EGAxeVertical> savedAxed) { String variableDrawnOnRightAxis = content.getVariableDrawnOnRightAxis(reportResultProviderService); EGAxeVertical rightAxis = null; if (StringUtils.isNotBlank(variableDrawnOnRightAxis)) { - rightAxis = getOrCreateAxeVerticalConfigured(reportResultProviderService.getPropertyNature(variableDrawnOnRightAxis), content, null); + rightAxis = getOrCreateAxeVerticalConfigured(reportResultProviderService.getPropertyNature(variableDrawnOnRightAxis), content, savedAxed); } if (rightAxis != null) { rightAxis.setDroite(true); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderCourbe.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderCourbe.java 2016-10-12 11:55:12 UTC (rev 9430) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderCourbe.java 2016-10-12 13:18:00 UTC (rev 9431) @@ -42,12 +42,13 @@ EGAxeVertical rightAxis; ReportLongitudinalConfig content; - public ReportLongitudinalGrapheBuilderCourbe(CrueConfigMetier ccm, ReportLongitudinalGrapheBuilder result, ReportLongitudinalConfig content) { + public ReportLongitudinalGrapheBuilderCourbe(CrueConfigMetier ccm, ReportLongitudinalGrapheBuilder result, ReportLongitudinalConfig content, + Map<String, EGAxeVertical> saved) { this.ccm = ccm; this.builder = result; this.content = content; - axeZ = builder.getOrCreateAxeVerticalZ(content); - rightAxis = builder.getRightAxis(content); + axeZ = builder.getOrCreateAxeVerticalZ(content, saved); + rightAxis = builder.getRightAxis(content, saved); } public EGAxeVertical getAxeZ() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 11:55:14
|
Revision: 9430 http://sourceforge.net/p/fudaa/svn/9430 Author: deniger Date: 2016-10-12 11:55:12 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-691 Export des profils en travers Modified Paths: -------------- trunk/soft/fudaa-crue/pom.xml Modified: trunk/soft/fudaa-crue/pom.xml =================================================================== --- trunk/soft/fudaa-crue/pom.xml 2016-10-12 11:54:58 UTC (rev 9429) +++ trunk/soft/fudaa-crue/pom.xml 2016-10-12 11:55:12 UTC (rev 9430) @@ -20,7 +20,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <javaCompiler>1.7</javaCompiler> <targetJdk>1.7</targetJdk> - <fudaa-sig.version>1.8</fudaa-sig.version> + <fudaa-sig.version>1.9-SNAPSHOT</fudaa-sig.version> <netbeans.run.params.ide /> <netbeans.run.params>${netbeans.run.params.ide}</netbeans.run.params> <!--<netbeans.version>RELEASE731</netbeans.version>--> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 11:55:02
|
Revision: 9429 http://sourceforge.net/p/fudaa/svn/9429 Author: deniger Date: 2016-10-12 11:54:58 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-691 Export des profils en travers Modified Paths: -------------- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2016-10-12 10:15:55 UTC (rev 9428) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2016-10-12 11:54:58 UTC (rev 9429) @@ -113,13 +113,14 @@ doExport('\t', _t, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } + final TIntArrayList exportableColumns = new TIntArrayList(); + @SuppressWarnings("serial") private CtuluTableExportPanel(final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui) { super(false); setLayout(new BuBorderLayout(5, 5)); exportTask = new CtuluTableExportTask(_table, _ui, type, _dest); cbModel_ = new BuList(); - final TIntArrayList exportableColumns = new TIntArrayList(); CtuluTableExportInterface exportInterface = null; if (_table.getModel() instanceof CtuluTableExportInterface) { exportInterface = (CtuluTableExportInterface) _table.getModel(); @@ -200,7 +201,11 @@ return; } } else { - col = cbModel_.getSelectedIndices(); + final int[] selectedIndices = cbModel_.getSelectedIndices(); + col = new int[selectedIndices.length]; + for (int i = 0; i < selectedIndices.length; i++) { + col[i] = this.exportableColumns.get(selectedIndices[i]); + } // pas de selection -> pas de fichier if (col == null) { nothingToExport(); Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java 2016-10-12 10:15:55 UTC (rev 9428) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportTask.java 2016-10-12 11:54:58 UTC (rev 9429) @@ -105,7 +105,7 @@ final TableColumn column = table_.getColumnModel().getColumn(col[i]); boolean toAdd = exportInterface.isColumnExportable(column.getModelIndex()); if (toAdd) { - toExport.add(i); + toExport.add(col[i]); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 10:15:57
|
Revision: 9428 http://sourceforge.net/p/fudaa/svn/9428 Author: deniger Date: 2016-10-12 10:15:55 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-700 Export des tableaux en csv Modified Paths: -------------- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java 2016-10-12 10:15:33 UTC (rev 9427) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliActionPaletteAbstract.java 2016-10-12 10:15:55 UTC (rev 9428) @@ -31,9 +31,11 @@ import org.fudaa.ctulu.gui.CtuluLibSwing; /** - * Une action d\xE9clenchant l'affichage d'une palette. Une palette est un panneau non modal. Elle peut \xEAtre associ\xE9e :<p> - Soit \xE0 la JInternalFrame - * active du Desktop donn\xE9 par {@link #setDesktop(BuDesktop)}. Elle apparait et disparait en m\xEAme temps qu'elle. Elle est visualis\xE9e sous forme de - * Palette interne.<p> - Soit a l'application par {@link #setParent(Component)}. Dans ce cas, elle est visualis\xE9e sous forme de dialogue externe. + * Une action d\xE9clenchant l'affichage d'une palette. Une palette est un panneau non modal. Elle peut \xEAtre associ\xE9e : + * <p> + * - Soit \xE0 la JInternalFrame active du Desktop donn\xE9 par {@link #setDesktop(BuDesktop)}. Elle apparait et disparait en m\xEAme temps qu'elle. Elle est + * visualis\xE9e sous forme de Palette interne.<p> + * - Soit a l'application par {@link #setParent(Component)}. Dans ce cas, elle est visualis\xE9e sous forme de dialogue externe. * * @author deniger * @version $Id$ @@ -221,6 +223,7 @@ @Override public void windowClosing(WindowEvent _e) { setSelected(false); + internalFrameClosing(null); } }); dial_.show(); @@ -424,4 +427,4 @@ public void setUsedAsTab(boolean usedAsTab) { this.usedAsTab = usedAsTab; } -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 10:15:35
|
Revision: 9427 http://sourceforge.net/p/fudaa/svn/9427 Author: deniger Date: 2016-10-12 10:15:33 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-700 Export des tableaux en csv Modified Paths: -------------- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java Modified: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2016-10-12 09:41:50 UTC (rev 9426) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2016-10-12 10:15:33 UTC (rev 9427) @@ -49,10 +49,9 @@ final CtuluTableExportTask exportTask; JDialog parentDial_; - char separator = '\t'; public static void setShowColumnsToExport(final BuTable _b, final boolean _show) { - _b.putClientProperty("TABLE_SHOW_COLUMNS_TO_EXPORT", Boolean.valueOf(_show)); + _b.putClientProperty("TABLE_SHOW_COLUMNS_TO_EXPORT", _show); } public static boolean isshowColumnToExport(final JTable _b) { @@ -79,7 +78,7 @@ return; } final CtuluTableExportPanel pn = new CtuluTableExportPanel(_table, _dest, type, _ui); - pn.separator = separator; + pn.setSeparator(separator); final CtuluDialog dial = CtuluDialogPanel.createDialog(windowParent, pn); pn.setParentDial(dial); dial.setTitle(CtuluLib.getS("S\xE9lection des donn\xE9es \xE0 exporter")); @@ -90,6 +89,10 @@ BuPreferences.BU.writeIniFile(); } + public void setSeparator(char separator) { + exportTask.setSeparator(separator); + } + public static void doExport(final JTable _t, final CtuluUI _ui, final Window _f) { doExport(DEFAULT_SEPARATOR, _t, _ui, _f); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 09:41:52
|
Revision: 9426 http://sourceforge.net/p/fudaa/svn/9426 Author: deniger Date: 2016-10-12 09:41:50 +0000 (Wed, 12 Oct 2016) Log Message: ----------- CRUE-701: Fermeture du menu Distance Modified Paths: -------------- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java Modified: trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java =================================================================== --- trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java 2016-10-12 08:56:25 UTC (rev 9425) +++ trunk/framework/ebli-2d/src/main/java/org/fudaa/ebli/calque/action/SceneShowDistanceAction.java 2016-10-12 09:41:50 UTC (rev 9426) @@ -61,14 +61,18 @@ calquesPanel_.setCalqueInteractionActif(calqueDistance_); calquesPanel_.getVueCalque().requestFocus(); } else { - calqueDistance_.cancelEdition(); - calquesPanel_.unsetCalqueInteractionActif(calqueDistance_); - if (calquesPanel_.getController().getCqSelectionI() != null) { - calquesPanel_.getController().getCqSelectionI().setGele(false); - } + cleanCalques(); } } + protected void cleanCalques() { + calqueDistance_.cancelEdition(); + calquesPanel_.unsetCalqueInteractionActif(calqueDistance_); + if (calquesPanel_.getController().getCqSelectionI() != null) { + calquesPanel_.getController().getCqSelectionI().setGele(false); + } + } + @Override protected BPalettePanelInterface buildPaletteContent() { return new BPaletteDistance(calqueDistance_, formatter_, calquesPanel_); @@ -87,10 +91,13 @@ } @Override + protected void hideWindow() { + super.hideWindow(); + cleanCalques(); + } + + @Override public void internalFrameClosing(InternalFrameEvent e) { - calqueDistance_.cancelEdition(); - if (calquesPanel_.getController().getCqSelectionI() != null) { - calquesPanel_.getController().getCqSelectionI().setGele(false); - } + cleanCalques(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 08:56:27
|
Revision: 9425 http://sourceforge.net/p/fudaa/svn/9425 Author: deniger Date: 2016-10-12 08:56:25 +0000 (Wed, 12 Oct 2016) Log Message: ----------- Changement de nom pour des classe d'exemplle: Test -> Example Modified Paths: -------------- trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueTranslationReaderWriter.java trunk/soft/fudaa-crue/crue-config/src/test/resources/log/fr_FR.msg.xml Modified: trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueTranslationReaderWriter.java =================================================================== --- trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueTranslationReaderWriter.java 2016-10-12 08:48:23 UTC (rev 9424) +++ trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueTranslationReaderWriter.java 2016-10-12 08:56:25 UTC (rev 9425) @@ -28,12 +28,12 @@ assertEquals("fr_FR", metier.locale); assertEquals("Fichier {nomEMH} {1} : la version de grammaire du fichier ({2}) n'est pas prise en charge.", metier.getTranslation("ID_FICHIERXML_VERSION_GRAMMAIRE")); - LienDocumentation lienDocumentation = metier.getLienDocumentation("ID_FICHIER_NON_TROUVE"); - assertEquals("nomReference", lienDocumentation.getSignet()); - assertEquals("cheminEtFichierDoc", lienDocumentation.getHRef()); - LienMultimedia lienMultimedia = metier.getLienMultimedia("ID_FICHIER_NON_TROUVE"); - assertEquals("nomReferenceMultimedia", lienMultimedia.getSignet()); - assertEquals("cheminEtFichierMultimedia", lienMultimedia.getHRef()); + LienDocumentation lienDocumentation = metier.getLienDocumentation("ID_VARIABLE_HORS_NORMALITE"); + assertEquals("DocumentationSignet", lienDocumentation.getSignet()); + assertEquals("FctCrue10/Dictionnaire Crue.html", lienDocumentation.getHRef()); + LienMultimedia lienMultimedia = metier.getLienMultimedia("ID_VARIABLE_HORS_NORMALITE"); + assertEquals("MutlimediaSignet", lienMultimedia.getSignet()); + assertEquals("FctCrue10/Mutlimedia.html", lienMultimedia.getHRef()); } @Test @@ -69,13 +69,13 @@ test.addRecord(createRecordVector("EMH", "arg1", "arg2")); test.addRecord(createRecordVector("EMH", "arg1")); metier.translate(test); - assertEquals("Entrée méthode sur EMH : arg1, arg2 vecteur v1;v2;v3", + assertEquals("Entrée méthode sur EMH : arg1, arg2", test.getRecords().get(0).getLocalizedMessage()); - assertEquals("Entrée méthode sur EMH : arg1, arg2 vecteur v1", + assertEquals("Entrée méthode sur EMH : arg1, arg2", test.getRecords().get(1).getLocalizedMessage()); - assertEquals("Entrée méthode sur EMH : arg1, arg2 vecteur ", + assertEquals("Entrée méthode sur EMH : arg1, arg2", test.getRecords().get(2).getLocalizedMessage()); - assertEquals("Entrée méthode sur EMH : arg1, {2} vecteur ", + assertEquals("Entrée méthode sur EMH : arg1, {2}", test.getRecords().get(3).getLocalizedMessage()); } Modified: trunk/soft/fudaa-crue/crue-config/src/test/resources/log/fr_FR.msg.xml =================================================================== --- trunk/soft/fudaa-crue/crue-config/src/test/resources/log/fr_FR.msg.xml 2016-10-12 08:48:23 UTC (rev 9424) +++ trunk/soft/fudaa-crue/crue-config/src/test/resources/log/fr_FR.msg.xml 2016-10-12 08:56:25 UTC (rev 9425) @@ -60,7 +60,8 @@ </Message> <Message ID="ID_VARIABLE_HORS_NORMALITE"> <Texte>Dans {nomEMH} (contexte {5}), la variable {4} est hors des plages de normalité [{1}, {2}] : {3}</Texte> - <LienDocumentation Href="FctCrue10/Dictionnaire Crue.html" /> + <LienDocumentation Href="FctCrue10/Dictionnaire Crue.html" Signet="DocumentationSignet"/> + <LienMultimedia Href="FctCrue10/Mutlimedia.html" Signet="MutlimediaSignet"/> </Message> <Message ID="ID_VARIABLE_SUPERIEURE_VARIABLE"> <Texte>La variable {nomEMH} ({1}) devrait être inférieure à la variable {3} ({2}).</Texte> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 08:48:25
|
Revision: 9424 http://sourceforge.net/p/fudaa/svn/9424 Author: deniger Date: 2016-10-12 08:48:23 +0000 (Wed, 12 Oct 2016) Log Message: ----------- Changement de nom pour des classe d'exemplle: Test -> Example Modified Paths: -------------- trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueLogReader.java Modified: trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueLogReader.java =================================================================== --- trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueLogReader.java 2016-10-12 08:43:04 UTC (rev 9423) +++ trunk/soft/fudaa-crue/crue-config/src/test/java/org/fudaa/dodico/crue/config/cr/TestCrueLogReader.java 2016-10-12 08:48:23 UTC (rev 9424) @@ -33,7 +33,7 @@ translator.translate(read.getMetier()); CtuluLogRecord get = read.getMetier().getRecords().get(2171); String localizedMessage = get.getLocalizedMessage(); - assertEquals("Entrée méthode sur Sc_M201-0_c9c10 : arg1, arg2 vecteur 1;2;3;4;5", localizedMessage); + assertEquals("Entrée méthode sur Sc_M201-0_c9c10 : arg1, arg2", localizedMessage); } @Test This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-10-12 08:04:42
|
Revision: 9422 http://sourceforge.net/p/fudaa/svn/9422 Author: deniger Date: 2016-10-12 08:04:39 +0000 (Wed, 12 Oct 2016) Log Message: ----------- Changement de nom pour des classe d'exemplle: Test -> Example Modified Paths: -------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibFile.java Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibFile.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibFile.java 2016-10-12 07:32:14 UTC (rev 9421) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/CtuluLibFile.java 2016-10-12 08:04:39 UTC (rev 9422) @@ -688,17 +688,6 @@ * @return le fichier ou une copie si necessaire */ public static File getFileFromJar(final String pathInJar, File destFile, Class clazzToLoad) { - URI uri = null; - try { - final URL resource = clazzToLoad.getResource(pathInJar); - assert resource != null; - uri = resource.toURI(); - } catch (final URISyntaxException e) { - Logger.getLogger(CtuluLibFile.class.getName()).log(Level.SEVERE, "getFile " + pathInJar, e); - } - if (uri == null) { - return null; - } File f = destFile; FileOutputStream out = null; InputStream in = null; @@ -707,8 +696,7 @@ f = File.createTempFile("fudaa", ".tmp"); } out = new FileOutputStream(f); - in = uri.toURL().openStream(); - CtuluLibFile.copyStream(in, out, true, true); + CtuluLibFile.copyStream(clazzToLoad.getResourceAsStream(pathInJar), out, true, true); } catch (final IOException e) { Logger.getLogger(CtuluLibFile.class.getName()).log(Level.SEVERE, "getFile " + pathInJar, e); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |