Ignore:
Timestamp:
05/19/08 12:03:18 (16 years ago)
Author:
ra33
Message:

Fixed a bunch of problems with rectangles and resizing the window, as well as adding some more unit tests etc.

File:
1 edited

Legend:

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

    r58 r67  
    11package org.expeditee.io;
    22
    3 import java.awt.Rectangle;
    43import java.io.File;
    54import java.io.FileWriter;
     
    76import java.lang.reflect.Method;
    87import java.util.Iterator;
    9 import java.util.LinkedHashMap;
    108import java.util.LinkedList;
    119import java.util.List;
     
    1715import org.expeditee.items.Line;
    1816import org.expeditee.items.Picture;
    19 import org.expeditee.items.Text;
    2017import org.expeditee.items.WidgetCorner;
    2118import org.expeditee.items.WidgetEdge;
     
    3431        private StringBuilder _stringWriter = null;
    3532
    36         // keep track of methods that are put on the same line
    37         private static LinkedHashMap<String, Method> _ItemTags = null;
    38 
    39         private static LinkedHashMap<String, Method> _FrameTags = null;
    40 
    4133        private static final char TERMINATOR = 'Z';
    4234
    4335        public ExpWriter() {
    44                 if (_ItemTags != null && _FrameTags != null)
    45                         return;
    46 
    47                 _ItemTags = new LinkedHashMap<String, Method>();
    48                 _FrameTags = new LinkedHashMap<String, Method>();
    49 
    50                 Class[] param = {};
    51 
    52                 try {
    53                         _FrameTags.put("V", Frame.class.getMethod("getVersion", param));
    54                         _FrameTags.put("p", Frame.class.getMethod("getProtection", param));
    55                         _FrameTags.put("U", Frame.class.getMethod("getOwner", param));
    56                         _FrameTags.put("D", Frame.class.getMethod("getDateCreated", param));
    57                         _FrameTags.put("M", Frame.class.getMethod("getLastModifyUser",
    58                                         param));
    59                         _FrameTags.put("d", Frame.class.getMethod("getLastModifyDate",
    60                                         param));
    61                         _FrameTags.put("F", Frame.class.getMethod("getFrozenDate", param));
    62 
    63                         _FrameTags.put("O", Frame.class.getMethod("getForegroundColor",
    64                                         param));
    65                         _FrameTags.put("B", Frame.class.getMethod("getBackgroundColor",
    66                                         param));
    67 
    68                         _ItemTags.put("S", Item.class.getMethod("getTypeAndID", param));
    69                         _ItemTags.put("s", Item.class.getMethod("getDateCreated", param));
    70                         _ItemTags.put("d", Item.class.getMethod("getColor", param));
    71                         _ItemTags.put("G", Item.class
    72                                         .getMethod("getBackgroundColor", param));
    73                         _ItemTags.put("P", Item.class.getMethod("getPosition", param));
    74                         _ItemTags.put("F", Item.class.getMethod("getLink", param));
    75                         _ItemTags.put("X", Item.class.getMethod("getAction", param));
    76                         _ItemTags.put("x", Item.class.getMethod("getActionMark", param));
    77                         _ItemTags.put("U", Item.class.getMethod("getActionCursorEnter",
    78                                         param));
    79                         _ItemTags.put("V", Item.class.getMethod("getActionCursorLeave",
    80                                         param));
    81                         _ItemTags.put("W", Item.class.getMethod("getActionEnterFrame",
    82                                         param));
    83                         _ItemTags.put("Y", Item.class.getMethod("getActionLeaveFrame",
    84                                         param));
    85                         _ItemTags.put("D", Item.class.getMethod("getData", param));
    86                         _ItemTags.put("u", Item.class.getMethod("getHighlight", param));
    87                         _ItemTags.put("e", Item.class.getMethod("getFillColor", param));
    88                         _ItemTags.put("i", Item.class.getMethod("getFillPattern", param));
    89                         _ItemTags.put("o", Item.class.getMethod("getOwner", param));
    90                         _ItemTags.put("n", Item.class.getMethod("getLinkMark", param));
    91                         _ItemTags.put("q", Item.class.getMethod("getLinkFrameset", param));
    92                         _ItemTags.put("y", Item.class.getMethod("getLinkTemplate", param));
    93                         _ItemTags.put("g", Item.class.getMethod("getLinePattern", param));
    94 
    95                         _ItemTags.put("j", Item.class.getMethod("getArrow", param));
    96 
    97                         _ItemTags.put("f", Text.class.getMethod("getFont", param));
    98                         _ItemTags.put("t", Text.class.getMethod("getSpacing", param));
    99                         _ItemTags.put("T", Text.class.getMethod("getText", param));
    100 
    101                         _ItemTags.put("a", Text.class.getMethod("getWordSpacing", param));
    102                         _ItemTags.put("b", Text.class.getMethod("getLetterSpacing", param));
    103                         _ItemTags
    104                                         .put("m", Text.class.getMethod("getInitialSpacing", param));
    105                         _ItemTags.put("w", Text.class.getMethod("getWidth", param));
    106                         _ItemTags.put("k", Text.class.getMethod("getJustification", param));
    107 
    108                         _ItemTags.put("h", Item.class.getMethod("getThickness", param));
    109                         _ItemTags.put("l", Item.class.getMethod("getLineIDs", param));
    110                         _ItemTags.put("c", Item.class.getMethod("getConstraintIDs", param));
    111 
    112                 } catch (Exception e) {
    113                         e.printStackTrace();
    114                 }
     36                super();
    11537        }
    11638
     
    12850                } else
    12951                        _writer = new ProxyWriter(new FileWriter(_filename));
     52               
     53                try {
     54                        _ItemTags.put("S", Item.class.getMethod("getTypeAndID", new Class[] {}));
     55                } catch (Exception e) {
     56
     57                }
    13058        }
    13159
     
    225153                // Dont save the item if it is off the screen
    226154                if (item.offScreen()) {
    227                         System.out.println("item offscreen!");
     155                        //System.out.println("item offscreen!");
    228156                        return;
    229157                }
Note: See TracChangeset for help on using the changeset viewer.