com.itmill.toolkit.ui
Class AbstractComponent

java.lang.Object
  extended by com.itmill.toolkit.ui.AbstractComponent
All Implemented Interfaces:
MethodEventSource, Paintable, Sizeable, VariableOwner, Component, EventListener
Direct Known Subclasses:
AbstractComponentContainer, AbstractField, Embedded, Label, Link, MenuBar, Upload, UriFragmentUtility

public abstract class AbstractComponent
extends Object
implements Component, MethodEventSource

An abstract class that defines default implementation for the Component interface. Basic UI components that are not derived from an external component can inherit this class to easily qualify as a IT Mill Toolkit component. Most components in the toolkit do just that.

Since:
3.0
Version:
5.3.0
Author:
IT Mill Ltd.

Nested Class Summary
static interface AbstractComponent.ComponentErrorEvent
           
static interface AbstractComponent.ComponentErrorHandler
           
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.Component
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener
 
Nested classes/interfaces inherited from interface com.itmill.toolkit.terminal.Paintable
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener
 
Field Summary
 
Fields inherited from interface com.itmill.toolkit.terminal.Sizeable
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
AbstractComponent()
          Constructs a new Component.
 
Method Summary
 void addListener(Class eventType, Object object, Method method)
           Registers a new listener with the specified activation method to listen events generated by this component.
 void addListener(Class eventType, Object object, String methodName)
           Convenience method for registering a new listener with the specified activation method to listen events generated by this component.
 void addListener(Component.Listener listener)
          Registers a new component event listener for this component.
 void addListener(Paintable.RepaintRequestListener listener)
          Adds repaint request listener.
 void addStyleName(String style)
          Adds style name to component.
 void attach()
           Notifies the component that it is connected to an application.
 void changeVariables(Object source, Map variables)
          Called when one or more variables handled by the implementing class are changed.
 void childRequestedRepaint(Collection alreadyNotified)
          The children must call this method when they need repainting.
 void detach()
          Notifies the component that it is detached from the application.
protected  void fireComponentErrorEvent()
          Emits the component error event.
protected  void fireComponentEvent()
          Emits the component event.
protected  void fireEvent(Component.Event event)
          Sends the event to all listeners.
 Application getApplication()
          Gets the component's parent application.
 String getCaption()
          Gets the caption of the component.
 ErrorMessage getComponentError()
          Gets the component's error message.
 Object getData()
          Gets the application specific data.
 String getDebugId()
          Get's currently set debug identifier
 String getDescription()
           Gets the component's description.
 AbstractComponent.ComponentErrorHandler getErrorHandler()
          Gets the error handler for the component.
 ErrorMessage getErrorMessage()
          Gets the error message for this component.
 float getHeight()
          Gets the height of the object.
 int getHeightUnits()
          Gets the height property units.
 Resource getIcon()
          Gets the component's icon.
 Locale getLocale()
          Gets the locale of this component.
 Component getParent()
          Gets the visual parent of the component.
 String getStyle()
          Deprecated. Use getStyleName() instead; renamed for consistency and to indicate that "style" should not be used to switch client side implementation, only to style the component.
 String getStyleName()
          Gets style for component.
abstract  String getTag()
          Gets the UIDL tag corresponding to the component.
 float getWidth()
          Gets the width of the object.
 int getWidthUnits()
          Gets the width property units.
 Window getWindow()
          Gets the component's parent window.
 boolean handleError(AbstractComponent.ComponentErrorEvent error)
          Handle the component error event.
 boolean isEnabled()
           Tests if the variable owner is enabled or not.
 boolean isImmediate()
           Tests if the variable owner is in immediate mode or not.
 boolean isReadOnly()
          Tests if the component is in read-only mode.
 boolean isVisible()
          Tests the components visibility.
 void paint(PaintTarget target)
           Paints the Paintable into a UIDL stream.
 void paintContent(PaintTarget target)
          Paints any needed component-specific things to the given UIDL stream.
 void removeListener(Class eventType, Object target)
          Removes all registered listeners matching the given parameters.
 void removeListener(Class eventType, Object target, Method method)
          Removes one registered listener method.
 void removeListener(Class eventType, Object target, String methodName)
           Removes one registered listener method.
 void removeListener(Component.Listener listener)
          Removes a previously registered component event listener from this component.
 void removeListener(Paintable.RepaintRequestListener listener)
          Removes repaint request listener.
 void removeStyleName(String style)
          Removes given style name from component.
 void requestRepaint()
          Requests that the paintable should be repainted as soon as possible.
 void requestRepaintRequests()
          Request sending of repaint events on any further visible changes.
 void setCaption(String caption)
          Sets the component's caption String.
 void setComponentError(ErrorMessage componentError)
          Sets the component's error message.
 void setData(Object data)
          Sets the data object, that can be used for any application specific data.
 void setDebugId(String id)
          Adds an unique id for component that get's transferred to terminal for testing purposes.
 void setDescription(String description)
          Sets the component's description.
 void setEnabled(boolean enabled)
          Enables or disables the component.
 void setErrorHandler(AbstractComponent.ComponentErrorHandler errorHandler)
          Sets the error handler for the component.
 void setHeight(float height)
          Deprecated. 
 void setHeight(float height, int unit)
          Sets the height of the object.
 void setHeight(String height)
          Sets the height of the component using String presentation.
 void setHeightUnits(int unit)
          Deprecated. 
 void setIcon(Resource icon)
          Sets the component's icon.
 void setImmediate(boolean immediate)
          Sets the component's immediate mode to the specified status.
 void setLocale(Locale locale)
          Sets the locale of this component.
 void setParent(Component parent)
          Sets the component's parent component.
 void setReadOnly(boolean readOnly)
          Sets the component's to read-only mode to the specified state.
 void setSizeFull()
          Sets the size to 100% x 100%.
 void setSizeUndefined()
          Clears any size settings.
 void setStyle(String style)
          Deprecated. Use setStyleName() instead; renamed for consistency and to indicate that "style" should not be used to switch client side implementation, only to style the component.
 void setStyleName(String style)
          Sets and replaces all previous style names of the component.
 void setWidth(float width)
          Deprecated. 
 void setWidth(float width, int unit)
          Sets the width of the object.
 void setWidth(String width)
          Sets the width of the component using String presentation.
 void setWidthUnits(int unit)
          Deprecated. 
 void setVisible(boolean visible)
          Sets this components visibility status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractComponent

public AbstractComponent()
Constructs a new Component.

Method Detail

getTag

public abstract String getTag()
Gets the UIDL tag corresponding to the component.

Returns:
the component's UIDL tag as String

setDebugId

public void setDebugId(String id)
Description copied from interface: Paintable
Adds an unique id for component that get's transferred to terminal for testing purposes. Keeping identifiers unique throughout the Application instance is on programmers responsibility.

Specified by:
setDebugId in interface Paintable
Parameters:
id - A short (< 20 chars) alphanumeric id

getDebugId

public String getDebugId()
Description copied from interface: Paintable
Get's currently set debug identifier

Specified by:
getDebugId in interface Paintable
Returns:
current debug id, null if not set

getStyle

@Deprecated
public String getStyle()
Deprecated. Use getStyleName() instead; renamed for consistency and to indicate that "style" should not be used to switch client side implementation, only to style the component.

Gets style for component. Multiple styles are joined with spaces.

Returns:
the component's styleValue of property style.

setStyle

@Deprecated
public void setStyle(String style)
Deprecated. Use setStyleName() instead; renamed for consistency and to indicate that "style" should not be used to switch client side implementation, only to style the component.

Sets and replaces all previous style names of the component. This method will trigger a RepaintRequestEvent.

Parameters:
style - the new style of the component.

getStyleName

public String getStyleName()
Description copied from interface: Component
Gets style for component. Multiple styles are joined with spaces.

Specified by:
getStyleName in interface Component
Returns:
the component's styleValue of property style.

setStyleName

public void setStyleName(String style)
Description copied from interface: Component
Sets and replaces all previous style names of the component. This method will trigger a RepaintRequestEvent.

Specified by:
setStyleName in interface Component
Parameters:
style - the new style of the component.

addStyleName

public void addStyleName(String style)
Description copied from interface: Component
Adds style name to component. Handling additional style names is terminal specific, but in web browser environment they will most likely become CSS classes as given on server side. This method will trigger a RepaintRequestEvent.

Specified by:
addStyleName in interface Component
Parameters:
style - the new style to be added to the component

removeStyleName

public void removeStyleName(String style)
Description copied from interface: Component
Removes given style name from component.

Specified by:
removeStyleName in interface Component
Parameters:
style - the style to be removed

getCaption

public String getCaption()
Description copied from interface: Component
Gets the caption of the component. Caption is the visible name of the component.

Specified by:
getCaption in interface Component
Returns:
the component's caption String.

setCaption

public void setCaption(String caption)
Sets the component's caption String. Caption is the visible name of the component. This method will trigger a RepaintRequestEvent.

Specified by:
setCaption in interface Component
Parameters:
caption - the new caption String for the component.

getLocale

public Locale getLocale()
Description copied from interface: Component
Gets the locale of this component.

Specified by:
getLocale in interface Component
Returns:
This component's locale. If this component does not have a locale, the locale of its parent is returned. Eventually locale of application is returned. If application does not have its own locale the locale is determined by Locale.getDefautlt. Returns null if the component does not have its own locale and has not yet been added to a containment hierarchy such that the locale can be determined from the containing parent.

setLocale

public void setLocale(Locale locale)
Sets the locale of this component.

Parameters:
locale - the locale to become this component's locale.

getIcon

public Resource getIcon()
Description copied from interface: Component
Gets the component's icon. A component may have a graphical icon associated with it, this method retrieves it if it is defined.

Specified by:
getIcon in interface Component
Returns:
the component's icon or null if it not defined.

setIcon

public void setIcon(Resource icon)
Sets the component's icon. This method will trigger a RepaintRequestEvent.

Specified by:
setIcon in interface Component
Parameters:
icon - the icon to be shown with the component's caption.

isEnabled

public boolean isEnabled()
Description copied from interface: VariableOwner

Tests if the variable owner is enabled or not. The terminal should not send any variable changes to disabled variable owners.

Specified by:
isEnabled in interface VariableOwner
Specified by:
isEnabled in interface Component
Returns:
true if the variable owner is enabled, false if not
See Also:
VariableOwner.isEnabled()

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: Component
Enables or disables the component. Being enabled means that the component can be edited. This method will trigger a RepaintRequestEvent.

Note that after enabling a component, Component.isEnabled() might still return false if the parent is disabled.

Also note that if the component contains child-components, it should recursively call requestRepaint() for all descendant components.

Specified by:
setEnabled in interface Component
Parameters:
enabled - the boolean value specifying if the component should be enabled after the call or not

isImmediate

public boolean isImmediate()
Description copied from interface: VariableOwner

Tests if the variable owner is in immediate mode or not. Being in immediate mode means that all variable changes are required to be sent back from the terminal immediately when they occur.

Note: VariableOwner does not include a set- method for the immediateness property. This is because not all VariableOwners wish to offer the functionality. Such VariableOwners are never in the immediate mode, thus they always return false in VariableOwner.isImmediate().

Specified by:
isImmediate in interface VariableOwner
Returns:
true if the component is in immediate mode, false if not.

setImmediate

public void setImmediate(boolean immediate)
Sets the component's immediate mode to the specified status. This method will trigger a RepaintRequestEvent.

Parameters:
immediate - the boolean value specifying if the component should be in the immediate mode after the call.
See Also:
VariableOwner.isImmediate()

isVisible

public boolean isVisible()
Description copied from interface: Component
Tests the components visibility. Visibility defines if the component is drawn when updating UI. Default is true.

Note that to return true, this component and all its parents must be visible.

Also note that this method does not check if component is attached and shown to user. Component and all its parents may be visible, but not necessary attached to application. To test if component will be drawn, check its visibility and that Component.getApplication() does not return null.

Specified by:
isVisible in interface Component
Returns:
true if the component is visible in the UI, false if not

setVisible

public void setVisible(boolean visible)
Description copied from interface: Component
Sets this components visibility status. Visibility defines if the component is shown in the UI or not.

Note that to be shown in UI this component and all its parents must be visible.

Specified by:
setVisible in interface Component
Parameters:
visible - the boolean value specifying if the component should be visible after the call or not.

getDescription

public String getDescription()

Gets the component's description. The description can be used to briefly describe the state of the component to the user. The description string may contain certain XML tags:

Tag Description Example
<b> bold bold text
<i> italic italic text
<u> underlined underlined text
<br> linebreak N/A
<ul>
<li>item1
<li>item1
</ul>
item list
  • item1
  • item2

These tags may be nested.

Returns:
component's description String

setDescription

public void setDescription(String description)
Sets the component's description. See getDescription() for more information on what the description is. This method will trigger a RepaintRequestEvent.

Parameters:
description - the new description string for the component.

getParent

public Component getParent()
Description copied from interface: Component
Gets the visual parent of the component. The components can be nested but one component can have only one parent.

Specified by:
getParent in interface Component
Returns:
the parent component.

setParent

public void setParent(Component parent)
Description copied from interface: Component
Sets the component's parent component.

This method calls automatically Component.attach() if the parent is attached to a window (or is itself a window}, and Component.detach() if parent is set null, but the component was in the application.

This method is rarely called directly. Instead the ComponentContainer.addComponent(Component) method is used to add components to container, which call this method implicitly.

Specified by:
setParent in interface Component
Parameters:
parent - the new parent component.

getErrorMessage

public ErrorMessage getErrorMessage()
Gets the error message for this component.

Returns:
ErrorMessage containing the description of the error state of the component or null, if the component contains no errors. Extending classes should override this method if they support other error message types such as validation errors or buffering errors. The returned error message contains information about all the errors.

getComponentError

public ErrorMessage getComponentError()
Gets the component's error message.

Returns:
the component's error message.

setComponentError

public void setComponentError(ErrorMessage componentError)
Sets the component's error message. The message may contain certain XML tags, for more information see

Parameters:
componentError - the new ErrorMessage of the component.

isReadOnly

public boolean isReadOnly()
Description copied from interface: Component
Tests if the component is in read-only mode.

Specified by:
isReadOnly in interface Component
Returns:
true if the component is in read-only mode, false if not.

setReadOnly

public void setReadOnly(boolean readOnly)
Description copied from interface: Component
Sets the component's to read-only mode to the specified state. This method will trigger a RepaintRequestEvent.

Specified by:
setReadOnly in interface Component
Parameters:
readOnly - the boolean value specifying if the component should be in read-only mode after the call or not.

getWindow

public Window getWindow()
Description copied from interface: Component
Gets the component's parent window. If the component does not yet belong to a window null is returned.

Specified by:
getWindow in interface Component
Returns:
the parent window of the component or null.

attach

public void attach()
Description copied from interface: Component

Notifies the component that it is connected to an application. This method is always called before the component is first time painted and is suitable to be extended. The getApplication and getWindow methods might return null before this method is called.

The caller of this method is Component.setParent(Component) if the parent is already in the application. If the parent is not in the application, it must call the Component.attach() for all its children when it will be added to the application.

Specified by:
attach in interface Component

detach

public void detach()
Description copied from interface: Component
Notifies the component that it is detached from the application.

The Component.getApplication() and Component.getWindow() methods might return null after this method is called.

The caller of this method is Component.setParent(Component) if the parent is in the application. When the parent is detached from the application it is its response to call Component.detach() for all the children and to detach itself from the terminal.

Specified by:
detach in interface Component

getApplication

public Application getApplication()
Description copied from interface: Component
Gets the component's parent application. If the component does not yet belong to a application null is returned.

Specified by:
getApplication in interface Component
Returns:
the parent application of the component or null.

requestRepaintRequests

public void requestRepaintRequests()
Description copied from interface: Paintable
Request sending of repaint events on any further visible changes. Normally the paintable only send up to one repaint request for listeners after paint as the paintable as the paintable assumes that the listeners already know about the repaint need. This method resets the assumtion. Paint implicitly does the assumtion reset functionality implemented by this method.

This method is normally used only by the terminals to note paintables about implicit repaints (painting the component without actually invoking paint method).

Specified by:
requestRepaintRequests in interface Paintable

paint

public final void paint(PaintTarget target)
                 throws PaintException
Description copied from interface: Paintable

Paints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.

It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.

Specified by:
paint in interface Paintable
Parameters:
target - the target UIDL stream where the component should paint itself to.
Throws:
PaintException - if the paint operation failed.

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Paints any needed component-specific things to the given UIDL stream. The more general paint(PaintTarget) method handles all general attributes common to all components, and it calls this method to paint any component-specific attributes to the UIDL stream.

Parameters:
target - the target UIDL stream where the component should paint itself to
Throws:
PaintException - if the paint operation failed.

requestRepaint

public void requestRepaint()
Description copied from interface: Paintable
Requests that the paintable should be repainted as soon as possible.

Specified by:
requestRepaint in interface Paintable

childRequestedRepaint

public void childRequestedRepaint(Collection alreadyNotified)
Description copied from interface: Component
The children must call this method when they need repainting. The call must be made event in the case the children sent the repaint request themselves.

Specified by:
childRequestedRepaint in interface Component
Parameters:
alreadyNotified - the collection of repaint request listeners that have been already notified by the child. This component should not renotify the listed listeners again. The container given as parameter must be modifiable as the component might modify it and pass it forwards. Null parameter is interpreted as empty collection.

addListener

public void addListener(Paintable.RepaintRequestListener listener)
Description copied from interface: Paintable
Adds repaint request listener. In order to assure that no repaint requests are missed, the new repaint listener should paint the paintable right after adding itself as listener.

Specified by:
addListener in interface Paintable
Parameters:
listener - the listener to be added.

removeListener

public void removeListener(Paintable.RepaintRequestListener listener)
Description copied from interface: Paintable
Removes repaint request listener.

Specified by:
removeListener in interface Paintable
Parameters:
listener - the listener to be removed.

changeVariables

public void changeVariables(Object source,
                            Map variables)
Description copied from interface: VariableOwner
Called when one or more variables handled by the implementing class are changed.

Specified by:
changeVariables in interface VariableOwner
Parameters:
source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
variables - the Mapping from variable names to new variable values.

addListener

public void addListener(Class eventType,
                        Object object,
                        Method method)

Registers a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation.

Specified by:
addListener in interface MethodEventSource
Parameters:
eventType - the type of the listened event. Events of this type or its subclasses activate the listener.
object - the object instance who owns the activation method.
method - the activation method.

addListener

public void addListener(Class eventType,
                        Object object,
                        String methodName)

Convenience method for registering a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.

This version of addListener gets the name of the activation method as a parameter. The actual method is reflected from object, and unless exactly one match is found, java.lang.IllegalArgumentException is thrown.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation.

Note: Using this method is discouraged because it cannot be checked during compilation. Use addListener(Class, Object, Method) or addListener(com.itmill.toolkit.ui.Component.Listener) instead.

Specified by:
addListener in interface MethodEventSource
Parameters:
eventType - the type of the listened event. Events of this type or its subclasses activate the listener.
object - the object instance who owns the activation method.
methodName - the name of the activation method.

removeListener

public void removeListener(Class eventType,
                           Object target)
Removes all registered listeners matching the given parameters. Since this method receives the event type and the listener object as parameters, it will unregister all object's methods that are registered to listen to events of type eventType generated by this component.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation.

Specified by:
removeListener in interface MethodEventSource
Parameters:
eventType - the exact event type the object listens to.
target - the target object that has registered to listen to events of type eventType with one or more methods.

removeListener

public void removeListener(Class eventType,
                           Object target,
                           Method method)
Removes one registered listener method. The given method owned by the given object will no longer be called when the specified events are generated by this component.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation.

Specified by:
removeListener in interface MethodEventSource
Parameters:
eventType - the exact event type the object listens to.
target - target object that has registered to listen to events of type eventType with one or more methods.
method - the method owned by target that's registered to listen to events of type eventType.

removeListener

public void removeListener(Class eventType,
                           Object target,
                           String methodName)

Removes one registered listener method. The given method owned by the given object will no longer be called when the specified events are generated by this component.

This version of removeListener gets the name of the activation method as a parameter. The actual method is reflected from target, and unless exactly one match is found, java.lang.IllegalArgumentException is thrown.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation.

Specified by:
removeListener in interface MethodEventSource
Parameters:
eventType - the exact event type the object listens to.
target - the target object that has registered to listen to events of type eventType with one or more methods.
methodName - the name of the method owned by target that's registered to listen to events of type eventType.

fireEvent

protected void fireEvent(Component.Event event)
Sends the event to all listeners.

Parameters:
event - the Event to be sent to all listeners.

addListener

public void addListener(Component.Listener listener)
Description copied from interface: Component
Registers a new component event listener for this component.

Specified by:
addListener in interface Component
Parameters:
listener - the new Listener to be registered.

removeListener

public void removeListener(Component.Listener listener)
Description copied from interface: Component
Removes a previously registered component event listener from this component.

Specified by:
removeListener in interface Component
Parameters:
listener - the listener to be removed.

fireComponentEvent

protected void fireComponentEvent()
Emits the component event. It is transmitted to all registered listeners interested in such events.


fireComponentErrorEvent

protected void fireComponentErrorEvent()
Emits the component error event. It is transmitted to all registered listeners interested in such events.


setData

public void setData(Object data)
Sets the data object, that can be used for any application specific data. The component does not use or modify this data.

Parameters:
data - the Application specific data.
Since:
3.1

getData

public Object getData()
Gets the application specific data. See setData(Object).

Returns:
the Application specific data set with setData function.
Since:
3.1

getHeight

public float getHeight()
Description copied from interface: Sizeable
Gets the height of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
getHeight in interface Sizeable
Returns:
height of the object in units specified by heightUnits property.

getHeightUnits

public int getHeightUnits()
Description copied from interface: Sizeable
Gets the height property units.

Specified by:
getHeightUnits in interface Sizeable
Returns:
units used in height property.

getWidth

public float getWidth()
Description copied from interface: Sizeable
Gets the width of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
getWidth in interface Sizeable
Returns:
width of the object in units specified by widthUnits property.

getWidthUnits

public int getWidthUnits()
Description copied from interface: Sizeable
Gets the width property units.

Specified by:
getWidthUnits in interface Sizeable
Returns:
units used in width property.

setHeight

@Deprecated
public void setHeight(float height)
Deprecated. 

Description copied from interface: Sizeable
Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
setHeight in interface Sizeable
Parameters:
height - the height of the object in units specified by heightUnits property.

setHeightUnits

@Deprecated
public void setHeightUnits(int unit)
Deprecated. 

Description copied from interface: Sizeable
Sets the height property units.

Specified by:
setHeightUnits in interface Sizeable
Parameters:
unit - the units used in height property.

setHeight

public void setHeight(float height,
                      int unit)
Description copied from interface: Sizeable
Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
setHeight in interface Sizeable
Parameters:
height - the height of the object.
unit - the unit used for the width. Possible values include UNITS_PIXELS, UNITS_POINTS, UNITS_PICAS, UNITS_EM, UNITS_EX, UNITS_MM, UNITS_CM, UNITS_INCH, UNITS_PERCENTAGE, UNITS_ROWS.

setSizeFull

public void setSizeFull()
Description copied from interface: Sizeable
Sets the size to 100% x 100%.

Specified by:
setSizeFull in interface Sizeable

setSizeUndefined

public void setSizeUndefined()
Description copied from interface: Sizeable
Clears any size settings.

Specified by:
setSizeUndefined in interface Sizeable

setWidth

@Deprecated
public void setWidth(float width)
Deprecated. 

Description copied from interface: Sizeable
Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
setWidth in interface Sizeable
Parameters:
width - the width of the object in units specified by widthUnits property.

setWidthUnits

@Deprecated
public void setWidthUnits(int unit)
Deprecated. 

Description copied from interface: Sizeable
Sets the width property units.

Specified by:
setWidthUnits in interface Sizeable
Parameters:
unit - the units used in width property.

setWidth

public void setWidth(float width,
                     int unit)
Description copied from interface: Sizeable
Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).

Specified by:
setWidth in interface Sizeable
Parameters:
width - the width of the object.
unit - the unit used for the width. Possible values include UNITS_PIXELS, UNITS_POINTS, UNITS_PICAS, UNITS_EM, UNITS_EX, UNITS_MM, UNITS_CM, UNITS_INCH, UNITS_PERCENTAGE, UNITS_ROWS.

setWidth

public void setWidth(String width)
Description copied from interface: Sizeable
Sets the width of the component using String presentation. String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size. The empty string ("") or null will unset the width and set the units to pixels. See CSS specification for more details.

Specified by:
setWidth in interface Sizeable
Parameters:
width - in CSS style string representation, null or empty string to reset

setHeight

public void setHeight(String height)
Description copied from interface: Sizeable
Sets the height of the component using String presentation. String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size. The empty string ("") or null will unset the height and set the units to pixels. See CSS specification for more details.

Specified by:
setHeight in interface Sizeable
Parameters:
height - in CSS style string representation

getErrorHandler

public AbstractComponent.ComponentErrorHandler getErrorHandler()
Gets the error handler for the component. The error handler is dispatched whenever there is an error processing the data coming from the client.

Returns:

setErrorHandler

public void setErrorHandler(AbstractComponent.ComponentErrorHandler errorHandler)
Sets the error handler for the component. The error handler is dispatched whenever there is an error processing the data coming from the client. If the error handler is not set, the application error handler is used to handle the exception.

Parameters:
errorHandler - AbstractField specific error handler

handleError

public boolean handleError(AbstractComponent.ComponentErrorEvent error)
Handle the component error event.

Parameters:
error - Error event to handle
Returns:
True if the error has been handled False, otherwise. If the error haven't been handled by this component, it will be handled in the application error handler.


Copyright © 2000-2009 IT Mill Ltd. All Rights Reserved.