SlideShare a Scribd company logo
Eclipse Draw2D

ECLIPSE DRAW2D
                 조현종(v.05, 12/12/09)
                 http://cafe.naver.com/eclipseplugin
                 http://hangumkj.blogspot.com/
                 hangum@gmail.com
목 차
 Draw2D란?
 Draw2D 살펴보기
 실행 환경
 HelloWorld Draw2D
 Figures 종류
 Painting of Figures
 Layout
 Locator Anchors Routers
 실습
Draw2D란?

 그래픽 생성, 편집, 조작가능
 SWT에 의존
 경량 Widget
 www.eclipse.org/gef
Draw2D 살펴보기

 LightweightSystem?
   SWT Canvas와 Draw2D를 연결 .
   SWT Control 위에서 발생한 이벤트를 Draw2D이
    벤트로 변경
   SWT의 Display와 비슷한 역할을 함
Draw2D 살펴보기

 EventDispatcher?
   SWT Event to Draw2D router
 UpdateManager?
Draw2D 살펴보기

 Figure?
   Draw2D에서 표현 되어 지는 것.
   반드시 하나의 Root Figure가 존재해야함.
   부모 자식과의 관계가 가능 하며, 마우스 이벤트
    등의 이벤트 가능
   SWT의 Shell, Control, Composite등과 비슷함.


  Class는 org.eclipse.draw2d.IFigurer
실행환경

 Eclipse 4.2 SR1
 GEF SDK3.8.1 (update manager
  http://download.eclipse.org/tools/gef/updates/releases/)
HelloWorld Draw2D
                  .




ps) com.ibm.icu?? 추가하세요
Figure

 Figure?
   Draw2D에서 표현 되어 지는 것.
   반드시 하나의 Root Figure가 존재해야함.
   부모 자식과의 관계가 가능 하며, 마우스 이벤트
    등의 이벤트 가능
   SWT의 Shell, Control, Composite등과 비슷함.


  Class는 org.eclipse.draw2d.IFigurer
Figure – Common Figures

 Shapes – rectangle, triangles, ellipse
 Clickables – buttons, checkboxes
 Containers – Panel, ScrollPane
 Connections – figure간의 line
 Layered – figure 들을 layer
 Other – ImageFigure, Label등
Figures 종류?
Figure Border

   CompoundBorder
   FramBorder
   GroupBoxBorder
   LineBorder
   SimpleEtchedBorder
   SimpleLoweredBorder
   SimpleRaisedBorder

 TitleBarBorder
Figures Z-Order

 Figures들은 tree형식을 취합니다
  (Root Figure 존재)
 자식 Figure를 만들 수 있고, 부모와 자식 관
  계를 가집니다
 마지막에 그린 것이 제일위에 표시됩니다.
Event


Listener              Description
FocusListener         포커스를 얻거나 잃었을때
KeyListener
MouseListener         Mouse 클릭, 클릭 후, 버블클릭
MouseMotionListener   Mouse 가 움직일때
                      (mouse enter, mouse hover, mouse move)
Genealogy 예제

 Figure
   RectangleFigure
   PolygonShape
   PolylineConnection
     ChopboxAnchor
 Event
   MouseListener
   MouseMotionListener
Layout 종류
BorderLayout
               Canvas canvas = new Canvas(parent, SWT.NONE);
               LightweightSystem lws = new LightweightSystem(canvas);


               IFigure panel = new Figure();
               BorderLayout layout = new BorderLayout();
               panel.setLayoutManager(layout);


               Button btnLeft = new Button("Left Button");
               panel.setBorder(new LineBorder());
               panel.add(btnLeft, BorderLayout.LEFT);


               Button btnRight = new Button("right Button");
               panel.setBorder(new LineBorder());
               panel.add(btnRight, BorderLayout.RIGHT);


               Button btnTOP = new Button("TOP Button");
               panel.setBorder(new LineBorder());
               panel.add(btnTOP, BorderLayout.TOP);


               lws.setContents(panel);
FlowLayout
             Canvas canvas = new Canvas(parent,
                 SWT.NONE);
             LightweightSystem lws = new
                 LightweightSystem(canvas);

             IFigure panel = new Figure();

             FlowLayout layout = new FlowLayout();
             layout.setHorizontal(true);
             panel.setLayoutManager(layout);

             for (int i = 0; i < 10; i++) {
             panel.add(new Button("button" + i));
             }

             lws.setContents(panel);
XYLayout
           Canvas canvas = new
               Canvas(parent, SWT.NONE);
           LightweightSystem lws = new
               LightweightSystem(canvas);

           IFigure panel = new Figure();

           XYLayout layout = new XYLayout();
           panel.setLayoutManager(layout);

           Button btn = new Button("btn");
           Rectangle rect = new Rectangle(10, 10, 50, 50);
           panel.add(btn);
           panel.setConstraint(btn, rect);

           lws.setContents(panel);
ToolbarLayout
            Canvas canvas = new
                Canvas(parent, SWT.NONE);
            LightweightSystem lws = new
                LightweightSystem(canvas);

            IFigure panel = new Figure();

            ToolbarLayout layout = new ToolbarLayout();
            layout.setVertical(true);
            panel.setLayoutManager(layout);

            for (int i = 0; i < 10; i++) {
            panel.add(new Button("button" + i));
            }

            lws.setContents(panel);
ParagraphTextLayout
         private TextFlow makeTextFlow(String text) {
          TextFlow textFlow = new TextFlow();
          textFlow.setLayoutManager(new
         ParagraphTextLayout(textFlow,
          ParagraphTextLayout.WORD_WRAP_HARD));
          textFlow.setFont(this.getFont());
          textFlow.setText("rn"+text);

             return textFlow;
         }
Connections

 Anchors : Figure간의 선 연결
 Decorations : 선의 끝을 장식
 Routers : 선의 방향을 어떻게 할 것인지~
 Locator : 텍스트를 선의 어느 위치에 놓을
 것인지~
Anchors

 figure들 간에 선 연결
  ChopboxAnchor


  EllipseAnchor


  LabelAnchor


  XYAnchor
Decorations

 선의 끝 모양을 장식


 Default Decorations
   PolylineDecoration
   PolygonDecoration
   RotatableDecoration
Routers

 Router
   NullConnectionRouter


   BendpointConnectionRouter



   MantattanConnectionRouter
Router

 BendpointConnectionRouter
   AbsoluteBendpoint : 절대 좌표 리턴
     AbsoluteBendpoint(350, 10);
   RelativeBendpoint :
     RelativeBendpoint bp2 = new RelativeBendpoint(firstConnection);
     bp2.setRelativeDimensions(new Dimension(-50, 20), new
      Dimension(10, -40));
Connection Labels(Locator)
Locator




                     이 름                         종 류
          BendpointLocator            BendpointConnectionRoutter의
                                      텍스트
          ConnectionEndpointLocator   선의 양끝 텍스트
          MidpointLocator             선의 중앙 텍스트
          ConnectionLocator
          RelativeLocator
PolylineConnection ManhattanConnectionRouter
                           PolylineConnection connection = new PolylineConnection();
                           ..


                           // source label decoration
                           ConnectionEndpointLocator locator = new
                               ConnectionEndpointLocator (connection, false);
                           Label label = new Label("Source");
                           connection.add(label, locator);


                           // target label decoration
                           locator = new ConnectionEndpointLocator (connection, true);
                           label = new Label("Target");
                           connection.add(label, locator);


                           //
                           ManhattanConnectionRouter router = new
                               ManhattanConnectionRouter ();
                           connection.setConnectionRouter (router);


                           // rootFigure에 추가합니다.
                           rootFigure.add(connection);
실습
참고자료

 Addison Wesely The Eclipse Graphical Editing Framework
 Eclipse Help(http://help.eclipse.org/ganymede/index.jsp) – Draw2D
 Eclipse coon 2005 GEF in dept ppt
 SWT/Jface 인 액션(이선아/제갈호준/에이콘)
 http://www13.plala.or.jp/observe/draw2d/draw2d_overview.html
 Eclipse Plug-in & RCP café의 번역문
      http://eclipse-articles.springnote.com/pages/3666185
      http://eclipse-articles.springnote.com/pages/3683263
 http://eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html
 Eclipse Development using the Graphical Editing Framework and the
   Eclipse Modeling Framework(IBM)

More Related Content

ODT
Yolygambas
PPT
ملخص البرمجة المرئية - الوحدة السابعة
TXT
Bouncingballs sh
PDF
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
PDF
Building Large jQuery Applications
KEY
Total World Domination with i18n (es)
PDF
Ext GWT 3.0 Theming and Appearances
Yolygambas
ملخص البرمجة المرئية - الوحدة السابعة
Bouncingballs sh
TDC2017 | São Paulo - Trilha Programação Funcional How we figured out we had ...
Building Large jQuery Applications
Total World Domination with i18n (es)
Ext GWT 3.0 Theming and Appearances

What's hot (13)

TXT
Exemple de création de base
PDF
Design pattern - Iterator, Mediator and Memento
PDF
Mulberry: A Mobile App Development Toolkit
TXT
Upload text JAVA SCRIPT
PDF
Symfony CoP: Form component
PPTX
Amp Up Your Admin
PDF
Intro programacion funcional
PDF
Extbase and Beyond
PDF
Cyclejs introduction
DOCX
Punto fijo multivariante
PDF
A New Baseline for Front-End Devs
PDF
Electron: From Beginner to Pro
PDF
Dojo Confessions
Exemple de création de base
Design pattern - Iterator, Mediator and Memento
Mulberry: A Mobile App Development Toolkit
Upload text JAVA SCRIPT
Symfony CoP: Form component
Amp Up Your Admin
Intro programacion funcional
Extbase and Beyond
Cyclejs introduction
Punto fijo multivariante
A New Baseline for Front-End Devs
Electron: From Beginner to Pro
Dojo Confessions
Ad

Viewers also liked (20)

PPT
Ek 1552 S Eng
PPT
Penman - Our PR Process
PPT
Strategies for Using LinkedIn
PPTX
Den attraktiva gymnasieskolan
PPTX
오픈소스 프로젝트 올챙이
PDF
Leicester Stadium Kp
PPTX
The Benefits and Challenges of Being Connected: Living, Learning, and Teachin...
PPT
Howto Facebook
PPTX
Eclipse RAP
PPTX
Smoking jaclyn sweeney
PDF
Smash - Richard Lavigne
PPT
Olli oct17 workplace
PPTX
Swt J Face 2/3
PPTX
Lra belshaw discussant
PPT
Creating A Facebook Fan Page
PPTX
Las Maravillas Del Oce Ano 2
PPTX
Nk Rock.0
PPTX
mediator
PPT
Taking Wi-Fi Where It’s Never Gone Before
Ek 1552 S Eng
Penman - Our PR Process
Strategies for Using LinkedIn
Den attraktiva gymnasieskolan
오픈소스 프로젝트 올챙이
Leicester Stadium Kp
The Benefits and Challenges of Being Connected: Living, Learning, and Teachin...
Howto Facebook
Eclipse RAP
Smoking jaclyn sweeney
Smash - Richard Lavigne
Olli oct17 workplace
Swt J Face 2/3
Lra belshaw discussant
Creating A Facebook Fan Page
Las Maravillas Del Oce Ano 2
Nk Rock.0
mediator
Taking Wi-Fi Where It’s Never Gone Before
Ad

More from cho hyun jong (20)

PPTX
평범한 개발자 오픈소스로 먹고살기 2
PPTX
테드폴허브(올챙이) PostgreSQL 디비 확장하기
PPTX
평범한 개발자 오픈소스로 먹고살기 2
PPTX
자바가 디비와 사귀기 까지 벌어지는 일들
PDF
테드폴허브 오픈소스Vs엔터프라이즈
PPTX
올챙이팜플렛 V1.0
PDF
올챙이팜플렛
PPTX
Tadpole db hub-monitoring
PPTX
올챙이 확장으로 살펴보는 이클립스 확장
PPTX
Swt bot
PPTX
Eclipse basic(조현종)
PPTX
Tadpole DB Hub 1.0.0
PPTX
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
PPTX
올챙이 현재와 미래
PPTX
올챙이로 살펴보는 Eclipse개발
PPTX
올챙이로 살펴보는 개발툴과 Cloud
PPTX
Eclipse RAP design
PPTX
WindowTester PRO
PPTX
Eclipse RAP - Single Source
DOCX
Petra보고서 개발 open자료
평범한 개발자 오픈소스로 먹고살기 2
테드폴허브(올챙이) PostgreSQL 디비 확장하기
평범한 개발자 오픈소스로 먹고살기 2
자바가 디비와 사귀기 까지 벌어지는 일들
테드폴허브 오픈소스Vs엔터프라이즈
올챙이팜플렛 V1.0
올챙이팜플렛
Tadpole db hub-monitoring
올챙이 확장으로 살펴보는 이클립스 확장
Swt bot
Eclipse basic(조현종)
Tadpole DB Hub 1.0.0
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이 현재와 미래
올챙이로 살펴보는 Eclipse개발
올챙이로 살펴보는 개발툴과 Cloud
Eclipse RAP design
WindowTester PRO
Eclipse RAP - Single Source
Petra보고서 개발 open자료

Recently uploaded (20)

PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation theory and applications.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectroscopy.pptx food analysis technology
Encapsulation theory and applications.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
MIND Revenue Release Quarter 2 2025 Press Release
“AI and Expert System Decision Support & Business Intelligence Systems”
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Spectral efficient network and resource selection model in 5G networks
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
Dropbox Q2 2025 Financial Results & Investor Presentation
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton

Draw2D

  • 1. Eclipse Draw2D ECLIPSE DRAW2D 조현종(v.05, 12/12/09) http://cafe.naver.com/eclipseplugin http://hangumkj.blogspot.com/ hangum@gmail.com
  • 2. 목 차  Draw2D란?  Draw2D 살펴보기  실행 환경  HelloWorld Draw2D  Figures 종류  Painting of Figures  Layout  Locator Anchors Routers  실습
  • 3. Draw2D란?  그래픽 생성, 편집, 조작가능  SWT에 의존  경량 Widget  www.eclipse.org/gef
  • 4. Draw2D 살펴보기  LightweightSystem?  SWT Canvas와 Draw2D를 연결 .  SWT Control 위에서 발생한 이벤트를 Draw2D이 벤트로 변경  SWT의 Display와 비슷한 역할을 함
  • 5. Draw2D 살펴보기  EventDispatcher?  SWT Event to Draw2D router  UpdateManager?
  • 6. Draw2D 살펴보기  Figure?  Draw2D에서 표현 되어 지는 것.  반드시 하나의 Root Figure가 존재해야함.  부모 자식과의 관계가 가능 하며, 마우스 이벤트 등의 이벤트 가능  SWT의 Shell, Control, Composite등과 비슷함. Class는 org.eclipse.draw2d.IFigurer
  • 7. 실행환경  Eclipse 4.2 SR1  GEF SDK3.8.1 (update manager http://download.eclipse.org/tools/gef/updates/releases/)
  • 8. HelloWorld Draw2D . ps) com.ibm.icu?? 추가하세요
  • 9. Figure  Figure?  Draw2D에서 표현 되어 지는 것.  반드시 하나의 Root Figure가 존재해야함.  부모 자식과의 관계가 가능 하며, 마우스 이벤트 등의 이벤트 가능  SWT의 Shell, Control, Composite등과 비슷함. Class는 org.eclipse.draw2d.IFigurer
  • 10. Figure – Common Figures  Shapes – rectangle, triangles, ellipse  Clickables – buttons, checkboxes  Containers – Panel, ScrollPane  Connections – figure간의 line  Layered – figure 들을 layer  Other – ImageFigure, Label등
  • 12. Figure Border  CompoundBorder  FramBorder  GroupBoxBorder  LineBorder  SimpleEtchedBorder  SimpleLoweredBorder  SimpleRaisedBorder  TitleBarBorder
  • 13. Figures Z-Order  Figures들은 tree형식을 취합니다  (Root Figure 존재)  자식 Figure를 만들 수 있고, 부모와 자식 관 계를 가집니다  마지막에 그린 것이 제일위에 표시됩니다.
  • 14. Event Listener Description FocusListener 포커스를 얻거나 잃었을때 KeyListener MouseListener Mouse 클릭, 클릭 후, 버블클릭 MouseMotionListener Mouse 가 움직일때 (mouse enter, mouse hover, mouse move)
  • 15. Genealogy 예제  Figure  RectangleFigure  PolygonShape  PolylineConnection  ChopboxAnchor  Event  MouseListener  MouseMotionListener
  • 17. BorderLayout Canvas canvas = new Canvas(parent, SWT.NONE); LightweightSystem lws = new LightweightSystem(canvas); IFigure panel = new Figure(); BorderLayout layout = new BorderLayout(); panel.setLayoutManager(layout); Button btnLeft = new Button("Left Button"); panel.setBorder(new LineBorder()); panel.add(btnLeft, BorderLayout.LEFT); Button btnRight = new Button("right Button"); panel.setBorder(new LineBorder()); panel.add(btnRight, BorderLayout.RIGHT); Button btnTOP = new Button("TOP Button"); panel.setBorder(new LineBorder()); panel.add(btnTOP, BorderLayout.TOP); lws.setContents(panel);
  • 18. FlowLayout Canvas canvas = new Canvas(parent, SWT.NONE); LightweightSystem lws = new LightweightSystem(canvas); IFigure panel = new Figure(); FlowLayout layout = new FlowLayout(); layout.setHorizontal(true); panel.setLayoutManager(layout); for (int i = 0; i < 10; i++) { panel.add(new Button("button" + i)); } lws.setContents(panel);
  • 19. XYLayout Canvas canvas = new Canvas(parent, SWT.NONE); LightweightSystem lws = new LightweightSystem(canvas); IFigure panel = new Figure(); XYLayout layout = new XYLayout(); panel.setLayoutManager(layout); Button btn = new Button("btn"); Rectangle rect = new Rectangle(10, 10, 50, 50); panel.add(btn); panel.setConstraint(btn, rect); lws.setContents(panel);
  • 20. ToolbarLayout Canvas canvas = new Canvas(parent, SWT.NONE); LightweightSystem lws = new LightweightSystem(canvas); IFigure panel = new Figure(); ToolbarLayout layout = new ToolbarLayout(); layout.setVertical(true); panel.setLayoutManager(layout); for (int i = 0; i < 10; i++) { panel.add(new Button("button" + i)); } lws.setContents(panel);
  • 21. ParagraphTextLayout private TextFlow makeTextFlow(String text) { TextFlow textFlow = new TextFlow(); textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_HARD)); textFlow.setFont(this.getFont()); textFlow.setText("rn"+text); return textFlow; }
  • 22. Connections  Anchors : Figure간의 선 연결  Decorations : 선의 끝을 장식  Routers : 선의 방향을 어떻게 할 것인지~  Locator : 텍스트를 선의 어느 위치에 놓을 것인지~
  • 23. Anchors  figure들 간에 선 연결  ChopboxAnchor  EllipseAnchor  LabelAnchor  XYAnchor
  • 24. Decorations  선의 끝 모양을 장식  Default Decorations  PolylineDecoration  PolygonDecoration  RotatableDecoration
  • 25. Routers  Router  NullConnectionRouter  BendpointConnectionRouter  MantattanConnectionRouter
  • 26. Router  BendpointConnectionRouter  AbsoluteBendpoint : 절대 좌표 리턴  AbsoluteBendpoint(350, 10);  RelativeBendpoint :  RelativeBendpoint bp2 = new RelativeBendpoint(firstConnection);  bp2.setRelativeDimensions(new Dimension(-50, 20), new Dimension(10, -40));
  • 27. Connection Labels(Locator) Locator 이 름 종 류 BendpointLocator BendpointConnectionRoutter의 텍스트 ConnectionEndpointLocator 선의 양끝 텍스트 MidpointLocator 선의 중앙 텍스트 ConnectionLocator RelativeLocator
  • 28. PolylineConnection ManhattanConnectionRouter PolylineConnection connection = new PolylineConnection(); .. // source label decoration ConnectionEndpointLocator locator = new ConnectionEndpointLocator (connection, false); Label label = new Label("Source"); connection.add(label, locator); // target label decoration locator = new ConnectionEndpointLocator (connection, true); label = new Label("Target"); connection.add(label, locator); // ManhattanConnectionRouter router = new ManhattanConnectionRouter (); connection.setConnectionRouter (router); // rootFigure에 추가합니다. rootFigure.add(connection);
  • 30. 참고자료  Addison Wesely The Eclipse Graphical Editing Framework  Eclipse Help(http://help.eclipse.org/ganymede/index.jsp) – Draw2D  Eclipse coon 2005 GEF in dept ppt  SWT/Jface 인 액션(이선아/제갈호준/에이콘)  http://www13.plala.or.jp/observe/draw2d/draw2d_overview.html  Eclipse Plug-in & RCP café의 번역문  http://eclipse-articles.springnote.com/pages/3666185  http://eclipse-articles.springnote.com/pages/3683263  http://eclipse.org/articles/Article-GEF-Draw2d/GEF-Draw2d.html  Eclipse Development using the Graphical Editing Framework and the Eclipse Modeling Framework(IBM)