From: jprocter Date: Wed, 29 Aug 2012 15:27:17 +0000 (+0100) Subject: formatting X-Git-Tag: Jalview_2_9~375 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3beb22d0e20da65b123d44039a9f1e8bc8690f5e;p=jalview.git formatting --- diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 665537c..319dcf4 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -144,7 +144,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, void getSelectedRow(int y) { int height = 0; - AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] aa = ap.av.getAlignment() + .getAlignmentAnnotation(); selectedRow = -2; if (aa != null) { @@ -176,7 +177,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, */ public void actionPerformed(ActionEvent evt) { - AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] aa = ap.av.getAlignment() + .getAlignmentAnnotation(); if (evt.getActionCommand().equals(ADDNEW)) { @@ -245,8 +247,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, ap.validateAnnotationDimensions(false); ap.addNotify(); ap.repaint(); - //validate(); - //ap.paintAlignment(true); + // validate(); + // ap.paintAlignment(true); } /** @@ -312,7 +314,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, { end = ap.av.getAlignment().getAlignmentAnnotation().length - 1; } - AlignmentAnnotation endAA = ap.av.getAlignment().getAlignmentAnnotation()[end]; + AlignmentAnnotation endAA = ap.av.getAlignment() + .getAlignmentAnnotation()[end]; ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA; ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA; @@ -405,40 +408,51 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (selectedRow > -1 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow) { - AlignmentAnnotation aa = ap.av.getAlignment().getAlignmentAnnotation()[selectedRow]; - + AlignmentAnnotation aa = ap.av.getAlignment() + .getAlignmentAnnotation()[selectedRow]; + StringBuffer desc = new StringBuffer(); if (aa.description != null && !aa.description.equals("New description")) { - // TODO: we could refactor and merge this code with the code in jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature tooltips + // TODO: we could refactor and merge this code with the code in + // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature + // tooltips desc.append(aa.getDescription(true).trim()); // check to see if the description is an html fragment. - if (desc.length()<6 || (desc.substring(0,6).toLowerCase().indexOf("")<0)) + if (desc.length() < 6 + || (desc.substring(0, 6).toLowerCase().indexOf("") < 0)) { // clean the description ready for embedding in html - desc = new StringBuffer(Pattern.compile("<").matcher(desc).replaceAll("<")); + desc = new StringBuffer(Pattern.compile("<").matcher(desc) + .replaceAll("<")); desc.insert(0, ""); - } else { - // remove terminating html if any - int i=desc.substring(desc.length()-7).toLowerCase().lastIndexOf(""); - if (i>-1) { - desc.setLength(desc.length()-7+i); - } + } + else + { + // remove terminating html if any + int i = desc.substring(desc.length() - 7).toLowerCase() + .lastIndexOf(""); + if (i > -1) + { + desc.setLength(desc.length() - 7 + i); + } } if (aa.hasScore()) { desc.append("
"); } - - - } else { + + } + else + { // begin the tooltip's html fragment desc.append(""); } if (aa.hasScore()) { - // TODO: limit precision of score to avoid noise from imprecise doubles (64.7 becomes 64.7+/some tiny value). + // TODO: limit precision of score to avoid noise from imprecise doubles + // (64.7 becomes 64.7+/some tiny value). desc.append(" Score: " + aa.score); } @@ -461,7 +475,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, */ public void mouseClicked(MouseEvent evt) { - AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] aa = ap.av.getAlignment() + .getAlignmentAnnotation(); if (SwingUtilities.isLeftMouseButton(evt)) { if (selectedRow > -1 && selectedRow < aa.length) @@ -470,7 +485,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, { if (evt.getClickCount() >= 2) { - // todo: make the ap scroll to the selection - not necessary, first click highlights/scrolls, second selects + // todo: make the ap scroll to the selection - not necessary, first + // click highlights/scrolls, second selects ap.seqPanel.ap.idPanel.highlightSearchResults(null); ap.av.setSelectionGroup(// new SequenceGroup( aa[selectedRow].groupRef); // ); @@ -638,7 +654,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { public void actionPerformed(ActionEvent e) { - + // TODO: pass on reference // to ap // so the