|
|
Re: Swing PlannerField [message #1471625 is a reply to message #1456452] |
Thu, 13 November 2014 08:14 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Let start with a personal opinion about the planner field: it was developed for some custom needs of a commercial product at BSI. The API is not really intuitive and wasn't updated (still array based ...). There is no SDK support. It is only available in the Swing UI. Maybe it should have stayed as a custom-field of this commercial application and not land into the eclipse scout framework.
If you think it can suit your need (which are really specific), here some inputs to start to use the field.
Example:
The Grid displays a set of ActivityCells. Each ActivityCell contains:
* resourceId (Generic Type: RI)
* activityId (Generic Type: AI)
* startTime (Date)
* endTime (Date)
* text (String)
* tooltipText (String)
* iconId (String)
* majorValue (float)
* minorValue (float)
Resources are listed in the Table: ResourceTable an inner-class of the planner field.
* This Table contains a column (primary key, same type of RI) to store the resourceId.
* And additional columns (Name and Detail in this case).
To populate the table, add some logic in YourPlannerField.execLoadResourceTableData(). Return an array Object[][] that will some data for the RessourceTable.
To populate initial data in the field, add some logic in the method: YourPlannerField.execLoadActivityMapData(..) The method should return a bi dimensional array: Object[][]: first dimension is the quantity of ActivityCells you want to display. Second dimension is 9: it corresponds to the properties of the ActivityCell (resourceId, activityId, startTime, endTime, text, tooltipText, iconId, majorValue, minorValue)
To initialize the field, you need to compute an array of the days you want to be displayed (if you chose to display a calendar getConfiguredMiniCalendarCount() > 0. The user will be able to change the selected days).
Date d = DateUtility.parse("2014-11-01", "yyyy-MM-dd");
Date[] days = new Date[30];
for (int i = 0; i < days.length; i++) {
days[i] = DateUtility.addDays(d, i);
}
getActivityMap().setDays(days);
This code can be set in execInitField(). In this method, you can set the PlanningMode. You should also call: loadResourceTableData();
Menus:
There are two types of menus that you can put in the activity map.
ActivityMapMenuType.Activity
This type of menu is displayed when an ActivityCell is selected (Delete menu in this example):
You can access the selected activity cell with getSelectedActivityCell()
ActivityMapMenuType.Selection
This type of menu is displayed when a selection is made in the grid (Create menu in this example)
You can access the selection with the methods: getSelectedResourceIds(), getSelectedBeginTime(), getSelectedEndTime()
The code I have used for this example is hosted in this Gist.
I hope it help you to start. Do not hesitate to continue the discussion... (There are more features - I do not know what you need).
|
|
|
|
Powered by
FUDForum. Page generated in 0.02926 seconds