You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ILabel.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.itmill.toolkit.terminal.gwt.client.ui;
  2. import com.google.gwt.user.client.ui.HTML;
  3. import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection;
  4. import com.itmill.toolkit.terminal.gwt.client.Paintable;
  5. import com.itmill.toolkit.terminal.gwt.client.UIDL;
  6. public class ILabel extends HTML implements Paintable {
  7. public static final String CLASSNAME = "i-label";
  8. public ILabel() {
  9. super();
  10. setStyleName(CLASSNAME);
  11. }
  12. public ILabel(String text) {
  13. super(text);
  14. setStyleName(CLASSNAME);
  15. }
  16. public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
  17. if (client.updateComponent(this, uidl, true))
  18. return;
  19. String mode = uidl.getStringAttribute("mode");
  20. if (mode == null || "text".equals(mode))
  21. setText(uidl.getChildString(0));
  22. else if ("pre".equals(mode)) {
  23. setHTML(uidl.getChildrenAsXML());
  24. } else if ("uidl".equals(mode)) {
  25. setHTML(uidl.getChildrenAsXML());
  26. } else if ("xhtml".equals(mode)) {
  27. setHTML(uidl.getChildUIDL(0).getChildUIDL(0).getChildString(0));
  28. } else if ("xml".equals(mode)) {
  29. setHTML(uidl.getChildUIDL(0).getChildString(0));
  30. } else if ("raw".equals(mode)) {
  31. setHTML(uidl.getChildUIDL(0).getChildString(0));
  32. } else {
  33. setText("");
  34. }
  35. }
  36. }