X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationPanel.java;h=2b2fdea5a7bdf4bf636ce6aa9d96554a038fe630;hb=c78840385a5ac9dd6d16a37aa7b55cfaeb360456;hp=417bb0672b27e87b2f6c151923ef7819452ceb4d;hpb=5899c15a3f3de3ab562970cf645c2b29b9ed7079;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 417bb06..2b2fdea 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -51,9 +51,9 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; -public class AnnotationPanel extends Panel implements AwtRenderPanelI, - AdjustmentListener, ActionListener, MouseListener, - MouseMotionListener, ViewportListenerI +public class AnnotationPanel extends Panel + implements AwtRenderPanelI, AdjustmentListener, ActionListener, + MouseListener, MouseMotionListener, ViewportListenerI { AlignViewport av; @@ -153,7 +153,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, if (anot.length < av.getColumnSelection().getMax()) { - Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2]; + Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + + 2]; System.arraycopy(anot, 0, temp, 0, anot.length); anot = temp; aa[activeRow].annotations = anot; @@ -287,8 +288,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, anot[index] = new Annotation(label, "", type, 0); } - anot[index].secondaryStructure = type != 'S' ? type : label - .length() == 0 ? ' ' : label.charAt(0); + anot[index].secondaryStructure = type != 'S' ? type + : label.length() == 0 ? ' ' : label.charAt(0); anot[index].displayCharacter = label; } } @@ -353,7 +354,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, } } - if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK + if ((evt.getModifiers() + & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK && activeRow != -1) { if (av.getColumnSelection() == null @@ -425,16 +427,20 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, { if (graphStretch > -1) { - av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - - evt.getY(); - if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0) + av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY + - evt.getY(); + if (av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight < 0) { - av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0; + av.getAlignment() + .getAlignmentAnnotation()[graphStretch].graphHeight = 0; } graphStretchY = evt.getY(); av.calcPanelHeight(); needValidating = true; - ap.paintAlignment(true); + // TODO: only update overview visible geometry + ap.paintAlignment(true, false); } else { @@ -509,18 +515,19 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, String name; if (av.getAlignment().isNucleotide()) { - name = ResidueProperties.nucleotideName.get(String - .valueOf(residue)); - text.append(" Nucleotide: ").append( - name != null ? name : residue); + name = ResidueProperties.nucleotideName + .get(String.valueOf(residue)); + text.append(" Nucleotide: ") + .append(name != null ? name : residue); } else { - name = 'X' == residue ? "X" : ('*' == residue ? "STOP" - : ResidueProperties.aa2Triplet.get(String - .valueOf(residue))); - text.append(" Residue: ").append( - name != null ? name : residue); + name = 'X' == residue ? "X" + : ('*' == residue ? "STOP" + : ResidueProperties.aa2Triplet + .get(String.valueOf(residue))); + text.append(" Residue: ") + .append(name != null ? name : residue); } int residuePos = seqref.findPosition(column); text.append(" (").append(residuePos).append(")"); @@ -626,8 +633,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, gg.setColor(Color.white); gg.fillRect(0, 0, getSize().width, getSize().height); - drawComponent(gg, av.getRanges().getStartRes(), av.getRanges() - .getEndRes() + 1); + drawComponent(gg, av.getRanges().getStartRes(), + av.getRanges().getEndRes() + 1); g.drawImage(image, 0, 0, this); } @@ -644,7 +651,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal * av.getCharWidth(), 0); - int sr = av.getRanges().getStartRes(), er = av.getRanges().getEndRes() + 1, transX = 0; + int sr = av.getRanges().getStartRes(), + er = av.getRanges().getEndRes() + 1, transX = 0; if (horizontal > 0) // scrollbar pulled right, image to the left { @@ -770,5 +778,10 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, { fastPaint((int) evt.getNewValue() - (int) evt.getOldValue()); } + else if (evt.getPropertyName().equals(ViewportRanges.STARTRESANDSEQ)) + { + fastPaint(((int[]) evt.getNewValue())[0] + - ((int[]) evt.getOldValue())[0]); + } } }