Class NavBarFooterButtonPopup


public class NavBarFooterButtonPopup extends Component<NavBarFooterButtonPopup>

Popup menu component for buttons in the @{link NavBar component’s footer.

Use this component to display a popup menu by pressing a button in the NavBar footer. The popup menu shows different items. All displayed items are clickable. Click event handlers are individually implemented.

You can set an icon and a header text for the popup menu. You can add items to the popup menu. Icons or pictures are inserted before these items. You can add a title and detail text to the items. These are displayed in line with the specified icon or picture. If the specified text is too long to display, only a part of the text that fits to a row will appear.
Furthermore, you can add buttons to the popup menu. Button texts appear left-aligned or center-aligned.

Click events for items and buttons are individually implemented along with the application logic.

The component is not a standalone component, it is always to be assigned to a NavBarFooterButton component. You cannot instantiate this component, you can only create it using the createPopup() method.

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

    • NavBarFooterButtonPopup

      protected NavBarFooterButtonPopup()
  • Method Details

    • setHeader

      public NavBarFooterButtonPopup setHeader(Icon icon, String title)
      Sets the popup menu header. If no header is specified or the header text and icon are set as null, the header is not displayed.
      Parameters:
      icon - Header icon If null is set, no icon is displayed. Available icons are listed in the enum Icon.
      title - Header text If null or an empty string is specified, no text is displayed in the header.
      Returns:
      Popup menu component
    • getHeaderIcon

      public Icon getHeaderIcon()
      Gets the header icon in the popup menu.
      Returns:
      The icon in the popup menu header, or null if no icon is displayed or specified for the popup menu.
    • getHeaderText

      public String getHeaderText()
      Gets the popup menu header text.
      Returns:
      The icon in the popup menu header text, or null if no header text is displayed or specified for the popup menu.
    • addItem

      public NavBarFooterButtonPopup addItem(String name, Icon icon, TextType iconType, String title, String detail, ClickEventHandler clickHandler)
      Adds a menu item with an icon to the popup menu.
      Parameters:
      name - Menu item name This parameter is mandatory. The menu item name must be unique in order to be properly referenced later.
      icon - The icon before the menu item If null is specified, no icon is displayed before the menu item. Available icons are listed in the enum Icon.
      iconType - The icon type which determines the icon color Available types are listed in the enum TextType.
      title - Item title If null is set, no title is displayed.
      detail - Item detail text This text is displayed with a fainter color next to the icon and below the item title. If null is specified, the detail text is not displayed.
      clickHandler - Click handler event implementation If null is specified, the click event is not handled and the user is not able to use the given item. However, the item is visible.
      Returns:
      Popup menu component
      Throws:
      NullPointerException - Thrown if the item name is specified as null
    • addItem

      public NavBarFooterButtonPopup addItem(String name, String imageUrl, String title, String detail, ClickEventHandler clickHandler)
      Adds a menu item with an image to the popup menu.
      Parameters:
      name - Menu item name This parameter is mandatory. The menu item name must be unique in order to be properly referenced later.
      imageUrl - Relative URL of the image displayed before the item The specified URL must be different from the application’s base URL. If null is specified, no image is displayed before the menu item.
      title - Item title If null is set, no title is displayed.
      detail - Item detail text This text is displayed with a fainter color next to the icon and below the item title. If null is specified, no detail text is displayed.
      clickHandler - Click handler event implementation If null is specified, the click event is not handled, thus the user cannot handle the item but it is visible.
      Returns:
      Popup menu component
      Throws:
      NullPointerException - Thrown if the item name is specified as null
    • removeItemByName

      public NavBarFooterButtonPopup removeItemByName(String name)
      Removes a previously added item from the popup menu. If more items match the specified name, all of them are removed.
      Parameters:
      name - The name of the item to be removed
      Returns:
      Popup menu component
    • addButton

      public NavBarFooterButtonPopup addButton(String text, ClickEventHandler clickHandler)
      Adds a button with a left-aligned text to the menu.
      Parameters:
      text - Button text If null is specified, the button is displayed without a text.
      clickHandler - Click event handler implementation If null is specified, the button will be inactive.
      Returns:
      Popup menu component
    • addButton

      public NavBarFooterButtonPopup addButton(String text, boolean centered, ClickEventHandler clickHandler)
      Adds a button with a text to the menu.
      Parameters:
      text - Button text If null is specified, the button is displayed without a text.
      centered - If true is specified, the button text is aligned to the center Otherwise, it is displayed left-aligned.
      clickHandler - Click event handler implementation If null is specified, the button will be inactive.
      Returns:
      Popup menu component
    • addDivider

      public NavBarFooterButtonPopup addDivider()
      Adds a divider item to the menu.
      Returns:
      Popup menu component
    • 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<NavBarFooterButtonPopup>
      Returns:
      If the componentwas drawn, true, otherwise false