Package org.zkoss.chart
Class Optionable
- java.lang.Object
-
- org.zkoss.chart.Optionable
-
- All Implemented Interfaces:
Serializable
,OptionDataListener
,org.zkoss.json.JSONAware
- Direct Known Subclasses:
Accessibility
,AccessibilityPoint
,AccessibilitySeries
,ActiveWhen
,Animation
,Annotation
,Annotation.Point
,AnnotationLabelAccessibility
,AnnotationLabelOptions
,AnnotationShapeOptions
,AnnounceNewData
,Axis
,AxisAccessibility
,AxisLabels
,AxisTitle
,Breadcrumbs
,Break
,BubbleLegend
,BubbleLegend.Labels
,BubbleLegend.Range
,Caption
,Chart
,Cluster
,ClusterLayoutAlgorithm
,CollapseButton
,Color
,ColorVariation
,ConnectorOptions
,Credits
,Crosshair
,Data
,DataClass
,DataLabels
,DataLabelsFilter
,DataLabelsTextPath
,DataSorting
,DateTimeLabelFormats
,DefaultSpeechOptions
,DragDrop
,DragDrop.DragHandle
,DragDrop.GuideBox
,Drilldown
,DrillUpButton
,Exporting
,ExportingAccessibility
,ExportingButton
,FocusBorder
,Frame3D
,Frequency
,GaugeDialPlotOptions
,GaugePivotPlotOptions
,Global
,GlobalTrack
,Halo
,HaloAttributes
,Highpass
,Jitter
,KeyboardNavigation
,Labels
,LabelsItem
,Lang
,LangAccessibility
,LangAnnounceNewData
,LangAxis
,LangChartTypes
,LangExporting
,LangLegend
,LangRangeSelector
,LangScreenReaderSection
,LangScreenReaderSectionAnnotations
,LangSeries
,LangSeriesSummary
,LangSeriesTypeDescriptions
,LangSonification
,LangTable
,LangZoom
,Legend
,LegendAccessibility
,LegendKeyboardNavigation
,LegendNavigation
,LegendTitle
,Level
,LevelSize
,LinearGradient
,Loading
,Mapping
,Marker
,MenuItem
,Navigation
,NavigationButton
,NetworkGraphLayoutAlgorithm
,NetworkGraphLink
,NoData
,Node
,OnPoint
,Options
,Options3D
,PackedBubbleLayoutAlgorithm
,PackedBubbleParentNode
,PackedBubbleParentNodeOptions
,Pane
,PaneBackground
,Panel3D
,Path
,PDFFont
,Pitch
,PlotBand
,PlotLabel
,PlotLine
,PlotOptions
,Point
,PointAccessibility
,PointGrouping
,Position
,RadialGradient
,ResetZoomButton
,Responsive
,Responsive.Condition
,Responsive.Rule
,ScreenReaderSection
,ScrollablePlotArea
,Separator
,Series
,SeriesAccessibility
,SeriesKeyboardNavigation
,SeriesLabel
,SeriesNavigation
,SeriesPlotOptions
,SeriesSonification
,Shadow
,Sonification
,StackLabels
,StackShadow
,State
,States
,Subtitle
,TargetOptions
,Title
,Tooltip
,TooltipPlotOptions
,TraverseUpButton
,TreeGraphLink
,Tremolo
,WindBarbDataGrouping
,WordCloudRotation
,XRangePartialFill
,Zone
public abstract class Optionable extends Object implements org.zkoss.json.JSONAware, OptionDataListener
A skeletal implementation for Highcharts's optionable data.- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Optionable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
addExtraAttr(String key, org.zkoss.json.JSONAware value)
Adds an extra attribute to client side, if any.<T extends Optionable>
TaddOptionDataListener(OptionDataListener l)
Adds the option data listener<T extends Optionable>
TclearOptonDataListener()
Clear up all the option data listenersObject
clone()
protected boolean
containsKey(PlotAttribute key)
Returns true if this options contains a mapping for the specified key.protected <T extends Optionable>
TfireEvent(OptionDataEvent event)
Triggers the option change event.protected <T extends Optionable>
TfireEvent(OptionDataEvent.EventType type, String key, Object value, String key2, Object value2, Object... pairs)
Triggers the option change event.protected <T extends Optionable>
TfireEvent(OptionDataEvent.EventType type, String key, Object value, DeferredCall call)
Triggers the option change event.protected <T extends Optionable>
TfireEvent(OptionDataEvent.EventType type, PlotAttribute key, Object value)
Triggers the option change event.protected <T extends Optionable>
TfireEvent(OptionDataEvent.EventType type, PlotAttribute key, Object value, DeferredCall call)
Triggers the option change event.protected Object
getAttr(PlotAttribute key)
Returns the value of the element according to the attribute name.protected <T> AnyVal<T>
getAttr(PlotAttribute key, T defaultValue)
Returns theAnyVal
object of the element according to the attribute name.void
getClientState(String attr, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener)
Returns a client state after a client callback in the event listener.Object
getExtraAttr(String key)
Get an attribute by key, if any.protected Optionable
merge(Optionable other)
Merges the all value from the given object, if the key is the same, the value will be overridden.void
onChange(OptionDataEvent event)
Sent when the contents of the chart option has changed.Object
removeExtraAttr(String key)
Removes the extra attribute to client side from the given key, if any.protected Object
removeKey(PlotAttribute key, boolean triggerEvent)
Removes the mapping for a key from this options if it is present.<T extends Optionable>
TremoveOptionDataListener(OptionDataListener l)
Removes the option data listenerprotected <T> boolean
setAttr(String strKey, Object value, T defaultValue)
protected boolean
setAttr(PlotAttribute key, Object value)
Sets the value of the attribute name.protected <T> boolean
setAttr(PlotAttribute key, Object value, T defaultValue)
Sets the value of the attribute name with the given default value, which is used for comparing the null value case when the default value is not null.protected <T> boolean
setAttr(PlotAttribute key, Color value, T defaultValue)
Sets the color value of the attribute name with the given default value, which is used for comparing the null value case when the default value is not null.String
toJSONString()
Encodes this object to a JSON string.String
toString()
Encodes this object to a JSON string.
-
-
-
Method Detail
-
fireEvent
protected <T extends Optionable> T fireEvent(OptionDataEvent.EventType type, PlotAttribute key, Object value)
Triggers the option change event.
-
fireEvent
protected <T extends Optionable> T fireEvent(OptionDataEvent.EventType type, PlotAttribute key, Object value, DeferredCall call)
Triggers the option change event.
-
fireEvent
protected <T extends Optionable> T fireEvent(OptionDataEvent.EventType type, String key, Object value, DeferredCall call)
Triggers the option change event.
-
fireEvent
protected <T extends Optionable> T fireEvent(OptionDataEvent.EventType type, String key, Object value, String key2, Object value2, Object... pairs)
Triggers the option change event.
-
fireEvent
protected <T extends Optionable> T fireEvent(OptionDataEvent event)
Triggers the option change event.
-
addOptionDataListener
public <T extends Optionable> T addOptionDataListener(OptionDataListener l)
Adds the option data listener
-
removeOptionDataListener
public <T extends Optionable> T removeOptionDataListener(OptionDataListener l)
Removes the option data listener
-
clearOptonDataListener
public <T extends Optionable> T clearOptonDataListener()
Clear up all the option data listeners
-
getClientState
public void getClientState(String attr, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener)
Returns a client state after a client callback in the event listener.
-
setAttr
protected boolean setAttr(PlotAttribute key, Object value)
Sets the value of the attribute name.- Parameters:
key
- the name of the attributevalue
- the value of the attribute- Returns:
- boolean true if changed
-
setAttr
protected <T> boolean setAttr(PlotAttribute key, Object value, T defaultValue)
Sets the value of the attribute name with the given default value, which is used for comparing the null value case when the default value is not null.- Parameters:
key
- the name of the attributevalue
- the value of the attributedefaultValue
- defaultValue for specifying the null value to check whether the value is not the same as T defaultValue- Returns:
- boolean true if changed
-
setAttr
protected <T> boolean setAttr(PlotAttribute key, Color value, T defaultValue)
Sets the color value of the attribute name with the given default value, which is used for comparing the null value case when the default value is not null.- Parameters:
key
- the name of the attributevalue
- the value of the colordefaultValue
- defaultValue for specifying the null value to check whether the value is not the same as T defaultValue- Returns:
- boolean true if changed
-
getAttr
protected <T> AnyVal<T> getAttr(PlotAttribute key, T defaultValue)
Returns theAnyVal
object of the element according to the attribute name. If not found, sets with the given default value, if any.- Parameters:
key
- the attribute namedefaultValue
- if the value is not found, the defaultValue will be returned.
-
containsKey
protected boolean containsKey(PlotAttribute key)
Returns true if this options contains a mapping for the specified key.
-
removeKey
protected Object removeKey(PlotAttribute key, boolean triggerEvent)
Removes the mapping for a key from this options if it is present.
-
merge
protected Optionable merge(Optionable other)
Merges the all value from the given object, if the key is the same, the value will be overridden.- Parameters:
other
-
-
getAttr
protected Object getAttr(PlotAttribute key)
Returns the value of the element according to the attribute name.- Parameters:
key
- the attribute name.
-
getExtraAttr
public Object getExtraAttr(String key)
Get an attribute by key, if any.- Returns:
- the value, if any.
-
addExtraAttr
public Object addExtraAttr(String key, org.zkoss.json.JSONAware value)
Adds an extra attribute to client side, if any.- Returns:
- the old value, if any.
-
removeExtraAttr
public Object removeExtraAttr(String key)
Removes the extra attribute to client side from the given key, if any.Invoking this method won't trigger any event to notify the client side, please use
Charts.invalidate()
if you want to notify the client side to sync with the value.- Returns:
- the old value, if any.
-
toJSONString
public String toJSONString()
Encodes this object to a JSON string. It is the same astoString()
.- Specified by:
toJSONString
in interfaceorg.zkoss.json.JSONAware
-
toString
public String toString()
Encodes this object to a JSON string. It is the same astoJSONString()
.
-
onChange
public void onChange(OptionDataEvent event)
Description copied from interface:OptionDataListener
Sent when the contents of the chart option has changed.- Specified by:
onChange
in interfaceOptionDataListener
-
-