From: <de...@us...> - 2014-06-09 19:54:28
|
Revision: 8755 http://sourceforge.net/p/fudaa/svn/8755 Author: deniger Date: 2014-06-09 19:54:19 +0000 (Mon, 09 Jun 2014) Log Message: ----------- CRUE-597 Modified Paths: -------------- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/list/ModellingListSectionTopComponent.java trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ProfilSectionTopComponent.java trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/transversal/ReportProfilTransversalTopComponent.java trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/transversal/Bundle.properties Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/list/ModellingListSectionTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/list/ModellingListSectionTopComponent.java 2014-06-04 11:12:37 UTC (rev 8754) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/list/ModellingListSectionTopComponent.java 2014-06-09 19:54:19 UTC (rev 8755) @@ -157,6 +157,7 @@ protected void openAddNodeTopComponent(final AddSectionInBranchePanelContentData data) { Runnable runnable = new Runnable() { + @Override public void run() { ModellingOpenListSectionAddNodeAction.open(getSousModele(), data); } Modified: trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ProfilSectionTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ProfilSectionTopComponent.java 2014-06-04 11:12:37 UTC (rev 8754) +++ trunk/soft/fudaa-crue/ui-modelling/src/main/java/org/fudaa/fudaa/crue/modelling/loi/ProfilSectionTopComponent.java 2014-06-09 19:54:19 UTC (rev 8755) @@ -73,8 +73,8 @@ public static final String PROPERTY_INIT_UID = "initUid"; public static final String MODE = "loi-profilSectionEditor"; //NOI18N public static final String TOPCOMPONENT_ID = "ProfilSectionTopComponent"; //NOI18N - private ProfilSectionLoiUiController profilUiController; - private JTextField txtCommentaire; + private final ProfilSectionLoiUiController profilUiController; + private final JTextField txtCommentaire; /** * permet de sélectionner le profil précédent */ @@ -83,14 +83,14 @@ * permet de sélectionner le profil suivant */ private JButton btDown; - private JTextField txtNom; - private JLabel lbNomValidation; - private JLabel lbCreationSection; + private final JTextField txtNom; + private final JLabel lbNomValidation; + private final JLabel lbCreationSection; private Action delete; private Action duplicate; private Action create; protected String initName; - private ViewCourbeManager viewCourbeManager; + private final ViewCourbeManager viewCourbeManager; private ModellingConfigService modellingConfigService = Lookup.getDefault().lookup(ModellingConfigService.class); /** * Contient la liste des profils dans l'ordre @@ -663,12 +663,12 @@ } void selectNextProfil() { - selectProfil(1); + selectProfilFromDelta(1); } void selectPreviousProfil() { - selectProfil(-1); + selectProfilFromDelta(-1); } @Override @@ -742,7 +742,7 @@ return pnActions; } - private void selectProfil(int delta) { + private void selectProfilFromDelta(int delta) { if (CollectionUtils.isEmpty(profils)) { return; } Modified: trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/transversal/ReportProfilTransversalTopComponent.java =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/transversal/ReportProfilTransversalTopComponent.java 2014-06-04 11:12:37 UTC (rev 8754) +++ trunk/soft/fudaa-crue/ui-report/src/main/java/org/fudaa/fudaa/crue/report/transversal/ReportProfilTransversalTopComponent.java 2014-06-09 19:54:19 UTC (rev 8755) @@ -5,19 +5,16 @@ import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.swing.JPanel; import javax.swing.JSplitPane; -import org.apache.commons.collections.CollectionUtils; +import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.dodico.crue.common.transformer.TransformerHelper; -import org.fudaa.dodico.crue.metier.emh.CatEMHBranche; import org.fudaa.dodico.crue.metier.emh.CatEMHSection; import org.fudaa.dodico.crue.metier.emh.OrdResScenario; import org.fudaa.dodico.crue.metier.emh.OrdResSection; -import org.fudaa.dodico.crue.metier.emh.RelationEMHSectionDansBranche; import org.fudaa.dodico.crue.metier.result.OrdResExtractor; import org.fudaa.dodico.crue.metier.result.OrdResVariableSelection; import org.fudaa.ebli.commun.EbliActionInterface; @@ -146,7 +143,7 @@ protected void chooseSection() { final List<CatEMHSection> sections = reportService.getModele().getSections(); List<String> sectionNames = TransformerHelper.toNom(sections); - ChooseInListHelper<String> chooser = new ChooseInListHelper<String>(); + ChooseInListHelper<String> chooser = new ChooseInListHelper<>(); chooser.setLabel(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "ChooseSectionName.Label")); chooser.setDialogTitle(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "ChooseSection.DialogTitle")); String newSection = chooser.choose(sectionNames, content.getSectionName()); @@ -157,76 +154,34 @@ } protected void chooseAval() { - choose(1); + chooseFromDelta(1); } protected void chooseAmont() { - choose(-1); + chooseFromDelta(-1); } private CatEMHSection findSection(CatEMHSection current, int inc) { if (current == null) { return null; } - CatEMHBranche branche = current.getBranche(); - if (branche != null) { - List<RelationEMHSectionDansBranche> listeSections = branche.getListeSections(); - int idx = indexOf(listeSections, current) + inc; - if (idx >= listeSections.size()) { - List<CatEMHBranche> branchesAval = branche.getNoeudAval().getBranchesAval(); - final boolean empty = CollectionUtils.isEmpty(branchesAval); - if (empty || branchesAval.size() > 1) { - if (empty) { - DialogHelper.showInfo(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SectionNavigation.InfoDialog"), - NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "NoAvalSectionWithResultat.DialogContent")); - } else { - DialogHelper.showInfo(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SectionNavigation.InfoDialog"), - NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SeveralAvalBranche.DialogContent")); - - } - return null; - } - branche = branchesAval.get(0); - listeSections = branche.getListeSections(); - CatEMHSection first = listeSections.get(0).getEmh(); - return first; - } else if (idx < 0) { - List<CatEMHBranche> branchesAmont = branche.getNoeudAmont().getBranchesAmont(); - final boolean empty = CollectionUtils.isEmpty(branchesAmont); - if (empty || branchesAmont.size() > 1) { - if (empty) { - DialogHelper.showInfo(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SectionNavigation.InfoDialog"), - NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "NoAmontSectionWithResultat.DialogContent")); - } else { - DialogHelper.showInfo(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SectionNavigation.InfoDialog"), - NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SeveralAmontBranche.DialogContent")); - - } - return null; - - } - branche = branchesAmont.get(0); - listeSections = branche.getListeSections(); - CatEMHSection last = listeSections.get(listeSections.size() - 1).getEmh(); - return last; - } else { - CatEMHSection emh = listeSections.get(idx).getEmh(); - return emh; - } + final List<CatEMHSection> sections = reportService.getModele().getSections(); + int idx = CtuluLibArray.findObjectEgalEgal(sections, current) + inc; + if (idx < 0) { + DialogHelper.showInfo(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SectionNavigation.InfoDialog"), + NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "NoAmontSectionWithResultat.DialogContent")); + return null; } - return null; - } - - private int indexOf(List<RelationEMHSectionDansBranche> listeSections, CatEMHSection section) { - for (int i = 0; i < listeSections.size(); i++) { - RelationEMHSectionDansBranche relationEMHSectionDansBranche = listeSections.get(i); - if (relationEMHSectionDansBranche.getEmh() == section) { - return i; - } + if (idx >= sections.size()) { + DialogHelper.showInfo(NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "SectionNavigation.InfoDialog"), + NbBundle.getMessage(ReportProfilTransversalTopComponent.class, "NoAvalSectionWithResultat.DialogContent")); + return null; } - return -1; + return sections.get(idx); } + + /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. @@ -294,7 +249,7 @@ @Override public List<ReportVariableKey> getTitleAvailableVariables() { - List<ReportVariableKey> res = new ArrayList<ReportVariableKey>(); + List<ReportVariableKey> res = new ArrayList<>(); res.add(new ReportVariableKey(ReportVariableTypeEnum.EXPR, ReportExpressionHelper.EXPR_NOM)); res.add(new ReportVariableKey(ReportVariableTypeEnum.EXPR, ReportExpressionHelper.EXPR_COMMENTAIRE)); res.add(new ReportVariableKey(ReportVariableTypeEnum.EXPR, ReportExpressionHelper.EXPR_PROFIL_COMMENTAIRE)); @@ -312,7 +267,7 @@ return res; } - public void choose(final int inc) { + public void chooseFromDelta(final int inc) { CatEMHSection section = (CatEMHSection) reportService.getRunCourant().getEMH(content.getSectionName()); CatEMHSection findSection = findSection(section, inc); if (findSection != null) { Modified: trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/transversal/Bundle.properties =================================================================== --- trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/transversal/Bundle.properties 2014-06-04 11:12:37 UTC (rev 8754) +++ trunk/soft/fudaa-crue/ui-report/src/main/resources/org/fudaa/fudaa/crue/report/transversal/Bundle.properties 2014-06-09 19:54:19 UTC (rev 8755) @@ -3,13 +3,11 @@ ChooseVariable.DialogTitle=Choix des variables AddVariable.ButtonName=Variables ChooseSection.ButtonName=Section -ChooseSectionAmont.ButtonName=Amont -ChooseSectionAval.ButtonName=Aval +ChooseSectionAmont.ButtonName=Pr\u00e9c. +ChooseSectionAval.ButtonName=Suiv. ChooseSectionName.Label=Section \u00e0 utiliser: ChooseSection.DialogTitle=Profil en travers SectionNavigation.InfoDialog=Navigation -NoAmontSectionWithResultat.DialogContent=Aucune section amont n'a \u00e9t\u00e9 trouv\u00e9e -SeveralAmontBranche.DialogContent=La navigation vers l'amont est impossible: plusieurs branches amont +NoAmontSectionWithResultat.DialogContent=Aucune section amont n'a \u00e9t\u00e9 trouv\u00e9e NoAvalSectionWithResultat.DialogContent=Aucune section aval n'a \u00e9t\u00e9 trouv\u00e9e -SeveralAvalBranche.DialogContent=La navigation vers l'aval est impossible: plusieurs branches aval ConfigureTitle.Action=Configurer le titre This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |