Interface OptionHelper
-
- All Known Implementing Classes:
AbstractOptionHelper,ClassicOptionHelper,MaterialOptionHelper
public interface OptionHelperUtility methods to generate more complex constructs inChartOptions. Also two implementations (ClassicOptionHelperandMaterialOptionHelper) can be used for convenient building of different option structure just by changing the implementation of this interface. Also used to generate ResourceModels according to a convention for the keys. Implementations should callResourceModel.wrapOnAssignment(org.apache.wicket.Component)with theChartcomponent as wrapper.- Author:
- Dieter Tremel
-
-
Method Summary
All Methods Instance Methods Abstract 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, String[] axisTitles, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers)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.ChartOptionsaddSubTitle(ChartOptions parent, String subTitle)Add a subTitle of the chart to the root of ChartOptions.ChartOptionsaddSubTitle(ChartOptions parent, IModel<String> subTitleModel)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.ChartOptionsaddTitle(ChartOptions parent, String title)Add a title of the chart to the root of ChartOptions.ChartOptionsaddTitle(ChartOptions parent, IModel<String> titleModel)Add a title of the chart to the root of ChartOptions.StringgetChartBaseResourceKey()Generate the base resource key for the chart.IModel<String>getChartLabelResourceModel(String subKey)Generate a wrapped ResourceModel for theChartcomponent.
-
-
-
Method Detail
-
getChartBaseResourceKey
String getChartBaseResourceKey()
Generate 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.".- Returns:
- Base resource key of chart in form
"chart.<id of chart>.". Note the trailing dot.
-
getChartLabelResourceModel
IModel<String> getChartLabelResourceModel(String subKey)
Generate a wrapped ResourceModel for theChartcomponent.- Parameters:
subKey- Subkey as suffix ofgetChartBaseResourceKey().- Returns:
- ResourceModel for the complete key. There is no default defined, so missing properties can be easyly detected.
-
addTitle
ChartOptions addTitle(ChartOptions parent)
Add 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.- Parameters:
parent- Root ChartOptions to add title to.- Returns:
- Parent for fluent calling.
-
addTitle
ChartOptions addTitle(ChartOptions parent, String title)
Add a title of the chart to the root of ChartOptions.- Parameters:
parent- Root ChartOptions to add title to.title- String to use for the title.- Returns:
- Parent for fluent calling.
-
addTitle
ChartOptions addTitle(ChartOptions parent, IModel<String> titleModel)
Add a title of the chart to the root of ChartOptions.- Parameters:
parent- Root ChartOptions to add title to.titleModel- Model to use for the title.- Returns:
- Parent for fluent calling.
-
addSubTitle
ChartOptions addSubTitle(ChartOptions parent)
Add 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.- Parameters:
parent- Root ChartOptions to add subTitle to.- Returns:
- Parent for fluent calling.
-
addSubTitle
ChartOptions addSubTitle(ChartOptions parent, String subTitle)
Add a subTitle of the chart to the root of ChartOptions.- Parameters:
parent- Root ChartOptions to add subTitle to.subTitle- String to use for the subTitle.- Returns:
- Parent for fluent calling.
-
addSubTitle
ChartOptions addSubTitle(ChartOptions parent, IModel<String> subTitleModel)
Add a subTitle of the chart to the root of ChartOptions.- Parameters:
parent- Root ChartOptions to add subTitle to.subTitleModel- Model to use for the subTitle.- Returns:
- Parent for fluent calling.
-
addDualAxisOptions
ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping)
Add a definition of dual axis to the root of ChartOptions. Use ResourceModels with key convention for labeling axis.- 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
ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers)
Add a definition of dual axis to the root of ChartOptions. Use ResourceModels with key convention for labeling axis.- 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
ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles)
Add a definition of dual axis to the root of ChartOptions. Use explicit axis titles for labeling axis.- 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.
-
addDualAxisOptions
ChartOptions addDualAxisOptions(ChartOptions parent, String[] axisNames, String[] seriesMapping, String[] axisTitles, OptionModifier[] axisModifiers, OptionModifier[] seriesModifiers)
Add a definition of dual axis to the root of ChartOptions. Use explicit axis titles for labeling axis.- 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.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. Set tonullif no modification needed.- Returns:
- Parent for fluent calling.
-
-