+\r
package org.forester.phylogeny.data;\r
\r
import java.awt.Color;\r
import java.util.ArrayList;\r
import java.util.List;\r
\r
-\r
import org.forester.phylogeny.data.Property.AppliesTo;\r
import org.forester.util.ForesterUtil;\r
\r
-\r
public final class NodeVisualData implements PhylogenyData {\r
- \r
- private static final int DEFAULT_SIZE = -1;\r
- private static final int DEFAULT_TRANSPARANCY = -1;\r
- private static final byte DEFAULT_FONT_SIZE = -1;\r
- private NodeShape _shape;\r
- private NodeFill _fill_type;\r
- private Color _border_color;\r
- private Color _fill_color;\r
- \r
- private String _font;\r
- private FontType _font_type;\r
- private byte _font_size;\r
- private Color _font_color;\r
- \r
- private float _size;\r
- private float _transparancy;\r
+\r
+ public static final String SIZE_REF = "aptx_visualiation:node_size";\r
+ public static final String SIZE_TYPE = "xsd:decimal";\r
+ private static final byte DEFAULT_FONT_SIZE = -1;\r
+ private static final int DEFAULT_SIZE = -1;\r
+ private static final int DEFAULT_TRANSPARANCY = -1;\r
+ private Color _border_color;\r
+ private Color _fill_color;\r
+ private NodeFill _fill_type;\r
+ private String _font;\r
+ private Color _font_color;\r
+ private byte _font_size;\r
+ private FontType _font_type;\r
+ private NodeShape _shape;\r
+ private float _size;\r
+ private float _transparancy;\r
\r
public NodeVisualData() {\r
init();\r
}\r
\r
- public NodeVisualData( final String font,\r
- final FontType font_type,\r
- byte font_size,\r
- Color font_color,\r
- final NodeShape shape,\r
- final NodeFill fill_type,\r
- final Color border_color,\r
- final Color fill_color,\r
- final float size,\r
- final float transparancy ) {\r
+ public NodeVisualData( final String font,\r
+ final FontType font_type,\r
+ final byte font_size,\r
+ final Color font_color,\r
+ final NodeShape shape,\r
+ final NodeFill fill_type,\r
+ final Color border_color,\r
+ final Color fill_color,\r
+ final float size,\r
+ final float transparancy ) {\r
setFont( font );\r
- setFontType(font_type );\r
+ setFontType( font_type );\r
setFontSize( font_size );\r
setFontColor( font_color );\r
setShape( shape );\r
}\r
\r
@Override\r
- public final PhylogenyData copy() {\r
- return new NodeVisualData( ForesterUtil.isEmpty( getFont() ) ? new String( getFont()) : null ,\r
+ public final PhylogenyData copy() {\r
+ return new NodeVisualData( !ForesterUtil.isEmpty( getFont() ) ? new String( getFont() ) : null,\r
getFontType(),\r
getFontSize(),\r
getFontColor() != null ? new Color( getFontColor().getRed(), getFontColor()\r
- .getGreen(), getFontColor().getBlue() ) : null, \r
+ .getGreen(), getFontColor().getBlue() ) : null,\r
getShape(),\r
- getFillType(),\r
- getBorderColor() != null ? new Color( getBorderColor().getRed(), getBorderColor()\r
- .getGreen(), getBorderColor().getBlue() ) : null,\r
- getFillColor() != null ? new Color( getFillColor().getRed(), getFillColor()\r
- .getGreen(), getFillColor().getBlue() ) : null,\r
- getSize(),\r
- getTransparancy() );\r
+ getFillType(),\r
+ getBorderColor() != null ? new Color( getBorderColor().getRed(), getBorderColor()\r
+ .getGreen(), getBorderColor().getBlue() ) : null,\r
+ getFillColor() != null ? new Color( getFillColor().getRed(), getFillColor()\r
+ .getGreen(), getFillColor().getBlue() ) : null,\r
+ getSize(),\r
+ getTransparancy() );\r
}\r
\r
public final Color getBorderColor() {\r
return _fill_type;\r
}\r
\r
+ public final String getFont() {\r
+ return _font;\r
+ }\r
+\r
+ public final Color getFontColor() {\r
+ return _font_color;\r
+ }\r
+\r
+ public final byte getFontSize() {\r
+ return _font_size;\r
+ }\r
+\r
+ public final FontType getFontType() {\r
+ return _font_type;\r
+ }\r
+\r
public final NodeShape getShape() {\r
return _shape;\r
}\r
return _transparancy;\r
}\r
\r
- private final void init() {\r
- setFont( null );\r
- setFontType( FontType.NORMAL );\r
- setFontSize( DEFAULT_FONT_SIZE );\r
- setFontColor( null );\r
- setShape( NodeShape.DEFAULT );\r
- setFillType( NodeFill.DEFAULT );\r
- setBorderColor( null );\r
- setFillColor( null );\r
- setSize( DEFAULT_SIZE );\r
- setTransparancy( DEFAULT_TRANSPARANCY );\r
+ public final boolean isEmpty() {\r
+ return ( ForesterUtil.isEmpty( getFont() ) && ( getFontType() == FontType.NORMAL )\r
+ && ( getFontSize() == DEFAULT_FONT_SIZE ) && ( getFontColor() == null )\r
+ && ( getShape() == NodeShape.DEFAULT ) && ( getFillType() == NodeFill.DEFAULT )\r
+ && ( getBorderColor() == null ) && ( getFillColor() == null ) && ( getSize() == DEFAULT_SIZE ) && ( getTransparancy() == DEFAULT_TRANSPARANCY ) );\r
}\r
\r
@Override\r
_fill_type = fill_type;\r
}\r
\r
+ public final void setFont( final String font ) {\r
+ if ( !ForesterUtil.isEmpty( font ) ) {\r
+ _font = font;\r
+ }\r
+ else {\r
+ _font = null;\r
+ }\r
+ }\r
+\r
+ public final void setFontColor( final Color font_color ) {\r
+ _font_color = font_color;\r
+ }\r
+\r
+ public final void setFontSize( final byte font_size ) {\r
+ _font_size = font_size;\r
+ }\r
+\r
+ public final void setFontType( final FontType font_type ) {\r
+ _font_type = font_type;\r
+ }\r
+\r
public final void setShape( final NodeShape shape ) {\r
_shape = shape;\r
}\r
return asText().toString();\r
}\r
\r
- public enum NodeFill {\r
- NONE, GRADIENT, SOLID, DEFAULT\r
- }\r
-\r
- public enum NodeShape {\r
- CIRCLE, RECTANGLE, DEFAULT\r
- }\r
- \r
- public enum FontType {\r
- NORMAL, BOLD, ITALIC, BOLD_ITALIC\r
+ private final void init() {\r
+ setFont( null );\r
+ setFontType( FontType.NORMAL );\r
+ setFontSize( DEFAULT_FONT_SIZE );\r
+ setFontColor( null );\r
+ setShape( NodeShape.DEFAULT );\r
+ setFillType( NodeFill.DEFAULT );\r
+ setBorderColor( null );\r
+ setFillColor( null );\r
+ setSize( DEFAULT_SIZE );\r
+ setTransparancy( DEFAULT_TRANSPARANCY );\r
}\r
\r
private final List<Property> toProperties() {\r
properties.add( new Property( SIZE_REF, String.valueOf( getBorderColor() ), "", SIZE_TYPE, AppliesTo.NODE ) );\r
return properties;\r
}\r
- public static final String SIZE_REF = "aptx_visualiation:node_sise";\r
- public static final String SIZE_TYPE = "xsd:decimal";\r
-\r
- public final boolean isEmpty() {\r
- return ( ForesterUtil.isEmpty( getFont() ) &&\r
- getFontType() == FontType.NORMAL && \r
- getFontSize() == DEFAULT_FONT_SIZE &&\r
- getFontColor() == null &&\r
- getShape() == NodeShape.DEFAULT &&\r
- getFillType() == NodeFill.DEFAULT &&\r
- getBorderColor() == null &&\r
- getFillColor() == null &&\r
- getSize() == DEFAULT_SIZE &&\r
- getTransparancy() == DEFAULT_TRANSPARANCY );\r
- }\r
-\r
- public final String getFont() {\r
- return _font;\r
- }\r
\r
- public final void setFont( final String font ) {\r
- if ( !ForesterUtil.isEmpty( font ) ) {\r
- _font = font;\r
- }\r
- else {\r
- _font = null;\r
- }\r
- }\r
-\r
- public final FontType getFontType() {\r
- return _font_type;\r
- }\r
-\r
- public final void setFontType( FontType font_type ) {\r
- _font_type = font_type;\r
- }\r
-\r
- public final byte getFontSize() {\r
- return _font_size;\r
- }\r
-\r
- public final void setFontSize( byte font_size ) {\r
- _font_size = font_size;\r
+ public enum FontType {\r
+ BOLD, BOLD_ITALIC, ITALIC, NORMAL\r
}\r
\r
- public final Color getFontColor() {\r
- return _font_color;\r
+ public enum NodeFill {\r
+ DEFAULT, GRADIENT, NONE, SOLID\r
}\r
\r
- public final void setFontColor( Color font_color ) {\r
- _font_color = font_color;\r
+ public enum NodeShape {\r
+ CIRCLE, DEFAULT, RECTANGLE\r
}\r
}\r