Class NetworkChartController
- java.lang.Object
-
- org.zkoss.zk.ui.event.GenericEventListener
-
- org.zkoss.zk.ui.util.GenericComposer<T>
-
- org.zkoss.zk.ui.util.GenericAutowireComposer<T>
-
- org.zkoss.zk.ui.util.GenericForwardComposer<org.zkoss.zk.ui.Component>
-
- com.hybris.cockpitng.util.ViewAnnotationAwareComposer
-
- com.hybris.cockpitng.util.DefaultWidgetController
-
- com.hybris.backoffice.widgets.networkchart.NetworkChartController
-
- All Implemented Interfaces:
WidgetController,WidgetDragAndDropAware,WidgetInstanceManagerAware,java.io.Serializable,org.zkoss.zk.ui.event.EventListener,org.zkoss.zk.ui.event.SerializableEventListener,org.zkoss.zk.ui.util.ComponentActivationListener,org.zkoss.zk.ui.util.ComponentCloneListener,org.zkoss.zk.ui.util.Composer<org.zkoss.zk.ui.Component>,org.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>
public class NetworkChartController extends DefaultWidgetController
Default controller for vis.js network chart's widget- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.ObjectMappermapperstatic java.lang.StringMODEL_CANVAS_CENTERstatic java.lang.StringMODEL_INIT_DATAstatic java.lang.StringMODEL_NETWORK_EDGESstatic java.lang.StringMODEL_NETWORK_NODESstatic java.lang.StringSCLASS_EMPTY_CHARTstatic java.lang.StringSETTING_CHART_OPTIONSstatic java.lang.StringSETTING_CHART_OPTIONS_PROVIDERstatic java.lang.StringSETTING_CUSTOM_ADD_NODE_BUTTONstatic java.lang.StringSETTING_DATA_MANIPULATION_HANDLERstatic java.lang.StringSETTING_NETWORK_POPULATORstatic java.lang.StringSETTING_SHOW_CONTROLS_BUTTONSstatic java.lang.StringSETTING_VIEW_EVENT_HANDLERstatic java.lang.StringSOCKET_IN_INIT_DATAstatic java.lang.StringSOCKET_IN_UPDATE_OBJECT
-
Constructor Summary
Constructors Constructor Description NetworkChartController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Optional<ListContainerCloseListener>evaluateOnCloseListener(TypedSettingsMap widgetSettings)EvaluatesListContainerCloseListenerspecified byListContainerRenderer.CLOSE_LISTENER_SETTINGon widget settingsprotected java.util.Optional<org.zkoss.zul.Window>findTemplateWindow()Tries to find parent window for this template widgetorg.zkoss.zul.ButtongetCancelButton()OptionsgetChartOptions()OptionsProvidergetChartOptionsProvider()org.zkoss.zul.DivgetControlsButtonContainer()protected DataManipulationHandlergetDataManipulationHandler()NetworkChartgetNetworkChart()protected NetworkPopulatorgetNetworkPopulator()org.zkoss.zul.ButtongetRefreshButton()org.zkoss.zul.ButtongetSaveButton()protected ViewEventHandlergetViewEventHandler()protected voidhandleEvent(CockpitEvent event, java.util.function.Consumer consumer)voidhandleObjectsDeletedEvent(CockpitEvent event)voidhandleObjectsUpdatedEvent(CockpitEvent event)protected voidhandleRefresh(DataManipulationHandler dataManipulationHandler, NetworkChartContext context)Allows to refresh model and sends the event about refreshingvoidinitData(java.lang.Object initData)voidinitialize(org.zkoss.zk.ui.Component comp)Override this method to do initialization stuff for your widget, like initialize widget settings, restore view state from viewmodel, etc.protected voidinitializeControlButtonsListeners(DataManipulationHandler dataManipulationHandler, NetworkChartContext context)protected voidinitializeDataManipulationListeners(DataManipulationHandler dataManipulationHandler, NetworkChartContext context)protected voidinitializeHandlers()protected voidinitializeViewEventListeners(ViewEventHandler viewEventHandler, NetworkChartContext context)protected voidinitializeWorkflowDesignerButtons()protected voidinitModel()protected voidinjectSettings()protected java.util.ListjoinCollections(java.util.Collection... collections)protected voidresetModel()protected voidrestoreNetworkFromModel()voidsetCancelButton(org.zkoss.zul.Button cancelButton)voidsetControlsButtonContainer(org.zkoss.zul.Div controlsButtonContainer)voidsetNetworkChart(NetworkChart networkChart)voidsetRefreshButton(org.zkoss.zul.Button refreshButton)voidsetSaveButton(org.zkoss.zul.Button saveButton)protected voidstoreNetworkUpdateInModel(NetworkUpdates updatesToStore)Persists network updates in modelprotected voidupdateNetworkChartScss()voidupdateObject(java.lang.Object objectToUpdate)-
Methods inherited from class com.hybris.cockpitng.util.DefaultWidgetController
doAfterCompose, doBeforeCompose, doBeforeComposeChildren, executeOperation, getDragAndDropStrategy, getLabel, getLabel, getModel, getValue, getWidgetDragAndDropStrategyRepository, getWidgetInstanceManager, getWidgetRoot, getWidgetSettings, getWidgetslot, getWidgetTitle, getWidgetUtils, initDragAndDropAwareness, initWidgetSetting, initWidgetSetting, initWidgetSetting, initWidgetSetting, initWidgetSetting, invokeListenerMethod, onSocketInput, preInitialize, sendOutput, sendOutputAfterOperation, sendOutputAfterOperation, sendOutputAfterOperation, setValue, setWidgetInstanceManager, setWidgetTitle
-
Methods inherited from class com.hybris.cockpitng.util.ViewAnnotationAwareComposer
scanEventListeners
-
Methods inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer
alert, didActivate, getPage, willClone, willPassivate
-
-
-
-
Field Detail
-
SOCKET_IN_INIT_DATA
public static final java.lang.String SOCKET_IN_INIT_DATA
- See Also:
- Constant Field Values
-
SOCKET_IN_UPDATE_OBJECT
public static final java.lang.String SOCKET_IN_UPDATE_OBJECT
- See Also:
- Constant Field Values
-
SETTING_CHART_OPTIONS
public static final java.lang.String SETTING_CHART_OPTIONS
- See Also:
- Constant Field Values
-
SETTING_CHART_OPTIONS_PROVIDER
public static final java.lang.String SETTING_CHART_OPTIONS_PROVIDER
- See Also:
- Constant Field Values
-
SETTING_NETWORK_POPULATOR
public static final java.lang.String SETTING_NETWORK_POPULATOR
- See Also:
- Constant Field Values
-
SETTING_VIEW_EVENT_HANDLER
public static final java.lang.String SETTING_VIEW_EVENT_HANDLER
- See Also:
- Constant Field Values
-
SETTING_DATA_MANIPULATION_HANDLER
public static final java.lang.String SETTING_DATA_MANIPULATION_HANDLER
- See Also:
- Constant Field Values
-
SETTING_SHOW_CONTROLS_BUTTONS
public static final java.lang.String SETTING_SHOW_CONTROLS_BUTTONS
- See Also:
- Constant Field Values
-
SETTING_CUSTOM_ADD_NODE_BUTTON
public static final java.lang.String SETTING_CUSTOM_ADD_NODE_BUTTON
- See Also:
- Constant Field Values
-
MODEL_INIT_DATA
public static final java.lang.String MODEL_INIT_DATA
- See Also:
- Constant Field Values
-
MODEL_NETWORK_NODES
public static final java.lang.String MODEL_NETWORK_NODES
- See Also:
- Constant Field Values
-
MODEL_NETWORK_EDGES
public static final java.lang.String MODEL_NETWORK_EDGES
- See Also:
- Constant Field Values
-
MODEL_CANVAS_CENTER
public static final java.lang.String MODEL_CANVAS_CENTER
- See Also:
- Constant Field Values
-
SCLASS_EMPTY_CHART
public static final java.lang.String SCLASS_EMPTY_CHART
- See Also:
- Constant Field Values
-
mapper
protected final transient com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
initialize
public void initialize(org.zkoss.zk.ui.Component comp)
Description copied from class:DefaultWidgetControllerOverride this method to do initialization stuff for your widget, like initialize widget settings, restore view state from viewmodel, etc. This method will be invoked byDefaultWidgetController.doAfterCompose(Component)everytime your widget view is created. SeeGenericForwardComposer.doAfterCompose(Component)for more details.- Overrides:
initializein classDefaultWidgetController
-
injectSettings
protected void injectSettings()
-
initializeWorkflowDesignerButtons
protected void initializeWorkflowDesignerButtons()
-
initializeHandlers
protected void initializeHandlers()
-
initModel
protected void initModel()
-
resetModel
protected void resetModel()
-
restoreNetworkFromModel
protected void restoreNetworkFromModel()
-
updateNetworkChartScss
protected void updateNetworkChartScss()
-
joinCollections
protected java.util.List joinCollections(java.util.Collection... collections)
-
initData
public void initData(java.lang.Object initData)
-
updateObject
public void updateObject(java.lang.Object objectToUpdate)
-
handleObjectsUpdatedEvent
public void handleObjectsUpdatedEvent(CockpitEvent event)
-
handleObjectsDeletedEvent
public void handleObjectsDeletedEvent(CockpitEvent event)
-
handleEvent
protected void handleEvent(CockpitEvent event, java.util.function.Consumer consumer)
-
initializeViewEventListeners
protected void initializeViewEventListeners(ViewEventHandler viewEventHandler, NetworkChartContext context)
-
initializeDataManipulationListeners
protected void initializeDataManipulationListeners(DataManipulationHandler dataManipulationHandler, NetworkChartContext context)
-
initializeControlButtonsListeners
protected void initializeControlButtonsListeners(DataManipulationHandler dataManipulationHandler, NetworkChartContext context)
-
findTemplateWindow
protected java.util.Optional<org.zkoss.zul.Window> findTemplateWindow()
Tries to find parent window for this template widget- Returns:
- window object if the widget is a template,
Optional.empty()otherwise
-
evaluateOnCloseListener
protected java.util.Optional<ListContainerCloseListener> evaluateOnCloseListener(TypedSettingsMap widgetSettings)
EvaluatesListContainerCloseListenerspecified byListContainerRenderer.CLOSE_LISTENER_SETTINGon widget settings- Parameters:
widgetSettings- widget settings containing close listener spring bean name- Returns:
- ListContainerCloseListener or empty if not found
-
handleRefresh
protected void handleRefresh(DataManipulationHandler dataManipulationHandler, NetworkChartContext context)
Allows to refresh model and sends the event about refreshing- Parameters:
dataManipulationHandler-context-
-
storeNetworkUpdateInModel
protected void storeNetworkUpdateInModel(NetworkUpdates updatesToStore)
Persists network updates in model- Parameters:
updatesToStore-
-
getChartOptionsProvider
public OptionsProvider getChartOptionsProvider()
-
getNetworkPopulator
protected NetworkPopulator getNetworkPopulator()
- Returns:
NetworkPopulatorwhich is responsible for providing initial data to network chart.
-
getViewEventHandler
protected ViewEventHandler getViewEventHandler()
- Returns:
ViewEventHandlerwhich is responsible for handling network events: click, doubleClick, selection and deselection of node and edge.
-
getDataManipulationHandler
protected DataManipulationHandler getDataManipulationHandler()
- Returns:
DataManipulationHandlerwhich is responsible for manipulating network structure.
-
setNetworkChart
public void setNetworkChart(NetworkChart networkChart)
-
getNetworkChart
public NetworkChart getNetworkChart()
-
getSaveButton
public org.zkoss.zul.Button getSaveButton()
-
setSaveButton
public void setSaveButton(org.zkoss.zul.Button saveButton)
-
getRefreshButton
public org.zkoss.zul.Button getRefreshButton()
-
setRefreshButton
public void setRefreshButton(org.zkoss.zul.Button refreshButton)
-
getCancelButton
public org.zkoss.zul.Button getCancelButton()
-
setCancelButton
public void setCancelButton(org.zkoss.zul.Button cancelButton)
-
getControlsButtonContainer
public org.zkoss.zul.Div getControlsButtonContainer()
-
setControlsButtonContainer
public void setControlsButtonContainer(org.zkoss.zul.Div controlsButtonContainer)
-
-