com.vaadin.terminal.gwt.client.ui
Class AbstractComponentConnector

java.lang.Object
  extended by com.vaadin.terminal.gwt.client.ui.AbstractConnector
      extended by com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler, StateChangeEvent.StateChangeHandler, ComponentConnector, Connector, ServerConnector, Serializable
Direct Known Subclasses:
AbstractComponentContainerConnector, AbstractFieldConnector, ButtonConnector, EmbeddedConnector, JavaScriptComponentConnector, LabelConnector, LinkConnector, MediaBaseConnector, MenuBarConnector, NativeButtonConnector, TreeConnector, UnknownComponentConnector, UploadConnector, Vaadin6Connector

public abstract class AbstractComponentConnector
extends AbstractConnector
implements ComponentConnector

See Also:
Serialized Form

Field Summary
protected  List<String> styleNames
          The style names from getState().getStyles() which are currently applied to the widget.
 
Constructor Summary
AbstractComponentConnector()
          Default constructor
 
Method Summary
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.
 LayoutManager getLayoutManager()
           
 ComponentState 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 hasEventListener(String eventIdentifier)
          Checks if there is a registered server side listener for the given event identifier.
protected  void init()
          Called when the connector has been initialized.
 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)
           
 void onUnregister()
          Event called when connector has been unregistered.
 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.
 void updateEnabledState(boolean enabledState)
           
protected  void updateWidgetStyleNames()
          Updates the user defined, read-only and error style names for the widget based the shared state.
 
Methods inherited from class com.vaadin.terminal.gwt.client.ui.AbstractConnector
addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, getChildren, getConnection, getConnectorId, getParent, getRpcImplementations, isEnabled, registerRpc, setChildren, setParent, 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.terminal.gwt.client.ServerConnector
addStateChangeHandler, doInit, fireEvent, getChildren, getConnection, getParent, getRpcImplementations, isEnabled, setChildren, setParent
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 

Field Detail

styleNames

protected List<String> styleNames
The style names from getState().getStyles() which are currently applied to the widget.

Constructor Detail

AbstractComponentConnector

public AbstractComponentConnector()
Default constructor

Method Detail

init

protected void init()
Description copied from class: AbstractConnector
Called when the connector has been initialized. Override this method to perform initialization of the connector.

Overrides:
init in class AbstractConnector

createWidget

protected com.google.gwt.user.client.ui.Widget createWidget()
Creates and returns the widget for this VPaintableWidget. This method should only be called once when initializing the paintable.

Returns:

getWidget

public com.google.gwt.user.client.ui.Widget getWidget()
Returns the widget associated with this paintable. The widget returned by this method must not changed during the life time of the paintable.

Specified by:
getWidget in interface ComponentConnector
Returns:
The widget associated with this paintable

isRealUpdate

@Deprecated
public static boolean isRealUpdate(UIDL uidl)
Deprecated. 


getState

public ComponentState getState()
Description copied from class: AbstractConnector
Returns the shared state object for this connector. Override this method to define the shared state type for your connector.

Specified by:
getState in interface ComponentConnector
Specified by:
getState in interface Connector
Overrides:
getState in class AbstractConnector
Returns:
the current shared state (never null)

onStateChanged

public void onStateChanged(StateChangeEvent stateChangeEvent)
Specified by:
onStateChanged in interface StateChangeEvent.StateChangeHandler
Overrides:
onStateChanged in class AbstractConnector

setWidgetEnabled

public void setWidgetEnabled(boolean widgetEnabled)
Description copied from interface: ComponentConnector
Sets the enabled state of the widget associated to this connector.

Specified by:
setWidgetEnabled in interface ComponentConnector
Parameters:
widgetEnabled - true if the widget should be enabled, false otherwise

isRelativeHeight

public boolean isRelativeHeight()
Description copied from interface: ComponentConnector
Returns 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.

Specified by:
isRelativeHeight in interface ComponentConnector
Returns:
true if the width is undefined, else false

isRelativeWidth

public boolean isRelativeWidth()
Description copied from interface: ComponentConnector
Returns 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.

Specified by:
isRelativeWidth in interface ComponentConnector
Returns:
true if the width is undefined, else false

isUndefinedHeight

public boolean isUndefinedHeight()
Description copied from interface: ComponentConnector
Returns 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.

Specified by:
isUndefinedHeight in interface ComponentConnector
Returns:
true if the height is undefined, else false

isUndefinedWidth

public boolean isUndefinedWidth()
Description copied from interface: ComponentConnector
Returns 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.

Specified by:
isUndefinedWidth in interface ComponentConnector
Returns:
true if the width is undefined, else false

delegateCaptionHandling

public boolean delegateCaptionHandling()
Description copied from interface: ComponentConnector
Return true if parent handles caption, false if the paintable handles the caption itself.

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

Specified by:
delegateCaptionHandling in interface ComponentConnector
Returns:
true if caption handling is delegated to the parent, false if parent should not be allowed to render caption

updateWidgetStyleNames

protected void updateWidgetStyleNames()
Updates the user defined, read-only and error style names for the widget based the shared state. User defined style names are prefixed with the primary style name of the widget returned by getWidget()

This method can be overridden to provide additional style names for the component, for example see AbstractFieldConnector.updateWidgetStyleNames()


setWidgetStyleName

protected void setWidgetStyleName(String styleName,
                                  boolean add)
This is used to add / remove state related style names from the widget.

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().

Parameters:
styleName - the style name to be added or removed
add - true to add the given style, false to remove it

setWidgetStyleNameWithPrefix

@Deprecated
protected void setWidgetStyleNameWithPrefix(String prefix,
                                                       String styleName,
                                                       boolean add)
Deprecated. This will be removed once styles are no longer added with prefixes.

This is used to add / remove state related prefixed style names from the widget.

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 PopupDateFieldConnector.setWidgetStyleNameWithPrefix(String, String, boolean)

Parameters:
styleName - the style name to be added or removed
add - true to add the given style, false to remove it

isReadOnly

@Deprecated
public boolean isReadOnly()
Deprecated. 

Description copied from interface: ComponentConnector
Checks if the connector is read only.

Specified by:
isReadOnly in interface ComponentConnector
Returns:
true

getLayoutManager

public LayoutManager getLayoutManager()
Specified by:
getLayoutManager in interface ComponentConnector

hasEventListener

public boolean hasEventListener(String eventIdentifier)
Checks if there is a registered server side listener for the given event identifier.

Specified by:
hasEventListener in interface ComponentConnector
Parameters:
eventIdentifier - The identifier to check for
Returns:
true if an event listener has been registered with the given event identifier on the server side, false otherwise

updateEnabledState

public void updateEnabledState(boolean enabledState)
Specified by:
updateEnabledState in interface ServerConnector
Overrides:
updateEnabledState in class AbstractConnector

onUnregister

public void onUnregister()
Description copied from interface: ServerConnector
Event called when connector has been unregistered.

Specified by:
onUnregister in interface ServerConnector
Overrides:
onUnregister in class AbstractConnector

getTooltipInfo

public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element)
Description copied from interface: ComponentConnector
Gets the tooltip info for the given element.

Specified by:
getTooltipInfo in interface ComponentConnector
Parameters:
element - The element to lookup a tooltip for
Returns:
The tooltip for the element or null if no tooltip is defined for this element.


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.