source: trunk/src/org/expeditee/settings/templates/TemplateSettings.java@ 919

Last change on this file since 919 was 919, checked in by jts21, 10 years ago

Added license headers to all files, added full GPL3 license file, moved license header generator script to dev/bin/scripts

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