Class PageByTransform

  • All Implemented Interfaces:
    AppTransform, LayoutTransform, Transform

    public class PageByTransform
    extends AbstractAppTransform
    implements LayoutTransform

    The Page-by Transform generates the HTML for both, the page-by axis of a report and the group-by section of a document.

    This class transforms a PageByBean. This bean is the one that encapsulates the differences at the WebApi level between reports and documents.

    This transform can be used in either design or view mode. Design mode renders the list of units and allows end users to add/remove/pivot/sort them using drag and drop, context menus or simply buttons. In view mode, the transform also renders a dropdown list with the page-by elements from which end-users can filter the displayed data.

    The default output of the PageByTransform is divided into two methods renderTitle(com.microstrategy.web.beans.MarkupOutput) and renderBody(com.microstrategy.web.beans.MarkupOutput). The first includes the title of the dialog, a summary section with the current selections and close and help buttons. The body just renders the list of page-by units with their corresponding elements (if in view mode).

    This Transform implements LayoutTransform, therefore the output generated can be controlled and modified using an external configuration xml file.

    Since:
    MicroStrategy Web 8.0.0
    • Field Detail

      • _removeOptionString

        protected java.lang.String _removeOptionString
      • isDragAndDropEnabled

        protected FormalParameter isDragAndDropEnabled
        This is the flag used in the transform to specify whether to enable drag and drop functionality.
        Noticed, though, that even if this parameter is true, this functionality might be disabled if the user doesn't have enough privileges or if it's not DHTML mode.
        Allowed Values: TRUE/FALSE.
      • isContextMenuEnabled

        protected FormalParameter isContextMenuEnabled
        Deprecated.
        To customize context-menus use the xml-definition specified by AbstractAppTransform.contextMenus
        This is the flag used in the transform to specify whether to enable context menu functionality.
        Noticed, though, that even if this parameter is true, this functionality might be disabled if the user doesn't have enough privileges or if it's not DHTML mode.
        Allowed Values: TRUE/FALSE.
      • isAutoSubmitEnabled

        protected FormalParameter isAutoSubmitEnabled
        This is the flag used in the transform to specify whether to enable auto-submit functionality.
        With this functionality, the page-by element selection is automatically submitted using javascript as soon as the element is selected by the end user.
        Noticed, though, that even if this parameter is true, this functionality might be disabled if the user doesn't have enough privileges, if it's not DHTML mode, or based on the WebFeatureAutoPageBy Feature.
        Allowed Values: TRUE/FALSE.
      • isSummaryWhenClosedEnabled

        protected FormalParameter isSummaryWhenClosedEnabled
        This flag indicates the Transform to render the summary section, even if the even is closed.
        When this happens, the Transform isOpen returns true even if the underlying PageByBean is closed, and invokes the renderSummary method.
        Allowed Values: TRUE/FALSE.
      • isEditable

        protected FormalParameter isEditable
        This flag indicates the page by attributes can be arranged or removed from the panel.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 8.0.2
      • showDrillPathSetNamesSubMenuAtTopLevel

        protected FormalParameter showDrillPathSetNamesSubMenuAtTopLevel
        It is used in the transform to specify whether to show the set names submenu for drilling at the top level (or at a lower depth).
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • advancedDrillingContextMenuDisplay

        protected FormalParameter advancedDrillingContextMenuDisplay
        It is used in the transform to specify whether to show the advanced drilling options in the editor or context menu.
        Allowed Values: PreferencesDrillTransform.ADVANCED_DRILLING_RMC_DISPLAY_DEFAULT = "1"
        ADVANCED_DRILLING_RMC_DISPLAY_SUBMENU = "2"
        Since:
        MicroStrategy Web 9.0.0
      • sortSetNamesAndDrillPaths

        protected FormalParameter sortSetNamesAndDrillPaths
        It is used in the transform to specify whether to show the set names and drill paths names alphabetically sorted.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • groupContextMenuDrillPathsByType

        protected FormalParameter groupContextMenuDrillPathsByType
        It is used in the transform to specify whether to show the set names and drill paths names alphabetically sorted.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • showDrillRMC

        protected FormalParameter showDrillRMC
        It is used in the transform to specify whether to show Right Mouse Click menu for drill.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • showDrillAdvanced

        protected FormalParameter showDrillAdvanced
        It is used in the transform to specify whether to allow advanced drilling.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • showDrillDownOnly

        protected FormalParameter showDrillDownOnly
        It is used in the transform to specify whether to allow drilling to the child only.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • showDrillMetric

        protected FormalParameter showDrillMetric
        It is used in the transform to specify whether to allow drilling on metrics.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • showDrillRMCMetric

        protected FormalParameter showDrillRMCMetric
        It is used in the transform to specify whether to show Right Mouse Click menu for drill for metrics.
        Allowed Values: TRUE/FALSE.
        Since:
        MicroStrategy Web 9.0.0
      • helpType

        public FormalParameter helpType
        Indicates the type of help topic this editor uses.
        Since:
        MicroStrategy Web 9.0.0
      • helpTopic

        public FormalParameter helpTopic
        Indicates the help topic for the help page of the editor.
        Since:
        MicroStrategy Web 9.0.0
    • Constructor Detail

      • PageByTransform

        public PageByTransform()
    • Method Detail

      • initializeTransform

        public void initializeTransform​(Transformable data)
        Description copied from class: AbstractAppTransform

        This method initialize the private and protected fields of the transform, such as width and height. It also invokes the initializeWebComponent, initializeImages and initializeCss methods.

        This method is automatically called from the transform method. Transforms which would like to invoke other methods in this instance directly (for example, to invoke some render methods), need first to call this method to guarantee that the Transform is ready to generate output.
        Specified by:
        initializeTransform in interface AppTransform
        Overrides:
        initializeTransform in class AbstractAppTransform
        Parameters:
        data - the bean to transform.
      • isOpen

        protected boolean isOpen()
        Extends isOpen by returning true even if the PageByBean is closed whenever all the following conditions are met:
        • isSummaryWhenClosedEnabled FormalParameter is true.
        • it's is view mode
        • The list is not empty
        This allows the Transform to mimic Microstrategy Web 7.5 which would always displayed the page-by section in view mode if the page-by axis was not empty.
        Overrides:
        isOpen in class AbstractAppTransform
        Returns:
        true if the dialog should be open.
      • isListEmpty

        public boolean isListEmpty()
        Returns true is the page-by units list is empty.
        Returns:
        true if the page-by units list is empty.
      • renderTitle

        public void renderTitle​(MarkupOutput out)
        Renders the dialog's title. This includes:
        1. The editor's title.
        2. The help button.
        3. The close button.
        4. A summary with the current selections.

        Example code for this method:
         Tag div = getTagsFactory().newDivTag();
         Tag spanTitle = div.addChild("span");
         Tag spanButtons = div.addChild("span");
         Tag spanSummary = div.addChild("span");
        
         div.setCssClass("titleBar");
         div.setAttributes(getAttributesTitle());
        
         spanTitle.setCssClass("title");
         spanButtons.setCssClass("buttons");
         spanSummary.setCssClass("summary");
        
         renderEditorTitle(spanTitle.getContent());
         renderHelpButton(spanButtons.getContent());
         renderCloseButton(spanButtons.getContent());
         renderSummary(spanSummary.getContent());
        
         div.render(out);
         
        Parameters:
        out - where the output gets rendered.
      • isDesignMode

        public boolean isDesignMode()
        Indicates to the transform that it should render its content for design mode (in this case, some functionality might be disabled or different).
        Returns:
        true if the bean is in design mode.
      • getAttributesTitle

        public java.util.Map getAttributesTitle()
        Returns a map (name/value pairs) with attributes and their corresponding values used with the <div> tag enclosing the title. These attributes are used for javascript and formatting.
        Returns:
        Map with the attributes for the title div.
      • getAttributesBody

        public java.util.Map getAttributesBody()
        Returns a map (name/value pairs) with attributes and their corresponding values used with the <div> tag enclosing the body. These attributes are used for javascript and formatting.
        Returns:
        Map with the attributes for the title div.
      • getEditorTitle

        public java.lang.String getEditorTitle()
        Returns the title for the editor. For documents it returns "Grouping", for reports it retursn "Page-by"
        Returns:
        String with the title for the dialog.
      • renderSummary

        public void renderSummary​(MarkupOutput out)
        Renders the summary of the current selections.
        If there are no units it just appends "none". If there are units but it's design mode, since no selections are available it returns an empty list.
        Parameters:
        out - where the output gets rendered.
      • renderEditorTitle

        public void renderEditorTitle​(MarkupOutput out)
        Renders the title for the editor, just converts the editor title to upper case and appends ":"
        Parameters:
        out - where the output gets rendered.
      • renderCloseButton

        public void renderCloseButton​(MarkupOutput out)
        If the dialog can be closed (that is, the canClose method returns true) it will render the close button.
        Parameters:
        out - where the output gets rendered.
      • renderHelpButton

        public void renderHelpButton​(MarkupOutput out)
        Renders a button with the link to the help section with the corresponding help topic.
        Parameters:
        out - where the output gets rendered.
      • getEditor

        protected Editor getEditor()
        Returns an initialized Editor instance, this instance is used by the Transform as a helper object to render the help and close buttons.
      • renderEmptyList

        public void renderEmptyList​(MarkupOutput out)
        This method is used to render the body when the list of units is empty. It just adds the message "none" to the output.
        Parameters:
        out - where the output gets rendered.
      • renderList

        public void renderList​(MarkupOutput out)
        Renders all pageby units (by calling for each one renderUnit).
        Parameters:
        out - where the output gets rendered.
      • renderUnit

        public void renderUnit​(MarkupOutput out,
                               PageByUnit unit)
        Renders a single unit. For each unit this method will:
        1. render its sort buttons
        2. render its alias
        3. render its element list
        4. render its pivot buttons

        Example code for this method:
         Tag span = getTagsFactory().newSpanTag();
        
         span.setCssClass("gby");
         span.setAttributes(getAttributesUnit(unit));
        
         renderSortButtons(span.getContent(), unit);
         renderAlias(span.getContent(), unit);
         renderElements(span.getContent(), unit);
         renderPivotButtons(span.getContent(), unit);
        
         span.render(out);
         
        Parameters:
        out - where the output gets rendered.
        unit - PageByUnit being rendered.
      • renderSortButtons

        public void renderSortButtons​(MarkupOutput out,
                                      PageByUnit unit)
        Renders sort buttons (if available) for the given unit.
        Parameters:
        out - where the output gets rendered.
        unit - PageByUnit being rendered.
      • renderAlias

        public void renderAlias​(MarkupOutput out,
                                PageByUnit unit)
        Renders the unit alias.
        Parameters:
        out - where the output gets rendered.
        unit - PageByUnit being rendered.
      • renderPivotButtons

        public void renderPivotButtons​(MarkupOutput out,
                                       PageByUnit unit)
        Renders pivot buttons (if available) for the given unit.
        Parameters:
        out - where the output gets rendered.
        unit - PageByUnit being rendered.
      • renderPivotImage

        protected void renderPivotImage​(MarkupOutput out,
                                        PageByUnit unit,
                                        java.lang.String cmdvl,
                                        java.lang.String css,
                                        java.lang.String alt)
        Renders the image to pivot a unit. In HTML mode it adds the link for the pivot event. This method is used to render any of the posible pivot actions on a unit.
      • renderPivotImage

        protected void renderPivotImage​(MarkupOutput out,
                                        PageByUnit unit,
                                        java.lang.String cmdvl,
                                        java.lang.String css,
                                        java.lang.String src,
                                        java.lang.String alt)
        Renders the image to pivot a unit. In HTML mode it adds the link for the pivot event. This method is used to render any of the posible pivot actions on a unit. Src will only be used in cases of accessibility support.
        Since:
        MicroStrategy Web 8.1.1
      • renderRemoveImage

        protected void renderRemoveImage​(MarkupOutput out,
                                         PageByUnit unit)
        Renders the image to remove a unit from the page-by section. In HTML mode it adds the link for the remove event.
      • renderDeleteImage

        protected void renderDeleteImage​(MarkupOutput out,
                                         PageByUnit unit)
        Renders the image to delete a unit. Deleting actually removes the unit from the working set and may trigger new SQL execution. By default this si only called if removing the unit from the page-by section is not available.
        Since:
        MicroStrategy Web 8.0.1
      • renderSortImage

        protected void renderSortImage​(MarkupOutput out,
                                       PageByUnit unit,
                                       java.lang.String css,
                                       java.lang.String title)
        Renders the image to sort a unit. In HTML mode it adds the link for the sort event.
      • renderSortImage

        protected void renderSortImage​(MarkupOutput out,
                                       PageByUnit unit,
                                       java.lang.String css,
                                       java.lang.String src,
                                       java.lang.String title)
        Renders the image to sort a unit. In HTML mode it adds the link for the sort event. Src will only be used in cases of accessibility support.
        Since:
        MicroStrategy Web 8.1.1
      • getRemoveTooltip

        protected java.lang.String getRemoveTooltip()
        Gets the tooltip for the remove image. This depends on privileges and the target type
        Returns:
        String By default: Remove. Could also return "Remove from Report" or "Remove from template"
      • renderSelectedElementLabel

        public void renderSelectedElementLabel​(MarkupOutput out,
                                               PageByUnit unit)

        Renders the selected element label for the given unit.

        Parameters:
        out - where the output gets rendered.
        unit - PageByUnit being rendered.
      • renderElementList

        public void renderElementList​(MarkupOutput out,
                                      PageByElementList list)

        Renders a single element list (that is, the dropdown that allows the end-user to select the current element).

        By default the list is rendered inside a drop-down box. However if the user doesn't have the DssXmlPrivilegesWebSwitchPageByElements privilege, it will not render a drop-down but just a label with the current selection.

        Parameters:
        out - where the output gets rendered.
        list - PageByElementList to render.
      • renderSelectedElement

        public void renderSelectedElement​(MarkupOutput out,
                                          PageByElementList list)

        Renders a single selected element label

        Parameters:
        out - where the output gets rendered.
        list - PageByElementList to render.
      • renderSubmitButton

        public void renderSubmitButton​(MarkupOutput out)
        Renders the submit button for the element list. Notice however nothing will be rendered if the list is empty, or if the autosubmit is enabled.
        Parameters:
        out - where the output gets rendered.
      • getSortEvent

        protected WebEvent getSortEvent​(PageByUnit unit)
        Returns the event used by the Trasnform to sort a pageby unit.
        Parameters:
        unit - PageByUnit to sort
        Returns:
        WebEvent that will sort the unit
      • getPivotEvent

        protected WebEvent getPivotEvent​(PageByUnit unit,
                                         java.lang.String action)
        Returns the event used by the Trasnform to pivot a pageby unit. The action argument decides the type of pivot (left, right, to columns, etc).
        Parameters:
        unit - PageByUnit to pivot
        Returns:
        WebEvent that will pivot the unit
      • getRemoveEvent

        protected WebEvent getRemoveEvent​(PageByUnit unit)
        Returns the event used by the Trasnform to remove a pageby unit. Notice that this event only removes the unit from the page-by section, but the unit is still available for manipulations in the working set definition.
        Parameters:
        unit - PageByUnit to pivot
        Returns:
        WebEvent that will remove the unit from the page-by
      • getDeletetEvent

        protected WebEvent getDeletetEvent​(PageByUnit unit)

        Returns the event used by the Trasnform to delete a pageby unit from the working-set definition. When you simply remove an object from the page-by, the object can still be used in other parts of the report/document definition. When you deleted from the working-set, though, the report definition changes, the unit is not available anymore and the report/document gets re-executed with the new definition.

        Parameters:
        unit - PageByUnit to pivot
        Returns:
        WebEvent that will remove the unit from the page-by
        Since:
        MicroStrategy Web 8.0.1
      • showRemoveFromReport

        protected boolean showRemoveFromReport()
        Deprecated.
        This method is not used by Transform anymore and will be removed from future versions of the product.
        Indicates whether this unit can be removed from the report.

        Any time you remove the last template unit from a REPORT (not just grid), you'll get the 'template unit is empty' error when executing it. If you're already in view mode (e.g. the report has been executed), when removing this unit the user will get the error, therefore we want to prevent it, therefore we will not allow users to remove if its the las unit in the template.
      • getMainEvent

        protected WebEvent getMainEvent()
        This will return the event that the main form should use. In DHTML it returns the changeSelectedElement event. In HTML mode is returns the generic event.
        Returns:
        WebEvent
      • getChangeSelectedElementEvent

        protected WebEvent getChangeSelectedElementEvent()
        Returns the event used by the Transform to change the currently selected element.
        Returns:
        By default EnumPageByBeanEvents.WebEventPageBySelectElement.
      • getGenericEvent

        protected WebEvent getGenericEvent()
        In HTML mode, all actions (sort, pivot, change element) need to be summited in the same <FORM> tag, therefore the event submitted needs to support all of these and execution the correct action based on an argument. This is the event used by the Transform for this case.
        Returns:
        By default EnumPageByBeanEvents.WebEventPageByGeneric.
      • getCloseEvent

        protected WebEvent getCloseEvent()
        Returns the event used to close the Transform.
        Returns:
        By default, EnumPageByBeanEvents.WebEventShowBean.
      • getHelpEvent

        protected WebEvent getHelpEvent()
        Deprecated.
        Returns the event used to open the online help in the corresponding section.
        Returns:
        By default EnumServletEvents.WebEventOpenHelp.
      • getAttributesUnit

        public java.util.Map getAttributesUnit​(PageByUnit unit)
        Returns a map (name/value pairs) with attributes and their corresponding values used with the <div> tag enclosing a single page-by unit. These attributes are used for javascript and formatting and include information for drand and drop and context menus.
        Returns:
        Map with the attributes for a single page-by unit.
      • getDragAndDropAttributes

        protected java.util.Map getDragAndDropAttributes​(PageByUnit unit)
        Returns a map (name/value pairs) with attributes and their corresponding values necessary for drand and drop used with the <div> tag enclosing a single page-by unit.
        Returns:
        Map with the attributes for drag and drop of a page-by unit.
      • getContextMenuAttributes

        protected java.util.Map getContextMenuAttributes​(PageByUnit unit)
        Returns a map (name/value pairs) with attributes and their corresponding values necessary for context-menus used with the <div> tag enclosing a single page-by unit.
        This method also builds these menus.
        Returns:
        Map with the attributes for context menus of a page-by unit.
      • isDragAndDropEnabled

        protected boolean isDragAndDropEnabled()
        Method that indicates if drag and drop is enabled for this transform.
        Returns:
        true if available.
      • isContextMenuEnabled

        protected boolean isContextMenuEnabled()
        Deprecated.
        Method that indicates if context-menus are enabled for this transform.
        Returns:
        true if available.
      • isAutoSubmitEnabled

        protected boolean isAutoSubmitEnabled()
        Method that indicates if auto-submit is enabled for this transform.
        Returns:
        true if available.
      • canClose

        protected boolean canClose()
        Indicates the Transform whether it can be closed. Mainly used to decide whether to show the close button or not. There is the case where this needs to be open, even if the bean is closed (e.g. when we're showing the summary but not the dropdowns), in this case the bean is already closed so we don't want to show the button. The other case is in design mode for reports, here by design the dialog cannot be closed.
        Returns:
        boolean true if the dialog can be closed.
      • getScriptClass

        protected java.lang.String getScriptClass()
        This method overwrites the default implementation by determining which script class to use based on properties of the target report, not by what was defined as value of the formal parameter
        Overrides:
        getScriptClass in class AbstractAppTransform
        Returns:
        String with the script class property to use for the JavaScript representation of this element.
      • renderJavascript

        protected void renderJavascript​(MarkupOutput out)
        Method that will render all output necessary for client-side manipulations using javascript
        Parameters:
        out - where the output is generated.
      • renderFakedUnits

        public void renderFakedUnits​(MarkupOutput out,
                                     PageByUnitReportFaked unit)
        This method generates the fake page-by units for the attributes that are not on the template.
      • showFakedUnits

        protected boolean showFakedUnits()
      • hasFakedUnits

        public boolean hasFakedUnits()
      • getPageByBean

        public PageByBean getPageByBean()
        Returns the PageByBean being transformed.
        Returns:
        PageByBean being Transformed.
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: Transform
        Returns a textual description of the transform.
        Specified by:
        getDescription in interface Transform
        Returns:
        The textual description of the transform.
      • isTargetReport

        protected boolean isTargetReport()
        Indicates if the target bean should be treated as a ReportBean.
        Returns:
        true if the targetbean of the PageByBean is a ReportBean.
      • isTargetRW

        protected boolean isTargetRW()
        Indicates if the target bean should be treated as a RWBean (document).
        Returns:
        true if the targetbean of the PageByBean is a RWBean.
      • newContext

        protected TransformContext newContext()
        Description copied from class: AbstractAppTransform
        Creates a new instance of a TransformContext. It's used by the getContext method the first time is invoked. Transforms who require to include extra information in the context should create their own TransformContext implementation (possibly a subclass of AppTransformContext) and returns a new instance in this method.
        Overrides:
        newContext in class AbstractAppTransform
        Since:
        MicroStrategy Web 8.0.1