public abstract class AbstractComponentConnector extends AbstractConnector implements ComponentConnector
Modifier and Type | Field and Description |
---|---|
protected int |
SIGNIFICANT_MOVE_THRESHOLD |
Constructor and Description |
---|
AbstractComponentConnector()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected com.google.gwt.user.client.ui.Widget |
createWidget()
Creates and returns the widget for this VPaintableWidget.
|
boolean |
delegateCaptionHandling()
Return true if parent handles caption, false if the paintable handles the
caption itself.
|
void |
flush()
Called for the active (focused) connector when a situation occurs that
the focused connector might have buffered changes which need to be
processed before other activity takes place.
|
protected Icon |
getIcon()
Gets the icon set for this component.
|
protected String |
getIconUri()
Gets the URI of the icon set for this component.
|
LayoutManager |
getLayoutManager() |
AbstractComponentState |
getState()
Returns the shared state object for this connector.
|
TooltipInfo |
getTooltipInfo(com.google.gwt.dom.client.Element element)
Gets the tooltip info for the given element.
|
com.google.gwt.user.client.ui.Widget |
getWidget()
Returns the widget associated with this paintable.
|
boolean |
hasTooltip()
Check whether there might be a tooltip for this component.
|
boolean |
isReadOnly()
Deprecated.
|
static boolean |
isRealUpdate(UIDL uidl)
Deprecated.
|
boolean |
isRelativeHeight()
Returns
true if the height of this paintable is currently
relative. |
boolean |
isRelativeWidth()
Returns
true if the width of this paintable is currently
relative. |
boolean |
isUndefinedHeight()
Returns
true if the height of this paintable is currently
undefined. |
boolean |
isUndefinedWidth()
Returns
true if the width of this paintable is currently
undefined. |
void |
onStateChanged(StateChangeEvent stateChangeEvent)
Notifies the event handler that the state has changed.
|
void |
onUnregister()
Event called when connector has been unregistered.
|
protected void |
registerTouchHandlers()
The new default behaviour is for long taps to fire a contextclick event
if there's a contextclick listener attached to the component.
|
protected void |
sendContextClickEvent(MouseEventDetails details,
com.google.gwt.dom.client.EventTarget eventTarget)
This method sends the context menu event to the server-side.
|
void |
setWidgetEnabled(boolean widgetEnabled)
Sets the enabled state of the widget associated to this connector.
|
protected void |
setWidgetStyleName(String styleName,
boolean add)
This is used to add / remove state related style names from the widget.
|
protected void |
setWidgetStyleNameWithPrefix(String prefix,
String styleName,
boolean add)
Deprecated.
This will be removed once styles are no longer added with
prefixes.
|
protected boolean |
shouldHandleLongTap() |
protected void |
unregisterTouchHandlers()
The new default behaviour is for long taps to fire a contextclick event
if there's a contextclick listener attached to the component.
|
protected void |
updateComponentSize()
Updates the component size based on the shared state, invoking the
layout manager if necessary. |
protected void |
updateComponentSize(String newWidth,
String newHeight)
Updates the component size, invoking the
layout
manager if necessary. |
void |
updateEnabledState(boolean enabledState) |
protected void |
updateWidgetSize(String newWidth,
String newHeight)
Updates the DOM size of this connector's
widget . |
protected void |
updateWidgetStyleNames()
Updates the user defined, read-only and error style names for the widget
based the shared state.
|
addStateChangeHandler, addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, forceStateChange, getChildren, getConnection, getConnectorId, getParent, getResourceUrl, getRpcImplementations, getRpcProxy, getStateType, hasEventListener, init, isEnabled, registerRpc, removeStateChangeHandler, removeStateChangeHandler, setChildren, setParent, unregisterRpc
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addStateChangeHandler, addStateChangeHandler, doInit, fireEvent, getChildren, getConnection, getParent, getRpcImplementations, hasEventListener, isEnabled, removeStateChangeHandler, removeStateChangeHandler, setChildren, setParent
getConnectorId
public AbstractComponentConnector()
protected void unregisterTouchHandlers()
protected void registerTouchHandlers()
protected boolean shouldHandleLongTap()
protected void sendContextClickEvent(MouseEventDetails details, com.google.gwt.dom.client.EventTarget eventTarget)
event
- protected com.google.gwt.user.client.ui.Widget createWidget()
You should typically not override this method since the framework by
default generates an implementation that uses GWT.create(Class)
to create a widget of the same type as returned by the most specific
override of getWidget()
. If you do override the method, you
can't call super.createWidget()
since the metadata needed
for that implementation is not generated if there's an override of the
method.
public com.google.gwt.user.client.ui.Widget getWidget()
getWidget
in interface ComponentConnector
@Deprecated public static boolean isRealUpdate(UIDL uidl)
public AbstractComponentState getState()
AbstractConnector
getState
in interface ComponentConnector
getState
in interface ServerConnector
getState
in class AbstractConnector
public void onStateChanged(StateChangeEvent stateChangeEvent)
StateChangeEvent.StateChangeHandler
onStateChanged
in interface StateChangeEvent.StateChangeHandler
onStateChanged
in class AbstractConnector
stateChangeEvent
- the state change event with details about the changepublic void setWidgetEnabled(boolean widgetEnabled)
ComponentConnector
setWidgetEnabled
in interface ComponentConnector
widgetEnabled
- true if the widget should be enabled, false otherwiseprotected void updateComponentSize()
layout manager
if necessary.protected void updateComponentSize(String newWidth, String newHeight)
layout
manager
if necessary.newWidth
- The new width as a CSS string. Cannot be null.newHeight
- The new height as a CSS string. Cannot be null.protected void updateWidgetSize(String newWidth, String newHeight)
widget
.newWidth
- The new width as a CSS string. Cannot be null.newHeight
- The new height as a CSS string. Cannot be null.public boolean isRelativeHeight()
ComponentConnector
true
if the height of this paintable is currently
relative. If the height is relative, the actual height of the paintable
is a percentage of the size allocated to it by its parent.isRelativeHeight
in interface ComponentConnector
true
if the width is undefined, else
false
public boolean isRelativeWidth()
ComponentConnector
true
if the width of this paintable is currently
relative. If the width is relative, the actual width of the paintable is
a percentage of the size allocated to it by its parent.isRelativeWidth
in interface ComponentConnector
true
if the width is undefined, else
false
public boolean isUndefinedHeight()
ComponentConnector
true
if the height of this paintable is currently
undefined. If the height is undefined, the actual height of the paintable
is defined by its contents.isUndefinedHeight
in interface ComponentConnector
true
if the height is undefined, else
false
public boolean isUndefinedWidth()
ComponentConnector
true
if the width of this paintable is currently
undefined. If the width is undefined, the actual width of the paintable
is defined by its contents.isUndefinedWidth
in interface ComponentConnector
true
if the width is undefined, else
false
public boolean delegateCaptionHandling()
ComponentConnector
This should always return true and all components should let the parent handle the caption and use other attributes for internal texts in the component
delegateCaptionHandling
in interface ComponentConnector
protected void updateWidgetStyleNames()
getWidget()
This method can be overridden to provide additional style names for the
component, for example see
AbstractFieldConnector.updateWidgetStyleNames()
protected void setWidgetStyleName(String styleName, boolean add)
Override this method for example if the style name given here should be
updated in another widget in addition to the one returned by the
getWidget()
.
styleName
- the style name to be added or removedadd
- true
to add the given style, false
to remove it@Deprecated protected void setWidgetStyleNameWithPrefix(String prefix, String styleName, boolean add)
Override this method if the prefixed style name given here should be
updated in another widget in addition to the one returned by the
Connector
's getWidget()
, or if the prefix should be
different. For example see
DateFieldConnector.setWidgetStyleNameWithPrefix(String, String, boolean)
styleName
- the style name to be added or removedadd
- true
to add the given style, false
to remove it@Deprecated public boolean isReadOnly()
ComponentConnector
isReadOnly
in interface ComponentConnector
public LayoutManager getLayoutManager()
getLayoutManager
in interface ComponentConnector
public void updateEnabledState(boolean enabledState)
updateEnabledState
in interface ServerConnector
updateEnabledState
in class AbstractConnector
public void onUnregister()
ServerConnector
onUnregister
in interface ServerConnector
onUnregister
in class AbstractConnector
public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element)
ComponentConnector
When overriding this method, ComponentConnector.hasTooltip()
should also be
overridden to return true
in all situations where this
method might return a non-empty result.
getTooltipInfo
in interface ComponentConnector
element
- The element to lookup a tooltip forpublic boolean hasTooltip()
ComponentConnector
ComponentConnector.getTooltipInfo(Element)
) if this method returns true.
This is only done to optimize performance, so in cases where the status
is not known, it's safer to return true
so that there will
be a tooltip handler even though it might not be needed in all cases.
hasTooltip
in interface ComponentConnector
true
if some part of the component might have a
tooltip, otherwise false
protected String getIconUri()
null
if no icon has been
defined.protected Icon getIcon()
null
if no icon has been defined.public void flush()
ComponentConnector
This is currently called when the user changes the fragment using the back/forward button in the browser and allows the focused field to submit its value to the server before the fragment change event takes place.
flush
in interface ComponentConnector
Copyright © 2023 Vaadin Ltd. All rights reserved.