|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.millstone.base.ui.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 inherited from class org.millstone.base.ui.Component |
Component.Event, Component.Listener |
Nested classes inherited from class org.millstone.base.terminal.Paintable |
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Constructor Summary | |
CustomComponent()
Construct new custom component. |
|
CustomComponent(Component compositionRoot)
Construct 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)
Add repaint request listener. |
void |
attach()
Notifies the component that it is connected to an application. |
void |
changeVariables(java.lang.Object source,
java.util.Map variables)
The custom component does not have any variables by default |
void |
childRequestedRepaint(java.util.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. |
java.lang.String |
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 |
java.lang.String |
getComponentType()
Gets the component type. |
protected Component |
getCompositionRoot()
Returns the composition root. |
java.util.Set |
getDirectDependencies()
Gets the variable change listeners this VariableOwner
directly depends on. |
Resource |
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 |
java.util.Locale |
getLocale()
The icon of the custom component is by default the the locale of the parent or null if the parent is not set. |
Component |
getParent()
Gets the visual parent of the component. |
java.lang.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)
Remove 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(java.lang.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)
Changing the read-only mode of the component is not supported by default. |
void |
setStyle(java.lang.String style)
Changing the style of the component is not supported by default. |
void |
setVisible(boolean visible)
Sets the components visibility status. |
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()
Component
getApplication()
and
getWindow()
functions 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.
attach
in interface Component
public void detach()
Component
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.
detach
in interface Component
public Application getApplication()
Component
null
is returned.
getApplication
in interface Component
null
public java.lang.String getCaption()
getCaption
in interface Component
String
public Resource getIcon()
getIcon
in interface Component
null
if it not defined.public java.util.Locale getLocale()
getLocale
in interface Component
public Component getParent()
Component
getParent
in interface Component
public java.lang.String getStyle()
getStyle
in interface Component
public Window getWindow()
Component
null
is returned.
getWindow
in interface Component
null
public boolean isEnabled()
isEnabled
in interface Component
true
if the component is enabled,
false
if notVariableOwner.isEnabled()
public boolean isImmediate()
isImmediate
in interface Component
true
if the component is in immediate mode,
false
if notpublic boolean isReadOnly()
isReadOnly
in interface Component
true
if the component is in read-only mode,
false
if notpublic boolean isVisible()
Component
true
.
isVisible
in interface Component
true
if the component is visible in the UI,
false
if notpublic void requestRepaint()
Paintable
requestRepaint
in interface Paintable
public void childRequestedRepaint(java.util.Collection alreadyNotified)
Component
childRequestedRepaint
in interface Component
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.public void addListener(Paintable.RepaintRequestListener listener)
Paintable
addListener
in interface Paintable
listener
- to be addedpublic void removeListener(Paintable.RepaintRequestListener listener)
Paintable
removeListener
in interface Paintable
listener
- to be removedpublic void setEnabled(boolean enabled)
setEnabled
in interface Component
enabled
- boolean value specifying if the component should be
enabled after the call or notpublic void setParent(Component 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.
setParent
in interface Component
parent
- the new parent componentpublic void setReadOnly(boolean readOnly)
setReadOnly
in interface Component
readOnly
- boolean value specifying if the component should be
in read-only mode after the call or notpublic void setStyle(java.lang.String style)
setStyle
in interface Component
style
- new style of the componentpublic void setVisible(boolean visible)
Component
setVisible
in interface Component
visible
- Boolean value specifying if the component should be
visible after the call or notpublic void requestRepaintRequests()
Paintable
requestRepaintRequests
in interface Paintable
public void paint(PaintTarget target) throws PaintException
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's 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 Paintable
target
- target UIDL stream where the component should paint
itself to
PaintException
- if the paint operation failedpublic void changeVariables(java.lang.Object source, java.util.Map variables)
changeVariables
in interface VariableOwner
source
- Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables
- Mapping from variable names to new variable valuespublic void dependsOn(VariableOwner depended)
VariableOwner
VariableOwner
depend on the given
VariableOwner
. This means that any variable change
events relating to depended
must be sent before any
such events that relate to this object.
dependsOn
in interface VariableOwner
public java.util.Set getDirectDependencies()
VariableOwner
VariableOwner
directly depends on. This list does not contain any indirect
dependencies, for example, if A depends on B and B depends on C,
the dependency list of A does not include C.
getDirectDependencies
in interface VariableOwner
VariableOwner
s this component directly
depend on, null
if this component does not depend on
anybody.public void removeDirectDependency(VariableOwner depended)
VariableOwner
depended
wdepende direct dependency from the component.
Indirect dependencies are not removed.
removeDirectDependency
in interface VariableOwner
public void addListener(Component.Listener listener)
addListener
in interface Component
listener
- the new Listener to be registeredpublic void removeListener(Component.Listener listener)
removeListener
in interface Component
listener
- the listener to be removedpublic java.lang.String getComponentType()
public void setComponentType(java.lang.String componentType)
componentType
- The componentType to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |