org.apache.pivot.wtk
Class Component

java.lang.Object
  extended by org.apache.pivot.wtk.Component
All Implemented Interfaces:
ConstrainedVisual, Visual
Direct Known Subclasses:
ActivityIndicator, Button, ChartView, Container, GridPane.Filler, ImageView, Label, ListView, Meter, MovieView, ScrollPane.Corner, Separator, TablePane.Filler, TableView, TableViewHeader, TerraRollupSkin.RollupButton, TerraScrollBarSkin.Handle, TerraScrollBarSkin.ScrollButton, TerraSliderSkin.Thumb, TerraSpinnerSkin.SpinButton, TerraSpinnerSkin.SpinnerContent, TerraSplitPaneSkin.Splitter, TerraSplitPaneSkin.SplitterShadow, TextArea, TextInput, TreeView

@IDProperty(value="name")
public abstract class Component
extends Object
implements ConstrainedVisual

Top level abstract base class for all components. In MVC terminology, a component represents the "controller". It has no inherent visual representation and acts as an intermediary between the component's data (the "model") and the skin, an implementation of Skin which serves as the "view".


Nested Class Summary
 class Component.DecoratorSequence
          Decorator sequence implementation.
 class Component.StyleDictionary
          Style dictionary implementation.
 class Component.UserDataDictionary
          User data dictionary implementation.
 
Constructor Summary
Component()
           
 
Method Summary
 void clear()
          Clears any bound values in the component.
static void clearFocus()
          Clears the focus.
 boolean contains(int xArgument, int yArgument)
          Determines if the component contains a given location.
 Container getAncestor(Class<? extends Container> ancestorType)
           
 Container getAncestor(String ancestorTypeName)
           
<T extends Enum<T>>
Object
getAttribute(T key)
          Gets the specified component attribute.
 String getAutomationID()
          Returns the component's automation ID.
 int getBaseline()
          Returns the component's baseline.
 int getBaseline(int width, int height)
          Returns the component's baseline for a given width and height.
 Bounds getBounds()
          Returns the component's bounding area.
static ListenerList<ComponentClassListener> getComponentClassListeners()
           
 ListenerList<ComponentDataListener> getComponentDataListeners()
           
 ListenerList<ComponentDecoratorListener> getComponentDecoratorListeners()
           
 ListenerList<ComponentKeyListener> getComponentKeyListeners()
           
 ListenerList<ComponentListener> getComponentListeners()
           
 ListenerList<ComponentMouseButtonListener> getComponentMouseButtonListeners()
           
 ListenerList<ComponentMouseListener> getComponentMouseListeners()
           
 ListenerList<ComponentMouseWheelListener> getComponentMouseWheelListeners()
           
 ListenerList<ComponentStateListener> getComponentStateListeners()
           
 ListenerList<ComponentStyleListener> getComponentStyleListeners()
           
 ListenerList<ComponentTooltipListener> getComponentTooltipListeners()
           
 Cursor getCursor()
          Returns the cursor that is displayed when the mouse pointer is over this component.
 Bounds getDecoratedBounds()
          Returns the component's bounding area including decorators.
 Component.DecoratorSequence getDecorators()
          Returns the component's decorator sequence.
 Display getDisplay()
           
 DragSource getDragSource()
           
 DropTarget getDropTarget()
           
static Component getFocusedComponent()
          Returns the currently focused component.
 Graphics2D getGraphics()
          Creates a graphics context for this component.
 int getHeight()
          Returns the visual's height.
 Limits getHeightLimits()
          Returns the height limits for this component.
 Point getLocation()
          Returns the component's location.
 int getMaximumHeight()
          Returns the maximum height of this component.
 int getMaximumWidth()
          Returns the maximum width of this component.
 MenuHandler getMenuHandler()
           
 int getMinimumHeight()
          Returns the minimum height of this component.
 int getMinimumWidth()
          Returns the minimum width of this component.
 Point getMouseLocation()
          Returns the current mouse location in the component's coordinate space.
 String getName()
          Returns the component's name.
static Map<String,Map<String,?>> getNamedStyles()
          Returns the named style dictionary.
 Container getParent()
           
 int getPreferredHeight()
          Returns the component's unconstrained preferred height.
 int getPreferredHeight(int width)
          Returns the component's constrained preferred height.
 Dimensions getPreferredSize()
          Gets the component's unconstrained preferred size.
 int getPreferredWidth()
          Returns the component's unconstrained preferred width.
 int getPreferredWidth(int height)
          Returns the component's constrained preferred width.
 Dimensions getSize()
           
protected  Skin getSkin()
          Returns the currently installed skin.
 Component.StyleDictionary getStyles()
          Returns the component's style dictionary.
 int getTooltipDelay()
          Returns the component's tooltip delay.
 String getTooltipText()
          Returns the component's tooltip text.
 boolean getTooltipWrapText()
          Returns the tooltip's mode for wrapping its text.
static Map<Class<? extends Component>,Map<String,?>> getTypedStyles()
          Returns the typed style dictionary.
 Component.UserDataDictionary getUserData()
          Returns the user data dictionary.
 Bounds getVisibleArea()
          Determines the visible area of a component.
 Bounds getVisibleArea(Bounds area)
          Determines the visible area of a component.
 Bounds getVisibleArea(int xArgument, int yArgument, int width, int height)
          Determines the visible area of a component.
 int getWidth()
          Returns the visual's width.
 Limits getWidthLimits()
          Returns the width limits for this component.
 Window getWindow()
           
 int getX()
          Returns the component's x-coordinate.
 int getY()
          Returns the component's y-coordinate.
protected static void indexBoundsCheck(String indexName, int index, int min, int max)
          Provide a nice exception message for out of range values.
protected  void installSkin(Class<? extends Component> componentClass)
          Installs the skin for the given component class, as defined by the current theme.
 void invalidate()
          Flags the component's hierarchy as invalid, and clears any cached preferred size.
 boolean isBlocked()
          Determines if this component is blocked.
 boolean isEnabled()
          Returns the component's enabled state.
 boolean isFocusable()
          Returns this component's focusability.
 boolean isFocused()
          Returns the component's focused state.
 boolean isMouseOver()
          Determines if the mouse is positioned over this component.
 boolean isOpaque()
          Tells whether or not this component is fully opaque when painted.
 boolean isPreferredHeightSet()
          Returns a flag indicating whether the preferred height was explicitly set by the caller or is the default value determined by the skin.
 boolean isPreferredSizeSet()
          Returns a flag indicating whether the preferred size was explicitly set by the caller or is the default value determined by the skin.
 boolean isPreferredWidthSet()
          Returns a flag indicating whether the preferred width was explicitly set by the caller or is the default value determined by the skin.
 boolean isShowing()
          Determines if this component is showing.
 boolean isValid()
          Returns the component's valid state.
 boolean isVisible()
          Returns the component's visibility.
protected  boolean keyPressed(int keyCode, Keyboard.KeyLocation keyLocation)
           
protected  boolean keyReleased(int keyCode, Keyboard.KeyLocation keyLocation)
           
protected  boolean keyTyped(char character)
           
protected  void layout()
          Called to lay out the component.
 void load(Object context)
          Copies bound values from the bind context to the component.
 Point mapPointFromAncestor(Container ancestor, int xArgument, int yArgument)
          Maps a point in the specified ancestor's coordinate space to this component's coordinate system.
 Point mapPointFromAncestor(Container ancestor, Point location)
           
 Point mapPointToAncestor(Container ancestor, int xArgument, int yArgument)
          Maps a point in this component's coordinate system to the specified ancestor's coordinate space.
 Point mapPointToAncestor(Container ancestor, Point location)
          Maps a point in this component's coordinate system to the specified ancestor's coordinate space.
protected  boolean mouseClick(Mouse.Button button, int xArgument, int yArgument, int count)
           
protected  boolean mouseDown(Mouse.Button button, int xArgument, int yArgument)
           
protected  boolean mouseMove(int xArgument, int yArgument)
           
protected  void mouseOut()
           
protected  void mouseOver()
           
protected  boolean mouseUp(Mouse.Button button, int xArgument, int yArgument)
           
protected  boolean mouseWheel(Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int xArgument, int yArgument)
           
 void paint(Graphics2D graphics)
          Paints the component.
 void reenterMouse()
          If the mouse is currently over the component, causes the component to fire mouseOut() and a mouseMove() at the current mouse location.
 void repaint()
          Flags the entire component as needing to be repainted.
 void repaint(boolean immediate)
          Flags the entire component as needing to be repainted.
 void repaint(Bounds area)
          Flags an area as needing to be repainted.
 void repaint(Bounds area, boolean immediate)
          Flags an area as needing to be repainted or repaints the rectangle immediately.
 void repaint(int xArgument, int yArgument, int width, int height)
          Flags an area as needing to be repainted.
 void repaint(int xArgument, int yArgument, int width, int height, boolean immediate)
          Flags an area as needing to be repainted.
 boolean requestFocus()
          Requests that focus be given to this component.
 void scrollAreaToVisible(Bounds area)
          Ensures that the given area of a component is visible within the viewports of all applicable ancestors.
 void scrollAreaToVisible(int xArgument, int yArgument, int width, int height)
          Ensures that the given area of a component is visible within the viewports of all applicable ancestors.
<T extends Enum<T>>
Object
setAttribute(T key, Object value)
          Sets the specified component attribute.
 void setAutomationID(String automationID)
          Sets the component's automation ID.
 void setCursor(Cursor cursor)
          Sets the cursor that is displayed when the mouse pointer is over this component.
 void setDragSource(DragSource dragSource)
           
 void setDropTarget(DropTarget dropTarget)
           
 void setEnabled(boolean enabled)
          Sets the component's enabled state.
protected  void setFocused(boolean focused, Component obverseComponent)
          Called to notify a component that its focus state has changed.
 void setHeight(int height)
           
 void setHeightLimits(int minimumHeight, int maximumHeight)
          Sets the height limits for this component.
 void setHeightLimits(Limits heightLimits)
          Sets the height limits for this component.
 void setLocation(int x, int y)
          Sets the component's location.
 void setLocation(Point location)
          Sets the component's location.
 void setMaximumHeight(int maximumHeight)
          Sets the maximum height of this component.
 void setMaximumWidth(int maximumWidth)
          Sets the maximum width of this component.
 void setMenuHandler(MenuHandler menuHandler)
           
 void setMinimumHeight(int minimumHeight)
          Sets the minimum height of this component.
 void setMinimumWidth(int minimumWidth)
          Sets the minimum width of this component.
 void setName(String name)
          Sets the component's name.
protected  void setParent(Container parent)
           
 void setPreferredHeight(int preferredHeight)
          Sets the component's preferred height.
 void setPreferredSize(Dimensions preferredSize)
           
 void setPreferredSize(int preferredWidth, int preferredHeight)
          Sets the component's preferred size.
 void setPreferredWidth(int preferredWidth)
          Sets the component's preferred width.
 void setSize(Dimensions size)
           
 void setSize(int width, int height)
          NOTE This method should only be called during layout.
protected  void setSkin(Skin skin)
          Sets the skin, replacing any previous skin.
 void setStyleName(String styleName)
          Applies a set of named styles.
 void setStyleNames(Sequence<String> styleNames)
          Applies a set of named styles.
 void setStyleNames(String styleNames)
          Applies a set of named styles.
 void setStyles(Map<String,?> styles)
          Applies a set of styles.
 void setStyles(String styles)
          Applies a set of styles.
 void setTooltipDelay(int tooltipDelay)
          Sets the component's tooltip delay.
 void setTooltipText(String tooltipText)
          Sets the component's tooltip text.
 void setTooltipWrapText(boolean tooltipWrapText)
          Sets the tooltip's text wrapping mode.
 void setVisible(boolean visible)
          Sets the component's visibility.
 void setWidth(int width)
           
 void setWidthLimits(int minimumWidth, int maximumWidth)
          Sets the width limits for this component.
 void setWidthLimits(Limits widthLimits)
          Sets the width limits for this component.
 void setX(int x)
          Sets the component's x-coordinate.
 void setY(int y)
          Sets the component's y-coordinate.
 void store(Object context)
          Copies bound values from the component to the bind context.
 String toString()
           
 Component transferFocus(FocusTraversalDirection direction)
          Transfers focus to the next focusable component.
 void validate()
          Lays out the component by calling Skin.layout().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Component

public Component()
Method Detail

getAutomationID

public String getAutomationID()
Returns the component's automation ID.

Returns:
The component's automation ID, or null if the component does not have an automation ID.

setAutomationID

public void setAutomationID(String automationID)
Sets the component's automation ID. This value can be used to obtain a reference to the component via Automation.get(String) when the component is attached to a component hierarchy.

Parameters:
automationID - The automation ID to use for the component, or null to clear the automation ID.

getSkin

protected Skin getSkin()
Returns the currently installed skin.

Returns:
The currently installed skin.

setSkin

protected void setSkin(Skin skin)
Sets the skin, replacing any previous skin.

Parameters:
skin - The new skin.

installSkin

protected void installSkin(Class<? extends Component> componentClass)
Installs the skin for the given component class, as defined by the current theme.

Parameters:
componentClass -

getParent

public Container getParent()

setParent

protected void setParent(Container parent)

getWindow

public Window getWindow()

getDisplay

public Display getDisplay()

getAncestor

public Container getAncestor(Class<? extends Container> ancestorType)

getAncestor

public Container getAncestor(String ancestorTypeName)
                      throws ClassNotFoundException
Throws:
ClassNotFoundException

getWidth

public int getWidth()
Description copied from interface: Visual
Returns the visual's width.

Specified by:
getWidth in interface Visual

setWidth

public void setWidth(int width)

getHeight

public int getHeight()
Description copied from interface: Visual
Returns the visual's height.

Specified by:
getHeight in interface Visual

setHeight

public void setHeight(int height)

getSize

public Dimensions getSize()

setSize

public final void setSize(Dimensions size)

setSize

public void setSize(int width,
                    int height)
NOTE This method should only be called during layout. Callers should use setPreferredSize(int, int).

Specified by:
setSize in interface ConstrainedVisual
Parameters:
width -
height -

getPreferredWidth

public int getPreferredWidth()
Returns the component's unconstrained preferred width.


getPreferredWidth

public int getPreferredWidth(int height)
Returns the component's constrained preferred width.

Specified by:
getPreferredWidth in interface ConstrainedVisual
Parameters:
height - The height value by which the preferred width should be constrained, or -1 for no constraint.
Returns:
The constrained preferred width.

setPreferredWidth

public void setPreferredWidth(int preferredWidth)
Sets the component's preferred width.

Parameters:
preferredWidth - The preferred width value, or -1 to use the default value determined by the skin.

isPreferredWidthSet

public boolean isPreferredWidthSet()
Returns a flag indicating whether the preferred width was explicitly set by the caller or is the default value determined by the skin.

Returns:
true if the preferred width was explicitly set; false, otherwise.

getPreferredHeight

public int getPreferredHeight()
Returns the component's unconstrained preferred height.


getPreferredHeight

public int getPreferredHeight(int width)
Returns the component's constrained preferred height.

Specified by:
getPreferredHeight in interface ConstrainedVisual
Parameters:
width - The width value by which the preferred height should be constrained, or -1 for no constraint.
Returns:
The constrained preferred height.

setPreferredHeight

public void setPreferredHeight(int preferredHeight)
Sets the component's preferred height.

Parameters:
preferredHeight - The preferred height value, or -1 to use the default value determined by the skin.

isPreferredHeightSet

public boolean isPreferredHeightSet()
Returns a flag indicating whether the preferred height was explicitly set by the caller or is the default value determined by the skin.

Returns:
true if the preferred height was explicitly set; false, otherwise.

getPreferredSize

public Dimensions getPreferredSize()
Gets the component's unconstrained preferred size.

Specified by:
getPreferredSize in interface ConstrainedVisual

setPreferredSize

public final void setPreferredSize(Dimensions preferredSize)

setPreferredSize

public void setPreferredSize(int preferredWidth,
                             int preferredHeight)
Sets the component's preferred size.

Parameters:
preferredWidth - The preferred width value, or -1 to use the default value determined by the skin.
preferredHeight - The preferred height value, or -1 to use the default value determined by the skin.

isPreferredSizeSet

public boolean isPreferredSizeSet()
Returns a flag indicating whether the preferred size was explicitly set by the caller or is the default value determined by the skin.

Returns:
true if the preferred size was explicitly set; false, otherwise.

getMinimumWidth

public int getMinimumWidth()
Returns the minimum width of this component.


setMinimumWidth

public void setMinimumWidth(int minimumWidth)
Sets the minimum width of this component.

Parameters:
minimumWidth -

getMaximumWidth

public int getMaximumWidth()
Returns the maximum width of this component.


setMaximumWidth

public void setMaximumWidth(int maximumWidth)
Sets the maximum width of this component.

Parameters:
maximumWidth -

getWidthLimits

public Limits getWidthLimits()
Returns the width limits for this component.


setWidthLimits

public void setWidthLimits(int minimumWidth,
                           int maximumWidth)
Sets the width limits for this component.

Parameters:
minimumWidth -
maximumWidth -

setWidthLimits

public final void setWidthLimits(Limits widthLimits)
Sets the width limits for this component.

Parameters:
widthLimits -

getMinimumHeight

public int getMinimumHeight()
Returns the minimum height of this component.


setMinimumHeight

public void setMinimumHeight(int minimumHeight)
Sets the minimum height of this component.

Parameters:
minimumHeight -

getMaximumHeight

public int getMaximumHeight()
Returns the maximum height of this component.


setMaximumHeight

public void setMaximumHeight(int maximumHeight)
Sets the maximum height of this component.

Parameters:
maximumHeight -

getHeightLimits

public Limits getHeightLimits()
Returns the height limits for this component.


setHeightLimits

public void setHeightLimits(int minimumHeight,
                            int maximumHeight)
Sets the height limits for this component.

Parameters:
minimumHeight -
maximumHeight -

setHeightLimits

public final void setHeightLimits(Limits heightLimits)
Sets the height limits for this component.

Parameters:
heightLimits -

getX

public int getX()
Returns the component's x-coordinate.

Returns:
The component's horizontal position relative to the origin of the parent container.

setX

public void setX(int x)
Sets the component's x-coordinate.

Parameters:
x - The component's horizontal position relative to the origin of the parent container.

getY

public int getY()
Returns the component's y-coordinate.

Returns:
The component's vertical position relative to the origin of the parent container.

setY

public void setY(int y)
Sets the component's y-coordinate.

Parameters:
y - The component's vertical position relative to the origin of the parent container.

getLocation

public Point getLocation()
Returns the component's location.

Returns:
A point value containing the component's horizontal and vertical position relative to the origin of the parent container.

setLocation

public void setLocation(int x,
                        int y)
Sets the component's location. NOTE This method should only be called when performing layout. However, since some containers do not reposition components during layout, it is valid for callers to invoke this method directly when such containers.

Parameters:
x - The component's horizontal position relative to the origin of the parent container.
y - The component's vertical position relative to the origin of the parent container.

setLocation

public final void setLocation(Point location)
Sets the component's location.

Parameters:
location - A point value containing the component's horizontal and vertical position relative to the origin of the parent container.
See Also:
setLocation(int, int)

getBaseline

public int getBaseline()
Returns the component's baseline.

Specified by:
getBaseline in interface Visual
Returns:
The baseline relative to the origin of this component, or -1 if this component does not have a baseline.

getBaseline

public int getBaseline(int width,
                       int height)
Returns the component's baseline for a given width and height.

Specified by:
getBaseline in interface ConstrainedVisual
Returns:
The baseline relative to the origin of this component, or -1 if this component does not have a baseline.

getBounds

public Bounds getBounds()
Returns the component's bounding area.

Returns:
The component's bounding area. The x and y values are relative to the parent container.

getDecoratedBounds

public Bounds getDecoratedBounds()
Returns the component's bounding area including decorators.

Returns:
The decorated bounding area. The x and y values are relative to the parent container.

contains

public boolean contains(int xArgument,
                        int yArgument)
Determines if the component contains a given location. This method facilitates mouse interaction with non-rectangular components.

Parameters:
xArgument -
yArgument -
Returns:
true if the component's shape contains the given location; false, otherwise.
Throws:
UnsupportedOperationException - This method is not currently implemented.

isVisible

public boolean isVisible()
Returns the component's visibility.

Returns:
true if the component will be painted; false, otherwise.

setVisible

public void setVisible(boolean visible)
Sets the component's visibility.

Parameters:
visible - true if the component should be painted; false, otherwise.

getDecorators

public Component.DecoratorSequence getDecorators()
Returns the component's decorator sequence.

Returns:
The component's decorator sequence

mapPointToAncestor

public Point mapPointToAncestor(Container ancestor,
                                int xArgument,
                                int yArgument)
Maps a point in this component's coordinate system to the specified ancestor's coordinate space.

Parameters:
xArgument - The x-coordinate in this component's coordinate space
yArgument - The y-coordinate in this component's coordinate space
Returns:
A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.

mapPointToAncestor

public Point mapPointToAncestor(Container ancestor,
                                Point location)
Maps a point in this component's coordinate system to the specified ancestor's coordinate space.

Parameters:
location - The coordinates in this component's coordinate space
Returns:
A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.

mapPointFromAncestor

public Point mapPointFromAncestor(Container ancestor,
                                  int xArgument,
                                  int yArgument)
Maps a point in the specified ancestor's coordinate space to this component's coordinate system.

Parameters:
xArgument - The x-coordinate in the ancestors's coordinate space.
yArgument - The y-coordinate in the ancestor's coordinate space.
Returns:
A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.

mapPointFromAncestor

public Point mapPointFromAncestor(Container ancestor,
                                  Point location)

isShowing

public boolean isShowing()
Determines if this component is showing. To be showing, the component and all of its ancestors must be visible and attached to a display.

Returns:
true if this component is showing; false otherwise.

getVisibleArea

public Bounds getVisibleArea()
Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.

Returns:
The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.

getVisibleArea

public Bounds getVisibleArea(Bounds area)
Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.

Parameters:
area -
Returns:
The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.

getVisibleArea

public Bounds getVisibleArea(int xArgument,
                             int yArgument,
                             int width,
                             int height)
Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.

Parameters:
xArgument -
yArgument -
width -
height -
Returns:
The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.

scrollAreaToVisible

public void scrollAreaToVisible(Bounds area)
Ensures that the given area of a component is visible within the viewports of all applicable ancestors.

Parameters:
area -

scrollAreaToVisible

public void scrollAreaToVisible(int xArgument,
                                int yArgument,
                                int width,
                                int height)
Ensures that the given area of a component is visible within the viewports of all applicable ancestors.

Parameters:
xArgument -
yArgument -
width -
height -

isValid

public boolean isValid()
Returns the component's valid state.


invalidate

public void invalidate()
Flags the component's hierarchy as invalid, and clears any cached preferred size.


validate

public void validate()
Lays out the component by calling Skin.layout().


layout

protected void layout()
Called to lay out the component.


repaint

public final void repaint()
Flags the entire component as needing to be repainted.


repaint

public final void repaint(boolean immediate)
Flags the entire component as needing to be repainted.

Parameters:
immediate -

repaint

public final void repaint(Bounds area)
Flags an area as needing to be repainted.

Parameters:
area -

repaint

public final void repaint(Bounds area,
                          boolean immediate)
Flags an area as needing to be repainted or repaints the rectangle immediately.

Parameters:
area -
immediate -

repaint

public final void repaint(int xArgument,
                          int yArgument,
                          int width,
                          int height)
Flags an area as needing to be repainted.

Parameters:
xArgument -
yArgument -
width -
height -

repaint

public void repaint(int xArgument,
                    int yArgument,
                    int width,
                    int height,
                    boolean immediate)
Flags an area as needing to be repainted.

Parameters:
xArgument -
yArgument -
width -
height -
immediate -

paint

public void paint(Graphics2D graphics)
Paints the component. Delegates to the skin.

Specified by:
paint in interface Visual
Parameters:
graphics - The graphics context in which to paint the visual.

getGraphics

public Graphics2D getGraphics()
Creates a graphics context for this component. This graphics context will not be double buffered. In other words, drawing operations on it will operate directly on the video RAM.

Returns:
A graphics context for this component, or null if this component is not showing.
See Also:
isShowing()

isEnabled

public boolean isEnabled()
Returns the component's enabled state.

Returns:
true if the component is enabled; false, otherwise.

setEnabled

public void setEnabled(boolean enabled)
Sets the component's enabled state. Enabled components respond to user input events; disabled components do not.

Parameters:
enabled - true if the component is enabled; false, otherwise.

isBlocked

public boolean isBlocked()
Determines if this component is blocked. A component is blocked if the component or any of its ancestors is disabled.

Returns:
true if the component is blocked; false, otherwise.

isMouseOver

public boolean isMouseOver()
Determines if the mouse is positioned over this component.

Returns:
true if the mouse is currently located over this component; false, otherwise.

getMouseLocation

public Point getMouseLocation()
Returns the current mouse location in the component's coordinate space.

Returns:
The current mouse location, or null if the mouse is not currently positioned over this component.

getCursor

public Cursor getCursor()
Returns the cursor that is displayed when the mouse pointer is over this component.

Returns:
The cursor that is displayed over the component.

setCursor

public void setCursor(Cursor cursor)
Sets the cursor that is displayed when the mouse pointer is over this component.

Parameters:
cursor - The cursor to display over the component, or null to inherit the cursor of the parent container.

getTooltipText

public String getTooltipText()
Returns the component's tooltip text.

Returns:
The component's tooltip text, or null if no tooltip is specified.

setTooltipText

public void setTooltipText(String tooltipText)
Sets the component's tooltip text.

Parameters:
tooltipText - The component's tooltip text, or null for no tooltip.

getTooltipDelay

public int getTooltipDelay()
Returns the component's tooltip delay.

Returns:
The tooltip delay, in milliseconds.

setTooltipDelay

public void setTooltipDelay(int tooltipDelay)
Sets the component's tooltip delay.

Parameters:
tooltipDelay - The tooltip delay, in milliseconds.

getTooltipWrapText

public boolean getTooltipWrapText()
Returns the tooltip's mode for wrapping its text.

Returns:
true if the tooltip text wrap mode is enabled; false if not.

setTooltipWrapText

public void setTooltipWrapText(boolean tooltipWrapText)
Sets the tooltip's text wrapping mode.

Parameters:
tooltipWrapText - The component's tooltip text wrap mode.

isOpaque

public boolean isOpaque()
Tells whether or not this component is fully opaque when painted.

Returns:
true if this component is opaque; false if any part of it is transparent or translucent.

isFocusable

public boolean isFocusable()
Returns this component's focusability. A focusable component is capable of receiving the focus only when it is showing, unblocked, and its window is not closing.

Returns:
true if the component is capable of receiving the focus; false, otherwise.

isFocused

public boolean isFocused()
Returns the component's focused state.

Returns:
true if the component has the input focus; false otherwise.

setFocused

protected void setFocused(boolean focused,
                          Component obverseComponent)
Called to notify a component that its focus state has changed.

Parameters:
focused - true if the component has received the input focus; false if the component has lost the focus.
obverseComponent - If focused is true, the component that has lost the focus; otherwise, the component that has gained the focus.

requestFocus

public boolean requestFocus()
Requests that focus be given to this component.

Returns:
true if the component gained the focus; false otherwise.

transferFocus

public Component transferFocus(FocusTraversalDirection direction)
Transfers focus to the next focusable component.

Parameters:
direction - The direction in which to transfer focus.

getFocusedComponent

public static Component getFocusedComponent()
Returns the currently focused component.

Returns:
The component that currently has the focus, or null if no component is focused.

clearFocus

public static void clearFocus()
Clears the focus.


load

public void load(Object context)
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.

Parameters:
context -

store

public void store(Object context)
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.

Parameters:
context -

clear

public void clear()
Clears any bound values in the component.


getDragSource

public DragSource getDragSource()

setDragSource

public void setDragSource(DragSource dragSource)

getDropTarget

public DropTarget getDropTarget()

setDropTarget

public void setDropTarget(DropTarget dropTarget)

getMenuHandler

public MenuHandler getMenuHandler()

setMenuHandler

public void setMenuHandler(MenuHandler menuHandler)

getName

public String getName()
Returns the component's name.


setName

public void setName(String name)
Sets the component's name.

Parameters:
name -

getStyles

public final Component.StyleDictionary getStyles()
Returns the component's style dictionary.


setStyles

public void setStyles(Map<String,?> styles)
Applies a set of styles.

Parameters:
styles - A map containing the styles to apply.

setStyles

public void setStyles(String styles)
               throws SerializationException
Applies a set of styles.

Parameters:
styles - The styles encoded as a JSON map.
Throws:
SerializationException

getTypedStyles

public static Map<Class<? extends Component>,Map<String,?>> getTypedStyles()
Returns the typed style dictionary.


getNamedStyles

public static Map<String,Map<String,?>> getNamedStyles()
Returns the named style dictionary.


setStyleName

public void setStyleName(String styleName)
Applies a set of named styles.

Parameters:
styleName -

setStyleNames

public void setStyleNames(Sequence<String> styleNames)
Applies a set of named styles.

Parameters:
styleNames -

setStyleNames

public void setStyleNames(String styleNames)
Applies a set of named styles.

Parameters:
styleNames -

getUserData

public Component.UserDataDictionary getUserData()
Returns the user data dictionary.


getAttribute

public <T extends Enum<T>> Object getAttribute(T key)
Gets the specified component attribute. While attributes can be used to store arbitrary data, they are intended to be used by containers to store layout-related metadata in their child components.

Parameters:
key - The attribute key
Returns:
The attribute value, or null if no such attribute exists

setAttribute

public <T extends Enum<T>> Object setAttribute(T key,
                                               Object value)
Sets the specified component attribute. While attributes can be used to store arbitrary data, they are intended to be used by containers to store layout-related metadata in their child components.

Parameters:
key - The attribute key
value - The attribute value, or null to clear the attribute
Returns:
The previous value of the attribute, or null if the attribute was unset

reenterMouse

public void reenterMouse()
If the mouse is currently over the component, causes the component to fire mouseOut() and a mouseMove() at the current mouse location.

This method is primarily useful when consuming container mouse motion events, since it allows a caller to reset the mouse state based on the event consumption logic.


mouseMove

protected boolean mouseMove(int xArgument,
                            int yArgument)

mouseOver

protected void mouseOver()

mouseOut

protected void mouseOut()

mouseDown

protected boolean mouseDown(Mouse.Button button,
                            int xArgument,
                            int yArgument)

mouseUp

protected boolean mouseUp(Mouse.Button button,
                          int xArgument,
                          int yArgument)

mouseClick

protected boolean mouseClick(Mouse.Button button,
                             int xArgument,
                             int yArgument,
                             int count)

mouseWheel

protected boolean mouseWheel(Mouse.ScrollType scrollType,
                             int scrollAmount,
                             int wheelRotation,
                             int xArgument,
                             int yArgument)

keyTyped

protected boolean keyTyped(char character)

keyPressed

protected boolean keyPressed(int keyCode,
                             Keyboard.KeyLocation keyLocation)

keyReleased

protected boolean keyReleased(int keyCode,
                              Keyboard.KeyLocation keyLocation)

toString

public String toString()
Overrides:
toString in class Object

getComponentListeners

public ListenerList<ComponentListener> getComponentListeners()

getComponentStateListeners

public ListenerList<ComponentStateListener> getComponentStateListeners()

getComponentDecoratorListeners

public ListenerList<ComponentDecoratorListener> getComponentDecoratorListeners()

getComponentStyleListeners

public ListenerList<ComponentStyleListener> getComponentStyleListeners()

getComponentMouseListeners

public ListenerList<ComponentMouseListener> getComponentMouseListeners()

getComponentMouseButtonListeners

public ListenerList<ComponentMouseButtonListener> getComponentMouseButtonListeners()

getComponentMouseWheelListeners

public ListenerList<ComponentMouseWheelListener> getComponentMouseWheelListeners()

getComponentKeyListeners

public ListenerList<ComponentKeyListener> getComponentKeyListeners()

getComponentTooltipListeners

public ListenerList<ComponentTooltipListener> getComponentTooltipListeners()

getComponentDataListeners

public ListenerList<ComponentDataListener> getComponentDataListeners()

getComponentClassListeners

public static ListenerList<ComponentClassListener> getComponentClassListeners()

indexBoundsCheck

protected static final void indexBoundsCheck(String indexName,
                                             int index,
                                             int min,
                                             int max)
                                      throws IndexOutOfBoundsException
Provide a nice exception message for out of range values.

Throws:
IndexOutOfBoundsException - if index is out of range.