diff flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java @ 2505:87ac5c532523

First part of the UI for fixing analysis parameter. flys-client/trunk@4350 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 07 May 2012 13:22:43 +0000
parents
children 8f528f5ae137
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java	Mon May 07 13:22:43 2012 +0000
@@ -0,0 +1,103 @@
+package de.intevation.flys.client.client.ui.fixation;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import com.google.gwt.core.client.GWT;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import de.intevation.flys.client.client.FLYSConstants;
+
+import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataList;
+
+/**
+ * This UIProvider creates a panel for location or distance input.
+ *
+ * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
+ */
+public class FixEventSelect
+extends      FixationPanel
+{
+    /** The message class that provides i18n strings. */
+    protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
+
+    protected List<String> events;
+
+    public FixEventSelect() {
+        htmlOverview = "";
+        events = new ArrayList<String>();
+    }
+
+    public Canvas createWidget(DataList data) {
+        instances.put(this.artifact.getUuid(), this);
+
+        VLayout layout = new VLayout();
+
+        Canvas title = new Label(MESSAGES.eventselect());
+        title.setHeight("25px");
+
+        layout.addMember(title);
+        return layout;
+    }
+
+    @Override
+    public Canvas createOld(DataList dataList) {
+        HLayout layout = new HLayout();
+        layout.setWidth("400px");
+
+        Label   label  = new Label(dataList.getLabel());
+        label.setWidth("200px");
+
+        Canvas back = getBackButton(dataList.getState());
+
+        layout.addMember(label);
+        layout.addMember(back);
+
+        return layout;
+    }
+
+
+    /**
+     * This method returns the selected data.
+     *
+     * @return the selected/inserted data.
+     */
+    public Data[] getData() {
+        List<Data> data = new ArrayList<Data>();
+
+        return (Data[]) data.toArray(new Data[data.size()]);
+    }
+
+
+    @Override
+    public void setValues(String cid, boolean checked) {
+        if (checked) {
+            events.add(cid);
+        }
+        else {
+            if (events.contains(cid)) {
+                events.remove(cid);
+            }
+        }
+    }
+
+
+    @Override
+    public boolean renderCheckboxes() {
+        return true;
+    }
+
+
+    public void dumpGWT(String cid) {
+        GWT.log("Setting values for cId: " + cid);
+        GWT.log("River: " + fixInfo.getRiver());
+        GWT.log("Date: " + fixInfo.getEventByCId(cid).getDate());
+        GWT.log("Name: " + fixInfo.getEventByCId(cid).getName());
+    }
+}

http://dive4elements.wald.intevation.org