|| | |||Browse by category|
How to vertically position an activity inside a row?
The activities placement in a Gantt row is managed by an IlvActivityLayout set on its IlvGanttRow. The base implementation of this interface being the
IlvActivitySimpleLayout class on which all of the other activity layouts do rely.
The base height of the activities inside a row is managed by this
IlvActivitySimpleLayout class. Depending on the behavior that is required, here are different solutions:
- If the activities have to be sized proportionally to the height of the row, use the
IlvActivitySimpleLayoutclass and more specifically the
IlvActivitySimpleLayout.setBottomMargin(float)methods of the layout. By setting this layout on the sheet or row, the margins are now interpreted as a fraction of the row height and changing the size of the margins will change the height of the activities.
For example, setting a top and bottom margins of "0.2" will make the activities to take 60% of the row height.
- Other behaviors are implemented in the
IlvActivitySimpleLayoutsubclasses provided with the API (please refer the Java documentation for better reference to the
- If a more complex behavior is required to manage the height of the activities, subclass the class
IlvActivitySimpleLayoutand override the methods
IlvActivityLayout.arrange(...). There are two methods
arrange: one is called to layout the position of a single graphic of an activity within a row, whereas the second one is called to layout the position of all the graphics of the activities within a row.
The sample that has been attached below is displaying an
IlvScheduleChart and four activities. The height of the activities one and three have been resized thanks to the method
IlvActivitySimpleLayout.arrange(IlvGanttRow, IlvActivityGraphic) that has been overloaded.
Note: In order to run this sample with JViews 8.7 and later, you must call the ilog.views.util.IlvProductUtil.DeploymentLicenseRequired method with the appropriate argument (uncomment line 116 of Main.java). See the General information > Deployment licenses > Declaring the use of IBM ILOG JViews services section in the documentation for more information.