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.

WidgetMap.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client;
  5. import com.vaadin.terminal.gwt.client.ui.VDateFieldCalendar;
  6. import com.vaadin.terminal.gwt.client.ui.VPasswordField;
  7. import com.vaadin.terminal.gwt.client.ui.VSplitPanelVertical;
  8. import com.vaadin.terminal.gwt.client.ui.VTextArea;
  9. import com.vaadin.terminal.gwt.client.ui.VWindow;
  10. public abstract class WidgetMap {
  11. public Paintable instantiate(Class<? extends Paintable> classType) {
  12. /*
  13. * Yes, this (including the generated) may look very odd code, but due
  14. * the nature of GWT, we cannot do this with reflect. Luckily this is
  15. * mostly written by WidgetSetGenerator, here are just some hacks. Extra
  16. * instantiation code is needed if client side widget has no "native"
  17. * counterpart on client side.
  18. */
  19. if (VSplitPanelVertical.class == classType) {
  20. return new VSplitPanelVertical();
  21. } else if (VTextArea.class == classType) {
  22. return new VTextArea();
  23. } else if (VDateFieldCalendar.class == classType) {
  24. return new VDateFieldCalendar();
  25. } else if (VPasswordField.class == classType) {
  26. return new VPasswordField();
  27. } else if (VWindow.class == classType) {
  28. return new VWindow();
  29. } else {
  30. return null; // let generated type handle this
  31. }
  32. }
  33. public abstract Class<? extends Paintable> getImplementationByServerSideClassName(
  34. String fullyqualifiedName);
  35. }