Class WRepeater.SubUIContext

  • All Implemented Interfaces:
    UIContext, Serializable
    Enclosing class:
    WRepeater

    public static class WRepeater.SubUIContext
    extends UIContextDelegate
    The SubUIContext stores the state information for the repeated component hierarchy for a single row in the repeater.
    Author:
    Martin Shevchenko
    See Also:
    Serialized Form
    • Constructor Detail

      • SubUIContext

        public SubUIContext​(WRepeater repeater,
                            int contextId)
        Creates a SubUIContext.
        Parameters:
        repeater - the repeater which this SubUIContext belongs to.
        contextId - the context unique id
      • SubUIContext

        public SubUIContext​(WRepeater repeater,
                            int contextId,
                            String rowRenderId)
        Creates a SubUIContext.
        Parameters:
        repeater - the repeater which this SubUIContext belongs to.
        contextId - the context unique id
        rowRenderId - the rows unique render id
    • Method Detail

      • invokeLater

        public void invokeLater​(Runnable runnable)
        Adds a runnable to the list of runnables to be invoked later. The runnable will be invoked against this UIContext.
        Specified by:
        invokeLater in interface UIContext
        Overrides:
        invokeLater in class UIContextDelegate
        Parameters:
        runnable - the runnable to add
      • getRowId

        public Object getRowId()
        Retrieves the row id for this SubUIContext.
        Returns:
        the row id
      • getParentContext

        protected UIContext getParentContext()
        Returns:
        the parent UIContext.
      • setRowIndex

        protected void setRowIndex​(int rowIndex)
        Sets the row index, in the case that the repeater has rows added/removed/moved.
        Parameters:
        rowIndex - the new row index for this sub context.
      • setRowId

        protected void setRowId​(Object rowId)
        Sets the row bean, in the case that the repeater has rows added/removed/moved.
        Parameters:
        rowId - the row id for this sub context.
      • getRowIndex

        public int getRowIndex()
        Retrieves the row index for this SubUIContext.
        Returns:
        the row index, or -1 if uninitialised.
      • getRowRenderId

        public String getRowRenderId()
        Returns:
        the row render id to keep each row unique so that handle request processing is handled correctly.
      • getContextId

        public int getContextId()
        Returns:
        the context unique id
      • getModel

        public WebModel getModel​(WebComponent component)
        Retrieves the component model for the given component. If the component is not being repeated by the WRepeater, the parent context will be queried for the model.
        Specified by:
        getModel in interface UIContext
        Overrides:
        getModel in class UIContextDelegate
        Parameters:
        component - the component to retrieve the model for.
        Returns:
        the component model for the given component.
      • setModel

        public void setModel​(WebComponent component,
                             WebModel model)
        Sets the component model for the given component. If the component is not being repeated by the WRepeater, the parent context will be given the model.
        Specified by:
        setModel in interface UIContext
        Overrides:
        setModel in class UIContextDelegate
        Parameters:
        component - the component to set the model for.
        model - the component model for the given component.
      • isInContext

        protected boolean isInContext​(WebComponent component)
        Indicates whether the given component is inside this context's repeatRoot.
        Parameters:
        component - the component to check
        Returns:
        true if the given component belongs in this context, false otherwise.
      • removeModel

        public void removeModel​(WebComponent component)
        Removes the component model for the given component. If the component is not being repeated by the WRepeater, the parent context will be asked to remove the model.
        Specified by:
        removeModel in interface UIContext
        Overrides:
        removeModel in class UIContextDelegate
        Parameters:
        component - the component to remove the model for.
      • setEnvironment

        public void setEnvironment​(Environment environment)
        Throws an UnsupportedOperationException, as the environment can not be set on a SubUIContext.
        Specified by:
        setEnvironment in interface UIContext
        Overrides:
        setEnvironment in class UIContextDelegate
        Parameters:
        environment - the environment to set.
      • getScratchMap

        public Map getScratchMap​(WComponent component)
        Retrieves the scratch map with phase scope for the given component. The scratch map is stored under one further level of indirection; by this sub-ui context. This allows each row to have its own scratch map.
        Specified by:
        getScratchMap in interface UIContext
        Overrides:
        getScratchMap in class UIContextDelegate
        Parameters:
        component - the component to retrieve the scratch map for.
        Returns:
        the scratch map for the given component.
      • getRequestScratchMap

        public Map getRequestScratchMap​(WComponent component)
        Retrieves the scratch map with request scope for the given component. The scratch map is stored under one further level of indirection; by this sub-ui context. This allows each row to have its own scratch map.
        Specified by:
        getRequestScratchMap in interface UIContext
        Overrides:
        getRequestScratchMap in class UIContextDelegate
        Parameters:
        component - the component to retrieve the scratch map for.
        Returns:
        the scratch map for the given component.
      • setFocussed

        public void setFocussed​(WComponent component)
        Sets the component in this UIC which is to be the focus of the client browser cursor. The id of the component is used to find the focussed element in the rendered html.
        Specified by:
        setFocussed in interface UIContext
        Overrides:
        setFocussed in class UIContextDelegate
        Parameters:
        component - the component that sould be the cursor focus in the rendered UI.