import javax.swing.JPanel;
/**
- * DOCUMENT ME!
+ * Panel displaying an overview of the full alignment, with an interactive box
+ * representing the viewport onto the alignment.
*
* @author $author$
* @version $Revision$
/**
* Creates a new OverviewPanel object.
*
- * @param ap
+ * @param alPanel
* The alignment panel which is shown in the overview panel
*/
- public OverviewPanel(AlignmentPanel ap)
+ public OverviewPanel(AlignmentPanel alPanel)
{
- this.av = ap.av;
- this.ap = ap;
+ this.av = alPanel.av;
+ this.ap = alPanel;
setLayout(null);
sr = new SequenceRenderer(av);
sr.renderGaps = false;
sr.forOverview = true;
- fr = new FeatureRenderer(ap);
+ fr = new FeatureRenderer(alPanel);
- od = new OverviewDimensions(av);
+ boolean showAnnotation = false;
+ // TODO: in applet this was getSequenceConsensusHash()
+ // check if it makes any functional difference: hconsensus or conservation
+ if (av.getAlignmentConservationAnnotation() == null)
+ {
+ showAnnotation = true;
+ }
+ od = new OverviewDimensions(av, showAnnotation);
addComponentListener(new ComponentAdapter()
{
{
// TODO: feature: jv2.5 detect shift drag and update selection from
// it.
- od.setBoxX(evt.getX());
- od.setBoxY(evt.getY());
- checkValid();
+ od.updateViewportFromMouse(evt.getX(), evt.getY());
+ ap.setScrollValues(od.getScrollCol(), od.getScrollRow());
}
}
});
{
if (!av.getWrapAlignment())
{
- od.setBoxX(evt.getX());
- od.setBoxY(evt.getY());
- checkValid();
+ od.updateViewportFromMouse(evt.getX(), evt.getY());
+ ap.setScrollValues(od.getScrollCol(), od.getScrollRow());
}
}
});
}
/**
- * Check box dimensions and scroll positions and correct if necessary
- */
- private void checkValid()
- {
- od.checkValid();
- ap.setScrollValues(od.getScrollCol(), od.getScrollRow());
-
- }
-
- /**
* Updates the overview image when the related alignment panel is updated
*/
public void updateOverviewImage()
mg.setColor(Color.orange);
mg.fillRect(0, 0, od.getWidth(), miniMe.getHeight());
- // calculate scale based on current alignment width and height
- od.updateScales();
-
// calculate sampleCol and sampleRow
// alignment width is max number of residues/bases
// alignment height is number of sequences
int alwidth = av.getAlignment().getWidth();
- int alheight = av.getAlignment().getHeight()
- + av.getAlignment().getHiddenSequences().getSize();
+ int alheight = av.getAlignment().getAbsoluteHeight();
// sampleCol or sampleRow is the width/height allocated to each residue
// in particular, sometimes we may need more than one row/col of the
int color = Color.white.getRGB();
jalview.datamodel.SequenceI seq = null;
- final boolean hasHiddenRows = av.hasHiddenRows();
+
final boolean hasHiddenCols = av.hasHiddenColumns();
boolean hiddenRow = false;
// get hidden row and hidden column map once at beginning.
lastrow = currentrow;
- hiddenRow = false;
- // should be method(s) in Alignment
- if (hasHiddenRows)
- {
- seq = av.getAlignment().getHiddenSequences()
- .getHiddenSequence(lastrow);
- if (seq == null)
- {
- int index = av.getAlignment().getHiddenSequences()
- .findIndexWithoutHiddenSeqs(lastrow);
-
- seq = av.getAlignment().getSequenceAt(index);
- }
- else
- {
- hiddenRow = true;
- }
- }
- else
- {
- seq = av.getAlignment().getSequenceAt(lastrow);
- }
- // end of Alignment method(s)
+ // get the sequence which would be at alignment index 'lastrow' if no
+ // columns were hidden, and determine whether it is hidden or not
+ hiddenRow = av.getAlignment().isHidden(lastrow);
+ seq = av.getAlignment().getSequenceAtAbsoluteIndex(lastrow);
}
if (seq == null)
}
// TODO: render selected regions
g.setColor(Color.red);
- g.drawRect(od.getBoxX(), od.getBoxY(), od.getBoxWidth(),
- od.getBoxHeight());
- g.drawRect(od.getBoxX() + 1, od.getBoxY() + 1, od.getBoxWidth() - 2,
- od.getBoxHeight() - 2);
+ od.drawBox(g);
}
}