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.

Version:
$Id: ChartTool.java,v 1.15 2009/09/30 20:16:04 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
ChartTool()
          Constructs a new tool.
 
Method Summary
 void dispose()
          Disposes the object by setting its disposed flag.
 String encode(ChartLayout layout, String type)
          Encodes the specified layout and caches it to the content filter.
 String encode(ChartLayout layout, String type, int quality)
          Encodes the specified layout with the given quality and caches it to the content filter.
 ChartModel filter(ChartModel model, OrderedMap<Comparable<?>,Comparable<?>> columns, OrderedMap<Comparable<?>,Comparable<?>> rows)
          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<? extends ChartModel> list, String type, String orientation)
          Generates a chart layout from the specified list of models.
 ChartLayout generate(List<? extends ChartModel> 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<Comparable<?>> columns, List<Comparable<?>> rows)
          Returns a named chart model.
 ChartLayout.ChartType toChartType(String str)
          Returns the specified chart type.
 ChartLayout.HAlignment toHAlignment(String str)
          Returns the specified horizontal aligment.
 ChartLayout.Location toLocation(String str)
          Returns the specified location.
 ChartGenerator.ModelOrder toModelOrder(String str)
          Returns the specified model order.
 ChartGenerator.Orientation toOrientation(String str)
          Returns the specified orientation.
 ChartLayout.Position toPosition(String str)
          Returns the specified axis position.
 ChartLayout.VAlignment toVAlignment(String str)
          Returns the specified vertical aligment.
 
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, 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
 

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<Comparable<?>,Comparable<?>> columns,
                         OrderedMap<Comparable<?>,Comparable<?>> rows)
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<Comparable<?>> columns,
                         List<Comparable<?>> rows)
Returns a named chart model.

Parameters:
model - the chart model.
columns - the column names.
rows - the row 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<? extends ChartModel> 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<? extends ChartModel> 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 type)
Encodes the specified layout and caches it to the content filter.

Parameters:
layout - the layout.
type - the content type.
Returns:
the path to the chart.

encode

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

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

toOrientation

public ChartGenerator.Orientation toOrientation(String str)
Returns the specified orientation.

Parameters:
str - the orientation as a string.
Returns:
the corresponding orientation or null.

toModelOrder

public ChartGenerator.ModelOrder toModelOrder(String str)
Returns the specified model order.

Parameters:
str - the orientation as a string.
Returns:
the corresponding orientation or null.

toChartType

public ChartLayout.ChartType toChartType(String str)
Returns the specified chart type.

Parameters:
str - the chart type as a string.
Returns:
the corresponding chart type or null.

toLocation

public ChartLayout.Location toLocation(String str)
Returns the specified location.

Parameters:
str - the location as a string.
Returns:
the corresponding location or null.

toHAlignment

public ChartLayout.HAlignment toHAlignment(String str)
Returns the specified horizontal aligment.

Parameters:
str - the aligment as a string.
Returns:
the corresponding aligment or null.

toVAlignment

public ChartLayout.VAlignment toVAlignment(String str)
Returns the specified vertical aligment.

Parameters:
str - the aligment as a string.
Returns:
the corresponding aligment or null.

toPosition

public ChartLayout.Position toPosition(String str)
Returns the specified axis position.

Parameters:
str - the position as a string.
Returns:
the corresponding position or null.

getChartFilter

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

Returns:
the chart filter or null.


Copyright © 2004 The Norther Organization. All rights reserved.