NetCharts Pro

netcharts.pro.common
Class NFLegendItem

java.lang.Object
  extended by netcharts.pro.common.NFBaseClass
      extended by netcharts.pro.common.NFLegendItem
All Implemented Interfaces:
java.lang.Cloneable, NFCDLGenerator

public class NFLegendItem
extends NFBaseClass
implements NFCDLGenerator

The NFLegendItem represents a single item in a legend. This object is only used if the developer needs to explicitly specify each legend item. See NFLegend for more information.

Each legend item can have text, a symbol with border, and an associated line.


Constructor Summary
NFLegendItem()
          Constructs a default legend item object
NFLegendItem(java.lang.String text, int symbolType, java.awt.Color symbolColor)
          Constructs a legend item using the given text, symbol and symbol color.
 
Method Summary
 java.lang.Object clone()
          Clone this legend item.
 java.lang.String getCDL()
          Generate CDL parameters representing this legend item
 java.awt.Color getFillColor()
          Return symbol fill color
 NFFillPattern getFillPattern()
          Return fill pattern
 java.awt.Color getLineColor()
          Return line color
 int getLineType()
          Return line type
 int getLineWidth()
          Return line width
 int getSymbolShadowWidth()
          Gets the legend item symbol's shadow width
 int getSymbolSize()
          Return symbol size
 int getSymbolStyle()
          Return symbol style
 int getSymbolType()
          Return symbol type.
 java.lang.String getText()
          Return legend item text
 void setCDL(java.lang.String cdl)
          Configures this object from a CDL parameter representation.
 void setFillColor(java.awt.Color symbolColor)
          Set symbol fill color
 void setFillPattern(NFFillPattern pattern)
          Set the fill pattern
 void setIncludesShadowWidth(boolean includeShadowWidth)
          Enables the legend item symbol's shadow width property.
 void setLineColor(java.awt.Color lineColor)
          Set line color
 void setLineType(int lineType)
          Set line type.
 void setLineWidth(int lineWidth)
          Set line width.
 void setSymbolShadowWidth(int shadowWidth)
          Sets the legend item symbol's shadow width.
 void setSymbolSize(int symbolSize)
          Set symbol size.
 void setSymbolStyle(int symbolStyle)
          Set symbol style.
 void setSymbolType(int symbolType)
          Set symbol type.
 void setText(java.lang.String text)
          Set legend item text
 java.lang.String toString()
          Returns a new String object representing this legend item.
 
Methods inherited from class netcharts.pro.common.NFBaseClass
getModified, getUserObject, setModified, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NFLegendItem

public NFLegendItem()
Constructs a default legend item object


NFLegendItem

public NFLegendItem(java.lang.String text,
                    int symbolType,
                    java.awt.Color symbolColor)
Constructs a legend item using the given text, symbol and symbol color. An Illegal argument exception will be thrown if the symbolType is not valid.

Parameters:
text - The text of the legend item. May be the null string ("").
symbolType - One of CIRCLE, SQUARE, DIAMOND, TRIANGLEUP, TRIANGLEDOWN, CROSS, VRECTANGLE, HRECTANGLE, TARGET, BAR, TRIANGLEBAR, DIAMONDBAR, CYLINDER, PIEVERTICAL, PIEHORIZONTAL.
symbolColor - The fill color of the symbol.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone this legend item. Performs a deep copy of this object.

Overrides:
clone in class NFBaseClass
Returns:
copy of this object
Throws:
java.lang.CloneNotSupportedException

setText

public void setText(java.lang.String text)
Set legend item text

Parameters:
text - Text to display for this legend item.

getText

public java.lang.String getText()
Return legend item text

Returns:
legend item text or null if not set

setFillColor

public void setFillColor(java.awt.Color symbolColor)
Set symbol fill color

Parameters:
color - Color of symbol fill.

getFillColor

public java.awt.Color getFillColor()
Return symbol fill color

Returns:
symbol fill color or null if not set

setSymbolType

public void setSymbolType(int symbolType)
Set symbol type. One of CIRCLE, SQUARE, DIAMOND, TRIANGLEUP, TRIANGLEDOWN, CROSS, VRECTANGLE, HRECTANGLE, TARGET, BAR, TRIANGLEBAR, DIAMONDBAR, CYLINDER, PIEVERTICAL, PIEHORIZONTAL.

If the value passed is not a valid symbol type an IllegalArgumentException will be thrown.

Parameters:
symbolType - Type of symbol to be shown alongside the text.

getSymbolType

public int getSymbolType()
Return symbol type.

Returns:
symbol type or SQUARE by default.

setSymbolSize

public void setSymbolSize(int symbolSize)
Set symbol size.

Parameters:
symbolSize - Size (in pixels) of the symbol.

getSymbolSize

public int getSymbolSize()
Return symbol size

Returns:
symbol size or 10 by default

setFillPattern

public void setFillPattern(NFFillPattern pattern)
Set the fill pattern

Parameters:
pattern - Fill pattern to use.

getFillPattern

public NFFillPattern getFillPattern()
Return fill pattern

Returns:
fill pattern or null if not set.

setSymbolStyle

public void setSymbolStyle(int symbolStyle)
Set symbol style. One of OUTLINED, FILLED, BOTH

If the value passed is not a valid symbol style an IllegalArgumentException will be thrown.

Parameters:
symbolStyle - The style of the symbol.

getSymbolStyle

public int getSymbolStyle()
Return symbol style

Returns:
symbol style or FILLED by default.

setLineType

public void setLineType(int lineType)
Set line type. One of NONE, SOLID, DOTTED, DASHED, DOTDASH

If the value passed is not a valid line type an IllegalArgumentException will be thrown.

Parameters:
lineType - The type of line (if any) to be shown alongside the text.

getLineType

public int getLineType()
Return line type

Returns:
line type or NONE if not defined.

setLineWidth

public void setLineWidth(int lineWidth)
Set line width.

Parameters:
lineWidth - Width of line (in pixels).

getLineWidth

public int getLineWidth()
Return line width

Returns:
line width or 1 if not defined.

setLineColor

public void setLineColor(java.awt.Color lineColor)
Set line color

Parameters:
lineColor -

getLineColor

public java.awt.Color getLineColor()
Return line color

Returns:
line color or null if not defined.

setSymbolShadowWidth

public void setSymbolShadowWidth(int shadowWidth)
Sets the legend item symbol's shadow width.

Parameters:
shadowWidth - legend item symbol's shadow width in pixels

getSymbolShadowWidth

public int getSymbolShadowWidth()
Gets the legend item symbol's shadow width

Returns:
legend item symbol's shadow width in pixels

setCDL

public void setCDL(java.lang.String cdl)
Configures this object from a CDL parameter representation.

Specified by:
setCDL in interface NFCDLGenerator
Parameters:
cdl - CDL in the form: ("label", color, symbolType, symbolStyle,lineType, lineWidth, lineColor)

getCDL

public java.lang.String getCDL()
Generate CDL parameters representing this legend item

Specified by:
getCDL in interface NFCDLGenerator
Returns:
CDL in the form: ("label", color, symbolType, symbolStyle,lineType, lineWidth, lineColor)

toString

public java.lang.String toString()
Returns a new String object representing this legend item.

Specified by:
toString in interface NFCDLGenerator
Overrides:
toString in class java.lang.Object
Returns:
A new String object in the same form as that given by getCDL().

setIncludesShadowWidth

public void setIncludesShadowWidth(boolean includeShadowWidth)
Enables the legend item symbol's shadow width property.

Parameters:
includeShadowWidth - true to enable the legend item symbol's shadow width, false otherwise

NetCharts Pro


Visual Mining, Inc.
2099 Gaither Rd.
Suite 220
Rockville, MD 20850
800.308.0731
301.947.8293 FAX

Copyright © Visual Mining, Inc. 1996 - 2011
All Rights Reserved.

NetCharts Pro TM is a registered trademark of Visual Mining, Inc. Other brands and their products are trademarks of their respective holders.

Last Modified: Jun 28, 2011