Class PartialPageUpdate

    • Constructor Detail

      • PartialPageUpdate

        public PartialPageUpdate​(Page page)
        Constructor.
        Parameters:
        page - the page which components are being updated.
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns:
        returns true if and only if nothing has being added to partial update.
      • writeTo

        public void writeTo​(Response response,
                            String encoding)
        Serializes this object to the response.
        Parameters:
        response - the response to write to
        encoding - the encoding for the response
      • onBeforeRespond

        protected void onBeforeRespond​(Response response)
        Hook-method called before components are written.
        Parameters:
        response -
      • onAfterRespond

        protected void onAfterRespond​(Response response)
        Hook-method called after components are written.
        Parameters:
        response -
      • writeFooter

        protected abstract void writeFooter​(Response response,
                                            String encoding)
        Parameters:
        response - the response to write to
        encoding - the encoding for the response
      • prepareComponent

        protected boolean prepareComponent​(Component component)
        Prepare a single component
        Parameters:
        component - the component to prepare
        Returns:
        whether the component was prepared
      • writeComponent

        protected void writeComponent​(Response response,
                                      String markupId,
                                      Component component,
                                      String encoding)
        Writes a single component
        Parameters:
        response - the response to write to
        markupId - the markup id to use for the component replacement
        component - the component which markup will be used as replacement
        encoding - the encoding for the response
      • writeHeader

        protected abstract void writeHeader​(Response response,
                                            String encoding)
        Writes the head part of the response. For example XML preamble
        Parameters:
        response - the response to write to
        encoding - the encoding for the response
      • writeComponent

        protected void writeComponent​(Response response,
                                      String markupId,
                                      CharSequence contents)
        Writes a component to the response.

        TODO make abstract in Wicket 10

        Parameters:
        response - the response to write to
        contents - the contents
      • writeHeaderContribution

        protected abstract void writeHeaderContribution​(Response response,
                                                        CharSequence contents)
        Writes a header contribution to the response.
        Parameters:
        response - the response to write to
        contents - the contents
      • appendJavaScript

        public final void appendJavaScript​(CharSequence javascript)
        Adds script to the ones which are executed after the component replacement.
        Parameters:
        javascript - the javascript to execute
      • prependJavaScript

        public final void prependJavaScript​(CharSequence javascript)
        Adds script to the ones which are executed before the component replacement.
        Parameters:
        javascript - the javascript to execute
      • add

        public final void add​(Component component,
                              String markupId)
        Adds a component to be updated at the client side with its current markup
        Parameters:
        component - the component to update
        markupId - the markup id to use to find the component in the page's markup
        Throws:
        IllegalArgumentException - thrown when a Page or an AbstractRepeater is added
        IllegalStateException - thrown when components no more can be added for replacement.
      • getComponents

        public final Collection<? extends ComponentgetComponents()
        Returns:
        a read-only collection of all components which have been added for replacement so far.
      • detach

        public void detach​(IRequestCycle requestCycle)
        Detaches the page if at least one of its components was updated.
        Parameters:
        requestCycle - the current request cycle
      • containsAncestorFor

        protected boolean containsAncestorFor​(Component component)
        Checks if the target contains an ancestor for the given component
        Parameters:
        component - the component which ancestors should be checked.
        Returns:
        true if target contains an ancestor for the given component
      • containsPage

        public boolean containsPage()
        Returns:
        true if the page has been added for replacement
      • getHeaderResponse

        public IHeaderResponse getHeaderResponse()
        Gets or creates an IHeaderResponse instance to use for the header contributions.
        Returns:
        IHeaderResponse instance to use for the header contributions.
      • writeHeaderContribution

        protected void writeHeaderContribution​(Response response,
                                               Component component)
        Parameters:
        response - the response to write to
        component - to component which will contribute to the header
      • setContentType

        public abstract void setContentType​(WebResponse response,
                                            String encoding)
        Sets the Content-Type header to indicate the type of the response.
        Parameters:
        response - the current we response
        encoding - the encoding to use