| java.lang.Object com.jidesoft.swing.JideBoxLayout
JideBoxLayout | public class JideBoxLayout implements LayoutManager2(Code) | | JideBoxLayout is very similar to BoxLayout in the way that all components
are arragned either from left to right or from top to bottom. Different \
from BoxLayout, there are three possible contraints when adding component
to this layout - FIX, FLEXIBLE and VARY.
- FIX: use the preferred size of the compoent and size is fixed
- FLEXIBLE: respect the preferred size of the compoennt but size can be changed.
- VARY: ignore preferred size. Its size is calculated based how much area left.
This is the default layout manager for
com.jidesoft.swing.JideSplitPane .
|
Field Summary | |
final public static String | FIX For FIX component, the width (or height if vertical) is and
will always be the preferred width. | final public static String | FLEXIBLE FLEXIBLE components try to keep the preferred width. | final public 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. | final public 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. | final public static String | VARY For VARY component, the width will always be whatever width left. | final public static int | X_AXIS Specifies that components should be laid out left to right. | final public static int | Y_AXIS Specifies that components should be laid out top to bottom. | protected int | _axis Axis, 0 for horizontal, or 1 for veritcal. | protected int[] | _componentSizes | protected Container | _target |
Constructor Summary | |
public | JideBoxLayout(Container target) Creates a layout manager that will lay out components along the
given axis. | public | JideBoxLayout(Container target, int axis) Parameters: target - the container that needs to be laid out Parameters: axis - the axis to lay out components along. | public | JideBoxLayout(Container target, int axis, int gap) Parameters: target - the container that needs to be laid out Parameters: axis - the axis to lay out components along. |
Method Summary | |
public 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 . | public void | addLayoutComponent(Component comp, Object constraints) Adds the specified component to the layout, using the specified
constraint object. | 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. | public Map<Component, Object> | getConstraintMap() Gets the map of constraints. | public 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. | public synchronized float | getLayoutAlignmentX(Container target) Returns the alignment along the x axis. | public synchronized float | getLayoutAlignmentY(Container target) Returns the alignment along the y axis. | int | getMinimumSizeOfComponent(Component c) Returns the width of the passed in Components minimum size. | protected Dimension | getPreferredSizeOf(Component comp, int atIndex) | protected int | getPreferredSizeOfComponent(Component c) Returns the width of the passed in Components preferred size. | int | getSizeForPrimaryAxis(Dimension size) If the axis == 0, the width is returned, otherwise the height. | int | getSizeForPrimaryAxis(Insets insets, boolean isTop) Returns a particular value of the inset identified by the
axis and isTop . | int | getSizeForSecondaryAxis(Dimension size) If the axis == X_AXIS, the width is returned, otherwise the height. | int | getSizeForSecondaryAxis(Insets insets, boolean isTop) Returns a particular value of the inset identified by the
axis and isTop . | protected int | getSizeOfComponent(Component c) Returns the width of the passed in component. | public synchronized void | invalidateLayout(Container c) Invalidates the layout, indicating that if the layout manager
has cached information it should be discarded. | public boolean | isResetWhenInvalidate() Checks of the layout should be reset when
JideBoxLayout.invalidateLayout(java.awt.Container) is called. | public void | layoutContainer(Container container) Lays out the specified container. | public Dimension | maximumLayoutSize(Container target) Returns the maximum layout size, which is Integer.MAX_VALUE
in both directions. | public Dimension | minimumLayoutSize(Container container) Returns the minimum size needed to contain the children. | public Dimension | preferredLayoutSize(Container container) Returns the preferred size needed to contain the children. | public 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.
The relative axis values, PAGE_AXIS and LINE_AXIS are converted
to their absolute couterpart given the target's ComponentOrientation
value. | 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. | public void | setGap(int gap) Sets the gap between each component. | public void | setResetWhenInvalidate(boolean resetWhenInvalidate) Sets the flag if the layout should be reset when
JideBoxLayout.invalidateLayout(java.awt.Container) is called. |
FIX | final public static String FIX(Code) | | For FIX component, the width (or height if vertical) is and
will always be the preferred width.
|
FLEXIBLE | final public static String FLEXIBLE(Code) | | FLEXIBLE components try to keep the preferred width. If
there isn't enough space, all FLEXIBLE components will shrink
proportionally.
|
LINE_AXIS | final public static int LINE_AXIS(Code) | | Specifies that components should be laid out in the direction of
a line of text as determined by the target container's
ComponentOrientation property.
|
PAGE_AXIS | final public static int PAGE_AXIS(Code) | | 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.
|
VARY | final public static String VARY(Code) | | For VARY component, the width will always be whatever width left.
You can allow add multiple FIX or FLEXIBLE components but only
one VARY component is allowed.
|
X_AXIS | final public static int X_AXIS(Code) | | Specifies that components should be laid out left to right.
|
Y_AXIS | final public static int Y_AXIS(Code) | | Specifies that components should be laid out top to bottom.
|
_axis | protected int _axis(Code) | | Axis, 0 for horizontal, or 1 for veritcal.
|
_componentSizes | protected int[] _componentSizes(Code) | | |
JideBoxLayout | public JideBoxLayout(Container target)(Code) | | Creates a layout manager that will lay out components along the
given axis.
Parameters: target - the container that needs to be laid out throws: AWTError - if the value of axis is invalid |
JideBoxLayout | public JideBoxLayout(Container target, int axis)(Code) | | Parameters: target - the container that needs to be laid out Parameters: axis - the axis to lay out components along. Can be one of:JideBoxLayout.X_AXIS ,JideBoxLayout.Y_AXIS ,JideBoxLayout.LINE_AXIS orJideBoxLayout.PAGE_AXIS |
JideBoxLayout | public JideBoxLayout(Container target, int axis, int gap)(Code) | | Parameters: target - the container that needs to be laid out Parameters: axis - the axis to lay out components along. Can be one of:JideBoxLayout.X_AXIS ,JideBoxLayout.Y_AXIS ,JideBoxLayout.LINE_AXIS orJideBoxLayout.PAGE_AXIS Parameters: gap - |
addLayoutComponent | public void addLayoutComponent(String name, Component component)(Code) | | If the layout manager uses a per-component string,
adds the component comp to the layout,
associating it
with the string specified by name .
Parameters: name - the string to be associated with the component Parameters: component - the component to be added |
addLayoutComponent | public void addLayoutComponent(Component comp, Object constraints)(Code) | | Adds the specified component to the layout, using the specified
constraint object.
Parameters: comp - the component to be added Parameters: constraints - where/how the component is added to the layout. |
calculateComponentSizes | protected boolean calculateComponentSizes(int availableSize, int startIndex, int endIndex)(Code) | | |
componentCountChanged | protected boolean componentCountChanged(Container c)(Code) | | |
getAvailableSize | protected int getAvailableSize(Dimension containerSize, Insets insets)(Code) | | Returns the available width based on the container size and
Insets.
|
getConstraintMap | public Map<Component, Object> getConstraintMap()(Code) | | Gets the map of constraints.
the map of constraints |
getGap | public int getGap()(Code) | | Gets the gap between each component.
the gap between each component. |
getInitialLocation | protected int getInitialLocation(Insets insets)(Code) | | Returns the left inset, unless the Insets are null in which case
0 is returned.
|
getLayoutAlignmentX | public synchronized float getLayoutAlignmentX(Container target)(Code) | | Returns the alignment along the x axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
|
getLayoutAlignmentY | public synchronized float getLayoutAlignmentY(Container target)(Code) | | Returns the alignment along the y axis. This specifies how
the component would like to be aligned relative to other
components. The value should be a number between 0 and 1
where 0 represents alignment along the origin, 1 is aligned
the furthest away from the origin, 0.5 is centered, etc.
|
getMinimumSizeOfComponent | int getMinimumSizeOfComponent(Component c)(Code) | | Returns the width of the passed in Components minimum size.
|
getPreferredSizeOfComponent | protected int getPreferredSizeOfComponent(Component c)(Code) | | Returns the width of the passed in Components preferred size.
|
getSizeForPrimaryAxis | int getSizeForPrimaryAxis(Dimension size)(Code) | | If the axis == 0, the width is returned, otherwise the height.
|
getSizeForPrimaryAxis | int getSizeForPrimaryAxis(Insets insets, boolean isTop)(Code) | | Returns a particular value of the inset identified by the
axis and isTop .
axis isTop
0 true - left
0 false - right
1 true - top
1 false - bottom
|
getSizeForSecondaryAxis | int getSizeForSecondaryAxis(Dimension size)(Code) | | If the axis == X_AXIS, the width is returned, otherwise the height.
|
getSizeForSecondaryAxis | int getSizeForSecondaryAxis(Insets insets, boolean isTop)(Code) | | Returns a particular value of the inset identified by the
axis and isTop .
axis isTop
0 true - left
0 false - right
1 true - top
1 false - bottom
|
getSizeOfComponent | protected int getSizeOfComponent(Component c)(Code) | | Returns the width of the passed in component.
|
invalidateLayout | public synchronized void invalidateLayout(Container c)(Code) | | Invalidates the layout, indicating that if the layout manager
has cached information it should be discarded.
|
layoutContainer | public void layoutContainer(Container container)(Code) | | Lays out the specified container.
Parameters: container - the container to be laid out |
maximumLayoutSize | public Dimension maximumLayoutSize(Container target)(Code) | | Returns the maximum layout size, which is Integer.MAX_VALUE
in both directions.
|
minimumLayoutSize | public Dimension minimumLayoutSize(Container container)(Code) | | Returns the minimum size needed to contain the children.
The width is the sum of all the childrens min widths and
the height is the largest of the childrens minimum heights.
|
preferredLayoutSize | public Dimension preferredLayoutSize(Container container)(Code) | | Returns the preferred size needed to contain the children.
The width is the
sum of all the childrens preferred widths and
the height is the largest of the childrens preferred heights.
|
removeLayoutComponent | public void removeLayoutComponent(Component comp)(Code) | | Removes the specified component from the layout.
Parameters: comp - the component to be removed |
resolveAxis | protected static int resolveAxis(int axis, ComponentOrientation o)(Code) | | Given one of the 4 axis values, resolve it to an absolute axis.
The relative axis values, PAGE_AXIS and LINE_AXIS are converted
to their absolute couterpart given the target's ComponentOrientation
value. The absolute axes, X_AXIS and Y_AXIS are returned unmodified.
Parameters: axis - the axis to resolve Parameters: o - the ComponentOrientation to resolve against the resolved axis |
setComponentToSize | protected void setComponentToSize(Component c, int size, int location, Insets insets, Dimension containerSize)(Code) | | 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.
|
setGap | public void setGap(int gap)(Code) | | Sets the gap between each component. Make sure you cal doLayout() after you change the gap.
Parameters: gap - |
|
|