net.sf.clichart.main
Class CliOptions

java.lang.Object
  extended by net.sf.clichart.main.CliOptions
All Implemented Interfaces:
Options

public class CliOptions
extends java.lang.Object
implements Options

Options implementation for options provided on the command-line, and parsed using commons CLI

Author:
johnd

Field Summary
 
Fields inherited from interface net.sf.clichart.chart.Options
DATA_SEP_CSV, DATA_SEP_WHITE_SPACE, DEFAULT_COLUMN_INDEXES, DEFAULT_DATA_SEP, DEFAULT_DATE_FORMAT, DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_X_TYPE, X_TYPE_DATE_TIME, X_TYPE_NONE, X_TYPE_VALUE
 
Constructor Summary
CliOptions(org.apache.commons.cli.CommandLine commandLine)
           
 
Method Summary
 boolean forceSecondAxisYRange()
          If set, force use of the minimum and maximum Y values provided for the second axis
 boolean forceYRange()
          If set, force use of the minimum and maximum Y values provided
 int getChartHeight()
          Return the height of the chart in pixels
 java.lang.String getChartTitle()
          Return the title for the graph, or null if not set
 int getChartWidth()
          Return the width of the chart in pixels
 java.lang.String getChartXAxisTitle()
          Return the title for the X axis, or null if not set
 int getChartXType()
          Return the type of X axis - date/time, value or none
 java.lang.String getChartYAxisTitle()
          Return the title for the y axis, or null if not set
 java.util.List<ColourOverride> getColourOverrides()
          Return any colour overrides set for columns (may be null)
 int[] getColumnIndexes()
          Return the list of column indexes required from the data provided
 int getDataSeparatorType()
          Returns the data separator (CSV)
 java.lang.String getDateFormat()
          Returns the date format string for parsing date/times
 java.lang.String getFileOutputPath()
          Path to which chart should be saved - null if should show in UI
 java.lang.String getInputPath()
          Return the input path to read data from, or null if should read from stdin
 int getLineWeight()
          Return required line weight for first axis, on a scale of 1 - 5
 int getListenPort()
          Return the port number on which the CLI server should listen.
 java.lang.Integer getMaxYValue()
          Return the max Y value for the chart, or null if not set
 java.lang.Integer getMinYValue()
          Return the min Y value for the chart, or null if not set
 java.lang.String getSecondAxisChartYAxisTitle()
          Return the title for the second y axis, or null if not set
 int[] getSecondAxisColumnIndexes()
          Return the list of column indexes required for the second axis (if any) from the data provided, or null if none
 int getSecondAxisLineWeight()
          Return required line weight for second axis, on a scale of 1 - 5
 java.lang.Integer getSecondAxisMaxYValue()
          Return the max Y value for the second axis for the chart, or null if not set
 java.lang.Integer getSecondAxisMinYValue()
          Return the min Y value for the second axis for the chart, or null if not set
 java.lang.String[] getSecondAxisSeriesTitles()
          Return the titles for each of the second Y axis data series, or null if not set
 java.lang.String[] getSeriesTitles()
          Return the titles for each of the first Y axis data series, or null if not set
 boolean hasDataPoints()
          Return true if line shapes should be rendered for the first axis
 boolean hasHeaderRow()
          Return true if the first row of the data is a header (this will be used for column titles)
 boolean hasSecondAxisDataPoints()
          Return true if line shapes should be rendered for the second axis
 boolean ignoreDuplicateValues()
          Return true if exceptions for adding duplicate X axis values should be swallowed (with an appropriate message)
 boolean ignoreEmptyColumns()
          Return true if empty column values in the data should be ignored (with an appropriate message)
 boolean ignoreMissingColumns()
          Return true if missing columns in the data should be ignored (with an appropriate message)
 boolean isBarChart()
          Return true if the main axis should be a bar chart, rather than X-Y
 boolean isCliServer()
          Return true if clichart should act as a CLI server, to be driven by a script
 boolean isSecondAxisBarChart()
          Return true if the second axis should be a bar chart, rather than X-Y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CliOptions

public CliOptions(org.apache.commons.cli.CommandLine commandLine)
           throws InvalidOptionsException,
                  ShowUsageException
Throws:
InvalidOptionsException
ShowUsageException
Method Detail

getDataSeparatorType

public int getDataSeparatorType()
Description copied from interface: Options
Returns the data separator (CSV)

Specified by:
getDataSeparatorType in interface Options
Returns:
one of the DATA_SEP_* defines

getDateFormat

public java.lang.String getDateFormat()
Description copied from interface: Options
Returns the date format string for parsing date/times

Specified by:
getDateFormat in interface Options

hasHeaderRow

public boolean hasHeaderRow()
Description copied from interface: Options
Return true if the first row of the data is a header (this will be used for column titles)

Specified by:
hasHeaderRow in interface Options

ignoreMissingColumns

public boolean ignoreMissingColumns()
Description copied from interface: Options
Return true if missing columns in the data should be ignored (with an appropriate message)

Specified by:
ignoreMissingColumns in interface Options

ignoreEmptyColumns

public boolean ignoreEmptyColumns()
Description copied from interface: Options
Return true if empty column values in the data should be ignored (with an appropriate message)

Specified by:
ignoreEmptyColumns in interface Options

ignoreDuplicateValues

public boolean ignoreDuplicateValues()
Description copied from interface: Options
Return true if exceptions for adding duplicate X axis values should be swallowed (with an appropriate message)

Specified by:
ignoreDuplicateValues in interface Options

getColumnIndexes

public int[] getColumnIndexes()
Description copied from interface: Options
Return the list of column indexes required from the data provided

Specified by:
getColumnIndexes in interface Options

getSecondAxisColumnIndexes

public int[] getSecondAxisColumnIndexes()
Description copied from interface: Options
Return the list of column indexes required for the second axis (if any) from the data provided, or null if none

Specified by:
getSecondAxisColumnIndexes in interface Options

getChartXType

public int getChartXType()
Description copied from interface: Options
Return the type of X axis - date/time, value or none

Specified by:
getChartXType in interface Options
Returns:
one of the X_TYPE_* defines

getFileOutputPath

public java.lang.String getFileOutputPath()
Description copied from interface: Options
Path to which chart should be saved - null if should show in UI

Specified by:
getFileOutputPath in interface Options

getChartTitle

public java.lang.String getChartTitle()
Description copied from interface: Options
Return the title for the graph, or null if not set

Specified by:
getChartTitle in interface Options

getChartXAxisTitle

public java.lang.String getChartXAxisTitle()
Description copied from interface: Options
Return the title for the X axis, or null if not set

Specified by:
getChartXAxisTitle in interface Options

getChartYAxisTitle

public java.lang.String getChartYAxisTitle()
Description copied from interface: Options
Return the title for the y axis, or null if not set

Specified by:
getChartYAxisTitle in interface Options

getSecondAxisChartYAxisTitle

public java.lang.String getSecondAxisChartYAxisTitle()
Description copied from interface: Options
Return the title for the second y axis, or null if not set

Specified by:
getSecondAxisChartYAxisTitle in interface Options

getMaxYValue

public java.lang.Integer getMaxYValue()
Description copied from interface: Options
Return the max Y value for the chart, or null if not set

Specified by:
getMaxYValue in interface Options

getMinYValue

public java.lang.Integer getMinYValue()
Description copied from interface: Options
Return the min Y value for the chart, or null if not set

Specified by:
getMinYValue in interface Options

forceYRange

public boolean forceYRange()
Description copied from interface: Options
If set, force use of the minimum and maximum Y values provided

Specified by:
forceYRange in interface Options

getSecondAxisMaxYValue

public java.lang.Integer getSecondAxisMaxYValue()
Description copied from interface: Options
Return the max Y value for the second axis for the chart, or null if not set

Specified by:
getSecondAxisMaxYValue in interface Options

getSecondAxisMinYValue

public java.lang.Integer getSecondAxisMinYValue()
Description copied from interface: Options
Return the min Y value for the second axis for the chart, or null if not set

Specified by:
getSecondAxisMinYValue in interface Options

forceSecondAxisYRange

public boolean forceSecondAxisYRange()
Description copied from interface: Options
If set, force use of the minimum and maximum Y values provided for the second axis

Specified by:
forceSecondAxisYRange in interface Options

getInputPath

public java.lang.String getInputPath()
Description copied from interface: Options
Return the input path to read data from, or null if should read from stdin

Specified by:
getInputPath in interface Options

getChartWidth

public int getChartWidth()
Description copied from interface: Options
Return the width of the chart in pixels

Specified by:
getChartWidth in interface Options

getChartHeight

public int getChartHeight()
Description copied from interface: Options
Return the height of the chart in pixels

Specified by:
getChartHeight in interface Options

isBarChart

public boolean isBarChart()
Description copied from interface: Options
Return true if the main axis should be a bar chart, rather than X-Y

Specified by:
isBarChart in interface Options

isSecondAxisBarChart

public boolean isSecondAxisBarChart()
Description copied from interface: Options
Return true if the second axis should be a bar chart, rather than X-Y

Specified by:
isSecondAxisBarChart in interface Options

getLineWeight

public int getLineWeight()
Description copied from interface: Options
Return required line weight for first axis, on a scale of 1 - 5

Specified by:
getLineWeight in interface Options

getSecondAxisLineWeight

public int getSecondAxisLineWeight()
Description copied from interface: Options
Return required line weight for second axis, on a scale of 1 - 5

Specified by:
getSecondAxisLineWeight in interface Options

hasDataPoints

public boolean hasDataPoints()
Description copied from interface: Options
Return true if line shapes should be rendered for the first axis

Specified by:
hasDataPoints in interface Options

hasSecondAxisDataPoints

public boolean hasSecondAxisDataPoints()
Description copied from interface: Options
Return true if line shapes should be rendered for the second axis

Specified by:
hasSecondAxisDataPoints in interface Options

isCliServer

public boolean isCliServer()
Description copied from interface: Options
Return true if clichart should act as a CLI server, to be driven by a script

Specified by:
isCliServer in interface Options

getSeriesTitles

public java.lang.String[] getSeriesTitles()
Description copied from interface: Options
Return the titles for each of the first Y axis data series, or null if not set

Specified by:
getSeriesTitles in interface Options

getSecondAxisSeriesTitles

public java.lang.String[] getSecondAxisSeriesTitles()
Description copied from interface: Options
Return the titles for each of the second Y axis data series, or null if not set

Specified by:
getSecondAxisSeriesTitles in interface Options

getColourOverrides

public java.util.List<ColourOverride> getColourOverrides()
Description copied from interface: Options
Return any colour overrides set for columns (may be null)

Specified by:
getColourOverrides in interface Options

getListenPort

public int getListenPort()
Description copied from interface: Options
Return the port number on which the CLI server should listen. If not greater than 0, functions as a true CLI server, i.e. listens on stdin and writes to stdout

Specified by:
getListenPort in interface Options