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

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