for (Iterator i = getAttributeNames().iterator(); i.hasNext();) {
String name = i.next().toString();
- s += " " + name + "=" + ((JSONObject) json.get(1)).get(name);
+ s += " " + name + "=";
+ JSONValue v = ((JSONObject) json.get(1)).get(name);
+ if (v.isString() != null) s += v;
+ else s += "\"" + v + "\"";
}
s += ">\n";
return s;
}
+ public String getChildrenAsXML() {
+ String s="";
+ Iterator i = getChildIterator();
+ while (i.hasNext()) {
+ Object c = i.next();
+ s += c.toString();
+ }
+ return s;
+ }
+
public UIDLBrowser print_r() {
return new UIDLBrowser();
}
package com.itmill.toolkit.terminal.gwt.client.ui;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
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 TkLabel extends Label implements Paintable {
+public class TkLabel extends HTML implements Paintable {
public void updateFromUIDL(UIDL uidl, Client client) {
return;
client.delegateCaptionToParent(this, uidl);
- try {
+ String mode = uidl.getStringAttribute("mode");
+ if (mode == null || "text".equals(mode))
setText(uidl.getChildString(0));
- } catch (Exception e) {
+ else if ("pre".equals(mode)) {
+ setHTML(uidl.getChildrenAsXML());
+ } else if ("uidl".equals(mode)) {
+ setHTML(uidl.getChildrenAsXML());
+ } else if ("xhtml".equals(mode)) {
+ setHTML(uidl.getChildUIDL(0).getChildUIDL(0).getChildString(0));
+ } else if ("xml".equals(mode)) {
+ setHTML(uidl.getChildUIDL(0).getChildString(0));
+ } else if ("raw".equals(mode)) {
+ setHTML(uidl.getChildUIDL(0).getChildString(0));
+ } else {
setText("");
-
}
}
}