X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FTreePanel.java;h=75ef09b0a8d4783b426cdf9f29db0f0381ac59ad;hb=c0439ed8b088887ffea2faf11bc7897333287cb3;hp=18a82548f5a4f8404836125fc5623093eda065a6;hpb=0a33061e4909390b607ba0dd5e209a9eb7527b95;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 18a8254..75ef09b 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -379,7 +379,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee init(); // if ( !_phylogeny.isEmpty() ) { _phylogeny.recalculateNumberOfExternalDescendants( true ); - // } setBackground( getTreeColorSet().getBackgroundColor() ); final MouseListener mouse_listener = new MouseListener( this ); @@ -736,8 +735,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee type = 'n'; } } - - try { Blast.openNcbiBlastWeb( query, type == 'n', this ); } @@ -1300,16 +1297,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee return _last_drag_point_y; } - final private short getMaxBranchesToLeaf( final PhylogenyNode node ) { - if ( !_nodeid_dist_to_leaf.containsKey( node.getId() ) ) { - final short m = PhylogenyMethods.calculateMaxBranchesToLeaf( node ); - _nodeid_dist_to_leaf.put( node.getId(), m ); - return m; - } - else { - return _nodeid_dist_to_leaf.get( node.getId() ); - } - } final private double getMaxDistanceToRoot() { if ( _max_distance_to_root < 0 ) { @@ -1737,8 +1724,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee decreaseOvSize(); } } - if ( e.getKeyCode() == KeyEvent.VK_HOME - || e.getKeyCode() == KeyEvent.VK_ESCAPE ) { + if ( e.getKeyCode() == KeyEvent.VK_HOME || e.getKeyCode() == KeyEvent.VK_ESCAPE ) { getControlPanel().showWhole(); } else if ( e.getKeyCode() == KeyEvent.VK_PAGE_UP ) { @@ -1998,8 +1984,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( !ForesterUtil.isEmpty( uri_strs ) ) { for( final String uri_str : uri_strs ) { try { - AptxUtil.launchWebBrowser( new URI( uri_str ), - "_aptx_seq" ); + AptxUtil.launchWebBrowser( new URI( uri_str ), "_aptx_seq" ); } catch ( final IOException e ) { AptxUtil.showErrorMessage( this, e.toString() ); @@ -2024,9 +2009,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final String uri_str = TreePanelUtil.createUriForSeqWeb( node, getConfiguration(), this ); if ( !ForesterUtil.isEmpty( uri_str ) ) { try { - AptxUtil.launchWebBrowser( new URI( uri_str ), - - "_aptx_seq" ); + AptxUtil.launchWebBrowser( new URI( uri_str ), "_aptx_seq" ); } catch ( final IOException e ) { AptxUtil.showErrorMessage( this, e.toString() ); @@ -2105,8 +2088,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } if ( !ForesterUtil.isEmpty( uri_str ) ) { try { - AptxUtil.launchWebBrowser( new URI( uri_str ), - "_aptx_tax" ); + AptxUtil.launchWebBrowser( new URI( uri_str ), "_aptx_tax" ); } catch ( final IOException e ) { AptxUtil.showErrorMessage( this, e.toString() ); @@ -2584,11 +2566,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee ( node.getYcoord() - getFontMetricsForLargeDefaultFont().getMaxDescent() ), g ); g.setColor( getTreeColorSet().getLostCharactersColor() ); - TreePanel.drawString( lost, - parent_x + ( ( x - parent_x - - getFontMetricsForLargeDefaultFont().stringWidth( lost ) ) / 2 ), - ( node.getYcoord() + getFontMetricsForLargeDefaultFont().getMaxAscent() ), - g ); + TreePanel + .drawString( lost, + parent_x + ( ( x - parent_x - getFontMetricsForLargeDefaultFont().stringWidth( lost ) ) + / 2 ), + ( node.getYcoord() + getFontMetricsForLargeDefaultFont().getMaxAscent() ), + g ); } } @@ -2649,14 +2632,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee || ( getOptions().isShowDefaultNodeShapesForMarkedNodes() && ( node.getNodeData().getNodeVisualData() != null ) && ( !node.getNodeData().getNodeVisualData().isEmpty() ) ) - || ( getControlPanel().isUseVisualStyles() - && ( ( node.getNodeData().getNodeVisualData() != null ) - && ( ( node.getNodeData().getNodeVisualData().getNodeColor() != null ) - || ( node.getNodeData().getNodeVisualData() - .getSize() != NodeVisualData.DEFAULT_SIZE ) - || ( node.getNodeData().getNodeVisualData().getFillType() != NodeFill.DEFAULT ) - || ( node.getNodeData().getNodeVisualData() - .getShape() != NodeShape.DEFAULT ) ) ) ) + || ( getControlPanel().isUseVisualStyles() && ( ( node.getNodeData().getNodeVisualData() != null ) + && ( ( node.getNodeData().getNodeVisualData().getNodeColor() != null ) + || ( node.getNodeData().getNodeVisualData().getSize() != NodeVisualData.DEFAULT_SIZE ) + || ( node.getNodeData().getNodeVisualData().getFillType() != NodeFill.DEFAULT ) + || ( node.getNodeData().getNodeVisualData().getShape() != NodeShape.DEFAULT ) ) ) ) || ( getControlPanel().isEvents() && node.isHasAssignedEvent() && ( node.getNodeData().getEvent().isDuplication() || node.getNodeData().getEvent().isSpeciation() @@ -2840,6 +2820,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( !getControlPanel().isShowInternalData() && !node.isExternal() && !node.isCollapse() ) { return 0; } + if ( !getControlPanel().isShowExternalData() && ( node.isExternal() || node.isCollapse() ) ) { + return 0; + } _sb.setLength( 0 ); int x = 0; if ( add > 0 ) { @@ -2901,9 +2884,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } else if ( ( _sb.length() > 0 ) || saw_species ) { // _sb.setLength( 0 ); - _sb.append( " (" ); + _sb.append( " [" ); _sb.append( node.getAllExternalDescendants().size() ); - _sb.append( ")" ); + _sb.append( "]" ); } } else { @@ -3416,8 +3399,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee && ( !ForesterUtil.isEmpty( node.getNodeData().getSequence().getMolecularSequence() ) ) ) { paintMolecularSequences( g, node, to_pdf ); } - if ( dynamically_hide && ( ( node.isExternal() - && ( ( _external_node_index % dynamic_hiding_factor ) != 1 ) ) + if ( dynamically_hide && ( ( node.isExternal() && ( ( _external_node_index % dynamic_hiding_factor ) != 1 ) ) || ( !node.isExternal() && ( ( new_x_min < 20 ) || ( ( _y_distance * node.getNumberOfExternalNodes() ) < getFontMetricsForLargeDefaultFont() .getHeight() ) ) ) ) ) { @@ -3438,6 +3420,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( ( !getControlPanel().isShowInternalData() && !node.isExternal() ) ) { return; } + if ( ( !getControlPanel().isShowExternalData() && node.isExternal() ) ) { + return; + } if ( getControlPanel().isShowDomainArchitectures() && node.getNodeData().isHasSequence() && ( node.getNodeData().getSequence().getDomainArchitecture() != null ) && ( node.getNodeData() .getSequence().getDomainArchitecture() instanceof RenderableDomainArchitecture ) ) { @@ -3639,7 +3624,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final boolean using_visual_font = setFont( g, node, is_in_found_nodes ); setColor( g, node, to_graphics_file, to_pdf, is_in_found_nodes, getTreeColorSet().getTaxonomyColor() ); float start_x = node.getXcoord() + 3 + ( getOptions().getDefaultNodeShapeSize() / 2 ) + x_shift; - if ( getControlPanel().getTreeDisplayType() == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM && node.isExternal() ) { + if ( getControlPanel().getTreeDisplayType() == Options.PHYLOGENY_DISPLAY_TYPE.ALIGNED_PHYLOGRAM + && node.isExternal() ) { start_x = ( float ) ( ( getMaxDistanceToRoot() * getXcorrectionFactor() ) + ( getOptions().getDefaultNodeShapeSize() / 2 ) + x_shift + ( 2 * TreePanel.MOVE ) + getXdistance() + 3 ); @@ -3879,7 +3865,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } private final StringBuffer propertiesToString( final PhylogenyNode node ) { - return node.getNodeData().getProperties().asText(); } @@ -4240,9 +4225,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee + ", unique entries: " + size; } final String s = sb.toString().trim(); - - getMainPanel().getMainFrame().showTextFrame( s, title ); - + getMainPanel().getMainFrame().showTextFrame( s, title ); } } } @@ -4436,8 +4419,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( _popup_buffer.length() > 0 ) { _popup_buffer.append( "\n" ); } - _popup_buffer.append(node.getNodeData().getProperties().asText()); - + _popup_buffer.append( node.getNodeData().getProperties().asText() ); } if ( _popup_buffer.length() > 0 ) { if ( !getConfiguration().isUseNativeUI() ) { @@ -4548,9 +4530,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee else { getControlPanel().setDrawPhylogramEnabled( false ); } - - getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getPhylogenyGraphicsType() ); - + getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getPhylogenyGraphicsType() ); } final void calcMaxDepth() { @@ -4833,8 +4813,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } - - void clearCurrentExternalNodesDataBuffer() { setCurrentExternalNodesDataBuffer( new StringBuilder() ); } @@ -5198,8 +5176,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee && ( e.getY() <= ( getOvRectangle().getY() + getOvRectangle().getHeight() + 1 ) ) ); } - - final boolean isCanCollapse() { return ( getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.UNROOTED ); } @@ -5501,8 +5477,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee _urt_factor *= f; } - - final void paintBranchCircular( final PhylogenyNode p, final PhylogenyNode c, final Graphics2D g, @@ -5709,10 +5683,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } final boolean disallow_shortcutting = ( dynamic_hiding_factor < 40 ) - || getControlPanel().isUseVisualStyles() || getOptions().isShowDefaultNodeShapesForMarkedNodes() - || ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) - || ( ( getFoundNodes1() != null ) && !getFoundNodes1().isEmpty() ) - || ( ( getCurrentExternalNodes() != null ) && !getCurrentExternalNodes().isEmpty() ) + /* || getControlPanel().isUseVisualStyles() || getOptions().isShowDefaultNodeShapesForMarkedNodes()*/ //TODO check if this is really not needed. || to_graphics_file || to_pdf; for( final PhylogenyNode element : _nodes_in_preorder ) { paintNodeRectangular( g,