Ignore:
Timestamp:
08/29/08 08:17:54 (16 years ago)
Author:
ra33
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/DefaultFrameWriter.java

    r284 r286  
    66import java.lang.reflect.Method;
    77import java.util.Collection;
     8import java.util.HashSet;
    89import java.util.LinkedHashMap;
    910
     
    1213import org.expeditee.gui.FrameIO;
    1314import org.expeditee.items.Item;
     15import org.expeditee.items.Line;
    1416import org.expeditee.items.Text;
    1517
     
    6365                        _ItemTags.put("G", Item.class
    6466                                        .getMethod("getBackgroundColor", param));
    65                         _ItemTags.put("K", Item.class
    66                                         .getMethod("getBorderColor", param));
     67                        _ItemTags.put("K", Item.class.getMethod("getBorderColor", param));
    6768                        _ItemTags.put("H", Item.class.getMethod("getAnchorRight", param));
    6869                        _ItemTags.put("I", Item.class.getMethod("getAnchorBottom", param));
     
    8384                        _ItemTags.put("e", Item.class.getMethod("getFillColor", param));
    8485                        _ItemTags.put("E", Item.class.getMethod("getGradientColor", param));
    85                        
     86
    8687                        _ItemTags.put("i", Item.class.getMethod("getFillPattern", param));
    8788                        _ItemTags.put("o", Item.class.getMethod("getOwner", param));
     
    9697                        _ItemTags.put("t", Text.class.getMethod("getSpacing", param));
    9798
    98                         //TODO set a boolean flag to indicate that the text is a formula
    99                         //Store the formula in the text property NOT the answer
     99                        // TODO set a boolean flag to indicate that the text is a formula
     100                        // Store the formula in the text property NOT the answer
    100101                        _ItemTags.put("J", Item.class.getMethod("getFormula", param));
    101102                        _ItemTags.put("T", Text.class.getMethod("getText", param));
     
    138139        /**
    139140         * 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.
    141144         * @throws IOException
    142145         */
     
    152155        /**
    153156         * 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.
    155160         * @throws IOException
    156161         */
     
    160165        protected void initialise(Frame start) throws IOException {
    161166                if (_filename == null)
    162                         _filename = FrameIO.EXPORTS_DIR + getValidFilename(start.getTitle()) + _format;
     167                        _filename = FrameIO.EXPORTS_DIR
     168                                        + getFileName(start) + _format;
    163169
    164170                if (_filename.equalsIgnoreCase(WriteTree.CLIPBOARD)) {
     
    189195        }
    190196
     197        protected String getFileName(Frame start) {
     198                return getValidFilename(start.getTitle());
     199        }
     200
    191201        public static String getValidFilename(String filename) {
    192202                return filename.replaceAll("[ \\.]", "_");
     
    212222                writeStartFrame(toWrite);
    213223
     224                Collection<Item> done = new HashSet<Item>();
     225
    214226                for (Item i : getItemsToWrite(toWrite)) {
    215                         if (_stop){
     227                        if (_stop) {
    216228                                return;
    217229                        }
     230
     231                        if (i instanceof Line) {
     232                                if (done.contains(i)) {
     233                                        continue;
     234                                }
     235                                done.addAll(i.getAllConnected());
     236                        }
    218237                        writeItem(i);
    219238                }
    220 
    221239                writeEndFrame(toWrite);
    222240        }
    223        
     241
    224242        protected Collection<Item> getItemsToWrite(Frame toWrite) {
    225243                return toWrite.getItemsToSave();
Note: See TracChangeset for help on using the changeset viewer.