Oculus Layout System API Documentation
November 25, 2002

com.oculustech.layout
Class OculusBox

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.oculustech.layout.OculusBox
All Implemented Interfaces:
javax.accessibility.Accessible, DynamicallyPropertiedComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, OculusLayoutInfo, java.io.Serializable

public class OculusBox
extends javax.swing.JPanel
implements OculusLayoutInfo, DynamicallyPropertiedComponent

For a detailed explanation of using the Oculus Layout system, see the docs for OculusLayoutHelper.

OculusBox extends JComponent but only uses OculusLayout as the layout manager. It also implements the OculusLayoutInfo.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface com.oculustech.layout.OculusLayoutInfo
ALIGNED_COMPONENT_SPACING, ALIGNMENT_SPACE_STRETCHING, CAN_BE_STRETCHED, LOW_PRIORITY_ALIGNMENT_SPACE_STRETCHING, MAX_STRETCHING_PREFERENCE, NO_STRETCH, START_NON_POINT_ALIGNMENT_STRETCHING_HERE, START_NORMAL_STRETCHING, START_STRETCHING_HERE, STRETCH_ONLY_TO_ALIGN, WANT_STRETCHED
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OculusBox()
          Empty constructor.
OculusBox(int axis)
          Constructor with set axis.
OculusBox(int axis, int justification)
          Constructor with set axis.
OculusBox(int axis, int justification, java.awt.Component heightGuide, java.awt.Component widthGuide)
          Constructor with the given axis, the given stretching, and the given alignment preferences.
 
Method Summary
 java.awt.Component add(java.awt.Component c, int xStretching, int yStretching)
          Adds given component to container with given stretching preferences.
 java.lang.Object aggregateDynamicPropertyValues(java.lang.String prop, java.lang.Object value1, java.lang.Object value2)
          This function is used to aggregate values of the given property when computing the value of accumulated properties.
static OculusBox createHorizontalOculusBox()
          Creates an OculusBox that displays its components from top to bottom.
static OculusBox createVerticalOculusBox()
          Creates an OculusBox that displays it components from left to right.
 void debugOutputNodesDefiningProperty(java.lang.String prop)
          Dump this.toString() to System.err for nodes who define given property.
 void dynamicallyAccumulatedPropertyChanged(java.lang.String prop)
          Called to notify parents when one of their descendants changes the accumulated property.
 void dynamicallyInheritedPropertyChanged(java.lang.String prop)
          Called to notify children when one of their ancestors changes a inherited property.
 java.lang.Object getDynamicallyAccumulatedProperty(java.lang.String prop)
          Get the value of the accumulated property, by starting aggregation from this node and recursing down through its children.
 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)
          Gets the given inherited property starting at this node and recursing up through the parents.
 DynamicallyPropertiedComponent getDynamicallyPropertiedChild(int index)
          Return a specific DynamicallyPropertiedComponent child
 int getDynamicallyPropertiedChildrenCount()
          Return the number of DynamicallyPropertiedComponent children
 DynamicallyPropertiedComponent getDynamicallyPropertiedParent()
          Return the parent DynamicallyPropertiedComponent
 DynamicallyPropertiedComponent getDynamicallyPropertiedRoot()
          Return the root of the DynamicallyPropertiedComponent tree
 int getInterComponentSpacing()
          Returns this box's intercomponent spacing.
 int getJustification()
          Gets the justification for this box
 java.lang.Object getLocalDynamicallyAccumulatedProperty(java.lang.String prop)
          Get the value of the dynamically accumulated property of the given name that was set on this node.
 java.lang.Object getLocalDynamicallyInheritedProperty(java.lang.String prop)
          Get the value of the inherited property of the given name that was set on this node.
 int getNestingLevel()
          Returns the depth of this box in a tree of nested OculusBoxes.
 int getNonce()
          Returns an arbitrary, unique number identifying this OculusBox instance.
 int getOrientation()
          Get the orientation for this box
 java.awt.Component getSameHeightAs()
          Gets the component whose height is being matched.
 java.awt.Component getSameWidthAs()
          Gets the component whose height is being matched.
 int getXPreference()
          Gets the horizontal preference according to one of the fields.
 int getYPreference()
          Gets the vertical preference according to one of the fields.
 void setDebugOutStream(java.io.PrintStream x)
          Sets the PrintStream to output debugging information to.
 void setDynamicallyAccumulatedProperty(java.lang.String prop, java.lang.Object value)
          Set the given accumulated property to the given value at this node.
 void setDynamicallyInheritedProperty(java.lang.String prop, java.lang.Object value)
          Sets the given inherited property to the given value at this node, and then notifies the children of the change via their dynamicallyInheritedPropertyChanged() method.
 void setInterComponentSpacing(int icspacing)
          Sets this box's intercomponent spacing.
 void setJustification(int justification)
          Sets the justification for this box
 void setOrientation(int orientation)
          Sets the orientation for this box
 void setSameHeightAs(java.awt.Component c)
           
 void setSameWidthAs(java.awt.Component c)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OculusBox

public OculusBox()
Empty constructor. Sets the Constraints to default which are:
  1. axis - horizontal
  2. horizontal - can be stretched
  3. vertical - no stretching
  4. horizontal size - same size as null
  5. vertical size - same size as null
Parameters:
axis - either OculusLayout.HORIZONTAL or OculusLayout.VERTICAL value

OculusBox

public OculusBox(int axis)
Constructor with set axis. axis must be either
Parameters:
axis - OculusLayout.HORIZONTAL or Oculus.VERTICAL values.

OculusBox

public OculusBox(int axis,
                 int justification)
Constructor with set axis. axis must be either
Parameters:
axis - OculusLayout.HORIZONTAL or Oculus.VERTICAL values.

OculusBox

public OculusBox(int axis,
                 int justification,
                 java.awt.Component heightGuide,
                 java.awt.Component widthGuide)
Constructor with the given axis, the given stretching, and the given alignment preferences.
Parameters:
axis - either OculusLayout.HORIZONTAL or OculusLayout.VERTICAL value
justification - one of OculusLayout.JUSTIFY_LEFT, OculusLayout.JUSTIFY_CENTER, OculusLayout.JUSTIFY_RIGHT, OculusLayout.JUSTIFY_TOP, or OculusLayout.JUSTIFY_BOTTOM.
heightGuide - The component whose vertical size will be matched.
widthGuide - The component whose horizontal size will be matched.
Method Detail

getNonce

public int getNonce()
Returns an arbitrary, unique number identifying this OculusBox instance. For convenience, this will correspond to the OculusLayout nonce initially created for this box.

createHorizontalOculusBox

public static OculusBox createHorizontalOculusBox()
Creates an OculusBox that displays its components from top to bottom.
Returns:
A horizontal OculusBox

createVerticalOculusBox

public static OculusBox createVerticalOculusBox()
Creates an OculusBox that displays it components from left to right.
Returns:
a vertical OculusBox

setDebugOutStream

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

setOrientation

public void setOrientation(int orientation)
Sets the orientation for this box

setJustification

public void setJustification(int justification)
Sets the justification for this box

getJustification

public int getJustification()
Gets the justification for this box

getOrientation

public int getOrientation()
Get the orientation for this box

setInterComponentSpacing

public void setInterComponentSpacing(int icspacing)
Sets this box's intercomponent spacing. Default is 3

getInterComponentSpacing

public int getInterComponentSpacing()
Returns this box's intercomponent spacing.

getXPreference

public int getXPreference()
Description copied from interface: OculusLayoutInfo
Gets the horizontal preference according to one of the fields.
Specified by:
getXPreference in interface OculusLayoutInfo
Following copied from interface: com.oculustech.layout.OculusLayoutInfo
Returns:
One of stretching preference final ints defined in OculusLayoutInfo

getYPreference

public int getYPreference()
Description copied from interface: OculusLayoutInfo
Gets the vertical preference according to one of the fields.
Specified by:
getYPreference in interface OculusLayoutInfo
Following copied from interface: com.oculustech.layout.OculusLayoutInfo
Returns:
One of stretching preference final ints defined in OculusLayoutInfo

setSameHeightAs

public void setSameHeightAs(java.awt.Component c)

getSameHeightAs

public java.awt.Component getSameHeightAs()
Description copied from interface: OculusLayoutInfo
Gets the component whose height is being matched.
Specified by:
getSameHeightAs in interface OculusLayoutInfo
Following copied from interface: com.oculustech.layout.OculusLayoutInfo
Returns:
The component whose height is being matched, or null if not applicable.

setSameWidthAs

public void setSameWidthAs(java.awt.Component c)

getSameWidthAs

public java.awt.Component getSameWidthAs()
Description copied from interface: OculusLayoutInfo
Gets the component whose height is being matched.
Specified by:
getSameWidthAs in interface OculusLayoutInfo
Following copied from interface: com.oculustech.layout.OculusLayoutInfo
Returns:
The component whose height is being matched, or null if not applicable.

getNestingLevel

public int getNestingLevel()
Returns the depth of this box in a tree of nested OculusBoxes.

add

public java.awt.Component add(java.awt.Component c,
                              int xStretching,
                              int yStretching)
Adds given component to container with given stretching preferences. Returns component added to container (c).

dynamicallyAccumulatedPropertyChanged

public void dynamicallyAccumulatedPropertyChanged(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Called to notify parents when one of their descendants changes the accumulated property.
Specified by:
dynamicallyAccumulatedPropertyChanged in interface DynamicallyPropertiedComponent

getDynamicallyPropertiedParent

public DynamicallyPropertiedComponent getDynamicallyPropertiedParent()
Description copied from interface: DynamicallyPropertiedComponent
Return the parent DynamicallyPropertiedComponent
Specified by:
getDynamicallyPropertiedParent in interface DynamicallyPropertiedComponent

getDynamicallyPropertiedChildrenCount

public int getDynamicallyPropertiedChildrenCount()
Description copied from interface: DynamicallyPropertiedComponent
Return the number of DynamicallyPropertiedComponent children
Specified by:
getDynamicallyPropertiedChildrenCount in interface DynamicallyPropertiedComponent

getDynamicallyPropertiedChild

public DynamicallyPropertiedComponent getDynamicallyPropertiedChild(int index)
Description copied from interface: DynamicallyPropertiedComponent
Return a specific DynamicallyPropertiedComponent child
Specified by:
getDynamicallyPropertiedChild in interface DynamicallyPropertiedComponent

getDynamicallyPropertiedRoot

public DynamicallyPropertiedComponent getDynamicallyPropertiedRoot()
Description copied from interface: DynamicallyPropertiedComponent
Return the root of the DynamicallyPropertiedComponent tree
Specified by:
getDynamicallyPropertiedRoot in interface DynamicallyPropertiedComponent

setDynamicallyAccumulatedProperty

public void setDynamicallyAccumulatedProperty(java.lang.String prop,
                                              java.lang.Object value)
Description copied from interface: DynamicallyPropertiedComponent
Set the given accumulated property to the given value at this node. Parents will be notified that there has been a change via their dynamicallyAccumulatedPropertyChanged() method.
Specified by:
setDynamicallyAccumulatedProperty in interface DynamicallyPropertiedComponent

getDynamicallyAccumulatedProperty

public java.lang.Object getDynamicallyAccumulatedProperty(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Get the value of the accumulated property, by starting aggregation from this node and recursing down through its children. Returns null if the property is undefined. If null is passed, indicates that many properties have changed, or that unknown properties have changed.
Specified by:
getDynamicallyAccumulatedProperty in interface DynamicallyPropertiedComponent

getDynamicallyAccumulatedPropertyFromRoot

public java.lang.Object getDynamicallyAccumulatedPropertyFromRoot(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Get the value of the accumulated property as seen from the root of the tree. (Merely calls getDynamicallyPropertiedRoot().getDynamicallyAccumulatedProperty(prop)).
Specified by:
getDynamicallyAccumulatedPropertyFromRoot in interface DynamicallyPropertiedComponent

getLocalDynamicallyAccumulatedProperty

public java.lang.Object getLocalDynamicallyAccumulatedProperty(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Get the value of the dynamically accumulated property of the given name that was set on this node. (Gets only those properties set on this node; Does not accumulate from children).
Specified by:
getLocalDynamicallyAccumulatedProperty in interface DynamicallyPropertiedComponent

aggregateDynamicPropertyValues

public java.lang.Object aggregateDynamicPropertyValues(java.lang.String prop,
                                                       java.lang.Object value1,
                                                       java.lang.Object value2)
Description copied from interface: DynamicallyPropertiedComponent
This function is used to aggregate values of the given property when computing the value of accumulated properties. Either or both value1 and value2 may be null. This function should be implemented in an inheritance-style fashion: if this node has a parent, calls to aggregate should be delegated to the parent, unless this node explicitly wishes to override default behaviour. The root should always provide a reasonable default implementation of this property.
Specified by:
aggregateDynamicPropertyValues in interface DynamicallyPropertiedComponent

setDynamicallyInheritedProperty

public void setDynamicallyInheritedProperty(java.lang.String prop,
                                            java.lang.Object value)
Description copied from interface: DynamicallyPropertiedComponent
Sets the given inherited property to the given value at this node, and then notifies the children of the change via their dynamicallyInheritedPropertyChanged() method.
Specified by:
setDynamicallyInheritedProperty in interface DynamicallyPropertiedComponent

getDynamicallyInheritedProperty

public java.lang.Object getDynamicallyInheritedProperty(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Gets the given inherited property starting at this node and recursing up through the parents. Returns null if undefined.
Specified by:
getDynamicallyInheritedProperty in interface DynamicallyPropertiedComponent

getLocalDynamicallyInheritedProperty

public java.lang.Object getLocalDynamicallyInheritedProperty(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Get the value of the inherited property of the given name that was set on this node. (Gets only those properties set on this node; Does not inherit from ancestors).
Specified by:
getLocalDynamicallyInheritedProperty in interface DynamicallyPropertiedComponent

dynamicallyInheritedPropertyChanged

public void dynamicallyInheritedPropertyChanged(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Called to notify children when one of their ancestors changes a inherited property. This function should recurse down the tree notifying this nodes children of the change IF this node doesn't override the change. If null is passed, indicates that many properties have changed, or that unknown properties have changed.
Specified by:
dynamicallyInheritedPropertyChanged in interface DynamicallyPropertiedComponent

debugOutputNodesDefiningProperty

public void debugOutputNodesDefiningProperty(java.lang.String prop)
Description copied from interface: DynamicallyPropertiedComponent
Dump this.toString() to System.err for nodes who define given property. Recurses down through children.
Specified by:
debugOutputNodesDefiningProperty in interface DynamicallyPropertiedComponent

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.