source: trunk/src/org/expeditee/items/XRayable.java@ 1434

Last change on this file since 1434 was 1434, checked in by bln4, 5 years ago

Implementation of ProfileManager. Refactor + additional content for how new profiles are created. The refactoring split out the creation of the default profile from user profiles. Refactoring revealed a long term bug that was causing user profiles to generate with incorrect information. The additional content fixed this bug by introducing the ${USER.NAME} variable, so that the default profile frameset can specify resource locations located in the users resource directory.

org.expeditee.auth.AuthenticatorBrowser
org.expeditee.auth.account.Create
org.expeditee.gui.Browser
org.expeditee.gui.management.ProfileManager
org.expeditee.setting.DirectoryListSetting
org.expeditee.setting.ListSetting
org.expeditee.settings.UserSettings

Implementation of ResourceManager as a core location to get resources from the file system. Also the additional variable ${CURRENT_FRAMESET} to represent the current frameset, so that images can be stored in the directory of the current frameset. This increases portability of framesets.

org.expeditee.gui.FrameIO
org.expeditee.gui.management.ResourceManager
org.expeditee.gui.management.ResourceUtil
Audio:

#NB: Audio used to only operate on a single directory. This has been updated to work in a same way as images. That is: when you ask for a specific resouce, it looks to the user settings to find a sequence of directories to look at in order until it manages to find the desired resource.


There is still need however for a single(ish) source of truth for the .banks and .mastermix file. Therefore these files are now always located in resource-<username>\audio.
org.apollo.agents.MelodySearch
org.apollo.audio.structure.AudioStructureModel
org.apollo.audio.util.MultiTrackPlaybackController
org.apollo.audio.util.SoundDesk
org.apollo.gui.FrameLayoutDaemon
org.apollo.io.AudioPathManager
org.apollo.util.AudioPurger
org.apollo.widgets.FramePlayer
org.apollo.widgets.SampledTrack

Images:

org.expeditee.items.ItemUtils

Frames:

org.expeditee.gui.FrameIO

Fixed a error in the FramePlayer class caused by an incorrect use of toArray().

org.apollo.widgets.FramePlayer


Added several short cut keys to allow for the Play/Pause (Ctrl + P), mute (Ctrl + M) and volume up/down (Ctrl + +/-) when hovering over SampledTrack widgets.

org.apollo.widgets.SampledTrack


Changed the way that Authenticate.login parses the new users profile to be more consistance with other similar places in code.

org.expeditee.auth.account.Authenticate


Encapsulated _body, _surrogateItemsBody and _primaryItemsBody in Frame class. Also changed getBody function to take a boolean flag as to if it should respect the current surrogate mode. If it should then it makes sure that labels have not changed since last time getBody was called.

org.expeditee.gui.Frame

File size: 7.1 KB
Line 
1/**
2 * XRayable.java
3 * Copyright (C) 2010 New Zealand Digital Library, http://expeditee.org
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package org.expeditee.items;
20
21import java.util.Collection;
22import java.util.LinkedList;
23import java.util.List;
24
25import org.expeditee.core.Colour;
26import org.expeditee.core.Point;
27import org.expeditee.encryption.items.surrogates.Label;
28import org.expeditee.gui.DisplayController;
29import org.expeditee.gui.Frame;
30
31public abstract class XRayable extends Item {
32
33 protected Text _source = null;
34
35 public XRayable(Text source){
36 super();
37 _source = source;
38 source.setHidden(true);
39 source.addEnclosure(this);
40 }
41
42 @Override
43 public Item getPrimary() {
44 return _source.getPrimary();
45 }
46
47 @Override
48 public boolean isSurrogate() {
49 return _source.isSurrogate();
50 }
51
52 @Override
53 public void setEncryptionLabel(String label) {
54 _source.setEncryptionLabel(label);
55 }
56
57 public boolean sourceIsAccessible() {
58 String encryptionLabel = _source.getEncryptionLabel();
59 if (encryptionLabel == null || encryptionLabel.isEmpty()) {
60 return true;
61 } else {
62 Frame parent = this.getParent();
63 List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(parent.getBody(true));
64 return accessibleLabelsNames.contains(encryptionLabel);
65 }
66 }
67
68 public Collection<Item> getItemsToSave() {
69 Collection<Item> toSave = new LinkedList<Item>();
70 toSave.add(_source);
71 return toSave;
72 }
73
74 @Override
75 public Collection<Item> getConnected() {
76 Collection<Item> conn = super.getConnected();
77 conn.add(_source);
78 return conn;
79 }
80
81 @Override
82 public void addAllConnected(Collection<Item> connected) {
83 super.addAllConnected(connected);
84 if (!connected.contains(_source)) {
85 connected.add(_source);
86 }
87 }
88
89 /*
90 * (non-Javadoc)
91 *
92 * @see org.expeditee.items.Item#merge(org.expeditee.items.Item, int, int)
93 */
94 @Override
95 public Item merge(Item merger, int mouseX, int mouseY) {
96 return merger;
97 }
98
99 /**
100 * Returns the Text Item that was used to create this Picture object. This
101 * is required when saving the Frame.
102 *
103 * @return The Text Item used to create this Picture.
104 */
105 public Text getSource() {
106 return _source;
107 }
108
109 @Override
110 public int getID() {
111 return _source.getID();
112 }
113
114 @Override
115 public void setID(int newID) {
116 _source.setID(newID);
117 }
118
119 @Override
120 public int getY() {
121 return _source.getY();
122 }
123
124 @Override
125 public int getX() {
126 return _source.getX();
127 }
128
129 @Override
130 public Colour getColor() {
131 return _source.getColor();
132 }
133
134 @Override
135 public void setColor(Colour c) {
136 _source.setColor(c);
137 invalidateCommonTrait(ItemAppearence.ForegroundColorChanged);
138 }
139
140 @Override
141 public void setBackgroundColor(Colour c) {
142 _source.setBackgroundColor(c);
143 }
144
145 @Override
146 public void setFillColor(Colour c) {
147 _source.setFillColor(c);
148 }
149
150 @Override
151 public void setBorderColor(Colour c) {
152 _source.setBorderColor(c);
153 invalidateCommonTrait(ItemAppearence.BorderColorChanged);
154 }
155
156 @Override
157 public void setGradientColor(Colour c) {
158 _source.setGradientColor(c);
159 }
160
161 @Override
162 public void setTooltips(List<String> tooltips) {
163 _source.setTooltips(tooltips);
164 }
165
166 @Override
167 public void setTooltip(String tooltip) {
168 _source.setTooltip(tooltip);
169 }
170
171 @Override
172 public List<String> getTooltip() {
173 return _source.getTooltip();
174 }
175
176 @Override
177 public float getThickness() {
178 return _source.getThickness();
179 }
180
181 @Override
182 public Integer getAnchorLeft() {
183 return _source.getAnchorLeft();
184 }
185
186 @Override
187 public Integer getAnchorRight() {
188 return _source.getAnchorRight();
189 }
190
191 @Override
192 public Integer getAnchorTop() {
193 return _source.getAnchorTop();
194 }
195
196 @Override
197 public Integer getAnchorBottom() {
198 return _source.getAnchorBottom();
199 }
200
201
202 @Override
203 public Colour getBorderColor() {
204 return _source.getBorderColor();
205 }
206
207 @Override
208 public void setThickness(float thick, boolean setConnected) {
209 this.invalidateCommonTrait(ItemAppearence.Thickness);
210 _source.setThickness(thick, setConnected);
211 this.invalidateCommonTrait(ItemAppearence.Thickness);
212 }
213
214 @Override
215 public Colour getBackgroundColor() {
216 return _source.getBackgroundColor();
217 }
218
219 @Override
220 public Colour getFillColor() {
221 return _source.getFillColor();
222 }
223
224 @Override
225 public Colour getGradientColor() {
226 return _source.getGradientColor();
227 }
228
229 @Override
230 public String getFillPattern() {
231 return _source.getFillPattern();
232 }
233
234 @Override
235 public boolean hasLink() {
236 return getLink() != null;
237 }
238
239 @Override
240 public String getLink() {
241 if (_source == null)
242 return null;
243 else
244 return _source.getLink();
245 }
246
247 @Override
248 public void setLink(String frameName) {
249 if (_source == null) {
250 return;
251 }
252 if(frameName == null)
253 invalidateAll();
254 _source.setLink(frameName);
255 invalidateBounds();
256 //TODO: only invalidate the link bit
257 invalidateAll();
258 }
259
260 @Override
261 public void setActions(List<String> action) {
262 if (_source == null){
263 return;
264 }
265 if(action == null || action.size() == 0)
266 invalidateAll();
267 _source.setActions(action);
268 invalidateBounds();
269 invalidateAll();
270 }
271
272 @Override
273 public List<String> getAction() {
274 if (_source == null)
275 return null;
276 else
277 return _source.getAction();
278 }
279
280 @Override
281 public void translate(Point origin, double ratio){
282 //_source.translate(origin, ratio);
283 invalidateBounds();
284 }
285
286 @Override
287 public void setPosition(float x, float y) {
288 //_source.setPosition(x, y);
289
290 }
291
292 @Override
293 public boolean isAnchored() {
294 return _source.isAnchored();
295 }
296
297 @Override
298 public boolean isAnchoredX() {
299 return _source.isAnchoredX();
300 }
301
302 @Override
303 public boolean isAnchoredY() {
304 return _source.isAnchoredY();
305 }
306
307 @Override
308 public void setAnchorTop(Integer anchor) {
309 _source.setAnchorTop(anchor);
310 if (anchor != null)
311 _source.setY(anchor);
312 }
313
314 @Override
315 public void setAnchorBottom(Integer anchor) {
316 _source.setAnchorBottom(anchor);
317 if (anchor != null)
318 _source.setY(DisplayController.getFramePaintAreaHeight() - getHeight() - anchor);
319 }
320
321
322 @Override
323 public void setAnchorLeft(Integer anchor) {
324 _source.setAnchorLeft(anchor);
325 }
326
327 @Override
328 public void setAnchorRight(Integer anchor) {
329 _source.setAnchorRight(anchor);
330 _source.setX(DisplayController.getFramePaintAreaWidth() - anchor - this.getWidth());
331 }
332
333 public boolean refresh(){
334 return true;
335 }
336
337 @Override
338 public void setXY(float x, float y){
339 _source.setXY(x, y);
340 }
341
342 @Override
343 public boolean hasPermission(UserAppliedPermission p) {
344 return _source.hasPermission(p);
345 }
346
347 @Override
348 public void setPermission(PermissionTriple permissionPair) {
349 _source.setPermission(permissionPair);
350 }
351}
Note: See TracBrowser for help on using the repository browser.