Interface GadgetSource


  • @Role
    public interface GadgetSource
    Reads the gadgets for the dashboard macro which is being executed.
    Since:
    3.0M3
    Version:
    $Id: 5c8c5675ef2eb74a256465745bfbb4f81a45c8ef $
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List<org.xwiki.rendering.block.Block> getDashboardSourceMetadata​(String source, org.xwiki.rendering.transformation.MacroTransformationContext context)
      Get the metadata about this dashboard source, such as source document fullname, gadget add url, gadget remove url, etc, to pass to the client.
      List<Gadget> getGadgets​(String source, org.xwiki.rendering.transformation.MacroTransformationContext context)
      Reads the gadgets for the passed macro transformation context.
      boolean isEditing()  
    • Method Detail

      • getGadgets

        List<Gadget> getGadgets​(String source,
                                org.xwiki.rendering.transformation.MacroTransformationContext context)
                         throws Exception
        Reads the gadgets for the passed macro transformation context.
        Parameters:
        source - the source to read dashboard gadgets from (a document serialized reference)
        context - the dashboard macro transformation context
        Returns:
        the list of gadgets for the currently executing macro
        Throws:
        Exception - in case anything goes wrong reading data, the exception should be translated by the dashboard macro caller into a macro execution exception
      • getDashboardSourceMetadata

        List<org.xwiki.rendering.block.Block> getDashboardSourceMetadata​(String source,
                                                                         org.xwiki.rendering.transformation.MacroTransformationContext context)
        Get the metadata about this dashboard source, such as source document fullname, gadget add url, gadget remove url, etc, to pass to the client.
        TODO: find a better place for this code, ftm it's here because this is the only class that knows about XWiki data model
        Parameters:
        source - the source to read dashboard gadgets from (a document serialized reference)
        context - the dashboard macro transformation context
        Returns:
        a list of blocks that represent the XDOM with the metadata. TODO: might as well be a map of metadata and leave the rendering in XDOM to the dashboard macro, but ftm this does the job
      • isEditing

        boolean isEditing()
        Returns:
        true if the the current context is in edit mode (gadgets can be edited -- positions, parameters, adding gadgets etc), false otherwise
        TODO: find a better place to put this function, but for now this is the only interface towards XWiki data model, and since the mode is set on the current context, this function needs to be here