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.

UICreateEvent.java 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright 2000-2018 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.server;
  17. import com.vaadin.ui.UI;
  18. /**
  19. * Contains data used by various methods in {@link UIProvider} for determining
  20. * information about a new UI that is about to be created.
  21. *
  22. * @author Vaadin Ltd
  23. * @since 7.0.0
  24. */
  25. public class UICreateEvent extends UIProviderEvent {
  26. private final Class<? extends UI> uiClass;
  27. private final Integer uiId;
  28. /**
  29. * Creates a new UI create event for a given VaadinRequest and UI class but
  30. * without a UI id.
  31. *
  32. * @param request
  33. * the request for which the UI will be created
  34. * @param uiClass
  35. * the UI class that will be created
  36. */
  37. public UICreateEvent(VaadinRequest request, Class<? extends UI> uiClass) {
  38. this(request, uiClass, null);
  39. }
  40. /**
  41. * Creates a new UI create event for a given VaadinRequest, UI class and UI
  42. * id.
  43. *
  44. * @param request
  45. * the request for which the UI will be created
  46. * @param uiClass
  47. * the UI class that will be created
  48. * @param uiId
  49. * the id reserved for the UI; or <code>null</code> if no id has
  50. * yet been allocated.
  51. */
  52. public UICreateEvent(VaadinRequest request, Class<? extends UI> uiClass,
  53. Integer uiId) {
  54. super(request);
  55. this.uiClass = uiClass;
  56. this.uiId = uiId;
  57. }
  58. /**
  59. * Gets the UI class that will be created.
  60. *
  61. * @return the UI class
  62. */
  63. public Class<? extends UI> getUIClass() {
  64. return uiClass;
  65. }
  66. /**
  67. * Gets the id of the UI about to be created. This might be
  68. * <code>null</code> if the id has not yet been determined.
  69. * <p>
  70. * The UI id is generally only available in
  71. * {@link UIProvider#createInstance(UICreateEvent)}
  72. *
  73. * @return the UI id; or <code>null</code> if the UI id is not yet known.
  74. */
  75. public Integer getUiId() {
  76. return uiId;
  77. }
  78. }