Changeset 4521


Ignore:
Timestamp:
2003-06-09T13:03:43+12:00 (21 years ago)
Author:
mdewsnip
Message:

Changed away from using SynchronizedTreeModelTools, for the moment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/valuetree/GValueModel.java

    r4513 r4521  
    111111        }
    112112        value_node = new GValueNode(new_subject);
     113        System.err.println("(GValueModel) addValue()... " + value_node);
     114       
     115        // Figure out where this node will be inserted in subjects
     116        // children.
     117        int position = -1;
     118        for(int i = 0; position == -1 && i < subject.getChildCount(); i++) {
     119        Object sibling = subject.getChildAt(i);
     120        int rel_pos = value.compareTo(sibling.toString());
     121        ///ystem.err.println("'"+value+"'.compareTo('"+sibling+"') = " + rel_pos);
     122        if(rel_pos <= 0) {
     123            position = i;
     124        }
     125        }
     126        if(position == -1) {
     127        position = subject.getChildCount();
     128        }
    113129        // Insert it. If position is still -1, append it to the end of subjects children.
    114         //SynchronizedTreeModelTools.insertNodeInto(this, subject, value_node);
    115         insertNodeInto(value_node, subject, 0);
     130        ///ystem.err.println("Inserting '" + value + "' at position " + position);
     131        insertNodeInto(value_node, subject, position);
     132        // System.err.println("(GValueModel) Done insert node into...");
     133        // SynchronizedTreeModelTools.insertNodeInto(this, subject, value_node);
    116134        // Inform listeners that we've changed.
    117135        Gatherer.c_man.getCollection().msm.fireValueChanged(element, null, this);
Note: See TracChangeset for help on using the changeset viewer.