1 | /**
|
---|
2 | * TemplateSettings.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 |
|
---|
19 | package org.expeditee.settings.templates;
|
---|
20 |
|
---|
21 | import org.expeditee.core.Colour;
|
---|
22 | import org.expeditee.gui.DisplayController;
|
---|
23 | import org.expeditee.gui.Frame;
|
---|
24 | import org.expeditee.gui.FrameUtils;
|
---|
25 | import org.expeditee.gui.FreeItems;
|
---|
26 | import org.expeditee.items.Item;
|
---|
27 | import org.expeditee.items.ItemUtils;
|
---|
28 | import org.expeditee.items.Text;
|
---|
29 | import org.expeditee.setting.ArraySetting;
|
---|
30 | import org.expeditee.setting.FrameSetting;
|
---|
31 | import org.expeditee.setting.StringSetting;
|
---|
32 | import org.expeditee.setting.TextSetting;
|
---|
33 |
|
---|
34 | public class TemplateSettings {
|
---|
35 |
|
---|
36 | public static final StringSetting DefaultFrame = new StringSetting("The default frame", null) {
|
---|
37 | @Override
|
---|
38 | public boolean setSetting(Text text) {
|
---|
39 | _value = FrameUtils.getLink(text, _value);
|
---|
40 | return true;
|
---|
41 | }
|
---|
42 | };
|
---|
43 |
|
---|
44 | public static final FrameSetting CursorFrame = new FrameSetting("Items on this frame will be used as the cursor (clearing the frame or removing the link will default back to a normal cursor)") {
|
---|
45 | @Override
|
---|
46 | public void run(Frame frame) {
|
---|
47 | FreeItems.getCursor().addAll(ItemUtils.CopyItems(frame.getAllItems()));
|
---|
48 | for (Item i : FreeItems.getCursor()) {
|
---|
49 | i.setParent(null);
|
---|
50 | }
|
---|
51 | DisplayController.setCursor(Item.HIDDEN_CURSOR);
|
---|
52 | DisplayController.setCursor(Item.DEFAULT_CURSOR);
|
---|
53 | }
|
---|
54 | };
|
---|
55 |
|
---|
56 | public static final ArraySetting<Colour> ColorWheel = new ArraySetting<Colour>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
57 | new Colour[] { Colour.BLACK, Colour.RED, Colour.BLUE, Item.GREEN, Colour.MAGENTA, Colour.YELLOW.darker(), Colour.WHITE }) {
|
---|
58 | @Override
|
---|
59 | public boolean setSetting(Text text) {
|
---|
60 | Frame child = text.getChild();
|
---|
61 | if (child == null) {
|
---|
62 | return false;
|
---|
63 | }
|
---|
64 | _value = FrameUtils.getColorWheel(child);
|
---|
65 | return true;
|
---|
66 | }
|
---|
67 | };
|
---|
68 |
|
---|
69 | public static final ArraySetting<Colour> FillColorWheel = new ArraySetting<Colour>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
70 | new Colour[] { Colour.FromRGB255(255, 150, 150), Colour.FromRGB255(150, 150, 255), Colour.FromRGB255(150, 255, 150),
|
---|
71 | Colour.FromRGB255(255, 150, 255), Colour.FromRGB255(255, 255, 100), Colour.WHITE, Colour.BLACK }) {
|
---|
72 | @Override
|
---|
73 | public boolean setSetting(Text text) {
|
---|
74 | Frame child = text.getChild();
|
---|
75 | if (child == null) {
|
---|
76 | return false;
|
---|
77 | }
|
---|
78 | _value = FrameUtils.getColorWheel(child);
|
---|
79 | return true;
|
---|
80 | }
|
---|
81 | };
|
---|
82 |
|
---|
83 | public static final ArraySetting<Colour> BackgroundColorWheel = new ArraySetting<Colour>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
84 | new Colour[] { Colour.FromRGB255(235, 235, 235), Colour.FromRGB255(225, 225, 255), Colour.FromRGB255(195, 255, 255),
|
---|
85 | Colour.FromRGB255(225, 255, 225), Colour.FromRGB255(255, 255, 195), Colour.FromRGB255(255, 225, 225),
|
---|
86 | Colour.FromRGB255(255, 195, 255), Colour.WHITE, Colour.GREY, Colour.DARK_GREY, Colour.BLACK, null }) {
|
---|
87 | @Override
|
---|
88 | public boolean setSetting(Text text) {
|
---|
89 | Frame child = text.getChild();
|
---|
90 | if (child == null) {
|
---|
91 | return false;
|
---|
92 | }
|
---|
93 | _value = FrameUtils.getColorWheel(child);
|
---|
94 | return true;
|
---|
95 | }
|
---|
96 | };
|
---|
97 |
|
---|
98 | public static final TextSetting ItemTemplate = new TextSetting("Template for normal text items") {
|
---|
99 | @Override
|
---|
100 | public Text generateText() {
|
---|
101 | return new Text("ItemTemplate");
|
---|
102 | }
|
---|
103 | };
|
---|
104 | public static final TextSetting AnnotationTemplate = new TextSetting("Template for annotation text items") {
|
---|
105 | @Override
|
---|
106 | public Text generateText() {
|
---|
107 | Text t = new Text("AnnotationTemplate");
|
---|
108 | t.setColor(Colour.GREY);
|
---|
109 | return t;
|
---|
110 | }
|
---|
111 | };
|
---|
112 |
|
---|
113 | public static final TextSetting CommentTemplate = new TextSetting("Template for code comment text items") {
|
---|
114 | @Override
|
---|
115 | public Text generateText() {
|
---|
116 | Text t = new Text("CommentTemplate");
|
---|
117 | t.setColor(Colour.GREEN.darker());
|
---|
118 | return t;
|
---|
119 | }
|
---|
120 | };
|
---|
121 |
|
---|
122 | public static final TextSetting StatTemplate = new TextSetting("Template for statistics (e.g. extracted attributes) text items") {
|
---|
123 | @Override
|
---|
124 | public Text generateText() {
|
---|
125 | Text t = new Text("StatsTemplate");
|
---|
126 | t.setColor(Colour.BLACK);
|
---|
127 | t.setBackgroundColor(new Colour(0.9F, 0.9F, 0.9F));
|
---|
128 | t.setFamily(Text.MONOSPACED_FONT);
|
---|
129 | t.setSize(14);
|
---|
130 | return t;
|
---|
131 | }
|
---|
132 | };
|
---|
133 |
|
---|
134 | public static final TextSetting TitleTemplate = new TextSetting("Template for Title text item") {
|
---|
135 | @Override
|
---|
136 | public Text generateText() {
|
---|
137 | Text t = new Text("TitleTemplate");
|
---|
138 | t.setSize(30);
|
---|
139 | t.setFontStyle("Bold");
|
---|
140 | t.setFamily("SansSerif");
|
---|
141 | t.setColor(Colour.BLUE);
|
---|
142 | t.setPosition(25, 50);
|
---|
143 | return t;
|
---|
144 | }
|
---|
145 | };
|
---|
146 |
|
---|
147 | public static final TextSetting DotTemplate = new TextSetting("Template for dot items") {
|
---|
148 | @Override
|
---|
149 | public Text generateText() {
|
---|
150 | return new Text("DotTemplate");
|
---|
151 | }
|
---|
152 | };
|
---|
153 |
|
---|
154 | public static final TextSetting TooltipTemplate = new TextSetting("Template for tooltips") {
|
---|
155 | @Override
|
---|
156 | public Text generateText() {
|
---|
157 | Text t = new Text("TooltipTemplate");
|
---|
158 | t.setColor(Colour.BLACK);
|
---|
159 | t.setBackgroundColor(new Colour(0.7F, 0.7F, 0.9F));
|
---|
160 | // t.setFamily(Text.MONOSPACED_FONT);
|
---|
161 | t.setSize(14);
|
---|
162 | return t;
|
---|
163 | }
|
---|
164 | };
|
---|
165 | }
|
---|