Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## echopointng.util
Class ComponentKit

    java.lang.Object
      echopointng.util.ComponentKit

    public class ComponentKit

extends java.lang.Object

A utility to class to help with Component manipulation

Nested Class Summary
`static interface` | `ComponentKit.ComponentTraversalCallBack` `ComponentOperationCallBack` is an interface used during the traverseComponent() method.

Method Summary
`static Component[]` | `getComponentPath(Component parent, Component child)` This method will return an array of Components that indicates the path from parent to child.
`static Component` | `getComponentRoot(Component child)` Returns the highest Component parent starting from child.
`static Window` | `getComponentWindow(Component child)` Returns the Window contaning the child or null if the child is not contained within a Window.
`static boolean` | `remove(Component parent, Component child)` This method will remove a child component from anywhere in the component hierarchy from parent downwards.
`static void` | `setEnabled(Component component, boolean enabled)` This method makes the component, and all its children, enabled or disabled.
`static boolean` | `setProperty(Component component, java.lang.String propertyName, java.lang.Object propertyValue)` This method will use reflection to set a property on a given component, and all of its children.
`static boolean` | `setProperty(Component component, java.lang.String propertyName, java.lang.Object propertyValue, java.lang.Class filterClass)` This method will use reflection to set a property on a given component, and all of its children.
`static void` | `setVisible(Component component, boolean visible)` This method makes the component, and all its children, visible or invisible.
`static void` | `traverseComponent(Component startComponent, ComponentKit.ComponentTraversalCallBack traverseCallBack)` This method will traverse the current component and all its children, in a depth first manner, and call the ComponentTraversalCallBack object for each component found.
`static void` | `traverseInstance(ApplicationInstance instance, ComponentKit.ComponentTraversalCallBack traverseCallBack)` This method will traverse the EchoInstance and all its child components, in a depth first manner, and call the ComponentTraversalCallBack object for each component found.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### remove

    public static boolean remove(Component parent,
                                 Component child)

  This method will remove a child component from anywhere in the component hierarchy from parent downwards.

  Parameters:
    `parent` - - an ancestor of child
    `child` - - the component to remove
  Returns:
    true if the component was actually removed, or false if the parent is not an ancestor of child.

### getComponentPath

    public static Component[] getComponentPath(Component parent,
                                               Component child)

  This method will return an array of Components that indicates the path from parent to child. The parent Component (ie the root of the path) is the first element in the array, while the child will be the last. If the parent is not an ancestor of the child, then a zero length array will be returned.

  Parameters:
    `parent` - the parent component to be searched
    `child` - - the child component to find.
  Returns:
    an array of Components between parent and child or a zero length array if there is no path.

### getComponentRoot

    public static Component getComponentRoot(Component child)

  Returns the highest Component parent starting from child. This is in fact ths parent that has no parent.

  Parameters:
    `child` - - the component to start searching at
  Returns:
    - the higest parent Component

### getComponentWindow

    public static Window getComponentWindow(Component child)

  Returns the Window contaning the child or null if the child is not contained within a Window.

  Parameters:
    `child` - - the component to start searching at
  Returns:
    - the Window contaning the child or null if the child is not contained within a Window.

### setVisible

    public static void setVisible(Component component,
                                  boolean visible)

  This method makes the component, and all its children, visible or invisible.

  Parameters:
    `component` - - the component inquestion
    `visible` - - true to make all components visible or false to make them invisible

### setEnabled

    public static void setEnabled(Component component,
                                  boolean enabled)

  This method makes the component, and all its children, enabled or disabled.

  Parameters:
    `component` - - the component inquestion
    `enabled` - - true to make all components enabled or false to make them disabled

### traverseComponent

    public static void traverseComponent(Component startComponent,
                                         ComponentKit.ComponentTraversalCallBack traverseCallBack)

  This method will traverse the current component and all its children, in a depth first manner, and call the ComponentTraversalCallBack object for each component found.

  Parameters:
    `startComponent` - - the component to start at.
    `traverseCallBack` - - the ComponentTraversalCallBack to call when a component is found

### traverseInstance

    public static void traverseInstance(ApplicationInstance instance,
                                        ComponentKit.ComponentTraversalCallBack traverseCallBack)

  This method will traverse the EchoInstance and all its child components, in a depth first manner, and call the ComponentTraversalCallBack object for each component found.

  Parameters:
    `instance` - - the ApplicationInstance to traverse.
    `traverseCallBack` - - the ComponentTraversalCallBack to call when a component is found

### setProperty

    public static boolean setProperty(Component component,
                                      java.lang.String propertyName,
                                      java.lang.Object propertyValue)

  This method will use reflection to set a property on a given component, and all of its children. For example you could set the component's font via :

  >                     ComponentKit.setProperty(myComponent, "font", new Font(Font.VERDANA,Font.BOLD,8));

  This method uses JavaBean rules for setting properties, that is it will look for a method called setXxx that takes one parameter, where Xxx is the setter method of the property to be set. Failing that it will look for setXX and finally just XX.

  This method guarantees not to throw any exceptions, but rather return false if it cannot set the properties on an eligble object.

  Parameters:
    `component` - - the component in question
    `propertyName` - - then name of the property to set
    `propertyValue` - - the new value
  Returns:
    true if the property could be set.

### setProperty

    public static boolean setProperty(Component component,
                                      java.lang.String propertyName,
                                      java.lang.Object propertyValue,
                                      java.lang.Class filterClass)

  This method will use reflection to set a property on a given component, and all of its children. For example you could set the component's font via :

  >                     ComponentKit.setProperty(myComponent, "font", new Font(Font.VERDANA,Font.BOLD,8), RadionButton.class);

  This method uses JavaBean rules for setting properties, that is it will look for a method called setXxx that takes one parameter, where Xxx is the setter method of the property to be set. Failing that it will look for setXX and finally just XX.

  If a non null `filterClass` is provided then it will only set properties on components that are assignable from the filterClass. If the filterClass is null, then all components will be matched.

  This method guarantees not to throw any exceptions, but rather return false if it cannot set the properties on an eligble object.

  Parameters:
    `component` - - the component in question
    `propertyName` - - then name of the property to set
    `propertyValue` - - the new value
    `filterClass` - - only sets component derived from the filter class or matches all components if its null.
  Returns:
    true if the property could be set.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD