Class TabControlHelper


  • public class TabControlHelper
    extends java.lang.Object
    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

Since:
MicroStrategy Web 7.3.1 or earlier