/** Does all the handle selection checks for BaseFineEditor and BaseEditorPanel */ boolean canHandleSelection(FeatureSelectionEvent evt, Object self) { if ((noExternalSelection() && isExternalSelection(evt)) && !evt.forceSelection()) return false; if (evt.getSource() == self) return false; if (!this.isVisible()) return false; if (evt.getFeatures().size() == 0) return false; SeqFeatureI sf = evt.getFeatures().getFeature(0); // if strand of selection is not our strand return boolean is_reverse = (sf.getStrand() == -1); if (is_reverse != editorPanel.getReverseStrand()) return false; if (!(sf instanceof AnnotatedFeatureI)) return false; // repaint transVw? else return true; }
/** * Handle the selection event (feature was selected in another window--select it here) This is * also where selections from BaseFineEditor come in which are really internal selections. Only * handle external selection if followSelection is checked */ public boolean handleFeatureSelectionEvent(FeatureSelectionEvent evt) { if (!canHandleSelection(evt, this)) return false; // now we do something, canHanSel filters for GenAnnIs AnnotatedFeatureI gai = (AnnotatedFeatureI) evt.getFeatures().getFeature(0); displayAnnot(getTransOrOneLevelAnn(gai)); translationViewer.repaint(); return true; }
/** True if the selection comes from outside world. false if from this OR editorPanel */ private boolean isExternalSelection(FeatureSelectionEvent e) { if (e.getSource() == this || e.getSource() == editorPanel) return false; return true; }
/** rue if the selection comes from outside world. false if from this OR editorPanel */ private boolean isExternalSelection(FeatureSelectionEvent e) { return e.getSource() != this; }