Disable movements and other interactions of reservations on an IlvScheduleChart or activities on an IlvGanttChart

Article ID: 2224
Last updated: 29 May, 2018
Article ID: 2224
Last updated: 29 May, 2018
Revision: 3
Views: 667
Posted: 02 Jun, 2010
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How can I disable movements and other interactions of reservations on an IlvScheduleChart or activities on an IlvGanttChart?

Answer

Each IlvHierarchyChart contains an IlvGanttSheet that is responsible for displaying the activities, constraints, and reservations as well as handling the interactions/events on the view. You can obtain the Gantt sheet instance by calling the getGanttSheet() method of the chart. You can then disable all user-interactions on the Gantt sheet by calling its removeAllInteractors() method (this method is defined at the IlvManagerView class level).

For example:

IlvHierarchyChart myChart = ... (a gantt or schedule chart) ...
myChart.getGanttSheet().removeAllInteractors();

If instead you want to preserve interactive selection of activities within the Gantt sheet, but disable moving, resizing, and reservation copying, you can customize the selection interactor like this:

IlvGanttSelectInteractor selectInteractor = new IlvGanttSelectInteractor();
selectInteractor.setMoveAllowed(false); // prevents moving activities
selectInteractor.setEditionAllowed(false); // prevents resizing activities
selectInteractor.setDuplicationAllowed(false); // prevents copying reservations in a Schedule chart
myChart.getGanttSheet().setInteractor(selectInteractor);

If you want to manage the interactions independently on specific activities within the Gantt sheet, you can set the selectable, movable, and editable properties of the IlvActivityGraphic within the Gantt sheet's IlvManager. Note, that the Gantt sheet is a type of IlvManagerView. The selectable property of a graphic controls whether it can be selected, the movable property controls whether it can be interactively dragged or moved, and the editable property controls whether the graphic can be interactively resized or reshaped.

If you want to control the editability of individual activities based upon the value of one of their properties, here is a general outline:

  1. Before any Gantt data model is bound to the chart, register a ManagerContentChangedListener on the manager of the Gantt sheet and an ActivityListener on the data model.
  2. In the event handler, watch for when IlvActivityGraphics are added to the sheet and when the relevant property value changes.
  3. At this point, update the activity graphic's editable property by calling ganttSheet.getManager().setEditable(activityGraphic, ...)

See the attached sample, at the bottom of thsi page, that illustrates how to allow only activities whose names begin with the letters A-M to be edited (check the creation of the ActivityNameFilter).

You can also disable editing within the table by removing the cell editor from each of its columns like this:

IlvJTable table = myChart.getTable();

for (int i = 0; i < table.getColumnCount(); i++) {
table.getColumn(i).setCellEditor(null);
}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2224
Last updated: 29 May, 2018
Revision: 3
Views: 667
Posted: 02 Jun, 2010 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Attached files

Also listed in


Others in this category