import org.forester.phylogeny.data.PhylogenyDataUtil;
import org.forester.phylogeny.data.PropertiesMap;
import org.forester.phylogeny.data.Property;
+import org.forester.phylogeny.data.Property.AppliesTo;
import org.forester.phylogeny.data.Reference;
import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.SequenceRelation;
else if ( qualified_name.equals( PhyloXmlMapping.PROPERTY ) ) {
final Property prop = ( Property ) PropertyParser.getInstance().parse( element );
if ( prop.getRef().startsWith( NodeVisualData.APTX_VISUALIZATION_REF ) ) {
- if ( node.getNodeData().getNodeVisualData() == null ) {
- node.getNodeData().setNodeVisualData( new NodeVisualData() );
+ if ( prop.getAppliesTo() == AppliesTo.NODE ) {
+ if ( node.getNodeData().getNodeVisualData() == null ) {
+ node.getNodeData().setNodeVisualData( new NodeVisualData() );
+ }
+ final NodeVisualData vd = node.getNodeData().getNodeVisualData();
+ vd.parseProperty( prop );
+ }
+ else {
+ System.err.println( "Do not know how to handle " + NodeVisualData.APTX_VISUALIZATION_REF
+ + " property applied to " + prop.getAppliesTo() );
}
- final NodeVisualData vd = node.getNodeData().getNodeVisualData();
- vd.parseProperty( prop );
}
else {
if ( !node.getNodeData().isHasProperties() ) {
return;\r
}\r
}\r
+ //\r
+ else if ( prop.getRef().equals( NODE_SIZE_REF ) ) {\r
+ int s = -1;\r
+ try {\r
+ s = Integer.parseInt( prop.getValue() );\r
+ }\r
+ catch ( final NumberFormatException e ) {\r
+ return;\r
+ }\r
+ if ( s >= 0 ) {\r
+ setSize( s );\r
+ }\r
+ }\r
+ else if ( prop.getRef().equals( NODE_FILL_COLOR_REF ) ) {\r
+ try {\r
+ setFillColor( Color.decode( prop.getValue() ) );\r
+ }\r
+ catch ( final NumberFormatException e ) {\r
+ return;\r
+ }\r
+ }\r
+ else if ( prop.getRef().equals( NODE_BORDER_COLOR_REF ) ) {\r
+ try {\r
+ setBorderColor( Color.decode( prop.getValue() ) );\r
+ }\r
+ catch ( final NumberFormatException e ) {\r
+ return;\r
+ }\r
+ }\r
+ else if ( prop.getRef().equals( NODE_SHAPE_REF ) ) {\r
+ try {\r
+ setShape( prop.getValue() );\r
+ }\r
+ catch ( final NumberFormatException e ) {\r
+ return;\r
+ }\r
+ }\r
}\r
\r
public final void setBorderColor( final Color border_color ) {\r
_shape = shape;\r
}\r
\r
+ public final void setShape( final String shape ) {\r
+ if ( shape.equalsIgnoreCase( NODE_SHAPE_CIRCLE ) ) {\r
+ setShape( NodeShape.CIRCLE );\r
+ }\r
+ else if ( shape.equalsIgnoreCase( NODE_SHAPE_RECTANGLE ) ) {\r
+ setShape( NodeShape.RECTANGLE );\r
+ }\r
+ else {\r
+ setShape( NodeShape.DEFAULT );\r
+ }\r
+ }\r
+\r
public final void setSize( final float size ) {\r
+ if ( ( size != DEFAULT_SIZE ) && ( size < 0 ) ) {\r
+ throw new IllegalArgumentException( "negative size: " + size );\r
+ }\r
_size = size;\r
}\r
\r
FONT_COLOR_TYPE,\r
AppliesTo.NODE ) );\r
}\r
- //\r
if ( getShape() != NodeShape.DEFAULT ) {\r
String shape = null;\r
if ( getShape() == NodeShape.RECTANGLE ) {\r