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
RevLine 
[919]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
[109]19package org.expeditee.items;
20
21import java.util.Collection;
22import java.util.LinkedList;
23import java.util.List;
24
[1102]25import org.expeditee.core.Colour;
26import org.expeditee.core.Point;
[1423]27import org.expeditee.encryption.items.surrogates.Label;
[1102]28import org.expeditee.gui.DisplayController;
[1434]29import org.expeditee.gui.Frame;
[282]30
[109]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
[1420]42 @Override
[1426]43 public Item getPrimary() {
44 return _source.getPrimary();
45 }
46
47 @Override
48 public boolean isSurrogate() {
49 return _source.isSurrogate();
50 }
51
52 @Override
[1420]53 public void setEncryptionLabel(String label) {
54 _source.setEncryptionLabel(label);
55 }
56
[1423]57 public boolean sourceIsAccessible() {
58 String encryptionLabel = _source.getEncryptionLabel();
59 if (encryptionLabel == null || encryptionLabel.isEmpty()) {
60 return true;
61 } else {
[1434]62 Frame parent = this.getParent();
63 List<String> accessibleLabelsNames = Label.getAccessibleLabelsNames(parent.getBody(true));
[1423]64 return accessibleLabelsNames.contains(encryptionLabel);
65 }
66 }
67
[109]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
[1102]130 public Colour getColor() {
[109]131 return _source.getColor();
132 }
133
134 @Override
[1102]135 public void setColor(Colour c) {
[109]136 _source.setColor(c);
[124]137 invalidateCommonTrait(ItemAppearence.ForegroundColorChanged);
[109]138 }
139
140 @Override
[1102]141 public void setBackgroundColor(Colour c) {
[109]142 _source.setBackgroundColor(c);
143 }
144
145 @Override
[1102]146 public void setFillColor(Colour c) {
[109]147 _source.setFillColor(c);
148 }
149
150 @Override
[1102]151 public void setBorderColor(Colour c) {
[242]152 _source.setBorderColor(c);
153 invalidateCommonTrait(ItemAppearence.BorderColorChanged);
154 }
155
156 @Override
[1102]157 public void setGradientColor(Colour c) {
[145]158 _source.setGradientColor(c);
159 }
160
161 @Override
[707]162 public void setTooltips(List<String> tooltips) {
163 _source.setTooltips(tooltips);
164 }
165
166 @Override
[665]167 public void setTooltip(String tooltip) {
168 _source.setTooltip(tooltip);
169 }
170
171 @Override
[707]172 public List<String> getTooltip() {
[665]173 return _source.getTooltip();
174 }
175
176 @Override
[109]177 public float getThickness() {
178 return _source.getThickness();
179 }
180
181 @Override
[1102]182 public Integer getAnchorLeft() {
[720]183 return _source.getAnchorLeft();
[282]184 }
185
186 @Override
[1102]187 public Integer getAnchorRight() {
[282]188 return _source.getAnchorRight();
189 }
[720]190
191 @Override
[1102]192 public Integer getAnchorTop() {
[720]193 return _source.getAnchorTop();
194 }
195
196 @Override
[1102]197 public Integer getAnchorBottom() {
[720]198 return _source.getAnchorBottom();
199 }
[282]200
[720]201
[282]202 @Override
[1102]203 public Colour getBorderColor() {
[242]204 return _source.getBorderColor();
205 }
206
207 @Override
[311]208 public void setThickness(float thick, boolean setConnected) {
[121]209 this.invalidateCommonTrait(ItemAppearence.Thickness);
[311]210 _source.setThickness(thick, setConnected);
[121]211 this.invalidateCommonTrait(ItemAppearence.Thickness);
[109]212 }
213
214 @Override
[1102]215 public Colour getBackgroundColor() {
[109]216 return _source.getBackgroundColor();
217 }
218
219 @Override
[1102]220 public Colour getFillColor() {
[109]221 return _source.getFillColor();
222 }
[147]223
224 @Override
[1102]225 public Colour getGradientColor() {
[147]226 return _source.getGradientColor();
227 }
[109]228
229 @Override
230 public String getFillPattern() {
231 return _source.getFillPattern();
232 }
233
234 @Override
[697]235 public boolean hasLink() {
236 return getLink() != null;
237 }
238
239 @Override
[109]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 }
[154]252 if(frameName == null)
253 invalidateAll();
254 _source.setLink(frameName);
[1102]255 invalidateBounds();
[154]256 //TODO: only invalidate the link bit
257 invalidateAll();
[109]258 }
259
260 @Override
261 public void setActions(List<String> action) {
[154]262 if (_source == null){
[109]263 return;
[154]264 }
[156]265 if(action == null || action.size() == 0)
[154]266 invalidateAll();
267 _source.setActions(action);
[1102]268 invalidateBounds();
[154]269 invalidateAll();
[109]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
[1102]281 public void translate(Point origin, double ratio){
[109]282 //_source.translate(origin, ratio);
[1102]283 invalidateBounds();
[109]284 }
285
286 @Override
287 public void setPosition(float x, float y) {
288 //_source.setPosition(x, y);
[121]289
[109]290 }
291
[278]292 @Override
[774]293 public boolean isAnchored() {
294 return _source.isAnchored();
295 }
296
297 @Override
[805]298 public boolean isAnchoredX() {
299 return _source.isAnchoredX();
300 }
301
302 @Override
303 public boolean isAnchoredY() {
304 return _source.isAnchoredY();
305 }
306
307 @Override
[1102]308 public void setAnchorTop(Integer anchor) {
[720]309 _source.setAnchorTop(anchor);
310 if (anchor != null)
[875]311 _source.setY(anchor);
[720]312 }
313
314 @Override
[1102]315 public void setAnchorBottom(Integer anchor) {
[278]316 _source.setAnchorBottom(anchor);
[282]317 if (anchor != null)
[1258]318 _source.setY(DisplayController.getFramePaintAreaHeight() - getHeight() - anchor);
[278]319 }
[720]320
[278]321
322 @Override
[1102]323 public void setAnchorLeft(Integer anchor) {
[720]324 _source.setAnchorLeft(anchor);
325 }
326
327 @Override
[1102]328 public void setAnchorRight(Integer anchor) {
[278]329 _source.setAnchorRight(anchor);
[1258]330 _source.setX(DisplayController.getFramePaintAreaWidth() - anchor - this.getWidth());
[278]331 }
332
[109]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 }
[147]341
342 @Override
[450]343 public boolean hasPermission(UserAppliedPermission p) {
[147]344 return _source.hasPermission(p);
345 }
346
347 @Override
[1402]348 public void setPermission(PermissionTriple permissionPair) {
[737]349 _source.setPermission(permissionPair);
[147]350 }
[109]351}
Note: See TracBrowser for help on using the repository browser.