ucar.unidata.idv.control.chart
Class ChartManager

java.lang.Object
  extended by ucar.unidata.idv.control.chart.ChartManager
All Implemented Interfaces:
ImageObserver
Direct Known Subclasses:
XYChartManager

public abstract class ChartManager
extends Object
implements ImageObserver

A time series chart

Version:
$Revision: 1.16 $
Author:
MetApps Development Team

Nested Class Summary
static class ChartManager.FixedWidthLogarithmicAxis
          Class FixedWidthLogarithmicAxis fixed width log axis
static class ChartManager.FixedWidthNumberAxis
          Class FixedWidthNumberAxis fixed width axis
 
Field Summary
static int AXIS_WIDTH
          width of axis_
protected  List chartHolders
          the charts
protected  JComponent contents
          gui_
protected  DisplayControlImpl control
          my control
static int LAYOUT_2COLGRID
          chart layout type
static int LAYOUT_3COLGRID
          chart layout type
static int LAYOUT_CARD
          chart layout type
static int LAYOUT_GRAPH
          chart layout type
static int LAYOUT_HSTACK
          chart layout type
static int LAYOUT_TAB
          chart layout type
static int LAYOUT_VSTACK
          chart layout type
protected  Object MUTEX
          for synching_
protected  boolean okToDraw
          ok to draw charts
protected  boolean settingData
          currently setting data in chart_
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ChartManager()
          ctor
ChartManager(DisplayControlImpl control)
          ctor
ChartManager(DisplayControlImpl control, String chartName)
          Default constructor.
 
Method Summary
protected  void addChart(ChartHolder chartHolder)
          add chart
protected  void addLineState(LineState lineState)
          add line state
protected  void addRange(double min, double max, String name)
          add a range
 void addViewMenuItems(List items)
          add menu items
protected  boolean applyProperties(ChartHolder chartHolder)
          apply properties to chart
protected  void chartNameChanged(String oldName, String newName)
          The chart name has changed
protected  void clearLineStates()
          clear all saved line states
protected  void doMakeContents()
          make gui
abstract  org.jfree.chart.plot.Plot doMakePlot()
          factory method to make the plot
protected  void doneLoadingData()
          Call this after you are done loading data into the charts.
 void editLayout()
          change layout
protected  ChartHolder findChartHolder(String name)
          find chart with name
protected  ChartHolder getChartHolder(LineState lineState)
          Get the chart holder that is displaying the given line state.
protected  ChartHolder getChartHolder(String name)
          find chart with name
 List getChartHolders()
          Get the ChartHolders property.
 JComponent getContents()
          get gui
 DisplayControlImpl getControl()
          Get the Control property.
 List getCurrentRanges()
          get the ranges
protected  String getDefaultChartName()
          get name to use for default chart
 int getGridLayoutDimension()
          Get the GridLayoutDimension property.
 int getLayout()
          Get the Layout property.
protected  Object getMutex()
          for synching the charts
 boolean getOkToDraw()
          ok to draw chart
 List getPlotNames()
          get list of chart names
protected  List getPlots()
          Get the plots
protected  void getPopupMenuItems(ChartHolder chartHolder, List items)
          get menu items for chart
protected  Dimension getPreferredChartSize()
          Get the preferred chart size
protected  void getPropertiesComponents(ChartHolder chartHolder, List comps)
          get properties widgets
 boolean getSettingData()
          Are we currently setting data
 boolean getShowThumb()
          Get the ShowThumb property.
 JLabel getThumb()
          get thumb label
 boolean hasStuff()
          do we have anything to show
 boolean imageUpdate(Image img, int flags, int x, int y, int width, int height)
          Handle the image update
protected  void initChart(ChartHolder chartHolder)
          init chart
protected  void initCharts()
          init all charts
protected  void initPlot(org.jfree.chart.plot.Plot plot)
          init plot
 void saveImage()
          Save the image
 void setChartHolders(List value)
          Set the ChartHolders property.
 void setControl(DisplayControlImpl value)
          Set the Control property.
 void setGridLayoutDimension(int value)
          Set the GridLayoutDimension property.
 void setLayout(int value)
          Set the Layout property.
 void setLayoutType(Integer i)
          set layout
 void setShowThumb(boolean value)
          Set the ShowThumb property.
protected  void showPropertiesDialog(ChartHolder chartHolder)
          show dialog for chart
 void signalChartChanged()
          Tell the chart holds that something changed
protected  void startLoadingData()
          Call this before you start loading data into the charts.
 void timeChanged()
          Stub for handling time change events.
 void timeChanged(Real value)
          Stub for handling time change events.
protected  void updateContents()
          update gui
protected  void updateContents(boolean force)
          update gui
 void updateThumb()
          update thumbnail legend image
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAYOUT_HSTACK

public static final int LAYOUT_HSTACK
chart layout type

See Also:
Constant Field Values

LAYOUT_VSTACK

public static final int LAYOUT_VSTACK
chart layout type

See Also:
Constant Field Values

LAYOUT_2COLGRID

public static final int LAYOUT_2COLGRID
chart layout type

See Also:
Constant Field Values

LAYOUT_3COLGRID

public static final int LAYOUT_3COLGRID
chart layout type

See Also:
Constant Field Values

LAYOUT_GRAPH

public static final int LAYOUT_GRAPH
chart layout type

See Also:
Constant Field Values

LAYOUT_TAB

public static final int LAYOUT_TAB
chart layout type

See Also:
Constant Field Values

LAYOUT_CARD

public static final int LAYOUT_CARD
chart layout type

See Also:
Constant Field Values

AXIS_WIDTH

public static final int AXIS_WIDTH
width of axis_

See Also:
Constant Field Values

MUTEX

protected Object MUTEX
for synching_


chartHolders

protected List chartHolders
the charts


control

protected DisplayControlImpl control
my control


contents

protected JComponent contents
gui_


settingData

protected boolean settingData
currently setting data in chart_


okToDraw

protected boolean okToDraw
ok to draw charts

Constructor Detail

ChartManager

public ChartManager()
ctor


ChartManager

public ChartManager(DisplayControlImpl control)
ctor

Parameters:
control - the control

ChartManager

public ChartManager(DisplayControlImpl control,
                    String chartName)
Default constructor.

Parameters:
control - the control
chartName - name of default chart
Method Detail

addLineState

protected void addLineState(LineState lineState)
add line state

Parameters:
lineState - line state

saveImage

public void saveImage()
Save the image


clearLineStates

protected void clearLineStates()
clear all saved line states


chartNameChanged

protected void chartNameChanged(String oldName,
                                String newName)
The chart name has changed

Parameters:
oldName - old name
newName - new name

initCharts

protected void initCharts()
init all charts


getCurrentRanges

public List getCurrentRanges()
get the ranges

Returns:
ranges

addRange

protected void addRange(double min,
                        double max,
                        String name)
add a range

Parameters:
min - min
max - max
name - name

getMutex

protected Object getMutex()
for synching the charts

Returns:
mutex

initChart

protected void initChart(ChartHolder chartHolder)
init chart

Parameters:
chartHolder - The chart

initPlot

protected void initPlot(org.jfree.chart.plot.Plot plot)
init plot

Parameters:
plot - plot

doMakePlot

public abstract org.jfree.chart.plot.Plot doMakePlot()
factory method to make the plot

Returns:
the new plot

getPlots

protected List getPlots()
Get the plots

Returns:
plots_

updateThumb

public void updateThumb()
update thumbnail legend image


signalChartChanged

public void signalChartChanged()
Tell the chart holds that something changed


doneLoadingData

protected void doneLoadingData()
Call this after you are done loading data into the charts. It resets the flag to ignore any intermediate chart repaints and then it signals the chart to repaint


startLoadingData

protected void startLoadingData()
Call this before you start loading data into the charts. It sets a flag to ignore any intermediate chart repaints


getPopupMenuItems

protected void getPopupMenuItems(ChartHolder chartHolder,
                                 List items)
get menu items for chart

Parameters:
chartHolder - chart_
items - items

showPropertiesDialog

protected void showPropertiesDialog(ChartHolder chartHolder)
show dialog for chart

Parameters:
chartHolder - chart

getPropertiesComponents

protected void getPropertiesComponents(ChartHolder chartHolder,
                                       List comps)
get properties widgets

Parameters:
chartHolder - the chart
comps - comps

applyProperties

protected boolean applyProperties(ChartHolder chartHolder)
apply properties to chart

Parameters:
chartHolder - the chart
Returns:
OK

setLayoutType

public void setLayoutType(Integer i)
set layout

Parameters:
i - layout type

editLayout

public void editLayout()
change layout


addViewMenuItems

public void addViewMenuItems(List items)
add menu items

Parameters:
items - items

getOkToDraw

public boolean getOkToDraw()
ok to draw chart

Returns:
ok to draw

getSettingData

public boolean getSettingData()
Are we currently setting data

Returns:
is setting data

timeChanged

public void timeChanged()
Stub for handling time change events.


timeChanged

public void timeChanged(Real value)
Stub for handling time change events. Signals a redraw.

Parameters:
value - the time value (may be null);

imageUpdate

public boolean imageUpdate(Image img,
                           int flags,
                           int x,
                           int y,
                           int width,
                           int height)
Handle the image update

Specified by:
imageUpdate in interface ImageObserver
Parameters:
img - img
flags - flags
x - x
y - y
width - width
height - height
Returns:
keep going

hasStuff

public boolean hasStuff()
do we have anything to show

Returns:
anything to show

getContents

public JComponent getContents()
get gui

Returns:
gui

getPlotNames

public List getPlotNames()
get list of chart names

Returns:
names

getChartHolder

protected ChartHolder getChartHolder(LineState lineState)
Get the chart holder that is displaying the given line state.

Parameters:
lineState - The line state
Returns:
The chart holder

findChartHolder

protected ChartHolder findChartHolder(String name)
find chart with name

Parameters:
name - name
Returns:
the chart or null if none found

getChartHolder

protected ChartHolder getChartHolder(String name)
find chart with name

Parameters:
name - name
Returns:
the chart or create one if needed

addChart

protected void addChart(ChartHolder chartHolder)
add chart

Parameters:
chartHolder - chart

getPreferredChartSize

protected Dimension getPreferredChartSize()
Get the preferred chart size

Returns:
The preferred chart size

doMakeContents

protected void doMakeContents()
make gui


getDefaultChartName

protected String getDefaultChartName()
get name to use for default chart

Returns:
default chart name

updateContents

protected void updateContents()
update gui


updateContents

protected void updateContents(boolean force)
update gui

Parameters:
force - always do it

getThumb

public JLabel getThumb()
get thumb label

Returns:
thumb

setLayout

public void setLayout(int value)
Set the Layout property.

Parameters:
value - The new value for Layout

getLayout

public int getLayout()
Get the Layout property.

Returns:
The Layout

setGridLayoutDimension

public void setGridLayoutDimension(int value)
Set the GridLayoutDimension property.

Parameters:
value - The new value for GridLayoutDimension

getGridLayoutDimension

public int getGridLayoutDimension()
Get the GridLayoutDimension property.

Returns:
The GridLayoutDimension

setChartHolders

public void setChartHolders(List value)
Set the ChartHolders property.

Parameters:
value - The new value for ChartHolders

getChartHolders

public List getChartHolders()
Get the ChartHolders property.

Returns:
The ChartHolders

setControl

public void setControl(DisplayControlImpl value)
Set the Control property.

Parameters:
value - The new value for Control

getControl

public DisplayControlImpl getControl()
Get the Control property.

Returns:
The Control

setShowThumb

public void setShowThumb(boolean value)
Set the ShowThumb property.

Parameters:
value - The new value for ShowThumb

getShowThumb

public boolean getShowThumb()
Get the ShowThumb property.

Returns:
The ShowThumb