import java.util.Hashtable;
import java.util.List;
import java.util.Set;
+import java.util.SortedSet;
import javax.swing.BorderFactory;
import javax.swing.JApplet;
}
}
- final void inferCommonPartOfScientificNames() {
- if ( ( _phylogeny == null ) || ( _phylogeny.getNumberOfExternalNodes() < 2 ) ) {
- return;
- }
- setWaitCursor();
- AptxUtil.inferCommonPartOfScientificNames( _phylogeny );
- setArrowCursor();
- repaint();
- }
-
final void initNodeData() {
if ( ( _phylogeny == null ) || _phylogeny.isEmpty() ) {
return;
}
}
- final private Color calculateColorForAnnotation( final Annotation ann ) {
+ final private Color calculateColorForAnnotation( final SortedSet<Annotation> ann ) {
Color c = getTreeColorSet().getAnnotationColor();
if ( getControlPanel().isColorAccordingToAnnotation() && ( getControlPanel().getAnnotationColors() != null ) ) {
- final String ann_str = !ForesterUtil.isEmpty( ann.getRef() ) ? ann.getRef() : ann.getDesc();
+ final StringBuilder sb = new StringBuilder();
+ for( final Annotation a : ann ) {
+ sb.append( !ForesterUtil.isEmpty( a.getRef() ) ? a.getRef() : a.getDesc() );
+ }
+ final String ann_str = sb.toString();
if ( !ForesterUtil.isEmpty( ann_str ) ) {
c = getControlPanel().getAnnotationColors().get( ann_str );
if ( c == null ) {
else if ( getControlPanel().isColorAccordingToAnnotation()
&& ( node.getNodeData().isHasSequence() && ( node.getNodeData().getSequence().getAnnotations() != null ) && ( !node
.getNodeData().getSequence().getAnnotations().isEmpty() ) ) ) {
- g.setColor( calculateColorForAnnotation( node.getNodeData().getSequence().getAnnotation( 0 ) ) );
+ g.setColor( calculateColorForAnnotation( node.getNodeData().getSequence().getAnnotations() ) );
}
else if ( getOptions().isColorLabelsSameAsParentBranch() && getControlPanel().isColorBranches()
&& ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) {
if ( _sb.length() > 0 ) {
x += getTreeFontSet()._fm_large.stringWidth( _sb.toString() ) + 5;
}
- final Annotation ann = node.getNodeData().getSequence().getAnnotation( 0 );
+ final SortedSet<Annotation> ann = node.getNodeData().getSequence().getAnnotations();
if ( ( to_pdf || to_graphics_file ) && getOptions().isPrintBlackAndWhite() ) {
g.setColor( Color.BLACK );
}
else if ( getControlPanel().isColorAccordingToAnnotation() ) {
g.setColor( calculateColorForAnnotation( ann ) );
}
- final String ann_str = ann.asSimpleText().toString();
+ final String ann_str = 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 );
}
}
+ private String createAnnotationString( final SortedSet<Annotation> 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 void paintNodeDataUnrootedCirc( final Graphics2D g,
final PhylogenyNode node,
final boolean to_pdf,
else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
g.setColor( getTaxonomyBasedColor( node ) );
}
+ else if ( getControlPanel().isColorAccordingToAnnotation()
+ && ( node.getNodeData().isHasSequence() && ( node.getNodeData().getSequence().getAnnotations() != null ) && ( !node
+ .getNodeData().getSequence().getAnnotations().isEmpty() ) ) ) {
+ g.setColor( calculateColorForAnnotation( node.getNodeData().getSequence().getAnnotations() ) );
+ }
else {
g.setColor( getTreeColorSet().getSequenceColor() );
}