|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itmill.toolkit.terminal.Identifiable
com.itmill.toolkit.ui.CustomComponent
public 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.
| Nested Class Summary |
|---|
| 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 |
| Constructor Summary | |
|---|---|
CustomComponent()
Constructs a new custom component. |
|
CustomComponent(Component compositionRoot)
Constructs a new custom component. |
|
| Method Summary | |
|---|---|
void |
addListener(Component.Listener listener)
Custom component does not implement any component events by default. |
void |
addListener(Paintable.RepaintRequestListener listener)
Adds repaint request listener. |
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 |
dependsOn(VariableOwner depended)
Makes this VariableOwner depend on the given
VariableOwner. |
void |
detach()
Notifies the component that it is detached from the application. |
Application |
getApplication()
Gets the component's parent application |
String |
getCaption()
The caption of the custom component is by default the caption of the root component, or null if the root is not set. |
String |
getComponentType()
Gets the component type. |
protected Component |
getCompositionRoot()
Returns the composition root. |
Set |
getDirectDependencies()
Gets the variable change listeners this VariableOwner
directly depends on. |
Resource |
getIcon()
The icon of the custom component is by default the icon of the root component, or null if the root is not set. |
Locale |
getLocale()
The icon of the custom component is by default the locale of the parent or null if the parent is not set. |
Component |
getParent()
Gets the visual parent of the component. |
String |
getStyle()
Custom component does not implement custom styles by default and this function returns null. |
Window |
getWindow()
Gets the component's parent window. |
boolean |
isEnabled()
Custom component is allways enabled by default. |
boolean |
isImmediate()
Custom component is by default in the non-immediate mode. |
boolean |
isReadOnly()
The custom components are not readonly by default. |
boolean |
isVisible()
Tests if the component is visible or not. |
void |
paint(PaintTarget target)
Paints the paintable into a UIDL stream. |
void |
removeDirectDependency(VariableOwner depended)
Removes the given component from this component's dependency list. |
void |
removeListener(Component.Listener listener)
Custom component does not implement any component events by default. |
void |
removeListener(Paintable.RepaintRequestListener listener)
Removes repaint request listener. |
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 |
setComponentType(String componentType)
Sets the component type. |
protected void |
setCompositionRoot(Component compositionRoot)
Sets the compositions root. |
void |
setEnabled(boolean enabled)
The custom component is allways enabled by default. |
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 |
setStyle(String style)
Sets the look-and-feel style of the component. |
void |
setVisible(boolean visible)
Sets the components visibility status. |
| Methods inherited from class com.itmill.toolkit.terminal.Identifiable |
|---|
getDebugId, getUIID, setDebugId, setUIID |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CustomComponent()
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.
public CustomComponent(Component compositionRoot)
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.
compositionRoot - the root of the composition component tree.| Method Detail |
|---|
protected final Component getCompositionRoot()
protected final void setCompositionRoot(Component compositionRoot)
The composition root must be set to non-null value before the component can be used. The composition root can only be set once.
compositionRoot - the root of the composition component tree.public void attach()
attach in interface ComponentComponent.attach()public void detach()
detach in interface ComponentComponent.detach()public Application getApplication()
getApplication in interface Componentnull.Component.getApplication()public String getCaption()
getCaption in interface ComponentString.Component.getCaption()public Resource getIcon()
getIcon in interface Componentnull if it not defined.Component.getIcon()public Locale getLocale()
getLocale in interface ComponentLocale.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.Component.getLocale()public Component getParent()
getParent in interface ComponentComponent.getParent()public String getStyle()
getStyle in interface ComponentComponent.getStyle()public Window getWindow()
getWindow in interface Componentnull.Component.getWindow()public boolean isEnabled()
isEnabled in interface VariableOwnerisEnabled in interface Componenttrue if the variable owner is enabled,
false if notComponent.isEnabled()public boolean isImmediate()
isImmediate in interface VariableOwnertrue if the component is in immediate mode,
false if not.VariableOwner.isImmediate()public boolean isReadOnly()
isReadOnly in interface Componenttrue if the component is in read-only mode,
false if not.Component.isReadOnly()public boolean isVisible()
isVisible in interface Componenttrue if the component is visible in the UI,
false if notComponent.isVisible()public void requestRepaint()
Paintable
requestRepaint in interface Paintablepublic void childRequestedRepaint(Collection alreadyNotified)
Component
childRequestedRepaint in interface ComponentalreadyNotified - 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.public void addListener(Paintable.RepaintRequestListener listener)
Paintable
addListener in interface Paintablelistener - the listener to be added.public void removeListener(Paintable.RepaintRequestListener listener)
Paintable
removeListener in interface Paintablelistener - the listener to be removed.public void setEnabled(boolean enabled)
setEnabled in interface Componentenabled - the boolean value specifying if the component should be
enabled after the call or notpublic void setParent(Component parent)
setParent in interface Componentparent - the new parent component.Component.setParent(com.itmill.toolkit.ui.Component)public void setReadOnly(boolean readOnly)
setReadOnly in interface ComponentreadOnly - the boolean value specifying if the component should be in
read-only mode after the call or not.Component.setReadOnly(boolean)public void setStyle(String style)
setStyle in interface Componentstyle - the new style of the component.Component.setStyle(java.lang.String)public void setVisible(boolean visible)
setVisible in interface Componentvisible - the Boolean value specifying if the component should be
visible after the call or not.Component.setVisible(boolean)public void requestRepaintRequests()
PaintableThis method is normally used only by the terminals to note paintables about implicit repaints (painting the component without actually invoking paint method).
requestRepaintRequests in interface Paintable
public void paint(PaintTarget target)
throws PaintException
PaintablePaints 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.
paint in interface Paintabletarget - the target UIDL stream where the component should paint itself
to.
PaintException - if the paint operation failed.
public void changeVariables(Object source,
Map variables)
changeVariables in interface VariableOwnersource - 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.VariableOwner.changeVariables(java.lang.Object,
java.util.Map)public void dependsOn(VariableOwner depended)
VariableOwner depend on the given
VariableOwner.
dependsOn in interface VariableOwnerdepended - the VariableOwner component who this component
depends on.VariableOwner.dependsOn(com.itmill.toolkit.terminal.VariableOwner)public Set getDirectDependencies()
VariableOwner
directly depends on.
getDirectDependencies in interface VariableOwnerVariableOwners this component directly
depend on, null if this component does not depend
on anybody.VariableOwner.getDirectDependencies()public void removeDirectDependency(VariableOwner depended)
removeDirectDependency in interface VariableOwnerdepended - the component to be removed from this component's dependency
list.VariableOwner.removeDirectDependency(com.itmill.toolkit.terminal.VariableOwner)public void addListener(Component.Listener listener)
addListener in interface Componentlistener - the listener to add.public void removeListener(Component.Listener listener)
removeListener in interface Componentlistener - the listener to remove.public String getComponentType()
public void setComponentType(String componentType)
componentType - the componentType to set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||