Interface Component

The top-level component interface which must be implemented by all UI components that use IT Mill Toolkit

Synopsis

Since

3.0

Inheritance Path.  com.itmill.toolkit.ui.Component

addListener(Component.Listener)

Parameters

listener

the new Listener to be registered

Registers a new component event listener for this component.

attach()

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() functions might return null before this method is called.

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

childRequestedRepaint(Collection)

Parameters

alreadyNotified

A 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.

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.

detach()

Notifies the component that it is detached from the application.

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

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

getApplication()

Parameters

return

parent application of the component or null

Gets the component's parent application. If the component does not yet belong to a application null is returned.

getCaption()

Parameters

return

component's caption String

Gets the caption of the component. Caption is the visible name of the component.

getIcon()

Parameters

return

the component's icon or null if it not defined.

Gets the component's icon. A component may have a graphical icon associated with it, this method retrieves it if it is defined.

getLocale()

Parameters

return

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

Gets the locale of this component.

getParent()

Parameters

return

the parent component

Gets the visual parent of the component. The components can be nested but one component can have only one parent.

getStyle()

Parameters

return

component's styleValue of property style.

Gets the look-and-feel style of the component.

getWindow()

Parameters

return

parent window of the component or null

Gets the component's parent window. If the component does not yet belong to a window null is returned.

isEnabled()

Parameters

return

true if the component is enabled, false if not

See Also
isEnabled()

Tests if the component is enabled or not. All the variable change events are blocked from disabled components. Also the component should visually indicate that it is disabled (by shading the component for example). All hidden (isVisible() == false) components must return false.

Components should be enabled by default.

isReadOnly()

Parameters

return

true if the component is in read-only mode, false if not

Tests if the component is in read-only mode.

isVisible()

Parameters

return

true if the component is visible in the UI, false if not

Tests if the component is visible or not. Visibility defines if the component is shown in the UI or not. Default is true .

removeListener(Component.Listener)

Parameters

listener

the listener to be removed

Removes a previously registered component event listener from this component.

setEnabled(boolean)

Parameters

enabled

boolean value specifying if the component should be enabled after the call or not

Enable or disable the component. Being enabled means that the component can be edited. This method will trigger a RepaintRequestEvent .

setParent(Component)

Parameters

parent

the new parent component

Sets the component's parent component.

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

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

setReadOnly(boolean)

Parameters

readOnly

boolean value specifying if the component should be in read-only mode after the call or not

Sets the component's to read-only mode to the specified state. This method will trigger a RepaintRequestEvent .

setStyle(String)

Parameters

style

new style of the component

Sets the look-and-feel style of the component. This method will trigger a RepaintRequestEvent . .

setVisible(boolean)

Parameters

visible

Boolean value specifying if the component should be visible after the call or not

Sets the components visibility status. Visibility defines if the component is shown in the UI or not.