X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationLabels.java;h=09624a80ac779a1cab0f2aef87cf56793575441e;hb=747167089ecf8d6afc70d417f5a20352e029bd95;hp=673f04dd2ca672bd6a21e1a05011318969315b03;hpb=586ade46bdcd05ff028a1cff82c3c527326d28ec;p=jalview.git diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 673f04d..09624a8 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -20,6 +20,24 @@ */ package jalview.gui; +import java.util.Locale; + +import jalview.analysis.AlignSeq; +import jalview.analysis.AlignmentUtils; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.HiddenColumns; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.FileFormat; +import jalview.io.FormatAdapter; +import jalview.util.Comparison; +import jalview.util.MessageManager; +import jalview.util.Platform; +import jalview.workers.InformationThread; + import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; @@ -47,22 +65,6 @@ import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.ToolTipManager; -import jalview.analysis.AlignSeq; -import jalview.analysis.AlignmentUtils; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.Annotation; -import jalview.datamodel.HiddenColumns; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.io.FileFormat; -import jalview.io.FormatAdapter; -import jalview.util.Comparison; -import jalview.util.MessageManager; -import jalview.util.Platform; -import jalview.workers.InformationThread; - /** * The panel that holds the labels for alignment annotations, providing * tooltips, context menus, drag to reorder rows, and drag to adjust panel @@ -136,7 +138,7 @@ public class AnnotationLabels extends JPanel */ public AnnotationLabels(AlignmentPanel ap) { - + this.ap = ap; av = ap.av; ToolTipManager.sharedInstance().registerComponent(this); @@ -292,27 +294,26 @@ public class AnnotationLabels extends JPanel EditNameDialog dialog = new EditNameDialog(annotation.label, annotation.description, name, description); - dialog.showDialog(ap.alignFrame, title, - new Runnable() - { - @Override - public void run() - { - annotation.label = dialog.getName(); - String text = dialog.getDescription(); - if (text != null && text.length() == 0) - { - text = null; - } - annotation.description = text; - if (addNew) - { - ap.av.getAlignment().addAnnotation(annotation); - ap.av.getAlignment().setAnnotationIndex(annotation, 0); - } - ap.refresh(true); - } - }); + dialog.showDialog(ap.alignFrame, title, new Runnable() + { + @Override + public void run() + { + annotation.label = dialog.getName(); + String text = dialog.getDescription(); + if (text != null && text.length() == 0) + { + text = null; + } + annotation.description = text; + if (addNew) + { + ap.av.getAlignment().addAnnotation(annotation); + ap.av.getAlignment().setAnnotationIndex(annotation, 0); + } + ap.refresh(true); + } + }); } @Override @@ -353,10 +354,8 @@ public class AnnotationLabels extends JPanel pop.show(this, evt.getX(), evt.getY()); return; } - final AlignmentAnnotation ann = aa[selectedRow]; final boolean isSequenceAnnotation = ann.sequenceRef != null; - item = new JMenuItem(EDITNAME); item.addActionListener(this); pop.add(item); @@ -600,8 +599,7 @@ public class AnnotationLabels extends JPanel * @param pop */ static void addConsensusMenuOptions(AlignmentPanel ap, - AlignmentAnnotation ann, - JPopupMenu pop) + AlignmentAnnotation ann, JPopupMenu pop) { pop.addSeparator(); @@ -918,12 +916,12 @@ public class AnnotationLabels extends JPanel // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature // tooltips String desc = aa.getDescription(true).trim(); - if (!desc.toLowerCase().startsWith(HTML_START_TAG)) + if (!desc.toLowerCase(Locale.ROOT).startsWith(HTML_START_TAG)) { tooltip.append(HTML_START_TAG); desc = desc.replace("<", "<"); } - else if (desc.toLowerCase().endsWith(HTML_END_TAG)) + else if (desc.toLowerCase(Locale.ROOT).endsWith(HTML_END_TAG)) { desc = desc.substring(0, desc.length() - HTML_END_TAG.length()); } @@ -1090,6 +1088,7 @@ public class AnnotationLabels extends JPanel PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); ap.av.sendSelection(); } + } } return; @@ -1153,6 +1152,7 @@ public class AnnotationLabels extends JPanel @Override public void paintComponent(Graphics g) { + int width = getWidth(); if (width == 0) { @@ -1167,6 +1167,7 @@ public class AnnotationLabels extends JPanel } drawComponent(g2, true, width); + } /**