source: trunk/src/org/expeditee/setting/ListSetting.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: 2.6 KB
Line 
1/**
2 * ListSetting.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.setting;
20
21import java.util.LinkedList;
22import java.util.List;
23
24import org.expeditee.core.Representable;
25import org.expeditee.gui.Frame;
26import org.expeditee.gui.FrameIO;
27import org.expeditee.items.Text;
28import org.expeditee.settings.UserSettings;
29
30public abstract class ListSetting<T> extends VariableSetting {
31
32 protected List<T> _default;
33 protected List<T> _value;
34
35 public ListSetting(String tooltip, String name, List<T> value) {
36 super(tooltip, name);
37 _default = new LinkedList<T>(value);
38 _value = value;
39 }
40
41 public ListSetting(String tooltip, String name) {
42 this(tooltip, name, new LinkedList<T>());
43 }
44
45 public List<T> get() {
46 return _value;
47 }
48
49 public void set(List<T> value) {
50 _value = value;
51 }
52
53 public abstract boolean setSetting(Text text);
54
55 public void setDefault(List<T> value) {
56 _default = new LinkedList<T>(value);
57 }
58
59 public void reset() {
60 _value = new LinkedList<T>(_default);
61 }
62
63 @Override
64 public Text generateRepresentation(String label, String frameset) {
65 Text t = new Text(label);
66
67 if (!_value.isEmpty()) {
68 Frame listFrame = FrameIO.CreateFrame(frameset, null, null);
69 listFrame.getTitleItem().delete();
70
71 int x = UserSettings.TitlePosition.get();
72 int y = UserSettings.TitlePosition.get();
73 for (T v: _value) {
74 if (v == null) continue;
75 Text representation;
76 if (v instanceof Representable) {
77 representation = ((Representable) v).generateRepresentation("List Entry", "");
78 representation.setPosition(x, y);
79 representation.setID(listFrame.getNextItemID());
80 listFrame.addItem(representation);
81 } else {
82 representation = listFrame.addText(x, y, v.toString(), null);
83 }
84 y += representation.getBoundsHeight();
85 }
86 FrameIO.ForceSaveFrame(listFrame);
87 t.setLink(listFrame.getName());
88 }
89
90 return t;
91 }
92}
Note: See TracBrowser for help on using the repository browser.