1 | /**
|
---|
2 | * FrameSetting.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.setting;
|
---|
20 |
|
---|
21 | import org.expeditee.gui.Frame;
|
---|
22 | import org.expeditee.items.Text;
|
---|
23 |
|
---|
24 | public abstract class FrameSetting extends Setting {
|
---|
25 |
|
---|
26 | public FrameSetting(String tooltip, String name) {
|
---|
27 | super(tooltip, name);
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The code to run
|
---|
32 | * Must be overridden
|
---|
33 | */
|
---|
34 | protected abstract void run(Frame frame);
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * runs the setting specific code if the text item has a child frame
|
---|
38 | */
|
---|
39 | public boolean setSetting(Text text) {
|
---|
40 | if(text.getChild() != null) {
|
---|
41 | run(text.getChild());
|
---|
42 | return true;
|
---|
43 | }
|
---|
44 | return false;
|
---|
45 | }
|
---|
46 |
|
---|
47 | @Override
|
---|
48 | public Text generateRepresentation(String label, String frameset) {
|
---|
49 | Text t = new Text(label);
|
---|
50 | return t;
|
---|
51 | }
|
---|
52 | }
|
---|