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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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.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. * Return true if parent handles caption, false if the paintable handles the
  79. * caption itself.
  80. *
  81. * <p>
  82. * This should always return true and all components should let the parent
  83. * handle the caption and use other attributes for internal texts in the
  84. * component
  85. * </p>
  86. *
  87. * @return true if caption handling is delegated to the parent, false if
  88. * parent should not be allowed to render caption
  89. */
  90. public boolean delegateCaptionHandling();
  91. /**
  92. * Sets the enabled state of the widget associated to this connector.
  93. *
  94. * @param widgetEnabled
  95. * true if the widget should be enabled, false otherwise
  96. */
  97. public void setWidgetEnabled(boolean widgetEnabled);
  98. /**
  99. * Gets the tooltip info for the given element.
  100. * <p>
  101. * When overriding this method, {@link #hasTooltip()} should also be
  102. * overridden to return <code>true</code> in all situations where this
  103. * method might return a non-empty result.
  104. * </p>
  105. *
  106. * @param element
  107. * The element to lookup a tooltip for
  108. * @return The tooltip for the element or null if no tooltip is defined for
  109. * this element.
  110. */
  111. public TooltipInfo getTooltipInfo(Element element);
  112. /**
  113. * Check whether there might be a tooltip for this component. The framework
  114. * will only add event listeners for automatically handling tooltips (using
  115. * {@link #getTooltipInfo(Element)}) if this method returns true.
  116. * <p>
  117. * This is only done to optimize performance, so in cases where the status
  118. * is not known, it's safer to return <code>true</code> so that there will
  119. * be a tooltip handler even though it might not be needed in all cases.
  120. *
  121. * @return <code>true</code> if some part of the component might have a
  122. * tooltip, otherwise <code>false</code>
  123. */
  124. public boolean hasTooltip();
  125. /**
  126. * Called for the active (focused) connector when a situation occurs that
  127. * the focused connector might have buffered changes which need to be
  128. * processed before other activity takes place.
  129. * <p>
  130. * This is currently called when the user changes the fragment using the
  131. * back/forward button in the browser and allows the focused field to submit
  132. * its value to the server before the fragment change event takes place.
  133. * </p>
  134. */
  135. public void flush();
  136. }