source: trunk/src/org/expeditee/items/FrameImage.java@ 181

Last change on this file since 181 was 181, checked in by ra33, 16 years ago

Work on Bridging the Gap between SimpleStatements and Actions/Agents

File size: 1.5 KB
Line 
1package org.expeditee.items;
2
3import java.awt.Image;
4import java.awt.image.ImageObserver;
5
6import org.expeditee.gui.Frame;
7import org.expeditee.gui.FrameGraphics;
8import org.expeditee.gui.FrameIO;
9
10public class FrameImage extends FramePicture {
11 /**
12 * Creates a new Picture from the given path. The ImageObserver is optional
13 * and can be set to NULL. <br>
14 * Note: It is assumed that the file described in path has already been
15 * checked to exist.
16 *
17 * @param source
18 * The Text Item that was used to create this Picture
19 * @param path
20 * The Path of the Image to load from disk.
21 * @param observer
22 * The ImageObserver to assign when painting the Image on the
23 * screen.
24 */
25 public FrameImage(Text source, ImageObserver observer, Image image) {
26 super(source, observer, image);
27 }
28
29 @Override
30 protected Picture createPicture() {
31 return new FrameImage(_source.copy(), _imageObserver, _image);
32 }
33
34 @Override
35 public boolean refresh() {
36 // Need to parse the first time the frame is being displayed
37 // parseSize();
38 assert (_source.getLink() != null);
39 Frame frame = FrameIO.LoadFrame(_source.getAbsoluteLink());
40 if (frame == null)
41 return false;
42
43 frame.setBuffer(null);
44 FrameGraphics.UpdateBuffer(frame, false, false);
45 _image = frame.getBuffer();
46
47 // TODO tidy this up, need to call parse size only when the frame has
48 // been created to begin with
49 parseSize();
50 updatePolygon();
51 return true;
52 }
53
54 @Override
55 protected String getTagText() {
56 return "@f: ";
57 }
58}
Note: See TracBrowser for help on using the repository browser.