X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=2f6e3e401d534283f9a6a9e0562f54945a1a9657;hb=480d7b96f089281a3caf77d2a4e5adec09dc5bfa;hp=8ade5d690648ee799b1b4b6c8e31970f63019770;hpb=3d2b5edf9ea33c6ebbde4717ccc14f03554fb6f0;p=jalview.git
diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java
index 8ade5d6..2f6e3e4 100644
--- a/src/jalview/gui/AlignmentPanel.java
+++ b/src/jalview/gui/AlignmentPanel.java
@@ -25,6 +25,7 @@ import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
@@ -33,6 +34,7 @@ import jalview.jbgui.GAlignmentPanel;
import jalview.math.AlignmentDimension;
import jalview.schemes.ResidueProperties;
import jalview.structure.StructureSelectionManager;
+import jalview.util.Comparison;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.viewmodel.ViewportRanges;
@@ -106,6 +108,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
private PropertyChangeListener propertyChangeListener;
+ private CalculationChooser calculationDialog;
+
/**
* Creates a new AlignmentPanel object.
*
@@ -169,6 +173,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
{
av.alignmentChanged(this);
+ if (getCalculationDialog() != null)
+ {
+ getCalculationDialog().validateCalcTypes();
+ }
+
alignFrame.updateEditMenuBar();
paintAlignment(true);
@@ -395,11 +404,12 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
if (av.hasHiddenColumns())
{
- start = av.getColumnSelection().findColumnPosition(start);
- end = av.getColumnSelection().findColumnPosition(end);
+ HiddenColumns hidden = av.getAlignment().getHiddenColumns();
+ start = hidden.findColumnPosition(start);
+ end = hidden.findColumnPosition(end);
if (start == end)
{
- if (!av.getColumnSelection().isVisible(r[0]))
+ if (!hidden.isVisible(r[0]))
{
// don't scroll - position isn't visible
return false;
@@ -704,7 +714,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
if (av.hasHiddenColumns())
{
// reset the width to exclude hidden columns
- width = av.getColumnSelection().findColumnPosition(width);
+ width = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(width);
}
hextent = getSeqPanel().seqCanvas.getWidth() / av.getCharWidth();
@@ -917,7 +928,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
if (av.hasHiddenColumns())
{
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ maxwidth = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(maxwidth) - 1;
}
int canvasWidth = getSeqPanel().seqCanvas
@@ -1205,7 +1217,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
int maxwidth = av.getAlignment().getWidth();
if (av.hasHiddenColumns())
{
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ maxwidth = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(maxwidth) - 1;
}
int resWidth = getSeqPanel().seqCanvas.getWrappedCanvasWidth(pwidth
@@ -1399,7 +1412,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
int maxwidth = av.getAlignment().getWidth();
if (av.hasHiddenColumns())
{
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
+ maxwidth = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(maxwidth);
}
int height = ((av.getAlignment().getHeight() + 1) * av.getCharHeight())
@@ -1482,11 +1496,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
sy = s * av.getCharHeight() + scaleHeight;
SequenceI seq = av.getAlignment().getSequenceAt(s);
- SequenceFeature[] features = seq.getSequenceFeatures();
SequenceGroup[] groups = av.getAlignment().findAllGroups(seq);
for (res = 0; res < alwidth; res++)
{
- StringBuilder text = new StringBuilder();
+ StringBuilder text = new StringBuilder(512);
String triplet = null;
if (av.getAlignment().isNucleotide())
{
@@ -1504,7 +1517,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
continue;
}
- int alIndex = seq.findPosition(res);
+ int seqPos = seq.findPosition(res);
gSize = groups.length;
for (g = 0; g < gSize; g++)
{
@@ -1516,7 +1529,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
.append((idWidth + (res + 1) * av.getCharWidth()))
.append(",").append((av.getCharHeight() + sy))
.append("\"").append(" onMouseOver=\"toolTip('")
- .append(alIndex).append(" ").append(triplet);
+ .append(seqPos).append(" ").append(triplet);
}
if (groups[g].getStartRes() < res
@@ -1527,61 +1540,51 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
}
- if (features != null)
+ if (text.length() < 1)
{
- if (text.length() < 1)
- {
- text.append(" features = seq.getFeatures()
+ .findFeatures(seqPos, seqPos);
+ for (SequenceFeature sf : features)
{
-
- if ((features[f].getBegin() <= seq.findPosition(res))
- && (features[f].getEnd() >= seq.findPosition(res)))
+ if (sf.isContactFeature())
{
- if (features[f].isContactFeature())
- {
- if (features[f].getBegin() == seq.findPosition(res)
- || features[f].getEnd() == seq
- .findPosition(res))
- {
- text.append("
").append(features[f].getType())
- .append(" ").append(features[f].getBegin())
- .append(":").append(features[f].getEnd());
- }
- }
- else
+ text.append("
").append(sf.getType()).append(" ")
+ .append(sf.getBegin()).append(":")
+ .append(sf.getEnd());
+ }
+ else
+ {
+ text.append("
");
+ text.append(sf.getType());
+ String description = sf.getDescription();
+ if (description != null
+ && !sf.getType().equals(description))
{
- text.append("
");
- text.append(features[f].getType());
- if (features[f].getDescription() != null
- && !features[f].getType().equals(
- features[f].getDescription()))
- {
- text.append(" ").append(features[f].getDescription());
- }
-
- if (features[f].getValue("status") != null)
- {
- text.append(" (").append(features[f].getValue("status"))
- .append(")");
- }
+ description = description.replace("\"", """);
+ text.append(" ").append(description);
}
}
-
+ String status = sf.getStatus();
+ if (status != null && !"".equals(status))
+ {
+ text.append(" (").append(status).append(")");
+ }
+ }
+ if (text.length() > 1)
+ {
+ text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">");
+ out.println(text.toString());
}
- }
- if (text.length() > 1)
- {
- text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">");
- out.println(text.toString());
}
}
}
@@ -1629,7 +1632,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
int maxwidth = av.getAlignment().getWidth();
if (av.hasHiddenColumns())
{
- maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
+ maxwidth = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(maxwidth) - 1;
}
int height = ((maxwidth / chunkWidth) + 1) * cHeight;
@@ -1647,6 +1651,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas());
PaintRefresher.RemoveComponent(this);
+ closeChildFrames();
+
/*
* try to ensure references are nulled
*/
@@ -1678,6 +1684,17 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
/**
+ * Close any open dialogs that would be orphaned when this one is closed
+ */
+ protected void closeChildFrames()
+ {
+ if (calculationDialog != null)
+ {
+ calculationDialog.closeFrame();
+ }
+ }
+
+ /**
* hides or shows dynamic annotation rows based on groups and av state flags
*/
public void updateAnnotation()
@@ -1906,4 +1923,24 @@ public class AlignmentPanel extends GAlignmentPanel implements
repaint();
}
}
+
+ /**
+ * Set the reference to the PCA/Tree chooser dialog for this panel. This
+ * reference should be nulled when the dialog is closed.
+ *
+ * @param calculationChooser
+ */
+ public void setCalculationDialog(CalculationChooser calculationChooser)
+ {
+ calculationDialog = calculationChooser;
+ }
+
+ /**
+ * Returns the reference to the PCA/Tree chooser dialog for this panel (null
+ * if none is open)
+ */
+ public CalculationChooser getCalculationDialog()
+ {
+ return calculationDialog;
+ }
}