For many scheduling projects it is very useful to display multiple entries onto a single row, the usage of this
is typically for the work-scheduling where the resource appears on the left hand-side and the resources allocation is measured on the right in the form of tasks:
In the example shown above we randomly generate the colours of the entires and create the entry with the GanttDrawingPartHelper class.
The usage of this class is more complex than the GanttEntryHelper the basic operation is:
helper.createDrawingState - Create the holder for the parts
helper.createDrawingPart - Create the holder for the entries
helper.createActivityEntry - Create the Entries one by one and add them to the part
drawingState.addPart - Add the part back to the state
The code behind each row is the following:
private DrawingState createDrawingState(int start, int finish, int segments){
BasicDrawingState state = GanttDrawingPartHelper.createDrawingState();int offset;{int range = finish - start;
offset = range /Math.max(segments, 1);}Random random =newRandom();
ListDrawingPart part = GanttDrawingPartHelper.createDrawingPart();for(int i=start; i < finish; i+=offset ){String context ="";switch(random.nextInt(3)){case0: context = GradientColorModule.BLUE_GRADIENT_CONTEXT;break;case1: context = GradientColorModule.RED_GRADIENT_CONTEXT;break;case2: context = GradientColorModule.PINK_GRADIENT_CONTEXT;break;default:
context = GradientColorModule.GREEN_GRADIENT_CONTEXT;}
GanttDrawingPartHelper.createActivityEntry(newObject(), newDate(i), newDate(i + offset), context, part);}
state.addDrawingPart(part);return state;}
The same technique can be used for adding text labels to appear ontop of the entries. In which case you would create two DrawingParts one for the DrawingLayer and the other for the TextLayer.
Multiple Entries
For many scheduling projects it is very useful to display multiple entries onto a single row, the usage of thisis typically for the work-scheduling where the resource appears on the left hand-side and the resources allocation is measured on the right in the form of tasks:
In the example shown above we randomly generate the colours of the entires and create the entry with the GanttDrawingPartHelper class.
The usage of this class is more complex than the GanttEntryHelper the basic operation is:
The code behind each row is the following:
The same technique can be used for adding text labels to appear ontop of the entries. In which case you would create two DrawingParts one for the DrawingLayer and the other for the TextLayer.
see example below: