您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ColorPickerWidgetSet.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.itmill.toolkit.demo.colorpicker.gwt.client;
  5. import com.google.gwt.user.client.ui.Widget;
  6. import com.itmill.toolkit.demo.colorpicker.gwt.client.ui.IColorPicker;
  7. import com.itmill.toolkit.terminal.gwt.client.DefaultWidgetSet;
  8. import com.itmill.toolkit.terminal.gwt.client.UIDL;
  9. public class ColorPickerWidgetSet extends DefaultWidgetSet {
  10. /** Creates a widget according to its class name. */
  11. public Widget createWidget(UIDL uidl) {
  12. final String className = resolveWidgetTypeName(uidl);
  13. if ("com.itmill.toolkit.demo.colorpicker.gwt.client.ui.IColorPicker"
  14. .equals(className)) {
  15. return new IColorPicker();
  16. }
  17. // Let the DefaultWidgetSet handle creation of default widgets
  18. return super.createWidget(uidl);
  19. }
  20. /** Resolves UIDL tag name to class name. */
  21. protected String resolveWidgetTypeName(UIDL uidl) {
  22. final String tag = uidl.getTag();
  23. if ("colorpicker".equals(tag)) {
  24. return "com.itmill.toolkit.demo.colorpicker.gwt.client.ui.IColorPicker";
  25. }
  26. // Let the DefaultWidgetSet handle resolution of default widgets
  27. return super.resolveWidgetTypeName(uidl);
  28. }
  29. }