de.matthiasmann.twl
Class Widget

java.lang.Object
  extended by de.matthiasmann.twl.Widget
Direct Known Subclasses:
AnimatedWindow, BorderLayout, BoxLayout, ComboBoxBase, Container, DesktopArea, DialogLayout, EditField, FolderBrowser, Graph, GUI, ListBox, PositionAnimatedPanel, ResizableFrame, Scrollbar, ScrollPane, SplitPane, TabbedPane, TableBase, TextArea, TextWidget, TreePathDisplay, ValueAdjuster, WheelWidget

public class Widget
extends java.lang.Object

Root of the TWL class hierarchy.

When subclassing the following methods should be overridden to ensure correct layout behavior:

The following methods are events and can be overridden when needed:

NOTE: The only thread safe methods of TWL are:


Nested Class Summary
static interface Widget.OffscreenMouseAdjustments
           
static interface Widget.RenderOffscreen
          When this interface is installed in a Widget then the widget tries to render into an offscreen surface.
 
Field Summary
static AnimationState.StateKey STATE_DISABLED
           
static AnimationState.StateKey STATE_HAS_FOCUSED_CHILD
           
static AnimationState.StateKey STATE_HAS_OPEN_POPUPS
           
static AnimationState.StateKey STATE_KEYBOARD_FOCUS
           
 
Constructor Summary
Widget()
          Creates a Widget with it's own animation state
Widget(AnimationState animState)
          Creates a Widget with a shared animation state
Widget(AnimationState animState, boolean inherit)
          Creates a Widget with a shared or inherited animation state
 
Method Summary
 void add(Widget child)
          Adds a new child at the end of this widget.
protected  void addActionMapping(java.lang.String action, java.lang.String methodName, java.lang.Object... params)
          Installs an action mapping for the given action in the current action map.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener for all properties.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener for a specific property.
 void adjustSize()
          Auto adjust the size of this widget based on it's preferred size.
protected  void afterAddToGUI(GUI gui)
          Called after this widget has been added to a GUI tree.
protected  void allChildrenRemoved()
          All children have been removed.
protected  void applyTheme(ThemeInfo themeInfo)
          Apply the given theme.
protected  void applyThemeBackground(ThemeInfo themeInfo)
           
protected  void applyThemeBorder(ThemeInfo themeInfo)
           
protected  void applyThemeInputMap(ThemeInfo themeInfo)
           
protected  void applyThemeMaxSize(ThemeInfo themeInfo)
           
protected  void applyThemeMinSize(ThemeInfo themeInfo)
           
protected  void applyThemeMouseCursor(ThemeInfo themeInfo)
           
protected  void applyThemeOffscreenExtra(ThemeInfo themeInfo)
           
protected  void applyThemeOverlay(ThemeInfo themeInfo)
           
protected  void applyThemeTooltip(ThemeInfo themeInfo)
           
protected  void beforeRemoveFromGUI(GUI gui)
          Called when this widget is removed from the GUI tree.
protected  void borderChanged()
          Called when the border size has changed.
 boolean canAcceptKeyboardFocus()
           
protected  void childAdded(Widget child)
          A new child has been added.
protected  void childInvalidateLayout(Widget child)
          Called when the layout of a child has been invalidated.
protected  void childRemoved(Widget exChild)
          A child has been removed.
protected  void childVisibilityChanged(Widget child)
          Called when the visibility state of a child was changed.
static int computeSize(int min, int preferred, int max)
          A helper method to compute the size of a widget based on min, max and preferred size.
 void destroy()
          Clean up GL resources.
protected  void firePropertyChange(java.beans.PropertyChangeEvent evt)
          Fire an existing PropertyChangeEvent to any registered listeners.
protected  void firePropertyChange(java.lang.String propertyName, boolean oldValue, boolean newValue)
          Report a bound property update to any registered listeners.
protected  void firePropertyChange(java.lang.String propertyName, int oldValue, int newValue)
          Report a bound property update to any registered listeners.
protected  void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Report a bound property update to any registered listeners.
 boolean focusFirstChild()
           
 boolean focusLastChild()
           
 boolean focusNextChild()
           
 boolean focusPrevChild()
           
 ActionMap getActionMap()
          Returns the current action map.
 AnimationState getAnimationState()
          Returns the animation state object.
 Image getBackground()
          Returns the current background image or null.
 short getBorderBottom()
           
 int getBorderHorizontal()
           
 short getBorderLeft()
           
 short getBorderRight()
           
 short getBorderTop()
           
 int getBorderVertical()
           
 int getBottom()
          Returns the bottom Y coordinate of this widget
 Widget getChild(int index)
          Returns the child at the given index
protected  Widget getChildAt(int x, int y)
          Returns the visible child widget which is at the specified coordinate.
 int getChildIndex(Widget child)
          Returns the index of the specified child in this widget.
 GUI getGUI()
          Returns the GUI root of this widget tree if it has one.
 int getHeight()
          Returns the height of this widget This property can be bound and fires PropertyChangeEvent
 int getInnerBottom()
          Returns the bottom Y coordinate while taking the bottom border into account.
 int getInnerHeight()
          The inner height takes the top and bottom border into account.
 int getInnerRight()
          Returns the right X coordinate while taking the right border into account.
 int getInnerWidth()
          The inner width takes the left and right border into account.
 int getInnerX()
          The inner X position takes the left border into account
 int getInnerY()
          The inner Y position takes the top border into account
 InputMap getInputMap()
          Returns the current input map.
protected  java.util.List<Widget> getKeyboardFocusOrder()
          Returns all children of this widget in their focus travel order.
 int getMaxHeight()
          Returns the maximum height of the widget.
 int getMaxWidth()
          Returns the maximum width of the widget.
 int getMinHeight()
          Returns the minimum height of the widget.
 int getMinWidth()
          Returns the minimum width of the widget.
 MouseCursor getMouseCursor()
           
 MouseCursor getMouseCursor(Event evt)
          Returns the mouse cursor which should be used for the given mouse coordinates and modifiers.
 int getNumChildren()
          Returns the number of children in this widget.
 short getOffscreenExtraBottom()
           
 short getOffscreenExtraLeft()
           
 short getOffscreenExtraRight()
           
 short getOffscreenExtraTop()
           
 ActionMap getOrCreateActionMap()
          Returns the current action map.
 Image getOverlay()
          Returns the current overlay image or null.
 Widget getParent()
          Returns the parent of this widget or null if it is the tree root.
 int getPreferredHeight()
          Returns the preferred height.
 int getPreferredInnerHeight()
          Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children.
 int getPreferredInnerWidth()
          Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children.
 int getPreferredWidth()
          Returns the preferred width based on it's children and preferred inner width.
 Widget.RenderOffscreen getRenderOffscreen()
          Returns the currently active offscreen rendering delegate or null if none was set
 int getRight()
          Returns the right X coordinate of this widget
 Widget getRootWidget()
          Returns the root of this widget tree.
 java.lang.String getTheme()
          Returns the current theme name of this widget.
 java.lang.String getThemePath()
          Returns this widget's theme path by concatenating the theme names from all parents separated by '.'.
protected  java.lang.Object getThemeTooltipContent()
           
 TintAnimator getTintAnimator()
          Returns the current tine animation object or null if none was set
 java.lang.Object getTooltipContent()
          Returns the currently set tooltip content.
protected  java.lang.Object getTooltipContentAt(int mouseX, int mouseY)
          Automatic tooltip support.
 Widget getWidgetAt(int x, int y)
          Returns the visible widget at the specified location.
 int getWidth()
          Returns the width of this widget This property can be bound and fires PropertyChangeEvent
 int getX()
          Returns the absolute X coordinate of widget in it's tree This property can be bound and fires PropertyChangeEvent
 int getY()
          Returns the absolute Y coordinate of widget in it's tree This property can be bound and fires PropertyChangeEvent
 void giveupKeyboardFocus()
          If this widget currently has the keyboard focus, then the keyboard focus is removed.
protected  boolean handleEvent(Event evt)
          Called when an event occurred that this widget could be interested in.
protected  boolean handleKeyStrokeAction(java.lang.String action, Event event)
          Called when a key stroke was found in the inputMap.
 boolean hasKeyboardFocus()
          Checks if this widget has the keyboard focus
 boolean hasOpenPopups()
          Checks whether this widget or atleast one of it's children owns an open popup.
 boolean hasSharedAnimationState()
          Returns true if the animation state of this widget is shared with another widget.
 void insertChild(Widget child, int index)
          Inserts a new child into this widget.
 void invalidateLayout()
          Called when something has changed which affected the layout of this widget.
protected  void invalidateLayoutLocally()
          Invalidates only the layout of this widget.
static boolean isAbsoluteTheme(java.lang.String theme)
          Checks if the given theme name is absolute or relative to it's parent.
 boolean isClip()
          Returns true if paint() is clipped to this widget.
 boolean isDepthFocusTraversal()
           
 boolean isEnabled()
          Checks if this widget and all it's parents are enabled.
 boolean isFocusKeyEnabled()
          Returns if this widget will handle the FOCUS_KEY.
 boolean isInside(int x, int y)
          Checks if the given absolute (to this widget's tree) coordinates are inside this widget.
 boolean isLocallyEnabled()
          Returns the local enabled state of this widget.
protected  boolean isMouseInside(Event evt)
          Checks whether the mouse is inside the widget or not.
 boolean isVisible()
          Returns the current visibility flag of this widget.
protected  void keyboardFocusChildChanged(Widget child)
          The current keyboard focus child has changed.
protected  void keyboardFocusGained()
          Called when this widget has gained the keyboard focus.
protected  void keyboardFocusGained(FocusGainedCause cause, Widget previousWidget)
          Called when this widget has gained the keyboard focus.
protected  void keyboardFocusLost()
          Called when this widget has lost the keyboard focus.
protected  void layout()
          Called when the layoutInvalid flag is set.
protected  void layoutChildFullInnerArea(Widget child)
          Sets size and position of a child widget so that it consumes the complete inner area.
protected  void layoutChildrenFullInnerArea()
          Sets size and position of all child widgets so that they all consumes the complete inner area.
protected  void moveChild(int from, int to)
          Moves the child at index from to index to.
protected  void paint(GUI gui)
          Paints this widget and it's children.
protected  void paintBackground(GUI gui)
          Paint the background image of this widget.
protected  void paintChild(GUI gui, Widget child)
          Paints a specified child.
protected  void paintChildren(GUI gui)
          Paints all children in index order.
protected  void paintDragOverlay(GUI gui, int mouseX, int mouseY, int modifier)
          Called after all other widgets have been rendered when a drag operation is in progress.
protected  void paintOverlay(GUI gui)
          Paints the overlay image of this widget.
protected  void paintWidget(GUI gui)
          Called by paint(de.matthiasmann.twl.GUI) after painting the background and before painting all children.
protected  void positionChanged()
          Called when the position of this widget was changed.
 void reapplyTheme()
          If the widget changed some internal state which may require different theme information then this function can be used to reapply the current theme.
 void removeAllChildren()
          Removes all children of this widget.
 Widget removeChild(int index)
          Removes the specified child from this widget.
 boolean removeChild(Widget child)
          Removes the specified child from this widget.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener.
 boolean requestKeyboardFocus()
          Requests that the keyboard focus is transfered to this widget.
protected  boolean requestKeyboardFocus(Widget child)
          A child requests keyboard focus.
protected  void resetTooltip()
          If this widget currently has an open tooltip then this tooltip is reset and the tooltip timer is restarted.
 void setActionMap(ActionMap actionMap)
          Installs an action map for this widget.
 void setBackground(Image background)
          Sets the background image that should be drawn before drawing this widget
 boolean setBorderSize(Border border)
          Sets the border width for this widget.
 boolean setBorderSize(int border)
          Sets a uniform border for this widget.
 boolean setBorderSize(int horizontal, int vertical)
          Sets a border for this widget.
 boolean setBorderSize(int top, int left, int bottom, int right)
          Sets a border for this widget.
 void setCanAcceptKeyboardFocus(boolean canAcceptKeyboardFocus)
           
 void setClip(boolean clip)
          Sets whether paint() must be clipped to this Widget or not.
 void setDepthFocusTraversal(boolean depthFocusTraversal)
           
 void setEnabled(boolean enabled)
          Sets the local enabled state of that widget.
 void setFocusKeyEnabled(boolean focusKeyEnabled)
          Controls the handling of the FOCUS_KEY.
 boolean setInnerSize(int width, int height)
          Changes the inner size of this widget.
 void setInputMap(InputMap inputMap)
          Sets the input map for key strokes.
 void setMaxSize(int width, int height)
          Sets the maximum size of the widget.
 void setMinSize(int width, int height)
          Sets the minimum size of the widget.
 void setMouseCursor(MouseCursor mouseCursor)
           
 void setOffscreenExtra(Border offscreenExtra)
          Sets the offscreen rendering extra area for this widget.
 void setOffscreenExtra(int top, int left, int bottom, int right)
          Sets the offscreen rendering extra area for this widget.
 void setOverlay(Image overlay)
          Sets the overlay image that should be drawn after drawing the children
 boolean setPosition(int x, int y)
          Changes the position of this widget.
 void setRenderOffscreen(Widget.RenderOffscreen renderOffscreen)
          Sets set offscreen rendering delegate.
 boolean setSize(int width, int height)
          Changes the size of this widget.
 void setTheme(java.lang.String theme)
          Changes the theme name of this widget - DOES NOT call reapplyTheme()
 void setTintAnimator(TintAnimator tintAnimator)
          Sets the tint animation object.
 void setTooltipContent(java.lang.Object tooltipContent)
          Changes the tooltip context.
 void setVisible(boolean visible)
          Changes the visibility flag of this widget.
protected  void sizeChanged()
          Called when the size of this widget has changed.
protected  void updateTintAnimation()
          Updates the tint animation when a fade is active.
protected  void updateTooltip()
          Called by setTooltipContent and applyThemeTooltip.
 void validateLayout()
          Calls layout() if the layout is marked invalid.
protected  void widgetDisabled()
          This method is called when this widget has been disabled, either directly or one of it's parents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_KEYBOARD_FOCUS

public static final AnimationState.StateKey STATE_KEYBOARD_FOCUS

STATE_HAS_OPEN_POPUPS

public static final AnimationState.StateKey STATE_HAS_OPEN_POPUPS

STATE_HAS_FOCUSED_CHILD

public static final AnimationState.StateKey STATE_HAS_FOCUSED_CHILD

STATE_DISABLED

public static final AnimationState.StateKey STATE_DISABLED
Constructor Detail

Widget

public Widget()
Creates a Widget with it's own animation state

The initial theme name is the lower case version of the simple class name of the concrete subclass - or in pseudo code:

getClass().getSimpleName().toLowerCase() 

See Also:
setTheme(java.lang.String)

Widget

public Widget(AnimationState animState)
Creates a Widget with a shared animation state

The initial theme name is the lower case version of the simple class name of the concrete subclass - or in pseudo code:

getClass().getSimpleName().toLowerCase() 

Parameters:
animState - the animation state to share, can be null
See Also:
setTheme(java.lang.String)

Widget

public Widget(AnimationState animState,
              boolean inherit)
Creates a Widget with a shared or inherited animation state

The initial theme name is the lower case version of the simple class name of the concrete subclass - or in pseudo code:

getClass().getSimpleName().toLowerCase() 

Parameters:
animState - the animation state to share or inherit, can be null
inherit - true if the animation state should be inherited, false for sharing
See Also:
AnimationState.AnimationState(de.matthiasmann.twl.AnimationState), setTheme(java.lang.String)
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener for all properties.

Parameters:
listener - The PropertyChangeListener to be added
See Also:
PropertyChangeSupport.addPropertyChangeListener(java.beans.PropertyChangeListener)

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property.

Parameters:
propertyName - The name of the property to listen on
listener - The PropertyChangeListener to be added
See Also:
PropertyChangeSupport.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener.

Parameters:
listener - The PropertyChangeListener to be removed
See Also:
PropertyChangeSupport.removePropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener.

Parameters:
propertyName - The name of the property that was listened on
listener - The PropertyChangeListener to be removed
See Also:
PropertyChangeSupport.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

hasOpenPopups

public boolean hasOpenPopups()
Checks whether this widget or atleast one of it's children owns an open popup.

Returns:
true if atleast own open popup is owned (indirectly) by this widget.

getParent

public final Widget getParent()
Returns the parent of this widget or null if it is the tree root. All coordinates are relative to the root of the widget tree.

Returns:
the parent of this widget or null if it is the tree root

getRootWidget

public final Widget getRootWidget()
Returns the root of this widget tree. All coordinates are relative to the root of the widget tree.

Returns:
the root of this widget tree

getGUI

public final GUI getGUI()
Returns the GUI root of this widget tree if it has one.

Once a widget is added (indirectly) to a GUI object it will be part of that GUI tree.

This method is thread safe.

Repeated calls may not return the same result. Use it like this:

 GUI gui = getGUI();
 if(gui != null) {
     gui.invokeLater(....);
 }
 

Returns:
the GUI root or null if the root is not a GUI instance.
See Also:
afterAddToGUI(de.matthiasmann.twl.GUI), beforeRemoveFromGUI(de.matthiasmann.twl.GUI)

isVisible

public final boolean isVisible()
Returns the current visibility flag of this widget. This does not check if the widget is clipped or buried behind another widget.

Returns:
the current visibility flag of this widget

setVisible

public void setVisible(boolean visible)
Changes the visibility flag of this widget. Widgets are by default visible. Invisible widgets don't receive paint() or handleEvent() calls

Parameters:
visible - the new visibility flag

isLocallyEnabled

public final boolean isLocallyEnabled()
Returns the local enabled state of this widget. If one of it's parents is disabled then this widget will also be disabled even when it's local enabled state is true.

Returns:
the local enabled state.
See Also:
isEnabled(), setEnabled(boolean)

isEnabled

public final boolean isEnabled()
Checks if this widget and all it's parents are enabled. If one of it's parents is disabled then it will return false. This is the effective enabled state which is also represented as animation state with inverse polarity STATE_DISABLED If a widget is disabled it will not receive keyboard or mouse events except MOUSE_ENTERED and MOUSE_EXITED

Returns:
the effective enabled state
See Also:
isEnabled(), setEnabled(boolean)

setEnabled

public void setEnabled(boolean enabled)
Sets the local enabled state of that widget. The effective enabled state of the widget is the effective enabled state of it's parent and it's local enabled state. The effective enabled state is exposed as animation state but with inverse polarity as STATE_DISABLED. On disabling the keyboard focus will be removed. If a widget is disabled it will not receive keyboard or mouse events except MOUSE_ENTERED and MOUSE_EXITED

Parameters:
enabled - true if the widget should be locally enabled
See Also:
isEnabled(), isLocallyEnabled()

getX

public final int getX()
Returns the absolute X coordinate of widget in it's tree This property can be bound and fires PropertyChangeEvent

Returns:
the absolute X coordinate of widget in it's tree
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getY

public final int getY()
Returns the absolute Y coordinate of widget in it's tree This property can be bound and fires PropertyChangeEvent

Returns:
the absolute Y coordinate of widget in it's tree
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getWidth

public final int getWidth()
Returns the width of this widget This property can be bound and fires PropertyChangeEvent

Returns:
the width of this widget
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getHeight

public final int getHeight()
Returns the height of this widget This property can be bound and fires PropertyChangeEvent

Returns:
the height of this widget
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getRight

public final int getRight()
Returns the right X coordinate of this widget

Returns:
getX() + getWidth()

getBottom

public final int getBottom()
Returns the bottom Y coordinate of this widget

Returns:
getY() + getHeight()

getInnerX

public final int getInnerX()
The inner X position takes the left border into account

Returns:
getX() + getBorderLeft()

getInnerY

public final int getInnerY()
The inner Y position takes the top border into account

Returns:
getY() + getBorderTop()

getInnerWidth

public final int getInnerWidth()
The inner width takes the left and right border into account.

Returns:
the inner width - never negative

getInnerHeight

public final int getInnerHeight()
The inner height takes the top and bottom border into account.

Returns:
the inner height - never negative

getInnerRight

public final int getInnerRight()
Returns the right X coordinate while taking the right border into account.

Returns:
getInnerX() + getInnerWidth()

getInnerBottom

public final int getInnerBottom()
Returns the bottom Y coordinate while taking the bottom border into account.

Returns:
getInnerY() + getInnerHeight()

isInside

public boolean isInside(int x,
                        int y)
Checks if the given absolute (to this widget's tree) coordinates are inside this widget.

Parameters:
x - the X coordinate to test
y - the Y coordinate to test
Returns:
true if it was inside

setPosition

public boolean setPosition(int x,
                           int y)
Changes the position of this widget.

When the position has changed then

This method should only be called from within the layout() method of the parent. Otherwise it could lead to bad interaction with theming and result in a wrong position after the theme has been applied.

NOTE: Position is absolute in the widget's tree.

Parameters:
x - The new x position, can be negative
y - The new y position, can be negative
Returns:
true if the position was changed, false if new position == old position
See Also:
layout()

setSize

public boolean setSize(int width,
                       int height)
Changes the size of this widget. Zero size is allowed but not negative. Size is not checked against parent widgets. When the size has changed then - the parent widget's childChangedSize is called - sizeChanged is called - PropertyChangeEvent are fired for "width" and "height" This method should only be called from within the layout() method of the parent. Otherwise it could lead to bad interaction with theming and result in a wrong size after the theme has been applied.

Parameters:
width - The new width (including border)
height - The new height (including border)
Returns:
true if the size was changed, false if new size == old size
Throws:
java.lang.IllegalArgumentException - if the size is negative
See Also:
sizeChanged(), layout()

setInnerSize

public boolean setInnerSize(int width,
                            int height)
Changes the inner size of this widget. Calls setSize after adding the border width/height.

Parameters:
width - The new width (exclusive border)
height - The new height (exclusive border)
Returns:
true if the size was changed, false if new size == old size
See Also:
setSize(int,int)

getBorderTop

public short getBorderTop()

getBorderLeft

public short getBorderLeft()

getBorderBottom

public short getBorderBottom()

getBorderRight

public short getBorderRight()

getBorderHorizontal

public int getBorderHorizontal()

getBorderVertical

public int getBorderVertical()

setBorderSize

public boolean setBorderSize(int top,
                             int left,
                             int bottom,
                             int right)
Sets a border for this widget.

Parameters:
top - the top border
left - the left border
bottom - the bottom border
right - the right border
Returns:
true if the border values have changed
Throws:
java.lang.IllegalArgumentException - if any of the parameters is negative.

setBorderSize

public boolean setBorderSize(int horizontal,
                             int vertical)
Sets a border for this widget.

Parameters:
horizontal - the border width for left and right
vertical - the border height for top and bottom
Returns:
true if the border values have changed
Throws:
java.lang.IllegalArgumentException - if horizontal or vertical is negative.

setBorderSize

public boolean setBorderSize(int border)
Sets a uniform border for this widget.

Parameters:
border - the border width/height on all edges
Returns:
true if the border values have changed
Throws:
java.lang.IllegalArgumentException - if border is negative.

setBorderSize

public boolean setBorderSize(Border border)
Sets the border width for this widget.

Parameters:
border - the border object or null for no border
Returns:
true if the border values have changed

getOffscreenExtraTop

public short getOffscreenExtraTop()

getOffscreenExtraLeft

public short getOffscreenExtraLeft()

getOffscreenExtraBottom

public short getOffscreenExtraBottom()

getOffscreenExtraRight

public short getOffscreenExtraRight()

setOffscreenExtra

public void setOffscreenExtra(int top,
                              int left,
                              int bottom,
                              int right)
Sets the offscreen rendering extra area for this widget.

Parameters:
top - the extra area on top
left - the extra area on left
bottom - the extra area on bottom
right - the extra area on right
Throws:
java.lang.IllegalArgumentException - if any of the parameters is negative.
See Also:
setRenderOffscreen(de.matthiasmann.twl.Widget.RenderOffscreen)

setOffscreenExtra

public void setOffscreenExtra(Border offscreenExtra)
Sets the offscreen rendering extra area for this widget.

Parameters:
offscreenExtra - the border object or null for no extra area
Throws:
java.lang.IllegalArgumentException - if any of the values is negative.
See Also:
setRenderOffscreen(de.matthiasmann.twl.Widget.RenderOffscreen)

getMinWidth

public int getMinWidth()
Returns the minimum width of the widget. Layout manager will allocate atleast the minimum width to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Returns:
the minimum width of the widget

getMinHeight

public int getMinHeight()
Returns the minimum height of the widget. Layout manager will allocate atleast the minimum height to a widget even when the container is not big enough. The default implementation will not return values smaller then the current border width.

Returns:
the minimum height of the widget

setMinSize

public void setMinSize(int width,
                       int height)
Sets the minimum size of the widget. This size includes the border.

The minimum size is set via the theme in applyThemeMinSize(de.matthiasmann.twl.ThemeInfo)

Parameters:
width - the minimum width
height - the minimum height
Throws:
java.lang.IllegalArgumentException - when width or height is negative
See Also:
getMinWidth(), getMinHeight()

getPreferredInnerWidth

public int getPreferredInnerWidth()
Computes the preferred inner width (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Returns:
the preferred inner width

getPreferredWidth

public int getPreferredWidth()
Returns the preferred width based on it's children and preferred inner width. Subclasses can overwrite this method to compute the preferred size differently.

Returns:
the preferred width.
See Also:
getPreferredInnerWidth()

getPreferredInnerHeight

public int getPreferredInnerHeight()
Computes the preferred inner height (the size of the widget without the border) The default implementation uses the current position of the children. It is highly recommended to override this method as the default implementation lead to unstable layouts. The default behavior might change in the future to provide a better default behavior.

Returns:
the preferred inner height

getPreferredHeight

public int getPreferredHeight()
Returns the preferred height. This method determines the preferred height based on it's children. Subclasses can overwrite this method to compute the preferred size differently.

Returns:
the preferred height.
See Also:
getPreferredInnerHeight()

getMaxWidth

public int getMaxWidth()
Returns the maximum width of the widget. A maximum of 0 means that the widgets wants it's preferred size and no extra space from layout. A value > 0 is used for widgets which can expand to cover available area to that maximum.

Returns:
the maximum width

getMaxHeight

public int getMaxHeight()
Returns the maximum height of the widget. A maximum of 0 means that the widgets wants it's preferred size and no extra space from layout. A value > 0 is used for widgets which can expand to cover available area to that maximum.

Returns:
the maximum height

setMaxSize

public void setMaxSize(int width,
                       int height)
Sets the maximum size of the widget. A value of 0 means no expansion, use Short.MAX_VALUE for unbounded expansion.

The maximum size is set via the theme in applyThemeMaxSize(de.matthiasmann.twl.ThemeInfo)

Parameters:
width - the maximum width
height - the maximum height
Throws:
java.lang.IllegalArgumentException - when width or height is negative
See Also:
getMaxWidth(), getMaxHeight()

computeSize

public static int computeSize(int min,
                              int preferred,
                              int max)
A helper method to compute the size of a widget based on min, max and preferred size. If max size is > 0 then the preferred size is limited to max.

Parameters:
min - the minimum size of the widget
preferred - the preferred size of the widget or the available space where the widget is fitted into
max - the maximum size of the widget
Returns:
Math.max(min, (max > 0) ? Math.min(preferred, max) : preferred)

adjustSize

public void adjustSize()
Auto adjust the size of this widget based on it's preferred size. Subclasses can provide more functionality


invalidateLayout

public void invalidateLayout()
Called when something has changed which affected the layout of this widget. The default implementation calls invalidateLayoutLocally() followed by childInvalidateLayout() Called by the default implementation of borderChanged.

See Also:
invalidateLayoutLocally(), borderChanged()

validateLayout

public void validateLayout()
Calls layout() if the layout is marked invalid.

See Also:
invalidateLayout(), layout()

getTheme

public java.lang.String getTheme()
Returns the current theme name of this widget. The default theme name is the lower case simple class name of this widget.

Returns:
the current theme name of this widget

setTheme

public void setTheme(java.lang.String theme)
Changes the theme name of this widget - DOES NOT call reapplyTheme()

If the theme name is empty then this widget won't receive theme data and is not included in the theme path, but it's children are still themed.

A theme name must not contain spaces or '*'. A '/' is only allowed as first character to indicate an absolute theme path. A '.' is only allowed for absolute theme paths.

Parameters:
theme - The new theme path element
Throws:
java.lang.NullPointerException - if theme is null
java.lang.IllegalArgumentException - if the theme name is invalid
See Also:
GUI.applyTheme(ThemeManager), reapplyTheme(), getThemePath(), isAbsoluteTheme(java.lang.String)

getThemePath

public final java.lang.String getThemePath()
Returns this widget's theme path by concatenating the theme names from all parents separated by '.'. If a parent theme is empty then it will be omitted from the theme path. The theme path will start with the first absolute theme starting from this widget up to the GUI.

Returns:
the effective theme path - can be empty

isClip

public boolean isClip()
Returns true if paint() is clipped to this widget.

Returns:
true if paint() is clipped to this widget

setClip

public void setClip(boolean clip)
Sets whether paint() must be clipped to this Widget or not. Clipping is performed for the whole widget and all it's children. The clip area is the outer area of the widget (it does include the border). If the widget theme has effects which extend outside of the widget (like shadow or glow) then clipping will also clip the this effect. A work around is to not apply clipping to the widget itself but to a child which will act as a clip container - this child may not need a theme.

Parameters:
clip - true if clipping must be used - default is false

isFocusKeyEnabled

public boolean isFocusKeyEnabled()
Returns if this widget will handle the FOCUS_KEY.

Returns:
if this widget will handle the FOCUS_KEY.

setFocusKeyEnabled

public void setFocusKeyEnabled(boolean focusKeyEnabled)
Controls the handling of the FOCUS_KEY.

The default is true.

When enabled the focus key (TAB) will cycle through all (indirect) children which can receive keyboard focus. The order is defined by getKeyboardFocusOrder().

Parameters:
focusKeyEnabled - if true this widget will handle the focus key.

getBackground

public Image getBackground()
Returns the current background image or null.

Returns:
the current background image or null
See Also:
paintBackground(de.matthiasmann.twl.GUI)

setBackground

public void setBackground(Image background)
Sets the background image that should be drawn before drawing this widget

Parameters:
background - the new background image - can be null
See Also:
paintBackground(de.matthiasmann.twl.GUI)

getOverlay

public Image getOverlay()
Returns the current overlay image or null.

Returns:
the current overlay image or null.
See Also:
paintOverlay(de.matthiasmann.twl.GUI)

setOverlay

public void setOverlay(Image overlay)
Sets the overlay image that should be drawn after drawing the children

Parameters:
overlay - the new overlay image - can be null
See Also:
paintOverlay(de.matthiasmann.twl.GUI)

getMouseCursor

public MouseCursor getMouseCursor(Event evt)
Returns the mouse cursor which should be used for the given mouse coordinates and modifiers. The default implementation calls getMouseCursor()

Parameters:
evt - only Event.getMouseX(), Event.getMouseY() and Event.getModifiers() are valid.
Returns:
the mouse cursor or null when no mouse cursor is defined for this widget

getMouseCursor

public MouseCursor getMouseCursor()

setMouseCursor

public void setMouseCursor(MouseCursor mouseCursor)

getNumChildren

public final int getNumChildren()
Returns the number of children in this widget.

Returns:
the number of children in this widget

getChild

public final Widget getChild(int index)
                      throws java.lang.IndexOutOfBoundsException
Returns the child at the given index

Parameters:
index -
Returns:
the child widget
Throws:
java.lang.IndexOutOfBoundsException - if the index is invalid

add

public void add(Widget child)
Adds a new child at the end of this widget. This call is equal to insertChild(child, getNumChildren())

Parameters:
child - the child that should be added
Throws:
java.lang.NullPointerException - if child is null
java.lang.IllegalArgumentException - if the child is already in a tree
See Also:
insertChild(de.matthiasmann.twl.Widget, int), getNumChildren()

insertChild

public void insertChild(Widget child,
                        int index)
                 throws java.lang.IndexOutOfBoundsException
Inserts a new child into this widget. The position of the child is treated as relative to this widget and adjusted. If a theme was applied to this widget then this theme is also applied to the new child.

Parameters:
child - the child that should be inserted
index - the index where it should be inserted
Throws:
java.lang.IndexOutOfBoundsException - if the index is invalid
java.lang.NullPointerException - if child is null
java.lang.IllegalArgumentException - if the child is already in a tree

getChildIndex

public final int getChildIndex(Widget child)
Returns the index of the specified child in this widget. Uses object identity for comparing.

Parameters:
child - the child which index should be returned
Returns:
the index of the child or -1 if it was not found

removeChild

public boolean removeChild(Widget child)
Removes the specified child from this widget. Uses object identity for comparing.

Parameters:
child - the child that should be removed.
Returns:
true if the child was found and removed.

removeChild

public Widget removeChild(int index)
                   throws java.lang.IndexOutOfBoundsException
Removes the specified child from this widget. The position of the removed child is changed to the relative position to this widget. Calls invalidateLayout after removing the child.

Parameters:
index - the index of the child
Returns:
the removed widget
Throws:
java.lang.IndexOutOfBoundsException - if the index is invalid
See Also:
invalidateLayout()

removeAllChildren

public void removeAllChildren()
Removes all children of this widget. The position of the all removed children is changed to the relative position to this widget. Calls allChildrenRemoved after removing all children.

See Also:
allChildrenRemoved()

destroy

public void destroy()
Clean up GL resources. When overwritten then super method must be called.


canAcceptKeyboardFocus

public boolean canAcceptKeyboardFocus()

setCanAcceptKeyboardFocus

public void setCanAcceptKeyboardFocus(boolean canAcceptKeyboardFocus)

isDepthFocusTraversal

public boolean isDepthFocusTraversal()

setDepthFocusTraversal

public void setDepthFocusTraversal(boolean depthFocusTraversal)

requestKeyboardFocus

public boolean requestKeyboardFocus()
Requests that the keyboard focus is transfered to this widget.

Use with care - users don't expect focus changes while working with the UI

Focus transfer only works when the widget is added to the GUI tree. See getGUI().

Returns:
true if keyboard focus was transfered to this widget.

giveupKeyboardFocus

public void giveupKeyboardFocus()
If this widget currently has the keyboard focus, then the keyboard focus is removed. The focus will be transferred to the parent widget.


hasKeyboardFocus

public boolean hasKeyboardFocus()
Checks if this widget has the keyboard focus

Returns:
true if this widget has the keyboard focus

focusNextChild

public boolean focusNextChild()

focusPrevChild

public boolean focusPrevChild()

focusFirstChild

public boolean focusFirstChild()

focusLastChild

public boolean focusLastChild()

getAnimationState

public AnimationState getAnimationState()
Returns the animation state object.

Returns:
the animation state object.

hasSharedAnimationState

public boolean hasSharedAnimationState()
Returns true if the animation state of this widget is shared with another widget. A widget with a shared animation state should normally not modify the animation state itself. How a shared animation state is used depends on the widgets.

Returns:
true if it is shared
See Also:
Widget(de.matthiasmann.twl.AnimationState)

getTintAnimator

public TintAnimator getTintAnimator()
Returns the current tine animation object or null if none was set

Returns:
the current tine animation object or null if none was set

setTintAnimator

public void setTintAnimator(TintAnimator tintAnimator)
Sets the tint animation object. Can be null to disable tinting.

Parameters:
tintAnimator - the new tint animation object

getRenderOffscreen

public Widget.RenderOffscreen getRenderOffscreen()
Returns the currently active offscreen rendering delegate or null if none was set

Returns:
the currently active offscreen rendering delegate or null if none was set

setRenderOffscreen

public void setRenderOffscreen(Widget.RenderOffscreen renderOffscreen)
Sets set offscreen rendering delegate. Can be null to disable offscreen rendering.

Parameters:
renderOffscreen - the offscreen rendering delegate.

getTooltipContent

public java.lang.Object getTooltipContent()
Returns the currently set tooltip content.

Returns:
the currently set tooltip content. Can be null.

setTooltipContent

public void setTooltipContent(java.lang.Object tooltipContent)
Changes the tooltip context. If the tooltip is currently active then it's refreshed with the new content.

Parameters:
tooltipContent - the new tooltip content.
See Also:
updateTooltip(), getTooltipContent()

getInputMap

public InputMap getInputMap()
Returns the current input map.

Returns:
the current input map or null.

setInputMap

public void setInputMap(InputMap inputMap)
Sets the input map for key strokes.

Parameters:
inputMap - the input map or null.
See Also:
handleKeyStrokeAction(java.lang.String, de.matthiasmann.twl.Event)

getActionMap

public ActionMap getActionMap()
Returns the current action map. If no action map has been set then null is returned.

Returns:
the current action map or null.

getOrCreateActionMap

public ActionMap getOrCreateActionMap()
Returns the current action map. If no action map has been set then a new one is created and set (setActionMap is not called).

Returns:
the current action map (or the new action map).

setActionMap

public void setActionMap(ActionMap actionMap)
Installs an action map for this widget.

Parameters:
actionMap - the new action map or null.

getWidgetAt

public Widget getWidgetAt(int x,
                          int y)
Returns the visible widget at the specified location. Use this method to locate drag&drop tragets. Subclasses can overwrite this method hide implementation details.

Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the widget at that location.

applyTheme

protected void applyTheme(ThemeInfo themeInfo)
Apply the given theme. This method also calls invalidateLayout()

Parameters:
themeInfo - The theme info for this widget

applyThemeBackground

protected void applyThemeBackground(ThemeInfo themeInfo)

applyThemeOverlay

protected void applyThemeOverlay(ThemeInfo themeInfo)

applyThemeBorder

protected void applyThemeBorder(ThemeInfo themeInfo)

applyThemeOffscreenExtra

protected void applyThemeOffscreenExtra(ThemeInfo themeInfo)

applyThemeMinSize

protected void applyThemeMinSize(ThemeInfo themeInfo)

applyThemeMaxSize

protected void applyThemeMaxSize(ThemeInfo themeInfo)

applyThemeMouseCursor

protected void applyThemeMouseCursor(ThemeInfo themeInfo)

applyThemeInputMap

protected void applyThemeInputMap(ThemeInfo themeInfo)

applyThemeTooltip

protected void applyThemeTooltip(ThemeInfo themeInfo)

getThemeTooltipContent

protected java.lang.Object getThemeTooltipContent()

getTooltipContentAt

protected java.lang.Object getTooltipContentAt(int mouseX,
                                               int mouseY)
Automatic tooltip support. This function is called when the mouse is idle over the widget for a certain time. The default implementation returns the result from getTooltipContent if it is non null, otherwise the result from getThemeTooltipContent is returned. This method is not called if the tooltip is already open and the mouse is moved but does not leave this widget. If the tooltip depends on the mouse position then updateTooltip must be called from handleEvent.

Parameters:
mouseX - the mouse X coordinate
mouseY - the mouse Y coordinate
Returns:
the tooltip message or null if no tooltip is specified.
See Also:
updateTooltip()

updateTooltip

protected void updateTooltip()
Called by setTooltipContent and applyThemeTooltip. If this widget currently has an open tooltip then this tooltip is updated to show the new content.

See Also:
getTooltipContent()

resetTooltip

protected void resetTooltip()
If this widget currently has an open tooltip then this tooltip is reset and the tooltip timer is restarted.

See Also:
getTooltipContent()

addActionMapping

protected void addActionMapping(java.lang.String action,
                                java.lang.String methodName,
                                java.lang.Object... params)
Installs an action mapping for the given action in the current action map. If no action map is set then a new one will be created. The mapping will invoke a public method on this widget. This is equal to calling addActionMapping on ActionMap with this as target and ActionMap.FLAG_ON_PRESSED as flags.

Parameters:
action - the action name
methodName - the method name to invoke on this widget
params - optional parameters which can be passed to the method
See Also:
getActionMap(), ActionMap.addMapping(java.lang.String, java.lang.Object, java.lang.reflect.Method, java.lang.Object[], int), getInputMap()

reapplyTheme

public void reapplyTheme()
If the widget changed some internal state which may require different theme information then this function can be used to reapply the current theme.


isMouseInside

protected boolean isMouseInside(Event evt)
Checks whether the mouse is inside the widget or not.

Calls isInside(int, int) with the mouse coordinates.

Parameters:
evt - the mouse event
Returns:
true if the widgets wants to claim this mouse event

handleEvent

protected boolean handleEvent(Event evt)
Called when an event occurred that this widget could be interested in.

The default implementation handles only keyboard events and delegates them to the child widget which has keyboard focus. If focusKey handling is enabled then this widget cycles the keyboard focus through it's children. If the key was not consumed by a child or focusKey and an inputMap is specified then the event is translated by the InputMap and handleKeyStrokeAction is called when a mapping was found.

If the widget wants to receive mouse events then it must return true for all mouse events except for MOUSE_WHEEL (which is optional) event. Otherwise the following mouse event are not send. Before mouse movement or button events are send a MOUSE_ENTERED event is send first.

Parameters:
evt - The event - do not store this object - it may be reused
Returns:
true if the widget handled this event
See Also:
setFocusKeyEnabled(boolean), handleKeyStrokeAction(java.lang.String, de.matthiasmann.twl.Event), setInputMap(de.matthiasmann.twl.InputMap)

handleKeyStrokeAction

protected boolean handleKeyStrokeAction(java.lang.String action,
                                        Event event)
Called when a key stroke was found in the inputMap.

Parameters:
action - the action associated with the key stroke
event - the event which caused the action
Returns:
true if the action was handled
See Also:
setInputMap(de.matthiasmann.twl.InputMap)

moveChild

protected void moveChild(int from,
                         int to)
Moves the child at index from to index to. This will shift the position of all children in between.

Parameters:
from - the index of the child that should be moved
to - the new index for the child at from
Throws:
java.lang.IndexOutOfBoundsException - if from or to are invalid

requestKeyboardFocus

protected boolean requestKeyboardFocus(Widget child)
A child requests keyboard focus. Default implementation will grant keyboard focus and request itself keyboard focus.

Parameters:
child - The child that wants keyboard focus
Returns:
true if the child received the focus.

beforeRemoveFromGUI

protected void beforeRemoveFromGUI(GUI gui)
Called when this widget is removed from the GUI tree. After this call getGUI() will return null.

Parameters:
gui - the GUI object - same as getGUI()
See Also:
getGUI()

afterAddToGUI

protected void afterAddToGUI(GUI gui)
Called after this widget has been added to a GUI tree.

Parameters:
gui - the GUI object - same as getGUI()
See Also:
getGUI()

layout

protected void layout()
Called when the layoutInvalid flag is set. The default implementation does nothing.


positionChanged

protected void positionChanged()
Called when the position of this widget was changed. The default implementation does nothing. Child positions are already updated to retain the absolute coordinate system. This has the side effect of firing child's positionChanged before the parent's.


sizeChanged

protected void sizeChanged()
Called when the size of this widget has changed. The default implementation calls invalidateLayoutLocally. As size changes are normally the result of the parent's layout() function.

See Also:
invalidateLayoutLocally()

borderChanged

protected void borderChanged()
Called when the border size has changed. The default implementation calls invalidateLayout.

See Also:
invalidateLayout()

childInvalidateLayout

protected void childInvalidateLayout(Widget child)
Called when the layout of a child has been invalidated. The default implementation calls invalidateLayout.

Parameters:
child - the child which was invalidated
See Also:
invalidateLayout()

childAdded

protected void childAdded(Widget child)
A new child has been added. The default implementation calls invalidateLayout.

Parameters:
child - the new child
See Also:
invalidateLayout()

childRemoved

protected void childRemoved(Widget exChild)
A child has been removed. The default implementation calls invalidateLayout.

Parameters:
exChild - the removed widget - no longer a child
See Also:
invalidateLayout()

allChildrenRemoved

protected void allChildrenRemoved()
All children have been removed. This is called by removeAllChildren instead of childRemoved. The default implementation calls invalidateLayout.

See Also:
invalidateLayout()

childVisibilityChanged

protected void childVisibilityChanged(Widget child)
Called when the visibility state of a child was changed. The default implementation does nothing.

Parameters:
child - the child which changed it's visibility state
See Also:
setVisible(boolean)

keyboardFocusChildChanged

protected void keyboardFocusChildChanged(Widget child)
The current keyboard focus child has changed. The default implementation does nothing.

Parameters:
child - The child which has now the keyboard focus in this hierachy level or null

keyboardFocusLost

protected void keyboardFocusLost()
Called when this widget has lost the keyboard focus. The default implementation does nothing.


keyboardFocusGained

protected void keyboardFocusGained()
Called when this widget has gained the keyboard focus. The default implementation does nothing.

See Also:
keyboardFocusGained(de.matthiasmann.twl.FocusGainedCause, de.matthiasmann.twl.Widget)

keyboardFocusGained

protected void keyboardFocusGained(FocusGainedCause cause,
                                   Widget previousWidget)
Called when this widget has gained the keyboard focus. The default implementation calls keyboardFocusGained()

Parameters:
cause - the cause for the this focus transfer
previousWidget - the widget which previously had the keyboard focus - can be null.

widgetDisabled

protected void widgetDisabled()
This method is called when this widget has been disabled, either directly or one of it's parents.

The default implementation does nothing.


paint

protected void paint(GUI gui)
Paints this widget and it's children.

A subclass should overwrite paintWidget() instead of this function.

The default implementation calls the following method in order:

  1. paintBackground(de.matthiasmann.twl.GUI)
  2. paintWidget(de.matthiasmann.twl.GUI)
  3. paintChildren(de.matthiasmann.twl.GUI)
  4. paintOverlay(de.matthiasmann.twl.GUI)

Parameters:
gui - the GUI object

paintWidget

protected void paintWidget(GUI gui)
Called by paint(de.matthiasmann.twl.GUI) after painting the background and before painting all children.

This should be overwritten instead of paint if normal themeable painting is desired by the subclass.

The default implementation does nothing.

Parameters:
gui - the GUI object - it's the same as getGUI()

paintBackground

protected void paintBackground(GUI gui)
Paint the background image of this widget.

Parameters:
gui - the GUI object
See Also:
paint(de.matthiasmann.twl.GUI)

paintOverlay

protected void paintOverlay(GUI gui)
Paints the overlay image of this widget.

Parameters:
gui - the GUI object
See Also:
paint(de.matthiasmann.twl.GUI)

paintChildren

protected void paintChildren(GUI gui)
Paints all children in index order. Invisible children are skipped.

Parameters:
gui - the GUI object
See Also:
paint(de.matthiasmann.twl.GUI)

paintChild

protected void paintChild(GUI gui,
                          Widget child)
Paints a specified child. Does not check for visibility.

Parameters:
gui - the GUI object
child - the child Widget

paintDragOverlay

protected void paintDragOverlay(GUI gui,
                                int mouseX,
                                int mouseY,
                                int modifier)
Called after all other widgets have been rendered when a drag operation is in progress. The mouse position can be outsife of this widget

Parameters:
gui - the GUI object
mouseX - the current mouse X position
mouseY - the current mouse Y position
modifier - the current active modifiers - see Event.getModifiers()

invalidateLayoutLocally

protected final void invalidateLayoutLocally()
Invalidates only the layout of this widget. Does not invalidate the layout of the parent. Should only be used for things like scrolling. This method is called by sizeChanged()

See Also:
sizeChanged()

layoutChildFullInnerArea

protected void layoutChildFullInnerArea(Widget child)
Sets size and position of a child widget so that it consumes the complete inner area.

Parameters:
child - A child widget

layoutChildrenFullInnerArea

protected void layoutChildrenFullInnerArea()
Sets size and position of all child widgets so that they all consumes the complete inner area. If there is more then one child then they will overlap.


getKeyboardFocusOrder

protected java.util.List<Widget> getKeyboardFocusOrder()
Returns all children of this widget in their focus travel order.

The returned list is only iterated and not stored.

The default implementation just returns an unmodifable view of the internal children list.

Returns:
a read only collection with all children in focus order.

getChildAt

protected final Widget getChildAt(int x,
                                  int y)
Returns the visible child widget which is at the specified coordinate.

Parameters:
x - the x coordinate
y - the y coordinate
Returns:
the child widget at that location or null if there is no visible child.
See Also:
getX(), getY()

updateTintAnimation

protected void updateTintAnimation()
Updates the tint animation when a fade is active. Can be overridden to do additional things like hide the widget after the end of the animation.


firePropertyChange

protected final void firePropertyChange(java.beans.PropertyChangeEvent evt)
Fire an existing PropertyChangeEvent to any registered listeners.

Parameters:
evt - The PropertyChangeEvent object
See Also:
PropertyChangeSupport.firePropertyChange(java.beans.PropertyChangeEvent)

firePropertyChange

protected final void firePropertyChange(java.lang.String propertyName,
                                        boolean oldValue,
                                        boolean newValue)
Report a bound property update to any registered listeners.

Parameters:
propertyName - The programmatic name of the property that was changed
oldValue - The old value of the property
newValue - The new value of the property
See Also:
PropertyChangeSupport.firePropertyChange(java.lang.String, boolean, boolean)

firePropertyChange

protected final void firePropertyChange(java.lang.String propertyName,
                                        int oldValue,
                                        int newValue)
Report a bound property update to any registered listeners.

Parameters:
propertyName - The programmatic name of the property that was changed
oldValue - The old value of the property
newValue - The new value of the property
See Also:
PropertyChangeSupport.firePropertyChange(java.lang.String, int, int)

firePropertyChange

protected final void firePropertyChange(java.lang.String propertyName,
                                        java.lang.Object oldValue,
                                        java.lang.Object newValue)
Report a bound property update to any registered listeners.

Parameters:
propertyName - The programmatic name of the property that was changed
oldValue - The old value of the property
newValue - The new value of the property
See Also:
PropertyChangeSupport.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object)

isAbsoluteTheme

public static boolean isAbsoluteTheme(java.lang.String theme)
Checks if the given theme name is absolute or relative to it's parent. An absolute theme name starts with a '/'.

Parameters:
theme - the theme name or path.
Returns:
true if the theme is absolute.