com.threerings.opengl.gui.layout
Class GroupLayout

java.lang.Object
  extended by com.threerings.opengl.gui.layout.LayoutManager
      extended by com.threerings.opengl.gui.layout.GroupLayout
Direct Known Subclasses:
HGroupLayout, VGroupLayout

public abstract class GroupLayout
extends LayoutManager

Group layout managers lay out widgets in horizontal or vertical groups.


Nested Class Summary
static class GroupLayout.Constraints
          The group layout managers supports two constraints: fixedness and weight.
static class GroupLayout.Justification
          A class used to make our policy constants type-safe.
static class GroupLayout.Policy
          A class used to make our policy constants type-safe.
 
Field Summary
static GroupLayout.Justification BOTTOM
          A justification constant.
static GroupLayout.Justification CENTER
          A justification constant.
static GroupLayout.Policy CONSTRAIN
          Only valid for off-axis policy, this leaves widgets alone unless they are larger in the off-axis direction than their container, in which case it constrains them to fit on the off-axis.
static int DEFAULT_GAP
          The default gap used by a group layout.
static GroupLayout.Policy EQUALIZE
          Stretch all the widgets to be equal to the size of the largest widget on this axis.
static GroupLayout.Constraints FIXED
          A constraints object that indicates that the component should be fixed and have the default weight of one.
static GroupLayout.Justification LEFT
          A justification constant.
static GroupLayout.Policy NONE
          Do not adjust the widgets on this axis.
static GroupLayout.Justification RIGHT
          A justification constant.
static GroupLayout.Policy STRETCH
          Stretch all the widgets to their maximum possible size on this axis.
static GroupLayout.Justification TOP
          A justification constant.
 
Constructor Summary
GroupLayout()
           
 
Method Summary
 void addLayoutComponent(Component comp, Object constraints)
          Components added to a container will result in a call to this method, informing the layout manager of said constraints.
 Object getConstraints(Component comp)
          Returns a reference to the constraints associated with the specified component, or null for none.
 int getGap()
           
 GroupLayout.Justification getJustification()
           
 GroupLayout.Justification getOffAxisJustification()
           
 GroupLayout.Policy getOffAxisPolicy()
           
 GroupLayout.Policy getPolicy()
           
static Container makeHBox(GlContext ctx, GroupLayout.Justification justification)
          Makes a container configured with a horizontal group layout manager.
static Container makeHBox(GlContext ctx, GroupLayout.Justification justification, Component... comps)
          Makes a horizontal box of components that uses the supplied (on-axis) justification.
static GroupLayout makeHoriz(GroupLayout.Justification justification)
          Convenience method for creating a horizontal group layout manager.
static GroupLayout makeHoriz(GroupLayout.Policy policy, GroupLayout.Justification justification, GroupLayout.Policy offpolicy)
          Convenience method for creating a horizontal group layout manager.
static GroupLayout makeHStretch()
          Convenience method for creating a horizontal group layout manager that stretches in both directions.
static Container makeVBox(GlContext ctx, GroupLayout.Justification justification)
          Creates a container configured with a vertical group layout manager.
static Container makeVBox(GlContext ctx, GroupLayout.Justification justification, Component... comps)
          Makes a vertical box of components that uses the supplied (on-axis) justification.
static GroupLayout makeVert(GroupLayout.Justification justification)
          Convenience method for creating a vertical group layout manager.
static GroupLayout makeVert(GroupLayout.Policy policy, GroupLayout.Justification justification, GroupLayout.Policy offpolicy)
          Convenience method for creating a vertical group layout manager.
static GroupLayout makeVStretch()
          Convenience method for creating a vertical group layout manager that stretches in both directions.
 void removeLayoutComponent(Component comp)
          Components removed to a container for which a layout manager has been configured will result in a call to this method.
 GroupLayout setGap(int gap)
           
 GroupLayout setJustification(GroupLayout.Justification justification)
           
 GroupLayout setOffAxisJustification(GroupLayout.Justification justification)
           
 GroupLayout setOffAxisPolicy(GroupLayout.Policy offpolicy)
           
 GroupLayout setPolicy(GroupLayout.Policy policy)
           
 
Methods inherited from class com.threerings.opengl.gui.layout.LayoutManager
computePreferredSize, layoutContainer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GAP

public static final int DEFAULT_GAP
The default gap used by a group layout.

See Also:
Constant Field Values

FIXED

public static final GroupLayout.Constraints FIXED
A constraints object that indicates that the component should be fixed and have the default weight of one. This is so commonly used that we create and make this object available here.


NONE

public static final GroupLayout.Policy NONE
Do not adjust the widgets on this axis.


STRETCH

public static final GroupLayout.Policy STRETCH
Stretch all the widgets to their maximum possible size on this axis.


EQUALIZE

public static final GroupLayout.Policy EQUALIZE
Stretch all the widgets to be equal to the size of the largest widget on this axis.


CONSTRAIN

public static final GroupLayout.Policy CONSTRAIN
Only valid for off-axis policy, this leaves widgets alone unless they are larger in the off-axis direction than their container, in which case it constrains them to fit on the off-axis.


CENTER

public static final GroupLayout.Justification CENTER
A justification constant.


LEFT

public static final GroupLayout.Justification LEFT
A justification constant.


RIGHT

public static final GroupLayout.Justification RIGHT
A justification constant.


TOP

public static final GroupLayout.Justification TOP
A justification constant.


BOTTOM

public static final GroupLayout.Justification BOTTOM
A justification constant.

Constructor Detail

GroupLayout

public GroupLayout()
Method Detail

setPolicy

public GroupLayout setPolicy(GroupLayout.Policy policy)

getPolicy

public GroupLayout.Policy getPolicy()

setOffAxisPolicy

public GroupLayout setOffAxisPolicy(GroupLayout.Policy offpolicy)

getOffAxisPolicy

public GroupLayout.Policy getOffAxisPolicy()

setGap

public GroupLayout setGap(int gap)

getGap

public int getGap()

setJustification

public GroupLayout setJustification(GroupLayout.Justification justification)

getJustification

public GroupLayout.Justification getJustification()

setOffAxisJustification

public GroupLayout setOffAxisJustification(GroupLayout.Justification justification)

getOffAxisJustification

public GroupLayout.Justification getOffAxisJustification()

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constraints)
Description copied from class: LayoutManager
Components added to a container will result in a call to this method, informing the layout manager of said constraints. The default implementation does nothing.

Overrides:
addLayoutComponent in class LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Description copied from class: LayoutManager
Components removed to a container for which a layout manager has been configured will result in a call to this method. The default implementation does nothing.

Overrides:
removeLayoutComponent in class LayoutManager

getConstraints

public Object getConstraints(Component comp)
Description copied from class: LayoutManager
Returns a reference to the constraints associated with the specified component, or null for none. The default implementation always returns null.

Overrides:
getConstraints in class LayoutManager

makeHoriz

public static GroupLayout makeHoriz(GroupLayout.Policy policy,
                                    GroupLayout.Justification justification,
                                    GroupLayout.Policy offpolicy)
Convenience method for creating a horizontal group layout manager.


makeVert

public static GroupLayout makeVert(GroupLayout.Policy policy,
                                   GroupLayout.Justification justification,
                                   GroupLayout.Policy offpolicy)
Convenience method for creating a vertical group layout manager.


makeHoriz

public static GroupLayout makeHoriz(GroupLayout.Justification justification)
Convenience method for creating a horizontal group layout manager.


makeVert

public static GroupLayout makeVert(GroupLayout.Justification justification)
Convenience method for creating a vertical group layout manager.


makeHStretch

public static GroupLayout makeHStretch()
Convenience method for creating a horizontal group layout manager that stretches in both directions.


makeVStretch

public static GroupLayout makeVStretch()
Convenience method for creating a vertical group layout manager that stretches in both directions.


makeHBox

public static Container makeHBox(GlContext ctx,
                                 GroupLayout.Justification justification)
Makes a container configured with a horizontal group layout manager.


makeHBox

public static Container makeHBox(GlContext ctx,
                                 GroupLayout.Justification justification,
                                 Component... comps)
Makes a horizontal box of components that uses the supplied (on-axis) justification.


makeVBox

public static Container makeVBox(GlContext ctx,
                                 GroupLayout.Justification justification)
Creates a container configured with a vertical group layout manager.


makeVBox

public static Container makeVBox(GlContext ctx,
                                 GroupLayout.Justification justification,
                                 Component... comps)
Makes a vertical box of components that uses the supplied (on-axis) justification.



Copyright © 2011. All Rights Reserved.