source: trunk/src/org/expeditee/items/widgets/WidgetEdge.java@ 774

Last change on this file since 774 was 774, checked in by davidb, 10 years ago

Mouse panning action updated to take into account the status of any items that are anchored, and therefore shouldn't move

File size: 4.1 KB
Line 
1package org.expeditee.items.widgets;
2
3import java.awt.Color;
4import java.awt.Polygon;
5import java.util.List;
6
7import org.expeditee.items.Item;
8import org.expeditee.items.Line;
9import org.expeditee.items.Text;
10
11/**
12 * Widget edges define the boundries of an interactive widget.
13 *
14 * @author Brook Novak
15 */
16public class WidgetEdge extends Line {
17
18 private InteractiveWidget _widgetSource;
19
20 WidgetEdge(WidgetCorner start, WidgetCorner end, int id,
21 InteractiveWidget widgetSource) {
22 super(start, end, id);
23
24 if (widgetSource == null)
25 throw new NullPointerException("widgetSource");
26 _widgetSource = widgetSource;
27 }
28
29 public InteractiveWidget getWidgetSource() {
30 return _widgetSource;
31 }
32
33 @Override
34 public Item forceMerge(Item merger, int mouseX, int mouseY) {
35 return null; // Don't allow breaking up of borders
36 }
37
38 @Override
39 public void toggleArrow() {
40 // Ignore
41 }
42
43 @Override
44 public void toggleDashed(int amount) {
45 // Ignore
46 }
47
48 @Override
49 public void toggleArrowHeadRatio(int amount) {
50 // Ignore
51 }
52
53 @Override
54 public void toggleArrowHeadLength(int amount) {
55 // Ignore
56 }
57
58 @Override
59 public void setAnnotation(boolean val) {
60 // Ignore
61 }
62
63 @Override
64 public boolean isAnnotation() {
65 return false;
66 }
67
68 @Override
69 public void setArrow(float length, double ratio, double nib_perc) {
70 }
71
72 @Override
73 public void setArrowhead(Polygon arrow) {
74 }
75
76 @Override
77 public void setArrowheadLength(float length) {
78 }
79
80 @Override
81 public void setArrowheadRatio(double ratio) {
82 }
83
84 @Override
85 public void setBottomShadowColor(Color bottom) {
86 }
87
88 @Override
89 public void setFillColor(Color c) {
90 }
91
92 @Override
93 public void setFillPattern(String patternLink) {
94 }
95
96 @Override
97 public void setSize(float size) {
98 }
99
100 @Override
101 public void setFormula(String formula) {
102 }
103
104 @Override
105 public void setAnchorTop(Float anchor) {
106 _widgetSource.setAnchorTop(anchor);
107 }
108
109 @Override
110 public void setAnchorBottom(Float anchor) {
111 _widgetSource.setAnchorBottom(anchor);
112 }
113
114 @Override
115 public void setAnchorLeft(Float anchor) {
116 _widgetSource.setAnchorLeft(anchor);
117 }
118
119 @Override
120 public void setAnchorRight(Float anchor) {
121 _widgetSource.setAnchorRight(anchor);
122 }
123
124 @Override
125 public boolean isAnchored() {
126 return _widgetSource.isAnchored();
127 }
128
129 @Override
130 public Float getAnchorTop() {
131 return _widgetSource.getSource().getAnchorTop();
132 }
133
134 @Override
135 public Float getAnchorBottom() {
136 return _widgetSource.getSource().getAnchorBottom();
137 }
138
139 @Override
140 public Float getAnchorLeft() {
141 return _widgetSource.getSource().getAnchorLeft();
142 }
143
144 @Override
145 public Float getAnchorRight() {
146 return _widgetSource.getSource().getAnchorRight();
147 }
148
149 @Override
150 public boolean contains(int x, int y) {
151 return super.contains(x, y) && !_widgetSource.getBounds().contains(x, y);
152 }
153
154 @Override
155 public Polygon getEnclosedShape() {
156 return getStartItem().getEnclosedShape();
157 }
158
159 @Override
160 public String getLink() {
161 return _widgetSource.getSource().getLink();
162 }
163
164 @Override
165 public void setLink(String link) {
166 _widgetSource.setLink(link, null);
167 }
168
169 /**
170 * @param link
171 * The new frame link. Can be null (for no link)
172 *
173 * @param linker
174 * The text item creating the link. Null if not created from
175 * a text item.
176 */
177 public void setLink(String link, Text linker) {
178 _widgetSource.setLink(link, linker);
179 }
180
181 @Override
182 public void setThickness(float newThickness, boolean setConnected) {
183 if (_widgetSource != null) {
184 float minThickness = _widgetSource.getMinimumBorderThickness();
185 if(newThickness < minThickness)
186 newThickness = minThickness;
187 super.setThickness(newThickness, setConnected);
188 _widgetSource.setSourceThickness(newThickness, false);
189 }
190 }
191
192 @Override
193 public void setBackgroundColor(Color c) {
194 if (_widgetSource != null) {
195 super.setBackgroundColor(c);
196 _widgetSource.setBackgroundColor(c);
197 }
198 }
199
200 @Override
201 public void setColor(Color c) {
202 if (_widgetSource != null) {
203 super.setColor(c);
204 _widgetSource.setSourceBorderColor(c);
205 }
206 }
207
208 @Override
209 public void setData(List<String> data) {
210 _widgetSource.setSourceData(data);
211 }
212
213 @Override
214 public String getName() {
215 return _widgetSource.getName();
216 }
217
218}
Note: See TracBrowser for help on using the repository browser.