|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.swing.JideBoxLayout
public class JideBoxLayout
JideBoxLayout is very similar to BoxLayout in the way that all components are arranged either from left to right or from top to bottom. Different \ from BoxLayout, there are three possible constraints when adding component to this layout - FIX, FLEXIBLE and VARY.
JideSplitPane.
| Field Summary | |
|---|---|
protected int |
_axis
Axis, 0 for horizontal, or 1 for vertical. |
protected int[] |
_componentSizes
|
protected Container |
_target
|
static String |
FIX
For FIX component, the width (or height if vertical) is and will always be the preferred width. |
static String |
FLEXIBLE
FLEXIBLE components try to keep the preferred width. |
static int |
LINE_AXIS
Specifies that components should be laid out in the direction of a line of text as determined by the target container's ComponentOrientation property. |
static int |
PAGE_AXIS
Specifies that components should be laid out in the direction that lines flow across a page as determined by the target container's ComponentOrientation property. |
static String |
VARY
For VARY component, the width will always be whatever width left. |
static int |
X_AXIS
Specifies that components should be laid out left to right. |
static int |
Y_AXIS
Specifies that components should be laid out top to bottom. |
| Constructor Summary | |
|---|---|
JideBoxLayout(Container target)
Creates a layout manager that will lay out components along the given axis. |
|
JideBoxLayout(Container target,
int axis)
|
|
JideBoxLayout(Container target,
int axis,
int gap)
|
|
| Method Summary | |
|---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
Adds the specified component to the layout, using the specified constraint object. |
void |
addLayoutComponent(String name,
Component component)
If the layout manager uses a per-component string, adds the component comp to the layout,
associating it with the string specified by name. |
protected boolean |
calculateComponentSizes(int availableSize,
int startIndex,
int endIndex)
|
protected boolean |
componentCountChanged(Container c)
|
protected int |
getAvailableSize(Dimension containerSize,
Insets insets)
Returns the available width based on the container size and Insets. |
int |
getAxis()
Gets the axis. |
Map<Component,Object> |
getConstraintMap()
Gets the map of constraints. |
int |
getGap()
Gets the gap between each component. |
protected int |
getInitialLocation(Insets insets)
Returns the left inset, unless the Insets are null in which case 0 is returned. |
float |
getLayoutAlignmentX(Container target)
Returns the alignment along the x axis. |
float |
getLayoutAlignmentY(Container target)
Returns the alignment along the y axis. |
protected Dimension |
getPreferredSizeOf(Component comp,
int atIndex)
|
protected int |
getPreferredSizeOfComponent(Component c)
Returns the width of the passed in Components preferred size. |
protected int |
getSizeOfComponent(Component c)
Returns the width of the passed in component. |
void |
invalidateLayout(Container c)
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded. |
boolean |
isAlwaysLayout()
Checks if the alwaysLayout flag is true. |
boolean |
isResetWhenInvalidate()
Checks of the layout should be reset when invalidateLayout(java.awt.Container) is called. |
void |
layoutContainer(Container container)
Lays out the specified container. |
Dimension |
maximumLayoutSize(Container target)
Returns the maximum layout size, which is Integer.MAX_VALUE in both directions. |
Dimension |
minimumLayoutSize(Container container)
Returns the minimum size needed to contain the children. |
Dimension |
preferredLayoutSize(Container container)
Returns the preferred size needed to contain the children. |
void |
removeLayoutComponent(Component comp)
Removes the specified component from the layout. |
protected static int |
resolveAxis(int axis,
ComponentOrientation o)
Given one of the 4 axis values, resolve it to an absolute axis. |
void |
setAlwaysLayout(boolean alwaysLayout)
Sets the alwaysLayout flag. |
void |
setAxis(int axis)
Sets the axis. |
protected void |
setComponentToSize(Component c,
int size,
int location,
Insets insets,
Dimension containerSize)
Sets the width of the component c to be size, placing its x location at location, y to the insets.top and height to the containersize.height less the top and bottom insets. |
void |
setGap(int gap)
Sets the gap between each component. |
void |
setResetWhenInvalidate(boolean resetWhenInvalidate)
Sets the flag if the layout should be reset when invalidateLayout(java.awt.Container) is called. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int _axis
protected Container _target
protected int[] _componentSizes
public static final String FIX
public static final String FLEXIBLE
public static final String VARY
public static final int X_AXIS
public static final int Y_AXIS
public static final int LINE_AXIS
ComponentOrientation property.
public static final int PAGE_AXIS
ComponentOrientation property.
| Constructor Detail |
|---|
public JideBoxLayout(Container target)
target - the container that needs to be laid out
AWTError - if the value of axis is invalid
public JideBoxLayout(Container target,
int axis)
target - the container that needs to be laid outaxis - the axis to lay out components along. Can be one of: JideBoxLayout.X_AXIS,
JideBoxLayout.Y_AXIS, JideBoxLayout.LINE_AXIS or
JideBoxLayout.PAGE_AXIS
public JideBoxLayout(Container target,
int axis,
int gap)
target - the container that needs to be laid outaxis - the axis to lay out components along. Can be one of: JideBoxLayout.X_AXIS,
JideBoxLayout.Y_AXIS, JideBoxLayout.LINE_AXIS or
JideBoxLayout.PAGE_AXISgap - the gap| Method Detail |
|---|
public void layoutContainer(Container container)
layoutContainer in interface LayoutManagercontainer - the container to be laid out
protected boolean calculateComponentSizes(int availableSize,
int startIndex,
int endIndex)
public void addLayoutComponent(String name,
Component component)
comp to the layout,
associating it with the string specified by name.
addLayoutComponent in interface LayoutManagername - the string to be associated with the componentcomponent - the component to be addedpublic Dimension minimumLayoutSize(Container container)
minimumLayoutSize in interface LayoutManagerpublic Dimension preferredLayoutSize(Container container)
preferredLayoutSize in interface LayoutManagerpublic void removeLayoutComponent(Component comp)
removeLayoutComponent in interface LayoutManagercomp - the component to be removed
public void addLayoutComponent(Component comp,
Object constraints)
addLayoutComponent in interface LayoutManager2comp - the component to be addedconstraints - where/how the component is added to the layout.public float getLayoutAlignmentX(Container target)
getLayoutAlignmentX in interface LayoutManager2public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY in interface LayoutManager2public void invalidateLayout(Container c)
invalidateLayout in interface LayoutManager2protected boolean componentCountChanged(Container c)
public Dimension maximumLayoutSize(Container target)
maximumLayoutSize in interface LayoutManager2protected int getPreferredSizeOfComponent(Component c)
c - the component
protected int getSizeOfComponent(Component c)
c - the component
protected int getAvailableSize(Dimension containerSize,
Insets insets)
containerSize - the size of the containerinsets - the insets
protected int getInitialLocation(Insets insets)
insets - the insets
protected void setComponentToSize(Component c,
int size,
int location,
Insets insets,
Dimension containerSize)
c - the componentsize - the size of the componentlocation - the location of the componentinsets - the insets of the componentcontainerSize - the size of the containerpublic Map<Component,Object> getConstraintMap()
protected static int resolveAxis(int axis,
ComponentOrientation o)
axis - the axis to resolveo - the ComponentOrientation to resolve against
public int getGap()
public void setGap(int gap)
gap - the gap
protected Dimension getPreferredSizeOf(Component comp,
int atIndex)
public boolean isResetWhenInvalidate()
invalidateLayout(java.awt.Container) is called.
public void setResetWhenInvalidate(boolean resetWhenInvalidate)
invalidateLayout(java.awt.Container) is called.
resetWhenInvalidate - the flagpublic int getAxis()
public void setAxis(int axis)
axis - the new axis.public boolean isAlwaysLayout()
public void setAlwaysLayout(boolean alwaysLayout)
alwaysLayout - true to always layout components even there is no way to satisfy the minimum size
requirements from all FIXED components.
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||