Class AbstractChartGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.spreadsheetviewer.chart.AbstractChartGenerator
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractRowBasedChartGenerator
,ControlChart
,Histogram
,JFreeChart
public abstract class AbstractChartGenerator extends AbstractOptionHandler implements QuickInfoSupporter
Ancestor for classes that generate/display charts using a flow as backend.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Height
the height of the dialog.protected int
m_Width
the width of the dialog.static String
STORAGE_NAME
the name for the spreadsheet in the flow's storage.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractChartGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addChartGeneration(Flow flow, String name, SpreadSheet sheet)
Adds the chart generation to the flow.protected void
check(String name, SpreadSheet sheet)
Checks whether the spreadsheet can be processed.protected Type
columnTypesToAxisType(SpreadSheet sheet, int[] colIndices)
Returns the most appropriate axis type for the given columns.protected TickGenerator
columnTypesToTickGenerator(SpreadSheet sheet, int[] colIndices)
Returns the most appropriate tick generator for the given columns.protected Type
columnTypeToAxisType(SpreadSheet sheet, int colIndex)
Returns the most appropriate axis type for a given column.protected TickGenerator
columnTypeToTickGenerator(SpreadSheet sheet, int colIndex)
Returns the most appropriate tick generator for a given column.void
defineOptions()
Adds options to the internal list of options.protected Flow
doGenerate(String name, SpreadSheet sheet)
Generates the actual flow.Flow
generate(String name, SpreadSheet sheet)
Generates a flow for displaying a chart for the spreadsheet.protected int
getDefaultHeight()
Returns the default height for the dialog.protected int
getDefaultWidth()
Returns the default width for the dialog.int
getHeight()
Returns the currently set height of the dialog.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.int
getWidth()
Returns the currently set width of the dialog.String
heightTipText()
Returns the tip text for this property.void
setHeight(int value)
Sets the height of the dialog.void
setWidth(int value)
Sets the width of the dialog.String
widthTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
STORAGE_NAME
public static final String STORAGE_NAME
the name for the spreadsheet in the flow's storage.- See Also:
- Constant Field Values
-
m_Width
protected int m_Width
the width of the dialog.
-
m_Height
protected int m_Height
the height of the dialog.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Returns:
- the default width
-
setWidth
public void setWidth(int value)
Sets the width of the dialog.- Parameters:
value
- the width
-
getWidth
public int getWidth()
Returns the currently set width of the dialog.- Returns:
- the width
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Returns:
- the default height
-
setHeight
public void setHeight(int value)
Sets the height of the dialog.- Parameters:
value
- the height
-
getHeight
public int getHeight()
Returns the currently set height of the dialog.- Returns:
- the height
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
The default implementation returns null.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
columnTypeToAxisType
protected Type columnTypeToAxisType(SpreadSheet sheet, int colIndex)
Returns the most appropriate axis type for a given column.- Parameters:
sheet
- the spreadsheet to usecolIndex
- the column index to inspect- Returns:
- the suggested axis type
-
columnTypesToAxisType
protected Type columnTypesToAxisType(SpreadSheet sheet, int[] colIndices)
Returns the most appropriate axis type for the given columns.- Parameters:
sheet
- the spreadsheet to usecolIndices
- the column indices to inspect- Returns:
- the suggested axis type
-
columnTypeToTickGenerator
protected TickGenerator columnTypeToTickGenerator(SpreadSheet sheet, int colIndex)
Returns the most appropriate tick generator for a given column.- Parameters:
sheet
- the spreadsheet to usecolIndex
- the column index to inspect- Returns:
- the suggested tick generator
-
columnTypesToTickGenerator
protected TickGenerator columnTypesToTickGenerator(SpreadSheet sheet, int[] colIndices)
Returns the most appropriate tick generator for the given columns.- Parameters:
sheet
- the spreadsheet to usecolIndices
- the column indices to inspect- Returns:
- the suggested tick generator
-
check
protected void check(String name, SpreadSheet sheet)
Checks whether the spreadsheet can be processed.
Default implementation only ensures that data is present.- Parameters:
name
- the name of the tab/sheetsheet
- the spreadsheet to check
-
addChartGeneration
protected abstract void addChartGeneration(Flow flow, String name, SpreadSheet sheet)
Adds the chart generation to the flow. The flow already contains forwarding of spreadsheet and selecting subset of rows.- Parameters:
flow
- the flow to extendname
- the name of the tab/sheetsheet
- the spreadsheet to generate the flow for
-
doGenerate
protected Flow doGenerate(String name, SpreadSheet sheet)
Generates the actual flow. The spreadsheet is available from storage via theSTORAGE_NAME
identifier.- Parameters:
name
- the name of the tab/sheetsheet
- the sheet to generate the chart for- Returns:
- the generated flow
-
generate
public Flow generate(String name, SpreadSheet sheet)
Generates a flow for displaying a chart for the spreadsheet.- Parameters:
sheet
- the spreadsheet to generate the chart for- Returns:
- the flow for creating the chart
-
-