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.4KB

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