Understanding sunflower Gantt's 4-sfdata Design

Source: Internet
Author: User
In the previous chapters, we have introduced in detail how to provide data to sfdata of the sunflower Gantt chart. Now we need to understand, what operations can we do with sfdata after we provide data to sfdata through the data adapter? In other words, how does sfdata use the data and provide what functions? Before that, let's take a look at the class structure of the entire sunflower Gantt Data System: From this figure, we can see that sfdata (including four entity objects) is indeed the core of the Gantt data system, adapter (blue part) is to provide data to sfdata, and the data component (green part) is to extend the function to sfdata, both of which are external calls (yellow part, including the operation of sfgantt Gantt Chart object on data) three independent parts, which are not directly associated with each other, are deployed by the sfdata object. We have already introduced operations between sfdata objects and adapters. Now let's take a look at the methods that sfdata provides for data components and external interfaces to call on the basis of accessing the data source through the adapter:
Functions and Methods Addcomponent (COMP) Add a data component
Method Type Method Name Method description
Functions and Methods Removecomponent (COMP) Remove a specified data component
Functions and Methods Depose () Destroys an object. Once called, NO content can be called again.
Get Data Getcalendar () Returns the calendar of work used by the current data.
Get Data Getroottask () Return root task
Get Data Gettaskbyuid (UID, force) Returns the task with the specified uid. If the force parameter is true, sfdata will read the task until all tasks are completed without finding the task.
Get Data Gettaskbyoutline (outline) Search for tasks by outline number
Get Data Comparetask (starttask, endtask) Compares the upper and lower positions of two tasks in the Task Tree.
Get Data Getrootresource () Returns the root resource.
Get Data Getresourcebyuid (UID, force) Returns the resource of the specified uid. If the force parameter is true, sfdata keeps reading the resource until all resources are read.
Get Data Getresourcebyoutline (outline) Search for resources by outline number
Get Data Compareresource (startresource, endresource) Compares the upper and lower positions of two resources in the Resource Tree.
Modify data Addtask (parent, ptask) Add a task
Modify data Deletetask (task) Delete a task
Modify data Movetask (task, ptask, pretask) Move a task
Modify data Addresource (parent, presource) Add a resource
Modify data Deleteresource (Resource) Delete A Resource
Modify data Moveresource (resource, presource, preresource) Move a resource
Modify data Addlink (suctask, pretask, type) Add a link
Modify data Deletelink (Link) Delete a link
Modify data Addassignment (task, resource, Unit) Add a resource allocation
Modify data Deleteassignment (assignment) Delete A Resource Allocation
Sfdata also provides many event support. The event list is shown below:
Event name Event Parameters Event Description
Taskregister Task Triggered when the task is initialized to read sfdata
Resourceregister Resource Triggered when the resource is initialized to read sfdata
Linkregister Link Triggered when the link is initialized to read sfdata
Assignmentregister Assignment Triggered when resource allocation is initialized and read to sfdata
Beforetaskchange Returnobj, task, name, Value Triggered before task attribute change
Aftertaskupdate Task, name, value, beforevalue Triggered after the task attribute is changed
Beforeresourcechange Returnobj, resource, name, Value Triggered before resource attribute change
Afterresourcechange Resource, name, value, beforevalue Triggered after the resource property is changed
Beforelinkchange Returnobj, Link, name, Value Triggered before link property change
Afterlinkchange Link, name, value, beforevalue Triggered after link property is changed
Beforeassignmentchange Returnobj, assignment, name, Value Triggered before Resource Allocation attribute change
Afterassignmentchange Assignment, name, value, beforevalue Triggered after the resource allocation attribute is changed
Beforetaskadd Returnobj, parent, ptask Triggered before creating a task
Aftertaskadd Newtask Triggered after a new task is created
Beforetaskdelete Returnobj, task Trigger before deleting a task
Aftertaskdelete Task, parent, PT Triggered after a task is deleted
Beforetaskmove Returnobj, task, ptask, pretask Triggered before a mobile task
Aftertaskmove Task, parenttask, previussibling Triggered after a mobile task
Beforeresourceadd Returnobj, parent, presource Triggered before creating a resource
Afterresourceadd Newresource Triggered after the resource is created
Beforeresourcedelete Returnobj, Resource Trigger before deleting a resource
Afterresourcedelete Resource, parent, PT Triggered after the resource is deleted
Beforeresourcemove Returnobj, resource, presource, preresource Triggered before a mobile resource
Afterresourcemove Resource, parentresource, previussibling Triggered after the resource is moved
Beforelinkadd Returnobj, suctask, pretask, Type Triggered before creating a link
Afterlinkadd Newlink Triggered after the new link
Beforelinkdelete Returnobj, Link Triggered before the link is deleted
Afterlinkdelete Link Triggered after the link is deleted
Beforeassignmentadd Returnobj, task, resource, Unit Triggered before new Resource Allocation
Afterassignmentdelete Newassignment Triggered after new Resource Allocation
Beforeassignmentdelete Returnobj, assignment Triggered before deleting Resource Allocation
Afterassignmentdelete Assignment Triggered after resource allocation is deleted

At the same time, sfdata provides some methods through four entities, which are not listed here. sfdata reads data through an adapter through a simple interface and encapsulates it into a variety of easy-to-use methods, the data component and the Gantt chart interface class do not need to care about the data source or whether the data is loaded through multipart loading. They only need to use these methods and events, you can achieve a variety of flexible functions. This is the design concept of sfdata.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.