aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetFactory.java3
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/TkSelect.java38
2 files changed, 41 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetFactory.java b/src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetFactory.java
index f6a4646c10..c381406fd2 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetFactory.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/DefaultWidgetFactory.java
@@ -5,6 +5,7 @@ import com.itmill.toolkit.terminal.gwt.client.ui.TkButton;
import com.itmill.toolkit.terminal.gwt.client.ui.TkGridLayout;
import com.itmill.toolkit.terminal.gwt.client.ui.TkLabel;
import com.itmill.toolkit.terminal.gwt.client.ui.TkOrderedLayout;
+import com.itmill.toolkit.terminal.gwt.client.ui.TkSelect;
import com.itmill.toolkit.terminal.gwt.client.ui.TkTree;
import com.itmill.toolkit.terminal.gwt.client.ui.TkUnknownComponent;
import com.itmill.toolkit.terminal.gwt.client.ui.TkWindow;
@@ -25,6 +26,8 @@ public class DefaultWidgetFactory implements WidgetFactory {
return new TkGridLayout();
if ("tree".equals(tag))
return new TkTree();
+ if ("select".equals(tag))
+ return new TkSelect();
return new TkUnknownComponent();
}
diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/TkSelect.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/TkSelect.java
new file mode 100644
index 0000000000..91c8fdc222
--- /dev/null
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/TkSelect.java
@@ -0,0 +1,38 @@
+package com.itmill.toolkit.terminal.gwt.client.ui;
+
+import java.util.Iterator;
+
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TreeItem;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+import com.itmill.toolkit.terminal.gwt.client.Client;
+import com.itmill.toolkit.terminal.gwt.client.Paintable;
+import com.itmill.toolkit.terminal.gwt.client.UIDL;
+
+public class TkSelect extends Composite implements Paintable {
+
+ Label caption = new Label();
+ ListBox select = new ListBox();
+
+ public TkSelect() {
+ VerticalPanel panel = new VerticalPanel();
+ panel.add(caption);
+ panel.add(select);
+ initWidget(panel);
+ }
+
+ public void updateFromUIDL(UIDL uidl, Client client) {
+
+ if (uidl.hasAttribute("caption")) caption.setText(uidl.getStringAttribute("caption"));
+
+ UIDL options = uidl.getChildUIDL(0);
+
+ for (Iterator i = options.getChildIterator(); i.hasNext();) {
+ UIDL optionUidl = (UIDL)i.next();
+ select.addItem(optionUidl.getStringAttribute("caption"), optionUidl.getStringAttribute("key"));
+ }
+ }
+}