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.

CoverflowWidgetSet.java 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.demo.coverflow.gwt.client;
  5. import com.vaadin.demo.coverflow.gwt.client.ui.ICoverflow;
  6. import com.vaadin.terminal.gwt.client.DefaultWidgetSet;
  7. import com.vaadin.terminal.gwt.client.Paintable;
  8. import com.vaadin.terminal.gwt.client.UIDL;
  9. public class CoverflowWidgetSet extends DefaultWidgetSet {
  10. /** Creates a widget according to its class name. */
  11. public Paintable createWidget(UIDL uidl) {
  12. final Class classType = resolveWidgetType(uidl);
  13. if (ICoverflow.class == classType) {
  14. return new ICoverflow();
  15. }
  16. // Let the DefaultWidgetSet handle creation of default widgets
  17. return super.createWidget(uidl);
  18. }
  19. /** Resolves UIDL tag name to class . */
  20. protected Class resolveWidgetType(UIDL uidl) {
  21. final String tag = uidl.getTag();
  22. if ("cover".equals(tag)) {
  23. return ICoverflow.class;
  24. }
  25. // Let the DefaultWidgetSet handle resolution of default widgets
  26. return super.resolveWidgetType(uidl);
  27. }
  28. }