3 - Elements
4 - Model
The graphics fires standard events in order to let applications react to change. The concepts used for event handler support in ScheduleJS are the same as the ones found in standard Angular.
Activity events are fired whenever the user deletes or edits an activity. To receive an activity event simply subscribe to an observable with graphics via the subscribe method.
The subscribe method is inherited from base components like DefaultScheduleGanttComponentBase or TransactionalAbstractComponent
If you need to register more than one handler for a specific event type then use this approach:
The following table lists all supported activity event types and the convenience setter methods of the graphics. These methods are used to quickly register an event handler for the given event type.
Fired whenever the user deletes an activity via the backspace key.
The parent event type of all activity changes. Can be used to to receive a notification for any kind of activity change.
Fired whenever an activity change has started, is ongoing, or has finished.
Fired whenever the user has started editing, is in the process of editing, or has finished editing the "high" value of a high / low chart activity.
Fired whenever the user has started editing, is in the process of editing, or has finished editing the "low" value of a high / low chart activity.
Fired whenever the user has started editing, is in the process of editing, or has finished editing a chart value of a chart activity.
Fired whenever the user has started dragging, is in the process of dragging, or has finished dragging an activity via drag & drop. This event type is used when the user can freely move the activity around, vertically and horizontally.
Fired whenever the user has started changing, is in the process of changing, or has finished changing the end time of an activity.
Fired whenever the user has started changing, is in the process of changing, or has finished changing the time interval (start and end time) of an activity. Changing this time interval makes the activity move horizontally, either to the right (future) or the left (past).
Fired whenever the user has started changing, is in the process of changing, or has finished changing the "percentage complete" value of an activity.
Fired whenever the user has started changing, is in the process of changing, or has finished changing the start time of an activity.
|Fired whenever the user has started dragging, is in the process of dragging, or has finished dragging an activity via platform-provided drag & drop. This event type is used when the user can only drag the activity vertically (reassign an activity to a different row).|
The event types defined in the ActivityEvent class are defining an event hierarchy. All events are input events (InputEvent.ANY) and they change the activity. Some of them get fired when the user starts the change, some while the change is ongoing, and some when the change is finished.
ACTIVITY_CHANGE_STARTED // All event types that signals "start"
ACTIVITY_CHANGE_ONGOING // All event types that signals "ongoing"
ACTIVITY_CHANGE_FINISHED // All event types that signals "finished"
Applications are obviously interested in the attributes of an Activity. Not only the new values of these attributes (for example the new start time) but also the old values (start time before the change). The new values are already available on the activity as they are being set while the user performs the change. The old values are stored on the event object. The following table lists the methods on ActivityEvent to retrieve these values.
The different old values are filled in according to the type of actions.
Returns the old start or end time of the activity.
Returns the old start and end time of the activity.
Returns the old row where the activity was located before.
Returns the old value of "percentage complete" or "chart value".
The user can use a lasso to select activities by pressing the ALT key. Events are fired when this happens. To receive a lasso event simply register an event handler on graphics via one of the convenience methods.
The following table lists the event types and the convenience setter methods of graphics.
Any lasso operation (start, ongoing, finished).
The user has pressed the mouse button and started a drag. The lasso has become visible.
The user is changing the size of the lasso.
|The user has finished the lasso selection. The lasso is no longer visible.|
The lasso automatically performs selections of activities but sometimes we might want to know more about the exact nature of this selection or we want to use the lasso for another use case (e.g. for creating new activities). For this reason instances of LassoEvent also provide an object of type LassoInfo, which carries many attributes that the application can use to react accordingly. The lasso information can be retrieved by calling event.getInfo(). The following table lists the attributes of LassoInfo.
You can subscribe multiple callbacks to the lasso using the Angular Observable in any TrasactionalAbstractComponent (with DefaultScheduleGanttComponentBase for example) like this:
Returns all activities that were selected by the lasso.
Returns the start and end time of the lasso according to the location of the left and right edge of the lasso.
Returns the rows that were touched by the lasso.
Returns the current row pointed by the mouse.
|Returns the pointer event.|