GEF source code analysis (2) simulate GEF design ideas and dissect GEF 1

Source: Internet
Author: User

GEFStudy Notes (2) SimulationGEFDesign Concept, anatomyGEF 1

 

GEFLike otherFrameworkSimilarly, it is a complex and huge (exaggerated). When we want to use it, we must fully understand its overall architecture and its operation process. This requires our perseverance and acumen. Journey started....

 

GEFThe main task is2dGraphic editing operations, such.

 

 

to make GEF can be widely used in a wide variety of 2D graphic editing field, GEF / easy combination / reusable MVC framework (of course, this method of decomposing and refining functional objects can be used in other places, other fields and other languages such as C # on ).

 

 

 

If you design This Strict MVC Framework ( For Model Is strictly independent, it does not depend on View And Controller) And This framework How To Easy to expand / Easy combination / Easy to use . Below I will follow my own bad ideas to see the sparrow's eye The ambition of Hongyan

 

ForMVCMedium

View part: GEF naturally use your own stuff draw2d . draw2d figuer as your own View .

ModelPart:It often contains wide-ranging and unpredictable business information. Therefore,GEFThe framework should minimize the constraints (the constraints will be described in detail below ).

Controller Part: Editpart/draw2d Of Figure/Model The three tree object models are Editpart The corresponding Draw2d Of Figure/Model Node Establish a one-to-one association.

 

The architecture is as follows:

 

 

 

 

 

 

Thoughts:

controller same View what about tree structures?

when controller in a tree, this facilitates functional breakdown (this is a bit like in class design composite over inheritance General)

the controller ( that is editpart) handle only

    • logical functions
    • Management Sub controller
    • notify parent if necessary controller

Especially when you need to edit the interface on the GUI, you need to use a varietyUIBehavior rule2dElements (such as different shape blocks and connections with different behaviors) are combined to complete the work (for example, similarVisioSuch an interface), the advantages of this architecture are undoubtedly exposed.

 

To be continued.... (The following describes how to generate the preceding three tree models..)

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.