Changeset 671


Ignore:
Timestamp:
01/09/14 11:50:49 (10 years ago)
Author:
jts21
Message:

Fix frame attribute setting (was using item attribute list where frame list should have been used)

File:
1 edited

Legend:

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

    r656 r671  
    340340                ensureReady();
    341341
    342                 AttributeSet as = null;
     342                AttributeSet attribSet = null;
    343343                if(toExtract instanceof Frame) {
    344                         as = _FrameAttrib;
     344                        attribSet = _FrameAttrib;
    345345                } else if(toExtract instanceof Item) {
    346                         as = _Attrib;
     346                        attribSet = _Attrib;
    347347                } else {
    348348                        throw new IncorrectTypeException("toExtract", "Item | Frame");
     
    353353
    354354                // iterate through the list of methods
    355                 for (String prop : as.keys) {
    356 
    357                         Attribute a = as.get(prop);
     355                for (String prop : attribSet.keys) {
     356
     357                        Attribute a = attribSet.get(prop);
    358358                        // Make sure the classes of the methods match the item
    359359                        if (a != null && a.getter != null && a.getter.getDeclaringClass().isAssignableFrom(toExtract.getClass())) {
     
    527527
    528528                ensureReady();
     529               
     530                AttributeSet attribSet = null;
     531                if(toSet instanceof Frame) {
     532                        attribSet = _FrameAttrib;
     533                } else if(toSet instanceof Item) {
     534                        attribSet = _Attrib;
     535                } else {
     536                        throw new IncorrectTypeException("toExtract", "Item | Frame");
     537                }
    529538
    530539                // if(attribs.isAnnotation())
     
    585594                                                return false;
    586595                                        } else {
    587                                                 Attribute a = _Attrib.get(stripped);
     596                                                Attribute a = attribSet.get(stripped);
    588597                                                if(a == null || a.setter == null) {
    589598                                                        return false;
     
    628637                String value = avp.getValue();
    629638                assert (value != null);
     639               
     640                AttributeSet attribSet = null;
     641                if(toSet instanceof Frame) {
     642                        attribSet = _FrameAttrib;
     643                } else if(toSet instanceof Item) {
     644                        attribSet = _Attrib;
     645                } else {
     646                        throw new IncorrectTypeException("toExtract", "Item | Frame");
     647                }
    630648
    631649                // Some properties are ignored when multiple attributes are being set on
     
    638656                // Separate multiple values if required
    639657               
    640                 Attribute a = _Attrib.get(attribute);
     658                Attribute a = attribSet.get(attribute);
    641659                // if this is not the name of a method, it may be the name of an agent
    642660                if (a == null || a.setter == null) {
     
    650668                        possibles.add(a.setter);
    651669                int i = 0;
    652                 while (_Attrib.containsKey(attribute + i)) {
    653                         Method m = _Attrib.get(attribute + i).setter;
     670                while (attribSet.containsKey(attribute + i)) {
     671                        Method m = attribSet.get(attribute + i).setter;
    654672                        if(m == null) {
    655673                                break;
     
    699717        private static Object invokeAttributeGetMethod(String name, Object toSet) {
    700718               
    701                 Attribute a = _Attrib.get(name.toLowerCase());
     719                AttributeSet attribSet = null;
     720                if(toSet instanceof Frame) {
     721                        attribSet = _FrameAttrib;
     722                } else if(toSet instanceof Item) {
     723                        attribSet = _Attrib;
     724                } else {
     725                        throw new IncorrectTypeException("toExtract", "Item | Frame");
     726                }
     727               
     728                Attribute a = attribSet.get(name.toLowerCase());
    702729                if(a == null) {
    703730                        return null;
Note: See TracChangeset for help on using the changeset viewer.