From: Mark G. <mg...@us...> - 2004-04-01 17:26:23
|
Update of /cvsroot/gmod/apollo/src/java/apollo/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27262/src/java/apollo/gui Modified Files: AnnotationEditor.java Log Message: So i tried to fix the bug where ya cant switch result to opposite strand if no feats of that type exist on that strand. This turned out to be much more complicated than i thought it would be, so its not fixed, but i did make a lot of progress and thats what im commiting. Where it fell short is that the AnnotationEditor has to send out a new kind of ResultChangeEvent that would prompt the view/tier manager to create a new tier. I dont think this functionality is there. At some point this needs to be revisited and that functionality needs to be added to ResultView.handleResultChangeEvent with a new event type like ADD_TIER or something like that. Sorry to leave this undone, but theres just higher priority stuff at the moment. If a user hits this bug they get a popup telling them to email us (i think a popup is warranted here) - in theory this will be a rare event, but we should hear otherwise if its not. Index: AnnotationEditor.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/gui/AnnotationEditor.java,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** AnnotationEditor.java 14 Mar 2004 03:15:31 -0000 1.153 --- AnnotationEditor.java 1 Apr 2004 17:14:20 -0000 1.154 *************** *** 1099,1105 **** /** Should this be a util function? boolean for a popup?*/ ! private void errorMsgWithStackTrace(String errMsg) { ! errMsg="Programmer error: "+errMsg ! +" Here is a stack trace for an apollo programmer to use for debugging:"; System.err.println(errMsg); new Throwable().printStackTrace(); --- 1099,1107 ---- /** Should this be a util function? boolean for a popup?*/ ! private void errorMsgWithStackTrace(String errMsg,boolean popup) { ! errMsg="Programmer error: "+errMsg; ! if (popup) ! JOptionPane.showMessageDialog(null,errMsg); ! errMsg += " Here is a stack trace for an apollo programmer to use for debugging:"; System.err.println(errMsg); new Throwable().printStackTrace(); *************** *** 1124,1139 **** FeatureSetI feature = (FeatureSetI) features.elementAt(i); FeatureSetI parent = (FeatureSetI) feature.getRefFeature(); - // if parent does not have an analogous opposite strand feature, there - // is no way we can do the flip. This is a programmer error. The - // data adapter needs to set this (see GAMEAdapter.addAnalysis) - if (!parent.hasAnalogousOppositeStrandFeatureSet()) { - String m = ("Cannot place feature on opposite strand. " + - "Parent of feature has not had its analogous opposite " + - "strand feature set. Either move to opp strand should " + - "be disallowed or the data adapter needs to set the " + - "analogous opposite strand feature."); - errorMsgWithStackTrace(m); - return; - } parent.deleteFeature (feature); // removes data model ResultChangeEvent rm_evt --- 1126,1129 ---- *************** *** 1149,1153 **** feature.flipFlop(); // changes strand ! FeatureSetI newParent = parent.getAnalogousOppositeStrandFeatureSet(); newParent.addFeature (feature, true); --- 1139,1158 ---- feature.flipFlop(); // changes strand ! ! SeqFeatureI newParent = parent.getAnalogousOppositeStrandFeature(); ! // if parent does not have an analogous opposite strand feature, there ! // is no way we can do the flip. This is a programmer error. The ! // data adapter needs to set this (see GAMEAdapter.addAnalysis) ! // no longer true - just create new op strand fs ! if (!parent.hasAnalogousOppositeStrandFeature()) { // newParent==null ! //newParent = createOppositeStrandAnalysisFeature(parent); // workinprogress ! String m = "You have hit a known apollo bug. You can not presently move\n" ! +"features to a strand that doesnt have any features of that type, in\n" ! +"other words features of this type exist on one strand but not the other.\n" ! +"Currently we deem this bug low priority and a rare case. Please email\n" ! +"ap...@fr... to have this bug fixed.\n"; ! errorMsgWithStackTrace(m,true); ! return; ! } newParent.addFeature (feature, true); *************** *** 1187,1190 **** --- 1192,1234 ---- } + /** Creates analysis feature for opposite strand of analysis feat + For now creates name of analysis in GAME style "program:db-strand" - should probably + name adapter this at some point - but probably not really critical + This doesnt work yet but its getting close - need to revisit. Need to tell + view/drawables that it needs to create a whole new tier - i dont think + theres presently a way to do that. + */ + private SeqFeatureI createOppositeStrandAnalysisFeature(SeqFeatureI analysis) { + SeqFeatureI oppositeAnalysis = analysis.cloneFeature(); + oppositeAnalysis.setStrand(analysis.getStrand() * -1); + // Yikes - this is data/name adapter specific isnt it? + // cant retrieve a name adapter for a non-annot - shouldnt we be able to? + //ApolloNameAdapterI na = Config.getNameAdapter(analysis); + // for now just gonna do name like game does it (GAMEAdapter.initAnalysis) - + //should revisit this - on the other hand the name of the analysis is + //probably not that important + String n = analysis.getProgramName()+":"+analysis.getDatabase(); + n += oppositeAnalysis.isForwardStrand() ? "-plus" : "-minus"; + oppositeAnalysis.setName(n); + // add to data model - ref ref feat is result stranded feature set + // this doesnt work - view/drawables doesnt know the results stranded feat set + SeqFeatureI results = analysis.getRefFeature().getRefFeature(); + results.addFeature(oppositeAnalysis); + // set analogous feats + analysis.setAnalogousOppositeStrandFeature(oppositeAnalysis); + oppositeAnalysis.setAnalogousOppositeStrandFeature(analysis); + // this causes exception to fly as view doesnt know results model - FIX + ResultChangeEvent add_evt + = new ResultChangeEvent(this, + results, + FeatureChangeEvent.ADD, + ResultChangeEvent.RESULTSET, + results, + oppositeAnalysis); + getController().handleResultChangeEvent(add_evt); + return oppositeAnalysis; + } + + /** * Determine if the current selection sets are compatible with the |