X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationLabels.java;h=1a9541c3794b0a2b44d34ca02bea69145b767270;hb=908fd2853ff088e3e3ad68ffc803b390d8d40d29;hp=92c6dc6e8b53820a245ef0f37f86b41963d3fa81;hpb=e2227e5cbd0772e74c24f9e5420a8427fae5ddac;p=jalview.git diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 92c6dc6..1a9541c 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -219,6 +219,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, AlignmentAnnotation[] aa = ap.av.getAlignment() .getAlignmentAnnotation(); + boolean fullRepaint = false; if (evt.getActionCommand().equals(ADDNEW)) { AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null, @@ -231,11 +232,16 @@ public class AnnotationLabels extends JPanel implements MouseListener, ap.av.getAlignment().addAnnotation(newAnnotation); ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0); + fullRepaint = true; } else if (evt.getActionCommand().equals(EDITNAME)) { + String name = aa[selectedRow].label; editLabelDescription(aa[selectedRow]); - repaint(); + if (!name.equalsIgnoreCase(aa[selectedRow].label)) + { + fullRepaint = true; + } } else if (evt.getActionCommand().equals(HIDE)) { @@ -245,6 +251,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { ap.av.getAlignment().deleteAnnotation(aa[selectedRow]); ap.av.getCalcManager().removeWorkerForAnnotation(aa[selectedRow]); + fullRepaint = true; } else if (evt.getActionCommand().equals(SHOWALL)) { @@ -255,6 +262,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, aa[i].visible = true; } } + fullRepaint = true; } else if (evt.getActionCommand().equals(OUTPUT_TEXT)) { @@ -283,18 +291,30 @@ public class AnnotationLabels extends JPanel implements MouseListener, aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel; } - refresh(); + refresh(fullRepaint); } /** * Redraw sensibly. + * + * @adjustHeight if true, try to recalculate panel height for visible + * annotations */ - protected void refresh() + protected void refresh(boolean adjustHeight) { - ap.validateAnnotationDimensions(false); + ap.validateAnnotationDimensions(adjustHeight); ap.addNotify(); - ap.repaint(); + if (adjustHeight) + { + // sort, repaint, update overview + ap.paintAlignment(true); + } + else + { + // lightweight repaint + ap.repaint(); + } } /** @@ -305,6 +325,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, */ boolean editLabelDescription(AlignmentAnnotation annotation) { + // TODO i18n EditNameDialog dialog = new EditNameDialog(annotation.label, annotation.description, " Annotation Name ", "Annotation Description ", "Edit Annotation Name/Description", @@ -398,7 +419,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, // ann.visible = false; // } // } - refresh(); + refresh(true); } }); pop.add(hideType); @@ -460,6 +481,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap); } + ap.alignmentChanged(); } }); pop.add(cbmi);