Changeset 286 for trunk/src/org/expeditee/io/DefaultFrameWriter.java
- Timestamp:
- 08/29/08 08:17:54 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/DefaultFrameWriter.java
r284 r286 6 6 import java.lang.reflect.Method; 7 7 import java.util.Collection; 8 import java.util.HashSet; 8 9 import java.util.LinkedHashMap; 9 10 … … 12 13 import org.expeditee.gui.FrameIO; 13 14 import org.expeditee.items.Item; 15 import org.expeditee.items.Line; 14 16 import org.expeditee.items.Text; 15 17 … … 63 65 _ItemTags.put("G", Item.class 64 66 .getMethod("getBackgroundColor", param)); 65 _ItemTags.put("K", Item.class 66 .getMethod("getBorderColor", param)); 67 _ItemTags.put("K", Item.class.getMethod("getBorderColor", param)); 67 68 _ItemTags.put("H", Item.class.getMethod("getAnchorRight", param)); 68 69 _ItemTags.put("I", Item.class.getMethod("getAnchorBottom", param)); … … 83 84 _ItemTags.put("e", Item.class.getMethod("getFillColor", param)); 84 85 _ItemTags.put("E", Item.class.getMethod("getGradientColor", param)); 85 86 86 87 _ItemTags.put("i", Item.class.getMethod("getFillPattern", param)); 87 88 _ItemTags.put("o", Item.class.getMethod("getOwner", param)); … … 96 97 _ItemTags.put("t", Text.class.getMethod("getSpacing", param)); 97 98 98 // TODO set a boolean flag to indicate that the text is a formula99 // Store the formula in the text property NOT the answer99 // TODO set a boolean flag to indicate that the text is a formula 100 // Store the formula in the text property NOT the answer 100 101 _ItemTags.put("J", Item.class.getMethod("getFormula", param)); 101 102 _ItemTags.put("T", Text.class.getMethod("getText", param)); … … 138 139 /** 139 140 * Called before writing out the body items of each frame. 140 * @param starting the name of the frame currently being written out. 141 * 142 * @param starting 143 * the name of the frame currently being written out. 141 144 * @throws IOException 142 145 */ … … 152 155 /** 153 156 * Called after writing out the body items of each frame. 154 * @param ending the name of the frame currently being written out. 157 * 158 * @param ending 159 * the name of the frame currently being written out. 155 160 * @throws IOException 156 161 */ … … 160 165 protected void initialise(Frame start) throws IOException { 161 166 if (_filename == null) 162 _filename = FrameIO.EXPORTS_DIR + getValidFilename(start.getTitle()) + _format; 167 _filename = FrameIO.EXPORTS_DIR 168 + getFileName(start) + _format; 163 169 164 170 if (_filename.equalsIgnoreCase(WriteTree.CLIPBOARD)) { … … 189 195 } 190 196 197 protected String getFileName(Frame start) { 198 return getValidFilename(start.getTitle()); 199 } 200 191 201 public static String getValidFilename(String filename) { 192 202 return filename.replaceAll("[ \\.]", "_"); … … 212 222 writeStartFrame(toWrite); 213 223 224 Collection<Item> done = new HashSet<Item>(); 225 214 226 for (Item i : getItemsToWrite(toWrite)) { 215 if (_stop) {227 if (_stop) { 216 228 return; 217 229 } 230 231 if (i instanceof Line) { 232 if (done.contains(i)) { 233 continue; 234 } 235 done.addAll(i.getAllConnected()); 236 } 218 237 writeItem(i); 219 238 } 220 221 239 writeEndFrame(toWrite); 222 240 } 223 241 224 242 protected Collection<Item> getItemsToWrite(Frame toWrite) { 225 243 return toWrite.getItemsToSave();
Note:
See TracChangeset
for help on using the changeset viewer.