comparison 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
comparison
equal deleted inserted replaced
1554:ae25566ce6f6 1555:c057ef91b268
72 protected List<OutputParameterChangeHandler> outHandlers; 72 protected List<OutputParameterChangeHandler> outHandlers;
73 73
74 /** List of ChartShallRedrawHandler. */ 74 /** List of ChartShallRedrawHandler. */
75 protected List<RedrawRequestHandler> redrawRequestHandlers; 75 protected List<RedrawRequestHandler> redrawRequestHandlers;
76 76
77 protected Collection collection;
78 protected OutputMode mode; 77 protected OutputMode mode;
79 78
80 protected ThemeNavigationPanel navigation; 79 protected ThemeNavigationPanel navigation;
81 protected ListGrid list; 80 protected ListGrid list;
82 81
87 /** 86 /**
88 * Setup Grid, navigation bar. 87 * Setup Grid, navigation bar.
89 * @param collection Collection for which to show themes. 88 * @param collection Collection for which to show themes.
90 */ 89 */
91 public ThemePanel( 90 public ThemePanel(
92 Collection collection,
93 OutputMode mode, 91 OutputMode mode,
94 CollectionView view 92 CollectionView view
95 ) { 93 ) {
96 this.collection = collection;
97 this.mode = mode; 94 this.mode = mode;
98 this.list = createGrid(); 95 this.list = createGrid();
99 this.view = view; 96 this.view = view;
100 list.addRowContextClickHandler(new RowContextClickHandler() { 97 list.addRowContextClickHandler(new RowContextClickHandler() {
101 public void onRowContextClick(RowContextClickEvent event) { 98 public void onRowContextClick(RowContextClickEvent event) {
137 * triggers updateGrid() which modifies the themes in the grid.</b> 134 * triggers updateGrid() which modifies the themes in the grid.</b>
138 * 135 *
139 * @param collection The new collection object. 136 * @param collection The new collection object.
140 */ 137 */
141 protected void setCollection(Collection collection) { 138 protected void setCollection(Collection collection) {
142 this.collection = collection; 139 // Set collection of view, but do not trigger event shooting.
140 this.view.setCollection(collection, true);
143 141
144 updateGrid(); 142 updateGrid();
145 } 143 }
146 144
147 145
148 /** Get Collection. */ 146 /** Get Collection. */
149 public Collection getCollection() { 147 public Collection getCollection() {
150 return collection; 148 return view.getCollection();
151 } 149 }
152 150
153 151
154 /** 152 /**
155 * Returns the ThemeList of the current collection and output mode. 153 * Returns the ThemeList of the current collection and output mode.
156 * 154 *
157 * @return the current ThemeList. 155 * @return the current ThemeList.
158 */ 156 */
159 public ThemeList getThemeList() { 157 public ThemeList getThemeList() {
160 return collection.getThemeList(mode.getName()); 158 return getCollection().getThemeList(mode.getName());
161 } 159 }
162 160
163 161
164 /** 162 /**
165 * Registers a new OutputParameterChangeHandler. 163 * Registers a new OutputParameterChangeHandler.
292 GWT.log("ThemePanel.updateCollection via RPC now"); 290 GWT.log("ThemePanel.updateCollection via RPC now");
293 291
294 // Don't forget to enable the panel after the request has finished! 292 // Don't forget to enable the panel after the request has finished!
295 disable(); 293 disable();
296 294
297 updater.update(collection, loc, new AsyncCallback<Collection>() { 295 updater.update(getCollection(), loc, new AsyncCallback<Collection>() {
298 public void onFailure(Throwable caught) { 296 public void onFailure(Throwable caught) {
299 GWT.log("Could not update collection attributes."); 297 GWT.log("Could not update collection attributes.");
300 SC.warn(MSG.getString(caught.getMessage())); 298 SC.warn(MSG.getString(caught.getMessage()));
301 299
302 enable(); 300 enable();
610 String locale = config.getLocale(); 608 String locale = config.getLocale();
611 609
612 String artifact = record.getTheme().getArtifact(); 610 String artifact = record.getTheme().getArtifact();
613 611
614 itemAttributeService.getCollectionItemAttribute( 612 itemAttributeService.getCollectionItemAttribute(
615 this.collection, 613 this.getCollection(),
616 artifact, 614 artifact,
617 locale, 615 locale,
618 new AsyncCallback<CollectionItemAttribute>() { 616 new AsyncCallback<CollectionItemAttribute>() {
619 public void onFailure (Throwable caught) { 617 public void onFailure (Throwable caught) {
620 SC.warn(MSG.getString(caught.getMessage())); 618 SC.warn(MSG.getString(caught.getMessage()));
630 protected void showStyleEditor( 628 protected void showStyleEditor(
631 CollectionItemAttribute cia, 629 CollectionItemAttribute cia,
632 FacetRecord record) 630 FacetRecord record)
633 { 631 {
634 StyleEditorWindow win = new StyleEditorWindow( 632 StyleEditorWindow win = new StyleEditorWindow(
635 collection, 633 getCollection(),
636 cia, 634 cia,
637 record); 635 record);
638 win.setThemePanel(this); 636 win.setThemePanel(this);
639 win.centerInPage(); 637 win.centerInPage();
640 win.show(); 638 win.show();

http://dive4elements.wald.intevation.org