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.

ComponentConnector.java 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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;
  17. import com.google.gwt.dom.client.Element;
  18. import com.google.gwt.user.client.ui.Widget;
  19. import com.vaadin.shared.AbstractComponentState;
  20. /**
  21. * An interface used by client-side widgets or paintable parts to receive
  22. * updates from the corresponding server-side components in the form of
  23. * {@link UIDL}.
  24. *
  25. * Updates can be sent back to the server using the
  26. * {@link ApplicationConnection#updateVariable()} methods.
  27. */
  28. public interface ComponentConnector extends HasWidget {
  29. /*
  30. * (non-Javadoc)
  31. *
  32. * @see com.vaadin.client.VPaintable#getState()
  33. */
  34. @Override
  35. public AbstractComponentState getState();
  36. public LayoutManager getLayoutManager();
  37. /**
  38. * Returns <code>true</code> if the width of this paintable is currently
  39. * undefined. If the width is undefined, the actual width of the paintable
  40. * is defined by its contents.
  41. *
  42. * @return <code>true</code> if the width is undefined, else
  43. * <code>false</code>
  44. */
  45. public boolean isUndefinedWidth();
  46. /**
  47. * Returns <code>true</code> if the height of this paintable is currently
  48. * undefined. If the height is undefined, the actual height of the paintable
  49. * is defined by its contents.
  50. *
  51. * @return <code>true</code> if the height is undefined, else
  52. * <code>false</code>
  53. */
  54. public boolean isUndefinedHeight();
  55. /**
  56. * Returns <code>true</code> if the width of this paintable is currently
  57. * relative. If the width is relative, the actual width of the paintable is
  58. * a percentage of the size allocated to it by its parent.
  59. *
  60. * @return <code>true</code> if the width is undefined, else
  61. * <code>false</code>
  62. */
  63. public boolean isRelativeWidth();
  64. /**
  65. * Returns <code>true</code> if the height of this paintable is currently
  66. * relative. If the height is relative, the actual height of the paintable
  67. * is a percentage of the size allocated to it by its parent.
  68. *
  69. * @return <code>true</code> if the width is undefined, else
  70. * <code>false</code>
  71. */
  72. public boolean isRelativeHeight();
  73. /**
  74. * Return true if parent handles caption, false if the paintable handles the
  75. * caption itself.
  76. *
  77. * <p>
  78. * This should always return true and all components should let the parent
  79. * handle the caption and use other attributes for internal texts in the
  80. * component
  81. * </p>
  82. *
  83. * @return true if caption handling is delegated to the parent, false if
  84. * parent should not be allowed to render caption
  85. */
  86. public boolean delegateCaptionHandling();
  87. /**
  88. * Sets the enabled state of the widget associated to this connector.
  89. *
  90. * @param widgetEnabled
  91. * true if the widget should be enabled, false otherwise
  92. */
  93. public void setWidgetEnabled(boolean widgetEnabled);
  94. /**
  95. * Gets the tooltip info for the given element.
  96. * <p>
  97. * When overriding this method, {@link #hasTooltip()} should also be
  98. * overridden to return <code>true</code> in all situations where this
  99. * method might return a non-empty result.
  100. * </p>
  101. *
  102. * @param element
  103. * The element to lookup a tooltip for
  104. * @return The tooltip for the element or null if no tooltip is defined for
  105. * this element.
  106. */
  107. public TooltipInfo getTooltipInfo(Element element);
  108. /**
  109. * Check whether there might be a tooltip for this component. The framework
  110. * will only add event listeners for automatically handling tooltips (using
  111. * {@link #getTooltipInfo(Element)}) if this method returns true.
  112. * <p>
  113. * This is only done to optimize performance, so in cases where the status
  114. * is not known, it's safer to return <code>true</code> so that there will
  115. * be a tooltip handler even though it might not be needed in all cases.
  116. *
  117. * @return <code>true</code> if some part of the component might have a
  118. * tooltip, otherwise <code>false</code>
  119. */
  120. public boolean hasTooltip();
  121. /**
  122. * Called for the active (focused) connector when a situation occurs that
  123. * the focused connector might have buffered changes which need to be
  124. * processed before other activity takes place.
  125. * <p>
  126. * This is currently called when the user changes the fragment using the
  127. * back/forward button in the browser and allows the focused field to submit
  128. * its value to the server before the fragment change event takes place.
  129. * </p>
  130. */
  131. public void flush();
  132. }