ilog.views.gantt.graphic
Interface IlvActivityLayout

All Known Implementing Classes:
IlvActivityLogisticLayout, IlvActivitySimpleLayout, IlvActivityTileLayout

public interface IlvActivityLayout

An IlvActivityLayout defines a strategy for how activity graphics are arranged within an IlvGanttRow. An IlvActivityLayout object is used by an IlvGanttRow to compute the positions and z-order of its activity graphics. When you add an activity graphic object to a Gantt row, the activity layout is used to determine the position of the new inserted activity graphic. When you change the time interval of an activity, the activity layout is also used to readjust the position of the associated activity graphic.

Since:
JViews 6.0

Method Summary
 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.
 

Method Detail

arrange

void arrange(IlvGanttRow row,
             IlvActivityGraphic graphic)
This method is called to layout the position of a single activity graphic within a row. This method should set the definition rectangle of the activity graphic and optionally rearranges its drawing order.

Here is an example of how the activity layout should set the definition rectangle of the graphic and modify its drawing order:

 public void arrange(IlvGanttRow row, IlvActivityGraphic graphic) {
   IlvTimeConverter converter = row.getTimeConverter();
   if (converter == null)
     return;
   IlvActivity activity = graphic.getActivity();
   float start = (float)converter.getUnits(activity.getStartTime());
   float end = (float)converter.getUnits(activity.getEndTime());
   IlvRect defRect = new IlvRect(start, row.getTop(),
                                 end-start, row.getHeight());
   graphic.setDefinitionRect(defRect);
   // Move the graphic to the top of the z-order
   row.setActivityGraphicIndex(graphic, row.getActivityGraphicCount()-1);
 }
 

Parameters:
row - The Gantt row that contains the graphic.
graphic - The activity graphic to be arranged.

arrange

void arrange(IlvGanttRow row,
             IlvActivityGraphic[] graphics)
This method is called to layout the position of all the activity graphics within a row. This method should set the definition rectangle of each activity graphic and can optionally rearrange their drawing order.

The ordering of the graphics in the array indicates the z-order in which the activity graphics currently draw. Graphics at a higher index in the array are drawn after graphics at a lower index. This method can reorder the graphics in the array to change their z-order.

Here is an example of how the activity layout should set the definition rectangle of each graphic:

 public void arrange(IlvGanttRow row, IlvActivityGraphic[] graphics) {
   IlvTimeConverter converter = row.getTimeConverter();
   if (converter == null)
     return;
   for (int i = 0; i < graphics.length; i++) {
     IlvActivityGraphic graphic = graphics[i];
     IlvActivity activity = graphic.getActivity();
     float start = (float)converter.getUnits(activity.getStartTime());
     float end = (float)converter.getUnits(activity.getEndTime());
     IlvRect defRect = new IlvRect(start, row.getTop(),
                                   end-start, row.getHeight());
     graphic.setDefinitionRect(defRect);
   }
 }
 

Parameters:
row - 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 in the array to change their drawing order.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.