From: <mg...@us...> - 2006-11-10 21:48:30
|
Revision: 197 http://svn.sourceforge.net/obo/?rev=197&view=rev Author: mgibson Date: 2006-11-10 13:48:24 -0800 (Fri, 10 Nov 2006) Log Message: ----------- preserving order on undo for bulk delete its sorta funny if ya dont Modified Paths: -------------- phenote/trunk/conf/initial-flybase.cfg phenote/trunk/conf/initial-zfin.cfg phenote/trunk/src/java/phenote/datamodel/CharacterList.java phenote/trunk/src/java/phenote/datamodel/CharacterListI.java phenote/trunk/src/java/phenote/edit/CompoundTransaction.java phenote/trunk/src/java/phenote/edit/DeleteTransaction.java Modified: phenote/trunk/conf/initial-flybase.cfg =================================================================== --- phenote/trunk/conf/initial-flybase.cfg 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/conf/initial-flybase.cfg 2006-11-10 21:48:24 UTC (rev 197) @@ -2,6 +2,7 @@ <phenote-configuration version="0.8" xmlns="phenote/config/xml"> <dataadapter name="phenosyntax"/> + <dataadapter name="phenoxml"/> <log config-file="conf/log4j-standalone.xml" /> Modified: phenote/trunk/conf/initial-zfin.cfg =================================================================== --- phenote/trunk/conf/initial-zfin.cfg 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/conf/initial-zfin.cfg 2006-11-10 21:48:24 UTC (rev 197) @@ -1,6 +1,7 @@ <phenote-configuration version="0.8" xmlns="phenote/config/xml"> <dataadapter name="phenosyntax"/> + <dataadapter name="phenoxml"/> <log config-file="conf/log4j.xml"/> Modified: phenote/trunk/src/java/phenote/datamodel/CharacterList.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/datamodel/CharacterList.java 2006-11-10 21:48:24 UTC (rev 197) @@ -15,9 +15,11 @@ public CharacterI get(int i) { return characterList.get(i); } public void add(CharacterI c) { characterList.add(c); } + public void add(int i, CharacterI c) {characterList.add(i,c); } public void remove(int i) { characterList.remove(i); } public void remove(CharacterI c) { characterList.remove(c); } public int size() { return characterList.size(); } + public int indexOf(CharacterI c) { return characterList.indexOf(c); } public List<CharacterI> getList() { return characterList; } public boolean equals(CharacterListI cl) { Modified: phenote/trunk/src/java/phenote/datamodel/CharacterListI.java =================================================================== --- phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/datamodel/CharacterListI.java 2006-11-10 21:48:24 UTC (rev 197) @@ -10,9 +10,11 @@ public CharacterI get(int i); public void add(CharacterI c); + public void add(int order,CharacterI c); public void remove(int i); public void remove(CharacterI c); public int size(); + public int indexOf(CharacterI c); public List<CharacterI> getList(); public boolean equals(CharacterListI cl); /** Sort data by char field enum field */ Modified: phenote/trunk/src/java/phenote/edit/CompoundTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/edit/CompoundTransaction.java 2006-11-10 21:48:24 UTC (rev 197) @@ -56,8 +56,12 @@ } public void undo() { - for (TransactionI childTrans : childTransactions) - childTrans.undo(); + // actually i think for undo it should be done in reverse - this actually + // matters for delete getting order correct + //for (TransactionI childTrans : childTransactions) + //childTrans.undo(); + for (int i=childTransactions.size()-1; i>=0; i--) + childTransactions.get(i).undo(); } List<TransactionI> getTransactions() { return childTransactions; } Modified: phenote/trunk/src/java/phenote/edit/DeleteTransaction.java =================================================================== --- phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2006-11-10 21:18:30 UTC (rev 196) +++ phenote/trunk/src/java/phenote/edit/DeleteTransaction.java 2006-11-10 21:48:24 UTC (rev 197) @@ -8,14 +8,20 @@ class DeleteTransaction implements TransactionI { private CharacterI delChar; + // remember where the char was in the list for undo + private int listOrder; DeleteTransaction(CharacterI c) { delChar = c; } public void editModel() { + listOrder = getCharList().indexOf(delChar); getCharList().remove(delChar); } - public void undo() { getCharList().add(delChar); } + // this doesnt put it where it came from on bulk delete as its getting reentered in + // opposite order it got deleted - maybe compound trans should be aware and do kids + // in reverse on undo? - actually thats general + public void undo() { getCharList().add(listOrder,delChar); } public boolean isUpdate() { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |