[Eclipse] GEF Getting Started series (vii, Xylayout and expand/collapse features)

Source: Internet
Author: User

Previous posts have said how to use the layout, which was focused on Toolbarlayout and FlowLayout (collectively orderedlayout), and many applications use a layout that allows you to drag the child graph freely, called xylayout in GEF, And this kind of application will probably need to create some connecting lines between the graphs, such as the scene shown in the following picture. The presence of the connection increases the complexity of the model to some extent, and the refresh of the connector is also a concern of GEF, which focuses on the implementation of such applications, and specifically discusses the implementation of the expand/collapse (expand/collapse) feature.

Figure 1 Application using Xylayout

Or from the beginning of the model, when using Xylayout, the model corresponding to each child graph maintains its own coordinates and dimension information, which introduces some member variables that are unrelated to the actual business in the model. To solve this problem, we typically have all model elements that need to have these interface information inherited from an abstract class such as node, which provides variables such as point, dimension, and Getter/setter methods:

public class Node extends Element implements IPropertySource {
   protected Point location = new Point(0, 0);//位置
   protected Dimension size = new Dimension(100, 150);//尺寸
   protected String name = "Node";//标签
   protected List outputs = new ArrayList(5);//节点作为起点的连接
   protected List inputs = new ArrayList(5);//节点作为终点的连接

}

Related Article

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.