An abstract class that defines default implementation for the
com.itmill.toolkit.ui.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.
Parameters
eventType
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
Exceptions
java.lang.IllegalArgumentException
unless
method
has exactly one match in
object
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
.
Parameters
eventType
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
Exceptions
java.lang.IllegalArgumentException
unless
method
has exactly one match in
object
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.
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
.
Parameters
listener
the new Listener to be registered
Registers a new component event listener for this 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()
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.
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.
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.
Parameters
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.
Parameters
component's caption
String
Gets the caption of the component. Caption is the visible name of the component.
Parameters
component's error message
Terminal.ErrorMessage#ErrorMessage(String, int)
Gets the component's error message.
Parameters
Application specific data set with setData function.
3.1
Gets application specific data.
Parameters
component's description
String
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 |
|
These tags may be nested.
Parameters
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.
Get the error message for this component.
Parameters
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.
Parameters
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.
Parameters
the parent component
Gets the visual parent of the component. The components can be nested but one component can have only one parent.
Parameters
component's styleValue of property style.
Gets the look-and-feel style of the component.
Parameters
component's UIDL tag as
String
Gets the UIDL tag corresponding to the component.
Parameters
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.
Parameters
true
if the component is enabled,
false
if not
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.
Parameters
true
if the component is in read-only mode,
false
if not
Tests if the component is in read-only mode.
Parameters
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
.
Parameters
target
target UIDL stream where the component should paint itself to
Exceptions
PaintException
if the operation failed
Paints any needed component-specific things to the given UIDL
stream. The more general
com.itmill.toolkit.ui.AbstractComponent
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
eventType
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
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
.
Parameters
eventType
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
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
.
Parameters
eventType
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
methodName
name of the method owned by
target
that's registered to listen to events of type
eventType
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
.
Parameters
listener
the listener to be removed
Removes a previously registered component event listener from this component.
Parameters
caption
new caption
String
for the component
Sets the component's caption
String
. Caption is the
visible name of the component. This method will trigger a
RepaintRequestEvent
.
Parameters
errorMessage
new
ErrorMessage
of the component
Component.ErrorMessage#ErrorMessage(String, int)
Sets the component's error message. The message may contain certain XML tags, for more information see
Parameters
data
Application specific data.
3.1
Sets application specific data object.
Parameters
description
new description string for the component
Sets the component's description. See
getDescription()
for
more information on what the description is. This method will trigger
a
RepaintRequestEvent
.
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
.
Parameters
icon
the icon to be shown with the component's caption
Sets the component's icon. This method will trigger a
RepaintRequestEvent
.
Parameters
immediate
boolean value specifying if the component should be in the immediate mode after the call.
isImmediate()
Sets the component's immediate mode to the specified status. This
method will trigger a
RepaintRequestEvent
.
Parameters
locale
The locale to become this component's locale.
Sets the locale of this 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.
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
.
Parameters
style
new style of the component
Sets the look-and-feel style of the component. This method will
trigger a
RepaintRequestEvent
.
.
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.