source: trunk/src/org/expeditee/items/FramePicture.java@ 1102

Last change on this file since 1102 was 1102, checked in by davidb, 6 years ago

Reworking of the code-base to separate logic from graphics. This version of Expeditee now supports a JFX graphics as an alternative to SWING

File size: 1.8 KB
Line 
1/**
2 * FramePicture.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.items;
20
21import org.expeditee.core.Colour;
22import org.expeditee.core.Image;
23import org.expeditee.gui.AttributeValuePair;
24import org.expeditee.gui.Frame;
25
26public abstract class FramePicture extends Picture {
27 protected FramePicture(Text source, Image image) {
28 super(source, image);
29 }
30
31 @Override
32 public void setColor(Colour c) {
33 super.setColor(c);
34 refresh();
35 }
36
37 @Override
38 public void setLink(String frameName) {
39 if (_source == null)
40 return;
41 else {
42 _source.setLink(frameName);
43 //remove the picture if the link is being removed
44 if (_source.getLink() == null) {
45 Frame parent = getParent();
46 if (parent != null) {
47 parent.removeItem(this);
48 _source.setHidden(false);
49 _source.removeEnclosure(this);
50 }
51 } else {
52 refresh();
53 }
54 }
55 invalidateBounds();
56 }
57
58 @Override
59 public String getName() {
60 return _source.getAbsoluteLink();
61 }
62
63 @Override
64 protected String getImageSize() {
65 return new AttributeValuePair(_source.getText()).getValue();
66 }
67}
Note: See TracBrowser for help on using the repository browser.