Class TabPage

All Implemented Interfaces:
Animatable<TabPage>, CanDrop<TabPage>, Clickable<TabPage>, Draggable<TabPage>, HandleHotKey<TabPage>, HandleMouseEvents<TabPage>, Scrollable<TabPage>, Touchable<TabPage>

Tab page component

This component cannot be used on its own. Every tab page component must be placed on a Tab component. A Tab Page component represents a page with a clickable Tab header. Accordingly, a Tab component represents a group of tab pages, that are displayed together in the same area. The tab page component contains the other components, that you wish to display when the tab page is selected.

The tab page component can have any other components assigned to it, that will only be displayed, if their tab page is active(the user clicks on that tab page's header). A tab header can have an icon and a title, but no additional components can be placed here.

Supported events:

AnimationStart AnimationEnd, Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, Scrollable TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd HotKey

Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • TabPage

      public TabPage(String title)
      Creates a tab page component with the specified tab page header title
      Parameters:
      title - The tab page header title
    • TabPage

      public TabPage(String id, String title)
      Creates a tab page component with the specified tab page header title
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      title - The tab page header title
    • TabPage

      public TabPage(Icon icon)
      Creates a tab page component with the specified tab page header icon
      Parameters:
      icon - The tab page header title. For applicable values, see the Icon enum.
    • TabPage

      public TabPage(String id, Icon icon)
      Creates a tab page component with the specified tab page header icon
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      icon - The tab page header title. For applicable values, see the Icon enum.
    • TabPage

      public TabPage(Icon icon, String title)
      Creates a tab page component with the specified tab page header title and icon.
      Parameters:
      icon - The tab page header title. For applicable values, see the Icon enum.
      title - The tab page header title
    • TabPage

      public TabPage(String id, Icon icon, String title)
      Creates a tab page component with the specified tab page header title and icon.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      icon - The tab page header title. For applicable values, see the Icon enum.
      title - The tab page header title
    • TabPage

      public TabPage(String title, Component<?>... contents)
      Creates a tab page component with the specified tab page header title and tab page contents.
      Parameters:
      title - The tab page header title
      contents - The instances of the components that will be placed in the tab page. They will be added in the order they are listed here.
    • TabPage

      public TabPage(String id, String title, Component<?>... contents)
      Creates a tab page component with the specified tab page header title and tab page contents.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      title - The tab page header title
      contents - The instances of the components that will be placed in the tab page. They will be added in the order they are listed here.
    • TabPage

      public TabPage(Icon icon, String title, Component<?>... contents)
      Creates a tab page component with the specified tab page header title, icon and tab page contents.
      Parameters:
      icon - The tab page header title. For applicable values, see the Icon enum.
      title - The tab page header title
      contents - The instances of the components that will be placed in the tab page. They will be added in the order they are listed here.
    • TabPage

      public TabPage(String id, Icon icon, String title, Component<?>... contents)
      Creates a tab page component with the specified tab page header title, icon and tab page contents.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      icon - The tab page header title. For applicable values, see the Icon enum.
      title - The tab page header title
      contents - The instances of the components that will be placed in the tab page. They will be added in the order they are listed here.
  • Method Details

    • getTitle

      public String getTitle()
      Gets the tab page header title
      Returns:
      The tab page header title or null, if it has no title
    • setTitle

      public TabPage setTitle(String title)
      Sets the tab page header title
      Parameters:
      title - The tab page header title
      Returns:
      The tab page component
    • setIcon

      public TabPage setIcon(Icon icon)
      Sets the tab page header icon
      Parameters:
      icon - The tab page header title. For applicable values, see the Icon enum.
      Returns:
      The tab page component
    • getIcon

      public Icon getIcon()
      Gets the tab page header icon
      Returns:
      The tab page header icon or null, if it has no icon
    • setBackgroundColor

      public TabPage setBackgroundColor(Color color)
      Sets the tab page background color
      Overrides:
      setBackgroundColor in class Component<TabPage>
      Parameters:
      color - The tab page background color. For applicable values, see the Color enum
      Returns:
      The tab page component
    • getBackgroundColor

      public Color getBackgroundColor()
      Gets the tab page background color
      Overrides:
      getBackgroundColor in class Component<TabPage>
      Returns:
      The background color, in the same format it was specified in.
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<TabPage>
      Returns:
      If the componentwas drawn, true, otherwise false
    • getHeaderLink

      protected Link getHeaderLink()
      Returns:
      The link component that represents the tab header
    • getIndex

      public Integer getIndex()
      Gets the index of the tab page. The index is the number that specifies the placement of the tab page within the tab component. These start from 0, meaning that the first tab page has 0 as it's index, the second has 1 as its index, the third has 2 as its index, etc.
      Returns:
      The tab page index or null, if the tab component has no tab pages when the query is started.
    • addHotKey

      public TabPage addHotKey(int hotKey)
      Description copied from interface: HandleHotKey
      Adds the specified hot key to the component. If the user presses the hot key, the component's Click event handler will be fired. If the hot key was assigned to an input field, the field will gain focus.
      Specified by:
      addHotKey in interface HandleHotKey<TabPage>
      Parameters:
      hotKey - The button combination, that will be assigned to the component. This button combination can be specified, by using the Key class' constants. If the hot key is a combination of two buttons, then the values must be added. For example, the CTRL+S combination is specified as KEY.CTRL + KEY.KEY_S
      Returns:
      The component
    • addHotKey

      public TabPage addHotKey(int hotKey, HotKeyEventHandler handler)
      Description copied from interface: HandleHotKey
      Adds the specified hot key to the component. If the user presses the hot key, the specified event handler will be fired
      Specified by:
      addHotKey in interface HandleHotKey<TabPage>
      Parameters:
      hotKey - The button combination, that will be assigned to the component. This button combination can be specified, by using the Key class' constants. If the hot key is a combination of two buttons, then the values must be added. For example, the CTRL+S combination is specified as KEY.CTRL + KEY.KEY_S
      handler - The HotKeyEventHandler implementation
      Returns:
      The component
      See Also:
    • show

      protected void show()
    • hide

      protected void hide()
    • setCloseable

      public TabPage setCloseable(boolean closeable)
      Sets if the tab page can be closed. By default, a tab page cannot be closed.
      Parameters:
      closeable - If true is specified, the tab page can be closed, otherwise it cannot be closed
      Returns:
      Tab page component
    • isCloseable

      public boolean isCloseable()
      Defines whether the tab page can be closed.
      Returns:
      If true, the tab page can be closed, otherwise not.
    • setCloseHandler

      public TabPage setCloseHandler(TabPageCloseHandler handler)
      Adds a tab page closing event handler to the tab page.
      Parameters:
      handler - Tab page closing event handler implementation
      Returns:
      Tab page component
    • afterDraw

      public void afterDraw()
      Description copied from class: Component
      The operations to be executed after the drawing of the component

      By default, this is an empty method. It has to be overwritten on a component or page if additional operations have to be executed after the drawing process. One such operation is data retrieval, which shouldn't run in constructors so that the user could see results of an operation or navigation process.

      Overrides:
      afterDraw in class Component<TabPage>
    • setEnabled

      public TabPage setEnabled(boolean enabled)
      Description copied from class: Component
      Sets the component to be enabled. Defaults to true
      Overrides:
      setEnabled in class Component<TabPage>
      Parameters:
      enabled - true, the component is enabled, otherwise it's disabled
      Returns:
      The component
    • showpage

      protected void showpage(boolean show)