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: <de...@us...> - 2016-02-19 15:13:04
|
Revision: 9277 http://sourceforge.net/p/fudaa/svn/9277 Author: deniger Date: 2016-02-19 15:13:02 +0000 (Fri, 19 Feb 2016) Log Message: ----------- traductions Modified Paths: -------------- trunk/soft/fudaa-crue/ui-views/pom.xml Modified: trunk/soft/fudaa-crue/ui-views/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-views/pom.xml 2016-02-19 14:58:59 UTC (rev 9276) +++ trunk/soft/fudaa-crue/ui-views/pom.xml 2016-02-19 15:13:02 UTC (rev 9277) @@ -38,6 +38,11 @@ </dependency> <dependency> <groupId>org.fudaa.framework.ctulu</groupId> + <artifactId>ctulu-fu</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.fudaa.framework.ctulu</groupId> <artifactId>ctulu-bu</artifactId> <scope>provided</scope> </dependency> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-02-19 14:59:02
|
Revision: 9276 http://sourceforge.net/p/fudaa/svn/9276 Author: deniger Date: 2016-02-19 14:58:59 +0000 (Fri, 19 Feb 2016) Log Message: ----------- traductions Modified Paths: -------------- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeReduceRangePanel.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeStepSliderPanel.java trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/export/DonClimMExportTableModel.java Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java 2016-02-15 22:10:43 UTC (rev 9275) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java 2016-02-19 14:58:59 UTC (rev 9276) @@ -3,6 +3,7 @@ */ package org.fudaa.fudaa.crue.report.longitudinal; +import com.memoire.fu.FuEmptyArrays; import gnu.trove.TIntObjectHashMap; import java.awt.color.ColorSpace; import java.util.ArrayList; @@ -100,6 +101,11 @@ } @Override + public int[] getSelectedRows() { + return FuEmptyArrays.INT0; + } + + @Override public Object getValue(int _row, int _col) { if (_col == COLUMN_BRANCHE) { return branches.get(_row); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeReduceRangePanel.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeReduceRangePanel.java 2016-02-15 22:10:43 UTC (rev 9275) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeReduceRangePanel.java 2016-02-19 14:58:59 UTC (rev 9276) @@ -8,13 +8,10 @@ import com.memoire.bu.BuLib; import java.awt.BorderLayout; import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; import javax.swing.BorderFactory; -import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; @@ -25,10 +22,8 @@ import org.fudaa.fudaa.crue.common.PerspectiveEnum; import org.fudaa.fudaa.crue.common.helper.ComboBoxHelper; import org.fudaa.fudaa.crue.common.helper.ToStringTransfomerCellRenderer; -import org.fudaa.fudaa.crue.common.services.SysdocContrat; import org.fudaa.fudaa.crue.common.services.SysdocUrlBuilder; import org.openide.util.HelpCtx; -import org.openide.util.Lookup; /** * Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeStepSliderPanel.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeStepSliderPanel.java 2016-02-15 22:10:43 UTC (rev 9275) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/time/ReportTimeStepSliderPanel.java 2016-02-19 14:58:59 UTC (rev 9276) @@ -141,10 +141,8 @@ if (videoRecorder != null) { videoRecorder.end(); } - } else { - if (videoRecorder != null) { - videoRecorder.nextDone(); - } + } else if (videoRecorder != null) { + videoRecorder.nextDone(); } } protected int playDelay = 1000; @@ -247,6 +245,9 @@ btNext.setEnabled(editable && enable); btLast.setEnabled(editable && enable); btPlay.setEnabled(editable && enable); + if (editable && !enable) { + setIcon(btPlay, "play.png"); + } btReplay.setEnabled(editable); } Modified: trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/export/DonClimMExportTableModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/export/DonClimMExportTableModel.java 2016-02-15 22:10:43 UTC (rev 9275) +++ trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/export/DonClimMExportTableModel.java 2016-02-19 14:58:59 UTC (rev 9276) @@ -3,6 +3,7 @@ */ package org.fudaa.fudaa.crue.views.export; +import com.memoire.fu.FuEmptyArrays; import java.util.Collections; import java.util.List; import jxl.write.Label; @@ -12,9 +13,7 @@ import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; import org.fudaa.dodico.crue.config.ccm.DecimalFormatEpsilonEnum; import org.fudaa.dodico.crue.config.ccm.ItemVariable; -import org.fudaa.dodico.crue.metier.emh.CalcPseudoPermBrancheOrificeManoeuvre; import org.fudaa.dodico.crue.metier.emh.CalcPseudoPermItem; -import org.fudaa.dodico.crue.metier.emh.CalcTransBrancheOrificeManoeuvre; import org.fudaa.dodico.crue.metier.emh.CalcTransItem; import org.fudaa.dodico.crue.metier.emh.DonCLimM; import org.fudaa.dodico.crue.metier.emh.DonCLimMCommonItem; @@ -51,6 +50,11 @@ } @Override + public int[] getSelectedRows() { + return FuEmptyArrays.INT0; + } + + @Override public List<String> getComments() { return Collections.emptyList(); } @@ -125,4 +129,5 @@ String value = getValue(_rowInModel, _colInModel); return new Label(_colInXls, _rowInXls, value); } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-02-15 22:10:45
|
Revision: 9275 http://sourceforge.net/p/fudaa/svn/9275 Author: deniger Date: 2016-02-15 22:10:43 +0000 (Mon, 15 Feb 2016) Log Message: ----------- traductions Modified Paths: -------------- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr.properties trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle_fr.properties trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-actions.jar/org/openide/actions/Bundle_fr.properties trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-explorer.jar/org/openide/explorer/propertysheet/Bundle_fr.properties Added Paths: ----------- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/beaninfo/ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/beaninfo/editors/ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/beaninfo/editors/Bundle_fr.properties Removed Paths: ------------- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr_FR.properties Modified: trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr.properties =================================================================== --- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr.properties 2016-02-15 21:58:19 UTC (rev 9274) +++ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr.properties 2016-02-15 22:10:43 UTC (rev 9275) @@ -21,5 +21,8 @@ LBL_ToggleWindowTransparencyAction=Fen\u00eatre transparente LBL_WindowTransparencyHint=Maintenir la touche [Ctrl+clavier num\u00e9rique 0] pour rendre transparente une fen\u00eatre minimis\u00e9e CTL_CloseModeAction=Fermer le groupe +CTL_MinimizeModeAction=Minimiser le groupe +CTL_MinimizeWindowAction=Minimiser + Deleted: trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr_FR.properties =================================================================== --- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr_FR.properties 2016-02-15 21:58:19 UTC (rev 9274) +++ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/actions/Bundle_fr_FR.properties 2016-02-15 22:10:43 UTC (rev 9275) @@ -1,2 +0,0 @@ -CTL_MinimizeModeAction=Minimiser le groupe -CTL_MinimizeWindowAction=Minimiser Modified: trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle_fr.properties =================================================================== --- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle_fr.properties 2016-02-15 21:58:19 UTC (rev 9274) +++ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle_fr.properties 2016-02-15 22:10:43 UTC (rev 9275) @@ -5,4 +5,5 @@ CTL_MainWindow_Title_No_Project=Fudaa-Crue {0} LBL_Close=&Fermer LBL_CloseDocuments=F&ermer les documents +CTL_PropertiesWindow=Propri\u00e9t\u00e9s Added: trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/beaninfo/editors/Bundle_fr.properties =================================================================== --- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/beaninfo/editors/Bundle_fr.properties (rev 0) +++ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-netbeans-core.jar/org/netbeans/beaninfo/editors/Bundle_fr.properties 2016-02-15 22:10:43 UTC (rev 9275) @@ -0,0 +1 @@ +ACS_PropertiesEditorPane=Propri\u00e9t\u00e9s Modified: trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-actions.jar/org/openide/actions/Bundle_fr.properties =================================================================== --- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-actions.jar/org/openide/actions/Bundle_fr.properties 2016-02-15 21:58:19 UTC (rev 9274) +++ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-actions.jar/org/openide/actions/Bundle_fr.properties 2016-02-15 22:10:43 UTC (rev 9275) @@ -8,4 +8,4 @@ UndoSimple=&D\u00e9faire CTL_Tools=Outils CloseView=Fermer - +Properties=&Propri\u00e9t\u00e9s \ No newline at end of file Modified: trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-explorer.jar/org/openide/explorer/propertysheet/Bundle_fr.properties =================================================================== --- trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-explorer.jar/org/openide/explorer/propertysheet/Bundle_fr.properties 2016-02-15 21:58:19 UTC (rev 9274) +++ trunk/soft/fudaa-crue/ui-branding/src/main/nbm-branding/modules/org-openide-explorer.jar/org/openide/explorer/propertysheet/Bundle_fr.properties 2016-02-15 22:10:43 UTC (rev 9275) @@ -1,3 +1,4 @@ +LBL_BasicTab=Propri\u00e9t\u00e9s CTL_Properties=&Propri\u00e9t\u00e9s CTL_PropertiesNoMnemonic=Propri\u00e9t\u00e9s CTL_No_properties=Pas de propri\u00e9t\u00e9s This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-02-15 21:58:22
|
Revision: 9274 http://sourceforge.net/p/fudaa/svn/9274 Author: deniger Date: 2016-02-15 21:58:19 +0000 (Mon, 15 Feb 2016) Log Message: ----------- ajout methode pour nouvelle version ebli1d Modified Paths: -------------- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/loiff/SimpleLoiCourbeModel.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionFrtCourbeModel.java Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java 2016-02-15 21:57:56 UTC (rev 9273) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/AbstractLoiCourbeModel.java 2016-02-15 21:58:19 UTC (rev 9274) @@ -671,4 +671,10 @@ @Override public void viewGenerationSource(Map infos, CtuluUI impl) { } + + @Override + public int[] getInitRows() { + return null; + } + } Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java 2016-02-15 21:57:56 UTC (rev 9273) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java 2016-02-15 21:58:19 UTC (rev 9274) @@ -317,4 +317,10 @@ public void restoreFromSpecificDatas(Object data, Map infos) { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int[] getInitRows() { + return null; + } + } Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java 2016-02-15 21:57:56 UTC (rev 9273) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiDefaultCourbeModel.java 2016-02-15 21:58:19 UTC (rev 9274) @@ -240,4 +240,9 @@ public void restoreFromSpecificDatas(Object data, Map infos) { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int[] getInitRows() { + return null; + } } Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/loiff/SimpleLoiCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/loiff/SimpleLoiCourbeModel.java 2016-02-15 21:57:56 UTC (rev 9273) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/loiff/SimpleLoiCourbeModel.java 2016-02-15 21:58:19 UTC (rev 9274) @@ -275,4 +275,9 @@ @Override public void viewGenerationSource(Map infos, CtuluUI impl) { } + + @Override + public int[] getInitRows() { + return null; + } } Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionFrtCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionFrtCourbeModel.java 2016-02-15 21:57:56 UTC (rev 9273) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/section/ProfilSectionFrtCourbeModel.java 2016-02-15 21:58:19 UTC (rev 9274) @@ -295,4 +295,9 @@ public void restoreFromSpecificDatas(Object data, Map infos) { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int[] getInitRows() { + return null; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-02-15 21:57:58
|
Revision: 9273 http://sourceforge.net/p/fudaa/svn/9273 Author: deniger Date: 2016-02-15 21:57:56 +0000 (Mon, 15 Feb 2016) Log Message: ----------- CRUE-689 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/services/SysdocService.java Modified: trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/services/SysdocService.java =================================================================== --- trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/services/SysdocService.java 2016-02-15 21:57:42 UTC (rev 9272) +++ trunk/soft/fudaa-crue/ui-sysdoc/src/main/java/org/fudaa/fudaa/crue/sysdoc/services/SysdocService.java 2016-02-15 21:57:56 UTC (rev 9273) @@ -37,203 +37,215 @@ * @author Frederic Deniger */ @ServiceProviders(value = { - @ServiceProvider(service = Help.class, supersedes = {"org.netbeans.modules.javahelp.JavaHelp"}), - @ServiceProvider(service = SysdocService.class), - @ServiceProvider(service = SysdocContrat.class)}) -public class SysdocService extends Help implements SysdocContrat { + @ServiceProvider(service = Help.class, supersedes = {"org.netbeans.modules.javahelp.JavaHelp"}), + @ServiceProvider(service = HelpCtx.Displayer.class), + @ServiceProvider(service = SysdocService.class), + @ServiceProvider(service = SysdocContrat.class)}) +public class SysdocService extends Help implements SysdocContrat, HelpCtx.Displayer { - private InstallationService installationService = Lookup.getDefault().lookup(InstallationService.class); - private ConfigurationManagerService configurationManagerService = Lookup.getDefault().lookup(ConfigurationManagerService.class); + private InstallationService installationService = Lookup.getDefault().lookup(InstallationService.class); + private ConfigurationManagerService configurationManagerService = Lookup.getDefault().lookup(ConfigurationManagerService.class); - private static HashMap<String, String> helpIdLink = null; - private static final String DEFAULT_LINK = "DEFAUT"; - private static final String HTMLCode = "<!DOCTYPE HTML>\n" - + "<html>\n" - + " <head>\n" - + " <meta charset=\"UTF-8\">\n" - + " <meta http-equiv=\"refresh\" content=\"1;url=@@URL@@\">\n" - + " <title>Fudaa Crue</title>\n" - + " </head>\n" - + " <body>\n" - + " Suivez ce lien pour afficher la documentation <a href='@@URL@@'>Aide FudaaCrue</a>\n" - + " </body>\n" - + "</html>"; + private static HashMap<String, String> helpIdLink = null; + private static final String DEFAULT_LINK = "DEFAUT"; + private static final String HTML_CODE = "<!DOCTYPE HTML>\n" + "<html>\n" + + " <head>\n" + + " <meta charset=\"UTF-8\">\n" + + " <meta http-equiv=\"refresh\" content=\"1;url=@@URL@@\">\n" + + " <title>Fudaa Crue</title>\n" + + " </head>\n" + + " <body>\n" + + " Suivez ce lien pour afficher la documentation <a href='@@URL@@'>Aide FudaaCrue</a>\n" + + " </body>\n" + + "</html>"; - /** - * Construit l'URL pour accéder à l'aide en ligne - * - * @param HelpId - * @return - */ - public String getHelpURL(String HelpId) { - String locale = configurationManagerService.getCurrentLocale(); - String path = String.format(configurationManagerService.getOptionsManager().getAideOption().getCheminBase(), locale); + /** + * Construit l'URL pour accéder à l'aide en ligne + * + * @param HelpId + * @return + */ + public String getHelpURL(String HelpId) { + String locale = configurationManagerService.getCurrentLocale(); + String path = String.format(configurationManagerService.getOptionsManager().getAideOption().getCheminBase(), locale); - if (configurationManagerService.getOptionsManager().getAideOption().getType().equals(AideEnum.RELATIVE.toString())) { - try { + if (configurationManagerService.getOptionsManager().getAideOption().getType().equals(AideEnum.RELATIVE.toString())) { + try { - File pathSiteDir = installationService.getSiteDir(); - //Recherche du lecteur - String drive = ""; - if (pathSiteDir.getCanonicalPath().length() > 1 && pathSiteDir.getCanonicalPath().charAt(1) == ':') { - drive = pathSiteDir.getCanonicalPath().substring(0, 1); - } - //drive = "P"; - //Commande Net Use pour recuperer le nom du serveur pour generer le chemin UNC - String[] command = new String[3]; - command[0] = "net"; - command[1] = "use"; - command[2] = drive + ":"; - Process p = Runtime.getRuntime().exec(command); + File pathSiteDir = installationService.getSiteDir(); + //Recherche du lecteur + String drive = ""; + if (pathSiteDir.getCanonicalPath().length() > 1 && pathSiteDir.getCanonicalPath().charAt(1) == ':') { + drive = pathSiteDir.getCanonicalPath().substring(0, 1); + } + //drive = "P"; + //Commande Net Use pour recuperer le nom du serveur pour generer le chemin UNC + String[] command = new String[3]; + command[0] = "net"; + command[1] = "use"; + command[2] = drive + ":"; + Process p = Runtime.getRuntime().exec(command); - BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); - String lineErr = ""; - while ((lineErr = err.readLine()) != null) { - System.out.println(lineErr); - } + BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String lineErr = ""; + while ((lineErr = err.readLine()) != null) { + System.out.println(lineErr); + } - BufferedReader read = new BufferedReader(new InputStreamReader(p.getInputStream())); + BufferedReader read = new BufferedReader(new InputStreamReader(p.getInputStream())); - String netPath = ""; - try { - String line = read.readLine(); + String netPath = ""; + try { + String line = read.readLine(); - while (line != null) { - if (line.contains("\\\\")) { - netPath = line.substring(line.indexOf("\\\\")).substring(2); - break; - } - line = read.readLine(); - } - } finally { - read.close(); - } - path = "/" + path; - if (netPath.length() > 0) { - String pathConv = installationService.getSiteDir().getCanonicalPath().replace(drive + ":", netPath); - if ((System.getenv("USERDNSDOMAIN") != null && System.getenv("USERDOMAIN") != null) && pathConv.toLowerCase().contains(System.getenv("USERDNSDOMAIN").toLowerCase())) { - pathConv = pathConv.toLowerCase().replace(System.getenv("USERDNSDOMAIN").toLowerCase(), System.getenv("USERDOMAIN")); - } - path = "file://" + pathConv + path + getLink(HelpId); - } else { - path = "file://" + installationService.getSiteDir().getCanonicalPath() + path + getLink(HelpId); - } - path = path.replace("\\", "/"); - } catch (IOException ex) { - Exceptions.printStackTrace(ex); + while (line != null) { + if (line.contains("\\\\")) { + netPath = line.substring(line.indexOf("\\\\")).substring(2); + break; } + line = read.readLine(); + } + } finally { + read.close(); + } + path = "/" + path; + if (netPath.length() > 0) { + String pathConv = installationService.getSiteDir().getCanonicalPath().replace(drive + ":", netPath); + if ((System.getenv("USERDNSDOMAIN") != null && System.getenv("USERDOMAIN") != null) && pathConv.toLowerCase().contains(System.getenv( + "USERDNSDOMAIN").toLowerCase())) { + pathConv = pathConv.toLowerCase().replace(System.getenv("USERDNSDOMAIN").toLowerCase(), System.getenv("USERDOMAIN")); + } + path = "file://" + pathConv + path + getLink(HelpId); } else { - path = path + getLink(HelpId); + path = "file://" + installationService.getSiteDir().getCanonicalPath() + path + getLink(HelpId); } - - return path; + path = path.replace("\\", "/"); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + } else { + path = path + getLink(HelpId); } - /** - * Fournit le lien correspondant à l'ID interne FudaaCrue - * - * @param HelpId - * @return - */ - private String getLink(String HelpId) { - String link = ""; - if (helpIdLink == null) { - helpIdLink = configurationManagerService.readAide(); - } + return path; + } - if (helpIdLink != null && helpIdLink.containsKey(HelpId)) { - link = helpIdLink.get(HelpId); - } else if (helpIdLink != null && helpIdLink.containsKey(DEFAULT_LINK)) { - link = helpIdLink.get(DEFAULT_LINK); - } - return link; + /** + * Fournit le lien correspondant à l'ID interne FudaaCrue + * + * @param HelpId + * @return + */ + private String getLink(String HelpId) { + String link = ""; + if (helpIdLink == null) { + helpIdLink = configurationManagerService.readAide(); } - @Override - public Boolean isValidID(String string, boolean bln) { - return Boolean.TRUE; + if (helpIdLink != null && helpIdLink.containsKey(HelpId)) { + link = helpIdLink.get(HelpId); + } else if (helpIdLink != null && helpIdLink.containsKey(DEFAULT_LINK)) { + link = helpIdLink.get(DEFAULT_LINK); } + return link; + } - @Override - public void showHelp(HelpCtx hc, boolean bln) { - display(hc.getHelpID()); + @Override + public Boolean isValidID(String string, boolean bln) { + return Boolean.TRUE; + } - } + @Override + public void showHelp(HelpCtx hc, boolean bln) { + display(hc.getHelpID()); + } - @Override - public void addChangeListener(ChangeListener cl) { - } + @Override + public boolean display(HelpCtx help) { + display(help.getHelpID()); + return true; + } - @Override - public void removeChangeListener(ChangeListener cl) { - } + @Override + public void showHelp(HelpCtx ctx) { + super.showHelp(ctx); + } - @Override - public void display(String path) { + @Override + public void addChangeListener(ChangeListener cl) { + } - if (configurationManagerService.getOptionsManager().getAideOption().getSyDocActivation()) { - String lienHelp = getLink(path); - SysdocTopComponent findTopComponent = (SysdocTopComponent) WindowManager.getDefault().findTopComponent(SysdocTopComponent.TOPCOMPONENT_ID); - if (lienHelp != null) { - findTopComponent.display(lienHelp); - } - if (!findTopComponent.isOpened()) { - findTopComponent.open(); - } - findTopComponent.requestActive(); - } else { - try { - String pageRedirection = HTMLCode.replaceAll("@@URL@@", this.getHelpURL(path)); - if (installationService.getUserDir() != null) { - File userDirectory = Places.getUserDirectory(); - FileUtils.writeStringToFile(new File(userDirectory.getCanonicalPath() + "/var/temp/aide.htm"), pageRedirection); - URL HelpUrl = new URL("file:///" + userDirectory.getCanonicalPath() + "/var/temp/aide.htm"); - Desktop.getDesktop().browse(HelpUrl.toURI()); - } else { - Logger.getLogger(SysdocService.class.getName()).log(Level.WARNING, "Repertoire utilisateur non défini."); - } - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } - } - } + @Override + public void removeChangeListener(ChangeListener cl) { + } - @Override - @Messages("Sysdoc.DisplayMediaNotFound=Le m\u00e9dia n''est pas trouv\u00e9. Chemin: {0}") - public void displayMedia(String helpUrl) { - if (helpUrl.startsWith("http")) { - try { - Desktop.getDesktop().browse(new URI(helpUrl)); - } catch (Exception ex) { - Exceptions.printStackTrace(ex); - } - return; - } - File sysdocLocaleDir = getSysdocLocalizedDir(); - File target = new File(sysdocLocaleDir, helpUrl); - if (!target.exists()) { - DialogHelper.showError(Sysdoc_DisplayMediaNotFound(target.getAbsolutePath())); + @Override + public void display(String path) { + + if (configurationManagerService.getOptionsManager().getAideOption().getSyDocActivation()) { + String lienHelp = getLink(path); + SysdocTopComponent findTopComponent = (SysdocTopComponent) WindowManager.getDefault().findTopComponent(SysdocTopComponent.TOPCOMPONENT_ID); + if (lienHelp != null) { + findTopComponent.display(lienHelp); + } + if (!findTopComponent.isOpened()) { + findTopComponent.open(); + } + findTopComponent.requestActive(); + } else { + try { + String pageRedirection = HTML_CODE.replaceAll("@@URL@@", this.getHelpURL(path)); + if (installationService.getUserDir() != null) { + File userDirectory = Places.getUserDirectory(); + FileUtils.writeStringToFile(new File(userDirectory.getCanonicalPath() + "/var/temp/aide.htm"), pageRedirection); + URL HelpUrl = new URL("file:///" + userDirectory.getCanonicalPath() + "/var/temp/aide.htm"); + Desktop.getDesktop().browse(HelpUrl.toURI()); } else { - try { - Desktop.getDesktop().open(target); - } catch (IOException ex) { - Logger.getLogger(SysdocService.class.getName()).log(Level.WARNING, "message {0}", ex); - } + Logger.getLogger(SysdocService.class.getName()).log(Level.WARNING, "Repertoire utilisateur non défini."); } + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } } + } - public File getSysdocLocalizedDir() { - File sysdocBaseDir = new File(configurationManagerService.getCoeurManager().getSiteDir(), "sydoc"); - String local = configurationManagerService.getCurrentLocale(); - File sysdocLocaleDir = new File(sysdocBaseDir, local); - return sysdocLocaleDir; + @Override + @Messages("Sysdoc.DisplayMediaNotFound=Le m\u00e9dia n''est pas trouv\u00e9. Chemin: {0}") + public void displayMedia(String helpUrl) { + if (helpUrl.startsWith("http")) { + try { + Desktop.getDesktop().browse(new URI(helpUrl)); + } catch (Exception ex) { + Exceptions.printStackTrace(ex); + } + return; } + File sysdocLocaleDir = getSysdocLocalizedDir(); + File target = new File(sysdocLocaleDir, helpUrl); + if (!target.exists()) { + DialogHelper.showError(Sysdoc_DisplayMediaNotFound(target.getAbsolutePath())); + } else { + try { + Desktop.getDesktop().open(target); + } catch (IOException ex) { + Logger.getLogger(SysdocService.class.getName()).log(Level.WARNING, "message {0}", ex); + } + } + } - @Override - /* + public File getSysdocLocalizedDir() { + File sysdocBaseDir = new File(configurationManagerService.getCoeurManager().getSiteDir(), "sydoc"); + String local = configurationManagerService.getCurrentLocale(); + File sysdocLocaleDir = new File(sysdocBaseDir, local); + return sysdocLocaleDir; + } + + @Override + /* * Flag permettant de connaitre l'activation ou non de SyDoc - */ - public boolean isSyDocActivated() { - return configurationManagerService.getOptionsManager().getAideOption().getSyDocActivation(); - } + */ + public boolean isSyDocActivated() { + return configurationManagerService.getOptionsManager().getAideOption().getSyDocActivation(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-02-15 21:57:45
|
Revision: 9272 http://sourceforge.net/p/fudaa/svn/9272 Author: deniger Date: 2016-02-15 21:57:42 +0000 (Mon, 15 Feb 2016) Log Message: ----------- CRUE-689 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/services/SysdocUrlBuilder.java Modified: trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/services/SysdocUrlBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/services/SysdocUrlBuilder.java 2016-02-15 21:18:25 UTC (rev 9271) +++ trunk/soft/fudaa-crue/ui-common/src/main/java/org/fudaa/fudaa/crue/common/services/SysdocUrlBuilder.java 2016-02-15 21:57:42 UTC (rev 9272) @@ -57,7 +57,7 @@ public static void installDialogHelpCtx(DialogDescriptor descriptor, String bdlId, PerspectiveEnum perspective, boolean bDisplayHelpButton) { final String id = getDialogHelpCtxId(bdlId, perspective); final HelpCtx helpCtx = new HelpCtx(id); - if(bDisplayHelpButton) + if (bDisplayHelpButton) descriptor.setHelpCtx(helpCtx); Object message = descriptor.getMessage(); if (message instanceof JComponent) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2016-02-15 21:18:28
|
Revision: 9271 http://sourceforge.net/p/fudaa/svn/9271 Author: deniger Date: 2016-02-15 21:18:25 +0000 (Mon, 15 Feb 2016) Log Message: ----------- CRUE-667 Property Changed: ---------------- trunk/framework/ Index: trunk/framework =================================================================== --- trunk/framework 2016-02-15 09:04:46 UTC (rev 9270) +++ trunk/framework 2016-02-15 21:18:25 UTC (rev 9271) Property changes on: trunk/framework ___________________________________________________________________ Modified: svn:ignore ## -1,5 +1,6 ## +.classpath +bin +nbactions.xml .project target .settings -bin -.classpath This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 9206 http://sourceforge.net/p/fudaa/svn/9206 Author: deniger Date: 2015-11-25 23:42:14 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java 2015-11-25 23:38:19 UTC (rev 9205) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java 2015-11-25 23:42:14 UTC (rev 9206) @@ -17,7 +17,7 @@ import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGExportData; import org.fudaa.ebli.courbe.EGExportDataBuilder; -import org.fudaa.ebli.commun.EbliDataCellDoubleValue; +import org.fudaa.ctulu.table.CtuluTableCellDoubleValue; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.courbe.EGTimeLabel; @@ -96,7 +96,7 @@ if (_i == COLUMN_BRANCHE || _i == COLUMN_SECTION) { return String.class; } - return EbliDataCellDoubleValue.class; + return CtuluTableCellDoubleValue.class; } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-25 23:38:22
|
Revision: 9205 http://sourceforge.net/p/fudaa/svn/9205 Author: deniger Date: 2015-11-25 23:38:19 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Added Paths: ----------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java Removed Paths: ------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java Deleted: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java 2015-11-25 23:30:00 UTC (rev 9204) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java 2015-11-25 23:38:19 UTC (rev 9205) @@ -1,70 +0,0 @@ -/* -GPL 2 - */ -package org.fudaa.ctulu.table; - -/** - * - * @author Frederic Deniger - */ -public class CtuluTableCellDoubleValue implements Comparable<CtuluTableCellDoubleValue> { - - private final String formattedValue; - private final double value; - - public CtuluTableCellDoubleValue(String formattedValue, double value) { - this.formattedValue = formattedValue == null ? Double.toString(value) : formattedValue; - this.value = value; - } - - public String getFormattedValue() { - return formattedValue; - } - - public double getValue() { - return value; - } - - @Override - public String toString() { - return formattedValue; - } - - - @Override - public int hashCode() { - int hash = 3; - hash = 37 * hash + (int) (Double.doubleToLongBits(this.value) ^ (Double.doubleToLongBits(this.value) >>> 32)); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final CtuluTableCellDoubleValue other = (CtuluTableCellDoubleValue) obj; - if (Double.doubleToLongBits(this.value) != Double.doubleToLongBits(other.value)) { - return false; - } - return true; - } - - @Override - public int compareTo(CtuluTableCellDoubleValue o) { - if (o == null) { - return 1; - } - if (o == this) { - return 0; - } - return value > o.value ? 1 : (value < o.value ? -1 : 0); - } - -} Copied: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java (from rev 9201, trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java) =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java (rev 0) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java 2015-11-25 23:38:19 UTC (rev 9205) @@ -0,0 +1,70 @@ +/* +GPL 2 + */ +package org.fudaa.ctulu.table; + +/** + * + * @author Frederic Deniger + */ +public class CtuluTableCellDoubleValue implements Comparable<CtuluTableCellDoubleValue> { + + private final String formattedValue; + private final double value; + + public CtuluTableCellDoubleValue(String formattedValue, double value) { + this.formattedValue = formattedValue == null ? Double.toString(value) : formattedValue; + this.value = value; + } + + public String getFormattedValue() { + return formattedValue; + } + + public double getValue() { + return value; + } + + @Override + public String toString() { + return formattedValue; + } + + + @Override + public int hashCode() { + int hash = 3; + hash = 37 * hash + (int) (Double.doubleToLongBits(this.value) ^ (Double.doubleToLongBits(this.value) >>> 32)); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CtuluTableCellDoubleValue other = (CtuluTableCellDoubleValue) obj; + if (Double.doubleToLongBits(this.value) != Double.doubleToLongBits(other.value)) { + return false; + } + return true; + } + + @Override + public int compareTo(CtuluTableCellDoubleValue o) { + if (o == null) { + return 1; + } + if (o == this) { + return 0; + } + return value > o.value ? 1 : (value < o.value ? -1 : 0); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-25 23:30:03
|
Revision: 9204 http://sourceforge.net/p/fudaa/svn/9204 Author: deniger Date: 2015-11-25 23:30:00 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableXlsxWriter.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java Added Paths: ----------- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java Removed Paths: ------------- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java Copied: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java (from rev 9201, trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java) =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java (rev 0) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableCellDoubleValue.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -0,0 +1,70 @@ +/* +GPL 2 + */ +package org.fudaa.ctulu.table; + +/** + * + * @author Frederic Deniger + */ +public class CtuluTableCellDoubleValue implements Comparable<CtuluTableCellDoubleValue> { + + private final String formattedValue; + private final double value; + + public CtuluTableCellDoubleValue(String formattedValue, double value) { + this.formattedValue = formattedValue == null ? Double.toString(value) : formattedValue; + this.value = value; + } + + public String getFormattedValue() { + return formattedValue; + } + + public double getValue() { + return value; + } + + @Override + public String toString() { + return formattedValue; + } + + + @Override + public int hashCode() { + int hash = 3; + hash = 37 * hash + (int) (Double.doubleToLongBits(this.value) ^ (Double.doubleToLongBits(this.value) >>> 32)); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CtuluTableCellDoubleValue other = (CtuluTableCellDoubleValue) obj; + if (Double.doubleToLongBits(this.value) != Double.doubleToLongBits(other.value)) { + return false; + } + return true; + } + + @Override + public int compareTo(CtuluTableCellDoubleValue o) { + if (o == null) { + return 1; + } + if (o == this) { + return 0; + } + return value > o.value ? 1 : (value < o.value ? -1 : 0); + } + +} Modified: trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableXlsxWriter.java =================================================================== --- trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableXlsxWriter.java 2015-11-25 22:57:46 UTC (rev 9203) +++ trunk/framework/ctulu-common/src/main/java/org/fudaa/ctulu/table/CtuluTableXlsxWriter.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -86,6 +86,8 @@ createCell.setCellValue(((Number) value).doubleValue()); } else if (Date.class.equals(dataClass)) { createCell.setCellValue(((Date) value)); + } else if (CtuluTableCellDoubleValue.class.equals(dataClass)) { + createCell.setCellValue(((CtuluTableCellDoubleValue) value).getValue()); } else { createCell.setCellValue(value.toString()); } Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-25 22:57:46 UTC (rev 9203) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -11,7 +11,7 @@ */ package org.fudaa.ebli.courbe; -import org.fudaa.ebli.commun.EbliDataCellDoubleValue; +import org.fudaa.ctulu.table.CtuluTableCellDoubleValue; import gnu.trove.TIntArrayList; import java.util.ArrayList; import java.util.Arrays; @@ -23,7 +23,6 @@ import jxl.write.Label; import jxl.write.Number; import jxl.write.WritableCell; -import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.ProgressionInterface; @@ -62,12 +61,12 @@ return Double.toString(yValue); } - public EbliDataCellDoubleValue getXValueFor(final double xValue) { - return new EbliDataCellDoubleValue(getStringXValueFor(xValue), xValue); + public CtuluTableCellDoubleValue getXValueFor(final double xValue) { + return new CtuluTableCellDoubleValue(getStringXValueFor(xValue), xValue); } public Object getYValueFor(final EGCourbe courbe, final double yValue) { - return new EbliDataCellDoubleValue(getStringYValueFor(courbe, yValue), yValue); + return new CtuluTableCellDoubleValue(getStringYValueFor(courbe, yValue), yValue); } final static class AllData extends EGExportData { @@ -89,7 +88,7 @@ @Override public Class getColumnClass(int _col) { boolean label = showLabel && (_col % 3 == 0); - return label ? String.class : EbliDataCellDoubleValue.class; + return label ? String.class : CtuluTableCellDoubleValue.class; } @Override @@ -167,7 +166,7 @@ @Override public Class getColumnClass(int _col) { - return EbliDataCellDoubleValue.class; + return CtuluTableCellDoubleValue.class; } @Override @@ -244,7 +243,7 @@ if (showLabel && _col == 0) { return String.class; } - return EbliDataCellDoubleValue.class; + return CtuluTableCellDoubleValue.class; } @Override @@ -350,6 +349,10 @@ final Double d = (Double) value; return new Number(_colInXls, _rowInXls, d.doubleValue()); } + if (value instanceof CtuluTableCellDoubleValue) { + final CtuluTableCellDoubleValue d = (CtuluTableCellDoubleValue) value; + return new Number(_colInXls, _rowInXls, d.getValue()); + } String asString = value.toString(); try { double d = Double.parseDouble(asString.replace(',', '.')); Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-11-25 22:57:46 UTC (rev 9203) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -11,7 +11,7 @@ */ package org.fudaa.ebli.courbe; -import org.fudaa.ebli.commun.EbliDataCellDoubleValue; +import org.fudaa.ctulu.table.CtuluTableCellDoubleValue; import org.fudaa.ebli.commun.EbliDateCellDoubleValueCellRenderer; import com.memoire.bu.BuMenu; import com.memoire.bu.BuResource; @@ -158,7 +158,7 @@ final EGMultiCourbeTableModel tableModel = new EGMultiCourbeTableModel(cs, (EGCourbe[]) courbesSelected.toArray(new EGCourbe[courbesSelected .size()]), graphe_, showLabel); final CtuluTable table = new CtuluTable(tableModel); - table.setDefaultRenderer(EbliDataCellDoubleValue.class, new EbliDateCellDoubleValueCellRenderer()); + table.setDefaultRenderer(CtuluTableCellDoubleValue.class, new EbliDateCellDoubleValueCellRenderer()); String title = null; final JInternalFrame iframe = (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class, graphe_); if (iframe == null) { Deleted: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java 2015-11-25 22:57:46 UTC (rev 9203) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -1,64 +0,0 @@ -/* -GPL 2 - */ -package org.fudaa.ebli.commun; - -/** - * - * @author Frederic Deniger - */ -public class EbliDataCellDoubleValue implements Comparable<EbliDataCellDoubleValue> { - - private final String formattedValue; - private final double value; - - public EbliDataCellDoubleValue(String formattedValue, double value) { - this.formattedValue = formattedValue; - this.value = value; - } - - public String getFormattedValue() { - return formattedValue; - } - - public double getValue() { - return value; - } - - @Override - public int hashCode() { - int hash = 3; - hash = 37 * hash + (int) (Double.doubleToLongBits(this.value) ^ (Double.doubleToLongBits(this.value) >>> 32)); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final EbliDataCellDoubleValue other = (EbliDataCellDoubleValue) obj; - if (Double.doubleToLongBits(this.value) != Double.doubleToLongBits(other.value)) { - return false; - } - return true; - } - - @Override - public int compareTo(EbliDataCellDoubleValue o) { - if (o == null) { - return 1; - } - if (o == this) { - return 0; - } - return value > o.value ? 1 : (value < o.value ? -1 : 0); - } - -} Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java 2015-11-25 22:57:46 UTC (rev 9203) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -3,6 +3,7 @@ */ package org.fudaa.ebli.commun; +import org.fudaa.ctulu.table.CtuluTableCellDoubleValue; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluCellTextRenderer; @@ -14,7 +15,9 @@ @Override protected void setValue(final Object _value) { - setText((_value == null) ? CtuluLibString.EMPTY_STRING : ((EbliDataCellDoubleValue) _value).getFormattedValue()); + setHorizontalTextPosition(RIGHT); + setHorizontalAlignment(RIGHT); + setText((_value == null) ? CtuluLibString.EMPTY_STRING : ((CtuluTableCellDoubleValue) _value).getFormattedValue()); } } Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-11-25 22:57:46 UTC (rev 9203) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-11-25 23:30:00 UTC (rev 9204) @@ -7,6 +7,7 @@ */ package org.fudaa.ebli.commun; +import org.fudaa.ctulu.table.CtuluTableCellDoubleValue; import org.fudaa.ctulu.gui.ExportTableCommentSupplier; import java.awt.Component; import java.awt.event.ActionListener; @@ -39,6 +40,7 @@ import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.gui.CtuluCellTextDecimalRenderer; +import org.fudaa.ctulu.gui.CtuluCellTextRenderer; import org.fudaa.ctulu.gui.CtuluDialogPreferences; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.gui.CtuluTableExportPanel; @@ -194,6 +196,7 @@ final int nb = init.getColumnCount(); // TODO a continuer EbliDateCellDoubleValueCellRenderer doubleValueRenderer = new EbliDateCellDoubleValueCellRenderer(); + CtuluCellTextRenderer textRenderer = new CtuluCellTextRenderer(); for (int i = 0; i < nb; i++) { TableColumn column = init.getColumn(i); int modelIdx = column.getModelIndex(); @@ -208,9 +211,10 @@ renderer.setFormatter(_defs[2].getFormatter().getXYFormatter()); } column.setCellRenderer(renderer); - } else if (columnClass.equals(EbliDataCellDoubleValue.class)) { + } else if (columnClass.equals(CtuluTableCellDoubleValue.class)) { column.setCellRenderer(doubleValueRenderer); - + } else if (columnClass.equals(String.class)) { + column.setCellRenderer(textRenderer); } colModel_.addColumn(column); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-25 22:57:49
|
Revision: 9203 http://sourceforge.net/p/fudaa/svn/9203 Author: deniger Date: 2015-11-25 22:57:46 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/longitudinal/ReportLongitudinalConfig.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/ReportLongitudinalTimeChooser.java trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties Modified: trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/longitudinal/ReportLongitudinalConfig.java =================================================================== --- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/longitudinal/ReportLongitudinalConfig.java 2015-11-25 22:19:43 UTC (rev 9202) +++ trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/longitudinal/ReportLongitudinalConfig.java 2015-11-25 22:57:46 UTC (rev 9203) @@ -65,6 +65,9 @@ @XStreamAlias("Vue-Config") ViewCourbeConfig loiLegendConfig = new ViewCourbeConfig(); + @XStreamAlias("Temps-courant-affiche") + Boolean currentTimeDisplayed = Boolean.TRUE; + @Override public ViewCourbeConfig getLoiLegendConfig() { return loiLegendConfig; @@ -74,7 +77,6 @@ return courbeconfigs; } - @Override protected void cleanUnusedCourbesConfig(Set<ReportKeyContract> usedKeys) { for (Iterator<ReportRunVariableTimeKey> it = courbeconfigs.keySet().iterator(); it.hasNext();) { @@ -97,6 +99,15 @@ return modified; } + public Boolean getCurrentTimeDisplayed() { + return currentTimeDisplayed == null ? Boolean.TRUE : currentTimeDisplayed; + } + + public void setCurrentTimeDisplayed(Boolean currentTimeDisplayed) { + this.currentTimeDisplayed = currentTimeDisplayed; + } + + public List<ResultatTimeKey> getTimes() { return times; } @@ -139,6 +150,9 @@ if (times == null) { times = new ArrayList<ResultatTimeKey>(); } + if (currentTimeDisplayed == null) { + currentTimeDisplayed = Boolean.TRUE; + } if (courbeconfigs == null) { courbeconfigs = new HashMap<ReportRunVariableTimeKey, EGCourbePersist>(); } @@ -171,7 +185,8 @@ for (ReportRunVariableKey vKey : profilVariables) { //pour eviter les limites -> vKey.isReadVariable() //uniquement Qini pour les RESULTAT_RPTI sur l'axe de droite - if (vKey.getVariableName().equals(CrueConfigMetierConstants.QINI) || (vKey.isReadOrVariable() && ReportRunVariableHelper.isNotAZNOrDzNature(vKey.getVariable(), service))) { + if (vKey.getVariableName().equals(CrueConfigMetierConstants.QINI) || (vKey.isReadOrVariable() && ReportRunVariableHelper.isNotAZNOrDzNature( + vKey.getVariable(), service))) { return vKey.getVariable().getVariableName(); } } @@ -182,7 +197,8 @@ for (Iterator<ReportRunVariableKey> it = profilVariables.iterator(); it.hasNext();) { ReportRunVariableKey vKey = it.next(); //pour eviter les limites -> vKey.isReadVariable() - if (vKey.getVariableName().equals(CrueConfigMetierConstants.QINI) || (vKey.isReadOrVariable() && ReportRunVariableHelper.isNotAZNOrDzNature(vKey.getVariable(), service))) { + if (vKey.getVariableName().equals(CrueConfigMetierConstants.QINI) || (vKey.isReadOrVariable() && ReportRunVariableHelper.isNotAZNOrDzNature( + vKey.getVariable(), service))) { it.remove(); } } 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 2015-11-25 22:19:43 UTC (rev 9202) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilder.java 2015-11-25 22:57:46 UTC (rev 9203) @@ -129,12 +129,15 @@ } private List<EGCourbeSimple> createCourbesOnCurrentTimeStep(ReportLongitudinalConfig content, ProgressHandle progress) { + if (Boolean.FALSE.equals(content.getCurrentTimeDisplayed())) { + return Collections.emptyList(); + } ReportLongitudinalGrapheBuilderCourbe courbeBuilder = new ReportLongitudinalGrapheBuilderCourbe(reportService.getCcm(), this, content); if (result == null) { return Collections.emptyList(); } List<ReportRunVariableKey> var = content.getProfilVariables(); - List<EGCourbeSimple> courbes = new ArrayList<EGCourbeSimple>(); + List<EGCourbeSimple> courbes = new ArrayList<>(); ResultatTimeKey selectedTime = reportService.getSelectedTime(); if (selectedTime != null) { for (ReportRunVariableKey reportRunVariableKey : var) { Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java 2015-11-25 22:19:43 UTC (rev 9202) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java 2015-11-25 22:57:46 UTC (rev 9203) @@ -9,7 +9,9 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; +import javax.swing.BorderFactory; import javax.swing.JCheckBox; +import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.fudaa.dodico.crue.common.transformer.ToStringTransformer; @@ -48,7 +50,7 @@ list.addCheckBoxListSelectedIndex(i); } } - JPanel pn = new JPanel(new BorderLayout(0, 5)); + JPanel pnCenter = new JPanel(new BorderLayout(0, 5)); final JCheckBox selectAll = new JCheckBox(NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.SelectAllNone")); selectAll.addItemListener(new ItemListener() { @@ -62,13 +64,29 @@ } } }); - pn.add(new JScrollPane(list)); - pn.add(selectAll, BorderLayout.NORTH); + pnCenter.add(new JScrollPane(list)); + pnCenter.add(selectAll, BorderLayout.NORTH); + pnCenter.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 3)); + JPanel pn = new JPanel(new BorderLayout(0, 5)); + JComboBox currentTimeDisplayed = new JComboBox(new String[]{ + org.openide.util.NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.DisplayCurrentTime"), + org.openide.util.NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.NotDisplayCurrentTime") + + }); + currentTimeDisplayed.setSelectedIndex(0); + if (Boolean.FALSE.equals(config.getCurrentTimeDisplayed())) { + currentTimeDisplayed.setSelectedIndex(1); + + } + pn.add(currentTimeDisplayed, BorderLayout.NORTH); + pn.add(pnCenter); + String title = org.openide.util.NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.DialogTitle"); boolean ok = DialogHelper.showQuestionAndSaveDialogConf(title, pn, getClass(), "vueProfilLongitudinal_ConfigurationPasDeTemps", PerspectiveEnum.REPORT, true); if (ok) { config.getTimes().clear(); + config.setCurrentTimeDisplayed(currentTimeDisplayed.getSelectedIndex() == 0); final Object[] selectedValues = list.getCheckBoxListSelectedValues(); for (Object object : selectedValues) { config.getTimes().add((ResultatTimeKey) object); Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties 2015-11-25 22:19:43 UTC (rev 9202) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties 2015-11-25 22:57:46 UTC (rev 9203) @@ -35,3 +35,5 @@ BrancheSectionColumn.Name=Branche / Section SectionColumn.Name=Section BrancheColumn.Name=Branche +ChooseTime.DisplayCurrentTime=Afficher au pas de temps courant +ChooseTime.NotDisplayCurrentTime=Ne pas afficher au pas de temps courant This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-25 22:19:46
|
Revision: 9202 http://sourceforge.net/p/fudaa/svn/9202 Author: deniger Date: 2015-11-25 22:19:43 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java Added Paths: ----------- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 2015-11-25 22:19:36 UTC (rev 9201) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 2015-11-25 22:19:43 UTC (rev 9202) @@ -18,45 +18,46 @@ * * @author Frederic Deniger */ -public class ReportLongitudinalCourbesUiResController extends CourbesUiResController { - +public final class ReportLongitudinalCourbesUiResController extends CourbesUiResController { + public ReportLongitudinalCourbesUiResController() { EGTableAction tableAction = (EGTableAction) getActions("TABLE").get(0); tableAction.setAddOptions(false); - tableAction.setAddCheckbox(true); + tableAction.setAddCheckbox(false); tableAction.setShowColumnToExport(false); tableAction.setDisplayAll(true); tableAction.setShowLabel(true); setUseVariableForAxeH(true); + getGraphe().setExportDataBuilder(new ReportLongitudinalExportDataBuilder()); } - + @Override protected AbstractTableModel createTableModel() { return new ReportLongitudinalTableModel(getTableGraphePanel()); } - + @Override protected void configureTablePanel() { super.configureTablePanel(); tableGraphePanel.getTable().getColumnModel().getColumn(0).setCellRenderer(new CtuluCellTextRenderer()); } - + protected static class ReportLongitudinalTableModel extends EGTableGraphePanel.SpecTableModel { - + public static final int COLUMN_BRANCHE = 0; public static final int COLUMN_SECTION = 1; - + public ReportLongitudinalTableModel(EGTableGraphePanel graphePanel) { super(graphePanel); xColIndex = 2; yColIndex = 3; } - + @Override public int getColumnCount() { return 4; } - + @Override public Object getValueAt(int _rowIndex, int _columnIndex) { if (_columnIndex == COLUMN_SECTION || _columnIndex == COLUMN_BRANCHE) { @@ -74,7 +75,7 @@ } return super.getValueAt(_rowIndex, _columnIndex); } - + @Override public String getColumnName(int _column) { if (_column == COLUMN_SECTION) { @@ -85,7 +86,7 @@ } return super.getColumnName(_column); } - + @Override public Class getColumnClass(int _columnIndex) { if (_columnIndex <= COLUMN_SECTION) { @@ -93,7 +94,7 @@ } return Double.class; } - + @Override public void setValueAt(Object _value, int _rowIndex, int _columnIndex) { } Added: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java (rev 0) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalExportDataBuilder.java 2015-11-25 22:19:43 UTC (rev 9202) @@ -0,0 +1,123 @@ +/* +GPL 2 + */ +package org.fudaa.fudaa.crue.report.longitudinal; + +import gnu.trove.TIntObjectHashMap; +import java.awt.color.ColorSpace; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.fudaa.dodico.crue.metier.factory.CruePrefix; +import org.fudaa.ebli.courbe.EGAxeHorizontal; +import org.fudaa.ebli.courbe.EGCourbe; +import org.fudaa.ebli.courbe.EGExportData; +import org.fudaa.ebli.courbe.EGExportDataBuilder; +import org.fudaa.ebli.commun.EbliDataCellDoubleValue; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.courbe.EGModel; +import org.fudaa.ebli.courbe.EGTimeLabel; +import org.fudaa.ebli.courbe.EgModelLabelNamed; +import org.fudaa.fudaa.crue.loi.common.LoiConstanteCourbeModel; +import org.openide.util.NbBundle; + +/** + * + * @author Frederic Deniger + */ +public class ReportLongitudinalExportDataBuilder implements EGExportDataBuilder { + + @Override + public EGExportData createExportData(EGCourbe[] courbesInitiales, EGGraphe _g, boolean _isSameH, boolean showLabel) { + return new LongitudinalExportData(EGExportData.prepareCourbesForExport(courbesInitiales), _g, showLabel); + } + + private static class LongitudinalExportData extends EGExportData { + + protected static final int COLUMN_X = 2; + protected static final int COLUMN_SECTION = 1; + protected static final int COLUMN_BRANCHE = 0; + + private double[] time_; + private List<String> branches; + private List<String> sections; + + LongitudinalExportData(final EGCourbe[] _cs, final EGGraphe _g, boolean showLabel) { + super(_cs, _g, showLabel); + //nombre de courbe + branche+ section + x + if (cs_.length > 0) { + maxCol_ = cs_.length + 3; + Set<EGTimeLabel> set = new HashSet<>(); + final EGAxeHorizontal h = g_.getTransformer().getXAxe(); + for (int i = cs_.length - 1; i >= 0; i--) { + final EGCourbe c = cs_[i]; + final LoiConstanteCourbeModel model = (LoiConstanteCourbeModel) c.getModel(); + final TIntObjectHashMap<String> subLabelsBranches = model.getSubLabels(CruePrefix.P_BRANCHE); + final TIntObjectHashMap<String> subLabelsSection = model.getSubLabels(CruePrefix.P_SECTION); + for (int j = model.getNbValues() - 1; j >= 0; j--) { + final double x = model.getX(j); + EGTimeLabel value = new EGTimeLabel(x); + set.add(value); + value.setLabel(subLabelsBranches.get(j)); + value.setSubLabel(subLabelsSection.get(j)); + } + } + List<EGTimeLabel> values = new ArrayList<>(set); + Collections.sort(values); + time_ = new double[values.size()]; + for (int i = 0; i < time_.length; i++) { + time_[i] = values.get(i).getX(); + } + Arrays.sort(time_); + maxLine_ = time_.length; + column_ = new String[maxCol_]; + column_[COLUMN_BRANCHE] = NbBundle.getMessage(ReportLongitudinalExportDataBuilder.class, "BrancheColumn.Name"); + column_[COLUMN_SECTION] = NbBundle.getMessage(ReportLongitudinalExportDataBuilder.class, "SectionColumn.Name"); + column_[COLUMN_X] = h.getTitre(); + branches = new ArrayList<>(); + sections = new ArrayList<>(); + for (EGTimeLabel value : values) { + branches.add(value.getLabel()); + sections.add(value.getSubLabel()); + } + int offset = 3; + for (int i = 0; i < _cs.length; i++) { + column_[i + offset] = _cs[i].getTitle(); + } + } + } + + @Override + public Class getColumnClass(int _i) { + if (_i == COLUMN_BRANCHE || _i == COLUMN_SECTION) { + return String.class; + } + return EbliDataCellDoubleValue.class; + } + + @Override + public Object getValue(int _row, int _col) { + if (_col == COLUMN_BRANCHE) { + return branches.get(_row); + } + if (_col == COLUMN_SECTION) { + return sections.get(_row); + } + final double x = time_[_row]; + if (_col == COLUMN_X) { + return getXValueFor(x); + } + if (cs_.length > 0) { + EGCourbe c = cs_[_col - 3]; + return getYValueFor(c, c.interpol(x)); + } + return StringUtils.EMPTY; + } + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-25 22:19:39
|
Revision: 9201 http://sourceforge.net/p/fudaa/svn/9201 Author: deniger Date: 2015-11-25 22:19:36 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java Added Paths: ----------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportDataBuilder.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-25 22:18:53 UTC (rev 9200) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -11,6 +11,7 @@ */ package org.fudaa.ebli.courbe; +import org.fudaa.ebli.commun.EbliDataCellDoubleValue; import gnu.trove.TIntArrayList; import java.util.ArrayList; import java.util.Arrays; @@ -41,26 +42,34 @@ return showLabel; } - public Object getXValueFor(final double xValue) { + public String getStringXValueFor(final double xValue) { if (g_.getModel().getAxeX().getSpecificFormatExport() != null) { return g_.getModel().getAxeX().getSpecificFormatExport().format(xValue); } if (g_.getModel().getAxeX().getSpecificFormat() != null) { return g_.getModel().getAxeX().getSpecificFormat().format(xValue); } - return CtuluLib.getDouble(xValue); + return Double.toString(xValue); } - public Object getYValueFor(final EGCourbe courbe, final double yValue) { + public String getStringYValueFor(final EGCourbe courbe, final double yValue) { if (courbe.getAxeY() != null && courbe.getAxeY().getSpecificFormatExport() != null) { return courbe.getAxeY().getSpecificFormatExport().format(yValue); } if (courbe.getAxeY() != null && courbe.getAxeY().getSpecificFormat() != null) { return courbe.getAxeY().getSpecificFormat().format(yValue); } - return CtuluLib.getDouble(yValue); + return Double.toString(yValue); } + public EbliDataCellDoubleValue getXValueFor(final double xValue) { + return new EbliDataCellDoubleValue(getStringXValueFor(xValue), xValue); + } + + public Object getYValueFor(final EGCourbe courbe, final double yValue) { + return new EbliDataCellDoubleValue(getStringYValueFor(courbe, yValue), yValue); + } + final static class AllData extends EGExportData { AllData(final EGCourbe[] _cs, final EGGraphe _g, boolean showLabel) { @@ -78,6 +87,12 @@ } @Override + public Class getColumnClass(int _col) { + boolean label = showLabel && (_col % 3 == 0); + return label ? String.class : EbliDataCellDoubleValue.class; + } + + @Override public Object getValue(final int _row, final int _col) { boolean label = showLabel && (_col % 3 == 0); final boolean x = showLabel ? (_col % 3 == 1) : (_col % 2 == 0); @@ -151,6 +166,11 @@ } @Override + public Class getColumnClass(int _col) { + return EbliDataCellDoubleValue.class; + } + + @Override public Object getValue(final int _row, final int _col) { final boolean x = (_col % 2 == 0); final int courbeIdx = x ? _col / 2 : (_col - 1) / 2; @@ -196,11 +216,11 @@ } Arrays.sort(time_); maxLine_ = time_.length; - int nbCols = _cs.length + 1; +// int nbCols = _cs.length + 1; if (showLabels) { - nbCols++; + maxCol_++; } - column_ = new String[nbCols]; + column_ = new String[maxCol_]; int offset = 0; if (showLabels) { offset = 1; @@ -220,6 +240,14 @@ } @Override + public Class getColumnClass(int _col) { + if (showLabel && _col == 0) { + return String.class; + } + return EbliDataCellDoubleValue.class; + } + + @Override public Object getValue(final int _row, final int _col) { final double x = time_[_row]; int offset = 0; @@ -242,9 +270,27 @@ public static EGExportData createExportData(final EGCourbe[] courbesInitiales, final EGGraphe _g, final boolean _isSameH, final boolean _onlyHiewed, boolean showLabel, final ProgressionInterface _prog) { + final EGExportDataBuilder exportDataBuilder = _g.getExportDataBuilder(); + if (exportDataBuilder != null) { + return exportDataBuilder.createExportData(courbesInitiales, _g, _isSameH, showLabel); + } + EGCourbe[] _cs = prepareCourbesForExport(courbesInitiales); + if (_isSameH) { + return new SameH(_cs, _g, _onlyHiewed, showLabel); + } else if (_onlyHiewed) { + return new HViewedOnly(_cs, _g, showLabel); + } + return new AllData(_cs, _g, showLabel); + + } + + public static EGCourbe[] prepareCourbesForExport(final EGCourbe[] courbesInitiales) { List<EGCourbe> courbes = new ArrayList<EGCourbe>(); for (int i = 0; i < courbesInitiales.length; i++) { EGCourbe egCourbe = courbesInitiales[i]; + if (!egCourbe.isVisible()) { + continue; + } Collection<EGCourbe> associatesCourbesForExport = egCourbe.getAssociatesCourbesForExport(); if (CtuluLibArray.isNotEmpty(associatesCourbesForExport)) { courbes.addAll(associatesCourbesForExport); @@ -252,21 +298,15 @@ courbes.add(egCourbe); } EGCourbe[] _cs = (EGCourbe[]) courbes.toArray(new EGCourbe[courbes.size()]); - if (_isSameH) { - return new SameH(_cs, _g, _onlyHiewed, showLabel); - } else if (_onlyHiewed) { - return new HViewedOnly(_cs, _g, showLabel); - } - return new AllData(_cs, _g, showLabel); - + return _cs; } - String[] column_; - EGCourbe[] cs_; - EGGraphe g_; - int maxCol_; - int maxLine_; + protected String[] column_; + protected EGCourbe[] cs_; + protected EGGraphe g_; + protected int maxCol_; + protected int maxLine_; - EGExportData(final EGCourbe[] _cs, final EGGraphe _g, boolean showLabel) { + protected EGExportData(final EGCourbe[] _cs, final EGGraphe _g, boolean showLabel) { cs_ = _cs; this.showLabel = showLabel; g_ = _g; @@ -294,6 +334,8 @@ return column_[_i]; } + public abstract Class getColumnClass(final int _i); + public EGCourbe getCourbe(final int _idx) { return cs_[_idx]; } Added: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportDataBuilder.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportDataBuilder.java (rev 0) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportDataBuilder.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -0,0 +1,24 @@ +/* +GPL 2 + */ +package org.fudaa.ebli.courbe; + +/** + * Une factory pour customiser les exports de donn\xE9es d'un graphe. + * + * @author Frederic Deniger + */ +public interface EGExportDataBuilder { + + /** + * + * @param courbesInitiales les courbes initiales sans pr\xE9traitement. Utiliser \xE9ventuellement + * org.fudaa.ebli.courbe.EGExportData.prepareCourbesForExport(EGCourbe[]) pour filtrer les courbes ( visible et ajouter les courbes li\xE9es) + * @param _g + * @param _isSameH + * @param showLabel + * @return + */ + EGExportData createExportData(final EGCourbe[] courbesInitiales, final EGGraphe _g, final boolean _isSameH, boolean showLabel); + +} Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2015-11-25 22:18:53 UTC (rev 9200) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGGraphe.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -93,6 +93,7 @@ protected CtuluRange xRange_; EGHorizontalBanner horizontalBanner; private ExportTableCommentSupplier exportTableCommentSupplier; + private EGExportDataBuilder exportDataBuilder; public EGGraphe(final EGGrapheModel _m) { addComponentListener(this); @@ -110,6 +111,15 @@ initTitlesOrigins(); } + public EGExportDataBuilder getExportDataBuilder() { + return exportDataBuilder; + } + + public void setExportDataBuilder(EGExportDataBuilder exportDataBuilder) { + this.exportDataBuilder = exportDataBuilder; + } + + public void setExportTableCommentSupplier(ExportTableCommentSupplier exportTableCommentSupplier) { this.exportTableCommentSupplier = exportTableCommentSupplier; } Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java 2015-11-25 22:18:53 UTC (rev 9200) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGMultiCourbeTableModel.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -78,7 +78,7 @@ @Override public Class getColumnClass(final int _columnIndex) { - return Double.class; + return current_.getColumnClass(_columnIndex); } @Override Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-11-25 22:18:53 UTC (rev 9200) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTableAction.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -11,6 +11,8 @@ */ package org.fudaa.ebli.courbe; +import org.fudaa.ebli.commun.EbliDataCellDoubleValue; +import org.fudaa.ebli.commun.EbliDateCellDoubleValueCellRenderer; import com.memoire.bu.BuMenu; import com.memoire.bu.BuResource; import com.memoire.bu.BuTable; @@ -156,6 +158,7 @@ final EGMultiCourbeTableModel tableModel = new EGMultiCourbeTableModel(cs, (EGCourbe[]) courbesSelected.toArray(new EGCourbe[courbesSelected .size()]), graphe_, showLabel); final CtuluTable table = new CtuluTable(tableModel); + table.setDefaultRenderer(EbliDataCellDoubleValue.class, new EbliDateCellDoubleValueCellRenderer()); String title = null; final JInternalFrame iframe = (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class, graphe_); if (iframe == null) { Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java 2015-11-25 22:18:53 UTC (rev 9200) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGTimeLabel.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -11,6 +11,7 @@ private final double x; private String label; + private String subLabel; public EGTimeLabel(double x) { this.x = x; @@ -24,7 +25,14 @@ return x; } + public String getSubLabel() { + return subLabel; + } + public void setSubLabel(String subLabel) { + this.subLabel = subLabel; + } + public void setLabel(String label) { this.label = label; } Added: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java (rev 0) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDataCellDoubleValue.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -0,0 +1,64 @@ +/* +GPL 2 + */ +package org.fudaa.ebli.commun; + +/** + * + * @author Frederic Deniger + */ +public class EbliDataCellDoubleValue implements Comparable<EbliDataCellDoubleValue> { + + private final String formattedValue; + private final double value; + + public EbliDataCellDoubleValue(String formattedValue, double value) { + this.formattedValue = formattedValue; + this.value = value; + } + + public String getFormattedValue() { + return formattedValue; + } + + public double getValue() { + return value; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 37 * hash + (int) (Double.doubleToLongBits(this.value) ^ (Double.doubleToLongBits(this.value) >>> 32)); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final EbliDataCellDoubleValue other = (EbliDataCellDoubleValue) obj; + if (Double.doubleToLongBits(this.value) != Double.doubleToLongBits(other.value)) { + return false; + } + return true; + } + + @Override + public int compareTo(EbliDataCellDoubleValue o) { + if (o == null) { + return 1; + } + if (o == this) { + return 0; + } + return value > o.value ? 1 : (value < o.value ? -1 : 0); + } + +} Added: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java (rev 0) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliDateCellDoubleValueCellRenderer.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -0,0 +1,20 @@ +/* +GPL 2 + */ +package org.fudaa.ebli.commun; + +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.gui.CtuluCellTextRenderer; + +/** + * + * @author Frederic Deniger + */ +public class EbliDateCellDoubleValueCellRenderer extends CtuluCellTextRenderer { + + @Override + protected void setValue(final Object _value) { + setText((_value == null) ? CtuluLibString.EMPTY_STRING : ((EbliDataCellDoubleValue) _value).getFormattedValue()); + } + +} Modified: trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java =================================================================== --- trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-11-25 22:18:53 UTC (rev 9200) +++ trunk/framework/ebli-common/src/main/java/org/fudaa/ebli/commun/EbliTableInfoPanel.java 2015-11-25 22:19:36 UTC (rev 9201) @@ -118,7 +118,6 @@ return res == null ? true : res.booleanValue(); } - /** * Enregistre le titre dans les propriete (putClientProperty) de la table. * @@ -151,7 +150,6 @@ _b.putClientProperty("TABLE_SHOW_SELECTED_ROW", Boolean.valueOf(_show)); } - final TableColumnModel colModel_; JDialog dialog_; boolean displaySelected_; @@ -195,11 +193,12 @@ final TableColumnModel init = table_.getColumnModel(); final int nb = init.getColumnCount(); // TODO a continuer - + EbliDateCellDoubleValueCellRenderer doubleValueRenderer = new EbliDateCellDoubleValueCellRenderer(); for (int i = 0; i < nb; i++) { TableColumn column = init.getColumn(i); int modelIdx = column.getModelIndex(); - if (table_.getModel().getColumnClass(modelIdx).equals(Double.class)) { + final Class<?> columnClass = table_.getModel().getColumnClass(modelIdx); + if (columnClass.equals(Double.class)) { CtuluCellTextDecimalRenderer renderer = new CtuluCellTextDecimalRenderer(); if (_defs[0].getName().equalsIgnoreCase(table_.getModel().getColumnName(modelIdx))) { renderer.setFormatter(_defs[0].getFormatter().getXYFormatter()); @@ -209,6 +208,9 @@ renderer.setFormatter(_defs[2].getFormatter().getXYFormatter()); } column.setCellRenderer(renderer); + } else if (columnClass.equals(EbliDataCellDoubleValue.class)) { + column.setCellRenderer(doubleValueRenderer); + } colModel_.addColumn(column); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-25 22:18:55
|
Revision: 9200 http://sourceforge.net/p/fudaa/svn/9200 Author: deniger Date: 2015-11-25 22:18:53 +0000 (Wed, 25 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableSortModel.java Modified: trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableSortModel.java =================================================================== --- trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableSortModel.java 2015-11-24 23:15:48 UTC (rev 9199) +++ trunk/framework/ctulu-bu/src/main/java/com/memoire/bu/BuTableSortModel.java 2015-11-25 22:18:53 UTC (rev 9200) @@ -1,4 +1,3 @@ - package com.memoire.bu; import java.awt.Point; @@ -15,158 +14,168 @@ import com.memoire.fu.FuSortint; public class BuTableSortModel - extends BuTableDelegateModel - implements FuEmptyArrays, FuSortint.Comparator -{ - protected int[] indexes; - protected int nbcols_; - protected int[] columns_; + extends BuTableDelegateModel + implements FuEmptyArrays, FuSortint.Comparator { + + protected int[] indexes; + protected int nbcols_; + protected int[] columns_; protected boolean[] descending_; - protected int compares; + protected int compares; - public BuTableSortModel() - { - indexes =INT0; - nbcols_ =0; - columns_ =new int[3]; - descending_=new boolean[3]; + public BuTableSortModel() { + indexes = INT0; + nbcols_ = 0; + columns_ = new int[3]; + descending_ = new boolean[3]; } - public BuTableSortModel(TableModel _model) - { + public BuTableSortModel(TableModel _model) { this(); setModel(_model); } - public void setModel(TableModel _model) - { - super.setModel(_model); - reallocateIndexes(); + public void setModel(TableModel _model) { + super.setModel(_model); + reallocateIndexes(); } - protected int compareRowsByColumn(int _row1,int _row2,int _col) - { - Object o1=model_.getValueAt(_row1,_col); - Object o2=model_.getValueAt(_row2,_col); - - if((o1==null)&&(o2==null)) return 0; - else if(o1==null) return -1; - else if(o2==null) return 1; + protected int compareRowsByColumn(int _row1, int _row2, int _col) { + Object o1 = model_.getValueAt(_row1, _col); + Object o2 = model_.getValueAt(_row2, _col); - if((o1 instanceof Number)&&(o2 instanceof Number)) - { - double d1=((Number)o1).doubleValue(); - double d2=((Number)o2).doubleValue(); + if ((o1 == null) && (o2 == null)) { + return 0; + } else if (o1 == null) { + return -1; + } else if (o2 == null) { + return 1; + } - if(d1<d2) return -1; - else if(d1>d2) return 1; - else return 0; + if ((o1 instanceof Number) && (o2 instanceof Number)) { + double d1 = ((Number) o1).doubleValue(); + double d2 = ((Number) o2).doubleValue(); + + if (d1 < d2) { + return -1; + } else if (d1 > d2) { + return 1; + } else { + return 0; + } + } else if ((o1 instanceof Comparable) && (o2 instanceof Comparable) && o1.getClass().isInstance(o2)) { + return ((Comparable) o1).compareTo(o2); + + } else if ((o1 instanceof Date) && (o2 instanceof Date)) { + long n1 = ((Date) o1).getTime(); + long n2 = ((Date) o2).getTime(); + + if (n1 < n2) { + return -1; + } else if (n1 > n2) { + return 1; + } else { + return 0; + } + } else if ((o1 instanceof Boolean) && (o2 instanceof Boolean)) { + boolean b1 = ((Boolean) o1).booleanValue(); + boolean b2 = ((Boolean) o2).booleanValue(); + + if (b1 == b2) { + return 0; + } else if (b1) { + return 1; + } else { + return -1; + } + } else { + String s1 = o1.toString(); + String s2 = o2.toString(); + + int result = s1.compareTo(s2); + if (result < 0) { + return -1; + } else if (result > 0) { + return 1; + } else { + return 0; + } } - else - if((o1 instanceof Date)&&(o2 instanceof Date)) - { - long n1=((Date)o1).getTime(); - long n2=((Date)o2).getTime(); - - if(n1<n2) return -1; - else if(n1>n2) return 1; - else return 0; - } - else - if((o1 instanceof Boolean)&&(o2 instanceof Boolean)) - { - boolean b1=((Boolean)o1).booleanValue(); - boolean b2=((Boolean)o2).booleanValue(); - - if(b1==b2) return 0; - else if(b1) return 1; - else return -1; - } - else - { - String s1=o1.toString(); - String s2=o2.toString(); - - int result=s1.compareTo(s2); - if(result<0) return -1; - else if(result>0) return 1; - else return 0; - } } - public int compare(int _row1,int _row2) - { + public int compare(int _row1, int _row2) { compares++; - int nc=model_.getRowCount(); + int nc = model_.getRowCount(); - for(int i=0;i<nbcols_;i++) - //for(int i=nbcols_-1;i>=0;i--) + for (int i = 0; i < nbcols_; i++) //for(int i=nbcols_-1;i>=0;i--) { - int c=columns_[i]; - if((c<0)||(c>=nc)) continue; + int c = columns_[i]; + if ((c < 0) || (c >= nc)) { + continue; + } - int s=compareRowsByColumn(_row1,_row2,c); - if(descending_[i]) s=-s; - if(s!=0) return s; + int s = compareRowsByColumn(_row1, _row2, c); + if (descending_[i]) { + s = -s; + } + if (s != 0) { + return s; + } } return 0; } - protected void reallocateIndexes() - { - int n=model_.getRowCount(); + protected void reallocateIndexes() { + int n = model_.getRowCount(); indexes = new int[n]; - for(int i=0;i<n;i++) indexes[i]=i; + for (int i = 0; i < n; i++) { + indexes[i] = i; + } } private boolean sortOnUpdate_; - - public boolean isSortOnUpdate() - { + + public boolean isSortOnUpdate() { return sortOnUpdate_; } - public void setSortOnUpdate(boolean _sortOnUpdate) - { - sortOnUpdate_=_sortOnUpdate; + public void setSortOnUpdate(boolean _sortOnUpdate) { + sortOnUpdate_ = _sortOnUpdate; } - public void tableChanged(TableModelEvent _evt) - { + public void tableChanged(TableModelEvent _evt) { //System.out.println("Sorter: tableChanged"); - int type =_evt.getType(); - int firstrow=_evt.getFirstRow(); - int lastrow =_evt.getLastRow(); + int type = _evt.getType(); + int firstrow = _evt.getFirstRow(); + int lastrow = _evt.getLastRow(); - if(isSortOnUpdate()||(type!=TableModelEvent.UPDATE)) + if (isSortOnUpdate() || (type != TableModelEvent.UPDATE)) { reallocateIndexes(); + } - if(_evt.getSource()==model_) - { - firstrow=getReverseRowIndex(firstrow); - lastrow =getReverseRowIndex(lastrow ); + if (_evt.getSource() == model_) { + firstrow = getReverseRowIndex(firstrow); + lastrow = getReverseRowIndex(lastrow); } - TableModelEvent e=new TableModelEvent - (this,firstrow,lastrow,_evt.getColumn(),type); + TableModelEvent e = new TableModelEvent(this, firstrow, lastrow, _evt.getColumn(), type); super.tableChanged(e); } - public void checkModel() - { - if(indexes.length!=model_.getRowCount()) + public void checkModel() { + if (indexes.length != model_.getRowCount()) { System.err.println("BTS: sorter not informed of a change in model"); + } } - private void sort() - { + private void sort() { checkModel(); - compares=0; + compares = 0; //n2sort(); - FuSortint.sort(indexes,this); + FuSortint.sort(indexes, this); //qsort(0, indexes.length-1); //shuttlesort((int[])indexes.clone(), indexes, 0, indexes.length); //System.out.println("Compares: "+compares); @@ -181,7 +190,7 @@ swap(i,j); }*/ - /* + /* private void shuttlesort(int from[], int to[], int low, int high) { if (high - low < 2) { @@ -210,198 +219,197 @@ } } } - */ - - /*private void swap(int i, int j) + */ + /*private void swap(int i, int j) { int tmp=indexes[i]; indexes[i]=indexes[j]; indexes[j]=tmp; }*/ - - public int getRowIndex(int _row) - { + public int getRowIndex(int _row) { checkModel(); return indexes[_row]; } - private int getReverseRowIndex(int _row) - { + private int getReverseRowIndex(int _row) { checkModel(); - int l=indexes.length; - if((_row<0)||(_row>=l)) return _row; - if(indexes[_row]==_row) return _row; - for(int i=0;i<l;i++) - if(_row==indexes[i]) return i; + int l = indexes.length; + if ((_row < 0) || (_row >= l)) { + return _row; + } + if (indexes[_row] == _row) { + return _row; + } + for (int i = 0; i < l; i++) { + if (_row == indexes[i]) { + return i; + } + } System.err.println("BTS: reverse index not found"); return -1; } - public Object getValueAt(int _row, int _column) - { + public Object getValueAt(int _row, int _column) { checkModel(); - return model_.getValueAt(indexes[_row],_column); + return model_.getValueAt(indexes[_row], _column); } - public void setValueAt(Object _value, int _row, int _column) - { + public void setValueAt(Object _value, int _row, int _column) { checkModel(); - model_.setValueAt(_value,indexes[_row],_column); + model_.setValueAt(_value, indexes[_row], _column); //fireTableCellUpdate(_row,_column); } - public void setSortingColumn(int _column) - { - setSortingColumn(_column,true); + public void setSortingColumn(int _column) { + setSortingColumn(_column, true); } - public void setSortingColumn(int _column,boolean _ascending) - { - columns_ [0]=_column; - descending_[0]=!_ascending; - nbcols_ =1; + public void setSortingColumn(int _column, boolean _ascending) { + columns_[0] = _column; + descending_[0] = !_ascending; + nbcols_ = 1; sort(); - super.tableChanged(new TableModelEvent(this)); + super.tableChanged(new TableModelEvent(this)); } - public void addSortingColumn(int _column,boolean _ascending) - { - int l=columns_.length; - if(nbcols_==l) - { - int[] columns=new int[l+3]; - System.arraycopy(columns_,0,columns,0,l); - columns_=columns; - boolean[] descending=new boolean[l+3]; - System.arraycopy(descending_,0,descending,0,l); - descending_=descending; + public void addSortingColumn(int _column, boolean _ascending) { + int l = columns_.length; + if (nbcols_ == l) { + int[] columns = new int[l + 3]; + System.arraycopy(columns_, 0, columns, 0, l); + columns_ = columns; + boolean[] descending = new boolean[l + 3]; + System.arraycopy(descending_, 0, descending, 0, l); + descending_ = descending; } - columns_ [nbcols_]=_column; - descending_[nbcols_]=!_ascending; + columns_[nbcols_] = _column; + descending_[nbcols_] = !_ascending; nbcols_++; sort(); - super.tableChanged(new TableModelEvent(this)); + super.tableChanged(new TableModelEvent(this)); } - public void removeSortingColumn(int _col) - { - for(int i=0;i<nbcols_;i++) - if(columns_[i]==_col) - { - if(i+1<nbcols_) - { - System.arraycopy(columns_ ,i+1,columns_ ,i,nbcols_-i); - System.arraycopy(descending_,i+1,descending_,i,nbcols_-i); + public void removeSortingColumn(int _col) { + for (int i = 0; i < nbcols_; i++) { + if (columns_[i] == _col) { + if (i + 1 < nbcols_) { + System.arraycopy(columns_, i + 1, columns_, i, nbcols_ - i); + System.arraycopy(descending_, i + 1, descending_, i, nbcols_ - i); } nbcols_--; break; } + } } - public int getSortingColumn() - { - if(nbcols_>0) + public int getSortingColumn() { + if (nbcols_ > 0) { return columns_[0]; - return -1; + } + return -1; } - public int[] getSortingColumns() - { - if(nbcols_==0) return INT0; + public int[] getSortingColumns() { + if (nbcols_ == 0) { + return INT0; + } - int[] r=new int[nbcols_]; - System.arraycopy(columns_,0,r,0,nbcols_); + int[] r = new int[nbcols_]; + System.arraycopy(columns_, 0, r, 0, nbcols_); //for(int i=0;i<nbcols_;i++) r[i]=columns_[i]; return r; } - public boolean isAscending() - { - if(nbcols_==0) return true; + public boolean isAscending() { + if (nbcols_ == 0) { + return true; + } return !descending_[0]; } - public boolean isAscending(int _col) - { - for(int i=0;i<nbcols_;i++) - if(columns_[i]==_col) + public boolean isAscending(int _col) { + for (int i = 0; i < nbcols_; i++) { + if (columns_[i] == _col) { return !descending_[i]; + } + } return true; } - public void setAscending(boolean _ascending) - { - setAscending(0,_ascending); + public void setAscending(boolean _ascending) { + setAscending(0, _ascending); } - public void setAscending(int _col, boolean _ascending) - { + public void setAscending(int _col, boolean _ascending) { //System.err.println("BTS: setAscending "+_col+" "+_ascending); - for(int i=0;i<nbcols_;i++) - if(columns_[i]==_col) - if(descending_[i]==_ascending) - { - descending_[i]=!_ascending; + for (int i = 0; i < nbcols_; i++) { + if (columns_[i] == _col) { + if (descending_[i] == _ascending) { + descending_[i] = !_ascending; sort(); - super.tableChanged(new TableModelEvent(this)); + super.tableChanged(new TableModelEvent(this)); break; } + } + } } - public boolean isSortingColumn(int _col) - { - for(int i=0;i<nbcols_;i++) - if(_col==columns_[i]) return true; + public boolean isSortingColumn(int _col) { + for (int i = 0; i < nbcols_; i++) { + if (_col == columns_[i]) { + return true; + } + } return false; } /** * @deprecated use install() instead */ - public void addMouseListenerToHeaderInTable(JTable _table) - { + public void addMouseListenerToHeaderInTable(JTable _table) { install(_table); } /** * Install a mouse listener on the table header. */ - public void install(final JTable _table) - { + public void install(final JTable _table) { //_table.setColumnSelectionAllowed(false); - MouseAdapter listener=new MouseAdapter() - { - public void mouseClicked(MouseEvent _evt) - { - if(!BuLib.isLeft(_evt)) return; - if(_evt.getClickCount()!=1) return; + MouseAdapter listener = new MouseAdapter() { + public void mouseClicked(MouseEvent _evt) { + if (!BuLib.isLeft(_evt)) { + return; + } + if (_evt.getClickCount() != 1) { + return; + } - int column=_table.columnAtPoint(new Point(_evt.getX(),_evt.getY())); - if(column==-1) return; - column=_table.convertColumnIndexToModel(column); - if(column==-1) return; + int column = _table.columnAtPoint(new Point(_evt.getX(), _evt.getY())); + if (column == -1) { + return; + } + column = _table.convertColumnIndexToModel(column); + if (column == -1) { + return; + } - if(isSortingColumn(column)) - { - if((column==getSortingColumn())||!BuLib.isCtrl(_evt)) - setAscending(column,!isAscending(column)); - else - if(!BuLib.isShift(_evt)) + if (isSortingColumn(column)) { + if ((column == getSortingColumn()) || !BuLib.isCtrl(_evt)) { + setAscending(column, !isAscending(column)); + } else if (!BuLib.isShift(_evt)) { removeSortingColumn(column); + } + } else if (BuLib.isCtrl(_evt) || BuLib.isShift(_evt)) { + addSortingColumn(column, true); + } else { + setSortingColumn(column, true); } - else - { - if(BuLib.isCtrl(_evt)||BuLib.isShift(_evt)) - addSortingColumn(column,true); - else - setSortingColumn(column,true); - } } }; - JTableHeader header=_table.getTableHeader(); - header.addMouseListener(listener); + JTableHeader header = _table.getTableHeader(); + header.addMouseListener(listener); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-24 23:15:50
|
Revision: 9199 http://sourceforge.net/p/fudaa/svn/9199 Author: deniger Date: 2015-11-24 23:15:48 +0000 (Tue, 24 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-24 23:15:41 UTC (rev 9198) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGExportData.java 2015-11-24 23:15:48 UTC (rev 9199) @@ -22,7 +22,6 @@ import jxl.write.Label; import jxl.write.Number; import jxl.write.WritableCell; -import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; Modified: trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java =================================================================== --- trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2015-11-24 23:15:41 UTC (rev 9198) +++ trunk/framework/ebli-1d/src/main/java/org/fudaa/ebli/courbe/EGLegendPanelManager.java 2015-11-24 23:15:48 UTC (rev 9199) @@ -3,13 +3,21 @@ */ package org.fudaa.ebli.courbe; +import com.lowagie.text.Font; +import com.memoire.bu.BuLib; import com.memoire.bu.BuVerticalLayout; import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; +import org.apache.commons.lang.StringUtils; /** * @@ -17,6 +25,14 @@ */ public class EGLegendPanelManager extends MouseAdapter implements EGGrapheModelListener { + private class LegendLine { + + String txt; + String tooltip; + EGCourbe courbe; + int padding; + } + JPanel panel; JPanel mainPanel; EGGraphe graphe; @@ -105,26 +121,104 @@ return mainPanel; } + private String groupByLastSeparator; + + public String getGroupByLastSeparator() { + return groupByLastSeparator; + } + + /** + * Si non null, sera utilis\xE9 pour afficher les courbes par groupe. Par exemple les courbes C1 - Toto / 1, C2 - Toto / 1, ... seront affich\xE9es + * <pre> + * Toto / 1 + * C1 + * C2 + * </pre> + * + * @param groupByLastSeparator si null, pas de groupement par suffixe + */ + public void setGroupByLastSeparator(String groupByLastSeparator) { + this.groupByLastSeparator = groupByLastSeparator; + } + private void rebuild() { panel.removeAll(); panel.setDoubleBuffered(false); EGCourbe[] courbes = graphe.getModel().getCourbes(); + List<LegendLine> lines = new ArrayList<LegendLine>(); for (EGCourbe courbe : courbes) { if (!courbe.isVisible_) { continue; } - JLabel label = new JLabel(); + LegendLine line = new LegendLine(); + line.courbe = courbe; + line.tooltip = courbe.getTitle(); + line.txt = courbe.getTitle(); + lines.add(line); + } + manageGroupByPrefix(lines); + for (LegendLine line : lines) { + addLabelToPanel(line); + } + panel.revalidate(); + panel.repaint(0); + } + + /** + * Si un groupement par pr\xE9fixe est demand\xE9, les lignes vont \xEAtre r\xE9agenc\xE9es pour cela. + * + * @param lines + */ + private void manageGroupByPrefix(List<LegendLine> lines) { + if (lines.size() > 0 && StringUtils.isNotBlank(groupByLastSeparator)) { + //contiend les lines par prefixes + LinkedHashMap<String, List<LegendLine>> linesByPrefix = new LinkedHashMap<String, List<LegendLine>>(); + for (LegendLine line : lines) { + String prefix = StringUtils.substringAfterLast(line.txt, groupByLastSeparator); + List<LegendLine> foundList = linesByPrefix.get(prefix); + if (foundList == null) { + foundList = new ArrayList<LegendLine>(); + linesByPrefix.put(prefix, foundList); + } + foundList.add(line); + } + lines.clear(); + for (Map.Entry<String, List<LegendLine>> entry : linesByPrefix.entrySet()) { + String key = entry.getKey(); + List<LegendLine> linesByTitle = entry.getValue(); + //s'il y a plusieurs courbes pour le pr\xE9fixe on fait un padding de 5 et on enl\xE8ve le padding + //si une seule line ou le pr\xE9fixe est vide on ne fait rien + if (StringUtils.isNotBlank(key) && linesByTitle.size() > 1) { + LegendLine titleLine = new LegendLine(); + titleLine.tooltip = key; + titleLine.txt = key; + lines.add(titleLine); + for (LegendLine legendLine : linesByTitle) { + legendLine.txt = StringUtils.substringBeforeLast(legendLine.txt, groupByLastSeparator).trim(); + legendLine.padding = 15; + } + } + lines.addAll(linesByTitle); + } + } + } + + private void addLabelToPanel(LegendLine line) { + JLabel label = new JLabel(); + + label.setText(line.txt); + label.setToolTipText(line.tooltip); + if (line.courbe != null) { EGIconForCourbe icon = new EGIconForCourbe(); - icon.updateFromCourbe(courbe); label.setIcon(icon); - label.setText(courbe.getTitle()); - label.setToolTipText(courbe.getTitle()); - label.putClientProperty("COURBE", courbe); - label.setOpaque(false); - panel.add(label); + icon.updateFromCourbe(line.courbe); + label.putClientProperty("COURBE", line.courbe); label.addMouseListener(this); + } else { + label.setFont(BuLib.deriveFont(label.getFont(), Font.BOLD, 1)); } - panel.revalidate(); - panel.repaint(0); + label.setOpaque(false); + label.setBorder(BorderFactory.createEmptyBorder(0, line.padding, 0, 0)); + panel.add(label); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-24 23:15:43
|
Revision: 9198 http://sourceforge.net/p/fudaa/svn/9198 Author: deniger Date: 2015-11-24 23:15:41 +0000 (Tue, 24 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 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/ReportLongitudinalGrapheBuilderLimit.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalGrapheBuilder.java trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java 2015-11-24 22:31:51 UTC (rev 9197) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/LoiConstanteCourbeModel.java 2015-11-24 23:15:41 UTC (rev 9198) @@ -33,7 +33,8 @@ return res; } - public static LoiConstanteCourbeModel create(Object key, double x1, double x2, double y1, double y2, ItemContentAbstract varX, ItemContentAbstract varY) { + public static LoiConstanteCourbeModel create(Object key, double x1, double x2, double y1, double y2, ItemContentAbstract varX, + ItemContentAbstract varY) { LoiConstanteCourbeModel res = new LoiConstanteCourbeModel(new double[]{x1, x2}, new double[]{y1, y2}, varX, varY); res.setKey(key); return res; @@ -45,7 +46,8 @@ return res; } - public static LoiConstanteCourbeModel create(Object key, ExternContentColumn x, ExternContentColumn y, ExternContent content, ItemContentAbstract varX, ItemContentAbstract varY) { + public static LoiConstanteCourbeModel create(Object key, ExternContentColumn x, ExternContentColumn y, ExternContent content, + ItemContentAbstract varX, ItemContentAbstract varY) { LoiConstanteCourbeModel res = new LoiConstanteCourbeModel(x.toNativeArray(), y.toNativeArray(), varX, varY); res.setLabels(content.getLabelsMap()); res.setKey(key); @@ -60,6 +62,7 @@ private Object key; private CtuluListSelection drawnSegment; private TIntObjectHashMap<String> labels; + private Map<String, TIntObjectHashMap<String>> subLabels; private final ItemContentAbstract varX; private final ItemContentAbstract varY; private String title; @@ -110,6 +113,28 @@ this.labels = labels; } + public void setSubLabels(Map<String, TIntObjectHashMap<String>> subLabels) { + this.subLabels = subLabels; + } + + private static final TIntObjectHashMap<String> EMPTY_LABEL = new TIntObjectHashMap(); + + /** + * + * @param key + * @return les sous labels. hashmap vide si non trouvé ( non null). + */ + public TIntObjectHashMap<String> getSubLabels(String key) { + TIntObjectHashMap<String> res = null; + if (subLabels != null) { + res = subLabels.get(key); + } + if (res == null) { + res = EMPTY_LABEL; + } + return res; + } + @Override public Object getKey() { return key; Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 2015-11-24 22:31:51 UTC (rev 9197) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalCourbesUiResController.java 2015-11-24 23:15:41 UTC (rev 9198) @@ -6,9 +6,11 @@ import javax.swing.table.AbstractTableModel; import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.gui.CtuluCellTextRenderer; +import org.fudaa.dodico.crue.metier.factory.CruePrefix; import org.fudaa.ebli.courbe.EGCourbe; import org.fudaa.ebli.courbe.EGTableAction; import org.fudaa.ebli.courbe.EGTableGraphePanel; +import org.fudaa.fudaa.crue.loi.common.LoiConstanteCourbeModel; import org.fudaa.fudaa.crue.loi.res.CourbesUiResController; import org.openide.util.NbBundle; @@ -17,7 +19,7 @@ * @author Frederic Deniger */ public class ReportLongitudinalCourbesUiResController extends CourbesUiResController { - + public ReportLongitudinalCourbesUiResController() { EGTableAction tableAction = (EGTableAction) getActions("TABLE").get(0); tableAction.setAddOptions(false); @@ -27,62 +29,71 @@ tableAction.setShowLabel(true); setUseVariableForAxeH(true); } - + @Override protected AbstractTableModel createTableModel() { return new ReportLongitudinalTableModel(getTableGraphePanel()); } - + @Override protected void configureTablePanel() { super.configureTablePanel(); tableGraphePanel.getTable().getColumnModel().getColumn(0).setCellRenderer(new CtuluCellTextRenderer()); } - + protected static class ReportLongitudinalTableModel extends EGTableGraphePanel.SpecTableModel { - - public static final int COLUMN_PROFIL = 0; - + + public static final int COLUMN_BRANCHE = 0; + public static final int COLUMN_SECTION = 1; + public ReportLongitudinalTableModel(EGTableGraphePanel graphePanel) { super(graphePanel); - xColIndex = 1; - yColIndex = 2; + xColIndex = 2; + yColIndex = 3; } - + @Override public int getColumnCount() { - return 3; + return 4; } - + @Override public Object getValueAt(int _rowIndex, int _columnIndex) { - if (_columnIndex == COLUMN_PROFIL) { + if (_columnIndex == COLUMN_SECTION || _columnIndex == COLUMN_BRANCHE) { final EGCourbe courbe = getCourbe(); String res = null; if (courbe != null) { - res = courbe.getModel().getPointLabel(_rowIndex); + LoiConstanteCourbeModel model = (LoiConstanteCourbeModel) courbe.getModel(); + String key = CruePrefix.P_BRANCHE; + if (_columnIndex == COLUMN_SECTION) { + key = CruePrefix.P_SECTION; + } + res = model.getSubLabels(key).get(_rowIndex); } return StringUtils.defaultString(res); } return super.getValueAt(_rowIndex, _columnIndex); } - + @Override public String getColumnName(int _column) { - if (_column == COLUMN_PROFIL) { - return NbBundle.getMessage(ReportLongitudinalCourbesUiResController.class, "BrancheSectionColumn.Name"); + if (_column == COLUMN_SECTION) { + return NbBundle.getMessage(ReportLongitudinalCourbesUiResController.class, "SectionColumn.Name"); } + if (_column == COLUMN_BRANCHE) { + return NbBundle.getMessage(ReportLongitudinalCourbesUiResController.class, "BrancheColumn.Name"); + } return super.getColumnName(_column); } - + @Override public Class getColumnClass(int _columnIndex) { - if (_columnIndex <= COLUMN_PROFIL) { + if (_columnIndex <= COLUMN_SECTION) { return String.class; } return Double.class; } - + @Override public void setValueAt(Object _value, int _rowIndex, int _columnIndex) { } 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 2015-11-24 22:31:51 UTC (rev 9197) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderCourbe.java 2015-11-24 23:15:41 UTC (rev 9198) @@ -9,7 +9,9 @@ import org.fudaa.dodico.crue.projet.report.longitudinal.ReportLongitudinalConfig; import gnu.trove.TDoubleArrayList; import gnu.trove.TIntObjectHashMap; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetierConstants; @@ -17,6 +19,7 @@ import org.fudaa.dodico.crue.config.ccm.PropertyEpsilon; import org.fudaa.dodico.crue.metier.emh.CatEMHSection; import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; +import org.fudaa.dodico.crue.metier.factory.CruePrefix; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbeSimple; import org.fudaa.fudaa.crue.loi.common.LoiConstanteCourbeModel; @@ -32,13 +35,13 @@ * @author Frederic Deniger */ public class ReportLongitudinalGrapheBuilderCourbe { - + CrueConfigMetier ccm; ReportLongitudinalGrapheBuilder builder; EGAxeVertical axeZ; EGAxeVertical rightAxis; ReportLongitudinalConfig content; - + public ReportLongitudinalGrapheBuilderCourbe(CrueConfigMetier ccm, ReportLongitudinalGrapheBuilder result, ReportLongitudinalConfig content) { this.ccm = ccm; this.builder = result; @@ -46,19 +49,24 @@ axeZ = builder.getOrCreateAxeVerticalZ(content); rightAxis = builder.getRightAxis(content); } - + public EGAxeVertical getAxeZ() { return axeZ; } - + public EGAxeVertical getRightAxis() { return rightAxis; } - + EGCourbeSimple createCourbe(ReportRunVariableKey reportRunVariableKey, ResultatTimeKey selectedTime, boolean currentTime) { TDoubleArrayList xps = new TDoubleArrayList(); TDoubleArrayList values = new TDoubleArrayList(); TIntObjectHashMap labels = new TIntObjectHashMap(); + Map<String, TIntObjectHashMap<String>> sublabels = new HashMap<String, TIntObjectHashMap<String>>(); + TIntObjectHashMap<String> labelBranches = new TIntObjectHashMap<String>(); + TIntObjectHashMap<String> labelSections = new TIntObjectHashMap<String>(); + sublabels.put(CruePrefix.P_BRANCHE, labelBranches); + sublabels.put(CruePrefix.P_SECTION, labelSections); CtuluListSelection drawnSegment = new CtuluListSelection(); boolean isDz = ReportRunVariableHelper.isNatDzVar(reportRunVariableKey.getVariable(), builder.getReportResultProviderService()); for (ReportLongitudinalBrancheCartouche cartouche : builder.result.getCartouches()) { @@ -68,7 +76,7 @@ } List<ReportLongitudinalPositionSection> sectionPositions = positions.getSectionDisplayPositions(); boolean firstAddInBranche = true; - + for (ReportLongitudinalPositionSection sectionPosition : sectionPositions) { CatEMHSection section = sectionPosition.getName(); Double value = builder.getReportResultProviderService().getValue(selectedTime, reportRunVariableKey, section.getNom()); @@ -85,6 +93,8 @@ drawnSegment.add(xps.size() - 1);//segment dessine } labels.put(xps.size(), section.getBranche().getNom() + " / " + section.getNom());//le faire avant l'ajout ! + labelBranches.put(xps.size(), section.getBranche().getNom()); + labelSections.put(xps.size(), section.getNom()); xps.add(sectionPosition.getXpDisplay()); values.add(value); firstAddInBranche = false; @@ -98,6 +108,7 @@ model.setLabelColumnName(NbBundle.getMessage(ReportLongitudinalCourbesUiResController.class, "BrancheSectionColumn.Name")); model.setDrawnSegment(drawnSegment); model.setLabels(labels); + model.setSubLabels(sublabels); boolean isOnZ = ReportRunVariableHelper.isZOrDzNature(reportRunVariableKey.getVariable(), builder.getReportResultProviderService()); final EGAxeVertical axisToUse = isOnZ ? axeZ : rightAxis; connectVerticalSegment(model, ccm); @@ -106,7 +117,7 @@ AbstractReportGrapheBuilder.applyPersistConfig(content.getCourbeconfigs().get(model.getKey()), courbe); return courbe; } - + public static void connectVerticalSegment(LoiConstanteCourbeModel model, CrueConfigMetier ccm) { PropertyEpsilon epsilon = ccm.getEpsilon(CrueConfigMetierConstants.PROP_XP); CtuluListSelection drawnSegment = model.getDrawnSegment(); @@ -119,7 +130,7 @@ drawnSegment.add(i); } } - + } } } Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderLimit.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderLimit.java 2015-11-24 22:31:51 UTC (rev 9197) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalGrapheBuilderLimit.java 2015-11-24 23:15:41 UTC (rev 9198) @@ -9,7 +9,9 @@ import org.fudaa.dodico.crue.projet.report.longitudinal.ReportLongitudinalBrancheCartouche; import gnu.trove.TDoubleArrayList; import gnu.trove.TIntObjectHashMap; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.dodico.crue.common.BusinessMessages; import org.fudaa.dodico.crue.common.io.CrueIOResu; @@ -22,6 +24,7 @@ import org.fudaa.dodico.crue.metier.emh.DonPrtGeoProfilEtiquette; import org.fudaa.dodico.crue.metier.emh.DonPrtGeoProfilSection; import org.fudaa.dodico.crue.metier.emh.EMHSectionProfil; +import org.fudaa.dodico.crue.metier.factory.CruePrefix; import org.fudaa.dodico.crue.metier.helper.DonPrtHelper; import org.fudaa.dodico.crue.metier.helper.EtiquetteIndexed; import org.fudaa.dodico.crue.metier.helper.LitNommeIndexed; @@ -61,6 +64,11 @@ TDoubleArrayList xps = new TDoubleArrayList(); TDoubleArrayList values = new TDoubleArrayList(); TIntObjectHashMap labels = new TIntObjectHashMap(); + Map<String, TIntObjectHashMap<String>> sublabels = new HashMap<>(); + TIntObjectHashMap<String> labelBranches = new TIntObjectHashMap<>(); + TIntObjectHashMap<String> labelSections = new TIntObjectHashMap<>(); + sublabels.put(CruePrefix.P_BRANCHE, labelBranches); + sublabels.put(CruePrefix.P_SECTION, labelSections); CtuluListSelection drawnSegment = new CtuluListSelection(); ItemEnum etiquette = limitHelper.getEtiquette(reportRunVariableKey.getVariable().getVariableName()); LitNommeLimite limite = limitHelper.getLimite(reportRunVariableKey.getVariable().getVariableName()); @@ -77,6 +85,8 @@ boolean ok = computeZ(etiquette, limite, profil, values); if (ok) { labels.put(xps.size(), section.getBranche().getNom() + " / " + section.getNom()); + labelBranches.put(xps.size(), section.getBranche().getNom()); + labelSections.put(xps.size(), section.getNom()); if (!firstAddInBranche) {//ce n'est pas le premier point de la ligne drawnSegment.add(xps.size() - 1);//segment dessine } @@ -93,6 +103,7 @@ LoiConstanteCourbeModel model = LoiConstanteCourbeModel.create(key, xps, values, varX, varY); model.setDrawnSegment(drawnSegment); model.setLabels(labels); + model.setSubLabels(sublabels); model.setLabelColumnName(NbBundle.getMessage(ReportLongitudinalCourbesUiResController.class, "BrancheSectionColumn.Name")); ReportLongitudinalGrapheBuilderCourbe.connectVerticalSegment(model, ccm); if (etiquette != null) { @@ -114,15 +125,13 @@ values.add(foundPt.getPoint().getZ()); } - } else { - if (limite != null) { - CrueIOResu<List<LitNommeIndexed>> asIndexedData = new ValidateAndRebuildProfilSection(ccm, null).getAsIndexedData(profil); - if (asIndexedData != null && asIndexedData.getMetier() != null) { - int ptIdx = ReportLongitudinalHelper.finPtIdx(asIndexedData, limite); - if (ptIdx >= 0) { - ok = true; - values.add(profil.getPtProfil().get(ptIdx).getZ()); - } + } else if (limite != null) { + CrueIOResu<List<LitNommeIndexed>> asIndexedData = new ValidateAndRebuildProfilSection(ccm, null).getAsIndexedData(profil); + if (asIndexedData != null && asIndexedData.getMetier() != null) { + int ptIdx = ReportLongitudinalHelper.finPtIdx(asIndexedData, limite); + if (ptIdx >= 0) { + ok = true; + values.add(profil.getPtProfil().get(ptIdx).getZ()); } } } Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalGrapheBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalGrapheBuilder.java 2015-11-24 22:31:51 UTC (rev 9197) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalGrapheBuilder.java 2015-11-24 23:15:41 UTC (rev 9198) @@ -17,6 +17,7 @@ import org.fudaa.dodico.crue.config.ccm.ItemVariable; import org.fudaa.dodico.crue.config.ccm.PropertyNature; import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; +import org.fudaa.dodico.crue.metier.factory.CruePrefix; import org.fudaa.ebli.courbe.EGAxeHorizontal; import org.fudaa.ebli.courbe.EGAxeVertical; import org.fudaa.ebli.courbe.EGCourbeSimple; @@ -142,6 +143,7 @@ TDoubleArrayList values = new TDoubleArrayList(); TDoubleArrayList times = new TDoubleArrayList(); TIntObjectHashMap<String> labels = new TIntObjectHashMap<String>(); + for (Pair<ResultatTimeKey, Long> pair : timeByKey) { Double value = reportResultProviderService.getValue(pair.first, key.getRunVariableKey(), key.getEmhName()); if (value != null) { Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties 2015-11-24 22:31:51 UTC (rev 9197) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/longitudinal/Bundle.properties 2015-11-24 23:15:41 UTC (rev 9198) @@ -32,5 +32,6 @@ LineSection.DisplayName=Contour LineBranche.DisplayName=Contour BannerConfiguration.DialogTitle=Configuration du cartouche +BrancheSectionColumn.Name=Branche / Section SectionColumn.Name=Section -BrancheSectionColumn.Name=Branche / Section +BrancheColumn.Name=Branche This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-17 22:27:03
|
Revision: 9196 http://sourceforge.net/p/fudaa/svn/9196 Author: deniger Date: 2015-11-17 22:27:01 +0000 (Tue, 17 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-common/pom.xml trunk/soft/fudaa-crue/ui-emh/pom.xml trunk/soft/fudaa-crue/ui-loader/pom.xml trunk/soft/fudaa-crue/ui-loi/pom.xml trunk/soft/fudaa-crue/ui-modelling/pom.xml trunk/soft/fudaa-crue/ui-options/pom.xml trunk/soft/fudaa-crue/ui-otfa/pom.xml trunk/soft/fudaa-crue/ui-planimetry/pom.xml trunk/soft/fudaa-crue/ui-post/pom.xml trunk/soft/fudaa-crue/ui-report/pom.xml trunk/soft/fudaa-crue/ui-study/pom.xml trunk/soft/fudaa-crue/ui-sysdoc/pom.xml Modified: trunk/soft/fudaa-crue/ui-common/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-common/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-common/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -98,6 +98,21 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-filesystems-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-api-progress-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-util</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-emh/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-emh/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-emh/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -96,9 +96,15 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-nodes</artifactId> <version>${netbeans.version}</version> </dependency> + <dependency> <groupId>org.netbeans.api</groupId> <artifactId>org-openide-explorer</artifactId> Modified: trunk/soft/fudaa-crue/ui-loader/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-loader/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-loader/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -39,6 +39,11 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-filesystems-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-util-lookup</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-loi/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-loi/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-loi/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -118,6 +118,11 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-util-lookup</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-modelling/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-modelling/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -188,6 +188,11 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-explorer</artifactId> <version>${netbeans.version}</version> </dependency> @@ -227,6 +232,11 @@ <version>${netbeans.version}</version> </dependency> <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-api-progress-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> Modified: trunk/soft/fudaa-crue/ui-options/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-options/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-options/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -92,6 +92,11 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-netbeans-api-progress</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-otfa/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-otfa/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-otfa/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -95,6 +95,21 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-filesystems-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-api-progress-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-netbeans-modules-settings</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-planimetry/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-planimetry/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-planimetry/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -189,6 +189,16 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-filesystems-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-dialogs</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-post/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-post/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-post/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -85,6 +85,16 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-api-progress-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-util-lookup</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-report/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-report/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-report/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -168,6 +168,16 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-api-progress-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-util-lookup</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-study/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-study/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-study/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -73,6 +73,11 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-netbeans-api-progress</artifactId> <version>${netbeans.version}</version> </dependency> Modified: trunk/soft/fudaa-crue/ui-sysdoc/pom.xml =================================================================== --- trunk/soft/fudaa-crue/ui-sysdoc/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) +++ trunk/soft/fudaa-crue/ui-sysdoc/pom.xml 2015-11-17 22:27:01 UTC (rev 9196) @@ -92,11 +92,21 @@ </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util-ui</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-netbeans-api-progress</artifactId> <version>${netbeans.version}</version> </dependency> <dependency> <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-api-progress-nb</artifactId> + <version>${netbeans.version}</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> <artifactId>org-openide-util-lookup</artifactId> <version>${netbeans.version}</version> </dependency> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-17 22:26:19
|
Revision: 9195 http://sourceforge.net/p/fudaa/svn/9195 Author: deniger Date: 2015-11-17 22:26:17 +0000 (Tue, 17 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/pom.xml Modified: trunk/soft/fudaa-crue/pom.xml =================================================================== --- trunk/soft/fudaa-crue/pom.xml 2015-11-12 22:57:48 UTC (rev 9194) +++ trunk/soft/fudaa-crue/pom.xml 2015-11-17 22:26:17 UTC (rev 9195) @@ -24,7 +24,7 @@ <netbeans.run.params.ide /> <netbeans.run.params>${netbeans.run.params.ide}</netbeans.run.params> <!--<netbeans.version>RELEASE731</netbeans.version>--> - <netbeans.version>RELEASE712</netbeans.version> + <netbeans.version>RELEASE81</netbeans.version> <brandingToken>fudaacrue</brandingToken> </properties> <modules> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-11 22:53:23
|
Revision: 9193 http://sourceforge.net/p/fudaa/svn/9193 Author: deniger Date: 2015-11-11 22:53:21 +0000 (Wed, 11 Nov 2015) Log Message: ----------- CRUE-667 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/Calc.java trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMs.java trunk/soft/fudaa-crue/crue-project/src/test/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMsTest.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/calcul/CalculNodeFactory.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.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/importer/CLimMsImporter.java trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/Calc.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/Calc.java 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/emh/Calc.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -6,6 +6,8 @@ import java.util.Iterator; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.commons.lang.StringUtils; import org.fudaa.dodico.crue.common.BusinessMessages; import org.fudaa.dodico.crue.common.annotation.PropertyDesc; @@ -32,14 +34,27 @@ public abstract void remove(EMH emh); public abstract void addDclm(DonCLimM dclm); + public abstract void removeDclm(DonCLimM dclm); @Override protected Object clone() throws CloneNotSupportedException { - Calc res=(Calc) super.clone(); + Calc res = (Calc) super.clone(); return res; } + public Calc cloneWithNameComment() { + try { + final Calc newInstance = getClass().newInstance(); + newInstance.nom = nom; + newInstance.commentaire = commentaire; + return newInstance; + } catch (Exception instantiationException) { + Logger.getLogger(Calc.class.getName()).log(Level.INFO, "message {0}", instantiationException); + } + return null; + } + /** * ne clone pas les emh... * @@ -132,4 +147,4 @@ public String getNom() { return nom; } -} \ No newline at end of file +} Modified: trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMs.java =================================================================== --- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMs.java 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMs.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -8,20 +8,30 @@ import gnu.trove.TLongObjectHashMap; import gnu.trove.TLongObjectIterator; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import org.fudaa.ctulu.CtuluLog; +import org.fudaa.ctulu.CtuluLogGroup; import org.fudaa.dodico.crue.common.BusinessMessages; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; import org.fudaa.dodico.crue.edition.bean.DonCLimMLineContent; +import org.fudaa.dodico.crue.metier.emh.Calc; import org.fudaa.dodico.crue.metier.emh.CalcPseudoPermItem; import org.fudaa.dodico.crue.metier.emh.CalcTransItem; import org.fudaa.dodico.crue.metier.emh.DonCLimM; import org.fudaa.dodico.crue.metier.emh.DonCLimMCommonItem; +import org.fudaa.dodico.crue.metier.emh.DonCLimMScenario; import org.fudaa.dodico.crue.metier.emh.EMH; 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.factory.DclmFactory; +import org.fudaa.dodico.crue.metier.factory.OrdCalcFactory; +import org.fudaa.dodico.crue.validation.ValidationHelper; /** * Met à jour les ClimM active d'un calcul. @@ -36,8 +46,7 @@ this.ccm = ccm; } - public CtuluLog updateCLimMs(List<DonCLimMLineContent> newCalcs, EMHScenario parent) { - CtuluLog log = new CtuluLog(BusinessMessages.RESOURCE_BUNDLE); + public CtuluLogGroup updateCLimMs(List<DonCLimMLineContent> newCalcsAndClimMs, EMHScenario parent) { Map<Class, DclmFactory.CalcBuilder> builderByClass = new HashMap<Class, DclmFactory.CalcBuilder>(); for (DclmFactory.CalcBuilder calcBuilder : DclmFactory.getPseudoPerm()) { builderByClass.put(calcBuilder.getDclmClass(), calcBuilder); @@ -45,30 +54,36 @@ for (DclmFactory.CalcBuilder calcBuilder : DclmFactory.getTrans()) { builderByClass.put(calcBuilder.getDclmClass(), calcBuilder); } - for (DonCLimMLineContent donCLimMLineContent : newCalcs) { + final List<OrdCalc> currentOrdCalcs = parent.getOrdCalcScenario().getOrdCalc(); + Map<String, OrdCalc> currentOrdCalcsByCalcName = new HashMap<>(); + for (OrdCalc currentOrdCalc : currentOrdCalcs) { + currentOrdCalcsByCalcName.put(currentOrdCalc.getCalc().getNom(), currentOrdCalc); + } + CtuluLogGroup group = new CtuluLogGroup(BusinessMessages.RESOURCE_BUNDLE); + List<Calc> newCalcs = new ArrayList<>(); + List<OrdCalc> newOrdCalcs = new ArrayList<>(); + Set<String> newCalculNames = new HashSet<>(); + final CtuluLog log = group.createLog(); + for (DonCLimMLineContent donCLimMLineContent : newCalcsAndClimMs) { TLongObjectHashMap<DonCLimM> dclmsByEMHId = donCLimMLineContent.getDclmsByEMHId(); + final Calc calcul = donCLimMLineContent.getCalc().cloneWithNameComment(); + newCalculNames.add(calcul.getNom()); + newCalcs.add(calcul); + OrdCalc currentOcal = currentOrdCalcsByCalcName.get(calcul.getNom()); + if (currentOcal == null) { + OrdCalc newOcal = OrdCalcFactory.createDefaultOcal(calcul, ccm); + newOrdCalcs.add(newOcal); + } else { + OrdCalc newOcal = currentOcal.deepCloneButNotCalc(calcul); + newOrdCalcs.add(newOcal); + } for (TLongObjectIterator<DonCLimM> it = dclmsByEMHId.iterator(); it.hasNext();) { it.advance(); final DonCLimMCommonItem dclm = (DonCLimMCommonItem) it.value(); if (dclm == null) { continue; } - dclm.setUserActive(true); final EMH emh = dclm.getEmh(); - if (emh == null) { - log.addSevereError("Erreur interne sur EMH null" + donCLimMLineContent.getCalc().getNom()); - } - if (!emh.getUiId().equals(it.key())) { - log.addSevereError("Erreur interne sur EMH avec " + donCLimMLineContent.getCalc().getNom() + "/" + it.value().getEmhId()); - } - DonCLimM activeClim = getActiveClim(emh, dclm.getCalculParent().getNom()); - if (activeClim == null) { - log.addSevereError("Erreur interne. dclim non active " + donCLimMLineContent.getCalc().getNom() + "/" + it.value().getEmhId()); - } - if (!dclm.getCalculParent().getId().equals(donCLimMLineContent.getCalc().getId())) { - log.addSevereError("Erreur interne sur Calc parent " - + donCLimMLineContent.getCalc().getNom() + "/" + it.value().getEmhId()); - } DclmFactory.CalcBuilder builder = builderByClass.get(dclm.getClass()); if (!builder.isAccepted(emh)) { log.addSevereError("dclim.dclmNotAccepted", dclm.getCalculParent().getNom(), emh.getNom(), builder.getNom()); @@ -81,36 +96,41 @@ log.addSevereError("dclim.loiNotDefined", dclm.getCalculParent().getNom(), emh.getNom()); } } + dclm.setCalculParent(calcul); + dclm.setUserActive(true); + calcul.addDclm(dclm); } } - if (log.containsErrorOrSevereError()) { - return log; - } - for (DonCLimMLineContent donCLimMLineContent : newCalcs) { - TLongObjectHashMap<DonCLimM> dclmsByEMHId = donCLimMLineContent.getDclmsByEMHId(); - for (TLongObjectIterator<DonCLimM> it = dclmsByEMHId.iterator(); it.hasNext();) { - it.advance(); - final DonCLimMCommonItem newDclm = (DonCLimMCommonItem) it.value(); - if (newDclm == null) { - continue; - } - final EMH emh = newDclm.getEmh(); - //on enleve - DonCLimM oldClim = getActiveClim(emh, newDclm.getNomCalculParent()); - if (oldClim == newDclm) { - continue; - } - //l'ordre est important: - newDclm.getCalculParent().removeDclm(oldClim); - emh.removeInfosEMH(oldClim); - //on ajoute - newDclm.getCalculParent().addDclm(newDclm); - newDclm.setEmh(emh); - emh.addInfosEMH(newDclm); + final List<Calc> currentCalculs = parent.getDonCLimMScenario().getCalc(); + for (Calc currentCalcul : currentCalculs) { + if (!newCalculNames.contains(currentCalcul.getNom())) { + newCalcs.add(currentCalcul.deepClone()); } + } + OrdCalcScenario ocalTemp = new OrdCalcScenario(); + DonCLimMScenario dclmTemp = new DonCLimMScenario(); + for (OrdCalc ordCalc : newOrdCalcs) { + ocalTemp.addOrdCalc(ordCalc); + } + for (Calc calc : newCalcs) { + dclmTemp.addCalc(calc); + } + + group.addLog(ValidationHelper.validateDonCLimMScenarioAndClim(dclmTemp, ccm)); + group.addLog(ValidationHelper.validateOrdCalcScenario(ocalTemp, ccm)); + if (group.containsFatalError()) { + return group; + } - return log; + EditionUpdateCalc updater = new EditionUpdateCalc(); + updater.updateCalcs(newCalcs, newOrdCalcs, parent); +//// modellingScenarioModificationService.setScenarioModified(new ScenarioModificationEvent(EnumModification.OCAL)); +// setModified(false); +// if (Boolean.TRUE.equals(getClientProperty("TEST"))) { +// scenarioReloaded(); +// } + return group; } protected DonCLimM getActiveClim(EMH emh, String calculNom) { Modified: trunk/soft/fudaa-crue/crue-project/src/test/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMsTest.java =================================================================== --- trunk/soft/fudaa-crue/crue-project/src/test/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMsTest.java 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/crue-project/src/test/java/org/fudaa/dodico/crue/edition/EditionUpdateActiveClimMsTest.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.List; import org.fudaa.ctulu.CtuluLog; +import org.fudaa.ctulu.CtuluLogGroup; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; import org.fudaa.dodico.crue.config.coeur.TestCoeurConfig; import org.fudaa.dodico.crue.edition.bean.DonCLimMLineContent; @@ -58,9 +59,10 @@ newDclm.setEmh(nd); newDclm.setCalculParent(ocal.getCalc()); List<DonCLimMLineContent> newCalcs = createEntry(nd, newDclm, ocal); - CtuluLog updateCLimMs = update.updateCLimMs(newCalcs, emhScenario); - assertFalse(updateCLimMs.containsErrorOrSevereError()); + CtuluLogGroup updateCLimMs = update.updateCLimMs(newCalcs, emhScenario); + assertFalse(updateCLimMs.containsError() || updateCLimMs.containsFatalError()); List<InfosEMH> infosEMH = nd.getInfosEMH(); + ocal = emhScenario.getOrdCalcScenario().getOrdCalc().get(0); List<DonCLimM> listeDCLMUserActive = ocal.getCalc().getlisteDCLMUserActive(); assertTrue(infosEMH.contains(newDclm)); assertTrue(newDclm.getEmh() != null); @@ -75,13 +77,13 @@ newDclmFalse.setCalculParent(ocal.getCalc()); newCalcs = createEntry(nd, newDclmFalse, ocal); updateCLimMs = update.updateCLimMs(newCalcs, emhScenario); - assertTrue(updateCLimMs.containsErrorOrSevereError()); - assertEquals(1, updateCLimMs.getRecords().size()); + assertTrue(updateCLimMs.containsError() || updateCLimMs.containsFatalError()); + assertEquals(1, updateCLimMs.getLogs().get(0).getRecords().size()); } public List<DonCLimMLineContent> createEntry(final EMH nd, final DonCLimM newDclm, OrdCalc ocal) { - List<DonCLimMLineContent> newCalcs = new ArrayList<DonCLimMLineContent>(); - TLongObjectHashMap<DonCLimM> newValues = new TLongObjectHashMap<DonCLimM>(); + List<DonCLimMLineContent> newCalcs = new ArrayList<>(); + TLongObjectHashMap<DonCLimM> newValues = new TLongObjectHashMap<>(); newValues.put(nd.getUiId(), newDclm); DonCLimMLineContent updated = new DonCLimMLineContent(ocal.getCalc(), newValues); newCalcs.add(updated); 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 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/ModellingComputeDataTopComponent.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -126,8 +126,8 @@ @Override public void valideModificationHandler() { Node[] nodes = getExplorerManager().getRootContext().getChildren().getNodes(); - List<Calc> newCalcs = new ArrayList<Calc>(); - List<OrdCalc> newOrdCalcs = new ArrayList<OrdCalc>(); + List<Calc> newCalcs = new ArrayList<>(); + List<OrdCalc> newOrdCalcs = new ArrayList<>(); for (Node node : nodes) { CalculNode calculNode = (CalculNode) node; newCalcs.add(calculNode.getCalc()); 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 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/CalculNodeFactory.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -70,7 +70,7 @@ if (modellingScenarioService.getScenarioLoaded() == null) { return Collections.emptyList(); } - List<CalculNode> nodes = new ArrayList<CalculNode>(); + List<CalculNode> nodes = new ArrayList<>(); OrdCalcCloner cloner = new OrdCalcCloner(); Result cloneOrdCalcAndCalc = cloner.cloneAndSort(modellingScenarioService.getScenarioLoaded()); final Map<Calc, OrdCalc> ordCalcByCalc = CalcHelper.getOrdCalcByCalc(cloneOrdCalcAndCalc.ordCalcs); Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.java 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -7,6 +7,7 @@ import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import org.fudaa.ctulu.CtuluLog; +import org.fudaa.ctulu.CtuluLogGroup; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.dodico.crue.common.Pair; import org.fudaa.dodico.crue.edition.EditionUpdateActiveClimMs; @@ -92,6 +93,7 @@ } }); add(newCenter); + newCenter.setName(CENTER_NAME); revalidate(); repaint(); newCenter.revalidate(); @@ -142,13 +144,13 @@ } } List<DonCLimMLineContent> dclims = tableModel.getDclims(); - CtuluLog res = new EditionUpdateActiveClimMs(getCcm()).updateCLimMs(dclims, getScenario()); - if (!res.containsErrorOrSevereError()) { + CtuluLogGroup res = new EditionUpdateActiveClimMs(getCcm()).updateCLimMs(dclims, getScenario()); + if (!res.containsFatalError()) { modellingScenarioModificationService.setScenarioModified(new ScenarioModificationEvent(EnumModification.OCAL)); setModified(false); } - if (res.isNotEmpty()) { + if (res.containsSomething()) { LogsDisplayer.displayError(res, getName()); } } 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 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -76,6 +76,7 @@ getMessage(ModellingListCLimMsTopExportImportPopupBuilder.class, "button.import.name")); if (result != null) { tc.rebuildCenterFor(result); + tc.setModified(true); } } } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -83,7 +83,6 @@ if (imported.getValues().isEmpty()) { continue; } -// DonCLimM currentCLimM = (DonCLimM) model.getValueAt(row, col); String calculName = imported.getCalculId(); boolean transitoire = imported.isTransitoire(); Calc newCalcul = transitoire ? new CalcTrans() : new CalcPseudoPerm(); @@ -138,6 +137,9 @@ } } + if (create != null) { + valueByEmhUid.put(emh.getUiId(), create); + } } } if (log.isNotEmpty()) { Modified: trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java 2015-11-05 22:02:10 UTC (rev 9192) +++ trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java 2015-11-11 22:53:21 UTC (rev 9193) @@ -39,11 +39,11 @@ DonClimMTableModel build(EMHScenario scenario, boolean clone) { List<OrdCalc> ordCalcs = scenario.getOrdCalcScenario().getOrdCalc(); - List<DonCLimMLineContent> lines = new ArrayList<DonCLimMLineContent>(); - Set<Long> emhs = new HashSet<Long>(); + List<DonCLimMLineContent> lines = new ArrayList<>(); + Set<Long> emhs = new HashSet<>(); for (OrdCalc ordCalc : ordCalcs) { List<DonCLimM> listeDCLMUserActive = ordCalc.getCalc().getlisteDCLMUserActive(); - TLongObjectHashMap<DonCLimM> dclmsByEMHId = new TLongObjectHashMap<DonCLimM>(); + TLongObjectHashMap<DonCLimM> dclmsByEMHId = new TLongObjectHashMap<>(); for (DonCLimM donCLimM : listeDCLMUserActive) { try { if (!donCLimM.getActuallyActive()) {//EMH non active... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-05 22:02:13
|
Revision: 9192 http://sourceforge.net/p/fudaa/svn/9192 Author: deniger Date: 2015-11-05 22:02:10 +0000 (Thu, 05 Nov 2015) Log Message: ----------- CRUE-644 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/ModellingListCLimMsTopComponent.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/importer/CLimMsImportValue.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/calcul/importer/Bundle.properties trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonClimMTableModel.java Added Paths: ----------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportData.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLine.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLinesBuilder.java Removed Paths: ------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKey.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKeyFromArray.java 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 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsProgressRunnable.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -22,6 +22,7 @@ import org.apache.poi.ss.usermodel.WorkbookFactory; import org.fudaa.ctulu.CtuluLibFile; 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; @@ -30,7 +31,7 @@ * * @author Frederic Deniger */ -public class ModellingListCLimMsProgressRunnable implements ProgressRunnable<Object> { +public class ModellingListCLimMsProgressRunnable implements ProgressRunnable<DonClimMTableModel> { private File file; private final ModellingListCLimMsTopComponent topComponent; @@ -47,8 +48,7 @@ } @Override - public Object run(ProgressHandle handle) { - Reader reader = null; + public DonClimMTableModel run(ProgressHandle handle) { String[][] values = null; if (initValues != null) { char sep = '\t'; @@ -62,10 +62,9 @@ if (values == null) { return null; } - CLimMsImporter importer = new CLimMsImporter(topComponent.getCcm(), topComponent.getScenario().getLoiConteneur(), values); + CLimMsImporter importer = new CLimMsImporter(topComponent.getCcm(), topComponent.getScenario(), values); importer.setTableModel(topComponent.tableModel); - importer.importData(); - return null; + return importer.importData(); } protected String getValue(Cell cell) { Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopComponent.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -70,9 +70,34 @@ @Override public ExplorerManager getExplorerManager() { return null; -// return helper.getExplorerManager(); } + protected void rebuildCenterFor(DonClimMTableModel newModel) { + JComponent oldCenter = CtuluLibSwing.findChildByName(this, CENTER_NAME); + remove(oldCenter); + setDoubleBuffered(false); + final ModellingOpenDLHYAction loiDisplayer = new ModellingOpenDLHYAction(); + final ModellingListCLimMsTopExportImportPopupBuilder popupReceiver = new ModellingListCLimMsTopExportImportPopupBuilder( + this, loiDisplayer); + Pair<JScrollPane, DonClimMTableModel> createScrollPane = new DonCLimMLineBuilder().createScrollPane(newModel, getCcm(), getScenario(), true, + loiDisplayer, + popupReceiver); + tableModel = createScrollPane.second; + final JScrollPane newCenter = createScrollPane.first; + popupReceiver.install(newCenter); + tableModel.addTableModelListener(new TableModelListener() { + @Override + public void tableChanged(TableModelEvent e) { + setModified(true); + } + }); + add(newCenter); + revalidate(); + repaint(); + newCenter.revalidate(); + newCenter.repaint(); + } + @Override protected void scenarioUnloaded() { super.scenarioUnloaded(); 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 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/ModellingListCLimMsTopExportImportPopupBuilder.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -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.views.DonClimMTableModel; import org.fudaa.fudaa.crue.views.LoiDisplayer; import org.fudaa.fudaa.crue.views.LoiDisplayerInstaller; import org.fudaa.fudaa.crue.views.export.DonClimMExportTableModel; @@ -70,8 +71,12 @@ ModellingListCLimMsTopExportImportPopupBuilder.class, "button.import.name")); if (res == JFileChooser.APPROVE_OPTION) { - CrueProgressUtils.showProgressDialogAndRun(new ModellingListCLimMsProgressRunnable(fileChooser.getSelectedFile(), tc), NbBundle. + final DonClimMTableModel result = CrueProgressUtils.showProgressDialogAndRun(new ModellingListCLimMsProgressRunnable(fileChooser. + getSelectedFile(), tc), NbBundle. getMessage(ModellingListCLimMsTopExportImportPopupBuilder.class, "button.import.name")); + if (result != null) { + tc.rebuildCenterFor(result); + } } } Added: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportData.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportData.java (rev 0) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportData.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -0,0 +1,27 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.modelling.calcul.importer; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author Frederic Deniger + */ +public class CLimMsImportData { + + private final List<CLimMsImportLine> calculs = new ArrayList<>(); + private final List<String> emhs = new ArrayList<>(); + + public List<CLimMsImportLine> getCalculs() { + return calculs; + } + + public List<String> getEmhs() { + return emhs; + } + + +} Deleted: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKey.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKey.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKey.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -1,58 +0,0 @@ -/* - GPL 2 - */ -package org.fudaa.fudaa.crue.modelling.calcul.importer; - -/** - * - * @author Frederic Deniger - */ -public class CLimMsImportKey { - - private final String emh; - private final String calculId; - - public CLimMsImportKey(String emhId, String calculId) { - this.emh = emhId; - this.calculId = calculId; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 59 * hash + (this.emh != null ? this.emh.hashCode() : 0); - hash = 59 * hash + (this.calculId != null ? this.calculId.hashCode() : 0); - return hash; - } - - public String getEmh() { - return emh; - } - - public String getCalculId() { - return calculId; - } - - @Override - public String toString() { - return calculId + ", " + emh; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final CLimMsImportKey other = (CLimMsImportKey) obj; - if ((this.emh == null) ? (other.emh != null) : !this.emh.equals(other.emh)) { - return false; - } - if ((this.calculId == null) ? (other.calculId != null) : !this.calculId.equals(other.calculId)) { - return false; - } - return true; - } -} Deleted: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKeyFromArray.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKeyFromArray.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKeyFromArray.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -1,72 +0,0 @@ -/* - GPL 2 - */ -package org.fudaa.fudaa.crue.modelling.calcul.importer; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.commons.lang.StringUtils; -import org.fudaa.ctulu.CtuluLog; -import org.fudaa.dodico.crue.common.io.CrueIOResu; -import org.openide.util.NbBundle; - -/** - * - * @author Frederic Deniger - */ -public class CLimMsImportKeyFromArray { - - public CLimMsImportKeyFromArray() { - } - - public CrueIOResu<Map<CLimMsImportKey, CLimMsImportValue>> extract(String[][] values) { - CrueIOResu<Map<CLimMsImportKey, CLimMsImportValue>> ioRes = new CrueIOResu<Map<CLimMsImportKey, CLimMsImportValue>>(); - Map<CLimMsImportKey, CLimMsImportValue> res = new HashMap<CLimMsImportKey, CLimMsImportValue>(); - CtuluLog log = new CtuluLog(); - //on parse les colonne - //calcul;EMH 1 (; - ioRes.setAnalyse(log); - ioRes.setMetier(res); - if (values.length == 0) { - return ioRes; - } - final int nbColumns = values[0].length; - if (nbColumns % 2 == 0) { - log.addSevereError(NbBundle.getMessage(CLimMsImportKeyFromArray.class, "climImport.wrongColumnsNumber")); - return ioRes; - } - List<String> emhs = new ArrayList<String>(); - for (int i = 1; i < nbColumns; i += 2) { - String emh1 = StringUtils.substringBeforeLast(values[0][i], "(").trim(); - String emh2 = StringUtils.substringBeforeLast(values[0][i + 1], "(").trim(); - if (!StringUtils.equals(emh1, emh2)) { - log.addSevereError(NbBundle.getMessage(CLimMsImportKeyFromArray.class, "climImport.wrongColumnsOrganization")); - } else { - emhs.add(emh1); - } - } - final int nbEmhs = emhs.size(); - for (int row = 1; row < values.length; row++) { - String[] val = values[row]; - if (val.length != nbColumns) { - log.addSevereError(NbBundle.getMessage(CLimMsImportKeyFromArray.class, "climImport.ligneWithWrongColumnsNumber"), Integer. - toString(row + 1)); - return ioRes; - } - String calcId = val[0]; - for (int i = 0; i < nbEmhs; i++) { - CLimMsImportKey key = new CLimMsImportKey(emhs.get(i), calcId); - CLimMsImportValue value = new CLimMsImportValue(val[1 + 2 * i], val[2 + 2 * i]); - res.put(key, value); - } - } - if (log.containsErrorOrSevereError()) { - return ioRes; - } - - - return ioRes; - } -} Copied: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLine.java (from rev 9158, trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKey.java) =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLine.java (rev 0) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLine.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -0,0 +1,65 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.modelling.calcul.importer; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import org.fudaa.dodico.crue.metier.factory.CruePrefix; + +/** + * + * @author Frederic Deniger + */ +public class CLimMsImportLine { + + private final String calculId; + private final List<CLimMsImportValue> values = new ArrayList<>(); + + public CLimMsImportLine(String calculId) { + this.calculId = calculId; + } + + public String getCalculId() { + return calculId; + } + + public List<CLimMsImportValue> getValues() { + return values; + } + + public boolean isNameValide() { + return calculId.startsWith(CruePrefix.P_CALCUL_PSEUDOPERMANENT) || calculId.startsWith(CruePrefix.P_CALCUL_TRANSITOIRE); + } + + public boolean isTransitoire() { + return calculId.startsWith(CruePrefix.P_CALCUL_TRANSITOIRE); + } + public boolean isPermanent() { + return calculId.startsWith(CruePrefix.P_CALCUL_PSEUDOPERMANENT); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + Objects.hashCode(this.calculId); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CLimMsImportLine other = (CLimMsImportLine) obj; + if (!Objects.equals(this.calculId, other.calculId)) { + return false; + } + return true; + } + +} Copied: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLinesBuilder.java (from rev 9158, trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportKeyFromArray.java) =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLinesBuilder.java (rev 0) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportLinesBuilder.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -0,0 +1,87 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.modelling.calcul.importer; + +import java.util.HashSet; +import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.fudaa.ctulu.CtuluLog; +import org.fudaa.dodico.crue.common.io.CrueIOResu; +import org.openide.util.NbBundle; + +/** + * Permet simplement de lire les données. Ne fait pas de tests métiers sur les données. Test uniquement si doublons dans les données + * + * @author Frederic Deniger + */ +public class CLimMsImportLinesBuilder { + + public CLimMsImportLinesBuilder() { + } + + public CrueIOResu<CLimMsImportData> extract(String[][] values) { + CrueIOResu<CLimMsImportData> ioRes = new CrueIOResu<>(); + CLimMsImportData res = new CLimMsImportData(); + CtuluLog log = new CtuluLog(); + //on parse les colonne + //calcul;EMH 1 (; + ioRes.setAnalyse(log); + ioRes.setMetier(res); + if (values.length == 0) { + return ioRes; + } + final int nbColumns = values[0].length; + if (nbColumns % 2 == 0) { + log.addSevereError(NbBundle.getMessage(CLimMsImportLinesBuilder.class, "climImport.wrongColumnsNumber")); + return ioRes; + } + for (int i = 1; i < nbColumns; i += 2) { + String emh1 = StringUtils.substringBeforeLast(values[0][i], "(").trim(); + String emh2 = StringUtils.substringBeforeLast(values[0][i + 1], "(").trim(); + if (!StringUtils.equals(emh1, emh2)) { + log.addSevereError(NbBundle.getMessage(CLimMsImportLinesBuilder.class, "climImport.wrongColumnsOrganization")); + } else if (res.getEmhs().contains(emh1)) { + log.addSevereError(NbBundle.getMessage(CLimMsImportLinesBuilder.class, "climImport.doublonEMH", emh1)); + } else { + res.getEmhs().add(emh1); + } + } + final int nbEmhs = res.getEmhs().size(); + Set<String> definedCalcul = new HashSet<>(); + for (int row = 1; row < values.length; row++) { + String[] val = values[row]; + if (val.length > nbColumns) { + log.addSevereError(NbBundle.getMessage(CLimMsImportLinesBuilder.class, "climImport.ligneWithWrongColumnsNumber"), Integer. + toString(row + 1), Integer.toString(nbColumns)); + return ioRes; + } + String calcId = val[0]; + if (definedCalcul.contains(calcId)) { + log.addSevereError(NbBundle.getMessage(CLimMsImportLinesBuilder.class, "climImport.doublonCalcul"), calcId); + } + definedCalcul.add(calcId); + CLimMsImportLine line = new CLimMsImportLine(calcId); + boolean existing = false; + for (int i = 0; i < nbEmhs; i++) { + String emh = res.getEmhs().get(i); + int idxCol = 2 + 2 * i; + if (val.length > idxCol) { + CLimMsImportValue value = new CLimMsImportValue(emh, val[idxCol - 1], val[idxCol]); + if (StringUtils.isNotBlank(value.getTypeClimM()) && StringUtils.isNotBlank(value.getValue())) { + line.getValues().add(value); + existing = true; + } + } + } + if (existing) { + res.getCalculs().add(line); + } + } + if (log.containsErrorOrSevereError()) { + return ioRes; + } + + return ioRes; + } +} Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportValue.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportValue.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImportValue.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -3,28 +3,38 @@ */ package org.fudaa.fudaa.crue.modelling.calcul.importer; +import java.util.Objects; + /** * * @author Frederic Deniger */ public class CLimMsImportValue { + private final String emh; private final String typeClimM; private final String value; - public CLimMsImportValue(String typeClimM, String value) { + public CLimMsImportValue(String emh, String typeClimM, String value) { + this.emh = emh; this.typeClimM = typeClimM; this.value = value; } - @Override - public int hashCode() { - int hash = 7; - hash = 59 * hash + (this.typeClimM != null ? this.typeClimM.hashCode() : 0); - hash = 59 * hash + (this.value != null ? this.value.hashCode() : 0); - return hash; + public String getEmh() { + return emh; } + + public boolean isPermanent() { + try { + Double.parseDouble(value); + return true; + } catch (NumberFormatException numberFormatException) { + } + return false; + } + public String getTypeClimM() { return typeClimM; } @@ -39,6 +49,15 @@ } @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + Objects.hashCode(this.emh); + hash = 59 * hash + Objects.hashCode(this.typeClimM); + hash = 59 * hash + Objects.hashCode(this.value); + return hash; + } + + @Override public boolean equals(Object obj) { if (obj == null) { return false; @@ -47,12 +66,16 @@ return false; } final CLimMsImportValue other = (CLimMsImportValue) obj; - if ((this.typeClimM == null) ? (other.typeClimM != null) : !this.typeClimM.equals(other.typeClimM)) { + if (!Objects.equals(this.emh, other.emh)) { return false; } - if ((this.value == null) ? (other.value != null) : !this.value.equals(other.value)) { + if (!Objects.equals(this.typeClimM, other.typeClimM)) { return false; } + if (!Objects.equals(this.value, other.value)) { + return false; + } return true; } + } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/calcul/importer/CLimMsImporter.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -3,25 +3,29 @@ */ package org.fudaa.fudaa.crue.modelling.calcul.importer; +import gnu.trove.TLongObjectHashMap; import java.util.ArrayList; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Set; -import org.apache.commons.lang.StringUtils; +import java.util.MissingResourceException; import org.fudaa.ctulu.CtuluLog; import org.fudaa.dodico.crue.common.io.CrueIOResu; import org.fudaa.dodico.crue.common.transformer.TransformerHelper; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; +import org.fudaa.dodico.crue.edition.bean.DonCLimMLineContent; +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.CalcPseudoPermItem; +import org.fudaa.dodico.crue.metier.emh.CalcTrans; import org.fudaa.dodico.crue.metier.emh.CalcTransBrancheOrificeManoeuvre; import org.fudaa.dodico.crue.metier.emh.CalcTransItem; import org.fudaa.dodico.crue.metier.emh.DonCLimM; import org.fudaa.dodico.crue.metier.emh.DonCLimMCommonItem; import org.fudaa.dodico.crue.metier.emh.DonLoiHYConteneur; import org.fudaa.dodico.crue.metier.emh.EMH; +import org.fudaa.dodico.crue.metier.emh.EMHScenario; import org.fudaa.dodico.crue.metier.emh.EnumSensOuv; import org.fudaa.dodico.crue.metier.emh.Loi; import org.fudaa.dodico.crue.metier.factory.DclmFactory; @@ -41,115 +45,145 @@ private final String[][] values; private final CrueConfigMetier ccm; private final DonLoiHYConteneur loiConteneur; + private final EMHScenario scenario; - public CLimMsImporter(CrueConfigMetier ccm, DonLoiHYConteneur loiConteneur, String[][] values) { + public CLimMsImporter(CrueConfigMetier ccm, EMHScenario scenario, String[][] values) { this.values = values; this.ccm = ccm; - this.loiConteneur = loiConteneur; + this.scenario = scenario; + this.loiConteneur = scenario.getLoiConteneur(); } DonClimMTableModel model; - public void importData() { - CLimMsImportKeyFromArray fromArray = new CLimMsImportKeyFromArray(); - CrueIOResu<Map<CLimMsImportKey, CLimMsImportValue>> importedData = fromArray.extract(values); + public DonClimMTableModel importData() { + CLimMsImportLinesBuilder fromArray = new CLimMsImportLinesBuilder(); + CrueIOResu<CLimMsImportData> importedData = fromArray.extract(values); final CtuluLog log = importedData.getAnalyse(); if (log.containsErrorOrSevereError()) { LogsDisplayer.displayError(log, NbBundle.getMessage(CLimMsImporter.class, "importCLimMs.bilan")); - return; + return null; } - Map<CLimMsImportKey, CLimMsImportValue> metier = importedData.getMetier(); - Set<CLimMsImportKey> notComputedData = new LinkedHashSet<CLimMsImportKey>(); - notComputedData.addAll(metier.keySet()); + + CLimMsImportData importedValues = importedData.getMetier(); + final Map<String, EMH> emhByNom = scenario.getIdRegistry().getEmhByNom(); + CtuluLog logCheckEMH = valideImportDatas(emhByNom, importedValues); + if (logCheckEMH.containsErrorOrSevereError()) { + LogsDisplayer.displayError(logCheckEMH, NbBundle.getMessage(CLimMsImporter.class, "importCLimMs.bilan")); + return null; + } + List<DonCLimMLineContent> dclimFinal = new ArrayList<>(); + List<EMH> emhsFinal = new ArrayList<>(); + for (String emh : importedValues.getEmhs()) { + emhsFinal.add(emhByNom.get(emh)); + } String versHaut = EnumSensOuv.OUV_VERS_HAUT.geti18n(); String versBas = EnumSensOuv.OUV_VERS_BAS.geti18n(); - for (int col = 0; col < model.getColumnCount(); col++) { - for (int row = 0; row < model.getRowCount(); row++) { - DonCLimM currentCLimM = (DonCLimM) model.getValueAt(row, col); - if (currentCLimM == null) { - continue; + for (CLimMsImportLine imported : importedValues.getCalculs()) { + //pas de lignes: on ignore + if (imported.getValues().isEmpty()) { + continue; + } +// DonCLimM currentCLimM = (DonCLimM) model.getValueAt(row, col); + String calculName = imported.getCalculId(); + boolean transitoire = imported.isTransitoire(); + Calc newCalcul = transitoire ? new CalcTrans() : new CalcPseudoPerm(); + newCalcul.setNom(calculName); + final TLongObjectHashMap<DonCLimM> valueByEmhUid = new TLongObjectHashMap<>(); + dclimFinal.add(new DonCLimMLineContent(newCalcul, valueByEmhUid)); + for (CLimMsImportValue value : imported.getValues()) { + String nom = value.getEmh(); + String typeClimM = value.getTypeClimM(); + EMH emh = emhByNom.get(nom); + Map<String, DclmFactory.CalcBuilder> toMapOfNom = findBuilders(newCalcul, emh); + DclmFactory.CalcBuilder builder = toMapOfNom.get(typeClimM); + DonCLimMCommonItem create = null; + if (builder != null) { + create = builder.create(ccm); + } else if (versHaut.equals(typeClimM) || versBas.equals(typeClimM)) { + final DclmFactory.CalcBuilder<? extends DonCLimMCommonItem> ouvBuilder = transitoire ? new DclmFactory.CalcTransBrancheOrificeManoeuvreCreator() : new DclmFactory.CalcPseudoPermBrancheOrificeManoeuvreCreator(); + if (toMapOfNom.containsKey(ouvBuilder.geti18n())) { + create = ouvBuilder.create(ccm); + EnumSensOuv sens = versHaut.equals(typeClimM) ? EnumSensOuv.OUV_VERS_HAUT : EnumSensOuv.OUV_VERS_BAS; + if (transitoire) { + ((CalcTransBrancheOrificeManoeuvre) create).setSensOuv(sens); + } else { + ((CalcPseudoPermBrancheOrificeManoeuvre) create).setSensOuv(sens); + } + } } - String cal = currentCLimM.getCalculParent().getNom(); - String nom = currentCLimM.getEmh().getNom(); - CLimMsImportKey key = new CLimMsImportKey(nom, cal); - CLimMsImportValue value = metier.get(key); - notComputedData.remove(key); - if (value != null && StringUtils.isNotBlank(value.getValue())) { - String typeClimM = value.getTypeClimM(); - EMH emh = currentCLimM.getEmh(); - Map<String, DclmFactory.CalcBuilder> toMapOfNom = findBuilders(currentCLimM); - DclmFactory.CalcBuilder builder = toMapOfNom.get(typeClimM); - boolean transitoire = currentCLimM.getCalculParent().isTransitoire(); - DonCLimMCommonItem create = null; - if (builder != null) { - create = builder.create(ccm); - } else if (versHaut.equals(typeClimM) || versBas.equals(typeClimM)) { - final DclmFactory.CalcBuilder<? extends DonCLimMCommonItem> ouvBuilder = transitoire ? new DclmFactory.CalcTransBrancheOrificeManoeuvreCreator() : new DclmFactory.CalcPseudoPermBrancheOrificeManoeuvreCreator(); - if (toMapOfNom.containsKey(ouvBuilder.geti18n())) { - create = ouvBuilder.create(ccm); - EnumSensOuv sens = versHaut.equals(typeClimM) ? EnumSensOuv.OUV_VERS_HAUT : EnumSensOuv.OUV_VERS_BAS; - if (transitoire) { - ((CalcTransBrancheOrificeManoeuvre) create).setSensOuv(sens); - } else { - ((CalcPseudoPermBrancheOrificeManoeuvre) create).setSensOuv(sens); - } + if (create == null) { + log.addWarn(NbBundle.getMessage(CLimMsImporter.class, "importClimMs.typeNotValid", typeClimM, emh. + getNom())); + } else { + create.setEmh(emh); + create.setCalculParent(newCalcul); + if (transitoire) { + CalcTransItem permItem = (CalcTransItem) create; + List<Loi> filterDLHY = LoiHelper.filterDLHY(loiConteneur, permItem.getTypeLoi()); + Loi loi = TransformerHelper.toMapOfId(filterDLHY).get(value.getValue().toUpperCase()); + if (loi != null) { + permItem.setLoi(loi); + } else { + create = null; + log.addWarn(NbBundle.getMessage(CLimMsImporter.class, "importClimMs.loiNotValid", value.getValue(), emh.getNom(), calculName)); } - } - if (create == null) { - log.addWarn(org.openide.util.NbBundle.getMessage(CLimMsImporter.class, "importClimMs.typeNotValid", typeClimM, emh. - getNom())); } else { - create.setEmh(emh); - create.setCalculParent(currentCLimM.getCalculParent()); - if (transitoire) { - CalcTransItem permItem = (CalcTransItem) create; - List<Loi> filterDLHY = LoiHelper.filterDLHY(loiConteneur, permItem.getTypeLoi()); - Loi loi = TransformerHelper.toMapOfId(filterDLHY).get(value.getValue().toUpperCase()); - if (loi != null) { - permItem.setLoi(loi); - } else { - create = null; - log.addWarn(NbBundle.getMessage(CLimMsImporter.class, "importClimMs.loiNotValid", value.getValue(), emh.getNom(), currentCLimM. - getCalculParent().getNom())); - } - } else { - try { - ((CalcPseudoPermItem) create).setValue(Double.parseDouble(value.getValue())); - } catch (NumberFormatException numberFormatException) { - create = null; - log.addWarn(NbBundle.getMessage(CLimMsImporter.class, "importClimMs.valueNotValid", value.getValue(), emh.getNom(), currentCLimM. - getCalculParent().getNom())); + try { + ((CalcPseudoPermItem) create).setValue(Double.parseDouble(value.getValue())); + } catch (NumberFormatException numberFormatException) { + create = null; + log.addWarn(NbBundle.getMessage(CLimMsImporter.class, "importClimMs.valueNotValid", value.getValue(), emh.getNom(), calculName)); - } - } - if (create != null) { - model.setValueAt(create, row, col); - } } } } - } - if (!notComputedData.isEmpty()) { - for (CLimMsImportKey cLimMsImportKey : notComputedData) { - log.addWarn(NbBundle.getMessage(CLimMsImporter.class, "importClimMs.skipLine", cLimMsImportKey.toString())); - } - } if (log.isNotEmpty()) { LogsDisplayer.displayError(log, NbBundle.getMessage(CLimMsImporter.class, "importCLimMs.bilan")); } + return new DonClimMTableModel(dclimFinal, emhsFinal); } + private CtuluLog valideImportDatas(Map<String, EMH> emhByNom, CLimMsImportData values) throws MissingResourceException { + CtuluLog logCheckEMH = new CtuluLog(); + for (String emh : values.getEmhs()) { + if (!emhByNom.containsKey(emh)) { + logCheckEMH.addSevereError(NbBundle.getMessage(CLimMsImporter.class, "climImport.unknownEMH"), emh); + } + } + for (CLimMsImportLine calcul : values.getCalculs()) { + if (!calcul.isNameValide()) { + logCheckEMH.addSevereError(NbBundle.getMessage(CLimMsImporter.class, "climImport.nameCalculUnknown"), calcul.getCalculId()); + } else { + boolean ispermanent = calcul.isPermanent(); + for (CLimMsImportValue value : calcul.getValues()) { + if (value.isPermanent() != ispermanent) { + if (ispermanent) { + logCheckEMH.addSevereError(NbBundle.getMessage(CLimMsImporter.class, "climImport.calculPermanentNoPermanentValue"), calcul. + getCalculId(), value.getEmh()); + } else { + logCheckEMH.addSevereError(NbBundle.getMessage(CLimMsImporter.class, "climImport.calculTransitoireNoTransitoireValue"), calcul. + getCalculId(), value.getEmh()); + } + } + } + } + + } + return logCheckEMH; + } + public void setTableModel(DonClimMTableModel tableModel) { this.model = tableModel; } - protected Map<String, DclmFactory.CalcBuilder> findBuilders(DonCLimM clim) { - List<DclmFactory.CalcBuilder> creators = new ArrayList<DclmFactory.CalcBuilder>(DclmFactory.getCreatorsSens(clim.getCalculParent())); + protected Map<String, DclmFactory.CalcBuilder> findBuilders(Calc calcul, EMH emh) { + List<DclmFactory.CalcBuilder> creators = new ArrayList<>(DclmFactory.getCreatorsSens(calcul)); for (Iterator<DclmFactory.CalcBuilder> it = creators.iterator(); it.hasNext();) { DclmFactory.CalcBuilder calcBuilder = it.next(); - if (!calcBuilder.isAccepted(clim.getEmh())) { + if (!calcBuilder.isAccepted(emh)) { it.remove(); } } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/calcul/importer/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/calcul/importer/Bundle.properties 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/resources/org/fudaa/fudaa/crue/modelling/calcul/importer/Bundle.properties 2015-11-05 22:02:10 UTC (rev 9192) @@ -4,9 +4,16 @@ import.cini.nbModifiedValue={0} valeurs modifi\u00e9es climImport.wrongColumnsNumber=Le nombre de colonnes du fichier d'import doit \u00eatre impair. Ent\u00eate attendue: colonne 1=nom calcul; colonne 2=emh 1 (type);emh 1 (valeur) climImport.wrongColumnsOrganization=Dans la ligne d'ent\u00eate, il doit y avoir 2 colonnes par EMH: type et valeur. Ent\u00eate attendue: colonne 1=nom calcul; colonne 2=emh 1 (type);emh 1 (valeur) -climImport.ligneWithWrongColumnsNumber=La ligne {0} doit contenir {1} colonnes +climImport.ligneWithWrongColumnsNumber=La ligne {0} doit contenir au maximum {1} colonnes +climImport.doublonCalcul=Le calcul {0} est d\u00e9fini plusieurs fois +climImport.doublonEMH=L''EMH {0} est d\u00e9finie plusieurs fois dans les DCLM importCLimMs.bilan=Import des CLimMs importClimMs.typeNotValid=Le type {0} n''est pas valide pour l''EMH {1} importClimMs.valueNotValid=La valeur {0} pour l''EMH {1} du calcul {2} n''est pas valide importClimMs.loiNotValid=La loi {0} pour l''EMH {1} du calcul {2} n''est pas pr\u00e9sente dans le sc\u00e9nario importClimMs.skipLine=La ligne {0} du fichier d''import a \u00e9t\u00e9 ignor\u00e9e +climImport.unknownEMH=L''EMH {0} n''existe pas +climImport.nameCalculUnknown=Le calcul {0} ne suit pas la convention de nommage: le pr\u00e9fixe doit \u00eatre CC_P pour pseudo-permanent et CC_T pour transitoire. +climImport.NonConsistentDclimValue=Les valeurs du calcul {0} ne sont pas consistentes ( permanentes et transitoire) +climImport.calculPermanentNoPermanentValue=Le calcul {0} de type pseudo-permanent contient une valeur non coh\u00e9rente pour l''EMH {0} +climImport.calculTransitoireNoTransitoireValue=Le calcul {0} de type transitoire contient une valeur non coh\u00e9rente pour l''EMH {0} Modified: trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java =================================================================== --- trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonCLimMLineBuilder.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -60,7 +60,7 @@ lines.add(new DonCLimMLineContent(ordCalc.getCalc(), dclmsByEMHId)); } List<EMH> allSimpleEMH = HierarchyChildFactory.getEMHInNetworkOrder(null, scenario); - List<EMH> emhToDisplay = new ArrayList<EMH>(); + List<EMH> emhToDisplay = new ArrayList<>(); for (EMH emh : allSimpleEMH) { if (emhs.contains(emh.getUiId())) { emhToDisplay.add(emh); @@ -74,7 +74,12 @@ DonClimMTableModel res = build(scenario, editable); res.setEditable(true); - List<String> rows = new ArrayList<String>(); + return createScrollPane(res, ccm, scenario, editable, loiDisplayer, rowPopupReceiver); + } + + public Pair<JScrollPane, DonClimMTableModel> createScrollPane(DonClimMTableModel res, CrueConfigMetier ccm, + EMHScenario scenario, boolean editable, final LoiDisplayer loiDisplayer, CtuluPopupListener.PopupReceiver rowPopupReceiver) { + List<String> rows = new ArrayList<>(); List<DonCLimMLineContent> dclims = res.getDclims(); for (DonCLimMLineContent donCLimMLine : dclims) { rows.add(donCLimMLine.getCalc().getNom()); @@ -116,7 +121,6 @@ } } - } } }); Modified: trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonClimMTableModel.java =================================================================== --- trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonClimMTableModel.java 2015-11-05 22:01:14 UTC (rev 9191) +++ trunk/soft/fudaa-crue/ui-views/src/main/java/org/fudaa/fudaa/crue/views/DonClimMTableModel.java 2015-11-05 22:02:10 UTC (rev 9192) @@ -5,8 +5,11 @@ import org.fudaa.dodico.crue.edition.bean.DonCLimMLineContent; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.swing.table.AbstractTableModel; +import org.fudaa.dodico.crue.metier.emh.Calc; import org.fudaa.dodico.crue.metier.emh.DonCLimM; import org.fudaa.dodico.crue.metier.emh.EMH; @@ -16,8 +19,8 @@ */ public class DonClimMTableModel extends AbstractTableModel { - private final List<DonCLimMLineContent> dclims; - private final List<EMH> emhs; + private List<DonCLimMLineContent> dclims; + private List<EMH> emhs; private boolean editable; public DonClimMTableModel(List<DonCLimMLineContent> dclims, List<EMH> emhs) { @@ -29,6 +32,14 @@ return editable; } + public Map<String, Calc> getCalcByNom() { + Map<String, Calc> res = new HashMap<>(); + for (DonCLimMLineContent dclim : dclims) { + res.put(dclim.getCalc().getNom(), dclim.getCalc()); + } + return res; + } + public void setEditable(boolean editable) { this.editable = editable; } @@ -78,4 +89,6 @@ public List<EMH> getEmhs() { return emhs; } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-11-05 22:01:16
|
Revision: 9191 http://sourceforge.net/p/fudaa/svn/9191 Author: deniger Date: 2015-11-05 22:01:14 +0000 (Thu, 05 Nov 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/factory/CruePrefix.java Modified: trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/factory/CruePrefix.java =================================================================== --- trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/factory/CruePrefix.java 2015-10-14 22:13:03 UTC (rev 9190) +++ trunk/soft/fudaa-crue/crue-emh/src/main/java/org/fudaa/dodico/crue/metier/factory/CruePrefix.java 2015-11-05 22:01:14 UTC (rev 9191) @@ -87,6 +87,8 @@ * Préfixe Cc_ */ public static final String P_CALCUL = "Cc_"; + public static final String P_CALCUL_PSEUDOPERMANENT = "Cc_P"; + public static final String P_CALCUL_TRANSITOIRE = "Cc_T"; /** * Préfixe Rg_ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-10-14 22:13:06
|
Revision: 9190 http://sourceforge.net/p/fudaa/svn/9190 Author: deniger Date: 2015-10-14 22:13:03 +0000 (Wed, 14 Oct 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportProfilLongitudinal.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportLongitudinalExportAction.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportMulitVarExportAction.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportProfilLongitudinalTopComponent.java trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties Modified: trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportProfilLongitudinal.java =================================================================== --- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportProfilLongitudinal.java 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportProfilLongitudinal.java 2015-10-14 22:13:03 UTC (rev 9190) @@ -21,6 +21,7 @@ import org.fudaa.dodico.crue.config.ccm.DecimalFormatEpsilonEnum; import org.fudaa.dodico.crue.config.ccm.ItemEnum; import org.fudaa.dodico.crue.config.ccm.ItemVariable; +import org.fudaa.dodico.crue.config.ccm.PropertyNature; import org.fudaa.dodico.crue.config.lit.LitNommeLimite; import org.fudaa.dodico.crue.config.lit.ReportLongitudinalLimitHelper; import org.fudaa.dodico.crue.metier.emh.CatEMHSection; @@ -89,7 +90,8 @@ for (ResultatTimeKey time : times) { for (ReportRunVariableKey variable : variablesToExport) { row.createCell(idx++).setCellValue( - variable.getDisplayName() + " - " + ResultatTimeKey.timeToString(time) + " - " + variable.getReportRunKey().getDisplayName()); + variable.getVariable().getVariableDisplayName() + " - " + ResultatTimeKey.timeToString(time) + " - " + variable.getReportRunKey(). + getDisplayName()); } } final List<ReportLongitudinalBrancheConfig> branchesConfig = content.getBranchesConfig(); @@ -110,8 +112,9 @@ final List<ReportLongitudinalBrancheCartouche> cartouches = result.getCartouches(); //les styles commun final CellStyle xpStyle = formater.getStyle(propertyXp.getNature(), DecimalFormatEpsilonEnum.COMPARISON); + final PropertyNature natureForZ = resultService.getCcm().getProperty(CrueConfigMetierConstants.PROP_Z).getNature(); final CellStyle zStyle = formater. - getStyle(resultService.getCcm().getNature(CrueConfigMetierConstants.PROP_Z), DecimalFormatEpsilonEnum.COMPARISON); + getStyle(natureForZ, DecimalFormatEpsilonEnum.COMPARISON); for (ReportLongitudinalBrancheCartouche cartouche : cartouches) { final ReportLongitudinalPositionSectionByRun sectionPositions = cartouche.getSectionPositions(runCourant); final List<ReportLongitudinalPositionSection> sectionDisplayPositions = sectionPositions.getSectionDisplayPositions(); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java 2015-10-14 22:13:03 UTC (rev 9190) @@ -38,7 +38,8 @@ this.currentSelected = currentSelected; } - public List<ReportRunVariableEmhKey> getKeysForCurrentRun(ReportResultProviderService reportService, List<String> variables, List<String> emhs) { + public static List<ReportRunVariableEmhKey> getKeysForCurrentRun(ReportResultProviderService reportService, List<String> variables, + List<String> emhs) { List<ReportRunVariableEmhKey> res = new ArrayList<>(); if (variables != null) { for (String variable : variables) { @@ -53,14 +54,14 @@ } - public List<ReportRunVariableEmhKey> getKeysForRuns(ReportResultProviderService reportService, List<String> variables, List<String> emhs, + public static List<ReportRunVariableEmhKey> getKeysForRuns(ReportResultProviderService reportService, List<String> variables, List<String> emhs, List<ReportRunKey> runkeys) { List<ReportRunVariableEmhKey> res = new ArrayList<>(); if (variables != null) { - for (String variable : variables) { - final ReportVariableKey createVariableKey = reportService.createVariableKey(variable); + for (ReportRunKey runkey : runkeys) { for (String emh : emhs) { - for (ReportRunKey runkey : runkeys) { + for (String variable : variables) { + final ReportVariableKey createVariableKey = reportService.createVariableKey(variable); ReportRunVariableEmhKey key = new ReportRunVariableEmhKey(runkey, createVariableKey, emh); res.add(key); } Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java 2015-10-14 22:13:03 UTC (rev 9190) @@ -11,6 +11,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.ctulu.gui.CtuluExportTableChooseFile; import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; import org.fudaa.dodico.crue.metier.comparator.ObjetNommeByNameComparator; @@ -61,10 +62,7 @@ @Override public void actionPerformed(ActionEvent _e) { - final List<String> choosableVariables = getChoosableVariables(); - final Set<String> selectedVariables = getCurrentSelectedVariables(); - ReportVariableChooser variableChooser = new ReportVariableChooser(choosableVariables, selectedVariables); - final List<String> toExport = variableChooser.choose(); + List<String> toExport = chooseVariables(); if (!toExport.isEmpty()) { //on récupère tous les runs configurés pour la vue en question. final ReportResultProviderService reportResultProviderService = Lookup.getDefault().lookup(ReportResultProviderService.class); @@ -75,11 +73,21 @@ keys.addAll(runKey); Collections.sort(keys, ObjetNommeByNameComparator.INSTANCE); final List<ResultatTimeKey> selectedTimeKeys = reportResultProviderService.getReportService().getRangeSelectedTimeKeys(); - final List<ReportRunVariableEmhKey> variablesKeys = variableChooser.getKeysForRuns(reportResultProviderService, toExport, + final List<ReportRunVariableEmhKey> variablesKeys = ReportVariableChooser.getKeysForRuns(reportResultProviderService, toExport, ReportCourbeExportActionAbstract.this.getEMHs(), keys); final File f = chooseTargetFile(); if (f != null) { + String error = CtuluLibFile.canWrite(f); + if (error == null && f.exists() && !f.delete()) { + error = org.openide.util.NbBundle.getMessage(ReportCourbeExportActionAbstract.class, "cantWriteToFileUsedByAnotherProcess.error"); + } + if (error != null) { + DialogHelper.showError(org.openide.util.NbBundle.getMessage(ReportCourbeExportActionAbstract.class, "cantWriteToFile.error", f.getName(), + error)); + return; + + } ProgressRunnable runnable = new ProgressRunnable<Boolean>() { @Override @@ -96,6 +104,14 @@ } } + protected List<String> chooseVariables() { + final List<String> choosableVariables = getChoosableVariables(); + final Set<String> selectedVariables = getCurrentSelectedVariables(); + ReportVariableChooser variableChooser = new ReportVariableChooser(choosableVariables, selectedVariables); + final List<String> toExport = variableChooser.choose(); + return toExport; + } + protected File chooseTargetFile() { final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(CtuluUIForNetbeans.DEFAULT); choose.removeChoosableFileFilter(choose.getFtCsv()); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportLongitudinalExportAction.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportLongitudinalExportAction.java 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportLongitudinalExportAction.java 2015-10-14 22:13:03 UTC (rev 9190) @@ -11,11 +11,13 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; +import org.fudaa.ctulu.CtuluLibFile; import org.fudaa.dodico.crue.metier.comparator.ObjetNommeByNameComparator; import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; import org.fudaa.dodico.crue.projet.report.data.ReportRunKey; import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableKey; import org.fudaa.dodico.crue.projet.report.export.ReportExportProfilLongitudinal; +import org.fudaa.fudaa.crue.common.helper.DialogHelper; import org.fudaa.fudaa.crue.report.data.ReportVariableChooser; import org.fudaa.fudaa.crue.report.longitudinal.ReportProfilLongitudinalTopComponent; import org.fudaa.fudaa.crue.report.service.ReportResultProviderService; @@ -40,7 +42,7 @@ @Override protected List<String> getChoosableVariables() { - final List<String> choosableVariables = topComponent.getChoosableVariables(); + final List<String> choosableVariables = topComponent.getChoosableVariablesForExport(); choosableVariables.remove(null); return choosableVariables; } @@ -58,6 +60,11 @@ if (var != null) { res.add(var); } + final List<String> variablesAsZDrawn = topComponent.getReportConfig(). + getVariablesAsZDrawn(reportResultProviderService.getRunCourant().getRunKey(), reportResultProviderService); + if (variablesAsZDrawn != null) { + res.addAll(variablesAsZDrawn); + } return res; } @@ -83,7 +90,18 @@ final List<ReportRunVariableKey> variablesKeys = variableChooser.getKeysForRuns(reportResultProviderService, toExport, keys); final File f = chooseTargetFile(); + if (f != null) { + String error = CtuluLibFile.canWrite(f); + if (error == null && f.exists() && !f.delete()) { + error = org.openide.util.NbBundle.getMessage(ReportCourbeExportActionAbstract.class, "cantWriteToFileUsedByAnotherProcess.error"); + } + if (error != null) { + DialogHelper.showError(org.openide.util.NbBundle.getMessage(ReportCourbeExportActionAbstract.class, "cantWriteToFile.error", f.getName(), + error)); + return; + + } ProgressRunnable runnable = new ProgressRunnable<Boolean>() { @Override Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportMulitVarExportAction.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportMulitVarExportAction.java 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportMulitVarExportAction.java 2015-10-14 22:13:03 UTC (rev 9190) @@ -30,6 +30,15 @@ } @Override + protected List<String> chooseVariables() { + final List<String> chooseVariables = super.chooseVariables(); + if (!chooseVariables.isEmpty()) { + chooseVariables.add(0, topComponent.getReportConfig().getHorizontalVar()); + } + return chooseVariables; + } + + @Override protected List<String> getChoosableVariables() { final List<String> choosableVariables = new ArrayList<>(topComponent.getChoosableVariables()); choosableVariables.remove(null); Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportProfilLongitudinalTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportProfilLongitudinalTopComponent.java 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportProfilLongitudinalTopComponent.java 2015-10-14 22:13:03 UTC (rev 9190) @@ -11,8 +11,12 @@ import javax.swing.Action; import javax.swing.JPanel; import javax.swing.JSplitPane; +import org.fudaa.dodico.crue.config.ccm.CrueConfigMetier; +import org.fudaa.dodico.crue.metier.emh.EMHScenario; +import org.fudaa.dodico.crue.metier.emh.EnumCatEMH; import org.fudaa.dodico.crue.metier.emh.OrdResScenario; import org.fudaa.dodico.crue.metier.emh.OrdResSection; +import org.fudaa.dodico.crue.metier.helper.ResPrtHelper; import org.fudaa.dodico.crue.metier.result.OrdResExtractor; import org.fudaa.dodico.crue.metier.result.OrdResVariableSelection; import org.fudaa.ebli.commun.EbliActionInterface; @@ -25,12 +29,14 @@ import org.fudaa.dodico.crue.projet.report.data.ReportExpressionHelper; import org.fudaa.dodico.crue.projet.report.data.ReportKeyContract; import org.fudaa.dodico.crue.projet.report.data.ReportRunKey; +import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableHelper; import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableKey; import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableTimeKey; import org.fudaa.dodico.crue.projet.report.data.ReportVariableKey; import org.fudaa.dodico.crue.projet.report.data.ReportVariableTypeEnum; import org.fudaa.fudaa.crue.report.export.ReportLongitudinalExportAction; import org.fudaa.fudaa.crue.report.service.ReportFormuleService; +import org.fudaa.fudaa.crue.report.service.ReportResultProviderService; import org.netbeans.api.settings.ConvertAsProperties; import org.openide.util.Lookup; import org.openide.util.NbBundle; @@ -150,8 +156,25 @@ } } - public List<String> getChoosableVariables() { - return new ReportLongitudinalRightVariableChooser(content).getChoosableVariables(); + public List<String> getChoosableVariablesForExport() { + final List<String> choosableVariables = new ReportLongitudinalRightVariableChooser(content).getChoosableVariables(); + //ajout des variables z + ReportResultProviderService reportResultProviderService = Lookup.getDefault().lookup(ReportResultProviderService.class); + EMHScenario scenario = reportService.getRunCourant().getScenario(); + OrdResExtractor extractor = new OrdResExtractor(scenario.getOrdResScenario()); + List<String> selectableVariables = extractor.getSelectableVariables(EnumCatEMH.SECTION, reportFormuleService.getVariablesKeys()); + //on ne conserve que les variables qui sont affichées sur l'axe des z: + for (Iterator<String> it = selectableVariables.iterator(); it.hasNext();) { + String string = it.next(); + if (ReportRunVariableHelper.isZOrDzNature(string, reportResultProviderService)) { + choosableVariables.add(string); + it.remove(); + } + } + // ajout Zini issu du RPTI + List<String> varZIni = ResPrtHelper.getZiniVar(); + choosableVariables.addAll(varZIni); + return choosableVariables; } protected void chooseRightVariable() { Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties 2015-10-13 21:03:58 UTC (rev 9189) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties 2015-10-14 22:13:03 UTC (rev 9190) @@ -15,4 +15,6 @@ DefaultExportType=type export: action exporter perspective Rapports ExportAll.Action=Exporter\n ExportAll.Tootltip=Export en masse -ExportEnded=Export termin\u00e9 vers le fichier {0} \ No newline at end of file +ExportEnded=Export termin\u00e9 vers le fichier {0} +cantWriteToFile.error=Il est impossible d'\u00e9crire dans le fichier {0}.\nRaison: {1} +cantWriteToFileUsedByAnotherProcess.error=il est probablement ouvert par une autre application (Excel) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-10-09 23:04:49
|
Revision: 9187 http://sourceforge.net/p/fudaa/svn/9187 Author: deniger Date: 2015-10-09 23:04:47 +0000 (Fri, 09 Oct 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java 2015-10-09 23:02:53 UTC (rev 9186) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java 2015-10-09 23:04:47 UTC (rev 9187) @@ -58,7 +58,7 @@ final CheckBoxList list = new CheckBoxList(choosableVariables.toArray()); for (int i = 0; i < choosableVariables.size(); i++) { if (currentSelected.contains(choosableVariables.get(i))) { - list.addSelectionInterval(i, i); + list.addCheckBoxListSelectedIndex(i); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-10-09 23:02:55
|
Revision: 9186 http://sourceforge.net/p/fudaa/svn/9186 Author: deniger Date: 2015-10-09 23:02:53 +0000 (Fri, 09 Oct 2015) Log Message: ----------- CRUE-644 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/CtuluTableExportPanel.java Added Paths: ----------- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluExportTableChooseFile.java Added: trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluExportTableChooseFile.java =================================================================== --- trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluExportTableChooseFile.java (rev 0) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluExportTableChooseFile.java 2015-10-09 23:02:53 UTC (rev 9186) @@ -0,0 +1,42 @@ +/* + GPL 2 + */ +package org.fudaa.ctulu.gui; + +import com.memoire.bu.BuPreferences; +import java.io.File; +import org.apache.commons.lang.StringUtils; + +/** + * + * @author Frederic Deniger + */ +public class CtuluExportTableChooseFile { + + private final CtuluFileChooserCsvExcel choose; + + public CtuluExportTableChooseFile(CtuluFileChooserCsvExcel choose) { + this.choose = choose; + } + + public File chooseExportFile() { + String defaultDir = BuPreferences.BU.getStringProperty("export.excel.lastPath", null); + if (StringUtils.isNotBlank(defaultDir)) { + File dir = new File(defaultDir); + if (dir.exists() && dir.isDirectory()) { + choose.setCurrentDirectory(dir); + + } + } + final File f = choose.getDestFile(); + if (f != null) { + File dir = f.getParentFile(); + if (dir != null) { + BuPreferences.BU.putStringProperty("export.excel.lastPath", dir.getAbsolutePath()); + BuPreferences.BU.writeIniFile(); + } + } + return f; + } + +} 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 2015-10-09 23:02:45 UTC (rev 9185) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluFileChooserCsvExcel.java 2015-10-09 23:02:53 UTC (rev 9186) @@ -39,6 +39,19 @@ this(_ui == null ? null : _ui.getParentComponent()); } + public BuFileFilter getFtCsv() { + return ftCsv_; + } + + public BuFileFilter getFtXsl() { + return ftXsl_; + } + + public BuFileFilter getFtXslx() { + return ftXslx_; + } + + public CtuluFileChooserCsvExcel(Component parentComponent) { this.parentComponent = parentComponent; ftCsv_ = new BuFileFilter(new String[]{"csv", "txt"}, CtuluResource.CTULU.getString("Texte CSV")); 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 2015-10-09 23:02:45 UTC (rev 9185) +++ trunk/framework/ctulu-ui/src/main/java/org/fudaa/ctulu/gui/CtuluTableExportPanel.java 2015-10-09 23:02:53 UTC (rev 9186) @@ -43,34 +43,34 @@ */ @SuppressWarnings("serial") public final class CtuluTableExportPanel extends CtuluDialogPanel implements ItemListener { - + private static final char DEFAULT_SEPARATOR = '\t'; JList cbModel_; BuRadioButton cbOnlySelected_; - + 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)); } - + public static boolean isshowColumnToExport(final JTable _b) { final Boolean res = (Boolean) _b.getClientProperty("TABLE_SHOW_COLUMNS_TO_EXPORT"); return res == null ? true : res.booleanValue(); } - + public static void showExportDialog(final char separator, final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui) { showExportDialog(separator, _table, _dest, type, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } - + public static void showExportDialog(final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui, final Window windowParent) { showExportDialog('\t', _table, _dest, type, _ui, windowParent); } - + public static void showExportDialog(final char separator, final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui, final Window windowParent) { if (!isshowColumnToExport(_table)) { @@ -90,42 +90,27 @@ CtuluDialogPreferences.saveComponentLocationAndDimension(dial, BuPreferences.BU, "exportExcelDialog"); BuPreferences.BU.writeIniFile(); } - + public static void doExport(final JTable _t, final CtuluUI _ui, final Window _f) { doExport(DEFAULT_SEPARATOR, _t, _ui, _f); } - + public static void doExport(final char separator, final JTable _t, final CtuluUI _ui, final Window _f) { final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(_ui); - String defaultDir = BuPreferences.BU.getStringProperty("export.excel.lastPath", null); - if (StringUtils.isNotBlank(defaultDir)) { - File dir = new File(defaultDir); - if (dir.exists() && dir.isDirectory()) { - choose.setCurrentDirectory(dir); - - } + final File f = new CtuluExportTableChooseFile(choose).chooseExportFile(); + if (f != null) { + CtuluTableExportPanel.showExportDialog(separator, _t, f, choose.getTypeChoosen(), _ui); } - final File f = choose.getDestFile(); - if (f == null) { - return; - } else { - File dir = f.getParentFile(); - if (dir != null) { - BuPreferences.BU.putStringProperty("export.excel.lastPath", dir.getAbsolutePath()); - BuPreferences.BU.writeIniFile(); - } - } - CtuluTableExportPanel.showExportDialog(separator, _t, f, choose.getTypeChoosen(), _ui); } - + public static void doExport(char separator, final JTable _t, final CtuluUI _ui) { doExport(separator, _t, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } - + public static void doExport(final JTable _t, final CtuluUI _ui) { doExport('\t', _t, _ui, CtuluLibSwing.getFrameAncestor(_ui.getParentComponent())); } - + @SuppressWarnings("serial") private CtuluTableExportPanel(final JTable _table, final File _dest, final TypeChoosen type, final CtuluUI _ui) { super(false); @@ -137,7 +122,7 @@ if (_table.getModel() instanceof CtuluTableExportInterface) { exportInterface = (CtuluTableExportInterface) _table.getModel(); } - + for (int i = 0; i < _table.getColumnCount(); i++) { final TableColumn column = _table.getColumnModel().getColumn(i); boolean toAdd = true; @@ -153,7 +138,7 @@ public Object getElementAt(final int _index) { return exportTask.getTable().getColumnName(exportableColumns.get(_index)); } - + @Override public int getSize() { return exportableColumns.size(); @@ -177,7 +162,7 @@ col.setSelected(true); add(cbOnlySelected_, BuBorderLayout.SOUTH); } - + @Override public String getHelpText() { String msg = CtuluLib.getS("Vous pouvez s\xE9lectionner les colonnes \xE0 exporter"); @@ -189,12 +174,12 @@ msg += "<br>" + CtuluLib.getS("Par d\xE9faut, toutes les colonnes sont s\xE9lectionn\xE9es pour l'exportation."); return "<html><body>" + msg + "</body></html>"; } - + protected void nothingToExport() { exportTask.getUi().warn(CtuluResource.CTULU.getString("Exportation annul\xE9e"), CtuluResource.CTULU.getString("Ancune donn\xE9e n'a \xE9t\xE9 s\xE9lectionn\xE9e"), false); } - + @Override public void apply() { int[] col = null; @@ -226,16 +211,16 @@ } exportTask.export(col, row); } - + @Override public void itemStateChanged(final ItemEvent _e) { cbModel_.setEnabled(!cbOnlySelected_.isSelected()); } - + public JDialog getParentDial() { return parentDial_; } - + public void setParentDial(final JDialog _parentDial) { parentDial_ = _parentDial; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2015-10-09 23:02:48
|
Revision: 9185 http://sourceforge.net/p/fudaa/svn/9185 Author: deniger Date: 2015-10-09 23:02:45 +0000 (Fri, 09 Oct 2015) Log Message: ----------- CRUE-644 Modified Paths: -------------- trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegate.java trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegateTemporal.java trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalTopComponent.java trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/Bundle.properties trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/data/Bundle.properties trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties Added Paths: ----------- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportTemporal.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportTemporalExportAction.java Modified: trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegate.java =================================================================== --- trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegate.java 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegate.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -13,7 +13,6 @@ import org.fudaa.dodico.crue.common.BusinessMessages; import org.fudaa.dodico.crue.config.ccm.CrueConfigMetierConstants; import org.fudaa.dodico.crue.config.ccm.DecimalFormatEpsilonEnum; -import org.fudaa.dodico.crue.config.ccm.ItemVariable; import org.fudaa.dodico.crue.config.ccm.PropertyNature; import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; import org.fudaa.dodico.crue.projet.report.ReportViewLineInfoAndType; Modified: trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegateTemporal.java =================================================================== --- trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegateTemporal.java 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/crue-otfa/src/main/java/org/fudaa/dodico/crue/projet/otfa/OtfaReportExecutorDelegateTemporal.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -10,11 +10,8 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.commons.lang.StringUtils; import org.fudaa.ctulu.CtuluLog; import org.fudaa.dodico.crue.common.BusinessMessages; -import org.fudaa.dodico.crue.config.ccm.DecimalFormatEpsilonEnum; -import org.fudaa.dodico.crue.config.ccm.PropertyNature; import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; import org.fudaa.dodico.crue.projet.report.ReportViewLineInfoAndType; import org.fudaa.dodico.crue.projet.report.data.ReportRunKey; Added: trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportTemporal.java =================================================================== --- trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportTemporal.java (rev 0) +++ trunk/soft/fudaa-crue/crue-project/src/main/java/org/fudaa/dodico/crue/projet/report/export/ReportExportTemporal.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -0,0 +1,89 @@ +/* + GPL 2 + */ +package org.fudaa.dodico.crue.projet.report.export; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +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.xssf.usermodel.XSSFWorkbook; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.CtuluLibString; +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.table.CtuluTableXlsxWriter; +import org.fudaa.dodico.crue.common.BusinessMessages; +import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; +import org.fudaa.dodico.crue.projet.report.ReportResultProviderServiceContrat; +import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableEmhKey; +import org.fudaa.dodico.crue.projet.report.persist.ReportTemporalConfig; + +/** + * + * @author Frederic Deniger + */ +public class ReportExportTemporal { + + private final ReportTemporalConfig config; + private final ReportResultProviderServiceContrat resultService; + private final String name; + + public ReportExportTemporal(ReportTemporalConfig config, ReportResultProviderServiceContrat resultService, String name) { + this.config = config; + this.resultService = resultService; + this.name = name; + } + + public void export(List<ReportRunVariableEmhKey> variablesToExport, List<ResultatTimeKey> times, File target) { + Workbook wb = new XSSFWorkbook(); + writeInBook(wb, variablesToExport, times); + writeToFile(wb, target); + + } + + protected void writeInBook(Workbook wb, List<ReportRunVariableEmhKey> variablesToExport, List<ResultatTimeKey> times) { + String sheetName = name; + if (sheetName == null) { + sheetName = CtuluResource.CTULU.getString("Feuille {0}", CtuluLibString.getString(1)); + } + Sheet currentSheet = wb.createSheet(sheetName); + //Titres + int rowIdx = 0; + Row row = currentSheet.createRow(rowIdx++); + int idx = 0; + row.createCell(idx++).setCellValue(BusinessMessages.getString("Export.Calcul.ColumnName")); + row.createCell(idx++).setCellValue(BusinessMessages.getString("Export.Temps.ColumnName")); + for (ReportRunVariableEmhKey variable : variablesToExport) { + row.createCell(idx++).setCellValue(variable.getRunVariableKey().getVariable().getVariableDisplayName() + "-" + variable.getEmhName()); + } + for (ResultatTimeKey time : times) { + idx = 0; + row = currentSheet.createRow(rowIdx++); + row.createCell(idx++).setCellValue(time.getNomCalcul()); + row.createCell(idx++).setCellValue(time.getTemps()); + for (ReportRunVariableEmhKey variable : variablesToExport) { + Double val = resultService.getValue(time, variable.getRunVariableKey(), variable.getEmhName()); + row.createCell(idx++).setCellValue(val.doubleValue()); + } + + } + } + + protected void writeToFile(Workbook wb, File target) { + FileOutputStream fileOut = null; + try { + fileOut = new FileOutputStream(target); + wb.write(fileOut); + fileOut.close(); + } catch (IOException ex) { + Logger.getLogger(CtuluTableXlsxWriter.class.getName()).log(Level.SEVERE, null, ex); + } finally { + CtuluLibFile.close(fileOut); + } + } +} Modified: trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java =================================================================== --- trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-loi/src/main/java/org/fudaa/fudaa/crue/loi/common/CourbesUiController.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -45,90 +45,90 @@ * @author Frederic Deniger */ public class CourbesUiController implements CtuluImageProducer { - + protected EGFillePanel panel; protected EGTableGraphePanel tableGraphePanel; protected EGAxeHorizontal axeH; protected JPanel toolbar; protected boolean useVariableForAxeH; protected List<EbliActionInterface> editCourbeActions = new ArrayList<EbliActionInterface>(); - + protected void configureTablePanel() { tableGraphePanel.getTable().setModel(createTableModel()); tableGraphePanel.setPreferredSize(new Dimension(300, 600)); new LoiTimeExportDecorator(tableGraphePanel.getTable()); } - + public boolean isUseVariableForAxeH() { return useVariableForAxeH; } - + public void setUseVariableForAxeH(boolean useVariableForAxeH) { this.useVariableForAxeH = useVariableForAxeH; } - + public void installComboxSelector() { tableGraphePanel.getTitleLabel().setVisible(false); tableGraphePanel.remove(tableGraphePanel.getTitleLabel()); ComboboxCourbeSelector cb = new ComboboxCourbeSelector(getGraphe()); tableGraphePanel.add(cb.getCb(), BorderLayout.NORTH); - + } - + public EGGrapheSimpleModel getEGGrapheSimpleModel() { return (EGGrapheSimpleModel) getGraphe().getModel(); } - + public EGTableGraphePanel getTableGraphePanel() { return tableGraphePanel; } - + public EGAxeHorizontal getAxeX() { return getEGGrapheSimpleModel().getAxeX(); } - + public List<EGAxeVertical> getAxesY() { return getGraphe().getAllAxeVertical(); } - + @Override public BufferedImage produceImage(final Map _params) { return panel.produceImage(_params); - + } - + @Override public BufferedImage produceImage(int _w, int _h, Map _params) { return panel.produceImage(_w, _h, _params); } - + @Override public Dimension getDefaultImageDimension() { return panel.getDefaultImageDimension(); } - + public void addExportImagesToToolbar() { toolbar.add(new ExportImageAction(panel).buildToolButton(EbliComponentFactory.INSTANCE)); toolbar.add(new ExportImageToClipboardAction(panel).buildToolButton(EbliComponentFactory.INSTANCE)); } - + public JPanel getToolbar() { return toolbar; } - + public EGFillePanel getPanel() { return panel; } - + public EGGraphe getGraphe() { return panel.getGraphe(); } - + public void removeEditActions() { tableGraphePanel.removeEditButtonsButCopy(); removeActions("MOVE_POINT", "SIMPLIFY"); } - + public void removeActions(String... actionCommands) { if (toolbar != null) { Set<String> command = new HashSet<String>(Arrays.asList(actionCommands)); @@ -140,12 +140,12 @@ toolbar.remove(component); } } - + } } - + } - + public List<EbliActionInterface> getActions(String... command) { EbliActionInterface[] specificActions = panel.getSpecificActions(); List<EbliActionInterface> res = new ArrayList<EbliActionInterface>(); @@ -161,11 +161,11 @@ } return res; } - + public List<EbliActionInterface> getEditActions() { return getActions("CONFIGURE", "CONFIGURE_REPERE"); } - + public CourbesUiController() { final EGGrapheSimpleModel grapheModel = new LoiGrapheSimpleModel(); axeH = new EGAxeHorizontal(); @@ -212,21 +212,25 @@ popupGraphe.setEditEnable(true); popupGraphe.install(panel.getGraphe(), tableGraphePanel.getTable(), CtuluUIForNetbeans.DEFAULT); } + + public void addToolbarAction(EbliActionInterface action) { + toolbar.add(action.buildToolButton(EbliComponentFactory.INSTANCE), toolbar.getComponentCount() - 2); + } protected boolean editable; - + public void setEditable(boolean b) { editable = b; tableGraphePanel.updateState(); for (EbliActionInterface ebliActionInterface : editCourbeActions) { ebliActionInterface.setEnabled(b); - + } } - + protected AbstractTableModel createTableModel() { return new EGTableGraphePanel.SpecTableModel(tableGraphePanel); } - + public void configureAxeH(final PropertyNature natureAbscisse, boolean usePresentation) { if (natureAbscisse == null) { return; @@ -237,7 +241,7 @@ axeH.setUnite(natureAbscisse.getUnite()); installFormatter(natureAbscisse, axeH, usePresentation); } - + public void configureAxeH(final ItemVariable varAbscisse, boolean usePresentation) { if (varAbscisse == null) { return; @@ -246,15 +250,15 @@ axeH.setTitre(varAbscisse.getDisplayNom()); axeH.setUserObject(varAbscisse); } - + public EGAxeVertical findAxe(final ItemVariable varOrdonnee) { if (varOrdonnee == null) { return null; } return findAxe(varOrdonnee.getNature()); - + } - + public EGAxeVertical findAxe(final PropertyNature nature) { if (nature == null) { return null; @@ -267,15 +271,15 @@ } return null; } - + public EGAxeVertical createAxeVertical(final ItemVariable varOrdonnee, boolean usePresentation) { if (varOrdonnee == null) { return null; } return createAxeVertical(varOrdonnee.getNature(), usePresentation); - + } - + public EGAxeVertical createAxeVertical(final PropertyNature nature, boolean usePresentation) { EGAxeVertical axeV = null; if (nature != null) { @@ -289,7 +293,7 @@ installFormatter(nature, axeV, usePresentation); return axeV; } - + public void setAxeHSpecificFormats(CtuluNumberFormatI mainFormat, CtuluNumberFormatI detailFormat, final CtuluValueEditorI _valueEditor) { if (getAxeX() != null) { getAxeX().setSpecificFormat(mainFormat); @@ -297,10 +301,10 @@ getAxeX().setValueEditor(_valueEditor); } } - + protected void installFormatter(final PropertyNature var, EGAxe axe, boolean usePresentation) { if (var != null) { - + if (var.isEnum()) { axe.setSpecificFormat(new EnumNumberFormatter(var)); axe.setAxisIterator(new FixedIntegerIterator(var.getItemEnumByValue().keys())); @@ -318,7 +322,7 @@ } axe.setUserObject(var); } - + public LoiPopupMenuReceiver createLoiPoupReceiver() { return new LoiPopupMenuReceiver(panel); } @@ -338,7 +342,7 @@ configureAxeH(varAbscisse.getNature(), usePresentationFormat); } } - + public void initAxeWithDuration(final PropertyNature var, EGAxe axe) { final ToStringTransformerSecond toStringTransformerSecond = new ToStringTransformerSecond(); final CtuluNumberFormatDefault toSecondFormat = new CtuluNumberFormatDefault(var.getFormatter(DecimalFormatEpsilonEnum.COMPARISON)); Added: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java (rev 0) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/data/ReportVariableChooser.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -0,0 +1,97 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.report.data; + +import com.jidesoft.swing.CheckBoxList; +import java.awt.BorderLayout; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import javax.swing.JCheckBox; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import org.fudaa.dodico.crue.projet.report.data.ReportRunKey; +import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableEmhKey; +import org.fudaa.dodico.crue.projet.report.data.ReportVariableKey; +import org.fudaa.fudaa.crue.common.PerspectiveEnum; +import org.fudaa.fudaa.crue.common.helper.CheckBoxListPopupListener; +import org.fudaa.fudaa.crue.common.helper.DialogHelper; +import org.fudaa.fudaa.crue.report.longitudinal.ReportLongitudinalTimeChooser; +import org.fudaa.fudaa.crue.report.service.ReportResultProviderService; +import org.openide.util.NbBundle; + +/** + * + * @author Frederic Deniger + */ +public class ReportVariableChooser { + + private final List<String> choosableVariables; + private final Set<String> currentSelected; + + public ReportVariableChooser(List<String> choosableVariables, Set<String> currentSelected) { + this.choosableVariables = choosableVariables; + this.currentSelected = currentSelected; + } + + public List<ReportRunVariableEmhKey> getKeysForCurrentRun(ReportResultProviderService reportService, List<String> variables, List<String> emhs) { + List<ReportRunVariableEmhKey> res = new ArrayList<>(); + if (variables != null) { + for (String variable : variables) { + final ReportVariableKey createVariableKey = reportService.createVariableKey(variable); + for (String emh : emhs) { + ReportRunVariableEmhKey key = new ReportRunVariableEmhKey(reportService.getReportService().getCurrentRunKey(), createVariableKey, emh); + res.add(key); + } + } + } + return res; + + } + + public List<String> choose() { + final CheckBoxList list = new CheckBoxList(choosableVariables.toArray()); + for (int i = 0; i < choosableVariables.size(); i++) { + if (currentSelected.contains(choosableVariables.get(i))) { + list.addSelectionInterval(i, i); + } + + } + list.setCellRenderer(new ReportVariableCellRenderer()); + new CheckBoxListPopupListener(list); + JPanel pn = new JPanel(new BorderLayout(0, 5)); + final JCheckBox selectAll = new JCheckBox(NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.SelectAllNone")); + selectAll.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + boolean select = selectAll.isSelected(); + if (select) { + list.selectAll(); + } else { + list.selectNone(); + } + } + }); + pn.add(new JScrollPane(list)); + pn.add(selectAll, BorderLayout.NORTH); + String title = org.openide.util.NbBundle.getMessage(ReportVariableChooser.class, "ReportVariableChooser.DialogTitle"); + boolean ok = DialogHelper.showQuestionAndSaveDialogConf(title, pn, getClass()); + if (ok) { + final Object[] checkBoxListSelectedValues = list.getCheckBoxListSelectedValues(); + List<String> res = new ArrayList<>(); + for (Object checkBoxListSelectedValue : checkBoxListSelectedValues) { + res.add((String) checkBoxListSelectedValue); + } + return res; + } + return Collections.emptyList(); + + } + +} Added: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java (rev 0) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportCourbeExportActionAbstract.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -0,0 +1,48 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.report.export; + +import com.memoire.bu.BuResource; +import java.io.File; +import org.fudaa.ctulu.gui.CtuluExportTableChooseFile; +import org.fudaa.ctulu.gui.CtuluFileChooserCsvExcel; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.crue.common.helper.CrueProgressUtils; +import org.fudaa.fudaa.crue.common.helper.CtuluUIForNetbeans; +import org.fudaa.fudaa.crue.common.helper.DialogHelper; +import org.fudaa.fudaa.crue.report.AbstractReportTimeViewTopComponent; +import org.netbeans.api.progress.ProgressRunnable; + +/** + * + * @author Frederic Deniger + */ +public abstract class ReportCourbeExportActionAbstract<T extends AbstractReportTimeViewTopComponent> extends EbliActionSimple { + + protected final T topComponent; + + public ReportCourbeExportActionAbstract(T topComponent) { + super(org.openide.util.NbBundle.getMessage(ReportCourbeExportActionAbstract.class, "ExportAll.Action"), BuResource.BU.getToolIcon("exporter"), + "EXPORT"); + setDefaultToolTip(org.openide.util.NbBundle.getMessage(ReportCourbeExportActionAbstract.class, "ExportAll.Tootltip")); + this.topComponent = topComponent; + } + + protected File chooseTargetFile() { + final CtuluFileChooserCsvExcel choose = new CtuluFileChooserCsvExcel(CtuluUIForNetbeans.DEFAULT); + choose.removeChoosableFileFilter(choose.getFtCsv()); + choose.removeChoosableFileFilter(choose.getFtXsl()); + final File f = new CtuluExportTableChooseFile(choose).chooseExportFile(); + return f; + } + + protected void execute(ProgressRunnable<Boolean> runnable, File f) { + Boolean res = CrueProgressUtils.showProgressDialogAndRun(runnable, getTitle()); + if (Boolean.TRUE.equals(res)) { + DialogHelper.showNotifyOperationTermine(getTitle(), org.openide.util.NbBundle.getMessage(ReportTemporalExportAction.class, "ExportEnded", f. + getAbsolutePath())); + } + } + +} Added: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportTemporalExportAction.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportTemporalExportAction.java (rev 0) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/export/ReportTemporalExportAction.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -0,0 +1,67 @@ +/* + GPL 2 + */ +package org.fudaa.fudaa.crue.report.export; + +import java.awt.event.ActionEvent; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.fudaa.dodico.crue.metier.emh.ResultatTimeKey; +import org.fudaa.dodico.crue.projet.report.data.ReportRunContent; +import org.fudaa.dodico.crue.projet.report.data.ReportRunVariableEmhKey; +import org.fudaa.dodico.crue.projet.report.export.ReportExportTemporal; +import org.fudaa.fudaa.crue.report.data.ReportVariableChooser; +import org.fudaa.fudaa.crue.report.service.ReportResultProviderService; +import org.fudaa.fudaa.crue.report.temporal.ReportTemporalTopComponent; +import org.netbeans.api.progress.ProgressHandle; +import org.netbeans.api.progress.ProgressRunnable; +import org.openide.util.Lookup; + +/** + * + * @author Frederic Deniger + */ +public class ReportTemporalExportAction extends ReportCourbeExportActionAbstract<ReportTemporalTopComponent> { + + public ReportTemporalExportAction(ReportTemporalTopComponent topComponent) { + super(topComponent); + } + + @Override + public void actionPerformed(ActionEvent _e) { + final List<String> choosableVariables = new ArrayList<>(Arrays.asList(topComponent.getChoosableVariables())); + choosableVariables.remove(null); + final Set<String> selectedVariables = new HashSet<>(topComponent.getReportConfig().getVariables()); + ReportVariableChooser variableChooser = new ReportVariableChooser(choosableVariables, selectedVariables); + final List<String> toExport = variableChooser.choose(); + if (!toExport.isEmpty()) { + final ReportResultProviderService reportResultProviderService = Lookup.getDefault().lookup(ReportResultProviderService.class); + final List<ResultatTimeKey> selectedTimeKeys = reportResultProviderService.getReportService().getRangeSelectedTimeKeys(); + final List<ReportRunVariableEmhKey> variablesKeys = variableChooser.getKeysForCurrentRun(reportResultProviderService, toExport, topComponent. + getReportConfig().getEmhs()); + + final File f = chooseTargetFile(); + if (f != null) { + ProgressRunnable runnable = new ProgressRunnable<Boolean>() { + + @Override + public Boolean run(ProgressHandle handle) { + final ReportRunContent runCourant = reportResultProviderService.getRunCourant(); + String currentRunName = runCourant.getScenario().getNom() + "-" + runCourant.getRun().getNom(); + ReportExportTemporal exporter = new ReportExportTemporal(topComponent.getReportConfig(), reportResultProviderService, currentRunName); + exporter.export(variablesKeys, selectedTimeKeys, f); + return Boolean.TRUE; + } + }; + execute(runnable, f); + + } + + } + } + +} Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/longitudinal/ReportLongitudinalTimeChooser.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -64,8 +64,7 @@ }); pn.add(new JScrollPane(list)); pn.add(selectAll, BorderLayout.NORTH); - String title = org.openide.util.NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.DialogTitle", - "vueProfilLongitudinalConfigurationPasDeTemps", PerspectiveEnum.REPORT); + String title = org.openide.util.NbBundle.getMessage(ReportLongitudinalTimeChooser.class, "ChooseTime.DialogTitle"); boolean ok = DialogHelper.showQuestionAndSaveDialogConf(title, pn, getClass(), "vueProfilLongitudinal_ConfigurationPasDeTemps", PerspectiveEnum.REPORT, true); if (ok) { Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalCourbesUiResController.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -25,6 +25,7 @@ tableAction.setShowColumnToExport(false); tableAction.setDisplayAll(true); tableAction.setShowLabel(true); + } @Override Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalTopComponent.java 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/temporal/ReportTemporalTopComponent.java 2015-10-09 23:02:45 UTC (rev 9185) @@ -1,5 +1,6 @@ package org.fudaa.fudaa.crue.report.temporal; +import org.fudaa.fudaa.crue.report.export.ReportTemporalExportAction; import org.fudaa.dodico.crue.projet.report.persist.ReportTemporalConfig; import com.memoire.bu.BuGridLayout; import java.awt.BorderLayout; @@ -12,6 +13,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.MissingResourceException; import java.util.Set; import javax.swing.JComboBox; import javax.swing.JLabel; @@ -113,6 +115,7 @@ @Override protected CourbesUiResController createCourbesUiController() { CourbesUiResController res = new ReportTemporalCourbesUiResController(); + res.addToolbarAction(new ReportTemporalExportAction(this)); return res; } @@ -181,15 +184,7 @@ } public void chooseVariable() { - EnumCatEMH usedCat = ChooseEMHByTypeHelper.getUsedCat(reportService, content.getEmhs()); - if (CollectionUtils.isNotEmpty(content.getEmhs()) - && usedCat == null) { - DialogHelper.showWarn(org.openide.util.NbBundle.getMessage(ChooseEMHByTypeHelper.class, "UsedEMHNotFound.warning")); - } - OrdResExtractor extractor = new OrdResExtractor(getScenario().getOrdResScenario()); - List<String> selectedVariables = extractor.getSelectableVariables(usedCat, reportFormuleService.getVariablesKeys()); - selectedVariables.add(0, null); - String[] selectedVariablesArray = (String[]) selectedVariables.toArray(new String[selectedVariables.size()]); + String[] selectedVariablesArray = getChoosableVariables(); ReportVariableCellRenderer cellRenderer = new ReportVariableCellRenderer(); ByRunSelector selector = new ByRunSelector(); @@ -231,7 +226,7 @@ } } } - + boolean accepted = DialogHelper.showQuestionOkCancel(NbBundle.getMessage(ReportTemporalTopComponent.class, "ChooseVariable.ButtonName"), pn); if (accepted) { content.getVariables().clear(); @@ -273,6 +268,19 @@ } } + public String[] getChoosableVariables() throws MissingResourceException { + EnumCatEMH usedCat = ChooseEMHByTypeHelper.getUsedCat(reportService, content.getEmhs()); + if (CollectionUtils.isNotEmpty(content.getEmhs()) + && usedCat == null) { + DialogHelper.showWarn(org.openide.util.NbBundle.getMessage(ChooseEMHByTypeHelper.class, "UsedEMHNotFound.warning")); + } + OrdResExtractor extractor = new OrdResExtractor(getScenario().getOrdResScenario()); + List<String> selectedVariables = extractor.getSelectableVariables(usedCat, reportFormuleService.getVariablesKeys()); + selectedVariables.add(0, null); + String[] selectedVariablesArray = (String[]) selectedVariables.toArray(new String[selectedVariables.size()]); + return selectedVariablesArray; + } + @Override protected void saveCourbeConfig(EGCourbePersist persitUiConfig, ReportKeyContract key) { if (ReportVerticalTimeKey.isTimeKey(key)) { Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/Bundle.properties 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/Bundle.properties 2015-10-09 23:02:45 UTC (rev 9185) @@ -51,3 +51,4 @@ formuleCyclesDetected.error=<html><body>La vue n''a pas \u00e9t\u00e9 valid\u00e9e. Des cycles ont \u00e9t\u00e9 d\u00e9tect\u00e9s pour:<ul>{0}</ul></body></html> button.export.name=Exporter viewManager.columnName=Rapports + Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/data/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/data/Bundle.properties 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/data/Bundle.properties 2015-10-09 23:02:45 UTC (rev 9185) @@ -1 +1,2 @@ -Variable.NoSelection=Vide \ No newline at end of file +Variable.NoSelection=Vide +ReportVariableChooser.DialogTitle=Choisir les variables Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties 2015-10-09 19:53:32 UTC (rev 9184) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/export/Bundle.properties 2015-10-09 23:02:45 UTC (rev 9185) @@ -12,4 +12,7 @@ Export.OperationFinish=Exportation termin\u00e9e: {0} ReportExportNodeAction.DisplayName=Exporter Export.ChooseFile.LabelName=Fichier CSV: -DefaultExportType=type export: action exporter perspective Rapports \ No newline at end of file +DefaultExportType=type export: action exporter perspective Rapports +ExportAll.Action=Exporter\n +ExportAll.Tootltip=Export en masse +ExportEnded=Export termin\u00e9 vers le fichier {0} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |