org.kalmeo.kuix.widget
Class Widget

java.lang.Object
  extended by org.kalmeo.kuix.widget.Widget
Direct Known Subclasses:
Desktop, DragAndDropContainer, FocusableWidget, List, Picture, Screen, Screen.ScreenBar, ScrollBar, ScrollPane, TabItem, UnpaintableWidget

public class Widget
extends java.lang.Object

This class is the base of all Kuix widgets.

For further informations, visit the Kuix widgets reference page.

Author:
bbeaulant

Nested Class Summary
protected  class Widget.BindInstruction
          This class represents a bind instruction for a specific attribute.
 
Field Summary
protected  LinkedList bindInstructions
           
protected static Alignment DEFAULT_ALIGN
           
protected static Alignment[] DEFAULT_BACKGROUND_ALIGN
           
protected static Repeat[] DEFAULT_BACKGROUND_REPEAT
           
protected static Insets DEFAULT_BORDER
           
protected static Gap DEFAULT_GAP
           
protected static Insets DEFAULT_MARGIN
           
protected static Metrics DEFAULT_MIN_SIZE
           
protected static Insets DEFAULT_PADDING
           
protected static Span DEFAULT_SPAN
           
protected static Weight DEFAULT_WEIGHT
           
 Widget next
           
 Widget parent
           
 Widget previous
           
 
Constructor Summary
Widget()
          Construct a Widget
Widget(java.lang.String tag)
          Construct a Widget
 
Method Summary
 Widget add(Widget widget)
          Add a Widget to this as child
 Widget add(Widget widget, Widget referenceWidget, boolean after)
          Add a Widget to this as child before or after referenceWidget child.
 void bringNear(Widget widget, Widget referenceWidget, boolean after)
          Bring the widget on top or behind referenceWidget according to the after parameter.
 void bringToFront(Widget widget)
          Bring the widget to the front of the orthers.
 void catchChildrenFrom(Widget widget)
          Catch all child widgets from widget to move them into this widget.
 void cleanUp()
          CleanUp all widget's link and propagate the action on its children.
 void cleanUpChildren()
          CleanUp all children.
 void clearCachedStyle(boolean propagateToChildren)
          Clear the cachedStyle.
protected  void doLayout()
          Layout the widget if its layout is defined.
 Alignment getAlign()
          Returns the alignment value.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the value of the specified attribute
 Style getAuthorStyle()
           
 java.lang.String[] getAvailablePseudoClasses()
          Retuns the list of available pseudo classes.
 Alignment[] getBackgroundAlign()
          Returns the backroundAlign or alignment list if multi alignments are defined.
 Color getBackgroundColor()
          Returns the background color value.
 Image[] getBackgroundImage()
          Returns the backroundImage or image list if multi images are defined.
 Repeat[] getBackgroundRepeat()
          Returns the backgroundRepeat or repeat list if multi repeats are defined.
 Insets getBorder()
           
 Alignment[] getBorderAlign()
          Returns the border alignments array.
 Color[] getBorderColor()
          Returns the border color array.
 Image[] getBorderImage()
          Returns the border image array.
 int getBorderStroke()
          Returns the border stroke int value.
protected  Metrics getCachedMetrics()
           
 Widget getChild()
          Returns the first child of this widget.
 Color getColor()
          Returns the color value.
 DataProvider getDataProvider()
          Returns the associated DataProvider.
protected  java.lang.Object getDefaultStylePropertyValue(java.lang.String name)
          Returns the de default style property value for name property, or null.
 Desktop getDesktop()
           
 int getDisplayX()
          Returns the x coordinate of this widget in the display coordinate system.
 int getDisplayY()
          Returns the y coordinate of this widget in the display coordinate system.
 FocusManager getFocusManager()
          Used for popup like widgets
 Gap getGap()
          Returns the gap value.
 Color getGrayedColor()
          Returns the grayedColor.
 int getHeight()
           
 java.lang.String getId()
          Returns the id.
 java.lang.String getInheritedTag()
          Returns the inheritedTag.
 int getInnerHeight()
          Return the inner height of this widget (exluding margin, border and padding).
 int getInnerWidth()
          Return the inner width of this widget (exluding margin, border and padding).
 Insets getInsets()
           
 Widget getInternalChildInstance(java.lang.String tag)
          Returns the first internal child instance corresponding to the given tag.
 Widget getLastChild()
          Returns the last child of this widget.
 Layout getLayout()
           
 LayoutData getLayoutData()
           
 Insets getMargin()
           
 Metrics getMinSize()
           
 Widget getOtherFocus(Widget root, Widget focusedWidget, Widget nearestFocusableWidget, boolean forward, Alignment direction, boolean checkItself, boolean checkChild, boolean checkParent)
          Returns the previous or next focusable Widget according to the forward parameter.
 Insets getPadding()
           
 Metrics getPreferredSize(int preferredWidth)
          Returns the prefered size of this Widget
 Span getSpan()
          Returns the span value.
 java.lang.String[] getStyleClasses()
          Returns styleClasses.
protected  java.lang.Object getStylePropertyValue(java.lang.String name, boolean inherited)
          Return the specified style property value repr�senting by the name, or null.
protected  java.util.Vector getStyles()
          Returns the list of Style that correspond to this Widget or null if no style is registered for this widget
 java.lang.String getTag()
          Returns the tag.
 Weight getWeight()
          Returns the weight value.
 Widget getWidget(java.lang.String id)
          Returns the Widget witch correspond to the id, or null
 Widget getWidgetAt(int mx, int my)
          Returns the child widget under mx, my point
 Widget getWidgetAt(int mx, int my, int x, int y, int width, int height)
          Returns the child widget under mx, my point and specify the x, y, width and height of search.
 int getWidth()
           
 int getX()
          Returns the x coordinate of this widget in its parent coordinate system.
 int getY()
          Returns the y coordinate of this widget in its parent coordinate system.
 boolean hasBindInstruction()
           
 boolean hasShortcutKeyCodes(byte eventType)
           
 boolean hasShortcuts()
           
 void invalidate()
          Invalidate the widget's size and position and propagate the information to its parent.
protected  void invalidate(Widget fromWidget)
          Invalidate the widget's size and position and propagate the information to its parent.
 void invalidateAppearance()
          Invalidate appearance of full widget's region.
protected  void invalidateAppearanceRegion(int x, int y, int width, int height)
          Invalidate a specific region.
 void invalidateStylePropertiesCache(boolean propagateToChildren)
          Invalidate all style properties cache.
 boolean isFocusable()
          Check if this Widget is focusable.
 boolean isFocused()
          Check if this Widget is focused.
 boolean isFocusWidgetChild()
          Check if this Widget is a child of a focused widget.
 boolean isIndividualyVisible()
          Returns the widget only visibility state.
 boolean isInvalidated()
          Returns the widget's invalidate status.
 boolean isInWidgetTree()
           
 boolean isObjectAttribute(java.lang.String name)
          Check if the given attribute require an Object value.
 boolean isPseudoClassCompatible(java.lang.String pseudoClass)
           
 boolean isShortcutKeyCodeCompatible(int kuixKeyCode, byte eventType)
          Check if a kuixKeyCode is compatible with widget's shortcuts.
 boolean isVisible()
          Returns the widget's visibility state.
protected  void markAsValidate()
          Mark this widget as validate
protected  boolean needToComputePreferredSize(int preferredWidth)
           
protected  void onAdded(Widget parent)
          Event called when the widjet is added to parent.
protected  void onChildAdded(Widget widget)
          Event called when the child widjet is added.
protected  void onChildRemoved(Widget widget)
          Event called when the child widjet is removed.
protected  void onFocus(Widget focusedWidget)
          Call when the widget or one of its parents gain the focus.
protected  void onLostFocus(Widget focusedWidget)
          Call when the widget or one of its parents lost the focus.
protected  void onRemoved(Widget parent)
          Event called when the widjet is removed from parent.
 void paint(Graphics g)
          Paint the widget itself.
 void paintBackground(Graphics g)
          Paint the background of this Widget.
 void paintBorder(Graphics g)
          Paint the widget's border.
protected  void paintChildrenImpl(Graphics g)
          Invoke the paintImpl method on widget's children.
 void paintImpl(Graphics g)
          Paint the implementation of the widget (itself and its children).
protected  void paintMosaicImage(Graphics g, Image image, int x, int y, int width, int height, Alignment alignment, int repeatX, int repeatY)
          Paint a cliped zone with mosaic image
 void parseAuthorStyle(java.lang.String rawAuthorStyle)
          Set new author style by parsing rawAuthorStyle string.
 boolean processActionEvent()
          Process action event
 boolean processDataBindEvent()
           
 boolean processFocusEvent(byte type)
          Process a focus event
 boolean processItemsModelUpdateEvent(byte type, java.lang.String property, DataProvider item, LinkedListEnumeration itemsEnumeration)
          Process an items model update event.
 boolean processKeyEvent(byte type, int kuixKeyCode)
          Process a key event
 boolean processModelUpdateEvent(java.lang.String property)
          Process a model update event.
 boolean processPointerEvent(byte type, int x, int y)
          Process a pointer event
 boolean processShortcutKeyEvent(byte type, int kuixKeyCode)
          Process a shortcut key event
protected  void propagateFocusEvent(Widget focusedWidget, boolean lost)
          Propagate focus lost or gain event to widget's children.
 void remove()
          Remove the current Widget from its parent.
 void removeAll()
          Remove all childs.
 void removeAttributeBindInstruction(java.lang.String attribute)
          Remove the bindInstruction for a specific attribute
 void requestBackwardFocus()
          Requests the focus of the backward focusable Widget.
 void requestFocus()
          Requests the focus of this Widget.
 void requestForwardFocus()
          Requests the focus of the forward focusable Widget.
 void sendToBack(Widget widget)
          Send the widget to the back of the others.
 boolean setAttribute(java.lang.String name, java.lang.String value)
          Set the value to the specified attribute representing by the name
 void setAttributeBindInstruction(java.lang.String attribute, java.lang.String[] properties, java.lang.String pattern)
          Set a BindInstruction for the specified attribute.
 void setAuthorStyle(Style authorStyle)
          Caution, if widget attribute are already cached, you need to call the invalidateStylePropertiesCache(propagateToChildern).
 void setBounds(int x, int y, int width, int height)
          Set the widget's bounds
 void setDataProvider(DataProvider dataProvider)
           
 void setId(java.lang.String id)
          Set the id.
 boolean setObjectAttribute(java.lang.String name, java.lang.Object value)
          Set the Object value to the specified attribute representing by the name.
 void setShortcutKeyCodes(int shortcutKeyCodes, byte eventType)
          Define the shortcuts key codes intercepted by this widget.
 void setShortcuts(java.lang.String rawShortcuts, byte eventType)
          Define the widget's associated shortcuts.
 void setStyleClass(java.lang.String styleClass)
           
 void setStyleClasses(java.lang.String[] styleClasses)
           
 void setVisible(boolean visible)
          Set the widget's visibility state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MARGIN

protected static final Insets DEFAULT_MARGIN

DEFAULT_BORDER

protected static final Insets DEFAULT_BORDER

DEFAULT_PADDING

protected static final Insets DEFAULT_PADDING

DEFAULT_MIN_SIZE

protected static final Metrics DEFAULT_MIN_SIZE

DEFAULT_GAP

protected static final Gap DEFAULT_GAP

DEFAULT_SPAN

protected static final Span DEFAULT_SPAN

DEFAULT_WEIGHT

protected static final Weight DEFAULT_WEIGHT

DEFAULT_ALIGN

protected static final Alignment DEFAULT_ALIGN

DEFAULT_BACKGROUND_ALIGN

protected static final Alignment[] DEFAULT_BACKGROUND_ALIGN

DEFAULT_BACKGROUND_REPEAT

protected static final Repeat[] DEFAULT_BACKGROUND_REPEAT

parent

public Widget parent

previous

public Widget previous

next

public Widget next

bindInstructions

protected LinkedList bindInstructions
Constructor Detail

Widget

public Widget()
Construct a Widget


Widget

public Widget(java.lang.String tag)
Construct a Widget

Parameters:
tag -
Method Detail

getInternalChildInstance

public Widget getInternalChildInstance(java.lang.String tag)
Returns the first internal child instance corresponding to the given tag.

Parameters:
tag -
Returns:
the child instance if it exists.

setAttribute

public boolean setAttribute(java.lang.String name,
                            java.lang.String value)
Set the value to the specified attribute representing by the name

Parameters:
name -
value -
Returns:
true if the attribute exists

setObjectAttribute

public boolean setObjectAttribute(java.lang.String name,
                                  java.lang.Object value)
Set the Object value to the specified attribute representing by the name.

Parameters:
name -
value -
Returns:

isObjectAttribute

public boolean isObjectAttribute(java.lang.String name)
Check if the given attribute require an Object value.

Parameters:
name -
Returns:
true if the given attribute require an Object value

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the value of the specified attribute

Parameters:
name -
Returns:
The value of the specified attribute

getTag

public java.lang.String getTag()
Returns the tag. The tag is the reference name of the widget. It's used to rerieve the widget nature on CSS and XML parsing.

Returns:
the tag

getInheritedTag

public java.lang.String getInheritedTag()
Returns the inheritedTag. The Inherited tag is used to inherit style properties from and other widget is those properties aren't defined specificly for this widget.

Returns:
the inherited tag

getId

public java.lang.String getId()
Returns the id. The id represents a unique instance reference of a widget.

Returns:
the id

setId

public void setId(java.lang.String id)
Set the id.

Parameters:
id - the id to set

getStyleClasses

public java.lang.String[] getStyleClasses()
Returns styleClasses. Style classes is an array of style class string reresentation.

Returns:
the styleClasses

setStyleClasses

public void setStyleClasses(java.lang.String[] styleClasses)
Parameters:
styleClasses - the styleClasses to set

setStyleClass

public void setStyleClass(java.lang.String styleClass)
Parameters:
styleClass - the styleClass to set

getAvailablePseudoClasses

public java.lang.String[] getAvailablePseudoClasses()
Retuns the list of available pseudo classes. (i.e hover, selected, ...).

Returns:
the pseudoClasses list

isPseudoClassCompatible

public boolean isPseudoClassCompatible(java.lang.String pseudoClass)
Returns:
true if this widget is compatible with peudo class

getChild

public Widget getChild()
Returns the first child of this widget.

Returns:
the child

getLastChild

public Widget getLastChild()
Returns the last child of this widget.

Returns:
the lastChild

getX

public int getX()
Returns the x coordinate of this widget in its parent coordinate system.

Returns:
the x coordinate

getY

public int getY()
Returns the y coordinate of this widget in its parent coordinate system.

Returns:
the y coordinate

getDisplayX

public int getDisplayX()
Returns the x coordinate of this widget in the display coordinate system.

Returns:
the x coordinate

getDisplayY

public int getDisplayY()
Returns the y coordinate of this widget in the display coordinate system.

Returns:
the y coordinate

getWidth

public int getWidth()
Returns:
the width

getHeight

public int getHeight()
Returns:
the height

getInnerWidth

public int getInnerWidth()
Return the inner width of this widget (exluding margin, border and padding).

Returns:
the innerWidth

getInnerHeight

public int getInnerHeight()
Return the inner height of this widget (exluding margin, border and padding).

Returns:
the innerHeight

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Set the widget's bounds

Parameters:
x -
y -
width -
height -

getAuthorStyle

public Style getAuthorStyle()
Returns:
the authorStyle

setAuthorStyle

public void setAuthorStyle(Style authorStyle)
Caution, if widget attribute are already cached, you need to call the invalidateStylePropertiesCache(propagateToChildern).

Parameters:
authorStyle - the authorStyle to set

parseAuthorStyle

public void parseAuthorStyle(java.lang.String rawAuthorStyle)
Set new author style by parsing rawAuthorStyle string.

Parameters:
authorStyle - the authorStyle to parse

isVisible

public boolean isVisible()
Returns the widget's visibility state. If the parent or an ancestror of the widget is not visible the function returns false.

Returns:
the visibility state

isIndividualyVisible

public boolean isIndividualyVisible()
Returns the widget only visibility state.

Returns:
the visible

setVisible

public void setVisible(boolean visible)
Set the widget's visibility state. An invisible widget is ignore from layout and paint process.

Parameters:
visible - the visible to set

isInWidgetTree

public boolean isInWidgetTree()
Returns:
true if the widget is in widget tree of desktop

hasBindInstruction

public boolean hasBindInstruction()
Returns:
true if one or more data bind instructions are defined

setAttributeBindInstruction

public void setAttributeBindInstruction(java.lang.String attribute,
                                        java.lang.String[] properties,
                                        java.lang.String pattern)
Set a BindInstruction for the specified attribute.

Parameters:
attribute -
properties -
pattern -

removeAttributeBindInstruction

public void removeAttributeBindInstruction(java.lang.String attribute)
Remove the bindInstruction for a specific attribute

Parameters:
attribute -

setShortcuts

public void setShortcuts(java.lang.String rawShortcuts,
                         byte eventType)
Define the widget's associated shortcuts. A shortcut could be a couple of kuixKeyCode and action, or simply a kuixKeyCode. Multiple shortcuts could be assigned to one widget. This method do not accept directly kuixKeyCode but only kuix key representation like left, *, 1.

Parameters:
rawShortcuts - a string that contains keys and / or action.
eventType - the event type. KuixConstants.KEY_PRESSED_EVENT_TYPE, KuixConstants.KEY_REPEATED_EVENT_TYPE or KuixConstants.KEY_RELEASED_EVENT_TYPE

setShortcutKeyCodes

public void setShortcutKeyCodes(int shortcutKeyCodes,
                                byte eventType)
Define the shortcuts key codes intercepted by this widget.
This method override all previous shortcuts and shortcut's actions defined by setShortcut method.

Parameters:
shortcutKeyCodes -
eventType - the event type. KuixConstants.KEY_PRESSED_EVENT_TYPE, KuixConstants.KEY_REPEATED_EVENT_TYPE or KuixConstants.KEY_RELEASED_EVENT_TYPE

hasShortcuts

public boolean hasShortcuts()
Returns:
true if shortcuts are set for all most one event type.

hasShortcutKeyCodes

public boolean hasShortcutKeyCodes(byte eventType)
Parameters:
eventType - the event type. KuixConstants.KEY_PRESSED_EVENT_TYPE, KuixConstants.KEY_REPEATED_EVENT_TYPE or KuixConstants.KEY_RELEASED_EVENT_TYPE
Returns:
true if shortcuts are set for a specified event type

isShortcutKeyCodeCompatible

public boolean isShortcutKeyCodeCompatible(int kuixKeyCode,
                                           byte eventType)
Check if a kuixKeyCode is compatible with widget's shortcuts.

Parameters:
kuixKeyCode -
eventType - the event type. KuixConstants.KEY_PRESSED_EVENT_TYPE, KuixConstants.KEY_REPEATED_EVENT_TYPE or KuixConstants.KEY_RELEASED_EVENT_TYPE
Returns:
true if the given kuixKeyCode is compatible with this widget's shortcuts

getDataProvider

public DataProvider getDataProvider()
Returns the associated DataProvider.

Returns:
the dataProvider

setDataProvider

public void setDataProvider(DataProvider dataProvider)
Parameters:
dataProvider - the dataProvider to set

getLayout

public Layout getLayout()
Returns:
the layout

getLayoutData

public LayoutData getLayoutData()
Returns:
the layoutData

getMargin

public Insets getMargin()
Returns:
the margin

getBorder

public Insets getBorder()
Returns:
the border

getPadding

public Insets getPadding()
Returns:
the padding

getMinSize

public Metrics getMinSize()
Returns:
the minSize

getInsets

public Insets getInsets()
Returns:
The insets

getColor

public Color getColor()
Returns the color value. By default the value is null.

Returns:
the color

getBorderColor

public Color[] getBorderColor()
Returns the border color array. The array length is 4. By default the value is null.

Returns:
the borderColor

getBorderStroke

public int getBorderStroke()
Returns the border stroke int value. By default the value is Graphics.SOLID.

Returns:
the borderStroke

getBorderImage

public Image[] getBorderImage()
Returns the border image array. The array length is 8. By default the value is null.

Returns:
the borderImages array

getBorderAlign

public Alignment[] getBorderAlign()
Returns the border alignments array. The array length is 8. By default the value is null.

Returns:
the borderAlignments array

getBackgroundColor

public Color getBackgroundColor()
Returns the background color value. By default the value is null.

Returns:
the backgroundColor

getBackgroundImage

public Image[] getBackgroundImage()
Returns the backroundImage or image list if multi images are defined.

Returns:
the backroundImage array

getBackgroundAlign

public Alignment[] getBackgroundAlign()
Returns the backroundAlign or alignment list if multi alignments are defined.

Returns:
the backroundAlign array

getBackgroundRepeat

public Repeat[] getBackgroundRepeat()
Returns the backgroundRepeat or repeat list if multi repeats are defined.

Returns:
the backgroundRepeat array

getGrayedColor

public Color getGrayedColor()
Returns the grayedColor.

Returns:
the grayed color

getGap

public Gap getGap()
Returns the gap value. The gape represents the horizontal and vertical space between widget's children.

Returns:
the gap

getSpan

public Span getSpan()
Returns the span value.

Returns:
the span

getWeight

public Weight getWeight()
Returns the weight value.

Returns:
the weight

getAlign

public Alignment getAlign()
Returns the alignment value.

Returns:
the alignment

getDesktop

public Desktop getDesktop()
Returns:
The Desktop

getWidget

public Widget getWidget(java.lang.String id)
Returns the Widget witch correspond to the id, or null

Parameters:
id -
Returns:
The Widget witch correspond to the id

getWidgetAt

public Widget getWidgetAt(int mx,
                          int my)
Returns the child widget under mx, my point

Parameters:
mx -
my -
Returns:
the child Widget under mx, my point

getWidgetAt

public Widget getWidgetAt(int mx,
                          int my,
                          int x,
                          int y,
                          int width,
                          int height)
Returns the child widget under mx, my point and specify the x, y, width and height of search.

Parameters:
mx -
my -
x -
y -
width -
height -
Returns:
the child Widget under mx, my point

isFocusable

public boolean isFocusable()
Check if this Widget is focusable.

Returns:
true if the widget is focusable

isFocused

public boolean isFocused()
Check if this Widget is focused.

Returns:
true is the widget is focused

isFocusWidgetChild

public boolean isFocusWidgetChild()
Check if this Widget is a child of a focused widget.

Returns:
true if this Widget is a child of a focused widget

getFocusManager

public FocusManager getFocusManager()
Used for popup like widgets

Returns:
The special FocusManager

getPreferredSize

public Metrics getPreferredSize(int preferredWidth)
Returns the prefered size of this Widget

Parameters:
preferredWidth -
Returns:
The prefered size of this Widget

needToComputePreferredSize

protected boolean needToComputePreferredSize(int preferredWidth)
Parameters:
preferredWidth -
Returns:
true if the preferredSize computation is needed

getCachedMetrics

protected Metrics getCachedMetrics()
Returns:
The cached Metrics

add

public Widget add(Widget widget)
Add a Widget to this as child

Parameters:
widget - The Widget to add
Returns:
This Widget

add

public Widget add(Widget widget,
                  Widget referenceWidget,
                  boolean after)
Add a Widget to this as child before or after referenceWidget child. The referenceWidget need to be a child of this widget.

Parameters:
widget -
referenceWidget -
after -
Returns:
This Widget

bringToFront

public void bringToFront(Widget widget)
Bring the widget to the front of the orthers. widget need to be a child of this widget.

Parameters:
widget -

sendToBack

public void sendToBack(Widget widget)
Send the widget to the back of the others. widget need to be a child of this widget.

Parameters:
widget -

bringNear

public void bringNear(Widget widget,
                      Widget referenceWidget,
                      boolean after)
Bring the widget on top or behind referenceWidget according to the after parameter. widget need to be a child of this widget.

Parameters:
widget -
referenceWidget -
after -

catchChildrenFrom

public void catchChildrenFrom(Widget widget)
Catch all child widgets from widget to move them into this widget.
This method do not call onChildAdd(), onAdded(), onChildRemove() and onRemoved() methods.

Parameters:
widget -

remove

public void remove()
Remove the current Widget from its parent.
Caution : this method do NOT cleanUp the widgets. It only remove widget from widget tree.


removeAll

public void removeAll()
Remove all childs.
Caution : this method do NOT cleanUp child widgets. It only remove widgets from widget tree.


cleanUp

public void cleanUp()
CleanUp all widget's link and propagate the action on its children.
Caution : This method do NOT remove the widget from widget tree. It only clean external references like dataBinding, menu cache, etc...


cleanUpChildren

public void cleanUpChildren()
CleanUp all children.
Caution : This method do NOT remove child widgets from widget tree. It only clean external references like dataBinding, etc...


isInvalidated

public boolean isInvalidated()
Returns the widget's invalidate status.

Returns:
true if the widget is invalidated.

invalidate

public void invalidate()
Invalidate the widget's size and position and propagate the information to its parent. Calling this method will generate a call to the doLayout() and paint() method on all invalidated widgets.


invalidate

protected void invalidate(Widget fromWidget)
Invalidate the widget's size and position and propagate the information to its parent. Calling this method will generate a call to the doLayout() and paint() method on all invalidated widgets.

Parameters:
fromWidget - the Widget responsible of the invalidation.

markAsValidate

protected void markAsValidate()
Mark this widget as validate


doLayout

protected void doLayout()
Layout the widget if its layout is defined.


invalidateAppearance

public void invalidateAppearance()
Invalidate appearance of full widget's region. Calling this method will generate a screen repaint with a specific region.


invalidateAppearanceRegion

protected void invalidateAppearanceRegion(int x,
                                          int y,
                                          int width,
                                          int height)
Invalidate a specific region. The given region is translated by this widget x and y coordinates.

Parameters:
x -
y -
width -
height -

paint

public void paint(Graphics g)
Paint the widget itself.

Parameters:
g -

paintBackground

public void paintBackground(Graphics g)
Paint the background of this Widget.

Parameters:
g -

paintBorder

public void paintBorder(Graphics g)
Paint the widget's border.

Parameters:
g -

paintMosaicImage

protected void paintMosaicImage(Graphics g,
                                Image image,
                                int x,
                                int y,
                                int width,
                                int height,
                                Alignment alignment,
                                int repeatX,
                                int repeatY)
Paint a cliped zone with mosaic image

Parameters:
g -
image -
x -
y -
width -
height -
alignment -
repeatX -
repeatY -

paintImpl

public void paintImpl(Graphics g)
Paint the implementation of the widget (itself and its children).

Parameters:
g -

paintChildrenImpl

protected void paintChildrenImpl(Graphics g)
Invoke the paintImpl method on widget's children.

Parameters:
g -

getStyles

protected java.util.Vector getStyles()
Returns the list of Style that correspond to this Widget or null if no style is registered for this widget

Returns:
The list of Style that correspond to this Widget

clearCachedStyle

public void clearCachedStyle(boolean propagateToChildren)
Clear the cachedStyle.

Parameters:
propagateToChildren -

invalidateStylePropertiesCache

public void invalidateStylePropertiesCache(boolean propagateToChildren)
Invalidate all style properties cache.

Parameters:
propagateToChildren -

getStylePropertyValue

protected java.lang.Object getStylePropertyValue(java.lang.String name,
                                                 boolean inherited)
Return the specified style property value repr�senting by the name, or null.

Parameters:
name -
inherited - Specify if the property value is inherited from widget's parent
Returns:
The specified style property value

getDefaultStylePropertyValue

protected java.lang.Object getDefaultStylePropertyValue(java.lang.String name)
Returns the de default style property value for name property, or null.

Parameters:
name -
Returns:
The de default style property value for name property

requestFocus

public void requestFocus()
Requests the focus of this Widget.


requestBackwardFocus

public void requestBackwardFocus()
Requests the focus of the backward focusable Widget. Starts from this.


requestForwardFocus

public void requestForwardFocus()
Requests the focus of the forward focusable Widget. Starts from this.


getOtherFocus

public Widget getOtherFocus(Widget root,
                            Widget focusedWidget,
                            Widget nearestFocusableWidget,
                            boolean forward,
                            Alignment direction,
                            boolean checkItself,
                            boolean checkChild,
                            boolean checkParent)
Returns the previous or next focusable Widget according to the forward parameter.

Returns:
The previous or next focusable Widget

processKeyEvent

public boolean processKeyEvent(byte type,
                               int kuixKeyCode)
Process a key event

Parameters:
type -
kuixKeyCode -
Returns:
true if the event is treated by the widget

processShortcutKeyEvent

public boolean processShortcutKeyEvent(byte type,
                                       int kuixKeyCode)
Process a shortcut key event

Parameters:
type -
kuixKeyCode -
Returns:
true if the event is treated by the widget

processPointerEvent

public boolean processPointerEvent(byte type,
                                   int x,
                                   int y)
Process a pointer event

Parameters:
type -
y -
y -
Returns:
true if the event is treated by the widget

processFocusEvent

public boolean processFocusEvent(byte type)
Process a focus event

Parameters:
type -
Returns:
true if the event is treated by the widget

processActionEvent

public boolean processActionEvent()
Process action event

Returns:
true if the event is treated by the widget

processDataBindEvent

public boolean processDataBindEvent()
Returns:
true if the event is treated by the widget

processModelUpdateEvent

public boolean processModelUpdateEvent(java.lang.String property)
Process a model update event.

Parameters:
property -
Returns:
true if the event is treated by the widget

processItemsModelUpdateEvent

public boolean processItemsModelUpdateEvent(byte type,
                                            java.lang.String property,
                                            DataProvider item,
                                            LinkedListEnumeration itemsEnumeration)
Process an items model update event.

Parameters:
type -
property -
item -
itemsEnumeration -
Returns:
true if the event is treated by the widget

propagateFocusEvent

protected void propagateFocusEvent(Widget focusedWidget,
                                   boolean lost)
Propagate focus lost or gain event to widget's children.

Parameters:
focusedWidget -
lost -

onAdded

protected void onAdded(Widget parent)
Event called when the widjet is added to parent.


onRemoved

protected void onRemoved(Widget parent)
Event called when the widjet is removed from parent.


onChildAdded

protected void onChildAdded(Widget widget)
Event called when the child widjet is added.

Parameters:
widget - The widget child witch is added

onChildRemoved

protected void onChildRemoved(Widget widget)
Event called when the child widjet is removed.

Parameters:
widget - The widget child witch is removed

onFocus

protected void onFocus(Widget focusedWidget)
Call when the widget or one of its parents gain the focus.

Parameters:
focusedWidget -

onLostFocus

protected void onLostFocus(Widget focusedWidget)
Call when the widget or one of its parents lost the focus.

Parameters:
focusedWidget -


Copyright © 2007-2008 Kalmeo. All Rights Reserved.