public class IlvActivitySimpleLayout extends Object implements IlvActivityLayout
IlvSimpleActivityLayout is a basic implementation of IlvActivityLayout that arranges all activity graphics in a row to the full height of
the row, minus some vertical margins. This activity layout does not establish any
specific drawing z-order for the graphics. Therefore, if you have concurrent tasks in a
Gantt row, they will overlap.
Being simple and fast, this layout strategy is suitable to arrange activity graphics in an activity oriented Gantt chart.
| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_VERTICAL_MARGIN
The default vertical margins of
2. |
| Constructor and Description |
|---|
IlvActivitySimpleLayout()
Creates an
IlvActivitySimpleLayout with default top and bottom row
margins of 2. |
IlvActivitySimpleLayout(double topMargin,
double bottomMargin)
Creates an
IlvActivitySimpleLayout with the specified vertical row
margins. |
| Modifier and Type | Method and Description |
|---|---|
void |
arrange(IlvGanttRow row,
IlvActivityGraphic graphic)
This method is called to layout the position of a single activity graphic within a
row.
|
void |
arrange(IlvGanttRow row,
IlvActivityGraphic[] graphics)
This method is called to layout the position of all the activity graphics within a
row.
|
double |
getBottomMargin()
Returns the bottom row margin of the activity layout.
|
protected IlvRect |
getChannelVerticalBounds(IlvGanttRow row)
Returns the vertical bounds of the specified row available for arranging its activity
graphics.
|
double |
getTopMargin()
Returns the top row margin of the activity layout.
|
void |
setBottomMargin(double bottomMargin)
Sets the bottom row margin of the activity layout.
|
void |
setTopMargin(double topMargin)
Sets the top row margin of the activity layout.
|
public static final double DEFAULT_VERTICAL_MARGIN
2.public IlvActivitySimpleLayout(double topMargin,
double bottomMargin)
IlvActivitySimpleLayout with the specified vertical row
margins.topMargin - The top row margin.bottomMargin - The bottom row margin.public IlvActivitySimpleLayout()
IlvActivitySimpleLayout with default top and bottom row
margins of 2.public void arrange(IlvGanttRow row, IlvActivityGraphic[] graphics)
This method is called to layout the position of all the activity graphics within a row. This implementation arranges the activity graphics to the full height of the row, minus the top margin and the bottom margin. This activity layout does not establish any specific drawing z-order for the graphics.
If you want to implement a z-ordering strategy, you can override this method like this:
public void arrange(IlvGanttRow row, IlvActivityGraphic[] graphics) {
// Set the definition rectangle of each activity graphic.
super.arrange(row, graphics);
// Set the graphics z-order to match that of the activity start times.
Arrays.sort(graphics, new Comparator<IlvActivityGraphic>() {
public int compare(IlvActivityGraphic o1, IlvActivityGraphic o2) {
Date start1 = o1.getActivity().getStartTime();
Date start2 = o2.getActivity().getStartTime();
return start1.compareTo(start2);
}
});
}
arrange in interface IlvActivityLayoutrow - The Gantt row that contains the graphics.graphics - The array of activity graphics in the row. The ordering of the
graphics in the array indicates the z-order in which the activity
graphics draw. Graphics at a higher index in the array are drawn
after graphics at a lower index. This method can rearrange the
graphics within the array to change their drawing order.public void arrange(IlvGanttRow row, IlvActivityGraphic graphic)
This method is called to layout the position of a single activity graphic within a
row. Typically, this occurs when an activity has been newly inserted into or assigned
to an already existing row. This activity layout does not establish any specific
drawing z-order for the graphics. If you want to implement a z-ordering strategy, you
should implement the draw ordering in the arrange(IlvGanttRow,
IlvActivityGraphic[]) method. Then override this method to delegate like this:
public void arrange(IlvGanttRow row, IlvActivityGraphic graphic) {
// Relayout the entire row so that z-ordering is respected between all graphics.
arrange(row, row.getActivityGraphics());
}
arrange in interface IlvActivityLayoutrow - The Gantt row that contains the graphic.graphic - The activity graphic to be arranged.public double getTopMargin()
public void setTopMargin(double topMargin)
topMargin - The top margin.public double getBottomMargin()
public void setBottomMargin(double bottomMargin)
bottomMargin - The bottom margin.protected IlvRect getChannelVerticalBounds(IlvGanttRow row)
row - The Gantt row.y and height fields of the
rectangle. The x axis dimension of the rectangle can be ignored.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.