1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package pl.edu.agh.cast.zestalgorithms.core;
18
19 import org.eclipse.zest.layouts.LayoutEntity;
20 import org.eclipse.zest.layouts.constraints.LayoutConstraint;
21
22
23 import pl.edu.agh.cast.schema.model.presentation.ISchemaNode;
24 import pl.edu.agh.cast.schema.model.visual.IVisualSchemaNode;
25
26
27
28
29
30
31 public class LayoutEntityAdapter implements LayoutEntity {
32
33 private static final long serialVersionUID = 388599899387325632L;
34
35
36
37
38 private Object layoutInformation;
39
40
41
42
43 private ISchemaNode node;
44
45
46
47
48
49
50
51 public LayoutEntityAdapter(ISchemaNode node) {
52 this.node = node;
53 }
54
55 @Override
56 public double getHeightInLayout() {
57 return ((IVisualSchemaNode)node.getVisualElement()).getHeight();
58 }
59
60 @Override
61 public double getWidthInLayout() {
62 return ((IVisualSchemaNode)node.getVisualElement()).getWidth();
63 }
64
65 @Override
66 public double getXInLayout() {
67 return ((IVisualSchemaNode)node.getVisualElement()).getXCoordinate();
68 }
69
70 @Override
71 public double getYInLayout() {
72 return ((IVisualSchemaNode)node.getVisualElement()).getYCoordinate();
73 }
74
75 @Override
76 public Object getLayoutInformation() {
77 return layoutInformation;
78 }
79
80 @Override
81 public void populateLayoutConstraint(LayoutConstraint arg0) {
82
83
84 }
85
86 @Override
87 public void setLayoutInformation(Object layoutInformation) {
88 this.layoutInformation = layoutInformation;
89
90 }
91
92
93
94
95
96 @Override
97 public void setLocationInLayout(double x, double y) {
98 ((IVisualSchemaNode)node.getVisualElement()).setXCoordinate((int)x);
99 ((IVisualSchemaNode)node.getVisualElement()).setYCoordinate((int)y);
100 }
101
102
103
104
105
106 @Override
107 public void setSizeInLayout(double x, double y) {
108 ((IVisualSchemaNode)node.getVisualElement()).setWidth((int)x);
109 ((IVisualSchemaNode)node.getVisualElement()).setHeight((int)y);
110 }
111
112 @Override
113 public int compareTo(Object arg) {
114 int _result = 0;
115
116 if (arg instanceof ISchemaNode) {
117 _result = this.node.getId().compareTo(((ISchemaNode)arg).getId());
118 }
119
120 return _result;
121 }
122
123
124
125
126 public Object getGraphData() {
127 return node;
128 }
129
130
131
132
133 public void setGraphData(Object arg0) {
134
135 }
136
137 }