import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
+import org.forester.archaeopteryx.tools.ImageLoader;
import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Accession;
+import org.forester.phylogeny.data.BranchWidth;
import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.Date;
import org.forester.phylogeny.data.Distribution;
"",
PHYLOXML_TAG.CONFIDENCE_TYPE,
counter );
+ String bw = "1";
+ if ( ( phylogeny_node.getBranchData().getBranchWidth() != null )
+ && ( phylogeny_node.getBranchData().getBranchWidth().getValue() != BranchWidth.BRANCH_WIDTH_DEFAULT_VALUE ) ) {
+ bw = ForesterUtil.FORMATTER_3.format( phylogeny_node.getBranchData().getBranchWidth().getValue() );
+ }
+ addSubelementEditable( category, NodePanel.NODE_BRANCH_WIDTH, bw, PHYLOXML_TAG.NODE_BRANCH_WIDTH );
}
// private void addAnnotation( final DefaultMutableTreeNode top, final Annotation ann, final String name ) {
}
private List<Point> obtainPoints() {
- ForesterUtil.ensurePresenceOfDistribution( getMyNode() );
+ Util.ensurePresenceOfDistribution( getMyNode() );
Distribution d = getMyNode().getNodeData().getDistribution();
if ( d.getPoints() == null ) {
d = new Distribution( d.getDesc(), new ArrayList<Point>(), d.getPolygons() );
}
}
break;
+ case NODE_BRANCH_WIDTH:
+ if ( ForesterUtil.isEmpty( value ) || value.equals( "1" ) ) {
+ if ( getMyNode().getBranchData().getBranchWidth() != null ) {
+ getMyNode().getBranchData().setBranchWidth( new BranchWidth() );
+ }
+ }
+ else {
+ try {
+ final double bw = ForesterUtil.parseDouble( value );
+ if ( bw >= 0 ) {
+ getMyNode().getBranchData().setBranchWidth( new BranchWidth( bw ) );
+ }
+ }
+ catch ( final ParseException e ) {
+ JOptionPane.showMessageDialog( this,
+ "failed to parse branch width from: " + value,
+ "Error",
+ JOptionPane.ERROR_MESSAGE );
+ mtn.setUserObject( "" );
+ }
+ }
+ break;
case CONFIDENCE_VALUE:
double confidence = Confidence.CONFIDENCE_DEFAULT_VALUE;
if ( !ForesterUtil.isEmpty( value ) ) {
}
break;
case TAXONOMY_CODE:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
try {
getMyNode().getNodeData().getTaxonomy().setTaxonomyCode( value );
}
}
break;
case TAXONOMY_SCIENTIFIC_NAME:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
getMyNode().getNodeData().getTaxonomy().setScientificName( value );
break;
case TAXONOMY_COMMON_NAME:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
getMyNode().getNodeData().getTaxonomy().setCommonName( value );
break;
case TAXONOMY_RANK:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
try {
getMyNode().getNodeData().getTaxonomy().setRank( value.toLowerCase() );
}
}
break;
case TAXONOMY_AUTHORITY:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
getMyNode().getNodeData().getTaxonomy().setAuthority( value );
break;
case TAXONOMY_URI: {
}
}
if ( uri != null ) {
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
}
addUri( mtn, uri, number, getMyNode().getNodeData().getTaxonomy() );
break;
}
else if ( getMyNode().getNodeData().getTaxonomy().getSynonyms().size() == number ) {
if ( !ForesterUtil.isEmpty( value ) ) {
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
getMyNode().getNodeData().getTaxonomy().getSynonyms().add( value );
}
}
}
break;
case TAXONOMY_ID_VALUE:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
if ( getMyNode().getNodeData().getTaxonomy().getIdentifier() == null ) {
getMyNode().getNodeData().getTaxonomy().setIdentifier( new Identifier( value ) );
}
}
break;
case TAXONOMY_ID_PROVIDER:
- ForesterUtil.ensurePresenceOfTaxonomy( getMyNode() );
+ Util.ensurePresenceOfTaxonomy( getMyNode() );
if ( getMyNode().getNodeData().getTaxonomy().getIdentifier() == null ) {
getMyNode().getNodeData().getTaxonomy().setIdentifier( new Identifier( "", value ) );
}
}
break;
case SEQ_LOCATION:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
getMyNode().getNodeData().getSequence().setLocation( value );
break;
case SEQ_MOL_SEQ:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
getMyNode().getNodeData().getSequence().setMolecularSequence( value );
break;
case SEQ_NAME:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
getMyNode().getNodeData().getSequence().setName( value );
break;
case SEQ_SYMBOL:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
try {
getMyNode().getNodeData().getSequence().setSymbol( value );
}
}
break;
case SEQ_TYPE:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
try {
getMyNode().getNodeData().getSequence().setType( value.toLowerCase() );
}
}
break;
case SEQ_ACC_SOURCE:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
if ( getMyNode().getNodeData().getSequence().getAccession() == null ) {
getMyNode().getNodeData().getSequence().setAccession( new Accession( "", value ) );
}
}
break;
case SEQ_ACC_VALUE:
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
if ( getMyNode().getNodeData().getSequence().getAccession() == null ) {
getMyNode().getNodeData().getSequence().setAccession( new Accession( value, "" ) );
}
}
}
if ( uri != null ) {
- ForesterUtil.ensurePresenceOfSequence( getMyNode() );
+ Util.ensurePresenceOfSequence( getMyNode() );
}
addUri( mtn, uri, number, getMyNode().getNodeData().getSequence() );
break;
getMyNode().getNodeData().getEvent().setGeneLosses( parsePositiveInt( mtn, value ) );
break;
case DATE_DESCRIPTION:
- ForesterUtil.ensurePresenceOfDate( getMyNode() );
+ Util.ensurePresenceOfDate( getMyNode() );
getMyNode().getNodeData().getDate().setDesc( value );
break;
case DATE_MAX:
- ForesterUtil.ensurePresenceOfDate( getMyNode() );
+ Util.ensurePresenceOfDate( getMyNode() );
getMyNode().getNodeData().getDate().setMax( parseBigDecimal( mtn, value ) );
break;
case DATE_MIN:
- ForesterUtil.ensurePresenceOfDate( getMyNode() );
+ Util.ensurePresenceOfDate( getMyNode() );
getMyNode().getNodeData().getDate().setMin( parseBigDecimal( mtn, value ) );
break;
case DATE_UNIT:
- ForesterUtil.ensurePresenceOfDate( getMyNode() );
+ Util.ensurePresenceOfDate( getMyNode() );
getMyNode().getNodeData().getDate().setUnit( value );
break;
case DATE_VALUE:
- ForesterUtil.ensurePresenceOfDate( getMyNode() );
+ Util.ensurePresenceOfDate( getMyNode() );
getMyNode().getNodeData().getDate().setValue( parseBigDecimal( mtn, value ) );
break;
case DIST_ALT: {
break;
}
case DIST_DESC: {
- ForesterUtil.ensurePresenceOfDistribution( getMyNode() );
+ Util.ensurePresenceOfDistribution( getMyNode() );
final Distribution d = getMyNode().getNodeData().getDistribution();
getMyNode().getNodeData().setDistribution( new Distribution( value, d.getPoints(), d.getPolygons() ) );
break;
private enum PHYLOXML_TAG {
NODE_NAME,
NODE_BRANCH_LENGTH,
+ NODE_BRANCH_WIDTH,
TAXONOMY_CODE,
TAXONOMY_SCIENTIFIC_NAME,
TAXONOMY_AUTHORITY,