Changeset 23455

2010-12-13T13:24:20+13:00 (12 years ago)

Dr Bainbridge fixed the problem with the metadata data getting mixed up at random sometimes when moving folders in the CollectionTree. The metadata was previously getting mixed up in the MetadataValueTable because of a race condition/state inconsistency due to the table trying to update itself when the collection tree was getting updated: when nodes are selected in the tree, which happens on Tree refresh (including file/directory move operations), it fires a valueChanged event which the Table responds to. However, since the filenodes of the tree (and so their associated metadata) are in flux at that point, the table should hold off updating its metadata on such an occasion. The current fix is to clear the selection in the tree upon the drop event of a drag and drop in the tree: no nodes are selected, no selection changed events are fired, the table does not even get displayed because nothing is selected.

1 edited


  • main/trunk/gli/src/org/greenstone/gatherer/collection/

    r19239 r23455  
    2929import java.awt.*;
     30import java.awt.dnd.DropTargetDropEvent;
    3031import java.awt.event.*;
    3132import javax.swing.*;
    6970    }
     72    // Overridden here: when a successful drag and drop takes place
     73    // make sure nothing is selected in the tree, so that no valueChanged()
     74    // event gets fired anymore by items getting reselected in the tree
     75    // (this  used to result in the metadata table in EnrichPane being updated
     76    // upon its valueChanged() getting called and funny things happened to
     77    // the metadata due to state inconsistencies).
     78    public void drop(DropTargetDropEvent event) {
     79        if (!isDroppable()) {
     80            return;
     81        }
     83        setImmediate(true);
     84        clearSelection();
     85        setImmediate(false);
     87        // let the superclass' drop() process the rest of the drag event
     88        super.drop(event);
     90    }
    7292    public void mouseClicked(MouseEvent event)
Note: See TracChangeset for help on using the changeset viewer.