Oculus Layout System API Documentation
November 25, 2002

com.oculustech.layout
Class DynamicallyPropertiedComponentHelper

java.lang.Object
  |
  +--com.oculustech.layout.DynamicallyPropertiedComponentHelper

public class DynamicallyPropertiedComponentHelper
extends java.lang.Object

Can be used as basis for implementation of DynamicallyPropertiedComponent by simply passing calls through to its functions. Note that this implementation does no caching of property values at nodes, making a tree walk necessary on every call to get. This simplifies the implementation (at the expense of performance), and is probably OK given that we use this code very little at the moment.

The object methods provided here are generic and could be used to implement the DynamicallyPropertiedComponent interface in any context. In addition, static methods for implementing the DynamicallyPropertiedComponent tree-functions in the context of AWT component trees are provided. These functions will collapse nodes of the AWT component tree that do not implement the DynamicallyPropertiedComponent interface, reducing the tree to a much smaller DynamicallyPropertiedComponent tree. The implementations of these functions are inefficient (a complete tree walk may be up to O(n^2 * ln n)); caching of tree structure information at nodes should probably be implemented to speed things along. On the other hand, this code is used sparingly enough its inefficiency doesn't matter.


Field Summary
 java.io.PrintStream debugOut
           
 
Constructor Summary
DynamicallyPropertiedComponentHelper(DynamicallyPropertiedComponent component)
           
 
Method Summary
static void addDebugProperty(java.lang.String prop)
          Turn on debugging information related to the given property name.
 java.lang.Object aggregateDynamicPropertyValues(java.lang.String prop, java.lang.Object value1, java.lang.Object value2)
          Implements inherited aggregateDynamicPropertyValues implementation, as per spec in interface.
 void clearNodeDynamicallyAccumulatedProperties()
           
 void clearNodeDynamicallyInheritedProperties()
           
protected  void debugOutput(java.lang.String s)
           
protected  void debugOutput(java.lang.String prop, int indent, java.lang.String s)
           
protected  void debugOutput(java.lang.String prop, java.lang.String s)
           
static void debugOutputDynamicallyPropertiedComponentTreeOfAWTContainer(java.awt.Container container)
           
 void debugOutputNodesDefiningProperty(java.lang.String prop)
           
static java.lang.Object defaultAggregateDynamicPropertiesAlgorithm(java.lang.String prop, java.lang.Object value1, java.lang.Object value2)
          Implements the algorithm used by default in aggregateDynamicPropertyValues.
 void dynamicallyAccumulatedPropertyChanged(java.lang.String prop)
           
 void dynamicallyInheritedPropertyChanged(java.lang.String prop)
           
 java.lang.Object getDynamicallyAccumulatedProperty(java.lang.String prop)
           
 java.lang.Object getDynamicallyAccumulatedPropertyFromRoot(java.lang.String prop)
          Get the value of the accumulated property as seen from the root of the tree.
 java.lang.Object getDynamicallyInheritedProperty(java.lang.String prop)
           
static DynamicallyPropertiedComponent getDynamicallyPropertiedChildOfAWTContainer(java.awt.Container container, int index)
          Provides parent routine that collapses an AWT component tree into a tree consisting only of DynamicallyPropertiedComponent nodes.
static int getDynamicallyPropertiedChildrenCountOfAWTComponent(java.awt.Component comp)
          Provides parent routine that collapses an AWT component tree into a tree consisting only of DynamicallyPropertiedComponent nodes.
static DynamicallyPropertiedComponent getDynamicallyPropertiedParentOfAWTComponent(java.awt.Component comp)
          Provides parent routine that collapses an AWT component tree into a tree consisting only of DynamicallyPropertiedComponent nodes.
 DynamicallyPropertiedComponent getDynamicallyPropertiedRoot()
           
 java.lang.Object getLocalDynamicallyAccumulatedProperty(java.lang.String prop)
           
 java.lang.Object getLocalDynamicallyInheritedProperty(java.lang.String prop)
           
static void removeDebugProperty(java.lang.String prop)
          Turn off debugging information related to the given property name.
static void setDebugAll(boolean on)
          turn on/off debugging information for all properties.
 void setDebugOutStream(java.io.PrintStream x)
          Set the PrintStream to which to output debugging information.
static void setDefaultDebugOutStream(java.io.PrintStream x)
          Set the PrintStream to which to output debugging information for all new DynamicallyPropertiedComponentHelper instances.
 void setDynamicallyAccumulatedProperty(java.lang.String prop, java.lang.Object value)
           
 void setDynamicallyInheritedProperty(java.lang.String prop, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugOut

public transient java.io.PrintStream debugOut
Constructor Detail

DynamicallyPropertiedComponentHelper

public DynamicallyPropertiedComponentHelper(DynamicallyPropertiedComponent component)
Method Detail

setDebugOutStream

public void setDebugOutStream(java.io.PrintStream x)
Set the PrintStream to which to output debugging information.

setDefaultDebugOutStream

public static void setDefaultDebugOutStream(java.io.PrintStream x)
Set the PrintStream to which to output debugging information for all new DynamicallyPropertiedComponentHelper instances.

addDebugProperty

public static void addDebugProperty(java.lang.String prop)
Turn on debugging information related to the given property name.

removeDebugProperty

public static void removeDebugProperty(java.lang.String prop)
Turn off debugging information related to the given property name.

setDebugAll

public static void setDebugAll(boolean on)
turn on/off debugging information for all properties.

debugOutput

protected void debugOutput(java.lang.String prop,
                           int indent,
                           java.lang.String s)

debugOutput

protected void debugOutput(java.lang.String prop,
                           java.lang.String s)

debugOutput

protected void debugOutput(java.lang.String s)

setDynamicallyAccumulatedProperty

public void setDynamicallyAccumulatedProperty(java.lang.String prop,
                                              java.lang.Object value)

clearNodeDynamicallyAccumulatedProperties

public void clearNodeDynamicallyAccumulatedProperties()

clearNodeDynamicallyInheritedProperties

public void clearNodeDynamicallyInheritedProperties()

getDynamicallyAccumulatedProperty

public java.lang.Object getDynamicallyAccumulatedProperty(java.lang.String prop)

getLocalDynamicallyAccumulatedProperty

public java.lang.Object getLocalDynamicallyAccumulatedProperty(java.lang.String prop)

dynamicallyAccumulatedPropertyChanged

public void dynamicallyAccumulatedPropertyChanged(java.lang.String prop)

aggregateDynamicPropertyValues

public java.lang.Object aggregateDynamicPropertyValues(java.lang.String prop,
                                                       java.lang.Object value1,
                                                       java.lang.Object value2)
Implements inherited aggregateDynamicPropertyValues implementation, as per spec in interface.

Root level default aggregation technique adds numbers, ORs booleans, concatenates Strings and Lists, and causes SelectionActions to inherit from one another corresponding to component tree structure, and passes up the least-derived (parent) SelectionActions instance. (Note that Concatenated strings will be separated by newline).

If properties are of different types, or are of a type unknown to this function, root level default returns value1.


defaultAggregateDynamicPropertiesAlgorithm

public static java.lang.Object defaultAggregateDynamicPropertiesAlgorithm(java.lang.String prop,
                                                                          java.lang.Object value1,
                                                                          java.lang.Object value2)
Implements the algorithm used by default in aggregateDynamicPropertyValues.

Aggregation technique adds numbers, ORs booleans, concatenates Strings and Lists, combines Maps with childrens' items taking precedence over parents', and causes SelectionActions to inherit from one another corresponding to component tree structure, and passes up the least-derived (parent) SelectionActions instance. (Note that Concatenated strings will be separated by newline).

If properties are of different types, or are of a type unknown to this function, root level default returns value1.


setDynamicallyInheritedProperty

public void setDynamicallyInheritedProperty(java.lang.String prop,
                                            java.lang.Object value)

getDynamicallyInheritedProperty

public java.lang.Object getDynamicallyInheritedProperty(java.lang.String prop)

getLocalDynamicallyInheritedProperty

public java.lang.Object getLocalDynamicallyInheritedProperty(java.lang.String prop)

dynamicallyInheritedPropertyChanged

public void dynamicallyInheritedPropertyChanged(java.lang.String prop)

getDynamicallyPropertiedRoot

public DynamicallyPropertiedComponent getDynamicallyPropertiedRoot()

getDynamicallyAccumulatedPropertyFromRoot

public java.lang.Object getDynamicallyAccumulatedPropertyFromRoot(java.lang.String prop)
Get the value of the accumulated property as seen from the root of the tree. (Merely calls getDynamicallyPropertiedRoot().getDynamicallyAccumulatedProperty(prop)).

getDynamicallyPropertiedParentOfAWTComponent

public static DynamicallyPropertiedComponent getDynamicallyPropertiedParentOfAWTComponent(java.awt.Component comp)
Provides parent routine that collapses an AWT component tree into a tree consisting only of DynamicallyPropertiedComponent nodes.

getDynamicallyPropertiedChildrenCountOfAWTComponent

public static int getDynamicallyPropertiedChildrenCountOfAWTComponent(java.awt.Component comp)
Provides parent routine that collapses an AWT component tree into a tree consisting only of DynamicallyPropertiedComponent nodes. This implementation is inefficient (O(n) in number of AWT components); it could be improved by addition of caching of tree info at nodes, but should be OK under most use.

getDynamicallyPropertiedChildOfAWTContainer

public static DynamicallyPropertiedComponent getDynamicallyPropertiedChildOfAWTContainer(java.awt.Container container,
                                                                                         int index)
Provides parent routine that collapses an AWT component tree into a tree consisting only of DynamicallyPropertiedComponent nodes. This implementation is inefficient (O(n * ln n) in number of AWT components); it could be improved by addition of caching of tree info at nodes, but should be OK under most use.

debugOutputNodesDefiningProperty

public void debugOutputNodesDefiningProperty(java.lang.String prop)

debugOutputDynamicallyPropertiedComponentTreeOfAWTContainer

public static void debugOutputDynamicallyPropertiedComponentTreeOfAWTContainer(java.awt.Container container)

Oculus Layout System API Documentation
November 25, 2002

Copyright 2001-2002 Oculus Technologies Corporation. 103 Broad Street, 5th Floor,
Boston, Massachusetts, 02110, U.S.A. All Rights Reserved.