# HG changeset patch # User Felix Wolfsteller # Date 1332244777 0 # Node ID 0eeceffd50e388a15c6430c26d010bf711fa35cd # Parent d45059aa850790f09a359e795b8096df1bdaed74 Make synchron navigation of CrossSections a per-theme option, not global one. flys-client/trunk@4170 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d45059aa8507 -r 0eeceffd50e3 flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Mar 20 11:08:20 2012 +0000 +++ b/flys-client/ChangeLog Tue Mar 20 11:59:37 2012 +0000 @@ -1,3 +1,8 @@ +2012-03-20 Felix Wolfsteller + + * src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java: + Make synchron navigation a per-theme option, not a global one. + 2012-03-20 Felix Wolfsteller Fix flys/issue462, hinted to by Raimund Renkert. diff -r d45059aa8507 -r 0eeceffd50e3 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java Tue Mar 20 11:08:20 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java Tue Mar 20 11:59:37 2012 +0000 @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.LinkedHashMap; import java.util.List; @@ -84,8 +85,8 @@ /** Data item name for CrossSections selected km. */ protected static String CS_IS_MASTER = "cross_section.master?"; - /** Whether or not to move through all cross sections synchronously. */ - protected boolean synchronNavigation; + /** List of cross-section themes through which is moved through synchronously. */ + protected HashSet synchronCrossSectionThemes = new HashSet(); /** Data for master artifact combobox.*/ protected LinkedHashMap masters; @@ -426,18 +427,19 @@ + closest); // Do not set value, as it will trigger strange - // "javascript" bugs. - //item.setValue(closest); - if (synchronNavigation) { - // Feed many ... - // Find all activated cross section themes + // "javascript" bugs. /*item.setValue(closest);*/ + if (synchronCrossSectionThemes.contains (themeHash + (facetRecord.getTheme()))) { + // Move all other synchrons ThemeList themes = getThemeList(); int nThemes = themes.getThemeCount(); List artifacts = new ArrayList(); for (int i = 0; i < nThemes; i++) { final Theme theme = themes.getThemeAt(i+1); if (theme.getFacet().equals("cross_section") && - theme.getActive() == 1) { + theme.getActive() == 1 && + synchronCrossSectionThemes.contains(themeHash(theme)) + ) { artifacts.add(artifactReference(theme.getArtifact())); } } @@ -459,8 +461,9 @@ * @param facetRecord The FacetRecord (~row in table) where this * handler is added to (to a child, to be exact). */ + // TODO obsolete? public final ChangedHandler createSpinnerHandler( - final FacetRecord facetRecord) + final FacetRecord facetRecord) { ChangedHandler handler = new ChangedHandler() { @@ -648,6 +651,11 @@ } + protected String themeHash(Theme theme) { + return theme.getArtifact() + theme.getFacet() + theme.getIndex(); + } + + /** * Include synchron navigation item. */ @@ -661,17 +669,23 @@ if(item.equals("cross_section")) { // Synchron checking. MenuItem synchronNavigationMenuItem = new MenuItem(); - if (synchronNavigation == true) { + final String themeHash = themeHash(facetTheme); + if (synchronCrossSectionThemes.contains(themeHash)) { synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_asynchron()); + synchronNavigationMenuItem.addClickHandler(new ClickHandler() { + public void onClick(MenuItemClickEvent evt) { + synchronCrossSectionThemes.remove (themeHash); + } + }); } else { synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_synchron()); + synchronNavigationMenuItem.addClickHandler(new ClickHandler() { + public void onClick(MenuItemClickEvent evt) { + synchronCrossSectionThemes.add (themeHash); + } + }); } - synchronNavigationMenuItem.addClickHandler(new ClickHandler() { - public void onClick(MenuItemClickEvent evt) { - synchronNavigation = !synchronNavigation; - } - }); contextMenu.addItem(synchronNavigationMenuItem); }