Class DefaultCockpitAdminService

  • All Implemented Interfaces:
    CockpitAdminService

    public class DefaultCockpitAdminService
    extends java.lang.Object
    implements CockpitAdminService
    Provides functionality for cockpitNG admin mode.
    • Field Detail

      • COCKPIT_SYMBOLIC_ADMIN_MODE

        public static final java.lang.String COCKPIT_SYMBOLIC_ADMIN_MODE
        See Also:
        Constant Field Values
      • COCKPIT_SHOW_CONNECTIONS_FLAG

        public static final java.lang.String COCKPIT_SHOW_CONNECTIONS_FLAG
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultCockpitAdminService

        public DefaultCockpitAdminService()
    • Method Detail

      • refreshCockpit

        public void refreshCockpit()
        Description copied from interface: CockpitAdminService
        Clears the widget session cache, which results in recalculating the widget tree after the next page refresh.
        Specified by:
        refreshCockpit in interface CockpitAdminService
      • setSymbolicAdminFlag

        public void setSymbolicAdminFlag​(boolean enabled)
        Description copied from interface: CockpitAdminService
        Sets symbolic adminmode flag.
        Specified by:
        setSymbolicAdminFlag in interface CockpitAdminService
        Parameters:
        enabled - indicates whether symbolic admin mode should be enabled
      • isAdminMode

        public boolean isAdminMode()
        Specified by:
        isAdminMode in interface CockpitAdminService
        Returns:
        true, if adminmode is currently enabled.
      • isAdminModePermitted

        public boolean isAdminModePermitted()
        Specified by:
        isAdminModePermitted in interface CockpitAdminService
        Returns:
        true, if adminmode is allowed for current session user.
      • setAdminMode

        public void setAdminMode​(boolean adminMode,
                                 org.zkoss.zk.ui.Component ref)
        Description copied from interface: CockpitAdminService
        Enable or disable the admin mode.
        Specified by:
        setAdminMode in interface CockpitAdminService
        Parameters:
        adminMode - True, if adminmode should be enable, false otherwise.
        ref - An arbitrary Component which is attached to the current page.
      • getWidgetToolbarColor

        public java.lang.String getWidgetToolbarColor()
        Specified by:
        getWidgetToolbarColor in interface CockpitAdminService
        Returns:
        the current color string used for the widget toolbars in a CSS readable RGB representation.
      • isInClipboard

        public boolean isInClipboard​(Widget widget)
        Description copied from interface: CockpitAdminService
        Checks if given widget is already in the clipboard
        Specified by:
        isInClipboard in interface CockpitAdminService
        Parameters:
        widget - The widget that should be checked
        Returns:
        true, if the specified widget is in clipboard.
      • moveWidgetToClipboard

        public void moveWidgetToClipboard​(Widget widget)
        Description copied from interface: CockpitAdminService
        Adds the specified widget to the clipboard and removes it from the widget tree.
        Specified by:
        moveWidgetToClipboard in interface CockpitAdminService
        Parameters:
        widget - which should be moved to clipboard
      • logWarningForManyInstancesIfNecessary

        protected void logWarningForManyInstancesIfNecessary​(int widgetInstancesSize)
      • removeWidgetSlotFromView

        protected void removeWidgetSlotFromView​(Widgetslot slot)
      • storeWidgetInWidgetTree

        protected void storeWidgetInWidgetTree​(WidgetInstance instance)
      • pasteWidgetToClipboard

        protected void pasteWidgetToClipboard​(Widget widget)
      • getClipboardWidgets

        protected java.util.List<java.lang.Object> getClipboardWidgets​(java.lang.Object widgetClipboardAttribute)
      • updateClipboard

        protected void updateClipboard()
      • renderWidgetClipboard

        public void renderWidgetClipboard​(org.zkoss.zk.ui.Component clipboardComponent,
                                          org.zkoss.zul.Caption caption)
        Description copied from interface: CockpitAdminService
        Render content of widget clipboard.
        Specified by:
        renderWidgetClipboard in interface CockpitAdminService
        Parameters:
        clipboardComponent - clipborad component
        caption - clipborad caption
      • showGroupWidgetWizard

        public void showGroupWidgetWizard​(Widget widget,
                                          org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> onCloseListener)
        Description copied from interface: CockpitAdminService
        Opens a wizard where the admin user can group a widget and its children into one single widget.
        Specified by:
        showGroupWidgetWizard in interface CockpitAdminService
        Parameters:
        widget - The root widget of the new widget group.
        onCloseListener - An EventListener which is called when the wizard is closed by the user.
      • prepareTreeModel

        protected org.zkoss.zul.TreeModel<java.lang.Object> prepareTreeModel​(WidgetDefinition definition)
      • showWidgetConnectionWizard

        public void showWidgetConnectionWizard​(Widget source,
                                               Widget target,
                                               org.zkoss.zk.ui.Component ref)
        Description copied from interface: CockpitAdminService
        Opens a wizard where a user can connect two widgets.
        Specified by:
        showWidgetConnectionWizard in interface CockpitAdminService
        Parameters:
        source - The source widget, i.e. the widget that may fire the event.
        target - The target widget, i.e. the widget that should receive the event.
        ref - An arbitrary Component which is attached to the current page.
      • showWidgetMultiConnectionWizard

        public void showWidgetMultiConnectionWizard​(Widget widget,
                                                    org.zkoss.zk.ui.Component ref)
        Description copied from interface: CockpitAdminService
        Shows a wizard for configuration of input/output sockets.
        Specified by:
        showWidgetMultiConnectionWizard in interface CockpitAdminService
        Parameters:
        widget - widget under configuration
        ref - parent component
      • createVirtualSocket

        @Deprecated(since="6.5",
                    forRemoval=true)
        public void createVirtualSocket​(Widget widget)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 6.5
        Parameters:
        widget -
      • hasConnections

        protected boolean hasConnections​(Widget widget)
      • renderWidgetDefinitionInfo

        public org.zkoss.zk.ui.Component renderWidgetDefinitionInfo​(org.zkoss.zk.ui.Component parent,
                                                                    WidgetDefinition widgetDefinition)
        Description copied from interface: CockpitAdminService
        Renders an area of widget definition information
        Specified by:
        renderWidgetDefinitionInfo in interface CockpitAdminService
        Parameters:
        parent - a component parent to which a component is appended
        widgetDefinition - a widget definition containing information to display
        Returns:
        created Component
      • createSettingsWizard

        public org.zkoss.zul.Window createSettingsWizard​(org.zkoss.zk.ui.Component parent,
                                                         Widgetslot widgetslot,
                                                         Widget widget,
                                                         org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> closeCallback)
        Description copied from interface: CockpitAdminService
        Creates a popup of settings for given widget
        Specified by:
        createSettingsWizard in interface CockpitAdminService
        Parameters:
        parent - a component parent to which a component is appended
        widgetslot - a slot of the widget
        widget - a widget from which settings to display are taken
        closeCallback - a function which is called when settings popup is being close
        Returns:
        created Window
      • showAddWidgetWizard

        public void showAddWidgetWizard​(org.zkoss.zk.ui.Component ref,
                                        org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> selectListener)
        Description copied from interface: CockpitAdminService
        Opens a wizard for adding a widget to a slot. Shows all widgets in the repository.
        Specified by:
        showAddWidgetWizard in interface CockpitAdminService
        Parameters:
        ref - An arbitrary Component which is attached to the current page.
        selectListener - An EventListener which is called when a widget has been selected in the wizard.
      • parseSocketInfo

        protected java.util.List<java.lang.String[]> parseSocketInfo​(java.lang.String propsStr)
      • setWidgetToolbarColor

        public void setWidgetToolbarColor​(java.lang.String color,
                                          org.zkoss.zk.ui.Component ref)
        Description copied from interface: CockpitAdminService
        Sets a new Color to the toolbar.
        Specified by:
        setWidgetToolbarColor in interface CockpitAdminService
        Parameters:
        color - the new color
        ref - An arbitrary Component which is attached to the current page.
      • canReceiveFrom

        public boolean canReceiveFrom​(WidgetSocket inputSocket,
                                      Widget targetWidget,
                                      WidgetSocket outputSocket,
                                      Widget srcWidget)
        Description copied from interface: CockpitAdminService
        Checks if outputSocket from srcWidget can be connected with inputSocket from targetWidget according to data type.
        Specified by:
        canReceiveFrom in interface CockpitAdminService
        Parameters:
        inputSocket - - WidgetSocket represents input socket
        targetWidget - - (@link Widget represents target widget
        outputSocket - - WidgetSocket represents output socket
        srcWidget - - (@link Widget represents source widget
        Returns:
        true, if the targetWidget.
      • setWidgetService

        public void setWidgetService​(WidgetService widgetService)
      • setNotificationStack

        public void setNotificationStack​(NotificationStack notificationStack)
      • setModalWindowStack

        public void setModalWindowStack​(ModalWindowStack modalWindowStack)
      • setWidgetPersistenceService

        public void setWidgetPersistenceService​(WidgetPersistenceService widgetPersistenceService)
      • setXmlBasedWidgetPersistenceService

        public void setXmlBasedWidgetPersistenceService​(XMLWidgetPersistenceService xmlBasedWidgetPersistenceService)
      • setWidgetUtils

        public void setWidgetUtils​(WidgetUtils widgetUtils)
      • setWidgetInstanceService

        public void setWidgetInstanceService​(WidgetInstanceService widgetInstanceService)
      • setSessionWidgetInstanceRegistry

        public void setSessionWidgetInstanceRegistry​(SessionWidgetInstanceRegistry sessionWidgetInstanceRegistry)
      • setWidgetLibUtils

        public void setWidgetLibUtils​(WidgetLibUtils widgetLibUtils)
      • setSocketConnectionService

        public void setSocketConnectionService​(SocketConnectionService socketConnectionService)
      • setCockpitProperties

        public void setCockpitProperties​(CockpitProperties cockpitProperties)
      • setTypedSettingsRenderer

        public void setTypedSettingsRenderer​(TypedSettingsRenderer typedSettingsRenderer)
      • getAdminModeAuthorityGroupService

        protected AuthorityGroupService getAdminModeAuthorityGroupService()
        Returns:
        the adminModeAuthorityGroupService
      • setAdminModeAuthorityGroupService

        public void setAdminModeAuthorityGroupService​(AuthorityGroupService adminModeAuthorityGroupService)
        Parameters:
        adminModeAuthorityGroupService - the adminModeAuthorityGroupService to set
      • setImpersonationPreviewHelper

        public void setImpersonationPreviewHelper​(ImpersonationPreviewHelper impersonationPreviewHelper)
        Parameters:
        impersonationPreviewHelper - the impersonationPreviewHelper to set
      • setCockpitUserService

        public void setCockpitUserService​(CockpitUserService cockpitUserService)
      • toggleAdminMode

        public void toggleAdminMode​(org.zkoss.zk.ui.Component slot)
        Description copied from interface: CockpitAdminService
        Toggles backoffice's admin mode
        Specified by:
        toggleAdminMode in interface CockpitAdminService
        Parameters:
        slot - parent component