org.norther.tammi.sprig.chart.tool
Class ChartTool

java.lang.Object
  extended by org.norther.tammi.core.pool.RecyclableSupport
      extended by org.norther.tammi.core.pool.PoolableSupport
          extended by org.norther.tammi.spray.engine.tool.GlobalTool
              extended by org.norther.tammi.spray.engine.tool.ContextTool
                  extended by org.norther.tammi.sprig.chart.tool.ChartTool
All Implemented Interfaces:
Serializable, Cloneable, EventListener, Poolable, Recyclable, ContextBindingListener

public class ChartTool
extends ContextTool

A request context tool for chart generation.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String BY_COLUMN
          The column based model order.
static String BY_ROW
          The row based model order.
 
Constructor Summary
ChartTool()
          Constructs a new tool.
 
Method Summary
 void dispose()
          Disposes the object by setting its disposed flag.
 String encode(ChartLayout layout, String extension)
          Encodes the specified layout and caches it to the content filter.
 String encode(ChartLayout layout, String extension, int quality)
          Encodes the specified layout with the given quality and caches it to the content filter.
 ChartModel filter(ChartModel model, OrderedMap rows, OrderedMap columns)
          Returns a filtered chart model.
 ChartLayout generate(ChartModel[] data, String type, String orientation)
          Generates a chart layout from the specified models.
 ChartLayout generate(ChartModel[] data, String type, String orientation, String order, int index)
          Generates an ordered chart from the specified models.
 ChartLayout generate(ChartModel data, String type, String orientation)
          Generates a chart layout from the specified model.
 ChartLayout generate(ChartModel data, String type, String orientation, String order, int index)
          Generates an ordered chart from the specified model.
 ChartLayout generate(List list, String type, String orientation)
          Generates a chart layout from the specified list of models.
 ChartLayout generate(List list, String type, String orientation, String order, int index)
          Generates an ordered chart from the specified list of models.
protected  ChartFilter getChartFilter()
          Gets the chart filter from the filter stack.
 ChartModel rename(ChartModel model, List rows, List columns)
          Returns a named chart model.
protected  int toChartType(String type)
          Returns the chart type from its string representation.
protected  int toModelOrder(String order)
          Returns the model order from its string representation.
protected  int toOrientation(String orientation)
          Returns the chart orientation from its string representation.
 
Methods inherited from class org.norther.tammi.spray.engine.tool.ContextTool
getFilter, getFilterChain, getFilterKey, getPrincipal, getRequest, getResponse, isFilterChanged
 
Methods inherited from class org.norther.tammi.spray.engine.tool.GlobalTool
clone, getContext, getContextToolFilter, getMBeanServer, getName, isBound, nop, toString, valueBound, valueUnbound
 
Methods inherited from class org.norther.tammi.core.pool.PoolableSupport
disposed, recycled
 
Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport
isDisposed, recycle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.pool.Recyclable
isDisposed, recycle
 

Field Detail

BY_COLUMN

public static final String BY_COLUMN
The column based model order.

See Also:
Constant Field Values

BY_ROW

public static final String BY_ROW
The row based model order.

See Also:
Constant Field Values
Constructor Detail

ChartTool

public ChartTool()
Constructs a new tool.

Method Detail

dispose

public void dispose()
Description copied from class: RecyclableSupport
Disposes the object by setting its disposed flag.

Specified by:
dispose in interface Recyclable
Overrides:
dispose in class ContextTool

filter

public ChartModel filter(ChartModel model,
                         OrderedMap rows,
                         OrderedMap columns)
Returns a filtered chart model.

Parameters:
model - the chart model.
rows - the row filter.
columns - the column filter.
Returns:
the filtered chart model.

rename

public ChartModel rename(ChartModel model,
                         List rows,
                         List columns)
Returns a named chart model.

Parameters:
model - the chart model.
rows - the row names.
columns - the column names.
Returns:
the named chart model.

generate

public ChartLayout generate(ChartModel data,
                            String type,
                            String orientation)
Generates a chart layout from the specified model.

Parameters:
data - the table model.
type - the chart type.
orientation - the orientation.
Returns:
the generated layout.

generate

public ChartLayout generate(ChartModel[] data,
                            String type,
                            String orientation)
Generates a chart layout from the specified models.

Parameters:
data - the table models.
type - the chart type.
orientation - the orientation.
Returns:
the generated layout.

generate

public ChartLayout generate(List list,
                            String type,
                            String orientation)
Generates a chart layout from the specified list of models.

Parameters:
list - the list of table models.
type - the chart type.
orientation - the orientation.
Returns:
the generated layout.

generate

public ChartLayout generate(ChartModel data,
                            String type,
                            String orientation,
                            String order,
                            int index)
Generates an ordered chart from the specified model.

Parameters:
data - the table model.
type - the chart type.
orientation - the orientation.
order - the table order.
index - the model index.
Returns:
the generated layout.

generate

public ChartLayout generate(ChartModel[] data,
                            String type,
                            String orientation,
                            String order,
                            int index)
Generates an ordered chart from the specified models.

Parameters:
data - the table models.
type - the chart type.
orientation - the orientation.
order - the table order.
index - the model index.
Returns:
the generated layout.

generate

public ChartLayout generate(List list,
                            String type,
                            String orientation,
                            String order,
                            int index)
Generates an ordered chart from the specified list of models.

Parameters:
list - the list of table models.
type - the chart type.
orientation - the orientation.
order - the table order.
index - the model index.
Returns:
the generated layout.

encode

public String encode(ChartLayout layout,
                     String extension)
Encodes the specified layout and caches it to the content filter.

Parameters:
layout - the layout.
extension - the encode type.
Returns:
the path to the chart.

encode

public String encode(ChartLayout layout,
                     String extension,
                     int quality)
Encodes the specified layout with the given quality and caches it to the content filter.

Parameters:
layout - the layout.
extension - the encode type.
quality - (0 - 100 %).
Returns:
the path to the chart.

getChartFilter

protected ChartFilter getChartFilter()
Gets the chart filter from the filter stack.

Returns:
the chart filter or null.

toChartType

protected int toChartType(String type)
Returns the chart type from its string representation.

Parameters:
type - the string type.
Returns:
the chart type.

toOrientation

protected int toOrientation(String orientation)
Returns the chart orientation from its string representation.

Parameters:
orientation - the string type.
Returns:
the chart orientation.

toModelOrder

protected int toModelOrder(String order)
Returns the model order from its string representation.

Parameters:
order - the string order.
Returns:
the model order.


Copyright © 2004 The Norther Organization. All rights reserved.