Mercurial > dive4elements > river
changeset 2463:0eeceffd50e3
Make synchron navigation of CrossSections a per-theme option, not global one.
flys-client/trunk@4170 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Mar 2012 11:59:37 +0000 |
parents | d45059aa8507 |
children | 7568d97d74ce |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java |
diffstat | 2 files changed, 34 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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 <felix.wolfsteller@intevation.de> + + * 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 <felix.wolfsteller@intevation.de> Fix flys/issue462, hinted to by Raimund Renkert.
--- 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<String, String> 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<Artifact> artifacts = new ArrayList<Artifact>(); 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); }