Changeset 133 for trunk/src/org/expeditee/agents
- Timestamp:
- 07/10/08 15:50:20 (16 years ago)
- Location:
- trunk/src/org/expeditee/agents
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/agents/Agent.java
r4 r133 2 2 3 3 import org.expeditee.gui.Frame; 4 import org.expeditee.items.Item; 4 5 5 6 /** … … 20 21 * @param toInit 21 22 * The Frame that has any parameters that need to be set before 22 * processing begins. Typically this is the Frame the Item that 23 * invoked this Agent is on. 23 * processing begins. It is also the first frame for the agent. 24 * @param launcher 25 * The item that was clicked on to launch this agent. 24 26 * @return True if the initialisation executed correctly, False if an error 25 27 * occured. 26 28 */ 27 public boolean initialise(Frame toInit); 28 29 /** 30 * Sets the first Frame to process to the given Frame using any settings 31 * previously set by a call to initialise(). Note that Tree based Agents 32 * will use this Frame as the start Frame of the tree, and will then be 33 * responsible for traversing the tree themselves. 34 * 35 * @param toProcess 36 * The Frame apply this Agent to, or the root of the Tree for 37 * Tree-based Agents. 38 */ 39 public void setStartFrame(Frame start); 29 public boolean initialise(Frame toInit, Item launcher); 40 30 41 31 /** -
trunk/src/org/expeditee/agents/CopyTree.java
r121 r133 31 31 32 32 @Override 33 public boolean initialise(Frame init ) {33 public boolean initialise(Frame init, Item launcher) { 34 34 _nameFrom = init.getFramesetName().toLowerCase(); 35 35 … … 56 56 } 57 57 58 return super.initialise(init );58 return super.initialise(init, launcher); 59 59 } 60 60 -
trunk/src/org/expeditee/agents/DefaultAgent.java
r121 r133 4 4 import org.expeditee.gui.MessageBay; 5 5 import org.expeditee.gui.TimeKeeper; 6 import org.expeditee.items.Item; 6 7 import org.expeditee.stats.SessionStats; 7 8 … … 17 18 public abstract class DefaultAgent implements Agent { 18 19 public static final String CLIPBOARD = "Clipboard"; 19 20 20 21 protected long _timeRemaining = 0; 21 22 22 23 // The shortest delay between frames 23 24 public static final long TIMER_RESOLUTION = 10; 25 26 protected Item _clicked = null; 24 27 25 28 protected Frame _start = null; … … 80 83 * @param start 81 84 */ 82 public boolean initialise(Frame init) { 85 public boolean initialise(Frame init, Item launcher) { 86 _start = init; 87 _clicked = launcher; 83 88 message("Starting " + this.getClass().getSimpleName() + "..."); 84 89 _timer = new TimeKeeper(); … … 86 91 } 87 92 88 public void setStartFrame(Frame start) {89 _start = start;90 }91 92 93 public void run() { 93 // init is now called by Actions.java94 /*95 * if(!initialise(_start)){ MessageBay.errorMessage("Error96 * initialising agent."); _running = false; return; }97 */98 99 94 SessionStats.setEnabled(false); 100 _start.change(); 95 if (_start != null) 96 _start.change(); 101 97 _end = process(_start); 102 98 -
trunk/src/org/expeditee/agents/DisplayTree.java
r121 r133 33 33 34 34 @Override 35 public boolean initialise(Frame start ) {35 public boolean initialise(Frame start, Item launcher) { 36 36 37 37 // push current frame on to back-stack 38 38 DisplayIO.addToBack(start); 39 39 40 return super.initialise(start );40 return super.initialise(start, launcher); 41 41 } 42 42 -
trunk/src/org/expeditee/agents/Format.java
r80 r133 108 108 int maxX = 0; 109 109 int maxY = 0; 110 for (Item it em: list) {111 maxX = Math.max(maxX, it em.getX() + item.getBoundsWidth());112 maxY = Math.max(maxY, it em.getY() + item.getBoundsHeight());110 for (Item it : list) { 111 maxX = Math.max(maxX, it.getX() + it.getBoundsWidth()); 112 maxY = Math.max(maxY, it.getY() + it.getBoundsHeight()); 113 113 } 114 114 115 115 int xCheck = maxX; 116 for (Item it em: columns.get(i + 1))116 for (Item it : columns.get(i + 1)) 117 117 xCheck = Math.max(xCheck, maxX 118 + /* item.getX() + */it em.getBoundsWidth());118 + /* item.getX() + */it.getBoundsWidth()); 119 119 120 120 if (xCheck < FrameGraphics.getMaxSize().width) { … … 123 123 columnHeads.get(i + 1).setX(maxX); 124 124 125 for (Item it em: columns.get(i + 1))126 if (it em.getX() < maxX && item.getY() < maxY)127 it em.setX(maxX);125 for (Item it : columns.get(i + 1)) 126 if (it.getX() < maxX && it.getY() < maxY) 127 it.setX(maxX); 128 128 } 129 129 -
trunk/src/org/expeditee/agents/WriteTree.java
r121 r133 10 10 import org.expeditee.io.Logger; 11 11 import org.expeditee.io.TreeWriter; 12 import org.expeditee.items.Item; 12 13 13 14 public class WriteTree extends DefaultAgent { … … 65 66 @SuppressWarnings("unchecked") 66 67 @Override 67 public boolean initialise(Frame start ) {68 public boolean initialise(Frame start, Item launcher) { 68 69 if (_outFile == null) 69 70 _outFile = start.getExportFileName(); … … 123 124 } 124 125 125 return super.initialise(start );126 return super.initialise(start, launcher); 126 127 } 127 128
Note:
See TracChangeset
for help on using the changeset viewer.