Class UIConnector
-
- All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler,StateChangeEvent.StateChangeHandler,ComponentConnector,ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler,HasComponentsConnector,HasWidget,Paintable,ServerConnector,HasErrorIndicator,MayScrollChildren,Connector,Serializable
public class UIConnector extends AbstractSingleComponentContainerConnector implements Paintable, MayScrollChildren
A connector class for the UI component. Eagerly loaded.- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.vaadin.client.ui.AbstractComponentConnector
SIGNIFICANT_MOVE_THRESHOLD
-
-
Constructor Summary
Constructors Constructor Description UIConnector()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidactivateTheme(String newTheme)Activates the new theme.voidanalyzeLayouts()Invokes the layout analyzer on the server.protected static voidforceStateChangeRecursively(AbstractConnector connector)Force a full recursive re-check of every connector's state variables.StringgetActiveTheme()Returns the name of the theme currently in used by the UI.protected ComponentConnectorgetContent()Returns the content (only/first child) of the container.PageStategetPageState()Returns the state of the Page associated with the UI.UIStategetState()Returns the shared state object for this connector.List<WindowConnector>getSubWindows()Return a list of current sub-windows.VUIgetWidget()Returns the widget associated with this paintable.booleanhasSubWindow(WindowConnector wc)Deprecated.Should be replaced by a more generic mechanism for getting non-ComponentConnector childrenbooleanhasTooltip()Check whether there might be a tooltip for this component.protected voidinit()Called when the connector has been initialized.voidinit(com.google.gwt.dom.client.Element rootPanelElement, ApplicationConnection applicationConnection)Initialize UIConnector and attach UI to the rootPanelElement.voidinit(String rootPanelId, ApplicationConnection applicationConnection)Initialize UIConnector and attach UI to RootPanel for rootPanelId element.booleanisMobileHTML5DndEnabled()Returns whether HTML5 DnD extensionsDragSourceExtensionConnectorandDropTargetExtensionConnectorand alike should be enabled for mobile devices.protected voidonChildSizeChange()Ensure the position is calculated correctly.voidonConnectorHierarchyChange(ConnectorHierarchyChangeEvent event)Called by the framework when the list of child components of the connector implementing this interface has changed.voidonStateChanged(StateChangeEvent stateChangeEvent)Notifies the event handler that the state has changed.protected voidreplaceTheme(String oldTheme, String newTheme, String oldThemeUrl, String newThemeUrl)Loads the new theme and removes references to the old theme.voidscrollIntoView(ComponentConnector componentConnector)Tries to scroll the viewport so that the given connector is in view.voidshowServerDebugInfo(ServerConnector serverConnector)Sends a request to the server to print details to console that will help the developer to locate the corresponding server-side connector in the source code.voidshowServerDesign(ServerConnector connector)Sends a request to the server to print a design to the console for the given component.voidupdateCaption(ComponentConnector component)Update child components caption, description and error message.voidupdateFromUIDL(UIDL uidl, ApplicationConnection client)-
Methods inherited from class com.vaadin.client.ui.AbstractSingleComponentContainerConnector
getContentWidget
-
Methods inherited from class com.vaadin.client.ui.AbstractHasComponentsConnector
addConnectorHierarchyChangeHandler, getChildComponents, setChildComponents
-
Methods inherited from class com.vaadin.client.ui.AbstractComponentConnector
createWidget, delegateCaptionHandling, flush, getIcon, getIconUri, getLayoutManager, getTooltipInfo, isErrorIndicatorVisible, isRealUpdate, isRelativeHeight, isRelativeWidth, isUndefinedHeight, isUndefinedWidth, onDragSourceAttached, onDragSourceDetached, onDropTargetAttached, onDropTargetDetached, onUnregister, registerTouchHandlers, sendContextClickEvent, setWidgetEnabled, setWidgetStyleName, setWidgetStyleNameWithPrefix, shouldHandleLongTap, unregisterTouchHandlers, updateComponentSize, updateComponentSize, updateEnabledState, updateWidgetSize, updateWidgetStyleNames
-
Methods inherited from class com.vaadin.client.ui.AbstractConnector
addStateChangeHandler, addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, forceStateChange, getChildren, getConnection, getConnectorId, getParent, getResourceUrl, getRpcImplementations, getRpcProxy, getStateType, getTag, hasEventListener, isEnabled, registerRpc, removeStateChangeHandler, removeStateChangeHandler, setChildren, setParent, setTag, unregisterRpc
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface com.vaadin.client.HasComponentsConnector
addConnectorHierarchyChangeHandler, getChildComponents, setChildComponents
-
Methods inherited from interface com.vaadin.client.ServerConnector
addStateChangeHandler, addStateChangeHandler, doInit, fireEvent, getChildren, getConnection, getParent, getRpcImplementations, getTag, hasEventListener, isEnabled, onUnregister, removeStateChangeHandler, removeStateChangeHandler, setChildren, setParent, setTag, updateEnabledState
-
-
-
-
Method Detail
-
init
protected void init()
Description copied from class:AbstractConnectorCalled when the connector has been initialized. Override this method to perform initialization of the connector.- Overrides:
initin classAbstractConnector
-
updateFromUIDL
public void updateFromUIDL(UIDL uidl, ApplicationConnection client)
- Specified by:
updateFromUIDLin interfacePaintable
-
init
public void init(com.google.gwt.dom.client.Element rootPanelElement, ApplicationConnection applicationConnection)Initialize UIConnector and attach UI to the rootPanelElement.- Parameters:
rootPanelElement- element to attach ui intoapplicationConnection- application connection- Since:
- 8.4
-
init
public void init(String rootPanelId, ApplicationConnection applicationConnection)
Initialize UIConnector and attach UI to RootPanel for rootPanelId element.- Parameters:
rootPanelId- root panel element idapplicationConnection- application connection
-
updateCaption
public void updateCaption(ComponentConnector component)
Description copied from interface:HasComponentsConnectorUpdate child components caption, description and error message.Each component is responsible for maintaining its caption, description and error message. In most cases components doesn't want to do that and those elements reside outside of the component. Because of this layouts must provide service for it's childen to show those elements for them.
- Specified by:
updateCaptionin interfaceHasComponentsConnector- Parameters:
component- Child component for which service is requested.
-
getWidget
public VUI getWidget()
Description copied from class:AbstractComponentConnectorReturns the widget associated with this paintable. The widget returned by this method must not changed during the life time of the paintable.- Specified by:
getWidgetin interfaceHasWidget- Overrides:
getWidgetin classAbstractComponentConnector- Returns:
- The widget associated with this paintable
-
getContent
protected ComponentConnector getContent()
Description copied from class:AbstractSingleComponentContainerConnectorReturns the content (only/first child) of the container.- Overrides:
getContentin classAbstractSingleComponentContainerConnector- Returns:
- child connector or null if none (e.g. invisible or not set on server)
-
onChildSizeChange
protected void onChildSizeChange()
Ensure the position is calculated correctly. This method should be called whenever the content's height changes for any reason, in case the change has been between a relative and non-relative height to either direction.
-
hasSubWindow
@Deprecated public boolean hasSubWindow(WindowConnector wc)
Deprecated.Should be replaced by a more generic mechanism for getting non-ComponentConnector childrenChecks if the given sub-window is a child of this UI Connector.- Parameters:
wc- the connector of the sub-window- Returns:
trueif the connector is found among the sub-windows,falseotherwise
-
getSubWindows
public List<WindowConnector> getSubWindows()
Return a list of current sub-windows. This method is meant for testing purposes only.- Returns:
- a list of sub-windows
-
getState
public UIState getState()
Description copied from class:AbstractConnectorReturns the shared state object for this connector. Override this method to define the shared state type for your connector.- Specified by:
getStatein interfaceComponentConnector- Specified by:
getStatein interfaceServerConnector- Overrides:
getStatein classAbstractComponentConnector- Returns:
- the current shared state (never null)
-
getPageState
public PageState getPageState()
Returns the state of the Page associated with the UI.Note that state is considered an internal part of the connector. You should not rely on the state object outside of the connector who owns it. If you depend on the state of other connectors you should use their public API instead of their state object directly. The page state might not be an independent state object but can be embedded in UI state.
- Returns:
- state object of the page
- Since:
- 7.1
-
onConnectorHierarchyChange
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event)
Description copied from interface:ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandlerCalled by the framework when the list of child components of the connector implementing this interface has changed. The implementation is responsible for attaching the widgets of any new children and detaching the widgets of any removed children. Implementations should typically also make sure that the child widgets are attached according to the ordering of the child components.This method is called after the shared state and hierarchy data (i.e.
AbstractHasComponentsConnector.setChildComponents(List)) been updated for all affected connectors, but before updating captions, firing state change events, invoking updateFromUIDL for legacy connectors, invoking RPC and starting the layout phase.Please note that hierarchy change events are fired in a non-deterministic order when a message from the server causes multiple parts of the hierarchy to change. This means that the old parent connector might not yet have detached a child widget and that the widget of a removed child might already have been attached by its new parent.
- Specified by:
onConnectorHierarchyChangein interfaceConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler- Parameters:
event- the event with information about the hierarchy change
-
hasTooltip
public boolean hasTooltip()
Description copied from interface:ComponentConnectorCheck whether there might be a tooltip for this component. The framework will only add event listeners for automatically handling tooltips (usingComponentConnector.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
trueso that there will be a tooltip handler even though it might not be needed in all cases.- Specified by:
hasTooltipin interfaceComponentConnector- Overrides:
hasTooltipin classAbstractComponentConnector- Returns:
trueif some part of the component might have a tooltip, otherwisefalse
-
scrollIntoView
public void scrollIntoView(ComponentConnector componentConnector)
Tries to scroll the viewport so that the given connector is in view.- Parameters:
componentConnector- The connector which should be visible
-
onStateChanged
public void onStateChanged(StateChangeEvent stateChangeEvent)
Description copied from interface:StateChangeEvent.StateChangeHandlerNotifies the event handler that the state has changed.- Specified by:
onStateChangedin interfaceStateChangeEvent.StateChangeHandler- Overrides:
onStateChangedin classAbstractComponentConnector- Parameters:
stateChangeEvent- the state change event with details about the change
-
analyzeLayouts
public void analyzeLayouts()
Invokes the layout analyzer on the server.- Since:
- 7.1
-
showServerDebugInfo
public void showServerDebugInfo(ServerConnector serverConnector)
Sends a request to the server to print details to console that will help the developer to locate the corresponding server-side connector in the source code.- Parameters:
serverConnector- the connector to locate- Since:
- 7.1
-
showServerDesign
public void showServerDesign(ServerConnector connector)
Sends a request to the server to print a design to the console for the given component.- Parameters:
connector- the component connector to output a declarative design for- Since:
- 7.5
-
replaceTheme
protected void replaceTheme(String oldTheme, String newTheme, String oldThemeUrl, String newThemeUrl)
Loads the new theme and removes references to the old theme.- Parameters:
oldTheme- The name of the old themenewTheme- The name of the new themeoldThemeUrl- The url of the old themenewThemeUrl- The url of the new theme- Since:
- 7.4.3
-
activateTheme
protected void activateTheme(String newTheme)
Activates the new theme. Assumes the theme has been loaded and taken into use in the browser.- Parameters:
newTheme- The name of the new theme- Since:
- 7.4.3
-
forceStateChangeRecursively
protected static void forceStateChangeRecursively(AbstractConnector connector)
Force a full recursive re-check of every connector's state variables.- Parameters:
connector- the connector which should get recursive forced state change- Since:
- 7.3
- See Also:
AbstractConnector.forceStateChange()
-
getActiveTheme
public String getActiveTheme()
Returns the name of the theme currently in used by the UI.- Returns:
- the theme name used by this UI
- Since:
- 7.3
-
isMobileHTML5DndEnabled
public boolean isMobileHTML5DndEnabled()
Returns whether HTML5 DnD extensionsDragSourceExtensionConnectorandDropTargetExtensionConnectorand alike should be enabled for mobile devices.By default, it is disabled.
- Returns:
trueif enabled,falseif not- Since:
- 8.1
-
-