/*
- * 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.0b1)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* 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 <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
protected void validateAnnotationDimensions(boolean adjustPanelHeight)
{
int height = annotationPanel.adjustPanelHeight();
-
- if (hscroll.isVisible())
- {
- height += hscroll.getPreferredSize().height;
- }
- if (height > alignFrame.getHeight() / 2)
- {
- height = alignFrame.getHeight() / 2;
+
+ int theight = av.getCharHeight() * (av.getAlignment().getHeight() + (!av.hasHiddenRows() ? 0 : av.getAlignment().getHiddenSequences().getSize()));
+ float sscaling = (float) (theight/(1.0*theight+height));
+ float ascaling=(float)(height*1.0/alignFrame.getHeight());
+ int rheight = alignFrame.getHeight() - height - av.getCharHeight();
+ if (adjustPanelHeight)
+ {
+ // NOTE: this logic is different in the applet. Need a better algorithm to define behaviour
+ // try and set height according to alignment
+ if (ascaling>0 && sscaling < 0.5)
+ {
+ // if the alignment is too big then
+ // default is 0.5 split
+ height = alignFrame.getHeight() / 2;
+ }
+ else
+ {
+ // if space for more than one sequence row left when annotation is fully displayed then set height to annotation height
+ // otherwise, leave at least two lines of sequence shown.
+ height = (rheight>av.getCharHeight()) ? height : (-av.getCharHeight() * 3
+ + (int) (alignFrame.getHeight() * (1 - sscaling)));
+ }
}
- if (!adjustPanelHeight)
+ else
{
// maintain same window layout whilst updating sliders
height = annotationScroller.getSize().height;
new OOMWarning(string, error, this);
}
- public FeatureRenderer cloneFeatureRenderer()
+ @Override
+ public jalview.api.FeatureRenderer cloneFeatureRenderer()
{
return new FeatureRenderer(this);
}
-
+ @Override
+ public jalview.api.FeatureRenderer getFeatureRenderer()
+ {
+ return seqPanel.seqCanvas.getFeatureRenderer();
+ }
public void updateFeatureRenderer(FeatureRenderer fr)
{
fr.transferSettings(seqPanel.seqCanvas.getFeatureRenderer());
}
- public void updateFeatureRendererFrom(FeatureRenderer fr)
+ public void updateFeatureRendererFrom(jalview.api.FeatureRenderer fr)
{
if (seqPanel.seqCanvas.getFeatureRenderer() != null)
{