javax.rad.ui
Interface IComponent

All Superinterfaces:
INamedObject, IResource
All Known Subinterfaces:
IActionComponent, IApplication, IButton, IChart, ICheckBox, ICheckBoxMenuItem, IContainer, IContent, IDesktopPanel, IEditor, IFrame, IGroupPanel, IIcon, IInternalFrame, ILabel, ILauncher, IMenu, IMenuBar, IMenuItem, IPanel, IPasswordField, IPopupMenu, IRadioButton, IScrollPanel, ISeparator, ISplitPanel, ITable, ITabsetPanel, ITextArea, ITextField, IToggleActionComponent, IToggleButton, IToolBar, IToolBarPanel, ITree, IWindow, IWorkScreen, IWorkScreenApplication
All Known Implementing Classes:
About, AbstractFrame, AbstractUIActionComponent, AbstractUIButton, AbstractUIMenuItem, AbstractUITextField, AbstractUIToggleButton, AbstractWindow, Application, Application, AwtComponent, AwtContainer, Content, Dialog, Error, Login, Message, RemoteApplication, RemoteWorkScreen, RemoteWorkScreenApplication, SwingAbstractButton, SwingAbstractFrame, SwingApplet.SwingAppletLauncher, SwingApplication, SwingButton, SwingChart, SwingCheckBox, SwingCheckBoxMenuItem, SwingComponent, SwingDesktopPanel, SwingEditor, SwingFrame, SwingGroupPanel, SwingIcon, SwingInternalFrame, SwingLabel, SwingMenu, SwingMenuBar, SwingMenuItem, SwingPanel, SwingPasswordField, SwingPopupMenu, SwingRadioButton, SwingScrollComponent, SwingScrollPanel, SwingSeparator, SwingSplitPanel, SwingTable, SwingTabsetPanel, SwingTextArea, SwingTextComponent, SwingTextField, SwingToggleButton, SwingToolBar, SwingToolBarPanel, SwingTree, UIButton, UIChart, UICheckBox, UICheckBoxMenuItem, UIComponent, UIContainer, UICustomComponent, UICustomContainer, UIDesktopPanel, UIEditor, UIFrame, UIGroupPanel, UIIcon, UIInternalFrame, UILabel, UILauncher, UIMenu, UIMenuBar, UIMenuItem, UIPanel, UIPasswordField, UIPopupMenu, UIRadioButton, UIScrollPanel, UISeparator, UISplitPanel, UITable, UITabsetPanel, UITextArea, UITextField, UIToggleButton, UIToolBar, UIToolBarPanel, UITree, UIWindow, WorkScreen

public interface IComponent
extends IResource, INamedObject

Platform and technology independent component definition. It is designed for use with AWT, Swing, SWT, JSP, JSF,... .

See Also:
Component, JComponent

Method Summary
 IImage capture(int iWidth, int iHeight)
          Creates an image/screenshot of the component.
 ComponentHandler eventComponentMoved()
          The ComponentHandler for the moved event.
 ComponentHandler eventComponentResized()
          The ComponentHandler for the resized event.
 KeyHandler eventKeyPressed()
          The EventHandler for the key pressed event.
 KeyHandler eventKeyReleased()
          The EventHandler for the key released event.
 KeyHandler eventKeyTyped()
          The EventHandler for the key typed event.
 MouseHandler eventMouseClicked()
          The EventHandler for the mouse clicked event.
 MouseHandler eventMouseEntered()
          The EventHandler for the mouse entered event.
 MouseHandler eventMouseExited()
          The EventHandler for the mouse exited event.
 MouseHandler eventMousePressed()
          The EventHandler for the mouse pressed event.
 MouseHandler eventMouseReleased()
          The EventHandler for the mouse released event.
 IColor getBackground()
          Gets the background color of this component.
 IRectangle getBounds()
          Gets the bounds of this component in the form of a IRectangle object.
 ICursor getCursor()
          Gets the ICursor set in the component.
 IComponent getEventSource()
          Gets the wanted event source for this component.
 IFactory getFactory()
          Gets the factory that created this NamedObject.
 IFont getFont()
          Gets the font of this component.
 IColor getForeground()
          Gets the foreground color of this component.
 IPoint getLocation()
          Gets the location of this component in the form of a point specifying the component's top-left corner.
 IPoint getLocationRelativeTo(IComponent pComponent)
          Gets the location relative to the given component.
 IDimension getMaximumSize()
          Gets the maximum size of this component.
 IDimension getMinimumSize()
          Gets the mininimum size of this component.
 String getName()
          Gets the name of the object.
 IContainer getParent()
          Gets the parent of this component.
 IDimension getPreferredSize()
          Gets the preferred size of this component.
 IDimension getSize()
          Returns the size of this component in the form of a IDimension object.
 String getToolTipText()
          Returns the tooltip string that has been set with setToolTipText.
 boolean isBackgroundSet()
          Returns whether the background color has been explicitly set for this Component.
 boolean isCursorSet()
          Returns whether the cursor has been explicitly set for this Component.
 boolean isEnabled()
          Determines whether this component is enabled.
 boolean isFocusable()
          Returns whether this component can be focused.
 boolean isFontSet()
          Returns whether the font has been explicitly set for this Component.
 boolean isForegroundSet()
          Returns whether the foreground color has been explicitly set for this Component.
 boolean isMaximumSizeSet()
          Returns true if the maximum size has been set to a non-null value otherwise returns false.
 boolean isMinimumSizeSet()
          Returns whether or not setMinimumSize has been invoked with a non-null value.
 boolean isPreferredSizeSet()
          Returns true if the preferred size has been set to a non-null value otherwise returns false.
 boolean isVisible()
          Determines whether this component should be visible when its parent is visible.
 void requestFocus()
          Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window.
 void setBackground(IColor pBackground)
          Sets the background color of this component.
 void setBounds(IRectangle pBounds)
          Moves and resizes this component to conform to the new bounding rectangle pBounds.
 void setCursor(ICursor pCursor)
          Sets the cursor image to the specified cursor.
 void setEnabled(boolean pEnable)
          Enables or disables this component, depending on the value of the parameter pEnable.
 void setEventSource(IComponent pEventSource)
          Sets the wanted event source for this component.
 void setFocusable(boolean pFocusable)
          Sets the focusable state of this component to the specified value.
 void setFont(IFont pFont)
          Sets the IFont of this component.
 void setForeground(IColor pForeground)
          Sets the foreground color of this component.
 void setLocation(IPoint pLocation)
          Moves this component to a new location.
 void setLocationRelativeTo(IComponent pComponent, IPoint pLocation)
          Sets the location relative to the given component.
 void setMaximumSize(IDimension pMaximumSize)
          Sets the maximum size of this component to a constant value.
 void setMinimumSize(IDimension pMinimumSize)
          Sets the minimum size of this component to a constant value.
 void setName(String pName)
          Sets the name of the object to the specified string.
 void setParent(IContainer pParent)
          Sets the parent of this component.
 void setPreferredSize(IDimension pPreferredSize)
          Sets the preferred size of this component to a constant value.
 void setSize(IDimension pSize)
          Resizes this component so that it has width d.width and height d.height.
 void setToolTipText(String pText)
          Registers the text to display in a tool tip.
 void setVisible(boolean pVisible)
          Shows or hides this component depending on the value of parameter b.
 
Methods inherited from interface javax.rad.ui.IResource
getResource
 

Method Detail

getName

String getName()
Gets the name of the object.

Specified by:
getName in interface INamedObject
Returns:
this component's name
See Also:
setName(java.lang.String)

setName

void setName(String pName)
Sets the name of the object to the specified string.

Specified by:
setName in interface INamedObject
Parameters:
pName - the string that is to be this component's name
See Also:
getName()

getFactory

IFactory getFactory()
Gets the factory that created this NamedObject.

Returns:
the factory that created this NamedObject

getPreferredSize

IDimension getPreferredSize()
Gets the preferred size of this component.

Returns:
an IDimension object indicating this component's preferred size
See Also:
getMinimumSize(), LayoutManager

setPreferredSize

void setPreferredSize(IDimension pPreferredSize)
Sets the preferred size of this component to a constant value. Subsequent calls to getPreferredSize will always return this value. Setting the preferred size to null restores the default behavior.

Parameters:
pPreferredSize - the new preferred size, or null
See Also:
getPreferredSize(), isPreferredSizeSet()

isPreferredSizeSet

boolean isPreferredSizeSet()
Returns true if the preferred size has been set to a non-null value otherwise returns false.

Returns:
true if setPreferredSize has been invoked with a non-null value.

getMinimumSize

IDimension getMinimumSize()
Gets the mininimum size of this component.

Returns:
an IDimension object indicating this component's minimum size
See Also:
getPreferredSize(), LayoutManager

setMinimumSize

void setMinimumSize(IDimension pMinimumSize)
Sets the minimum size of this component to a constant value. Subsequent calls to getMinimumSize will always return this value. Setting the minimum size to null restores the default behavior.

Parameters:
pMinimumSize - the new minimum size of this component
See Also:
getMinimumSize(), isMinimumSizeSet()

isMinimumSizeSet

boolean isMinimumSizeSet()
Returns whether or not setMinimumSize has been invoked with a non-null value.

Returns:
true if setMinimumSize has been invoked with a non-null value.

getMaximumSize

IDimension getMaximumSize()
Gets the maximum size of this component.

Returns:
an IDimension object indicating this component's maximum size
See Also:
getMinimumSize(), getPreferredSize(), LayoutManager

setMaximumSize

void setMaximumSize(IDimension pMaximumSize)
Sets the maximum size of this component to a constant value. Subsequent calls to getMaximumSize will always return this value. Setting the maximum size to null restores the default behavior.

Parameters:
pMaximumSize - a IDimension containing the desired maximum allowable size
See Also:
getMaximumSize(), isMaximumSizeSet()

isMaximumSizeSet

boolean isMaximumSizeSet()
Returns true if the maximum size has been set to a non-null value otherwise returns false.

Returns:
true if maximumSize is non-null, false otherwise

getBackground

IColor getBackground()
Gets the background color of this component.

Returns:
this component's background color; if this component does not have a background color, the background color of its parent is returned
See Also:
setBackground(javax.rad.ui.IColor)

setBackground

void setBackground(IColor pBackground)
Sets the background color of this component.

The background color affects each component differently and the parts of the component that are affected by the background color may differ between operating systems.

Parameters:
pBackground - the color to become this component's color; if this parameter is null, then this component will inherit the background color of its parent
See Also:
getBackground()

isBackgroundSet

boolean isBackgroundSet()
Returns whether the background color has been explicitly set for this Component. If this method returns false, this Component is inheriting its background color from an ancestor.

Returns:
true if the background color has been explicitly set for this Component; false otherwise.

getForeground

IColor getForeground()
Gets the foreground color of this component.

Returns:
this component's foreground color; if this component does not have a foreground color, the foreground color of its parent is returned
See Also:
setForeground(javax.rad.ui.IColor)

setForeground

void setForeground(IColor pForeground)
Sets the foreground color of this component.

Parameters:
pForeground - the color to become this component's foreground color; if this parameter is null then this component will inherit the foreground color of its parent
See Also:
getForeground()

isForegroundSet

boolean isForegroundSet()
Returns whether the foreground color has been explicitly set for this Component. If this method returns false, this Component is inheriting its foreground color from an ancestor.

Returns:
true if the foreground color has been explicitly set for this Component; false otherwise.

getCursor

ICursor getCursor()
Gets the ICursor set in the component. If the component does not have a cursor set, the cursor of its parent is returned. If no cursor is set in the entire hierarchy, Cursor.DEFAULT_CURSOR is returned.

Returns:
the ICursor set in the component
See Also:
setCursor(javax.rad.ui.ICursor)

setCursor

void setCursor(ICursor pCursor)
Sets the cursor image to the specified cursor. This cursor image is displayed when the contains method for this component returns true for the current cursor location, and this Component is visible, displayable, and enabled. Setting the cursor of a Container causes that cursor to be displayed within all of the container's subcomponents, except for those that have a non-null cursor.

The method may have no visual effect if the Java platform implementation and/or the native system do not support changing the mouse cursor shape.

Parameters:
pCursor - One of the constants defined by the Cursor class; if this parameter is null then this component will inherit the cursor of its parent
See Also:
isEnabled(), getCursor(), Toolkit.createCustomCursor(java.awt.Image, java.awt.Point, java.lang.String), ICursor

isCursorSet

boolean isCursorSet()
Returns whether the cursor has been explicitly set for this Component. If this method returns false, this Component is inheriting its cursor from an ancestor.

Returns:
true if the cursor has been explicitly set for this Component; false otherwise.

getFont

IFont getFont()
Gets the font of this component.

Returns:
this component's font; if a font has not been set for this component, the font of its parent is returned
See Also:
setFont(javax.rad.ui.IFont)

setFont

void setFont(IFont pFont)
Sets the IFont of this component.

Parameters:
pFont - the IFont to become this component's font; if this parameter is null then this component will inherit the font of its parent
See Also:
getFont()

isFontSet

boolean isFontSet()
Returns whether the font has been explicitly set for this Component. If this method returns false, this Component is inheriting its font from an ancestor.

Returns:
true if the font has been explicitly set for this Component; false otherwise.

getToolTipText

String getToolTipText()
Returns the tooltip string that has been set with setToolTipText.

Returns:
the text of the tool tip
See Also:
setToolTipText(String)

setToolTipText

void setToolTipText(String pText)
Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.

Parameters:
pText - the string to display; if the text is null, the tool tip is turned off for this component

setFocusable

void setFocusable(boolean pFocusable)
Sets the focusable state of this component to the specified value.

Parameters:
pFocusable - indicates whether this Component is focusable

isFocusable

boolean isFocusable()
Returns whether this component can be focused.

Returns:
true if this Component is focusable, false otherwise.

requestFocus

void requestFocus()
Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. This component must be displayable, visible, and focusable for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event. If this request is denied because this Component's top-level Window cannot become the focused Window, the request will be remembered and will be granted when the Window is later focused by the user.

This method cannot be used to set the focus owner to no Component at all. Use KeyboardFocusManager.clearGlobalFocusOwner() instead.

Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible.


getParent

IContainer getParent()
Gets the parent of this component.

Returns:
the parent container of this component

setParent

void setParent(IContainer pParent)
Sets the parent of this component.

Parameters:
pParent - the parent container of this component

isVisible

boolean isVisible()
Determines whether this component should be visible when its parent is visible. Components are initially visible, with the exception of top level components such as Frame objects.

Returns:
true if the component is visible, false otherwise
See Also:
setVisible(boolean)

setVisible

void setVisible(boolean pVisible)
Shows or hides this component depending on the value of parameter b.

Parameters:
pVisible - if true, shows this component; otherwise, hides this component
See Also:
isVisible()

setEnabled

void setEnabled(boolean pEnable)
Enables or disables this component, depending on the value of the parameter pEnable. An enabled component can respond to user input and generate events. Components are enabled initially by default.

Parameters:
pEnable - if true, this component is enabled; otherwise this component is disabled
See Also:
isEnabled()

isEnabled

boolean isEnabled()
Determines whether this component is enabled. An enabled component can respond to user input and generate events. Components are enabled initially by default. A component may be enabled or disabled by calling its setEnabled method.

Returns:
true if the component is enabled, false otherwise
See Also:
setEnabled(boolean)

getLocationRelativeTo

IPoint getLocationRelativeTo(IComponent pComponent)
Gets the location relative to the given component.

Parameters:
pComponent - the component in relation to which the window's location is determined.
Returns:
the location.

setLocationRelativeTo

void setLocationRelativeTo(IComponent pComponent,
                           IPoint pLocation)
Sets the location relative to the given component.

Parameters:
pComponent - the component in relation to which the window's location is determined.
pLocation - the location.

getLocation

IPoint getLocation()
Gets the location of this component in the form of a point specifying the component's top-left corner. The location will be relative to the parent's coordinate space.

Due to the asynchronous nature of native event handling, this method can return outdated values (for instance, after several calls of setLocation() in rapid succession). For this reason, the recommended method of obtaining a component's position is within java.awt.event.ComponentListener.componentMoved(), which is called after the operating system has finished moving the component.

Returns:
an instance of IPoint representing the top-left corner of the component's bounds in the coordinate space of the component's parent
See Also:
setLocation(IPoint)

setLocation

void setLocation(IPoint pLocation)
Moves this component to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space.

Parameters:
pLocation - the point defining the top-left corner of the new location, given in the coordinate space of this component's parent
See Also:
getLocation(), setBounds(IRectangle)

getSize

IDimension getSize()
Returns the size of this component in the form of a IDimension object. The height field of the IDimension object contains this component's height, and the width field of the IDimension object contains this component's width.

Returns:
an IDimension object that indicates the size of this component
See Also:
setSize(javax.rad.ui.IDimension)

setSize

void setSize(IDimension pSize)
Resizes this component so that it has width d.width and height d.height.

Parameters:
pSize - the IDimension specifying the new size of this component
See Also:
setSize(javax.rad.ui.IDimension), setBounds(javax.rad.ui.IRectangle)

getBounds

IRectangle getBounds()
Gets the bounds of this component in the form of a IRectangle object. The bounds specify this component's width, height, and location relative to its parent.

Returns:
a rectangle indicating this component's bounds
See Also:
setBounds(javax.rad.ui.IRectangle), getLocation(), getSize()

setBounds

void setBounds(IRectangle pBounds)
Moves and resizes this component to conform to the new bounding rectangle pBounds. This component's new position is specified by pBounds.x and pBounds.y, and its new size is specified by pBounds.width and pBounds.height

Parameters:
pBounds - the new bounding rectangle for this component
See Also:
getBounds(), setLocation(IPoint), setSize(IDimension)

getEventSource

IComponent getEventSource()
Gets the wanted event source for this component. This gives wrapper implementations like genui a simple mechanism to control the source of component events.

Returns:
the event source

setEventSource

void setEventSource(IComponent pEventSource)
Sets the wanted event source for this component. This gives wrapper implementations like genui a simple mechanism to control the source of component events.

Parameters:
pEventSource - the event source

eventMousePressed

MouseHandler eventMousePressed()
The EventHandler for the mouse pressed event.

Returns:
the EventHandler for the mouse pressed event.

eventMouseReleased

MouseHandler eventMouseReleased()
The EventHandler for the mouse released event.

Returns:
the EventHandler for the mouse released event.

eventMouseClicked

MouseHandler eventMouseClicked()
The EventHandler for the mouse clicked event.

Returns:
the EventHandler for the mouse clicked event.

eventMouseEntered

MouseHandler eventMouseEntered()
The EventHandler for the mouse entered event.

Returns:
the EventHandler for the mouse entered event.

eventMouseExited

MouseHandler eventMouseExited()
The EventHandler for the mouse exited event.

Returns:
the EventHandler for the mouse exited event.

eventKeyPressed

KeyHandler eventKeyPressed()
The EventHandler for the key pressed event.

Returns:
the EventHandler for the key pressed event.

eventKeyReleased

KeyHandler eventKeyReleased()
The EventHandler for the key released event.

Returns:
the EventHandler for the key released event.

eventKeyTyped

KeyHandler eventKeyTyped()
The EventHandler for the key typed event.

Returns:
the EventHandler for the key typed event.

eventComponentResized

ComponentHandler eventComponentResized()
The ComponentHandler for the resized event.

Returns:
the ComponentHandler for the resized event.

eventComponentMoved

ComponentHandler eventComponentMoved()
The ComponentHandler for the moved event.

Returns:
the ComponentHandler for the moved event.

capture

IImage capture(int iWidth,
               int iHeight)
Creates an image/screenshot of the component.

Parameters:
iWidth - the expected width
iHeight - the expected height
Returns:
the image/screenshot


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.