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, LabelConnector, LinkConnector, MediaBaseConnector, MenuBarConnector, NativeButtonConnector, TreeConnector, UnknownComponentConnector, UploadConnector, Vaadin6Connector

public abstract class AbstractComponentConnector
extends AbstractConnector
implements ComponentConnector

See Also:
Serialized Form

Constructor Summary
AbstractComponentConnector()
          Default constructor
 
Method Summary
protected abstract  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()
           
 ComponentContainerConnector getParent()
          Returns the parent of this connector.
 ComponentState getState()
          Returns the shared state object for this connector.
protected  String getStyleNames(String primaryStyleName)
          Generates the style name for the widget based on the given primary style name and the shared state.
 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.
 boolean isEnabled()
          Tests whether the connector is enabled or not.
 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 setParent(ComponentContainerConnector parent)
          Sets the parent for this connector.
 void setState(SharedState state)
          Sets the shared state for the paintable widget.
 void setWidgetEnabled(boolean widgetEnabled)
          Sets the enabled state of the widget associated to this connector.
 
Methods inherited from class com.vaadin.terminal.gwt.client.ui.AbstractConnector
addStateChangeHandler, doInit, ensureHandlerManager, fireEvent, getConnection, getConnectorId, getRpcImplementations, init, isConnectorEnabled, registerRpc, 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, getConnection, getRpcImplementations
 
Methods inherited from interface com.vaadin.terminal.gwt.client.Connector
getConnectorId
 

Constructor Detail

AbstractComponentConnector

public AbstractComponentConnector()
Default constructor

Method Detail

createWidget

protected abstract 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

getState

public ComponentState getState()
Returns the shared state object for this connector. If overriding this method to return a more specific type, also #createState() must be overridden.

Specified by:
getState in interface ComponentConnector
Specified by:
getState in interface Connector
Returns:
current shared state (not null)

isRealUpdate

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


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

isEnabled

public boolean isEnabled()
Description copied from interface: ServerConnector
Tests whether the connector is enabled or not. This method checks that the connector is enabled in context, i.e. if the parent connector is disabled, this method must return false.

Specified by:
isEnabled in interface ServerConnector
Returns:
true if the connector is enabled, false otherwise

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

getStyleNames

protected String getStyleNames(String primaryStyleName)
Generates the style name for the widget based on the given primary style name and the shared state.

This method can be overridden to provide additional style names for the component

Parameters:
primaryStyleName - The primary style name to use when generating the final style names
Returns:
The style names, settable using UIObject.setStyleName(String)

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

setState

public final void setState(SharedState state)
Sets the shared state for the paintable widget.

Specified by:
setState in interface ServerConnector
Parameters:
new - shared state (must be compatible with the return value of getState() - ComponentState if getState() is not overridden

getLayoutManager

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

getParent

public ComponentContainerConnector getParent()
Description copied from interface: ComponentConnector
Returns the parent of this connector. Can be null for only the root connector.

Specified by:
getParent in interface ComponentConnector
Returns:
The parent of this connector, as set by ComponentConnector.setParent(ComponentContainerConnector).

setParent

public void setParent(ComponentContainerConnector parent)
Description copied from interface: ComponentConnector
Sets the parent for this connector. This method should only be called by the framework to ensure that the connector hierarchy on the client side and the server side are in sync.

Note that calling this method does not fire a ConnectorHierarchyChangeEvent. The event is fired only when the whole hierarchy has been updated.

Specified by:
setParent in interface ComponentConnector
Parameters:
parent - The new parent of the connector

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

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


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