com.davisor.graphics.chart
Class LegendAttributes

java.lang.Object
  extended bycom.davisor.graphics.chart.LegendAttributes
All Implemented Interfaces:
com.davisor.core.Dupable, java.io.Serializable

public class LegendAttributes
extends java.lang.Object
implements com.davisor.core.Dupable, java.io.Serializable

LegendAttributes represents legend attributes including

Since:
JDK1.2
See Also:
LegendRenderAttributes, BoxModelAttributes, Serialized Form

Field Summary
protected  java.lang.Number M_gap
          Gap around elements.
protected  java.lang.Number M_height
          Explicitly given legend height.
protected  java.lang.Boolean M_hidden
          Is legend hidden or not.
protected  java.lang.Number M_labelOffset
          Offset between legend labels.
protected  java.lang.String M_legendType
          Legend type.
protected  BoxModelAttributes M_margins
          Margins.
protected  int M_orientation
          Orientation.
protected  LegendRenderAttributes M_render
          Rendering attributes.
protected  java.lang.Number M_width
          Explicilty given legend width.
 
Constructor Summary
LegendAttributes()
          Creates a new legend attributes with default null values.
LegendAttributes(LegendAttributes la)
          Deep copy constructor.
LegendAttributes(java.lang.String legendType, LegendRenderAttributes render, java.lang.Number gap, BoxModelAttributes margins, java.lang.Boolean hidden)
          Creates a new legend attributes set.
LegendAttributes(java.lang.String legendType, LegendRenderAttributes render, java.lang.Number gap, BoxModelAttributes margins, java.lang.Boolean hidden, int orientation, java.lang.Number labelOffset)
          Creates a new legend attributes set.
 
Method Summary
 com.davisor.core.Dupable dup()
          Duplicates this object.
 boolean equals(java.lang.Object object)
          Test if this legend attribtues equals to given attributes.
 java.lang.Number getGap()
          Gets legend symbol gap.
 java.lang.Number getHeight()
          Gets the user specified legend height.
 java.lang.Number getLabelOffset()
          Gets legend label offset.
 float getLabelOffset(float defaultOffset)
          Gets legend label offset, or if unset, a given default offset value.
 java.lang.String getLegendType()
          Returns legend factory name.
 BoxModelAttributes getMargins()
          Gets legend margins.
 int getOrientation()
          Returns legend orientation as alignment code.
 LegendRenderAttributes getRender()
          Returns reference to render attributes.
 java.lang.Number getWidth()
          Gets the user specified legend width.
 java.lang.Boolean isHidden()
          Tests if legend is hidden or not.
 boolean isHiddenDefault()
          Tests if legend is hidden or not.
 void setGap(java.lang.Number gap)
          Set gap for the legend symbols.
 void setHeight(java.lang.Number height)
          Set legend height.
 void setHidden(java.lang.Boolean hidden)
          Sets if the legend is hidden or not.
 void setLabelOffset(float labelOffset)
          Sets legend label offset.
 void setLabelOffset(java.lang.Number labelOffset)
          Sets legend label offset.
 void setMargins(BoxModelAttributes margins)
          Set legend margins.
 void setOrientation(int orientation)
          Sets legend orientation.
 void setWidth(java.lang.Number width)
          Set legend width.
 java.lang.String toString()
          Gets legend attributes XML representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

M_render

protected LegendRenderAttributes M_render
Rendering attributes.


M_gap

protected java.lang.Number M_gap
Gap around elements.


M_labelOffset

protected java.lang.Number M_labelOffset
Offset between legend labels.


M_margins

protected BoxModelAttributes M_margins
Margins.


M_orientation

protected int M_orientation
Orientation.


M_hidden

protected java.lang.Boolean M_hidden
Is legend hidden or not.


M_legendType

protected java.lang.String M_legendType
Legend type. Refers to one of chart factories.


M_width

protected java.lang.Number M_width
Explicilty given legend width.


M_height

protected java.lang.Number M_height
Explicitly given legend height.

Constructor Detail

LegendAttributes

public LegendAttributes()
Creates a new legend attributes with default null values.


LegendAttributes

public LegendAttributes(LegendAttributes la)
Deep copy constructor.

Parameters:
la - legend attributes to copy
See Also:
dup()

LegendAttributes

public LegendAttributes(java.lang.String legendType,
                        LegendRenderAttributes render,
                        java.lang.Number gap,
                        BoxModelAttributes margins,
                        java.lang.Boolean hidden)
Creates a new legend attributes set. Label offset will be set to null and orientation value to unset.

Parameters:
legendType - legend factory name (may be null)
render - render attributes (may be null)
gap - gap around symbol (may be null)
margins - margins around the legend (may be null)
hidden - is legend hidden or not (may be null)
See Also:
LegendAttributes(String,LegendRenderAttributes,Number, BoxModelAttributes,Boolean,int,Number)

LegendAttributes

public LegendAttributes(java.lang.String legendType,
                        LegendRenderAttributes render,
                        java.lang.Number gap,
                        BoxModelAttributes margins,
                        java.lang.Boolean hidden,
                        int orientation,
                        java.lang.Number labelOffset)
Creates a new legend attributes set.

Parameters:
legendType - legend factory name (may be null)
render - render attributes (may be null)
gap - gap around symbol (may be null)
margins - margins around the legend (may be null)
hidden - is legend hidden or not (may be null)
orientation - legend orientation as alignment code
labelOffset - label offset (may be null)
Method Detail

dup

public com.davisor.core.Dupable dup()
Duplicates this object.

Specified by:
dup in interface com.davisor.core.Dupable

equals

public boolean equals(java.lang.Object object)
Test if this legend attribtues equals to given attributes.


toString

public java.lang.String toString()
Gets legend attributes XML representation.


getGap

public java.lang.Number getGap()
Gets legend symbol gap.

See Also:
setGap(Number)

getLabelOffset

public java.lang.Number getLabelOffset()
Gets legend label offset.

See Also:
getLabelOffset(float), setLabelOffset(Number)

getLabelOffset

public float getLabelOffset(float defaultOffset)
Gets legend label offset, or if unset, a given default offset value.

Parameters:
defaultOffset - default offset to be used if offset has not been set
See Also:
getLabelOffset(), setLabelOffset(float)

getHeight

public java.lang.Number getHeight()
Gets the user specified legend height. May return null.

See Also:
setHeight(java.lang.Number)

getLegendType

public java.lang.String getLegendType()
Returns legend factory name.


getMargins

public BoxModelAttributes getMargins()
Gets legend margins.

See Also:
setMargins(BoxModelAttributes)

getOrientation

public int getOrientation()
Returns legend orientation as alignment code.

See Also:
setOrientation(int), RenderAttributes.isHorizontal(int), RenderAttributes.isVertical(int)

getRender

public LegendRenderAttributes getRender()
Returns reference to render attributes.


isHidden

public java.lang.Boolean isHidden()
Tests if legend is hidden or not.

Returns:
if legend is hidden or not
See Also:
isHiddenDefault(), setHidden(java.lang.Boolean)

isHiddenDefault

public boolean isHiddenDefault()
Tests if legend is hidden or not. Legends are not hidden by default.

Returns:
if legend is hidden or not (false by default)
See Also:
isHidden()

getWidth

public java.lang.Number getWidth()
Gets the user specified legend width. May return null.

See Also:
setWidth(java.lang.Number)

setGap

public void setGap(java.lang.Number gap)
Set gap for the legend symbols.

Parameters:
gap - symbol gap in percents (0-100) (may be null)

setHeight

public void setHeight(java.lang.Number height)
Set legend height.

Parameters:
height - legend height in pixels (may be null)

setHidden

public void setHidden(java.lang.Boolean hidden)
Sets if the legend is hidden or not.

Parameters:
hidden - is legend hidden or not (may be null)
See Also:
isHidden()

setLabelOffset

public void setLabelOffset(float labelOffset)
Sets legend label offset.

See Also:
getLabelOffset(), getLabelOffset(float), setLabelOffset(Number)

setLabelOffset

public void setLabelOffset(java.lang.Number labelOffset)
Sets legend label offset. The label offset determines the empty space between the legend and the legend labels, expressed in device units. If it is null, it defaults to some appropriate value, like zero, font leading, or 50% of the font size.

See Also:
getLabelOffset(), getLabelOffset(float), setLabelOffset(float)

setOrientation

public void setOrientation(int orientation)
Sets legend orientation. Uses alignment constants defined in RenderAttributes. Defines whether the legend entries are laid horizontally or vertically.

Parameters:
orientation - Legend orientation.
See Also:
getOrientation()

setMargins

public void setMargins(BoxModelAttributes margins)
Set legend margins.

Parameters:
margins - legend margins (may be null)

setWidth

public void setWidth(java.lang.Number width)
Set legend width.

Parameters:
width - legend width in pixels (may be null)


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.