Class YuiContext

  • All Implemented Interfaces:
    Serializable, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.util.io.IClusterable, IYuiContext

    public class YuiContext
    extends Object
    implements IYuiContext
    The YuiContext uses the shared YuiHeaderCache service for loading/caching YUI-modules and header contributions.

    Note: the addModule(String module) method will load the provided module within the YahooNamespace scope.

    See Also:
    IYuiContext, Serialized Form
    • Method Detail

      • addModule

        public void addModule​(String module)
        Description copied from interface: IYuiContext
        Load YUI module from the YahooNamespace context
        Specified by:
        addModule in interface IYuiContext
        Parameters:
        module - YUI module name
      • addModule

        public void addModule​(org.onehippo.yui.YuiNamespace ns,
                              String module)
        Description copied from interface: IYuiContext
        Load YUI module from the specified YuiNamespace context
        Specified by:
        addModule in interface IYuiContext
        Parameters:
        ns - YuiNamespace to use as context for module
        module - YUI module name
      • addTemplate

        public void addTemplate​(FinalTextTemplate template)
        Description copied from interface: IYuiContext
        Add a static template to the response.
        Specified by:
        addTemplate in interface IYuiContext
        Parameters:
        template - TextTemplate that will be added to the response.
      • addTemplate

        public void addTemplate​(Class<?> clazz,
                                String filename,
                                Map<String,​Object> parameters)
        Description copied from interface: IYuiContext
        Add a static TextTemplate to the response. The model provided by the parameters Map is final.
        Specified by:
        addTemplate in interface IYuiContext
        Parameters:
        clazz - Class that acts as context
        filename - Name of file relative to provided class
        parameters - Parameters that will be interpolated with the TextTemplate
      • addTemplate

        public void addTemplate​(org.apache.wicket.markup.html.IHeaderContributor template)
        Description copied from interface: IYuiContext
        Add a generic template to the header response. This method should replace the other add*Template methods.
        Specified by:
        addTemplate in interface IYuiContext
      • addCssReference

        public void addCssReference​(org.apache.wicket.request.resource.ResourceReference reference)
        Description copied from interface: IYuiContext
        Helper method for adding css reference
        Specified by:
        addCssReference in interface IYuiContext
        Parameters:
        reference - ResourceReference that should be added to the head
      • addJavascriptReference

        public void addJavascriptReference​(org.apache.wicket.request.resource.ResourceReference reference)
        Description copied from interface: IYuiContext
        Helper method for adding a javascript reference
        Specified by:
        addJavascriptReference in interface IYuiContext
        Parameters:
        reference - ResourceReference that should be added to the head
      • addOnDomLoad

        public void addOnDomLoad​(String string)
        Description copied from interface: IYuiContext
        Add static javascript String that will be executed on the browsers' dom-ready event
        Specified by:
        addOnDomLoad in interface IYuiContext
        Parameters:
        string - String of javascript code that will be executed on the client.
      • addOnDomLoad

        public void addOnDomLoad​(org.apache.wicket.model.IModel<String> model)
        Description copied from interface: IYuiContext
        Add dynamic javascript that will be executed on the browsers' dom-ready event.
        Specified by:
        addOnDomLoad in interface IYuiContext
        Parameters:
        model - IModel which returns javascript code that will be executed on the client.
      • addOnWinLoad

        public void addOnWinLoad​(String string)
        Description copied from interface: IYuiContext
        Add static javascript String that will be executed on the browsers' window-load event
        Specified by:
        addOnWinLoad in interface IYuiContext
        Parameters:
        string - String of javascript code that will be executed on the client.
      • addOnWinLoad

        public void addOnWinLoad​(org.apache.wicket.model.IModel<String> model)
        Description copied from interface: IYuiContext
        Add dynamic javascript that will be executed on the browsers' window-load event.
        Specified by:
        addOnWinLoad in interface IYuiContext
        Parameters:
        model - IModel which returns javascript code that will be executed on the client.
      • getHeaderItem

        public org.apache.wicket.markup.head.HeaderItem getHeaderItem()
        Description copied from interface: IYuiContext
        Return a header item for the modules and references
        Specified by:
        getHeaderItem in interface IYuiContext
      • renderHead

        public void renderHead​(org.apache.wicket.markup.head.IHeaderResponse response)
        Specified by:
        renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
      • renderOnloads

        public void renderOnloads​(Set<org.hippoecm.frontend.plugins.yui.header.YuiContext.Onload> _onloads,
                                  org.apache.wicket.markup.head.IHeaderResponse response)