Interface WebGridWidths


  • public interface WebGridWidths
    This interface is for grid column width manipulations. User can choose different scenario for row and column axes. A scenario controls how the column width would be configured for the specific axis.

    For column axis, the valid scenarios are in EnumDSSXMLWidthScenario.

    • For DssXmlWidthFitToDisplay and DssXmlWidthFitToContent, user will not be able to specify the width of any column.
    • Only for DssXmlWidthFixed scenario, user has the option to specify width for columns. User may specify a width for a particular column. If user does not specify a width for a particular column, a default width will be applied. To specify the column, user may indicate the template unit and the subtitleIndex(depth) of the column. For example, in the report, there is an attribute of "employee", and there are two columns corresponding to it: "Last Name" and "First Name". So for the column of "Last Name", the subtitleIndex is 1, for the column of "First Name", the subtitle index is 2. If user wants to set a specific width of the column of "First Name", user could specify this column by providing the "employee" and subtitleIndex of 1.

    For row axis, the valid scenarios are DssXmlWidthFitToContent and DssXmlWidthFixed in EnumDSSXMLWidthScenario.

    • For DssXmlWidthFitToContent scenario, user will not be able to specify the row height
    • For DssXmlWidthFixed scenario, user will be able to specify the default row height for any row. Currently, we do not have a way to specify a height for a particular row.

    After making neccessary manipulations about grid widths, user needs to apply these manipulations (WebReportManipulation.applyChanges()), and get result of new report instance to see the effect.

    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • PROPERTY_SET_CW_NAME

        static final java.lang.String PROPERTY_SET_CW_NAME
        See Also:
        Constant Field Values
      • PROPERTY_SET_TEMPLATE_FORMATTING

        static final java.lang.String PROPERTY_SET_TEMPLATE_FORMATTING
        See Also:
        Constant Field Values
    • Method Detail

      • getDefaultHeaderWidth

        int getDefaultHeaderWidth()
                           throws WebObjectsException
        Returns default column header width.
        Returns:
        the default column header width. This value only makes sense for column scenario of DssXmlWidthFixed.
        Throws:
        WebObjectsException - thrown when error happens during retrieving the column width information.
      • getDefaultGridWidth

        int getDefaultGridWidth()
                         throws WebObjectsException
        Returns default column grid width.
        Returns:
        the default column grid width. This value only makes sense for column scenario of DssXmlWidthFixed.
        Throws:
        WebObjectsException - thrown when error happens during retrieving the column width information.
      • setColumnScenario

        void setColumnScenario​(int scenario)
                        throws java.lang.IllegalArgumentException
        Sets the column scenario. When the input scenario is DssXmlWidthFixed, the default header width and grid width will be set to 0. When the input scenario is any value other than DssWidthFixed, then all fixed width information set for column are cleared.
        Parameters:
        scenario - A value in EnumDSSXMLWidthScenario.
        Throws:
        java.lang.IllegalArgumentException - Thrown when the input scenario is not a valid value in the enumeration EnumDSSXMLWidthScenario.
      • setColumnScenario

        void setColumnScenario​(int scenario,
                               int defaultHeaderWidth,
                               int defaultGridWidth)
                        throws java.lang.IllegalArgumentException
        Sets the column scenario. When the input scenario is DssXmlWidthFixed, the default header width and grid width will be set. When the input scenario is any value other than DssWidthFixed, then all fixed width information set for column are cleared.
        Parameters:
        scenario - A value in EnumDSSXMLWidthScenario.
        defaultHeaderWidth - The default header width to be set
        defaultGridWidth - The default grid width to be set
        Throws:
        java.lang.IllegalArgumentException - Thrown when the input scenario is not a valid value in the enumeration EnumDSSXMLWidthScenario, or the two width inputs are less than -1.
      • getExtraWidth

        int getExtraWidth()
                   throws WebObjectsException
        Returns the width of the extra column, which separates the row headers and grid values.
        Returns:
        the width of the extra column, which separates the row headers and grid values.
        Throws:
        WebObjectsException - thrown when error happens during retrieving the column width information.
      • setExtraWidth

        void setExtraWidth​(int extraWidth)
                    throws WebObjectsException
        Sets the width of the extra column, which separates the row headers and grid values.
        Parameters:
        extraWidth - The width to set to the extra column.
        Throws:
        WebObjectsException
      • getRowHeight

        int getRowHeight()
                  throws WebObjectsException
        Returns the row height.
        Returns:
        The height in pixel of row height.
        Throws:
        WebObjectsException - thrown when error happens during retrieving the column width information.
      • setRowScenario

        void setRowScenario​(int scenario)
                     throws java.lang.IllegalArgumentException
        Sets the row scenario. When the input scenario is DssXmlWidthFixed, the row height will be set to 0. When the input scenario is any value other than DssWidthFixed, then height information set for row are cleared.
        Parameters:
        scenario - DssXmlWidthFitToContent or DssXmlWidthFixed in EnumDSSXMLWidthScenario.
        Throws:
        java.lang.IllegalArgumentException - Thrown when the input scenario DssXmlWidthFitToContent or DssXmlWidthFixed in the enumeration EnumDSSXMLWidthScenario.
      • setRowScenario

        void setRowScenario​(int scenario,
                            int rowHeight)
                     throws java.lang.IllegalArgumentException
        Sets the row scenario. When the input scenario is DssXmlWidthFixed, the row height will be set. When the input scenario is any value other than DssWidthFixed, then height information set for row are cleared.
        Parameters:
        scenario - DssXmlWidthFitToContent or DssXmlWidthFixed in EnumDSSXMLWidthScenario.
        rowHeight - The value for row height
        Throws:
        java.lang.IllegalArgumentException - Thrown when the input scenario is not a valid value in the enumeration EnumDSSXMLWidthScenario, or row height is less than -1.
      • setWidth

        void setWidth​(int width,
                      WebObjectInfo target)
        Sets the width of a column on the template. The column specified by the template unit object. If this template unit corresponds to multiple columns, this setting will be applied to all columns.
        Parameters:
        width - The width to be set to the column.
        target - The target on the template unit, whose column(s) will be set.
      • setWidth

        void setWidth​(int width,
                      WebObjectInfo target,
                      int subtitleDepth)
        Sets the width of a column on the template. The column specified by the template unit object, and its subtitle depth.
        Parameters:
        width - the width to set for this column
        target - the object on this template unit.
        subtitleDepth - position on a 1-based index. For example, for attribute "employee", there are two forms, "first name" and "last name". So, there are two columns corresponding to "employee" unit. Then if you want to change the width of "first name", you should pass "1" as the subtitleDepth. When subtitleDepth gets set to 0, it means to apply this setting to all columns corresponding to this template unit.
      • setMetricsHeaderWidth

        void setMetricsHeaderWidth​(int width)
        Sets the width of the "metrics" header.
        Parameters:
        width - The width in pixel to set for the "metrics" header.
      • setColumnScenario

        void setColumnScenario​(int scenario,
                               int defaultWidth)
                        throws java.lang.IllegalArgumentException
        Set Column Scenario. Invokes setColumnScenario(int, int, int) with the same width for the header and grid defaults.
        Parameters:
        scenario - A value in EnumDSSXMLWidthScenario.
        defaultWidth - The default value to set for both header width and grid width
        Throws:
        java.lang.IllegalArgumentException - Thrown when the input scenario is not a valid value in the enumeration EnumDSSXMLWidthScenario, or the width input is less than -1.
      • getColumns

        @Deprecated
        WebColumns getColumns​(boolean compact,
                              boolean suppressOutlineMode)
                       throws WebObjectsException
        Deprecated.
        The function should not be used under normal circumstances
        Returns the collection of WebColumn objects. The "compact" option, if true it returns a unique set of data headers, otherwise the data headers are repeated according to the grid layout. Requires column scenario of EnumDSSXMLWidthScenario.DssXmlWidthFixed), and that the result flags include EnumDSSXMLResultFlags.DssXmlResultGrid.
        Parameters:
        compact - if true, repeated data headers are suppressed
        suppressOutlineMode - if true, suppress the columns to be merged for outline mode
        Returns:
        WebColumns a collection of WebColumn objects
        Throws:
        WebObjectsException - if any error occurs while retrieving or constructing the columns.
      • getWidth

        int getWidth​(java.lang.String columnKey)
              throws java.lang.IllegalArgumentException,
                     WebObjectsException
        Returns the width of the WebColumn matching the given column key.
        Parameters:
        columnKey - key of the WebColumn
        Returns:
        int the width of the column in pixels.
        Throws:
        java.lang.IllegalArgumentException - if key is malformed or empty.
        WebObjectsException
      • setWidth

        void setWidth​(int width,
                      java.lang.String columnKey)
               throws java.lang.IllegalArgumentException,
                      WebObjectsException
        Sets the width of a column on the template. The column specified by the column key.
        Parameters:
        width - width of the column in pixels.
        columnKey - column identifier.
        Throws:
        java.lang.IllegalArgumentException - if key is invalid.
        WebObjectsException - if column width could not be set.