X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSeqPanel.java;h=4836915ff0b5ee6bc2e400ad5c8275fc7b6080aa;hb=497958b4e5217efaa3ddeece38f38c3a6e98cb96;hp=9c3d557af1c9ee6dea0ae5e7a7cc9d47aa4e737a;hpb=fc853e3c385e32591ceac07070d37932fcf87941;p=jalview.git
diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java
index 9c3d557..4836915 100644
--- a/src/jalview/gui/SeqPanel.java
+++ b/src/jalview/gui/SeqPanel.java
@@ -1,21 +1,23 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * 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.*;
@@ -31,6 +33,7 @@ import jalview.datamodel.*;
import jalview.io.SequenceAnnotationReport;
import jalview.schemes.*;
import jalview.structure.*;
+import jalview.util.MessageManager;
/**
* DOCUMENT ME!
@@ -129,8 +132,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);
}
@@ -223,42 +225,6 @@ public class SeqPanel extends JPanel implements MouseListener,
return seq;
}
- SequenceFeature[] findFeaturesAtRes(SequenceI sequence, int res)
- {
- Vector tmp = new Vector();
- SequenceFeature[] features = sequence.getSequenceFeatures();
- if (features != null)
- {
- for (int i = 0; i < features.length; i++)
- {
- if (av.featuresDisplayed == null
- || !av.featuresDisplayed.containsKey(features[i].getType()))
- {
- continue;
- }
-
- if (features[i].featureGroup != null
- && seqCanvas.fr.featureGroups != null
- && seqCanvas.fr.featureGroups
- .containsKey(features[i].featureGroup)
- && !((Boolean) seqCanvas.fr.featureGroups
- .get(features[i].featureGroup)).booleanValue())
- continue;
-
- if ((features[i].getBegin() <= res)
- && (features[i].getEnd() >= res))
- {
- tmp.addElement(features[i]);
- }
- }
- }
-
- features = new SequenceFeature[tmp.size()];
- tmp.copyInto(features);
-
- return features;
- }
-
void endEditing()
{
if (editCommand != null && editCommand.getSize() > 0)
@@ -307,7 +273,7 @@ public class SeqPanel extends JPanel implements MouseListener,
{
SequenceI sequence = av.getAlignment().getSequenceAt(seqCanvas.cursorY);
- seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1() - 1);
+ seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
scrollToVisible();
}
@@ -518,29 +484,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;
}
@@ -719,14 +690,14 @@ public class SeqPanel extends JPanel implements MouseListener,
}
// use aa to see if the mouse pointer is on a
- if (av.showSequenceFeatures)
+ if (av.isShowSequenceFeatures())
{
int rpos;
- SequenceFeature[] features = findFeaturesAtRes(
+ List features = ap.getFeatureRenderer().findFeaturesAtRes(
sequence.getDatasetSequence(),
rpos = sequence.findPosition(res));
seqARep.appendFeatures(tooltipText, rpos, features,
- this.ap.seqPanel.seqCanvas.fr.minmax);
+ this.ap.seqPanel.seqCanvas.fr.getMinMax());
}
if (tooltipText.length() == 6) //
{
@@ -942,7 +913,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 +926,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}));
}
}
@@ -1363,21 +1334,21 @@ public class SeqPanel extends JPanel implements MouseListener,
av.setSelectionGroup(null);
}
- SequenceFeature[] features = findFeaturesAtRes(
+ List features = seqCanvas.getFeatureRenderer().findFeaturesAtRes(
sequence.getDatasetSequence(),
sequence.findPosition(findRes(evt)));
- if (features != null && features.length > 0)
+ if (features != null && features.size()> 0)
{
SearchResults highlight = new SearchResults();
- highlight.addResult(sequence, features[0].getBegin(),
- features[0].getEnd());
+ highlight.addResult(sequence, features.get(0).getBegin(),
+ features.get(0).getEnd());
seqCanvas.highlightSearchResults(highlight);
}
- if (features != null && features.length > 0)
+ if (features != null && features.size()> 0)
{
seqCanvas.getFeatureRenderer().amendFeatures(new SequenceI[]
- { sequence }, features, false, ap);
+ { sequence }, features.toArray(new SequenceFeature[features.size()]), false, ap);
seqCanvas.highlightSearchResults(null);
}
@@ -1430,9 +1401,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;
}
@@ -1491,16 +1463,16 @@ public class SeqPanel extends JPanel implements MouseListener,
if (javax.swing.SwingUtilities.isRightMouseButton(evt))
{
- SequenceFeature[] allFeatures = findFeaturesAtRes(
+ List allFeatures = ap.getFeatureRenderer().findFeaturesAtRes(
sequence.getDatasetSequence(), sequence.findPosition(res));
Vector links = new Vector();
- for (int i = 0; i < allFeatures.length; i++)
+ for (SequenceFeature sf:allFeatures)
{
- if (allFeatures[i].links != null)
+ if (sf.links != null)
{
- for (int j = 0; j < allFeatures[i].links.size(); j++)
+ for (int j = 0; j < sf.links.size(); j++)
{
- links.addElement(allFeatures[i].links.elementAt(j));
+ links.addElement(sf.links.elementAt(j));
}
}
}