Ignore:
Timestamp:
12/09/13 17:37:35 (11 years ago)
Author:
jts21
Message:

Fix divide-by-zero error in Image loading, fix Frame attribute saving (was using the wrong list), add indentation to Item properties for readability of the save file, add insert method to AttributeSet to deal with cases where an attribute must be loaded before another attribute from another section

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/AttributeUtils.java

    r589 r593  
    5252                public final List<String> keys = new LinkedList<String>();
    5353               
     54                // put an item at the end of the list
    5455                public void put(String attributeName, Method getter, Method setter) {
    5556                        if(map.containsKey(attributeName.toLowerCase())) {
     
    5960                                keys.add(attributeName.toLowerCase());
    6061                        }
     62                        map.put(attributeName.toLowerCase(), new Attribute(attributeName, getter, setter));
     63                }
     64               
     65                // put an item at the start of the list
     66                public void ins(String attributeName, Method getter, Method setter) {
     67                        if(map.containsKey(attributeName.toLowerCase())) {
     68                                System.err.println(this + " already contains key '" + attributeName + "', overwriting value!");
     69                                keys.remove(attributeName.toLowerCase());
     70                        }
     71                        // we keep an ordered list of attributes for extraction
     72                        keys.add(0, attributeName.toLowerCase());
    6173                        map.put(attributeName.toLowerCase(), new Attribute(attributeName, getter, setter));
    6274                }
     
    219231                        // FrameAttribSave has some extra stuff
    220232                        _FrameAttribSave.putAll(_FrameAttrib);
    221                         _FrameAttribSave.put("Version",     Frame.class.getMethod("getVersion"),
     233                        _FrameAttribSave.ins("Version",Frame.class.getMethod("getVersion"),
    222234                                                            Frame.class.getMethod("setVersion", pInt));
    223235                        _FrameAttribSave.put("FrozenDate",  Frame.class.getMethod("getFrozenDate"),
     
    307319                       
    308320                        // Picture Items
    309                         _Attrib.put("Image",                Picture.class.getMethod("getImageSource"),
     321                        _Attrib.ins("Image",                Picture.class.getMethod("getImageSource"),
    310322                                                            Picture.class.getMethod("setImageSource", pString));
    311323                        _Attrib.put("Scale",                Picture.class.getMethod("getScaleToSave"),
Note: See TracChangeset for help on using the changeset viewer.