public class

TabControlHelper

extends Object
java.lang.Object
   ↳ com.microstrategy.web.app.utils.TabControlHelper

Class Overview

This helper class takes care of displaying a tab control according to the information used for initializing it. The tab control is constructed as a form, therefore the information that needs to be included for its proper tab switching needs to be in the form of hidden inputs.
Each tab has a unique identifier, specified during the calls to the addTab() method. Use this same identifier to set the current selected tab by using the setSelectedTab() method.
Once the settings for the tab have been specified, the contents of the current selected tab have to be specified to the control by using the setContents() method.

The different parameters that can be set when defining a new tab control include:

  • Form Target - Indicates what the target of the form containing the tab control
  • Border Padding - For specifying the width of the border to be left between the edge of the tab page and the contents to be displayed
  • Use DHTML - Indicates whether the interface uses DHTML properties or not.
  • Use Form - Indicates whether the interface should use form tags for processing the switch tab requests (default), or if should use regular links.
  • Styles:
    - Style Border Color - The css class that specifies the color of the border to be included on the tab control
    - Style Selected Tab - indicates the css class to use for the tab marked as selected
    - Style Unselected Tab - css class for the unselected tabs
    - Style Selected Last Tab - css class for the selected tab if it happens to be the last one shown on the tab control. If ommited, the style for Selected Tab is used
    - Style Unselected Tab - css class for the unselected tab located at the end of the tab control. If ommited, the style for Unselected Tab is used
    - Style Selected Text - css class to apply to the text of the tab header marked as selected
    - Style Unselected Text - css class to apply to the text of the unselected tab headers
  • Images:
    - Image Selected Tab - image to be displayed on the tab that is marked as selected, at the left of the text
    - Image Unselected Tab - image to be displayed on the tabs not currently selected, at the left of the text
    - Image Selected Cell Style - css style of the cell that will hold the image for the selected tab
    - Image Unselected Cell Style - css style of the cell that will hold the images for the unselected tabs

    Example
    For the tab control shown on the object browser, the calls executed for initializing the tab control are as follows:

    TabControlHelper tab = new TabControlHelper();
    target1 = eventSwitchToReportObjectsTab.getHiddenInputs();
    target2 = eventSwitchToAllObjectsTab.getHiddenInputs();
    formTarget = eventSwitchToReportObjectsTab.getSource().getRoot().getName();

    tab.addTab(String.valueOf(EnumObjectBrowserTabs.ObjectBrowserReportObjectsTab), getDescriptor(1951), target1); 'Descriptor: Report Objects
    tab.addTab(String.valueOf(EnumObjectBrowserTabs.ObjectBrowserAllObjectsTab), getDescriptor(1952), target2); ' Descriptor: All Objects
    tab.setSwitchTabsFormTarget(formTarget);
    tab.setImageTab(imgArrowDown, imgArrowRight);
    tab.setStyleTab("selectedTabCell", "unselectedTabCell");
    tab.setStyleLastTab("selectedTabImage", "unselectedTabImage");
    tab.setImageCellStyle("selectedTabImage", "unselectedTabImage");
    tab.setBorderPadding(5);
    tab.setBorderColor("borderStyle");
    tab.setSelectedTab(String.valueOf(_currentTab));
    tab.setUseDHTML(DHTML);

    If the tab control to be displayed is to work on HTML mode only and no images are displayed together with the tabs so they can serve as INPUT images to submit the form, then the user can choose not to use forms but a direct link, for example:
    TabControlHelper tab = new TabControlHelper();
    target1 = eventSwitchToReportObjectsTab.getURLLink();
    target2 = eventSwitchToAllObjectsTab.getURLLink();
    tab.addTab(String.valueOf(EnumObjectBrowserTabs.ObjectBrowserReportObjectsTab), getDescriptor(1951), target1); 'Descriptor: Report Objects
    tab.addTab(String.valueOf(EnumObjectBrowserTabs.ObjectBrowserAllObjectsTab), getDescriptor(1952), target2); ' Descriptor: All Objects
    tab.setUseForm(false);
    tab.setStyleTab("selectedTabCell", "unselectedTabCell");
    tab.setStyleLastTab("selectedTabImage", "unselectedTabImage");
    tab.setImageCellStyle("selectedTabImage", "unselectedTabImage");
    tab.setBorderPadding(5);
    tab.setBorderColor("borderStyle");
    tab.setSelectedTab(String.valueOf(_currentTab));
    tab.setUseDHTML(false); // Change its true default value

  • Summary

    Constants
    int TAB_ALIGNMENT_JUSTIFIED Indicates the different tabs will be justified to the 100% of the width of the control
    int TAB_ALIGNMENT_LEFT Indicates the different tabs will be aligned to the left of the control
    int TAB_ALIGNMENT_RIGHT Indicates the different tabs will be aligned to the right of the control
    Public Constructors
    TabControlHelper(ContainerServices containerServices)
    Class constructor
    TabControlHelper(AppContext appContext)
    Class constructor
    Public Methods
    boolean addTab(String key, String tabText, String tabInfo, String tabPrefix, String tabSuffix, String imgTooltip)
    Adds the requested tab to the collection.
    boolean addTab(String key, String tabText, MarkupOutput contents)
    Adds the requested tab to the collection.
    boolean addTab(String key, String tabText, String tabInfo, String tabPrefix, String tabSuffix)
    Adds the requested tab to the collection.
    boolean addTab(String key, String tabText, MarkupOutput contents, String tabPrefix, String tabSuffix)
    Adds the requested tab to the collection.
    boolean addTab(String key, String tabText, String tabInfo)
    Adds the requested tab to the collection.
    void clear()
    Clear the tab definition
    MarkupOutput generateOutput()
    Generates the HTML output for this tab instance
    int getBorderPadding()
    Gets the border width to be applied to the tab control
    String getExtraInput()
    Gets any extra form input information that should be added to the events generated by this tab control
    String getExtraUrl()
    Gets any extra URL information that should be added to the events generated by this tab control
    String getImageSelectedTab()
    Gets the image to be displayed for the selected tab
    String getImageUnselectedTab()
    Gets the image to be displayed for the not selected tabs
    int getIndexSelectedTab()
    If no tab has been assigned as current, by default returns the first one
    String getInfoSelectedTab()
    Returns the information associated with the tab currently marked as selected.
    int getSize()
    Gets the number of tabs that have been added to the control
    String getStyleBorderColor()
    Gets the color of the border to be applied to the tab control
    String getStyleSelectedImageCell()
    Gets the style of the cell to hold the image to be used for the selected tab
    String getStyleSelectedLastTab()
    Gets the style to be used for the selected tab if it's the last one to be displayed
    String getStyleSelectedTab()
    Gets the style to be used for the selected tab
    String getStyleSelectedText()
    Gets the style to be used for the text of the selected tab
    String getStyleUnselectedImageCell()
    Gets the style of the cell to hold the image to be used for the not selected tabs
    String getStyleUnselectedLastTab()
    Gets the style to be used for the not selected tab if it's the last one to be displayed
    String getStyleUnselectedTab()
    Gets the style to be used for the not selected tabs
    String getStyleUnselectedText()
    Gets the style to be used for the text of the not selected tabs
    String getSwitchTabsFormTarget()
    Gets the target to be used when displaying the tabs
    int getTabAlignment()
    Gets the tab alignment to be used when displaying the tabs on the control
    String getTextSelectedTab()
    Returns what's the text being displayed for the tab that it's currently marked as selected.
    boolean getUseApplyAllTabs()
    Returns if this tab is to use the Apply All Tabs functionality or not
    boolean getUseDHTML()
    Returns whether the tab control displays DHTML or not
    boolean getUseForm()
    Returns if this tab is to generate a Form for switching tabs, or just regular links
    boolean getUseIFrame()
    Returns whether this tab control will be using IFrame or not
    void setBasePath(String basePath)
    Defines the base path where the image files used for regular formatting can be found
    void setBorderPadding(int value)
    Sets the border padding to use when displaying the tab contents
    void setContents(MarkupOutput out)
    Defines the contents of the current tab.
    void setEventManager(EventManager newValue)
    Assigns a new EventManager instance to be used by the tab control for generating the events to be used for handling this instance
    void setExtraInput(String newValue)
    Sets any extra form input information that should be added to the events generated by this tab control
    void setExtraUrl(String newValue)
    Sets any extra URL information that should be added to the events generated by this tab control
    void setImageCellStyle(String selected, String unSelected)
    Defines the style of the cell that will hold the image to be used for the tab
    void setImageSelectedTab(String value)
    Sets the image to display on the selected tab
    void setImageTab(String selected, String unSelected)
    Sets the image to be used when displaying the tabs
    void setImageUnselectedTab(String value)
    Sets the image to display on the not selected tabs
    boolean setSelectedTab(String key)
    Given the key sent as parameter, have the tab associated with this key selected as current one.
    void setStyleBorderColor(String value)
    Sets the color of the border to use when displaying the tab contents
    void setStyleLastTab(String selected, String unSelected)
    Defines the style of the last tab to be used
    void setStyleSelectedImageCell(String value)
    Sets the style to be used for the cell containing the image of the selected tab
    void setStyleSelectedLastTab(String value)
    Sets the style to be used for the selected tab if it's the last one to be displayed
    void setStyleSelectedTab(String value)
    Sets the style to be used for the selected tab
    void setStyleSelectedText(String value)
    Sets the style to use for the text to be displayed for the selected tab
    void setStyleTab(String selected, String unSelected)
    Defines the style of the tabs to be displayed for this control
    void setStyleText(String selected, String unSelected)
    Defines the style of the text to be used when displaying the tabs
    void setStyleUnselectedImageCell(String value)
    Sets the style to be used for the cell containing the image of the not selected tabs
    void setStyleUnselectedLastTab(String value)
    Sets the style to be used for the unselected tab if it's the last one to be displayed
    void setStyleUnselectedTab(String value)
    Sets the style to be used for the unselected tabs
    void setStyleUnselectedText(String value)
    Sets the style to use for the text to be displayed for the not selected tabs
    void setSwitchTabsFormTarget(String value)
    Defines the target of the form that gets submitted when a switch tab is requested
    void setTabAlignment(int value)
    Defines the alignment of the tabs to be displayed on the control.
    void setUseApplyAllTabs(boolean useApplyAllTabs)
    Defines if this tab is to use the Apply All Tabs functionality.
    void setUseDHTML(boolean useDHTML)
    Defines if this tab is to generate HTML or DHTML output.
    void setUseForm(boolean useForm)
    Defines if this tab is to generate a Form for switching tabs, or just regular links (by default it uses a form).
    void setUseIFrame(boolean newValue)
    Defines whether this tab control will be using an IFrame or not
    [Expand]
    Inherited Methods
    From class java.lang.Object

    Constants

    public static final int TAB_ALIGNMENT_JUSTIFIED

    Indicates the different tabs will be justified to the 100% of the width of the control

    Constant Value: 0 (0x00000000)

    public static final int TAB_ALIGNMENT_LEFT

    Indicates the different tabs will be aligned to the left of the control

    Constant Value: 1 (0x00000001)

    public static final int TAB_ALIGNMENT_RIGHT

    Indicates the different tabs will be aligned to the right of the control

    Constant Value: 2 (0x00000002)

    Public Constructors

    public TabControlHelper (ContainerServices containerServices)

    Class constructor

    public TabControlHelper (AppContext appContext)

    Class constructor

    Public Methods

    public boolean addTab (String key, String tabText, String tabInfo, String tabPrefix, String tabSuffix, String imgTooltip)

    Adds the requested tab to the collection. If the key was already defined with another element, the previous value will be overwritten with the new information.

    Parameters
    key String value to associate as key of the tab being added
    tabText String to display when rendering the tab
    tabInfo String containing the link to be used for accessing the contents of this tab
    tabPrefix String to display before the text of the tab. It will not be part of the link generated for switching tabs (if not using forms), but will have the same CSS Style as the text.
    tabSuffix String to display after the text of the tab. It will not be part of the link generated for switching tabs (if not using forms), but will have the same CSS Style as the text.
    imgTooltip String to be used as tooltip if there's an image to render together with this tab when it's not selected
    Returns
    • false if the key already existed on the collection.

    public boolean addTab (String key, String tabText, MarkupOutput contents)

    Adds the requested tab to the collection. If the key was already defined with another

    Parameters
    key String value to associate as key of the tab being added
    tabText String to display when rendering the tab
    contents a MarkupOutput instance initialized with the contents of this tab. If contents are going to be defined for each tab, they should be inside a
    tag identified with the same name as the key specified for this tab in order to have it enabled to be hidden or shown as requested by the final user. Somewhere in the contents the required hidden inputs should be included so the event gets handled correctly.
    Returns
    • false if the key already existed on the collection.

    public boolean addTab (String key, String tabText, String tabInfo, String tabPrefix, String tabSuffix)

    Adds the requested tab to the collection. If the key was already defined with another element, the previous value will be overwritten with the new information.

    Parameters
    key String value to associate as key of the tab being added
    tabText String to display when rendering the tab
    tabInfo String containing the link to be used for accessing the contents of this tab
    tabPrefix String to display before the text of the tab. It will not be part of the link generated for switching tabs (if not using forms), but will have the same CSS Style as the text.
    tabSuffix String to display after the text of the tab. It will not be part of the link generated for switching tabs (if not using forms), but will have the same CSS Style as the text.
    Returns
    • false if the key already existed on the collection.

    public boolean addTab (String key, String tabText, MarkupOutput contents, String tabPrefix, String tabSuffix)

    Adds the requested tab to the collection. If the key was already defined with another element, the previous value will be overwritten with the new information.

    Parameters
    key String value to associate as key of the tab being added
    tabText String to display when rendering the tab
    contents a MarkupOutput instance initialized with the contents of this tab. If contents are going to be defined for each tab, they should be inside a
    tag identified with the same name as the key specified for this tab in order to have it enabled to be hidden or shown as requested by the final user. Somewhere in the contents the required hidden inputs should be included so the event gets handled correctly.
    tabPrefix String to display before the text of the tab. It will not be part of the link generated for switching tabs (if not using forms), but will have the same CSS Style as the text.
    tabSuffix String to display after the text of the tab. It will not be part of the link generated for switching tabs (if not using forms), but will have the same CSS Style as the text.
    Returns
    • false if the key already existed on the collection.

    public boolean addTab (String key, String tabText, String tabInfo)

    Adds the requested tab to the collection. If the key was already defined with another element, the previous value will be overwritten with the new information.

    Parameters
    key String value to associate as key of the tab being added
    tabText String to display when rendering the tab
    tabInfo String containing the link to be used for accessing the contents of this tab
    Returns
    • false if the key already existed on the collection.

    public void clear ()

    Clear the tab definition

    public MarkupOutput generateOutput ()

    Generates the HTML output for this tab instance

    Returns
    • a MarkupOutput instance with the HTML to be rendered for this tab control.

    public int getBorderPadding ()

    Gets the border width to be applied to the tab control

    Returns
    • width of the border to be used

    public String getExtraInput ()

    Gets any extra form input information that should be added to the events generated by this tab control

    Returns
    • String with any extra input information to add to the forms to be displayed by this tab control

    public String getExtraUrl ()

    Gets any extra URL information that should be added to the events generated by this tab control

    Returns
    • String with any extra URL to add to the links to be displayed by this tab control

    public String getImageSelectedTab ()

    Gets the image to be displayed for the selected tab

    Returns
    • source of the image to be used

    public String getImageUnselectedTab ()

    Gets the image to be displayed for the not selected tabs

    Returns
    • source of the image to be used

    public int getIndexSelectedTab ()

    If no tab has been assigned as current, by default returns the first one

    Returns
    • the index of the selected tab

    public String getInfoSelectedTab ()

    Returns the information associated with the tab currently marked as selected.

    Returns
    • the information of the selected tab

    public int getSize ()

    Gets the number of tabs that have been added to the control

    Returns
    • the number of tabs available. If none yet, returns zero.

    public String getStyleBorderColor ()

    Gets the color of the border to be applied to the tab control

    Returns
    • color to be used for the tab border

    public String getStyleSelectedImageCell ()

    Gets the style of the cell to hold the image to be used for the selected tab

    Returns
    • css style to use

    public String getStyleSelectedLastTab ()

    Gets the style to be used for the selected tab if it's the last one to be displayed

    Returns
    • css style used

    public String getStyleSelectedTab ()

    Gets the style to be used for the selected tab

    Returns
    • css style used

    public String getStyleSelectedText ()

    Gets the style to be used for the text of the selected tab

    Returns
    • css style used

    public String getStyleUnselectedImageCell ()

    Gets the style of the cell to hold the image to be used for the not selected tabs

    Returns
    • css style to use

    public String getStyleUnselectedLastTab ()

    Gets the style to be used for the not selected tab if it's the last one to be displayed

    Returns
    • css style used

    public String getStyleUnselectedTab ()

    Gets the style to be used for the not selected tabs

    Returns
    • css style used

    public String getStyleUnselectedText ()

    Gets the style to be used for the text of the not selected tabs

    Returns
    • css stylel used

    public String getSwitchTabsFormTarget ()

    Gets the target to be used when displaying the tabs

    Returns
    • the target to go to once a switch tab request has been submitted

    public int getTabAlignment ()

    Gets the tab alignment to be used when displaying the tabs on the control

    Returns
    • the TAB_ALIGNMENT_LEFT, TAB_ALIGNMENT_RIGHT or TAB_ALIGNMENT_JUSTIFIED constants depending on the setting defined

    public String getTextSelectedTab ()

    Returns what's the text being displayed for the tab that it's currently marked as selected.

    Returns
    • the text shown for the selected tab

    public boolean getUseApplyAllTabs ()

    Returns if this tab is to use the Apply All Tabs functionality or not

    Returns
    • a boolean value indicating if the Apply All Tabs approach is to be used for this tab control or not

    public boolean getUseDHTML ()

    Returns whether the tab control displays DHTML or not

    Returns
    • a boolean value indicating if the tab uses DHTML or not

    public boolean getUseForm ()

    Returns if this tab is to generate a Form for switching tabs, or just regular links

    Returns
    • a boolean value indicating if the tab uses a Form or not

    public boolean getUseIFrame ()

    Returns whether this tab control will be using IFrame or not

    Returns
    • boolean value indicating if this interface will be interacting with an IFrame control

    public void setBasePath (String basePath)

    Defines the base path where the image files used for regular formatting can be found

    Parameters
    basePath String with the base path to access for finding the required files (for example, "..")

    public void setBorderPadding (int value)

    Sets the border padding to use when displaying the tab contents

    Parameters
    value an integer value with the width to be left between the edge of the tab control and its contents

    public void setContents (MarkupOutput out)

    Defines the contents of the current tab.

    Parameters
    out a MarkupOutput instance initialized with the HTML to be displayed as the current tab contents. These contents will be ignored if when adding tabs to the helper at least one content was defined.

    public void setEventManager (EventManager newValue)

    Assigns a new EventManager instance to be used by the tab control for generating the events to be used for handling this instance

    Parameters
    newValue a EventManager instance, initialized

    public void setExtraInput (String newValue)

    Sets any extra form input information that should be added to the events generated by this tab control

    Parameters
    newValue String with any extra input information to add to the forms to be displayed by this tab control

    public void setExtraUrl (String newValue)

    Sets any extra URL information that should be added to the events generated by this tab control

    Parameters
    newValue String with any extra URL to add to the links to be displayed by this tab control

    public void setImageCellStyle (String selected, String unSelected)

    Defines the style of the cell that will hold the image to be used for the tab

    Parameters
    selected css style to use for the cell that holds the image for a selected tab
    unSelected css style to use for the cell that holds the image for the not selected tabs

    public void setImageSelectedTab (String value)

    Sets the image to display on the selected tab

    Parameters
    value image source to be used

    public void setImageTab (String selected, String unSelected)

    Sets the image to be used when displaying the tabs

    Parameters
    selected image source to be used for the selected tab
    unSelected image source to be used for the not selected tabs.

    public void setImageUnselectedTab (String value)

    Sets the image to display on the not selected tabs

    Parameters
    value image source to be used

    public boolean setSelectedTab (String key)

    Given the key sent as parameter, have the tab associated with this key selected as current one. If no tab is associated with this key, returns false

    Parameters
    key String value that indicates the key of the selected tab
    Returns
    • True if the key requested corresponds to an existing tab. Returns False otherwise.

    public void setStyleBorderColor (String value)

    Sets the color of the border to use when displaying the tab contents

    Parameters
    value hexadecimal color code to apply when displaying the border of the tab control

    public void setStyleLastTab (String selected, String unSelected)

    Defines the style of the last tab to be used

    Parameters
    selected the css style to use if the last tab is a selected one
    unSelected the css style to use if the last tab is not the selected one

    public void setStyleSelectedImageCell (String value)

    Sets the style to be used for the cell containing the image of the selected tab

    Parameters
    value css style to use

    public void setStyleSelectedLastTab (String value)

    Sets the style to be used for the selected tab if it's the last one to be displayed

    Parameters
    value css style to use

    public void setStyleSelectedTab (String value)

    Sets the style to be used for the selected tab

    Parameters
    value css style to use

    public void setStyleSelectedText (String value)

    Sets the style to use for the text to be displayed for the selected tab

    Parameters
    value css style to use

    public void setStyleTab (String selected, String unSelected)

    Defines the style of the tabs to be displayed for this control

    Parameters
    selected css style to use for the selected tab
    unSelected css style to use for the not selected tabs

    public void setStyleText (String selected, String unSelected)

    Defines the style of the text to be used when displaying the tabs

    Parameters
    selected css style to use for the text of the selected tab
    unSelected css style to use for the text of the not selected tabs.

    public void setStyleUnselectedImageCell (String value)

    Sets the style to be used for the cell containing the image of the not selected tabs

    Parameters
    value css style to use

    public void setStyleUnselectedLastTab (String value)

    Sets the style to be used for the unselected tab if it's the last one to be displayed

    Parameters
    value css style to use

    public void setStyleUnselectedTab (String value)

    Sets the style to be used for the unselected tabs

    Parameters
    value css style to use

    public void setStyleUnselectedText (String value)

    Sets the style to use for the text to be displayed for the not selected tabs

    Parameters
    value css style to use

    public void setSwitchTabsFormTarget (String value)

    Defines the target of the form that gets submitted when a switch tab is requested

    Parameters
    value the target where to go when switching tabs has been asked for

    public void setTabAlignment (int value)

    Defines the alignment of the tabs to be displayed on the control. Possible values include the TAB_ALIGNMENT_LEFT, TAB_ALIGNMENT_RIGHT and TAB_ALIGNMENT_JUSTIFIED constants defined on this class.

    Parameters
    value the alignment to use when displaying the tab control

    public void setUseApplyAllTabs (boolean useApplyAllTabs)

    Defines if this tab is to use the Apply All Tabs functionality. If set to True, it disables the use of a Form for switching tabs and it enables the use of DHTML.

    Parameters
    useApplyAllTabs boolean indicating if the Apply All Tabs approach should be generated or not

    public void setUseDHTML (boolean useDHTML)

    Defines if this tab is to generate HTML or DHTML output. It disables the Apply All Tabs functionality if set to False.

    Parameters
    useDHTML boolean indicating if DHTML should be generated or not

    public void setUseForm (boolean useForm)

    Defines if this tab is to generate a Form for switching tabs, or just regular links (by default it uses a form). It disables the Apply All Tabs functionality if set to True.

    Parameters
    useForm boolean indicating if a Form should be generated or not

    public void setUseIFrame (boolean newValue)

    Defines whether this tab control will be using an IFrame or not

    Parameters
    newValue boolean value indicating if this interface will be interacting with an IFrame control