Class CustomComponent

Custom component provides simple implementation of Component interface for creation of new UI components by composition of existing components.

The component is used by inheriting the CustomComponent class and setting composite root inside the Custom component. The composite root itself can contain more components, but their interfaces are hidden from the users.

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.ui.CustomComponent

CustomComponent()

Construct new custom component.

The component is implemented by wrapping the methods of the composition root component given as parameter. The composition root must be set before the component can be used.

CustomComponent(Component)

Parameters

compositionRoot

The root of the composition component tree.

Construct new custom component.

The component is implemented by wrapping the methods of the composition root component given as parameter. The composition root must not be null and can not be changed after the composition.

addListener(Component.Listener)

Custom component does not implement any component events by default

attach()

Description copied from interface: 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.

changeVariables(Object, Map)

The custom component does not have any variables by default

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.

Description copied from interface: childRequestedRepaint

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

Description copied from interface: 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

Description copied from interface: getApplication

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

getCaption()

The caption of the custom component is by default the the caption of the root component, or null if the root is not set

getComponentType()

Parameters

return

String

Gets the component type. The component type is textual type of the component. This is included in the UIDL as component tag attribute. If the component type is null (default), the component tag is not included in the UIDL at all. Returns the componentType.

getIcon()

The icon of the custom component is by default the the icon of the root component, or null if the root is not set

getLocale()

The icon of the custom component is by default the the locale of the parent or null if the parent is not set.

getParent()

Parameters

return

the parent component

Description copied from interface: getParent

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

getStyle()

Custom component does not implement custom styles by default and this function returns null.

getWindow()

Parameters

return

parent window of the component or null

Description copied from interface: getWindow

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

isEnabled()

Custom component is allways enabled by default

isImmediate()

Custom component is by default in the non-immediate mode. The immediateness of the custom component is defined by the components it is composed of.

isReadOnly()

The custom components are not readonly by default.

isVisible()

Parameters

return

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

Description copied from interface: isVisible

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)

Custom component does not implement any component events by default

setComponentType(String)

Parameters

componentType

The componentType to set

Sets the component type. The component type is textual type of the component. This is included in the UIDL as component tag attribute. If the component type is null (default), the component tag is not included in the UIDL at all.

setEnabled(boolean)

The custom component is allways enabled by default.

setParent(Component)

Parameters

parent

the new parent component

Description copied from interface: setParent

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)

Changing the read-only mode of the component is not supported by default.

setStyle(String)

Changing the style of the component is not supported by default.

setVisible(boolean)

Parameters

visible

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

Description copied from interface: setVisible

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