import java.awt.print.*;
import javax.swing.*;
+import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
import jalview.datamodel.*;
import jalview.jbgui.*;
* @version $Revision$
*/
public class AlignmentPanel extends GAlignmentPanel implements
- AdjustmentListener, Printable
+ AdjustmentListener, Printable, AlignmentViewPanel
{
public AlignViewport av;
scrollToWrappedVisible(start);
}
}
- if (!redrawOverview && overviewPanel != null)
+ if (redrawOverview && overviewPanel != null)
{
overviewPanel.setBoxPosition();
}
- paintAlignment(!redrawOverview);
+ paintAlignment(redrawOverview);
return true;
}
}
/**
- * DOCUMENT ME!
*
- * @param b
- * DOCUMENT ME!
+ * @param b Hide or show annotation panel
+ *
*/
public void setAnnotationVisible(boolean b)
{
repaint();
}
+ /**
+ * automatically adjust annotation panel height for new annotation
+ * whilst ensuring the alignment is still visible.
+ */
public void adjustAnnotationHeight()
{
// TODO: display vertical annotation scrollbar if necessary
{
System.out.println("NEEDS FIXING");
}
-
+ validateAnnotationDimensions(true);
+ addNotify();
+ repaint();
+ }
+ /**
+ * 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 (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;
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);
+ }
+ }
}