Changeset 80 for trunk/src/org/expeditee/io/DefaultTreeWriter.java
- Timestamp:
- 05/30/08 10:14:43 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/DefaultTreeWriter.java
r46 r80 9 9 import org.expeditee.gui.FrameIO; 10 10 import org.expeditee.items.Item; 11 import org.expeditee.items.Text; 11 12 12 13 public abstract class DefaultTreeWriter extends DefaultFrameWriter implements … … 15 16 // the list of frames currently being processed 16 17 private Stack<FrameCounter> _frames = new Stack<FrameCounter>(); 18 17 19 private int _frameCount = 0; 18 20 19 21 public int getFrameCount() { 20 22 return _frameCount; … … 24 26 try { 25 27 initialise(toWrite); 26 27 28 outputTree(toWrite); 28 29 29 _running = false;30 return finaliseTree();31 30 } catch (IOException ioe) { 32 31 _running = false; 33 32 throw ioe; 33 } catch (Exception e) { 34 e.printStackTrace(); 34 35 } 36 _running = false; 37 return finaliseTree(); 35 38 } 36 39 … … 66 69 return; 67 70 68 _frames.push(new FrameCounter(toWrite.get FrameName(), -1));71 _frames.push(new FrameCounter(toWrite.getName(), -1)); 69 72 70 73 // process the entire tree of frames in depth-first order 71 74 while (_frames.size() > 0) { 72 75 FrameCounter cur = _frames.pop(); 76 77 if (_stop) 78 return; 73 79 74 80 Frame next = FrameIO.LoadFrame(cur.frame); … … 85 91 this.resumeFrame(next); 86 92 } else { 87 FrameGraphics.OverwriteMessage("Writing: " 88 + next.getFrameName()); 89 _frameCount ++; 93 FrameGraphics.OverwriteMessage("Writing: " + next.getName()); 94 _frameCount++; 90 95 writeStartFrame(next); 91 96 } … … 102 107 // ignore annotation and framenames 103 108 if (item.getID() >= 0) { 104 if (item.getLink() != null && !item.isAnnotation()) { 109 //Only follow the links of text items 110 if (item instanceof Text && item.getLink() != null 111 && !item.isAnnotation()) { 105 112 cur.index = i; 106 113 _frames.push(cur); … … 110 117 this.writeStartLink(item); 111 118 112 Frame linked = FrameIO.LoadFrame(item.getAbsoluteLink()); 119 Frame linked = FrameIO 120 .LoadFrame(item.getAbsoluteLink()); 113 121 114 122 // if the linked frame was found, then display it next 115 123 if (linked != null) { 116 FrameCounter fc = new FrameCounter( linked117 .getFrameName(), -1);124 FrameCounter fc = new FrameCounter( 125 linked.getName(), -1); 118 126 if (!_frames.contains(fc)) { 119 127 // remember what frame we are on before … … 127 135 } 128 136 } 129 } else if (item != next.getTitle()) 137 // Dont write out the title here because it is written 138 // out earlier 139 } else if (item != next.getTitleItem()) 130 140 this.writeItem(item); 131 141 } … … 160 170 if (o instanceof FrameCounter) 161 171 return (((FrameCounter) o).frame.equals(frame));// && fc.index 162 172 // == index); 163 173 164 174 return false;
Note:
See TracChangeset
for help on using the changeset viewer.