changeset 1555:c057ef91b268

Refactored Collection reference out of Panels. flys-client/trunk@3794 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 27 Jan 2012 13:02:38 +0000
parents ae25566ce6f6
children 3324ef9d8341
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java
diffstat 7 files changed, 32 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/ChangeLog	Fri Jan 27 13:02:38 2012 +0000
@@ -1,3 +1,14 @@
+2012-01-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java,
+	  src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java:
+	  Refactored to not hold own reference to Collection, always use Views
+	  one instead.
+
 2012-01-27  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/RangeData.java: New
@@ -15,6 +26,11 @@
 
 2012-01-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
 
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
+	  Added i18n for points-button.
+
+2012-01-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
 	  Transfer name of points.
 	  Resolved various i18n TODOs.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Jan 27 13:02:38 2012 +0000
@@ -74,7 +74,6 @@
     /** List of ChartShallRedrawHandler. */
     protected List<RedrawRequestHandler> redrawRequestHandlers;
 
-    protected Collection collection;
     protected OutputMode mode;
 
     protected ThemeNavigationPanel navigation;
@@ -89,11 +88,9 @@
      * @param collection Collection for which to show themes.
      */
     public ThemePanel(
-        Collection collection,
         OutputMode mode,
         CollectionView view
     ) {
-        this.collection = collection;
         this.mode       = mode;
         this.list       = createGrid();
         this.view       = view;
@@ -139,7 +136,8 @@
      * @param collection The new collection object.
      */
     protected void setCollection(Collection collection) {
-        this.collection = collection;
+        // Set collection of view, but do not trigger event shooting.
+        this.view.setCollection(collection, true);
 
         updateGrid();
     }
@@ -147,7 +145,7 @@
 
     /** Get Collection. */
     public Collection getCollection() {
-        return collection;
+        return view.getCollection();
     }
 
 
@@ -157,7 +155,7 @@
      * @return the current ThemeList.
      */
     public ThemeList getThemeList() {
-        return collection.getThemeList(mode.getName());
+        return getCollection().getThemeList(mode.getName());
     }
 
 
@@ -294,7 +292,7 @@
         // Don't forget to enable the panel after the request has finished!
         disable();
 
-        updater.update(collection, loc, new AsyncCallback<Collection>() {
+        updater.update(getCollection(), loc, new AsyncCallback<Collection>() {
             public void onFailure(Throwable caught) {
                 GWT.log("Could not update collection attributes.");
                 SC.warn(MSG.getString(caught.getMessage()));
@@ -612,7 +610,7 @@
         String artifact = record.getTheme().getArtifact();
 
         itemAttributeService.getCollectionItemAttribute(
-            this.collection,
+            this.getCollection(),
             artifact,
             locale,
             new AsyncCallback<CollectionItemAttribute>() {
@@ -632,7 +630,7 @@
         FacetRecord record)
     {
         StyleEditorWindow win = new StyleEditorWindow(
-            collection,
+            getCollection(),
             cia,
             record);
         win.setThemePanel(this);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Fri Jan 27 13:02:38 2012 +0000
@@ -136,10 +136,10 @@
         // Output "cross_section" needs slightly modified ThemePanel
         // (with action buttons).
         if (mode.getName().equals("cross_section")) {
-            ctp = new CrossSectionChartThemePanel(collection, mode, this.view);
+            ctp = new CrossSectionChartThemePanel(mode, this.view);
         }
         else {
-            ctp = new ChartThemePanel(collection, mode, this.view);
+            ctp = new ChartThemePanel(mode, this.view);
         }
 
         ctp.addRedrawRequestHandler(this);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java	Fri Jan 27 13:02:38 2012 +0000
@@ -54,9 +54,6 @@
     /** The interface that provides i18n messages. */
     protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
-    /** The collection */
-    protected Collection collection;
-
     public static final String GRID_FIELD_ACTIVE  = "active";
     public static final String GRID_FIELD_NAME    = "name";
     public static final String GRID_FIELD_ACTIONS = "actions";
@@ -67,12 +64,10 @@
 
     /** Constructor for a ChartThemePanel. */
     public ChartThemePanel(
-        Collection collection,
         OutputMode mode,
         CollectionView view
     ) {
-        super(collection, mode, view);
-        this.collection = collection;
+        super(mode, view);
 
         initGrid();
         initLayout();
@@ -253,7 +248,7 @@
         Recommendation[] recommendations = new Recommendation[] {area};
 
         loadService.loadMany(
-            this.collection,
+            this.getCollection(),
             recommendations,
             null, //use individual factories.
             locale,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Fri Jan 27 13:02:38 2012 +0000
@@ -96,11 +96,10 @@
      * Trivial constructor.
      */
     public CrossSectionChartThemePanel(
-        Collection collection,
         OutputMode mode,
         CollectionView view)
     {
-        super(collection, mode, view);
+        super(mode, view);
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Fri Jan 27 13:02:38 2012 +0000
@@ -450,7 +450,7 @@
         c.setBorder("1px solid black");
 
         themePanel = new MapThemePanel(
-            collection,
+            this.getCollectionView(),
             mode,
             this,
             new MapThemePanel.ActivateCallback() {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Fri Jan 27 12:47:25 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Fri Jan 27 13:02:38 2012 +0000
@@ -27,6 +27,7 @@
 import de.intevation.flys.client.shared.model.OutputMode;
 
 import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.client.ui.CollectionView;
 import de.intevation.flys.client.client.ui.ThemePanel;
 
 
@@ -73,24 +74,14 @@
 
 
     public MapThemePanel(
-        Collection         collection,
-        MapOutputTab       mapOut,
-        OutputMode         mode,
-        ActivateCallback   activateCallback
-    ) {
-        this(collection, mode, mapOut, activateCallback, null, null);
-    }
-
-
-    public MapThemePanel(
-        Collection         collection,
+        CollectionView     view,
         OutputMode         mode,
         MapOutputTab       mapOut,
         ActivateCallback   activateCallback,
         ThemeMovedCallback themeMovedCallback,
         LayerZoomCallback  layerZoomCallback
     ) {
-        super(collection, mode, null);
+        super(mode, view);
 
         this.mapOut             = mapOut;
         this.activateCallback   = activateCallback;

http://dive4elements.wald.intevation.org