diff flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java @ 858:9f07f67f60a5

Subclassed ChartThemePanel, trigger redraws of Chart when interaction with "Action" widgets in ThemePanel occured (but will still crash). flys-client/trunk@2651 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 06 Sep 2011 11:09:13 +0000
parents 67c678903280
children f6c14ffdfd07
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java	Tue Sep 06 10:58:32 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java	Tue Sep 06 11:09:13 2011 +0000
@@ -2,22 +2,10 @@
 
 import com.google.gwt.core.client.GWT;
 
-import com.smartgwt.client.types.Alignment; 
-import com.smartgwt.client.widgets.Canvas;
-import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
 import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.form.fields.SpinnerItem;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
 
-import de.intevation.flys.client.client.Config;
-import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.Theme;
 import de.intevation.flys.client.shared.model.OutputMode;
@@ -35,8 +23,7 @@
 public class ChartThemePanel extends ThemePanel {
 
     /** The interface that provides i18n messages. */
-    private FLYSConstants MSG = GWT.create(FLYSConstants.class);
-
+    protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
     public static final String GRID_FIELD_ACTIVE  = "active";
     public static final String GRID_FIELD_NAME    = "name";
@@ -56,75 +43,6 @@
 
 
     /**
-     * Create and configure the Grid to display.
-     */
-    protected ListGrid createGrid() {
-        ListGrid list = new ListGrid() {
-            @Override
-            protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) {
-                    GWT.log("createRecordComponent! " + this.getFieldName(colNum));
-
-                    String fieldName = this.getFieldName(colNum);
-
-                    if (fieldName.equals("actions")) {
-                        GWT.log("GG UU II: Put actopms");
-                        HLayout recordCanvas = new HLayout(3);
-                        recordCanvas.setHeight(22);
-                        recordCanvas.setAlign(Alignment.CENTER);
-                        // Grid Cell Widgets example
-                        SpinnerItem spinnerItem = new SpinnerItem();
-                        spinnerItem.setShowTitle(false);
-                        spinnerItem.setTitle("Waterlevel-Spinner");
-                        spinnerItem.setWidth(50);
-                        spinnerItem.setDefaultValue(5);
-                        spinnerItem.setMin(130);
-                        spinnerItem.setMax(1000);
-                        spinnerItem.setStep(5f);
-                        Config config = Config.getInstance();
-                        final String serverUrl = config.getServerUrl();
-                        final String locale = config.getLocale();
-
-                        spinnerItem.addChangedHandler(new ChangedHandler() {
-                                @Override
-                                public void onChanged(ChangedEvent ce) {
-                                    // artifact instead of null
-                                    // data[] instead of null
-                                    feedService.feed(serverUrl, locale, null, null,
-                                        new AsyncCallback<Artifact>() {
-                                            public void onFailure(Throwable caught) {
-                                                GWT.log("Could not feed artifact");
-                                                // TODO SC.warn 
-                                            }
-                                            public void onSuccess(Artifact artifact) {
-                                                GWT.log("Successfully fed");
-                                                //TODO and now?
-                                            }
-                                        });
-                                }
-                            }
-                        );
-
-                        DynamicForm formWrap = new DynamicForm();
-                        formWrap.setFields(spinnerItem);
-                        formWrap.setTitlePrefix("");
-                        formWrap.setTitleSuffix("");
-                        recordCanvas.addMember(formWrap);
-                        return recordCanvas;
-                    }
-                    else {
-                        return null;
-                    }
-                }
-            };
-        list.setCanResizeFields(true);
-        list.setShowRecordComponents(true);
-        list.setShowRecordComponentsByCell(true);
-        list.setShowAllRecords(true);
-        return list;
-    }
-
-
-    /**
      * Initializes the layout of this panel.
      */
     protected void initLayout() {
@@ -148,7 +66,7 @@
     protected void initGrid() {
         list.setCanEdit(true);
         list.setCanSort(false);
-        //list.setShowRecordComponents(false);
+        list.setShowRecordComponents(false);
         list.setShowRecordComponentsByCell(true);
         list.setShowHeader(true);
         list.setShowHeaderContextMenu(false);
@@ -164,12 +82,7 @@
             GRID_FIELD_NAME, MSG.chart_themepanel_header_themes());
         name.setType(ListGridFieldType.TEXT);
 
-        // TODO Visibility of this Field (~"column") shall depend on
-        // availability of facets allowing for actions.
-        ListGridField actions = new ListGridField(GRID_FIELD_ACTIONS,
-                GRID_FIELD_ACTIONS, 60);
-
-        list.setFields(active, name, actions);
+        list.setFields(active, name);
     }
 
 

http://dive4elements.wald.intevation.org