public class IlvLegendLayout extends Object implements Serializable, IlvServerSideLayout
LayoutManager
class that arranges legend items. Depending on
the legend position, this layout manager delegates the layout task to child
layout managers.
The default layout policy is:
IlvChart
, items are laid out as a grid, whose columns and
rows are automatically computed to display all the legend items.IlvChart
, legend items are laid out as a vertical flow, the
column number of the flow being computed so that all items are visible.IlvChart
, items are
laid out vertically as a one-column grid.
LayoutManager
instances of your choices by means of the corresponding factory methods.createNorthSouthLayout()
,
createEastWestLayout()
,
createFloatingLayout()
,
createDefaultLayout()
,
Serialized FormBOUNDS_PROPERTY
Constructor and Description |
---|
IlvLegendLayout(IlvLegend legend)
Creates a new
IlvLegendLayout attached to the
specified legend with default gap values of 5. |
IlvLegendLayout(IlvLegend legend,
int hgap,
int vgap)
Creates a new
IlvLegendLayout attached to the
specified legend with the specified gaps. |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(String str,
Component component)
Adds the specified component to the layout, using the specified
constraint.
|
void |
clearCaches()
Clears the caches of the layout delegates.
|
Map<Component,Rectangle> |
computeBounds(Container target,
Rectangle rect)
Returns a
Map of components bounding boxes expressed as Rectangle s. |
protected LayoutManager |
createDefaultLayout()
Creates the
LayoutManager instance used to lay out a
legend that has not been added to a chart. |
protected LayoutManager |
createEastWestLayout()
Creates the
LayoutManager instance used to lay out a
legend that has been docked on the east or the west side of a chart. |
protected LayoutManager |
createFloatingLayout()
Creates the
LayoutManager instance used to lay out
a floating legend. |
protected LayoutManager |
createNorthSouthLayout()
Creates the layout manager instance used to lay out a legend that has
been docked on the north or the south side of a chart.
|
protected LayoutManager |
getDefaultLayout()
Returns the
LayoutManager instance used to lay out a
legend that has not been added to a chart. |
protected LayoutManager |
getDelegate() |
protected LayoutManager |
getEastWestLayout()
Returns the
LayoutManager instance used to lay out
a legend that has been docked on the east or the west side of a chart. |
protected LayoutManager |
getFloatingLayout()
Returns the
LayoutManager instance used to lay out
a floating legend. |
int |
getFloatingLayoutDirection()
Returns the flow direction of the floating layout.
|
int |
getHGap()
Returns the horizontal gap.
|
int |
getHorizontalOrientation()
Returns the orientation used by a horizontal layout.
|
IlvLegend |
getLegend()
Returns the legend associates with this layout.
|
protected LayoutManager |
getNorthSouthLayout()
Returns the
LayoutManager instance used to lay out a
legend that has been docked on the north or the south side of a chart. |
int |
getVerticalOrientation()
Returns the orientation used by a vertical layout.
|
int |
getVGap()
Returns the vertical gap.
|
void |
layoutContainer(Container target)
Lays out the container.
|
Dimension |
minimumLayoutSize(Container target)
Returns the minimum size needed to lay out the target container.
|
Dimension |
preferredLayoutSize(Container target)
Returns the preferred layout size of the container argument using this
grid layout.
|
void |
removeLayoutComponent(Component component)
Removes the specified component from this layout.
|
void |
setFloatingLayoutDirection(int direction)
Sets the flow direction of the floating layout.
|
void |
setHGap(int hgap)
Sets the horizontal gap.
|
void |
setHorizontalOrientation(int orientation)
Sets the orientation used by a horizontal layout.
|
void |
setVerticalOrientation(int orientation)
Sets the orientation used by a vertical layout.
|
void |
setVGap(int vgap)
Sets the vertical gap.
|
public IlvLegendLayout(IlvLegend legend)
IlvLegendLayout
attached to the
specified legend with default gap values of 5.public IlvLegendLayout(IlvLegend legend, int hgap, int vgap)
IlvLegendLayout
attached to the
specified legend with the specified gaps.public IlvLegend getLegend()
public void clearCaches()
This method should be called whenever a parameter is changed that is used
by one of the factory methods createNorthSouthLayout()
,
createEastWestLayout()
, createFloatingLayout()
,
createDefaultLayout()
.
public final int getFloatingLayoutDirection()
setFloatingLayoutDirection(int)
public void setFloatingLayoutDirection(int direction)
direction
- The direction of the flow. One of the SwingConstants.HORIZONTAL
or SwingConstants.VERTICAL
constants.public final int getHorizontalOrientation()
setHorizontalOrientation(int)
public void setHorizontalOrientation(int orientation)
orientation
- The direction in which the items are layed out.
One of the constants
SwingConstants.TRAILING
(meaning the usual writing direction)
and SwingConstants.LEADING
(meaning the opposite direction).getHorizontalOrientation()
public final int getVerticalOrientation()
setVerticalOrientation(int)
public void setVerticalOrientation(int orientation)
orientation
- The direction in which the items are layed out.
One of the constants
SwingConstants.BOTTOM
(meaning down from top to bottom)
and SwingConstants.TOP
(meaning up from bottom to top).getVerticalOrientation()
public int getHGap()
public void setHGap(int hgap)
public int getVGap()
public void setVGap(int vgap)
protected LayoutManager getDefaultLayout()
LayoutManager
instance used to lay out a
legend that has not been added to a chart.createDefaultLayout()
protected LayoutManager createDefaultLayout()
LayoutManager
instance used to lay out a
legend that has not been added to a chart. The default implementation
creates a GridLayout
instance initialized with 1 column and
0 rows.protected LayoutManager getNorthSouthLayout()
LayoutManager
instance used to lay out a
legend that has been docked on the north or the south side of a chart.createNorthSouthLayout()
protected LayoutManager createNorthSouthLayout()
GridLayout
.protected LayoutManager getEastWestLayout()
LayoutManager
instance used to lay out
a legend that has been docked on the east or the west side of a chart.createEastWestLayout()
protected LayoutManager createEastWestLayout()
LayoutManager
instance used to lay out a
legend that has been docked on the east or the west side of a chart.
The default implementation returns an IlvVerticalFlowLayout
instance.protected LayoutManager getFloatingLayout()
LayoutManager
instance used to lay out
a floating legend.createFloatingLayout()
protected LayoutManager createFloatingLayout()
LayoutManager
instance used to lay out
a floating legend. The default implementation returns a
GridLayout
instance initialized with 1 column and 0 rows.protected final LayoutManager getDelegate()
public void layoutContainer(Container target)
layoutContainer
in interface LayoutManager
target
- The container to lay out.public Dimension preferredLayoutSize(Container target)
preferredLayoutSize
in interface LayoutManager
target
- The component to lay out.public Dimension minimumLayoutSize(Container target)
minimumLayoutSize
in interface LayoutManager
target
- The component to lay out.public void addLayoutComponent(String str, Component component)
addLayoutComponent
in interface LayoutManager
public void removeLayoutComponent(Component component)
removeLayoutComponent
in interface LayoutManager
public Map<Component,Rectangle> computeBounds(Container target, Rectangle rect)
IlvServerSideLayout
Map
of components bounding boxes expressed as Rectangle
s.computeBounds
in interface IlvServerSideLayout
target
- The container of components.rect
- The overall bounding rectangle.Map
of bounding boxes.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.