Class AbstractOptionHelper
- java.lang.Object
-
- org.wicketstuff.gchart.gchart.options.AbstractOptionHelper
-
- All Implemented Interfaces:
OptionHelper
- Direct Known Subclasses:
ClassicOptionHelper,MaterialOptionHelper
public abstract class AbstractOptionHelper extends Object implements OptionHelper
Abstract superclass for alle implementations ofOptionHelper. Used forMaterialOptionHelperandClassicOptionHelper.- Author:
- Dieter Tremel
-
-
Constructor Summary
Constructors Constructor Description AbstractOptionHelper(Chart chart)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ChartOptionsaddDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping)Add a definition of dual axis to the root of ChartOptions.ChartOptionsaddDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles)Add a definition of dual axis to the root of ChartOptions.ChartOptionsaddDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers)Add a definition of dual axis to the root of ChartOptions.ChartOptionsaddSubTitle(ChartOptions parent)Add a subTitle of the chart to the root of ChartOptions.ChartOptionsaddTitle(ChartOptions parent)Add a title of the chart to the root of ChartOptions.StringgetChartBaseResourceKey()Generate the base resource key for the chart.static StringgetChartBaseResourceKey(String chartId)Helper function to build resource base key for a chart and it's id according to a convention.IModel<String>getChartLabelResourceModel(String subKey)Generate a wrapped ResourceModel for theChartcomponent.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wicketstuff.gchart.gchart.options.OptionHelper
addDualAxisOptions, addSubTitle, addSubTitle, addTitle, addTitle
-
-
-
-
Field Detail
-
chart
protected Chart chart
-
-
Constructor Detail
-
AbstractOptionHelper
public AbstractOptionHelper(Chart chart)
-
-
Method Detail
-
getChartBaseResourceKey
public static String getChartBaseResourceKey(String chartId)
Helper function to build resource base key for a chart and it's id according to a convention. This should be used as left part for all keys for i18n of charts.- Parameters:
chartId- Wicket id of Chart.- Returns:
- Base key with trailing dot, eg.
"Chart.myChart."if param is"myChart".
-
getChartBaseResourceKey
public String getChartBaseResourceKey()
Description copied from interface:OptionHelperGenerate the base resource key for the chart. By convention this is build from the id of the Chart Component. Eg. if Chart id is"myChart"the result should be"chart.myChart.".- Specified by:
getChartBaseResourceKeyin interfaceOptionHelper- Returns:
- Base resource key of chart in form
"chart.<id of chart>.". Note the trailing dot.
-
getChartLabelResourceModel
public IModel<String> getChartLabelResourceModel(String subKey)
Description copied from interface:OptionHelperGenerate a wrapped ResourceModel for theChartcomponent.- Specified by:
getChartLabelResourceModelin interfaceOptionHelper- Parameters:
subKey- Subkey as suffix ofOptionHelper.getChartBaseResourceKey().- Returns:
- ResourceModel for the complete key. There is no default defined, so missing properties can be easyly detected.
-
addTitle
public ChartOptions addTitle(ChartOptions parent)
Description copied from interface:OptionHelperAdd a title of the chart to the root of ChartOptions. Use ResourceModel for the label text. The title handling is different for Material and Classic charts, so this convenient methods are written.- Specified by:
addTitlein interfaceOptionHelper- Parameters:
parent- Root ChartOptions to add title to.- Returns:
- Parent for fluent calling.
-
addSubTitle
public ChartOptions addSubTitle(ChartOptions parent)
Description copied from interface:OptionHelperAdd a subTitle of the chart to the root of ChartOptions. Use ResourceModel for the label text. The subTitle handling is different for Material and Classic charts, so this convenient methods are written.- Specified by:
addSubTitlein interfaceOptionHelper- Parameters:
parent- Root ChartOptions to add subTitle to.- Returns:
- Parent for fluent calling.
-
addDualAxisOptions
public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping)
Description copied from interface:OptionHelperAdd a definition of dual axis to the root of ChartOptions. Use ResourceModels with key convention for labeling axis.- Specified by:
addDualAxisOptionsin interfaceOptionHelper- Parameters:
parent- Root ChartOptions to add title to.axisNames- Names of the axis.seriesMapping- Map each serie in order to an axis by the axis name.- Returns:
- Parent for fluent calling.
-
addDualAxisOptions
public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers)
Description copied from interface:OptionHelperAdd a definition of dual axis to the root of ChartOptions. Use ResourceModels with key convention for labeling axis.- Specified by:
addDualAxisOptionsin interfaceOptionHelper- Parameters:
parent- Root ChartOptions to add title to.axisNames- Names of the axis.seriesMapping- Map each serie in order to an axis by the axis name.axisModifiers- Modifiers for the axis definitions. Can be used to add options to each axis. Set tonullif no modification is necessary at all. Set position in array tonullif to modification is needed for the particular axis.seriesModifiers- Modifiers for the series definitions. Can be used to add options to each series. Set tonullif no modification is necessary at all. Set position in array tonullif to modification is needed for the particular series.- Returns:
- Parent for fluent calling.
-
addDualAxisOptions
public ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles)
Description copied from interface:OptionHelperAdd a definition of dual axis to the root of ChartOptions. Use explicit axis titles for labeling axis.- Specified by:
addDualAxisOptionsin interfaceOptionHelper- Parameters:
parent- Root ChartOptions to add title to.axisNames- Names of the axis.seriesMapping- Map each serie in order to an axis by the axis name.axisTitles- Display titles (labels) used for the titles axis. Must have same order and count asaxisNames.- Returns:
- Parent for fluent calling.
-
-