From f6d7dfa06e34eaf7cc773cf7484e7b641296d452 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Thu, 10 Jan 2013 22:18:39 +0000 Subject: [PATCH] messed up at the moment --- .../src/org/forester/archaeopteryx/AptxUtil.java | 6 +- .../org/forester/archaeopteryx/ArchaeopteryxE.java | 13 +- .../org/forester/archaeopteryx/ControlPanel.java | 18 +- .../forester/archaeopteryx/MainFrameApplet.java | 10 +- .../archaeopteryx/MainFrameApplication.java | 28 +-- .../src/org/forester/archaeopteryx/Options.java | 4 + .../org/forester/archaeopteryx/TreeFontSet.java | 64 +++-- .../src/org/forester/archaeopteryx/TreePanel.java | 250 ++++++++++---------- 8 files changed, 212 insertions(+), 181 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java index c2dfc54..f84d8c4 100644 --- a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java +++ b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java @@ -300,7 +300,7 @@ public final class AptxUtil { final ControlPanel ac, final GraphicsExportType type, final Options options ) throws IOException { - tree_panel.setParametersForPainting( width, height, true ); + tree_panel.calcParametersForPainting( width, height, true ); tree_panel.resetPreferredSize(); tree_panel.repaint(); final RenderingHints rendering_hints = new RenderingHints( RenderingHints.KEY_RENDERING, @@ -1006,7 +1006,7 @@ public final class AptxUtil { if ( options.isGraphicsExportVisibleOnly() ) { throw new IllegalArgumentException( "cannot export visible rectangle only without exporting in actual size" ); } - tree_panel.setParametersForPainting( options.getPrintSizeX(), options.getPrintSizeY(), true ); + tree_panel.calcParametersForPainting( options.getPrintSizeX(), options.getPrintSizeY(), true ); tree_panel.resetPreferredSize(); tree_panel.repaint(); } @@ -1071,7 +1071,7 @@ public final class AptxUtil { if ( options.isGraphicsExportVisibleOnly() ) { throw new IllegalArgumentException( "cannot export visible rectangle only without exporting in actual size" ); } - tree_panel.setParametersForPainting( options.getPrintSizeX(), options.getPrintSizeY(), true ); + tree_panel.calcParametersForPainting( options.getPrintSizeX(), options.getPrintSizeY(), true ); tree_panel.resetPreferredSize(); tree_panel.repaint(); } diff --git a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java index 9146fe8..c6a4849 100644 --- a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java +++ b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java @@ -488,11 +488,14 @@ public class ArchaeopteryxE extends JApplet implements ActionListener { @Override public void componentResized( final ComponentEvent e ) { if ( getMainPanel().getCurrentTreePanel() != null ) { - getMainPanel().getCurrentTreePanel().setParametersForPainting( getMainPanel().getCurrentTreePanel() - .getWidth(), - getMainPanel().getCurrentTreePanel() - .getHeight(), - false ); + getMainPanel().getCurrentTreePanel().calcParametersForPainting( getMainPanel() + .getCurrentTreePanel() + .getWidth(), + getMainPanel() + .getCurrentTreePanel() + .getHeight(), + getOptions() + .isAllowFontSizeChange() ); } } } ); diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index 12bdf3f..7c338cb 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -1277,17 +1277,17 @@ final class ControlPanel extends JPanel implements ActionListener { _mainpanel.getCurrentTreePanel().updateOvSettings(); _mainpanel.getCurrentTreePanel().validate(); _mainpanel.validate(); - _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getSizeOfViewport().width, - _mainpanel.getSizeOfViewport().height, - true ); + _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width, + _mainpanel.getSizeOfViewport().height, + true ); _mainpanel.getCurrentTreePanel().resetPreferredSize(); _mainpanel.adjustJScrollPane(); _mainpanel.getCurrentTreePanel().repaint(); _mainpanel.getCurrentTreePanel().validate(); _mainpanel.validate(); - _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getSizeOfViewport().width, - _mainpanel.getSizeOfViewport().height, - true ); + _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width, + _mainpanel.getSizeOfViewport().height, + true ); _mainpanel.getCurrentTreePanel().resetPreferredSize(); _mainpanel.adjustJScrollPane(); _mainpanel.getCurrentTreePanel().repaint(); @@ -1298,9 +1298,9 @@ final class ControlPanel extends JPanel implements ActionListener { for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) { if ( tree_panel != null ) { tree_panel.validate(); - tree_panel.setParametersForPainting( _mainpanel.getSizeOfViewport().width, - _mainpanel.getSizeOfViewport().height, - true ); + tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width, + _mainpanel.getSizeOfViewport().height, + true ); tree_panel.resetPreferredSize(); tree_panel.repaint(); } diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java index 1248fa5..35cba7b 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java @@ -137,11 +137,11 @@ public final class MainFrameApplet extends MainFrame { @Override public void componentResized( final ComponentEvent e ) { if ( _mainpanel.getCurrentTreePanel() != null ) { - _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getCurrentTreePanel() - .getWidth(), - _mainpanel.getCurrentTreePanel() - .getHeight(), - false ); + _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getCurrentTreePanel() + .getWidth(), + _mainpanel.getCurrentTreePanel() + .getHeight(), + getOptions().isAllowFontSizeChange() ); } } } ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index d0b7949..211ead4 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -390,11 +390,11 @@ public final class MainFrameApplication extends MainFrame { @Override public void componentResized( final ComponentEvent e ) { if ( _mainpanel.getCurrentTreePanel() != null ) { - _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getCurrentTreePanel() - .getWidth(), - _mainpanel.getCurrentTreePanel() - .getHeight(), - false ); + _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getCurrentTreePanel() + .getWidth(), + _mainpanel.getCurrentTreePanel() + .getHeight(), + getOptions().isAllowFontSizeChange() ); } } } ); @@ -1476,9 +1476,9 @@ public final class MainFrameApplication extends MainFrame { } void writePhylogenyToGraphicsFile( final String file_name, final GraphicsExportType type ) { - _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getCurrentTreePanel().getWidth(), - _mainpanel.getCurrentTreePanel().getHeight(), - true ); + _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getCurrentTreePanel().getWidth(), + _mainpanel.getCurrentTreePanel().getHeight(), + true ); String file_written_to = ""; boolean error = false; try { @@ -2070,9 +2070,9 @@ public final class MainFrameApplication extends MainFrame { return; } if ( !getOptions().isPrintUsingActualSize() ) { - getCurrentTreePanel().setParametersForPainting( getOptions().getPrintSizeX() - 80, - getOptions().getPrintSizeY() - 140, - true ); + getCurrentTreePanel().calcParametersForPainting( getOptions().getPrintSizeX() - 80, + getOptions().getPrintSizeY() - 140, + true ); getCurrentTreePanel().resetPreferredSize(); getCurrentTreePanel().repaint(); } @@ -2100,9 +2100,9 @@ public final class MainFrameApplication extends MainFrame { private void printPhylogenyToPdf( final String file_name ) { if ( !getOptions().isPrintUsingActualSize() ) { - getCurrentTreePanel().setParametersForPainting( getOptions().getPrintSizeX(), - getOptions().getPrintSizeY(), - true ); + getCurrentTreePanel().calcParametersForPainting( getOptions().getPrintSizeX(), + getOptions().getPrintSizeY(), + true ); getCurrentTreePanel().resetPreferredSize(); getCurrentTreePanel().repaint(); } diff --git a/forester/java/src/org/forester/archaeopteryx/Options.java b/forester/java/src/org/forester/archaeopteryx/Options.java index 69bd5b8..9857b51 100644 --- a/forester/java/src/org/forester/archaeopteryx/Options.java +++ b/forester/java/src/org/forester/archaeopteryx/Options.java @@ -579,4 +579,8 @@ final public class Options { return toString().replaceAll( " ", "_" ); } } + + public boolean isAllowFontSizeChange() { + return true; + } } diff --git a/forester/java/src/org/forester/archaeopteryx/TreeFontSet.java b/forester/java/src/org/forester/archaeopteryx/TreeFontSet.java index fcf350b..a07c87a 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreeFontSet.java +++ b/forester/java/src/org/forester/archaeopteryx/TreeFontSet.java @@ -36,10 +36,10 @@ import java.awt.FontMetrics; */ public final class TreeFontSet { - final static float SMALL_FONTS_BASE = 8; - private final static String DEFAULT_FONT = "Verdana"; - private final static float FONT_SIZE_CHANGE_STEP = 1.0f; - static final int BOLD_AND_ITALIC = Font.BOLD + Font.ITALIC; + final static float SMALL_FONTS_BASE = 8; + private final static String DEFAULT_FONT = "Verdana"; + final static float FONT_SIZE_CHANGE_STEP = 1.0f; + static final int BOLD_AND_ITALIC = Font.BOLD + Font.ITALIC; // the owner (needed to get font metrics) private final MainPanel _owner; // The fonts @@ -52,6 +52,10 @@ public final class TreeFontSet { private Font _large_font_system; private Font _small_italic_font_system; private Font _large_italic_font_system; + private Font _small_font_memory; + private Font _large_font_memory; + private Font _small_italic_font_memory; + private Font _large_italic_font_memory; // Handy holders for font metrics public FontMetrics _fm_small; FontMetrics _fm_large; @@ -60,12 +64,12 @@ public final class TreeFontSet { FontMetrics _fm_large_italic; FontMetrics _fm_large_italic_bold; // hold font measurements - int _small_max_descent = 0; - int _small_max_ascent = 0; + int _small_max_descent = 0; + int _small_max_ascent = 0; private final int _min; private final int _max; - private boolean _decreased_size_by_system = false; - + private boolean _decreased_size_by_system = false; + TreeFontSet( final MainPanel owner ) { _owner = owner; _min = _owner.getConfiguration().getMinBaseFontSize(); @@ -77,12 +81,13 @@ public final class TreeFontSet { return _small_font; } - public Font getSmallFontSystem() { - return _small_font_system; - - } - void decreaseFontSize( final int min, final boolean decreased_size_by_system ) { + if ( decreased_size_by_system && !isDecreasedSizeBySystem() ) { + _small_font_memory = _small_font; + _large_font_memory = _large_font; + _small_italic_font_memory = _small_italic_font; + _large_italic_font_memory = _large_italic_font; + } setDecreasedSizeBySystem( decreased_size_by_system ); if ( _large_font.getSize() >= min ) { _small_font = _small_font.deriveFont( _small_font.getSize() - FONT_SIZE_CHANGE_STEP ); @@ -92,11 +97,10 @@ public final class TreeFontSet { setupFontMetrics(); } } - - - - - + + Font getLargeFontMemory() { + return _large_font_memory; + } Font getBaseFont() { return _base_font; @@ -114,6 +118,10 @@ public final class TreeFontSet { return _large_italic_font_system; } + Font getSmallFontSystem() { + return _small_font_system; + } + Font getSmallItalicFont() { return _small_italic_font; } @@ -130,6 +138,10 @@ public final class TreeFontSet { setupFontMetrics(); } + boolean isDecreasedSizeBySystem() { + return _decreased_size_by_system; + } + void largeFonts() { setDecreasedSizeBySystem( false ); _small_font = _small_font.deriveFont( 12f ); @@ -202,9 +214,17 @@ public final class TreeFontSet { _large_font_system = new Font( getBaseFont().getFontName(), getBaseFont().getStyle(), getBaseFont().getSize() ); _small_italic_font_system = new Font( getBaseFont().getFontName(), italic, small_size ); _large_italic_font_system = new Font( getBaseFont().getFontName(), italic, getBaseFont().getSize() ); + _small_font_memory = _small_font; + _large_font_memory = _large_font; + _small_italic_font_memory = _small_italic_font; + _large_italic_font_memory = _large_italic_font; setupFontMetrics(); } + private void setDecreasedSizeBySystem( final boolean decreased_size_by_system ) { + _decreased_size_by_system = decreased_size_by_system; + } + private void setupFontMetrics() { _fm_small = _owner.getFontMetrics( _small_font ); _fm_large = _owner.getFontMetrics( _large_font ); @@ -215,12 +235,4 @@ public final class TreeFontSet { _small_max_descent = _fm_small.getMaxDescent(); _small_max_ascent = _fm_small.getMaxAscent() + 1; } - - boolean isDecreasedSizeBySystem() { - return _decreased_size_by_system; - } - - private void setDecreasedSizeBySystem( final boolean decreased_size_by_system ) { - _decreased_size_by_system = decreased_size_by_system; - } } diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index bfc9f05..f58553a 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -307,65 +307,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee requestFocusInWindow(); } - public void checkForVectorProperties( final Phylogeny phy ) { - final DescriptiveStatistics stats = new BasicDescriptiveStatistics(); - for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) { - final PhylogenyNode node = iter.next(); - if ( node.getNodeData().getProperties() != null ) { - final PropertiesMap pm = node.getNodeData().getProperties(); - final double[] vector = new double[ pm.getProperties().size() ]; - int counter = 0; - for( final String ref : pm.getProperties().keySet() ) { - if ( ref.startsWith( PhyloXmlUtil.VECTOR_PROPERTY_REF ) ) { - final Property p = pm.getProperty( ref ); - final String value_str = p.getValue(); - final String index_str = ref - .substring( PhyloXmlUtil.VECTOR_PROPERTY_REF.length(), ref.length() ); - double d = -100; - try { - d = Double.parseDouble( value_str ); - } - catch ( final NumberFormatException e ) { - JOptionPane.showMessageDialog( this, "Could not parse \"" + value_str - + "\" into a decimal value", "Problem with Vector Data", JOptionPane.ERROR_MESSAGE ); - return; - } - int i = -1; - try { - i = Integer.parseInt( index_str ); - } - catch ( final NumberFormatException e ) { - JOptionPane.showMessageDialog( this, - "Could not parse \"" + index_str - + "\" into index for vector data", - "Problem with Vector Data", - JOptionPane.ERROR_MESSAGE ); - return; - } - if ( i < 0 ) { - JOptionPane.showMessageDialog( this, - "Attempt to use negative index for vector data", - "Problem with Vector Data", - JOptionPane.ERROR_MESSAGE ); - return; - } - vector[ i ] = d; - ++counter; - stats.addValue( d ); - } - } - final List vector_l = new ArrayList( counter ); - for( int i = 0; i < counter; ++i ) { - vector_l.add( vector[ i ] ); - } - node.getNodeData().setVector( vector_l ); - } - } - if ( stats.getN() > 0 ) { - _statistics_for_vector_data = stats; - } - } - public synchronized Hashtable getImageMap() { return getMainPanel().getImageMap(); } @@ -499,11 +440,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } - public final void setArrowCursor() { - setCursor( ARROW_CURSOR ); - repaint(); - } - public final void setEdited( final boolean edited ) { _edited = edited; } @@ -513,22 +449,62 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } /** + * Set a phylogeny tree. + * + * @param t + * an instance of a Phylogeny + */ + public final void setTree( final Phylogeny t ) { + setNodeInPreorderToNull(); + _phylogeny = t; + } + + public final void setWaitCursor() { + setCursor( WAIT_CURSOR ); + repaint(); + } + + @Override + public void update( final Graphics g ) { + paint( g ); + } + + final void calcMaxDepth() { + if ( _phylogeny != null ) { + _circ_max_depth = PhylogenyMethods.calculateMaxDepth( _phylogeny ); + } + } + + /** * Set parameters for printing the displayed tree * * @param x * @param y */ - public final void setParametersForPainting( final int x, final int y, final boolean recalc_longest_ext_node_info ) { + final void calcParametersForPainting( final int x, final int y, final boolean recalc_longest_ext_node_info ) { // updateStyle(); not needed? if ( ( _phylogeny != null ) && !_phylogeny.isEmpty() ) { initNodeData(); if ( recalc_longest_ext_node_info ) { calculateLongestExtNodeInfo(); - while ( ( getLongestExtNodeInfo() > ( x * 0.67 ) ) && ( getTreeFontSet().getLargeFont().getSize() > 2 ) ) { - getMainPanel().getTreeFontSet().decreaseFontSize( getConfiguration().getMinBaseFontSize(), true ); - - - calculateLongestExtNodeInfo(); + if ( getOptions().isAllowFontSizeChange() ) { + if ( ( getLongestExtNodeInfo() > ( x * 0.6 ) ) + && ( getTreeFontSet().getLargeFont().getSize() > 2 + TreeFontSet.FONT_SIZE_CHANGE_STEP ) ) { + while ( ( getLongestExtNodeInfo() > ( x * 0.6 ) ) + && ( getTreeFontSet().getLargeFont().getSize() > 2 ) ) { + getMainPanel().getTreeFontSet().decreaseFontSize( getConfiguration().getMinBaseFontSize(), + true ); + calculateLongestExtNodeInfo(); + } + } + else { + while ( ( getLongestExtNodeInfo() < ( x * 0.5 ) ) + && ( getTreeFontSet().getLargeFont().getSize() <= getTreeFontSet().getLargeFontMemory() + .getSize() - TreeFontSet.FONT_SIZE_CHANGE_STEP ) ) { + getMainPanel().getTreeFontSet().increaseFontSize(); + calculateLongestExtNodeInfo(); + } + } } } int ext_nodes = _phylogeny.getRoot().getNumberOfExternalNodes(); @@ -577,55 +553,29 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee _circ_max_depth = max_depth; setUpUrtFactor(); // - if ( ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) - && ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) { - int dynamic_hiding_factor = calcDynamicHidingFactor(); - if ( dynamic_hiding_factor > 1 ) { - while ( dynamic_hiding_factor > 1 - && getTreeFontSet()._fm_large.getHeight() > TreeFontSet.SMALL_FONTS_BASE ) { - getTreeFontSet().decreaseFontSize( 1, true ); - - dynamic_hiding_factor = calcDynamicHidingFactor(); - } - } - else if ( getTreeFontSet().isDecreasedSizeBySystem() ) { - while ( dynamic_hiding_factor < 1 && getTreeFontSet()._fm_large.getHeight() < 12 ) { - getTreeFontSet().increaseFontSize(); - dynamic_hiding_factor = calcDynamicHidingFactor(); - } + if ( getOptions().isAllowFontSizeChange() ) { + if ( ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) + && ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) { + // int dynamic_hiding_factor = calcDynamicHidingFactor(); + // if ( dynamic_hiding_factor > 1 ) { + // while ( dynamic_hiding_factor > 1 + // && getTreeFontSet()._fm_large.getHeight() > TreeFontSet.SMALL_FONTS_BASE ) { + // getTreeFontSet().decreaseFontSize( 1, true ); + // dynamic_hiding_factor = calcDynamicHidingFactor(); + // } + // } + // else if ( getTreeFontSet().isDecreasedSizeBySystem() ) { + // while ( dynamic_hiding_factor < 1 && getTreeFontSet()._fm_large.getHeight() < 12 ) { + // getTreeFontSet().increaseFontSize(); + // dynamic_hiding_factor = calcDynamicHidingFactor(); + // } + // } } } // } } - /** - * Set a phylogeny tree. - * - * @param t - * an instance of a Phylogeny - */ - public final void setTree( final Phylogeny t ) { - setNodeInPreorderToNull(); - _phylogeny = t; - } - - public final void setWaitCursor() { - setCursor( WAIT_CURSOR ); - repaint(); - } - - @Override - public void update( final Graphics g ) { - paint( g ); - } - - final void calcMaxDepth() { - if ( _phylogeny != null ) { - _circ_max_depth = PhylogenyMethods.calculateMaxDepth( _phylogeny ); - } - } - final void calculateLongestExtNodeInfo() { if ( ( _phylogeny == null ) || _phylogeny.isEmpty() ) { return; @@ -759,6 +709,65 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee return c; } + void checkForVectorProperties( final Phylogeny phy ) { + final DescriptiveStatistics stats = new BasicDescriptiveStatistics(); + for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) { + final PhylogenyNode node = iter.next(); + if ( node.getNodeData().getProperties() != null ) { + final PropertiesMap pm = node.getNodeData().getProperties(); + final double[] vector = new double[ pm.getProperties().size() ]; + int counter = 0; + for( final String ref : pm.getProperties().keySet() ) { + if ( ref.startsWith( PhyloXmlUtil.VECTOR_PROPERTY_REF ) ) { + final Property p = pm.getProperty( ref ); + final String value_str = p.getValue(); + final String index_str = ref + .substring( PhyloXmlUtil.VECTOR_PROPERTY_REF.length(), ref.length() ); + double d = -100; + try { + d = Double.parseDouble( value_str ); + } + catch ( final NumberFormatException e ) { + JOptionPane.showMessageDialog( this, "Could not parse \"" + value_str + + "\" into a decimal value", "Problem with Vector Data", JOptionPane.ERROR_MESSAGE ); + return; + } + int i = -1; + try { + i = Integer.parseInt( index_str ); + } + catch ( final NumberFormatException e ) { + JOptionPane.showMessageDialog( this, + "Could not parse \"" + index_str + + "\" into index for vector data", + "Problem with Vector Data", + JOptionPane.ERROR_MESSAGE ); + return; + } + if ( i < 0 ) { + JOptionPane.showMessageDialog( this, + "Attempt to use negative index for vector data", + "Problem with Vector Data", + JOptionPane.ERROR_MESSAGE ); + return; + } + vector[ i ] = d; + ++counter; + stats.addValue( d ); + } + } + final List vector_l = new ArrayList( counter ); + for( int i = 0; i < counter; ++i ) { + vector_l.add( vector[ i ] ); + } + node.getNodeData().setVector( vector_l ); + } + } + if ( stats.getN() > 0 ) { + _statistics_for_vector_data = stats; + } + } + void clearCurrentExternalNodesDataBuffer() { setCurrentExternalNodesDataBuffer( new StringBuilder() ); } @@ -1672,10 +1681,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } - private final int calcDynamicHidingFactor() { - return ( int ) ( 0.5 + ( getTreeFontSet()._fm_large.getHeight() / ( 1.5 * getYdistance() ) ) ); - } - final void recalculateMaxDistanceToRoot() { _max_distance_to_root = PhylogenyMethods.calculateMaxDistanceToRoot( getPhylogeny() ); } @@ -1790,6 +1795,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } + final void setArrowCursor() { + setCursor( ARROW_CURSOR ); + repaint(); + } + final void setControlPanel( final ControlPanel atv_control ) { _control_panel = atv_control; } @@ -2287,6 +2297,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } + private final int calcDynamicHidingFactor() { + return ( int ) ( 0.5 + ( getTreeFontSet()._fm_large.getHeight() / ( 1.5 * getYdistance() ) ) ); + } + /** * Calculate the length of the distance between the given node and its * parent. @@ -2985,8 +2999,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } else if ( ( e.getKeyCode() == KeyEvent.VK_SUBTRACT ) || ( e.getKeyCode() == KeyEvent.VK_MINUS ) ) { getMainPanel().getTreeFontSet().decreaseFontSize( 1, false ); - - getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( true ); } else if ( plusPressed( e.getKeyCode() ) ) { -- 1.7.10.2