/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.awt.print.*;
import javax.swing.*;
+import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.datamodel.*;
import jalview.jbgui.*;
import jalview.schemes.*;
import jalview.structure.SelectionSource;
+import jalview.structure.StructureSelectionManager;
/**
* DOCUMENT ME!
*
* @author $author$
- * @version $Revision$
+ * @version $Revision: 1.161 $
*/
public class AlignmentPanel extends GAlignmentPanel implements
- AdjustmentListener, Printable
+ AdjustmentListener, Printable, AlignmentViewPanel
{
public AlignViewport av;
{
System.out.println("NEEDS FIXING");
}
-
+ validateAnnotationDimensions(true);
+ addNotify();
+ paintAlignment(true);
+ }
+ /**
+ * calculate the annotation dimensions and refresh slider values accordingly.
+ * need to do repaints/notifys afterwards.
+ */
+ protected void validateAnnotationDimensions(boolean adjustPanelHeight) {
int height = annotationPanel.adjustPanelHeight();
-
+
if (hscroll.isVisible())
{
height += hscroll.getPreferredSize().height;
{
height = alignFrame.getHeight() / 2;
}
-
+ if (!adjustPanelHeight)
+ {
+ // maintain same window layout whilst updating sliders
+ height=annotationScroller.getSize().height;
+ }
hscroll.addNotify();
-
+
annotationScroller.setPreferredSize(new Dimension(annotationScroller
.getWidth(), height));
annotationSpaceFillerHolder.setPreferredSize(new Dimension(
annotationSpaceFillerHolder.getWidth(), height));
annotationScroller.validate();// repaint();
- addNotify();
- repaint();
+ annotationScroller.addNotify();
}
/**
if (updateOverview)
{
- jalview.structure.StructureSelectionManager
- .getStructureSelectionManager().sequenceColoursChanged(this);
+ av.getStructureSelectionManager().sequenceColoursChanged(this);
if (overviewPanel != null)
{
pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
alabels.drawComponent((Graphics2D) pg, idWidth);
pg.translate(idWidth + 3, 0);
- annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes + 1);
+ annotationPanel.renderer.drawComponent(annotationPanel, av, (Graphics2D) pg, -1, startRes, endRes + 1);
}
return Printable.PAGE_EXISTS;
if (System.getProperty("java.awt.headless") != null
&& System.getProperty("java.awt.headless").equals("true"))
{
+ // TODO: JAL-244
width = alignFrame.getWidth() - vscroll.getPreferredSize().width
- alignFrame.getInsets().left
- alignFrame.getInsets().right;
*/
public void closePanel()
{
- jalview.structure.StructureSelectionManager ssm = jalview.structure.StructureSelectionManager
- .getStructureSelectionManager();
- ssm.removeStructureViewerListener(seqPanel, null);
- ssm.removeSelectionListener(seqPanel);
PaintRefresher.RemoveComponent(seqPanel.seqCanvas);
PaintRefresher.RemoveComponent(idPanel.idCanvas);
PaintRefresher.RemoveComponent(this);
if (av != null)
{
+ jalview.structure.StructureSelectionManager ssm = av.getStructureSelectionManager();
+ ssm.removeStructureViewerListener(seqPanel, null);
+ ssm.removeSelectionListener(seqPanel);
av.alignment = null;
av = null;
}
boolean cons = av.isShowGroupConsensus();
boolean showprf = av.isShowSequenceLogo();
boolean showConsHist = av.isShowConsensusHistogram();
+ boolean normLogo = av.isNormaliseSequenceLogo();
boolean sortg = true;
// set defaults for this group's conservation/consensus
sg.setshowSequenceLogo(showprf);
sg.setShowConsensusHistogram(showConsHist);
+ sg.setNormaliseSequenceLogo(normLogo);
}
if (conv)
{
oldrfs.clear();
adjustAnnotationHeight();
}
+
+ @Override
+ public AlignmentI getAlignment()
+ {
+ return av.alignment;
+ }
+
+ /**
+ * get the name for this view
+ * @return
+ */
+ public String getViewName()
+ {
+ return av.viewName;
+ }
+
+ /**
+ * Make/Unmake this alignment panel the current input focus
+ * @param b
+ */
+ public void setSelected(boolean b)
+ {
+ try {
+ alignFrame.setSelected(b);
+ } catch (Exception ex) {};
+
+ if (b)
+ {
+ alignFrame.setDisplayedView(this);
+ }
+ }
+
+ @Override
+ public StructureSelectionManager getStructureSelectionManager()
+ {
+ return av.getStructureSelectionManager();
+ }
}