X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FTreePanel.java;h=1eaadd3922aadc943dcb73798665623ddf10b228;hb=5c4e24e304f57058fa1c3a3f1256a573b37d89f6;hp=151a3e563e8ea94eb33652a09dd3e21dda1d8965;hpb=12b27463955ee6d787d5c5e7cfbef303d8327669;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 151a3e5..1eaadd3 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -620,8 +620,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( getControlPanel().isShowAnnotation() && ( node.getNodeData().getSequence().getAnnotations() != null ) && !node.getNodeData().getSequence().getAnnotations().isEmpty() ) { - sum += getTreeFontSet()._fm_large.stringWidth( node.getNodeData().getSequence().getAnnotation( 0 ) - .asSimpleText() + sum += getTreeFontSet()._fm_large.stringWidth( AptxUtil.createAnnotationString( node.getNodeData() + .getSequence().getAnnotations() ) + " " ); } if ( getControlPanel().isShowDomainArchitectures() @@ -711,11 +711,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee } if ( c == null ) { if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) { - c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode() ); + c = AptxUtil.calculateColorFromString( tax.getTaxonomyCode(), true ); getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c ); } else { - c = AptxUtil.calculateColorFromString( tax.getScientificName() ); + c = AptxUtil.calculateColorFromString( tax.getScientificName(), true ); getControlPanel().getSpeciesColors().put( tax.getScientificName(), c ); } } @@ -2334,13 +2334,13 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee if ( getControlPanel().isColorAccordingToAnnotation() && ( getControlPanel().getAnnotationColors() != null ) ) { final StringBuilder sb = new StringBuilder(); for( final Annotation a : ann ) { - sb.append( !ForesterUtil.isEmpty( a.getRef() ) ? a.getRef() : a.getDesc() ); + sb.append( !ForesterUtil.isEmpty( a.getRefValue() ) ? a.getRefValue() : a.getDesc() ); } final String ann_str = sb.toString(); if ( !ForesterUtil.isEmpty( ann_str ) ) { c = getControlPanel().getAnnotationColors().get( ann_str ); if ( c == null ) { - c = AptxUtil.calculateColorFromString( ann_str ); + c = AptxUtil.calculateColorFromString( ann_str, false ); getControlPanel().getAnnotationColors().put( ann_str, c ); } if ( c == null ) { @@ -2429,22 +2429,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee repaint(); } - private String createAnnotationString( final SortedSet ann ) { - final StringBuilder sb = new StringBuilder(); - boolean first = true; - for( final Annotation a : ann ) { - if ( !first ) { - sb.append( "+" ); - } - else { - first = false; - } - sb.append( a.asSimpleText() ); - } - final String ann_str = sb.toString(); - return ann_str; - } - final private String createASimpleTextRepresentationOfANode( final PhylogenyNode node ) { final String tax = PhylogenyMethods.getSpecies( node ); String label = node.getName(); @@ -4111,7 +4095,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee else if ( getControlPanel().isColorAccordingToAnnotation() ) { g.setColor( calculateColorForAnnotation( ann ) ); } - final String ann_str = createAnnotationString( ann ); + final String ann_str = AptxUtil.createAnnotationString( ann ); TreePanel.drawString( ann_str, node.getXcoord() + x + 3 + half_box_size, node.getYcoord() + ( getTreeFontSet()._fm_large.getAscent() / down_shift_factor ), g ); _sb.setLength( 0 );