net.thefrontside.freestyle
Class Component

java.lang.Object
  extended bynet.thefrontside.freestyle.Component
Direct Known Subclasses:
Alert, Application, Button, CheckBox, ComboBox, Label, List, PopupMenu, TabPane, TextField

public class Component
extends java.lang.Object

The fundamental building block for creating user interfaces with Freestyle. For details, see: http://www.thefrontside.net/freestyle/architecture/components


Constructor Summary
Component()
          Create a new component.
 
Method Summary
 Component addChild(Component child)
          Insert child into the hierarchy by making it a direct child of this component.
 Component addChild(java.lang.String role, Component child)
          Insert child into the component hierarchy by making it a direct child of this component while at the same time, assign it the role role.
 Component addChild(java.lang.String role, java.lang.String text)
          Creates a Label from text, and adds it as a child with role role
 void addStyle(java.lang.String name)
          Adds name to this component's styles in the global scope.
 void addStyle(java.lang.String name, Component scope)
          Adds name to this component's styles within the given scope.
 CallbackBinding captureEvent(java.lang.String type, EventHandler handler)
          Adds handler as a callback to be invoked during the capture phase whenever an event of type is received by this component or one of its descendants
 CallbackBinding captureEvent(java.lang.String type, KeyEventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever a KeyEvent of type type is received by this component or one of its descendants.
 CallbackBinding captureEvent(java.lang.String type, MouseEventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever a mouse event of type type is received by this component or one of its descendants.
 CallbackBinding catchEvent(java.lang.String type, EventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever an event of type is received by this component or one of its descendants
 CallbackBinding catchEvent(java.lang.String type, KeyEventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever a key event of type type is received by this component or one of its descendants.
 CallbackBinding catchEvent(java.lang.String type, MouseEventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever a mouse event of type type is received by this component or one of its descendants.
 Application getApplication()
          Every component that is part of a hierarchy, has an application.
 java.util.Collection getChildren()
          Deprecated. this will not be in the release 1 API
 Component getParent()
          Gets the parent of this component in the hierarchy.
 boolean isChild(Component component)
          Tests if component is one of this object's direct children
 boolean isDescendent(Component component)
          Tests if component is a descendant of this object.
 CallbackBinding onEvent(java.lang.String type, EventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever an event of type is received by this component
 CallbackBinding onEvent(java.lang.String type, KeyEventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever a key event of type type is received by this component.
 CallbackBinding onEvent(java.lang.String type, MouseEventHandler handler)
          Registers handler as a callback to be invoked during the capture phase whenever a mouse event of type type is received by this component.
 void removeAllChildren()
          Remove every child contained in this component
 void removeChild(Component child)
          Removes child from the component hierarchy, by making it no longer a child of this component.
 void removeStyle(java.lang.String name)
          Removes name from this component's styles within the global scope.
 void removeStyle(java.lang.String name, Component scope)
          Removes name from this component's styles within the given scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Component

public Component()
Create a new component.

Method Detail

getApplication

public Application getApplication()
Every component that is part of a hierarchy, has an application. Retrieve that application.

Returns:
this component's application

getParent

public Component getParent()
Gets the parent of this component in the hierarchy.

Returns:
this component's parent
See Also:
http://www.thefrontside.net/freestyle/architecture/components#composition

addChild

public Component addChild(Component child)
Insert child into the hierarchy by making it a direct child of this component. see http://www.thefrontside.net/freestyle/architecture/components#composition

Parameters:
child - the component to add to this component's children.
Returns:
the newly added component

addChild

public Component addChild(java.lang.String role,
                          Component child)
Insert child into the component hierarchy by making it a direct child of this component while at the same time, assign it the role role. see http://www.thefrontside.net/freestyle/architecture/components#roles

Parameters:
role - the role which child will play in this component
child - the component which will be the new child
Returns:
the newly added component.

addChild

public Component addChild(java.lang.String role,
                          java.lang.String text)
Creates a Label from text, and adds it as a child with role role

Returns:
the automatically created @link{Label}

removeChild

public void removeChild(Component child)
Removes child from the component hierarchy, by making it no longer a child of this component. If child is not a child of component, this method has no effect.

Parameters:
child - the component to remove from this component's children.

removeAllChildren

public void removeAllChildren()
Remove every child contained in this component


captureEvent

public CallbackBinding captureEvent(java.lang.String type,
                                    EventHandler handler)
Adds handler as a callback to be invoked during the capture phase whenever an event of type is received by this component or one of its descendants

Parameters:
type - the type of event to listen for ("keydown", "mouseup", etc..)
handler - the callback to invoke when the event occurs
Returns:
a CallbackBinding for this callback
See Also:
Event

captureEvent

public CallbackBinding captureEvent(java.lang.String type,
                                    MouseEventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever a mouse event of type type is received by this component or one of its descendants.

Parameters:
type - type the type of mouse event to listen for ("mousedown", "mouseup", etc..)
handler - the callback to invoke when the event occurs
Throws:
java.lang.IllegalArgumentException - if type is not a valid mouse event type.
See Also:
MouseEvent

captureEvent

public CallbackBinding captureEvent(java.lang.String type,
                                    KeyEventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever a KeyEvent of type type is received by this component or one of its descendants.

Parameters:
type - type the type of mouse event to listen for ("keydown", "keyup", etc..)
handler - the callback to invoke when the event occurs
Throws:
java.lang.IllegalArgumentException - if type is not a valid key event type.
See Also:
KeyEvent

catchEvent

public CallbackBinding catchEvent(java.lang.String type,
                                  EventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever an event of type is received by this component or one of its descendants

Parameters:
type - the type of event to listen for ("keydown", "mouseup", etc..)
handler - the callback to invoke when the event occurs
See Also:
Event

catchEvent

public CallbackBinding catchEvent(java.lang.String type,
                                  MouseEventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever a mouse event of type type is received by this component or one of its descendants.

Parameters:
type - type the type of mouse event to listen for ("mousedown", "mouseup", etc..)
handler - the callback to invoke when the event occurs
Throws:
java.lang.IllegalArgumentException - if type is not a valid mouse event type.
See Also:
MouseEvent

catchEvent

public CallbackBinding catchEvent(java.lang.String type,
                                  KeyEventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever a key event of type type is received by this component or one of its descendants.

Parameters:
type - type the type of mouse event to listen for ("keydown", "keyup", etc..)
handler - the callback to invoke when the event occurs
Throws:
java.lang.IllegalArgumentException - if type is not a valid key event type.
See Also:
KeyEvent

onEvent

public CallbackBinding onEvent(java.lang.String type,
                               EventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever an event of type is received by this component

Parameters:
type - type the type of event to listen for ("keydown", "mouseup", etc..)
handler - the callback to invoke when the event occurs
See Also:
Event

onEvent

public CallbackBinding onEvent(java.lang.String type,
                               MouseEventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever a mouse event of type type is received by this component.

Parameters:
type - the type of mouse event to listen for ("mousedown", "mouseup", etc..)
handler - the callback to invoke when the event occurs
Returns:
a CallbackBinding for this callback
Throws:
java.lang.IllegalArgumentException - if type is not a valid mouse event type.
See Also:
MouseEvent

onEvent

public CallbackBinding onEvent(java.lang.String type,
                               KeyEventHandler handler)
Registers handler as a callback to be invoked during the capture phase whenever a key event of type type is received by this component.

Parameters:
type - the type of mouse event to listen for ("keydown", "keyup", etc..)
handler - the callback to invoke when the event occurs
Returns:
a CallbackBinding for this callback
Throws:
java.lang.IllegalArgumentException - if type is not a valid key event type.
See Also:
KeyEvent

addStyle

public void addStyle(java.lang.String name)
Adds name to this component's styles in the global scope. If this component already has style name, then this method has no effect.

Parameters:
name - -- identifier for the new style

addStyle

public void addStyle(java.lang.String name,
                     Component scope)
Adds name to this component's styles within the given scope. If this component already has style name, within the given scope, then this method has no effect.

Parameters:
name -
scope -

removeStyle

public void removeStyle(java.lang.String name)
Removes name from this component's styles within the global scope. If this component does not already have style name, then this method has no effect.

Parameters:
name -

removeStyle

public void removeStyle(java.lang.String name,
                        Component scope)
Removes name from this component's styles within the given scope. If this component has no style name, within the given scope, then this method has no effect.

Parameters:
name -
scope -

isChild

public boolean isChild(Component component)
Tests if component is one of this object's direct children

Parameters:
component -
Returns:
true if component is a direct child of this component.

isDescendent

public boolean isDescendent(Component component)
Tests if component is a descendant of this object.

Parameters:
component -
Returns:
true if component is descendend from this object.

getChildren

public java.util.Collection getChildren()
Deprecated. this will not be in the release 1 API


Welcome to the Millenium!!!!!

© 2006 The Front Side. All rights reserved.