source: trunk/src/org/expeditee/agents/DisplayComet.java@ 636

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

Added HTML styles

File size: 1.5 KB
Line 
1package org.expeditee.agents;
2
3import java.util.Collection;
4import java.util.HashSet;
5import java.util.Stack;
6
7import org.expeditee.gui.DisplayIO;
8import org.expeditee.gui.Frame;
9import org.expeditee.gui.FrameIO;
10import org.expeditee.gui.MessageBay;
11import org.expeditee.items.Item;
12import org.expeditee.items.ItemUtils;
13
14public class DisplayComet extends DefaultAgent {
15 private Stack<Frame> _frameList = new Stack<Frame>();
16
17 public DisplayComet(String delay) {
18 super(delay);
19 }
20
21 public DisplayComet() {
22 super();
23 }
24
25 @Override
26 protected Frame process(Frame frame) {
27 Collection<String> seen = new HashSet<String>();
28
29 DisplayIO.addToBack(frame);
30
31 // Goto the end of the comet
32 Item old = null;
33 Frame oldFrame = frame;
34 while (oldFrame != null) {
35 if (_stop)
36 return null;
37 seen.add(oldFrame.getName().toLowerCase());
38 _frameList.push(oldFrame);
39 old = ItemUtils.FindExactTag(oldFrame.getItems(), ItemUtils
40 .GetTag(ItemUtils.TAG_BACKUP));
41 oldFrame = null;
42 if (old != null) {
43 String link = old.getAbsoluteLink();
44
45 if (link != null) {
46 String linkLowerCase = link.toLowerCase();
47 if (!seen.contains(linkLowerCase)) {
48 oldFrame = FrameIO.LoadFrame(linkLowerCase);
49 MessageBay.overwriteMessage("Loading frames: " + link);
50 }
51 }
52 }
53 }
54 // Back out one frame at a time
55 while (!_frameList.empty()) {
56 if (_stop)
57 return null;
58 DisplayIO.setCurrentFrame(_frameList.pop(), true);
59 _frameCount++;
60 pause(_delay);
61 }
62
63 return _start;
64 }
65
66}
Note: See TracBrowser for help on using the repository browser.