Oculus Layout System API Documentation
November 25, 2002

com.oculustech.layout
Class OculusLayoutConstraints

java.lang.Object
  |
  +--com.oculustech.layout.OculusLayoutConstraints
All Implemented Interfaces:
OculusLayoutInfo

public class OculusLayoutConstraints
extends java.lang.Object
implements OculusLayoutInfo

This class implements the OculusLayoutInfo interface. It is intended to be associated with a component when the component is being added to an OculusGrid, OculusBox, or other container using OculusLayout. Instances of this class contain stretching preferences, and size constraints to be associated with a component.


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
 
Constructor Summary
OculusLayoutConstraints()
          Constructor with default settings.
OculusLayoutConstraints(int xStretchingPreference, int yStretchingPreference)
          Constructor with given stretching preferences and default sizing settings.
OculusLayoutConstraints(int xStretchingPreference, int yStretchingPreference, java.awt.Component heightGuide, java.awt.Component widthGuide)
          Constructor with the given stretching and sizing preferences.
 
Method Summary
static OculusLayoutInfo getDefaultConstraints(java.awt.Component c)
          Returns the default OculusLayoutConstraints for c.
 java.awt.Component getSameHeightAs()
          Returns the component to which this constraint's associated component's height is to be matched.
 java.awt.Component getSameWidthAs()
          Returns the component to which this constraint's associated component's width is to be matched.
 int getXPreference()
          Gets the horizontal stretching preference.
 int getYPreference()
          Gets the vertical stretching preference.
 void setSameHeightAs(java.awt.Component c)
          Sets the vertical size equal to that of the given component.
 void setSameWidthAs(java.awt.Component c)
          Sets the horizontal size equal to that of the given component.
 void setXPreference(int preference)
          Sets the horizontal stretching preference according to one of the fields.
 void setYPreference(int preference)
          Sets the vertical stretching preference according to one of the fields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OculusLayoutConstraints

public OculusLayoutConstraints()
Constructor with default settings. The default settings are:
  1. horizontal stretching: STRETCH_ONLY_TO_ALIGN
  2. vertical stretching: NO_STRETCH
  3. sameHeightAs: null
  4. sameWidthAs: null

OculusLayoutConstraints

public OculusLayoutConstraints(int xStretchingPreference,
                               int yStretchingPreference)
Constructor with given stretching preferences and default sizing settings.
Parameters:
xStretchingPreference - One of the stretching preferences defined in OculusLayoutInfo
yStretchingPreference - One of the stretching preferences defined in OculusLayoutInfo

OculusLayoutConstraints

public OculusLayoutConstraints(int xStretchingPreference,
                               int yStretchingPreference,
                               java.awt.Component heightGuide,
                               java.awt.Component widthGuide)
Constructor with the given stretching and sizing preferences.
Parameters:
xStretchingPreference - One of the stretching preferences defined in OculusLayoutInfo
yStretchingPreference - One of the stretching preferences defined in OculusLayoutInfo
heightGuide - The component whose vertical size will be matched.
widthGuide - The component whose horizontal size will be matched.
Method Detail

setXPreference

public void setXPreference(int preference)
Sets the horizontal stretching preference according to one of the fields.
Parameters:
preference - One of the stretching preferences defined in OculusLayoutInfo

getXPreference

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

setYPreference

public void setYPreference(int preference)
Sets the vertical stretching preference according to one of the fields.
Parameters:
preference - One of the stretching preferences defined in OculusLayoutInfo

getYPreference

public int getYPreference()
Gets the vertical stretching preference.
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)
Sets the vertical size equal to that of the given component.
Parameters:
c - The component whose height is to be matched

getSameHeightAs

public java.awt.Component getSameHeightAs()
Returns the component to which this constraint's associated component's height is to be 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)
Sets the horizontal size equal to that of the given component.
Parameters:
c - The component whose width is to be matched

getSameWidthAs

public java.awt.Component getSameWidthAs()
Returns the component to which this constraint's associated component's width is to be 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.

getDefaultConstraints

public static OculusLayoutInfo getDefaultConstraints(java.awt.Component c)
Returns the default OculusLayoutConstraints for c. If the component type is unrecognized, {STRETCH_ONLY_TO_ALIGN, NO_STRETCH} is returned. Custom components can set their default stretching preferences by implementing OculusLayoutInfo.

Default constraints for common Swing components:
(component = horizontal-stretching, vertical-stretching)

JLabel = NO_STRETCH, NO_STRETCH
JRadioButton = NO_STRETCH, NO_STRETCH
JCheckBox = NO_STRETCH, NO_STRETCH
JComboBox = STRETCH_ONLY_TO_ALIGN, NO_STRETCH
JButton = STRETCH_ONLY_TO_ALIGN, NO_STRETCH
JTextField = CAN_BE_STRETCHED, NO_STRETCH
JTextArea = CAN_BE_STRETCHED, CAN_BE_STRETCHED
JEditorPane = CAN_BE_STRETCHED, CAN_BE_STRETCHED
JTabbedPane = CAN_BE_STRETCHED, CAN_BE_STRETCHED
JScrollPane = CAN_BE_STRETCHED, WANT_STRETCHED
JList = CAN_BE_STRETCHED, WANT_STRETCHED
JTable = WANT_STRETCHED, WANT_STRETCHED
JTree = WANT_STRETCHED, WANT_STRETCHED
JSplitPane = WANT_STRETCHED, WANT_STRETCHED

Parameters:
c - The component whose default OculusLayoutConstraints are returned.
Returns:
The default OculusLayoutConstraints object for the given component.

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.