diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java @ 4184:03de5c424f95

Fix warnings and minor TODOs in flys-client.
author Christian Lins <christian.lins@intevation.de>
date Fri, 19 Oct 2012 09:29:57 +0200
parents 8a16ff3b9a7f
children af2aa716152f
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Oct 19 09:20:52 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Fri Oct 19 09:29:57 2012 +0200
@@ -1,13 +1,10 @@
 package de.intevation.flys.client.client.ui;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
+import com.smartgwt.client.util.BooleanCallback;
 import com.smartgwt.client.util.SC;
-import com.smartgwt.client.util.BooleanCallback;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -20,13 +17,6 @@
 import com.smartgwt.client.widgets.menu.events.ClickHandler;
 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
 
-import de.intevation.flys.client.shared.model.Collection;
-import de.intevation.flys.client.shared.model.CollectionItemAttribute;
-import de.intevation.flys.client.shared.model.FacetRecord;
-import de.intevation.flys.client.shared.model.OutputMode;
-import de.intevation.flys.client.shared.model.Theme;
-import de.intevation.flys.client.shared.model.ThemeList;
-
 import de.intevation.flys.client.client.Config;
 import de.intevation.flys.client.client.FLYSConstants;
 import de.intevation.flys.client.client.event.HasOutputParameterChangeHandlers;
@@ -35,13 +25,22 @@
 import de.intevation.flys.client.client.event.OnMoveHandler;
 import de.intevation.flys.client.client.event.OutputParameterChangeEvent;
 import de.intevation.flys.client.client.event.OutputParameterChangeHandler;
-import de.intevation.flys.client.client.event.RedrawRequestHandler;
 import de.intevation.flys.client.client.event.RedrawRequestEvent;
 import de.intevation.flys.client.client.event.RedrawRequestEvent.Type;
+import de.intevation.flys.client.client.event.RedrawRequestHandler;
 import de.intevation.flys.client.client.services.CollectionAttributeService;
 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync;
 import de.intevation.flys.client.client.services.CollectionItemAttributeService;
 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync;
+import de.intevation.flys.client.shared.model.Collection;
+import de.intevation.flys.client.shared.model.CollectionItemAttribute;
+import de.intevation.flys.client.shared.model.FacetRecord;
+import de.intevation.flys.client.shared.model.OutputMode;
+import de.intevation.flys.client.shared.model.Theme;
+import de.intevation.flys.client.shared.model.ThemeList;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * ThemePanel on the left in CollectionView.
@@ -93,8 +92,9 @@
         this.list       = createGrid();
         this.view       = view;
         list.addRowContextClickHandler(new RowContextClickHandler() {
+            @Override
             public void onRowContextClick(RowContextClickEvent event) {
-                ListGridRecord[] records = list.getSelection();
+                ListGridRecord[] records = list.getSelectedRecords();
 
                 Menu menu = null;
 
@@ -164,6 +164,7 @@
      *
      * @param h The new handler.
      */
+    @Override
     public void addOutputParameterChangeHandler(OutputParameterChangeHandler h){
         if (h != null) {
             outHandlers.add(h);
@@ -176,6 +177,7 @@
      *
      * @param h The new handler.
      */
+    @Override
     public void addRedrawRequestHandler(RedrawRequestHandler h){
         if (h != null) {
             redrawRequestHandlers.add(h);
@@ -298,6 +300,7 @@
         disable();
 
         updater.update(getCollection(), loc, new AsyncCallback<Collection>() {
+            @Override
             public void onFailure(Throwable caught) {
                 GWT.log("Could not update collection attributes.");
                 SC.warn(MSG.getString(caught.getMessage()));
@@ -306,6 +309,7 @@
             }
 
 
+            @Override
             public void onSuccess(Collection collection) {
                 setCollection(collection);
 
@@ -386,6 +390,7 @@
         MenuItem properties = new MenuItem(MSG.properties());
 
         properties.addClickHandler(new ClickHandler() {
+            @Override
             public void onClick(MenuItemClickEvent evt) {
                 GWT.log("clicked properties");
                 for (ListGridRecord record: records) {
@@ -402,6 +407,7 @@
         MenuItem activate = new MenuItem(MSG.activateTheme());
 
         activate.addClickHandler(new ClickHandler() {
+            @Override
             public void onClick(MenuItemClickEvent evt) {
                 for (ListGridRecord record: records) {
                     FacetRecord facet = (FacetRecord) record;
@@ -420,6 +426,7 @@
         MenuItem deactivate = new MenuItem(MSG.deactivateTheme());
 
         deactivate.addClickHandler(new ClickHandler() {
+            @Override
             public void onClick(MenuItemClickEvent evt) {
                 for (ListGridRecord record: records) {
                     FacetRecord facet = (FacetRecord) record;
@@ -451,6 +458,7 @@
         MenuItem remove = new MenuItem(MSG.removeTheme());
 
         remove.addClickHandler(new ClickHandler() {
+            @Override
             public void onClick(MenuItemClickEvent evt) {
                 SC.ask(MSG.askThemeRemove(), new BooleanCallback() {
                     @Override
@@ -497,7 +505,7 @@
      * @param newIdx The index of the theme after it was moved.
      */
     protected void fireThemeMoved(Theme theme, int oldIdx, int newIdx) {
-        // TODO Implement in subclasses
+        // Do nothing
     }
 
 
@@ -507,7 +515,7 @@
 
         GWT.log("ThemePanel.onMove: " + type);
 
-        ListGridRecord[] records = list.getSelection();
+        ListGridRecord[] records = list.getSelectedRecords();
 
         if (records == null || records.length == 0) {
             GWT.log("ThemePanel.onMove: No records selected.");
@@ -626,9 +634,11 @@
             artifact,
             locale,
             new AsyncCallback<CollectionItemAttribute>() {
+                @Override
                 public void onFailure (Throwable caught) {
                     SC.warn(MSG.getString(caught.getMessage()));
                 }
+                @Override
                 public void onSuccess(CollectionItemAttribute cia) {
                     GWT.log("Successfully loaded collectionitem attributes.");
                     showStyleEditor(cia, record);

http://dive4elements.wald.intevation.org