Package org.silverpeas.core.chart
Class AbstractChartItem<D>
- java.lang.Object
-
- org.silverpeas.core.chart.AbstractChartItem<D>
-
- All Implemented Interfaces:
ChartItem
- Direct Known Subclasses:
AbstractAxisChartItem
,PieChartItem
public abstract class AbstractChartItem<D> extends Object implements ChartItem
- Author:
- Yohann Chastagnier
-
-
Constructor Summary
Constructors Constructor Description AbstractChartItem()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends AbstractChartItem<D>>
TaddExtra(String key, String value)
Adds an extra information associated to the chart, but not necessary for the chart rendering.String
asJson()
Gets the json representation of the item.protected abstract void
completeJsonData(JSONCodec.JSONObject itemAsJson)
Completes the given json object with the data of specific implementations.Object
getExtra(String key)
Gets the value of an information associated to the chart, but not necessary for the chart rendering.protected UnaryOperator<JSONCodec.JSONObject>
getJsonProducer()
Gets the json representation of the item.String
getTitle()
Gets the label of the item.<T extends AbstractChartItem<D>>
TwithTitle(String title)
Sets the title that defines the item.
-
-
-
Method Detail
-
getTitle
public String getTitle()
Description copied from interface:ChartItem
Gets the label of the item.
-
addExtra
public <T extends AbstractChartItem<D>> T addExtra(String key, String value)
Adds an extra information associated to the chart, but not necessary for the chart rendering. Useful to provide data from a treatment to an other one.- Type Parameters:
T
-- Parameters:
key
- the key at which the given information is registered.value
- the value registered.- Returns:
- the instance of the chart itself.
-
getExtra
public Object getExtra(String key)
Gets the value of an information associated to the chart, but not necessary for the chart rendering. Useful to provide data from a treatment to an other one.- Parameters:
key
- the ket at which the extra data is registered.- Returns:
- the extra data as it has been registered.
-
withTitle
public <T extends AbstractChartItem<D>> T withTitle(String title)
Sets the title that defines the item.- Type Parameters:
T
-- Parameters:
title
- a title as string.- Returns:
- the instance of the chart itself.
-
asJson
public final String asJson()
Gets the json representation of the item.
-
getJsonProducer
protected final UnaryOperator<JSONCodec.JSONObject> getJsonProducer()
Gets the json representation of the item.- Returns:
- a string that represents the item as a json array.
-
completeJsonData
protected abstract void completeJsonData(JSONCodec.JSONObject itemAsJson)
Completes the given json object with the data of specific implementations.- Parameters:
itemAsJson
- the json object to complete.
-
-