/** Performs the update */ public void actionPerformed(ActionEvent e) { // TODO check that the basepair is within the bounds of an exon if (basepair < 0 || feature == null) { throw new IllegalArgumentException("basepair:" + basepair + " feature:" + feature); } annotationEditor.setSelections(null, null, null, null); annotationEditor.setTranslationStart((ExonI) feature, basepair); curationState.getSZAP().repaint(); // TODO repaint all msa's }
/** * If right mouse deselect base If end of feature drag notify AnnotationEditor (endRangeChange) * and recalc translation end from start */ public void mouseReleased(MouseEvent e) { // RIGHT MOUSE CLICK if (MouseButtonEvent.isRightMouseClick(e)) { BaseRenderer rend = baseEditorPanel.getRendererAt(tier); if (rend instanceof SelectableDNARenderer) { ((SelectableDNARenderer) rend).setTargetPos(-1, -1); baseEditorPanel.repaint(); } } // SEQ SELECT DRAG if (dragType == baseEditorPanel.SEQ_SELECT_DRAG) { SequenceI seq = baseEditorPanel.getSequenceForTier(startDragTier); int lowBP = baseEditorPanel.posToResidue(baseEditorPanel.selectLowPos()); int highBP = baseEditorPanel.posToResidue(baseEditorPanel.selectHighPos()); String sequence = seq.getResidues(lowBP, highBP); String header = " Arbitrary selection (" + seq.getName() + ": " + lowBP + "," + highBP + ")"; // controllingWindow.copySeqToClipboard(new Sequence (header, sequence)); ClipboardUtil.copySeqToClipboard(new Sequence(header, sequence)); resetDragState(); baseEditorPanel.repaint(); return; } // NOT SEQ SELECT DRAG else { // NOT DRAGGING - RETURN if (!MouseButtonEvent.isLeftMouseClick(e) || !dragging || dragFeature == null) { resetDragState(); return; } // DRAGGING ANNOT ENDS if (dragging && dragFeature != null && dragFeature.isAnnot()) { // NOTIFY ANNOTATION EDITOR (generates transaction) int oldStart = (preDragStartBasePair == -1) ? dragFeature.getStart() : preDragStartBasePair; int oldEnd = (preDragEndBasePair == -1) ? dragFeature.getEnd() : preDragEndBasePair; AnnotationEditor ae = baseEditorPanel.getAnnotationEditor(); ae.setAnnotTerminus( dragFeature.getAnnotatedFeature(), oldStart, oldEnd, dragFeature.getStart(), dragFeature.getEnd()); // RECALC CDS (if exon/transcript - not for 1 level annots) if (dragFeature.isExon() && dragFeature.getRefFeature() != null && (dragFeature.getRefFeature().isTranscript())) { // ExonI exon = (ExonI)dragFeature; // Transcript t = (Transcript)exon.getRefFeature(); SeqFeatureI transcript = dragFeature.getRefFeature(); TranslationI cds = transcript.getTranslation(); int transStart = transcript.getStart(); int cdsStart = cds.getTranslationStart(); boolean isForward = transcript.isForwardStrand(); if (cds.isMissing5prime() && ((isForward && transStart < cdsStart) || (!isForward && transStart > cdsStart))) { cds.calcTranslationStartForLongestPeptide(); // missing start } else { cds.setTranslationEndFromStart(); // got start - set end } } baseEditorPanel.repaint(); } } resetDragState(); baseEditorPanel.getCurationState().getSZAP().repaint(); }
public void actionPerformed(ActionEvent e) { // System.out.println("Calling editor.addNewAnnot(" + e.getActionCommand() + ")"); // DEL // getActionCommand returns the type the user selected from the menu editor.addNewAnnot(e.getActionCommand()); }