X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FTreePanel.java;h=68b63761f3f1760fc498d44eb2d226f1c8124850;hb=fbb463a0dc277aa6efa5231f6db554de3696b194;hp=407633ee1981d63f7eaa3de8eb738e483535b189;hpb=3bbfdd2376af6df268814837b928065d7152b7b9;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 407633e..68b6376 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -112,9 +112,9 @@ import org.forester.phylogeny.data.BranchColor; import org.forester.phylogeny.data.Confidence; import org.forester.phylogeny.data.Event; import org.forester.phylogeny.data.NodeData.NODE_DATA; -import org.forester.phylogeny.data.NodeVisualization; -import org.forester.phylogeny.data.NodeVisualization.NodeFill; -import org.forester.phylogeny.data.NodeVisualization.NodeShape; +import org.forester.phylogeny.data.NodeVisualData; +import org.forester.phylogeny.data.NodeVisualData.NodeFill; +import org.forester.phylogeny.data.NodeVisualData.NodeShape; import org.forester.phylogeny.data.PhylogenyDataUtil; import org.forester.phylogeny.data.PropertiesMap; import org.forester.phylogeny.data.Property; @@ -168,6 +168,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee private static final BasicStroke STROKE_2 = new BasicStroke( 2f ); private static final double TWO_PI = 2 * Math.PI; private final static int WIGGLE = 2; + private final static double OVERVIEW_FOUND_NODE_BOX_SIZE = 2; + private final static double OVERVIEW_FOUND_NODE_BOX_SIZE_HALF = 1; HashMap _nodeid_dist_to_leaf = new HashMap(); final private Arc2D _arc = new Arc2D.Double(); private AffineTransform _at; @@ -704,19 +706,21 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } final Color calculateTaxonomyBasedColor( final Taxonomy tax ) { - if ( getOptions().isColorByTaxonomicGroup() && !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) { - boolean ex = false; - String group = null; - try { - group = TaxonomyUtil.getTaxGroupByTaxCode( tax.getTaxonomyCode() ); - } - catch ( final Exception e ) { - ex = true; - } - if ( !ex && !ForesterUtil.isEmpty( group ) ) { - final Color c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( group ); - if ( c != null ) { - return c; + if ( getOptions().isColorByTaxonomicGroup() ) { + if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) { + boolean ex = false; + String group = null; + try { + group = TaxonomyUtil.getTaxGroupByTaxCode( tax.getTaxonomyCode() ); + } + catch ( final Exception e ) { + ex = true; + } + if ( !ex && !ForesterUtil.isEmpty( group ) ) { + final Color c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( group ); + if ( c != null ) { + return c; + } } } return getTreeColorSet().getTaxonomyColor(); @@ -865,8 +869,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final int colorizations = TreePanelUtil.colorPhylogenyAccordingToRanks( _phylogeny, rank, this ); if ( colorizations > 0 ) { _control_panel.setColorBranches( true ); - if ( _control_panel.getColorBranchesCb() != null ) { - _control_panel.getColorBranchesCb().setSelected( true ); + if ( _control_panel.getUseVisualStylesCb() != null ) { + _control_panel.getUseVisualStylesCb().setSelected( true ); } if ( _control_panel.getColorAccSpeciesCb() != null ) { _control_panel.getColorAccSpeciesCb().setSelected( false ); @@ -910,8 +914,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee AptxUtil.removeBranchColors( _phylogeny ); TreePanelUtil.colorPhylogenyAccordingToConfidenceValues( _phylogeny, this ); _control_panel.setColorBranches( true ); - if ( _control_panel.getColorBranchesCb() != null ) { - _control_panel.getColorBranchesCb().setSelected( true ); + if ( _control_panel.getUseVisualStylesCb() != null ) { + _control_panel.getUseVisualStylesCb().setSelected( true ); } setArrowCursor(); repaint(); @@ -977,7 +981,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } final Color getGraphicsForNodeBoxWithColorForParentBranch( final PhylogenyNode node ) { - if ( getControlPanel().isColorBranches() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { + if ( getControlPanel().isUseVisualStyles() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { return ( PhylogenyMethods.getBranchColorValue( node ) ); } else { @@ -1459,17 +1463,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee root_x + ( Math.cos( angle ) * parent_radius ), root_y + ( Math.sin( angle ) * parent_radius ), g ); - if ( ( isInFoundNodes0( c ) && !isInFoundNodes1( c ) ) || isInCurrentExternalNodes( c ) ) { - g.setColor( getTreeColorSet().getFoundColor0() ); - drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g ); - } - else if ( ( isInFoundNodes1( c ) && !isInFoundNodes0( c ) ) ) { - g.setColor( getTreeColorSet().getFoundColor1() ); - drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g ); - } - else if ( isInFoundNodes0( c ) && isInFoundNodes1( c ) ) { - g.setColor( getTreeColorSet().getFoundColor0and1() ); - drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g ); + if ( isInFoundNodes( c ) || isInCurrentExternalNodes( c ) ) { + g.setColor( getColorForFoundNode( c ) ); + drawRectFilled( c.getXSecondary() - OVERVIEW_FOUND_NODE_BOX_SIZE_HALF, c.getYSecondary() + - OVERVIEW_FOUND_NODE_BOX_SIZE_HALF, OVERVIEW_FOUND_NODE_BOX_SIZE, OVERVIEW_FOUND_NODE_BOX_SIZE, g ); } } @@ -2066,8 +2063,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee setWaitCursor(); TreePanelUtil.colorPhylogenyAccordingToExternalTaxonomy( _phylogeny, this ); _control_panel.setColorBranches( true ); - if ( _control_panel.getColorBranchesCb() != null ) { - _control_panel.getColorBranchesCb().setSelected( true ); + if ( _control_panel.getUseVisualStylesCb() != null ) { + _control_panel.getUseVisualStylesCb().setSelected( true ); } setEdited( true ); setArrowCursor(); @@ -2266,7 +2263,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee && !to_graphics_file && getCopiedAndPastedNodes().contains( node.getId() ) ) { g.setColor( getTreeColorSet().getFoundColor0() ); } - else if ( getControlPanel().isColorBranches() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { + else if ( getControlPanel().isUseVisualStyles() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { g.setColor( PhylogenyMethods.getBranchColorValue( node ) ); } else if ( to_pdf ) { @@ -2417,8 +2414,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee final PhylogenyNode node, final List additional_nodes ) { _control_panel.setColorBranches( true ); - if ( _control_panel.getColorBranchesCb() != null ) { - _control_panel.getColorBranchesCb().setSelected( true ); + if ( _control_panel.getUseVisualStylesCb() != null ) { + _control_panel.getUseVisualStylesCb().setSelected( true ); } if ( node != null ) { for( final PreorderTreeIterator it = new PreorderTreeIterator( node ); it.hasNext(); ) { @@ -2433,6 +2430,31 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee repaint(); } + final private void colorizeNodes( final Color c, + final PhylogenyNode node, + final List additional_nodes ) { + _control_panel.setColorBranches( true ); + if ( _control_panel.getUseVisualStylesCb() != null ) { + _control_panel.getUseVisualStylesCb().setSelected( true ); + } + if ( node != null ) { + colorizeNodesHelper( c, node ); + } + if ( additional_nodes != null ) { + for( final PhylogenyNode n : additional_nodes ) { + colorizeNodesHelper( c, n ); + } + } + repaint(); + } + + private final static void colorizeNodesHelper( final Color c, final PhylogenyNode node ) { + if ( node.getNodeData().getNodeVisualData() == null ) { + node.getNodeData().setNodeVisualData( new NodeVisualData() ); + } + node.getNodeData().getNodeVisualData().setFontColor( new Color( c.getRed(), c.getGreen(), c.getBlue() ) ); + } + final private void colorSubtree( final PhylogenyNode node ) { if ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) { JOptionPane.showMessageDialog( this, @@ -2443,8 +2465,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } _color_chooser.setPreviewPanel( new JPanel() ); SubtreeColorizationActionListener al; - if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) { - final List additional_nodes = getFoundNodes0AsListOfPhylogenyNodes(); + if ( ( getFoundNodes0() != null ) || ( getFoundNodes1() != null ) ) { + final List additional_nodes = getFoundNodesAsListOfPhylogenyNodes(); al = new SubtreeColorizationActionListener( _color_chooser, node, additional_nodes ); } else { @@ -2455,6 +2477,63 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee dialog.setVisible( true ); } + private void colorNodeFont( final PhylogenyNode node ) { + _color_chooser.setPreviewPanel( new JPanel() ); + NodeColorizationActionListener al; + if ( ( getFoundNodes0() != null ) || ( getFoundNodes1() != null ) ) { + final List additional_nodes = getFoundNodesAsListOfPhylogenyNodes(); + al = new NodeColorizationActionListener( _color_chooser, node, additional_nodes ); + } + else { + al = new NodeColorizationActionListener( _color_chooser, node ); + } + final JDialog dialog = JColorChooser.createDialog( this, "Node colorization", true, _color_chooser, al, null ); + dialog.setVisible( true ); + } + + private void changeNodeFont( final PhylogenyNode node ) { + final FontChooser fc = new FontChooser(); + Font f = null; + if ( ( node.getNodeData().getNodeVisualData() != null ) && !node.getNodeData().getNodeVisualData().isEmpty() ) { + f = node.getNodeData().getNodeVisualData().getFont(); + } + if ( f != null ) { + fc.setFont( f ); + } + else { + fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() ); + } + fc.showDialog( this, "Select Font" ); + if ( ( fc.getFont() != null ) && !ForesterUtil.isEmpty( fc.getFont().getFamily().trim() ) ) { + List nodes = new ArrayList(); + if ( ( getFoundNodes0() != null ) || ( getFoundNodes1() != null ) ) { + nodes = getFoundNodesAsListOfPhylogenyNodes(); + } + nodes.add( node ); + for( final PhylogenyNode n : nodes ) { + if ( n.getNodeData().getNodeVisualData() == null ) { + n.getNodeData().setNodeVisualData( new NodeVisualData() ); + } + final NodeVisualData vd = n.getNodeData().getNodeVisualData(); + final Font ff = fc.getFont(); + vd.setFontName( ff.getFamily().trim() ); + int s = ff.getSize(); + if ( s < 0 ) { + s = 0; + } + if ( s > Byte.MAX_VALUE ) { + s = Byte.MAX_VALUE; + } + vd.setFontSize( s ); + vd.setFontStyle( ff.getStyle() ); + } + if ( _control_panel.getUseVisualStylesCb() != null ) { + getControlPanel().getUseVisualStylesCb().setSelected( true ); + } + } + repaint(); + } + final private void copySubtree( final PhylogenyNode node ) { if ( getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) { errorMessageNoCutCopyPasteInUnrootedDisplay(); @@ -2767,18 +2846,19 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee return getMainPanel().getCutOrCopiedTree(); } - private List getFoundNodes0AsListOfPhylogenyNodes() { + private List getFoundNodesAsListOfPhylogenyNodes() { final List additional_nodes = new ArrayList(); - for( final Long id : getFoundNodes0() ) { - additional_nodes.add( _phylogeny.getNode( id ) ); + if ( getFoundNodes0() != null ) { + for( final Long id : getFoundNodes0() ) { + additional_nodes.add( _phylogeny.getNode( id ) ); + } } - return additional_nodes; - } - - private List getFoundNodes1AsListOfPhylogenyNodes() { - final List additional_nodes = new ArrayList(); - for( final Long id : getFoundNodes1() ) { - additional_nodes.add( _phylogeny.getNode( id ) ); + if ( getFoundNodes1() != null ) { + for( final Long id : getFoundNodes1() ) { + if ( ( getFoundNodes0() == null ) || !getFoundNodes0().contains( id ) ) { + additional_nodes.add( _phylogeny.getNode( id ) ); + } + } } return additional_nodes; } @@ -2897,6 +2977,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee case COLOR_SUBTREE: colorSubtree( node ); break; + case COLOR_NODE_FONT: + colorNodeFont( node ); + break; + case CHANGE_NODE_FONT: + changeNodeFont( node ); + break; case OPEN_SEQ_WEB: openSeqWeb( node ); break; @@ -3791,7 +3877,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee else if ( getControlPanel().isColorAccordingToTaxonomy() ) { c = getTaxonomyBasedColor( node ); } - else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isColorBranches() + else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isUseVisualStyles() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { c = PhylogenyMethods.getBranchColorValue( node ); } @@ -3816,11 +3902,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee _polygon.lineTo( node.getXcoord() + 1, node.getYcoord() - d ); _polygon.lineTo( node.getXcoord() + 1, node.getYcoord() + d ); _polygon.closePath(); - if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) { + if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.SOLID ) { g.setColor( c ); g.fill( _polygon ); } - else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.NONE ) { + else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.NONE ) { g.setColor( getBackground() ); g.fill( _polygon ); g.setColor( c ); @@ -3895,17 +3981,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } - final private void paintFoundNode( final PhylogenyNode n, final double x, final double y, final Graphics2D g ) { - final int box_size = getOptions().getDefaultNodeShapeSize(); - final double half_box_size = getOptions().getDefaultNodeShapeSize() / 2.0; - g.setColor( getColorForFoundNode( n ) ); - //g.fillRect( x - half_box_size, y - half_box_size, box_size, box_size ); - //TODO check me - //FIXME - _rectangle.setRect( x - half_box_size, y - half_box_size, box_size, box_size ); - g.fill( _rectangle ); - } - final private void paintGainedAndLostCharacters( final Graphics2D g, final PhylogenyNode node, final String gained, @@ -3955,14 +4030,22 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee drawOval( x - 9, y - 8, 17, 17, g ); drawOval( x - 9, y - 9, 18, 18, g ); } - if ( isInFoundNodes( node ) || isInCurrentExternalNodes( node ) ) { - paintFoundNode( node, x, y, g ); - } - else { + if ( ( isInFoundNodes( node ) || isInCurrentExternalNodes( node ) ) + || ( getOptions().isShowDefaultNodeShapesExternal() && node.isExternal() ) + || ( getOptions().isShowDefaultNodeShapesInternal() && node.isInternal() ) + || ( getControlPanel().isEvents() && node.isHasAssignedEvent() && ( node.getNodeData().getEvent() + .isDuplication() + || node.getNodeData().getEvent().isSpeciation() || node.getNodeData().getEvent() + .isSpeciationOrDuplication() ) ) ) { + final double box_size = getOptions().getDefaultNodeShapeSize(); + final double half_box_size = box_size / 2.0; Color outline_color = null; if ( ( to_pdf || to_graphics_file ) && getOptions().isPrintBlackAndWhite() ) { outline_color = Color.BLACK; } + else if ( isInFoundNodes( node ) || isInCurrentExternalNodes( node ) ) { + outline_color = getColorForFoundNode( node ); + } else if ( getControlPanel().isEvents() && TreePanelUtil.isHasAssignedEvent( node ) ) { final Event event = node.getNodeData().getEvent(); if ( event.isDuplication() ) { @@ -3975,79 +4058,58 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee outline_color = getTreeColorSet().getDuplicationOrSpeciationColor(); } } - else if ( getOptions().isTaxonomyColorizeNodeShapes() ) { - outline_color = getTaxonomyBasedColor( node ); - } else { outline_color = getGraphicsForNodeBoxWithColorForParentBranch( node ); if ( to_pdf && ( outline_color == getTreeColorSet().getBranchColor() ) ) { outline_color = getTreeColorSet().getBranchColorForPdf(); } } - final int box_size = getOptions().getDefaultNodeShapeSize(); - final int half_box_size = box_size / 2; - if ( ( getOptions().isShowDefaultNodeShapesExternal() && node.isExternal() ) - || ( getOptions().isShowDefaultNodeShapesInternal() && node.isInternal() ) - || ( getControlPanel().isEvents() && node.isHasAssignedEvent() ) ) { - if ( getOptions().getDefaultNodeShape() == NodeShape.CIRCLE ) { - if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) { - drawOvalGradient( x - half_box_size, - y - half_box_size, - box_size, - box_size, - g, - to_pdf ? Color.WHITE : outline_color, - to_pdf ? outline_color : getBackground(), - outline_color ); - } - else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) { - Color background = getBackground(); - if ( to_pdf ) { - background = Color.WHITE; - } - drawOvalGradient( x - half_box_size, - y - half_box_size, - box_size, - box_size, - g, - background, - background, - outline_color ); - } - else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) { - g.setColor( outline_color ); - drawOvalFilled( x - half_box_size, y - half_box_size, box_size, box_size, g ); - } + if ( getOptions().getDefaultNodeShape() == NodeShape.CIRCLE ) { + if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) { + drawOvalGradient( x - half_box_size, y - half_box_size, box_size, box_size, g, to_pdf ? Color.WHITE + : outline_color, to_pdf ? outline_color : getBackground(), outline_color ); } - else if ( getOptions().getDefaultNodeShape() == NodeVisualization.NodeShape.RECTANGLE ) { - if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.GRADIENT ) { - drawRectGradient( x - half_box_size, - y - half_box_size, - box_size, - box_size, - g, - to_pdf ? Color.WHITE : outline_color, - to_pdf ? outline_color : getBackground(), - outline_color ); - } - else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.NONE ) { - Color background = getBackground(); - if ( to_pdf ) { - background = Color.WHITE; - } - drawRectGradient( x - half_box_size, - y - half_box_size, - box_size, - box_size, - g, - background, - background, - outline_color ); + else if ( getOptions().getDefaultNodeFill() == NodeFill.NONE ) { + Color background = getBackground(); + if ( to_pdf ) { + background = Color.WHITE; } - else if ( getOptions().getDefaultNodeFill() == NodeVisualization.NodeFill.SOLID ) { - g.setColor( outline_color ); - drawRectFilled( x - half_box_size, y - half_box_size, box_size, box_size, g ); + drawOvalGradient( x - half_box_size, + y - half_box_size, + box_size, + box_size, + g, + background, + background, + outline_color ); + } + else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.SOLID ) { + g.setColor( outline_color ); + drawOvalFilled( x - half_box_size, y - half_box_size, box_size, box_size, g ); + } + } + else if ( getOptions().getDefaultNodeShape() == NodeVisualData.NodeShape.RECTANGLE ) { + if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.GRADIENT ) { + drawRectGradient( x - half_box_size, y - half_box_size, box_size, box_size, g, to_pdf ? Color.WHITE + : outline_color, to_pdf ? outline_color : getBackground(), outline_color ); + } + else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.NONE ) { + Color background = getBackground(); + if ( to_pdf ) { + background = Color.WHITE; } + drawRectGradient( x - half_box_size, + y - half_box_size, + box_size, + box_size, + g, + background, + background, + outline_color ); + } + else if ( getOptions().getDefaultNodeFill() == NodeVisualData.NodeFill.SOLID ) { + g.setColor( outline_color ); + drawRectFilled( x - half_box_size, y - half_box_size, box_size, box_size, g ); } } } @@ -4091,6 +4153,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee else if ( is_in_found_nodes ) { g.setColor( getColorForFoundNode( node ) ); } + else if ( getControlPanel().isUseVisualStyles() && ( node.getNodeData().getNodeVisualData() != null ) + && ( node.getNodeData().getNodeVisualData().getFontColor() != null ) ) { + g.setColor( node.getNodeData().getNodeVisualData().getFontColor() ); + } else if ( getControlPanel().isColorAccordingToTaxonomy() ) { g.setColor( getTaxonomyBasedColor( node ) ); } @@ -4099,7 +4165,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee .getNodeData().getSequence().getAnnotations().isEmpty() ) ) ) { g.setColor( calculateColorForAnnotation( node.getNodeData().getSequence().getAnnotations() ) ); } - else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isColorBranches() + else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isUseVisualStyles() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { g.setColor( PhylogenyMethods.getBranchColorValue( node ) ); } @@ -4162,7 +4228,13 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } _sb.append( propertiesToString( node ) ); } - g.setFont( getTreeFontSet().getLargeFont() ); + if ( getControlPanel().isUseVisualStyles() && ( node.getNodeData().getNodeVisualData() != null ) ) { + final Font f = node.getNodeData().getNodeVisualData().getFont(); + g.setFont( f != null ? f : getTreeFontSet().getLargeFont() ); + } + else { + g.setFont( getTreeFontSet().getLargeFont() ); + } if ( is_in_found_nodes ) { g.setFont( getTreeFontSet().getLargeFont().deriveFont( Font.BOLD ) ); } @@ -4441,7 +4513,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } if ( isInFoundNodes( node ) || isInCurrentExternalNodes( node ) ) { g.setColor( getColorForFoundNode( node ) ); - drawRectFilled( node.getXSecondary() - 1, node.getYSecondary() - 1, 3, 3, g ); + drawRectFilled( node.getXSecondary() - OVERVIEW_FOUND_NODE_BOX_SIZE_HALF, node.getYSecondary() + - OVERVIEW_FOUND_NODE_BOX_SIZE_HALF, OVERVIEW_FOUND_NODE_BOX_SIZE, OVERVIEW_FOUND_NODE_BOX_SIZE, g ); } float new_x = 0; if ( !node.isExternal() && !node.isCollapse() ) { @@ -4813,7 +4886,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee else if ( getControlPanel().isColorAccordingToTaxonomy() ) { g.setColor( getTaxonomyBasedColor( node ) ); } - else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isColorBranches() + else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isUseVisualStyles() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) { g.setColor( PhylogenyMethods.getBranchColorValue( node ) ); } @@ -5014,7 +5087,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee desc.setYSecondary( new_y ); if ( isInFoundNodes( desc ) || isInCurrentExternalNodes( desc ) ) { g.setColor( getColorForFoundNode( desc ) ); - drawRectFilled( desc.getXSecondary() - 1, desc.getYSecondary() - 1, 3, 3, g ); + drawRectFilled( desc.getXSecondary() - OVERVIEW_FOUND_NODE_BOX_SIZE_HALF, + desc.getYSecondary() - OVERVIEW_FOUND_NODE_BOX_SIZE_HALF, + OVERVIEW_FOUND_NODE_BOX_SIZE, + OVERVIEW_FOUND_NODE_BOX_SIZE, + g ); g.setColor( getTreeColorSet().getOvColor() ); } paintUnrootedLite( desc, current_angle, current_angle + arc_size, g, urt_ov_factor ); @@ -5225,15 +5302,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee private void showExtDescNodeData( final PhylogenyNode node ) { final List data = new ArrayList(); final List nodes = node.getAllExternalDescendants(); - if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) { - for( final PhylogenyNode n : getFoundNodes0AsListOfPhylogenyNodes() ) { - if ( !nodes.contains( n ) ) { - nodes.add( n ); - } - } - } - if ( ( getFoundNodes1() != null ) && !getFoundNodes1().isEmpty() ) { - for( final PhylogenyNode n : getFoundNodes1AsListOfPhylogenyNodes() ) { + if ( ( getFoundNodes0() != null ) || ( getFoundNodes1() != null ) ) { + for( final PhylogenyNode n : getFoundNodesAsListOfPhylogenyNodes() ) { if ( !nodes.contains( n ) ) { nodes.add( n ); } @@ -5764,4 +5834,32 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } } } + + final private class NodeColorizationActionListener implements ActionListener { + + List _additional_nodes = null; + JColorChooser _chooser = null; + PhylogenyNode _node = null; + + NodeColorizationActionListener( final JColorChooser chooser, final PhylogenyNode node ) { + _chooser = chooser; + _node = node; + } + + NodeColorizationActionListener( final JColorChooser chooser, + final PhylogenyNode node, + final List additional_nodes ) { + _chooser = chooser; + _node = node; + _additional_nodes = additional_nodes; + } + + @Override + public void actionPerformed( final ActionEvent e ) { + final Color c = _chooser.getColor(); + if ( c != null ) { + colorizeNodes( c, _node, _additional_nodes ); + } + } + } }