Class AbstractComponentsVisitor<C extends org.zkoss.zk.ui.Component,​E extends AbstractDynamicElement>

    • Constructor Detail

      • AbstractComponentsVisitor

        public AbstractComponentsVisitor()
    • Method Detail

      • register

        public void register​(org.zkoss.zk.ui.Component component)
        Description copied from interface: ComponentsVisitor
        Registers a component and it's child components recursively using Component.getChildren()
        Specified by:
        register in interface ComponentsVisitor
        Parameters:
        component - component to register
      • unRegister

        public void unRegister​(org.zkoss.zk.ui.Component component)
        Description copied from interface: ComponentsVisitor
        Unregisters a component and it's child components recursively using Component.getChildren()
        Specified by:
        unRegister in interface ComponentsVisitor
        Parameters:
        component - component to unregister
      • cleanUpInternal

        protected void cleanUpInternal​(WidgetModel model)
        Removes all components references and model observers.
        Parameters:
        model -
      • canHandle

        protected abstract boolean canHandle​(org.zkoss.zk.ui.Component component)
        Decides if component can be handled by the visitor.
        Parameters:
        component - component to accept.
        Returns:
        true if components should be accepted by visitor.
      • getComponentKey

        protected abstract java.lang.String getComponentKey​(C component)
        Gets component's name key which is used to map components with dynamic forms through AbstractDynamicElement.getQualifier().
        Parameters:
        component - component which id should be returned.
        Returns:
        extracted key of a component.
      • getDynamicElements

        protected abstract java.util.List<E> getDynamicElements()
        Extracts elements of type from DynamicForms.
        Returns:
        list of to use in configuration.
      • visitComponents

        protected abstract void visitComponents​(E dynamicElement,
                                                java.lang.Object target,
                                                boolean initial)
        Visits components for dynamic element.
        Parameters:
        dynamicElement - dynamic forms element configuration.
        target - currently displayed object.
        initial - flag which says if this is initial visit before any interaction with user.
      • getElementQualifierKey

        protected java.lang.String getElementQualifierKey​(E dynamicElement)
        Gets qualifier of . For components which getComponentKey(Component) cannot be directly mapped to a AbstractDynamicElement.getQualifier() the method should be overridden so for matching components and values from these two methods should be equal.
        Parameters:
        dynamicElement - element of which qualifier should be returned.
        Returns:
        qualifier of a element.
      • isVisible

        protected boolean isVisible​(E element,
                                    java.lang.Object target)
        Checks configuration from AbstractDynamicElement.visibleIf against target object.
        Parameters:
        element - element of configuration
        target - target object
        Returns:
        true is component should be visible
      • isDisabled

        protected boolean isDisabled​(E element,
                                     java.lang.Object target)
        Checks configuration from AbstractDynamicElement.disabledIf against target object.
        Parameters:
        element - element of configuration
        target - target object
        Returns:
        true if component should be disabled
      • getPathToAttributeInModel

        protected java.lang.String getPathToAttributeInModel​(E dynamicElement,
                                                             java.lang.String qualifier)
        Adds prefix with value of modelProperty. If AbstractDynamicElement.getModelProperty() is not null then it is used as the prefix otherwise the prefix will be DynamicForms.getModelProperty()
        Parameters:
        dynamicElement - element which modelProperty is taken as a prefix: e.g. currentObject.
        qualifier - qualifier of an object to check in model e.g code.
        Returns:
        qualifier with prefix e.g. currentObject.code .
      • canChangeProperty

        protected boolean canChangeProperty​(java.lang.Object target,
                                            java.lang.String property)
        Check whether user has permission to change property on targetObject. If property equals ComponentsVisitor.MODEL_ROOT then it is checked whether user can change targetObject
      • canReadProperty

        protected boolean canReadProperty​(java.lang.Object target,
                                          java.lang.String property)
        Check whether user has permission to read property on targetObject. If property equals ComponentsVisitor.MODEL_ROOT then it is checked whether user can read targetObject
      • getDataType

        protected final DataType getDataType()
      • getTypeCode

        public java.lang.String getTypeCode()
      • getDynamicForms

        protected final DynamicForms getDynamicForms()
      • getComponentKeyComponentsMap

        protected final java.util.Map<java.lang.String,​java.util.Collection<C>> getComponentKeyComponentsMap()
      • getTypeFacade

        protected final TypeFacade getTypeFacade()
      • getDefaultScriptingConfig

        protected final ScriptingConfig getDefaultScriptingConfig()
      • setExpressionEvaluator

        public void setExpressionEvaluator​(ExpressionEvaluator expressionEvaluator)
      • setPermissionFacade

        public void setPermissionFacade​(PermissionFacade permissionFacade)
      • setTypeFacade

        public void setTypeFacade​(TypeFacade typeFacade)