ucar.unidata.idv.control.chart
Class LineState

java.lang.Object
  extended by ucar.unidata.idv.control.chart.LineState

public class LineState
extends Object

Holds graphics state

Version:
$Revision: 1.23 $
Author:
IDV Development Team

Field Summary
static Color[] COLORS
          The array of colors we cycle through
static String[] HPOS_LABELS
          vertical position labels
static int HPOS_LEFT
          horizontal position value
static int HPOS_MIDDLE
          horizontal position value
static int HPOS_NONE
          horizontal position value
static int HPOS_RIGHT
          horizontal position value
static int[] HPOS_VALUES
          horizontal positions
protected  int index
          index
static int LINETYPE_AREA
          Useful constant for specifying the type of rendering (area only).
static int LINETYPE_AREA_AND_SHAPES
          Useful constant for specifying the type of rendering (area and shapes).
static int LINETYPE_BAR
          line type
static int[] LINETYPE_IDS
          line types
static String[] LINETYPE_LABELS
          line type labels
static int LINETYPE_LINES
          Useful constant for specifying the type of rendering (lines only).
static int LINETYPE_SHAPES
          line type
static int LINETYPE_SHAPES_AND_LINES
          Useful constant for specifying the type of rendering (shapes and lines).
static int SHAPE_HLINE
          shape type
static int SHAPE_LARGEPOINT
          shape type
static String[] SHAPE_NAMES
          shape names
static int SHAPE_PLUS
          shape type
static int SHAPE_POINT
          shape type
static int SHAPE_RECTANGLE
          shape type
static int SHAPE_VLINE
          shape type
static int SHAPE_X
          shape type
static int[] SHAPES
          shape types
static int SIDE_LEFT
          which side in legend
static int SIDE_RIGHT
          which side in legend
static int SIDE_UNDEFINED
          which side in legend
static String[] SIDELABELS
          which side in legend
static int[] SIDES
          which side in legend
static int STROKE_DASH
          Stroke type
static int STROKE_DOT
          Stroke type
static int STROKE_DOTDASH
          Stroke type
static int[] STROKE_IDS
          Stroke types
static String[] STROKE_LABELS
          Stroke type labels
static int STROKE_SOLID
          Stroke type
protected  Unit unit
          display unit
static int VPOS_BOTTOM
          vertical position value
static String[] VPOS_LABELS
          horizontal position labels
static int VPOS_MIDDLE
          vertical position value
static int VPOS_NONE
          vertical position value
static int VPOS_TOP
          vertical position value
static int[] VPOS_VALUES
          vertical positions
 
Constructor Summary
LineState()
          Default ctor
LineState(Color color, float width, int strokeType)
          Constructor
LineState(Color color, float width, int strokeType, int lineType, int shapeType)
          Constructor
 
Method Summary
protected  boolean applyProperties()
          Apply properties
 String getAxisLabel()
          Get the AxisLabel property.
 boolean getAxisVisible()
          Get the AxisVisible property.
 String getChartName()
          Get the ChartName property.
 Color getColor()
          Get the Color property.
 Color getColor(int index)
          if we have a color then return it.
static Color getFixedColor(int index)
          Utility to get a color in the static list of colors
 int getHorizontalPosition()
          Get the HorizontalPosition property.
 int getLineType()
          Get the LineType property.
 String getName()
          Get the Name property.
 String getNameMacro()
          Get the NameMacro property.
 Shape getPaintShape()
          get the shape we use to paint
protected  JComponent getPropertyContents()
          Create the properties contents
protected  JComponent getPropertyContents(boolean full, List chartNames, List sampleRanges)
          Create the properties contents
 Range getRange()
          Get the Range property.
 boolean getRangeIncludesZero()
          Get the RangeIncludesZero property.
 int getShape()
          Get the Shape property.
 int getSide()
          Get the Side property.
 BasicStroke getStroke()
          Create a stroke
 int getStrokeType()
          Get the StrokeType property.
 List<DateTime> getTimes()
          Get the list of times
 boolean getUseLogarithmicRange()
          Get the UseLogarithmicRange property.
 boolean getUseVerticalPosition()
          Get the UseVertical property.
 boolean getValid()
          Get the Valid property.
 List<Real> getValues()
          Get the list of values
 int getVerticalPosition()
          Get the VerticalPosition property.
 boolean getVisible()
          Get the Visible property.
 boolean getVisibleInLegend()
          Get the VisibleInLegend property.
 float getWidth()
          Get the Width property.
 boolean hasName()
          Does this linestate have a name defined
static BasicStroke makeStroke(float width, int type)
          create a stroke
 void setAxisLabel(String value)
          Set the AxisLabel property.
 void setAxisVisible(boolean value)
          Set the AxisVisible property.
 void setChartName(String value)
          Set the chart name property.
 void setColor(Color value)
          Set the Color property.
 void setHorizontalPosition(int value)
          Set the HorizontalPosition property.
 void setLineType(int value)
          Set the LineType property.
 void setName(String value)
          Set the Name property.
 void setNameIfNeeded(String value)
          Set the name if needed
 void setNameMacro(String value)
          Set the NameMacro property.
 void setRange(Range value)
          Set the Range property.
 void setRangeIncludesZero(boolean value)
          Set the RangeIncludesZero property.
 void setRangeInProperties(Range r)
          apply range to gui
 void setShape(int value)
          Set the Shape property.
 void setSide(int value)
          Set the Side property.
 void setStrokeType(int value)
          Set the StrokeType property.
 void setStrokeType(Integer value)
          set stroke
 void setTrack(List<DateTime> times, List<Real> values)
          Set the track with a list of times and values
 void setUseLogarithmicRange(boolean value)
          Set the UseLogarithmicRange property.
 void setUseVerticalPosition(boolean value)
          Set the UseVertical property.
 void setValid(boolean value)
          Set the Valid property.
 void setVerticalPosition(int value)
          Set the VerticalPosition property.
 void setVisible(boolean value)
          Set the Visible property.
 void setVisibleInLegend(boolean value)
          Set the VisibleInLegend property.
 void setWidth(float value)
          Set the Width property.
 boolean showPropertiesDialog(PropertyChangeListener propListener, boolean doVisible, boolean doRange, List chartNames, List sampleRanges)
          show dialog
 boolean showPropertiesDialog(PropertyChangeListener listener, List chartNames, List ranges)
          show dialog
 void showRangePopup(List ranges)
          popup range menu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VPOS_TOP

public static final int VPOS_TOP
vertical position value

See Also:
Constant Field Values

VPOS_MIDDLE

public static final int VPOS_MIDDLE
vertical position value

See Also:
Constant Field Values

VPOS_BOTTOM

public static final int VPOS_BOTTOM
vertical position value

See Also:
Constant Field Values

VPOS_NONE

public static final int VPOS_NONE
vertical position value

See Also:
Constant Field Values

HPOS_LEFT

public static final int HPOS_LEFT
horizontal position value

See Also:
Constant Field Values

HPOS_MIDDLE

public static final int HPOS_MIDDLE
horizontal position value

See Also:
Constant Field Values

HPOS_RIGHT

public static final int HPOS_RIGHT
horizontal position value

See Also:
Constant Field Values

HPOS_NONE

public static final int HPOS_NONE
horizontal position value

See Also:
Constant Field Values

VPOS_VALUES

public static int[] VPOS_VALUES
vertical positions


VPOS_LABELS

public static String[] VPOS_LABELS
horizontal position labels


HPOS_VALUES

public static int[] HPOS_VALUES
horizontal positions


HPOS_LABELS

public static String[] HPOS_LABELS
vertical position labels


LINETYPE_SHAPES

public static final int LINETYPE_SHAPES
line type

See Also:
Constant Field Values

LINETYPE_LINES

public static final int LINETYPE_LINES
Useful constant for specifying the type of rendering (lines only).

See Also:
Constant Field Values

LINETYPE_SHAPES_AND_LINES

public static final int LINETYPE_SHAPES_AND_LINES
Useful constant for specifying the type of rendering (shapes and lines).

See Also:
Constant Field Values

LINETYPE_AREA

public static final int LINETYPE_AREA
Useful constant for specifying the type of rendering (area only).

See Also:
Constant Field Values

LINETYPE_AREA_AND_SHAPES

public static final int LINETYPE_AREA_AND_SHAPES
Useful constant for specifying the type of rendering (area and shapes).

See Also:
Constant Field Values

LINETYPE_BAR

public static final int LINETYPE_BAR
line type

See Also:
Constant Field Values

LINETYPE_IDS

public static final int[] LINETYPE_IDS
line types


LINETYPE_LABELS

public static final String[] LINETYPE_LABELS
line type labels


SIDE_UNDEFINED

public static final int SIDE_UNDEFINED
which side in legend

See Also:
Constant Field Values

SIDE_LEFT

public static final int SIDE_LEFT
which side in legend

See Also:
Constant Field Values

SIDE_RIGHT

public static final int SIDE_RIGHT
which side in legend

See Also:
Constant Field Values

SIDES

public static final int[] SIDES
which side in legend


SIDELABELS

public static final String[] SIDELABELS
which side in legend


STROKE_SOLID

public static final int STROKE_SOLID
Stroke type

See Also:
Constant Field Values

STROKE_DOT

public static final int STROKE_DOT
Stroke type

See Also:
Constant Field Values

STROKE_DASH

public static final int STROKE_DASH
Stroke type

See Also:
Constant Field Values

STROKE_DOTDASH

public static final int STROKE_DOTDASH
Stroke type

See Also:
Constant Field Values

STROKE_IDS

public static final int[] STROKE_IDS
Stroke types


STROKE_LABELS

public static final String[] STROKE_LABELS
Stroke type labels


SHAPE_PLUS

public static final int SHAPE_PLUS
shape type

See Also:
Constant Field Values

SHAPE_X

public static final int SHAPE_X
shape type

See Also:
Constant Field Values

SHAPE_RECTANGLE

public static final int SHAPE_RECTANGLE
shape type

See Also:
Constant Field Values

SHAPE_POINT

public static final int SHAPE_POINT
shape type

See Also:
Constant Field Values

SHAPE_LARGEPOINT

public static final int SHAPE_LARGEPOINT
shape type

See Also:
Constant Field Values

SHAPE_VLINE

public static final int SHAPE_VLINE
shape type

See Also:
Constant Field Values

SHAPE_HLINE

public static final int SHAPE_HLINE
shape type

See Also:
Constant Field Values

SHAPES

public static int[] SHAPES
shape types


SHAPE_NAMES

public static String[] SHAPE_NAMES
shape names


COLORS

public static Color[] COLORS
The array of colors we cycle through


index

protected int index
index


unit

protected Unit unit
display unit

Constructor Detail

LineState

public LineState()
Default ctor


LineState

public LineState(Color color,
                 float width,
                 int strokeType)
Constructor

Parameters:
color - color
width - line width
strokeType - stroke

LineState

public LineState(Color color,
                 float width,
                 int strokeType,
                 int lineType,
                 int shapeType)
Constructor

Parameters:
color - color
width - line width
strokeType - stroke
lineType - line type
shapeType - shape type
Method Detail

getPropertyContents

protected JComponent getPropertyContents()
Create the properties contents

Returns:
Contents for properties dialog

showPropertiesDialog

public boolean showPropertiesDialog(PropertyChangeListener listener,
                                    List chartNames,
                                    List ranges)
show dialog

Parameters:
listener - listens for changes
chartNames - all chart names. We use this to show a combo box of charts
ranges - All ranges. Some candy for the user so they can set the range values to use on multiple line states
Returns:
ok

showPropertiesDialog

public boolean showPropertiesDialog(PropertyChangeListener propListener,
                                    boolean doVisible,
                                    boolean doRange,
                                    List chartNames,
                                    List sampleRanges)
show dialog

Parameters:
propListener - listens for changes
doVisible - show visible cbx
doRange - show ranges
chartNames - all chart names. We use this to show a combo box of charts
sampleRanges - All ranges. Some candy for the user so they can set the range values to use on multiple line states
Returns:
ok

getTimes

public List<DateTime> getTimes()
Get the list of times

Returns:
the list of times

getValues

public List<Real> getValues()
Get the list of values

Returns:
the list of values

setTrack

public void setTrack(List<DateTime> times,
                     List<Real> values)
Set the track with a list of times and values

Parameters:
times - the times
values - the values

getPropertyContents

protected JComponent getPropertyContents(boolean full,
                                         List chartNames,
                                         List sampleRanges)
Create the properties contents

Parameters:
full - show fill dialog
chartNames - chart names
sampleRanges - ranges
Returns:
Contents for properties dialog

showRangePopup

public void showRangePopup(List ranges)
popup range menu

Parameters:
ranges - ranges

setRangeInProperties

public void setRangeInProperties(Range r)
apply range to gui

Parameters:
r - range

applyProperties

protected boolean applyProperties()
Apply properties

Returns:
Was successful

getFixedColor

public static Color getFixedColor(int index)
Utility to get a color in the static list of colors

Parameters:
index - which color
Returns:
the color

getStroke

public BasicStroke getStroke()
Create a stroke

Returns:
a stroke

makeStroke

public static BasicStroke makeStroke(float width,
                                     int type)
create a stroke

Parameters:
width - line width
type - stroke type
Returns:
a stroke

getPaintShape

public Shape getPaintShape()
get the shape we use to paint

Returns:
paint shape

setVisible

public void setVisible(boolean value)
Set the Visible property.

Parameters:
value - The new value for Visible

getVisible

public boolean getVisible()
Get the Visible property.

Returns:
The Visible

setColor

public void setColor(Color value)
Set the Color property.

Parameters:
value - The new value for Color

getColor

public Color getColor()
Get the Color property.

Returns:
The Color

getColor

public Color getColor(int index)
if we have a color then return it. Else get index'th color

Parameters:
index - index
Returns:
color

setWidth

public void setWidth(float value)
Set the Width property.

Parameters:
value - The new value for Width

getWidth

public float getWidth()
Get the Width property.

Returns:
The Width

setStrokeType

public void setStrokeType(Integer value)
set stroke

Parameters:
value - value

setStrokeType

public void setStrokeType(int value)
Set the StrokeType property.

Parameters:
value - The new value for StrokeType

getStrokeType

public int getStrokeType()
Get the StrokeType property.

Returns:
The StrokeType

setShape

public void setShape(int value)
Set the Shape property.

Parameters:
value - The new value for Shape

getShape

public int getShape()
Get the Shape property.

Returns:
The Shape

setRangeIncludesZero

public void setRangeIncludesZero(boolean value)
Set the RangeIncludesZero property.

Parameters:
value - The new value for RangeIncludesZero

getRangeIncludesZero

public boolean getRangeIncludesZero()
Get the RangeIncludesZero property.

Returns:
The RangeIncludesZero

setRange

public void setRange(Range value)
Set the Range property.

Parameters:
value - The new value for Range

getRange

public Range getRange()
Get the Range property.

Returns:
The Range

setUseLogarithmicRange

public void setUseLogarithmicRange(boolean value)
Set the UseLogarithmicRange property.

Parameters:
value - The new value for UseLogarithmicRange

getUseLogarithmicRange

public boolean getUseLogarithmicRange()
Get the UseLogarithmicRange property.

Returns:
The UseLogarithmicRange

setLineType

public void setLineType(int value)
Set the LineType property.

Parameters:
value - The new value for LineType

getLineType

public int getLineType()
Get the LineType property.

Returns:
The LineType

setChartName

public void setChartName(String value)
Set the chart name property.

Parameters:
value - The new value for chart name

getChartName

public String getChartName()
Get the ChartName property.

Returns:
The ChartName

setNameIfNeeded

public void setNameIfNeeded(String value)
Set the name if needed

Parameters:
value - true to set the name

hasName

public boolean hasName()
Does this linestate have a name defined

Returns:
has a name

setName

public void setName(String value)
Set the Name property.

Parameters:
value - The new value for Name

getName

public String getName()
Get the Name property.

Returns:
The Name

setNameMacro

public void setNameMacro(String value)
Set the NameMacro property.

Parameters:
value - The new value for NameMacro

getNameMacro

public String getNameMacro()
Get the NameMacro property.

Returns:
The NameMacro

setVerticalPosition

public void setVerticalPosition(int value)
Set the VerticalPosition property.

Parameters:
value - The new value for VerticalPosition

getVerticalPosition

public int getVerticalPosition()
Get the VerticalPosition property.

Returns:
The VerticalPosition

setHorizontalPosition

public void setHorizontalPosition(int value)
Set the HorizontalPosition property.

Parameters:
value - The new value for HorizontalPosition

getHorizontalPosition

public int getHorizontalPosition()
Get the HorizontalPosition property.

Returns:
The HorizontalPosition

setSide

public void setSide(int value)
Set the Side property.

Parameters:
value - The new value for Side

getSide

public int getSide()
Get the Side property.

Returns:
The Side

setAxisVisible

public void setAxisVisible(boolean value)
Set the AxisVisible property.

Parameters:
value - The new value for AxisVisible

getAxisVisible

public boolean getAxisVisible()
Get the AxisVisible property.

Returns:
The AxisVisible

setValid

public void setValid(boolean value)
Set the Valid property.

Parameters:
value - The new value for Valid

getValid

public boolean getValid()
Get the Valid property.

Returns:
The Valid

setAxisLabel

public void setAxisLabel(String value)
Set the AxisLabel property.

Parameters:
value - The new value for AxisLabel

getAxisLabel

public String getAxisLabel()
Get the AxisLabel property.

Returns:
The AxisLabel

setVisibleInLegend

public void setVisibleInLegend(boolean value)
Set the VisibleInLegend property.

Parameters:
value - The new value for VisibleInLegend

getVisibleInLegend

public boolean getVisibleInLegend()
Get the VisibleInLegend property.

Returns:
The VisibleInLegend

setUseVerticalPosition

public void setUseVerticalPosition(boolean value)
Set the UseVertical property.

Parameters:
value - The new value for UseVertical

getUseVerticalPosition

public boolean getUseVerticalPosition()
Get the UseVertical property.

Returns:
The UseVertical