Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

VisibilityChangeEvent.java 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2000-2021 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.ui.popupview;
  17. import com.google.gwt.event.shared.GwtEvent;
  18. /**
  19. * Event for popup visibility changes.
  20. *
  21. * @author Vaadin Ltd
  22. */
  23. public class VisibilityChangeEvent extends GwtEvent<VisibilityChangeHandler> {
  24. private static Type<VisibilityChangeHandler> type;
  25. private boolean visible;
  26. /**
  27. * Constructs a visibility change event.
  28. *
  29. * @param visible
  30. * {@code true} if the popup was made visible
  31. */
  32. public VisibilityChangeEvent(final boolean visible) {
  33. this.visible = visible;
  34. }
  35. /**
  36. * Returns whether the popup is now visible or not.
  37. *
  38. * @return {@code true} if the popup is visible, {@code false} otherwise
  39. */
  40. public boolean isVisible() {
  41. return visible;
  42. }
  43. @Override
  44. public Type<VisibilityChangeHandler> getAssociatedType() {
  45. return getType();
  46. }
  47. /**
  48. * Returns the {@link Type} used to register this event.
  49. *
  50. * @return the type
  51. */
  52. public static Type<VisibilityChangeHandler> getType() {
  53. if (type == null) {
  54. type = new Type<>();
  55. }
  56. return type;
  57. }
  58. @Override
  59. protected void dispatch(final VisibilityChangeHandler handler) {
  60. handler.onVisibilityChange(this);
  61. }
  62. }