diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java @ 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 cfe88143ee89
children 1c47de6ccfb1
line wrap: on
line diff
--- 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);

http://dive4elements.wald.intevation.org