[919] | 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 |
|
---|
[79] | 19 | package org.expeditee.items;
|
---|
| 20 |
|
---|
[601] | 21 | import java.awt.Color;
|
---|
| 22 | import java.awt.Image;
|
---|
[108] | 23 | import java.awt.image.ImageObserver;
|
---|
| 24 |
|
---|
[601] | 25 | import org.expeditee.gui.AttributeValuePair;
|
---|
| 26 | import org.expeditee.gui.Frame;
|
---|
[79] | 27 |
|
---|
[147] | 28 | public abstract class FramePicture extends Picture {
|
---|
[601] | 29 | protected FramePicture(Text source, ImageObserver observer, Image image) {
|
---|
| 30 | super(source, observer, image);
|
---|
[79] | 31 | }
|
---|
| 32 |
|
---|
[601] | 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 | }
|
---|
[79] | 69 | }
|
---|