X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FSeqPanel.java;h=3b416208ab8d19dfd97ba435e9c38a3cf7d9fd27;hb=b8810711642d8473325c8a3d3e76cc5c3c9b5bbd;hp=938d48ca7b752f076c91ee222387936cc5936f3f;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 938d48c..3b41620 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1,36 +1,57 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.gui; -import java.util.*; +import jalview.commands.EditCommand; +import jalview.commands.EditCommand.Action; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SearchResults; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.SequenceAnnotationReport; +import jalview.schemes.ResidueProperties; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.SequenceListener; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; import java.util.List; +import java.util.Vector; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - -import jalview.commands.*; -import jalview.datamodel.*; -import jalview.io.SequenceAnnotationReport; -import jalview.schemes.*; -import jalview.structure.*; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.ToolTipManager; /** * DOCUMENT ME! @@ -129,8 +150,7 @@ public class SeqPanel extends JPanel implements MouseListener, addMouseMotionListener(this); addMouseListener(this); addMouseWheelListener(this); - ssm = StructureSelectionManager - .getStructureSelectionManager(Desktop.instance); + ssm = av.getStructureSelectionManager(); ssm.addStructureViewerListener(this); ssm.addSelectionListener(this); } @@ -243,7 +263,9 @@ public class SeqPanel extends JPanel implements MouseListener, .containsKey(features[i].featureGroup) && !((Boolean) seqCanvas.fr.featureGroups .get(features[i].featureGroup)).booleanValue()) + { continue; + } if ((features[i].getBegin() <= res) && (features[i].getEnd() >= res)) @@ -518,29 +540,34 @@ public class SeqPanel extends JPanel implements MouseListener, int getKeyboardNo1() { - try { - if (keyboardNo1 != null) + try { - int value = Integer.parseInt(keyboardNo1.toString()); - keyboardNo1 = null; - return value; - } + if (keyboardNo1 != null) + { + int value = Integer.parseInt(keyboardNo1.toString()); + keyboardNo1 = null; + return value; + } } catch (Exception x) - {} + { + } keyboardNo1 = null; return 1; } int getKeyboardNo2() { - try { - if (keyboardNo2!=null){ - int value = Integer.parseInt(keyboardNo2.toString()); - keyboardNo2 = null; - return value; - } + try + { + if (keyboardNo2 != null) + { + int value = Integer.parseInt(keyboardNo2.toString()); + keyboardNo2 = null; + return value; + } } catch (Exception x) - {} + { + } keyboardNo2 = null; return 1; } @@ -688,7 +715,9 @@ public class SeqPanel extends JPanel implements MouseListener, pos = setStatusMessage(sequence, res, seq); if (ssm != null && pos > -1) + { mouseOverSequence(sequence, res, pos); + } tooltipText.setLength(6); // Cuts the buffer back to @@ -739,7 +768,8 @@ public class SeqPanel extends JPanel implements MouseListener, if (lastTooltip == null || !lastTooltip.equals(tooltipText.toString())) { - setToolTipText(tooltipText.toString()); + setToolTipText(JvSwingUtils.wrapTooltip(true, + tooltipText.toString())); lastTooltip = tooltipText.toString(); } @@ -942,7 +972,7 @@ public class SeqPanel extends JPanel implements MouseListener, message.append("Edit group:"); if (editCommand == null) { - editCommand = new EditCommand("Edit Group"); + editCommand = new EditCommand(MessageManager.getString("action.edit_group")); } } else @@ -955,7 +985,7 @@ public class SeqPanel extends JPanel implements MouseListener, } if (editCommand == null) { - editCommand = new EditCommand("Edit " + label); + editCommand = new EditCommand(MessageManager.formatMessage("label.edit_params", new String[]{label})); } } @@ -1161,7 +1191,7 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs, + editCommand.appendEdit(Action.INSERT_GAP, groupSeqs, startres, startres - lastres, av.getAlignment(), true); } } @@ -1177,7 +1207,7 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs, + editCommand.appendEdit(Action.DELETE_GAP, groupSeqs, startres, lastres - startres, av.getAlignment(), true); } @@ -1199,7 +1229,7 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[] + editCommand.appendEdit(Action.INSERT_GAP, new SequenceI[] { seq }, lastres, startres - lastres, av.getAlignment(), true); } } @@ -1236,7 +1266,7 @@ public class SeqPanel extends JPanel implements MouseListener, if (max > 0) { - editCommand.appendEdit(EditCommand.DELETE_GAP, + editCommand.appendEdit(Action.DELETE_GAP, new SequenceI[] { seq }, startres, max, av.getAlignment(), true); } @@ -1254,7 +1284,7 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - editCommand.appendEdit(EditCommand.INSERT_NUC, new SequenceI[] + editCommand.appendEdit(Action.INSERT_NUC, new SequenceI[] { seq }, lastres, startres - lastres, av.getAlignment(), true); } } @@ -1290,10 +1320,10 @@ public class SeqPanel extends JPanel implements MouseListener, } } - editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1, + editCommand.appendEdit(Action.DELETE_GAP, seq, blankColumn, 1, av.getAlignment(), true); - editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, + editCommand.appendEdit(Action.INSERT_GAP, seq, j, 1, av.getAlignment(), true); } @@ -1301,10 +1331,10 @@ public class SeqPanel extends JPanel implements MouseListener, void deleteChar(int j, SequenceI[] seq, int fixedColumn) { - editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, + editCommand.appendEdit(Action.DELETE_GAP, seq, j, 1, av.getAlignment(), true); - editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1, + editCommand.appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1, av.getAlignment(), true); } @@ -1430,9 +1460,10 @@ public class SeqPanel extends JPanel implements MouseListener, if (av.wrapAlignment && seq > av.getAlignment().getHeight()) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "Cannot edit annotations in wrapped view.", - "Wrapped view - no edit", JOptionPane.WARNING_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .getString("label.cannot_edit_annotations_in_wrapped_view"), + MessageManager.getString("label.wrapped_view_no_edit"), + JOptionPane.WARNING_MESSAGE); return; }