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