From: Peter W. <pw...@us...> - 2006-07-29 09:44:24
|
Update of /cvsroot/cob/COBEditor/src/edu/iastate/ato/gui/packageview In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23279/src/edu/iastate/ato/gui/packageview Modified Files: PackageTreeEditor.java PackageTree.java Log Message: Fixed reload bug: editing packages stay being edited after reload. Index: PackageTreeEditor.java =================================================================== RCS file: /cvsroot/cob/COBEditor/src/edu/iastate/ato/gui/packageview/PackageTreeEditor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PackageTreeEditor.java 27 Jul 2006 12:02:30 -0000 1.6 --- PackageTreeEditor.java 29 Jul 2006 09:41:06 -0000 1.7 *************** *** 2,5 **** --- 2,6 ---- import java.sql.Connection ; + import java.util.HashSet; import java.util.Vector ; *************** *** 41,45 **** { PackageTree thisTree ; ! public PackageTreeEditor(PackageTree tree, Connection db) { --- 42,48 ---- { PackageTree thisTree ; ! HashSet<String> editingPkg_OIDs = new HashSet<String>(); ! HashSet<PackageNode> editingPkgs = new HashSet<PackageNode>(); ! public PackageTreeEditor(PackageTree tree, Connection db) { *************** *** 49,52 **** --- 52,63 ---- } + public HashSet<String> getEditingPackageOIDs(){ + HashSet<String> rtnVal = new HashSet<String>(); + for(String s:editingPkg_OIDs){ + rtnVal.add(s); + } + return rtnVal; + } + protected void buildContextMenu(TypedNode selectedNode) { *************** *** 551,554 **** --- 562,571 ---- } + public void quitEditingAll(){ + for(PackageNode n:this.editingPkgs){ + quitEditing(n); + } + } + public void quitEditing(PackageNode thePackageNode) { *************** *** 565,568 **** --- 582,589 ---- thePackageNode.editing = false; thePackageNode.expanded = false; + + editingPkg_OIDs.remove(thePackageNode.getOid()); + editingPkgs.remove(thePackageNode); + UserManager.cancelEditing(db, thePackageNode.getOid(), MOEditor.user.name) ; *************** *** 591,594 **** --- 612,633 ---- } + /** + * Begin editing for a set of packages + * @param packages Vector - set of package oid + * @since 2005-07-25 + */ + public void beginEditing(HashSet<String> pkg_oids) + { + // search packages + Vector<PackageNode> e = thisTree.getAllPackage(); + for(PackageNode n : e) + { + if(pkg_oids.contains(n.getOid())){ + editPackage(n); + } + } + } + + public void editPackage(PackageNode node) { *************** *** 610,613 **** --- 649,655 ---- { node.editing = true; + editingPkg_OIDs.add(node.getOid()); + editingPkgs.add(node); + Debug.trace("You can edit terms in package '" + node.getLocalName() + "'") ; Index: PackageTree.java =================================================================== RCS file: /cvsroot/cob/COBEditor/src/edu/iastate/ato/gui/packageview/PackageTree.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PackageTree.java 18 Jul 2006 21:32:29 -0000 1.5 --- PackageTree.java 29 Jul 2006 09:41:06 -0000 1.6 *************** *** 3,7 **** import java.sql.Connection ; import java.util.Enumeration ; ! import java.util.Vector ; import edu.iastate.ato.gui.MOEditor ; --- 3,8 ---- import java.sql.Connection ; import java.util.Enumeration ; ! import java.util.HashSet; ! import java.util.Vector; import edu.iastate.ato.gui.MOEditor ; *************** *** 27,32 **** { this.db = db ; } ! /** * AddTerm --- 28,36 ---- { this.db = db ; + } ! ! ! /** * AddTerm *************** *** 105,108 **** --- 109,116 ---- return null ; } + + + + /** |