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 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.client;
  17. import java.util.HashMap;
  18. /**
  19. * Abstract class mapping between {@link ComponentConnector} instances and their
  20. * instances.
  21. *
  22. * A concrete implementation of this class is generated by WidgetMapGenerator or
  23. * one of its subclasses during widgetset compilation.
  24. */
  25. abstract class WidgetMap {
  26. protected static HashMap<Class<? extends ServerConnector>, WidgetInstantiator> instmap = new HashMap<Class<? extends ServerConnector>, WidgetInstantiator>();
  27. /**
  28. * Create a new instance of a connector based on its type.
  29. *
  30. * @param classType
  31. * {@link ComponentConnector} class to instantiate
  32. * @return new instance of the connector
  33. */
  34. public ServerConnector instantiate(
  35. Class<? extends ServerConnector> classType) {
  36. return instmap.get(classType).get();
  37. }
  38. /**
  39. * Return the connector class to use for a fully qualified server side
  40. * component class name.
  41. *
  42. * @param fullyqualifiedName
  43. * fully qualified name of the server side component class
  44. * @return component connector class to use
  45. */
  46. public abstract Class<? extends ServerConnector> getConnectorClassForServerSideClassName(
  47. String fullyqualifiedName);
  48. /**
  49. * Return the connector classes to load after the initial widgetset load and
  50. * start.
  51. *
  52. * @return component connector class to load after the initial widgetset
  53. * loading
  54. */
  55. public abstract Class<? extends ServerConnector>[] getDeferredLoadedConnectors();
  56. /**
  57. * Make sure the code for a (deferred or lazy) component connector type has
  58. * been loaded, triggering the load and waiting for its completion if
  59. * necessary.
  60. *
  61. * @param classType
  62. * component connector class
  63. */
  64. public abstract void ensureInstantiator(
  65. Class<? extends ServerConnector> classType);
  66. }