Class Interactions
- java.lang.Object
-
- org.pepstock.charba.client.interaction.Interactions
-
- All Implemented Interfaces:
ChartsLifecycleListener
public final class Interactions extends Object implements ChartsLifecycleListener
Manages the chart interaction modes.
With a custom interaction mode you can decide how and which elements will be managed interacting with chart events.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Interactioner
createExtendedInteractioner(String mode, ExtendedInteraction interation)
Creates aInteractioner
for a specific mode, passed as argument, and a native function already existing in java script code.Interactioner
createExtendedInteractioner(String mode, ExtendedInteraction interation, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and a native function already existing in java script code.Interactioner
createNativeInteractioner(String mode, String code)
Creates aInteractioner
for a specific mode, passed as argument, and a string which represents the java script code, to implement the new interaction mode.Interactioner
createNativeInteractioner(String mode, String code, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and a string which represents the java script code, to implement the new interaction mode.Interactioner
createNativeInteractioner(String mode, NativeInteraction callback)
Creates aInteractioner
for a specific mode, passed as argument, and aNativeInteraction
which represents the java script function, to implement the new interaction mode.Interactioner
createNativeInteractioner(String mode, NativeInteraction callback, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and aNativeInteraction
which represents the java script function, to implement the new interaction mode.Interactioner
createNativeInteractioner(String mode, AbstractInjectableResource code)
Creates aInteractioner
for a specific mode, passed as argument, and a resource where the java script code, to implement the new interaction mode, is stored.Interactioner
createNativeInteractioner(String mode, AbstractInjectableResource code, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and a resource where the java script code, to implement the new interaction mode, is stored.static Interactions
get()
Singleton object to get the interactions instanceInteractioner
getInteractioner(IsInteractionMode mode)
Returns the interactioner.
If not exists, returnsnull
.IsInteractionMode
getInteractionMode(String name)
Returns the interaction mode.
If not exists, returnsnull
.boolean
hasInteractionMode(String name)
Returnstrue
if the mode is defined, otherwisefalse
.void
onBeforeDestroy(IsChart chart)
Called before the chart has been destroyed.void
register(Interactioner interactioner)
Register the interaction mode to CHART.JS.void
unregister(IsInteractionMode mode)
Unregister the custom interaction mode to CHART.JS.void
unregister(Interactioner interactioner)
Unregister the custom interaction mode to CHART.JS.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.ChartsLifecycleListener
onAfterConfigure, onAfterDestroy, onAfterInit, onBeforeConfigure, onBeforeInit
-
-
-
-
Method Detail
-
get
public static Interactions get()
Singleton object to get the interactions instance- Returns:
- interactions instance.
-
onBeforeDestroy
public void onBeforeDestroy(IsChart chart)
Description copied from interface:ChartsLifecycleListener
Called before the chart has been destroyed.- Specified by:
onBeforeDestroy
in interfaceChartsLifecycleListener
- Parameters:
chart
- the chart instance.
-
createExtendedInteractioner
public Interactioner createExtendedInteractioner(String mode, ExtendedInteraction interation)
Creates aInteractioner
for a specific mode, passed as argument, and a native function already existing in java script code.- Parameters:
mode
- new interaction modeinteration
- a native function already existing in java script code- Returns:
- new
Interactioner
for a specific mode
-
createExtendedInteractioner
public Interactioner createExtendedInteractioner(String mode, ExtendedInteraction interation, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and a native function already existing in java script code.- Parameters:
mode
- new interaction modeinteration
- a native function already existing in java script coderegister
- iftrue
, the new interaction mode will be automatically registered- Returns:
- new
Interactioner
for a specific mode
-
createNativeInteractioner
public Interactioner createNativeInteractioner(String mode, AbstractInjectableResource code)
Creates aInteractioner
for a specific mode, passed as argument, and a resource where the java script code, to implement the new interaction mode, is stored.- Parameters:
mode
- new interaction modecode
- a resource where the java script code is stored- Returns:
- new
Interactioner
for a specific mode
-
createNativeInteractioner
public Interactioner createNativeInteractioner(String mode, AbstractInjectableResource code, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and a resource where the java script code, to implement the new interaction mode, is stored.- Parameters:
mode
- new interaction modecode
- a resource where the java script code is storedregister
- iftrue
, the new interaction mode will be automatically registered- Returns:
- new
Interactioner
for a specific mode
-
createNativeInteractioner
public Interactioner createNativeInteractioner(String mode, String code)
Creates aInteractioner
for a specific mode, passed as argument, and a string which represents the java script code, to implement the new interaction mode.- Parameters:
mode
- new interaction modecode
- a string which represents the java script code- Returns:
- new
Interactioner
for a specific mode
-
createNativeInteractioner
public Interactioner createNativeInteractioner(String mode, String code, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and a string which represents the java script code, to implement the new interaction mode.- Parameters:
mode
- new interaction modecode
- a string which represents the java script coderegister
- iftrue
, the new interaction mode will be automatically registered- Returns:
- new
Interactioner
for a specific mode
-
createNativeInteractioner
public Interactioner createNativeInteractioner(String mode, NativeInteraction callback)
Creates aInteractioner
for a specific mode, passed as argument, and aNativeInteraction
which represents the java script function, to implement the new interaction mode.- Parameters:
mode
- new interaction modecallback
- aNativeInteraction
which represents the java script function- Returns:
- new
Interactioner
for a specific mode
-
createNativeInteractioner
public Interactioner createNativeInteractioner(String mode, NativeInteraction callback, boolean register)
Creates aInteractioner
for a specific mode, passed as argument, and aNativeInteraction
which represents the java script function, to implement the new interaction mode.- Parameters:
mode
- new interaction modecallback
- aNativeInteraction
which represents the java script functionregister
- iftrue
, the new interaction mode will be automatically registered- Returns:
- new
Interactioner
for a specific mode
-
hasInteractionMode
public boolean hasInteractionMode(String name)
Returnstrue
if the mode is defined, otherwisefalse
.- Parameters:
name
- the name of interaction mode- Returns:
true
if the mode is defined, otherwisefalse
-
getInteractionMode
public IsInteractionMode getInteractionMode(String name)
Returns the interaction mode.
If not exists, returnsnull
.- Parameters:
name
- the name of interaction mode- Returns:
- the interaction mode.
If not exists, returnsnull
.
-
getInteractioner
public Interactioner getInteractioner(IsInteractionMode mode)
Returns the interactioner.
If not exists, returnsnull
.- Parameters:
mode
- the name of interaction mode- Returns:
- the interactioner instance.
If not exists, returnsnull
.
-
register
public void register(Interactioner interactioner)
Register the interaction mode to CHART.JS.- Parameters:
interactioner
- interactioner instance to register
-
unregister
public void unregister(Interactioner interactioner)
Unregister the custom interaction mode to CHART.JS.- Parameters:
interactioner
- custom interaction mode instance
-
unregister
public void unregister(IsInteractionMode mode)
Unregister the custom interaction mode to CHART.JS.- Parameters:
mode
- custom interaction mode instance
-
-