Class QMenu

java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.menus.QMenu
All Implemented Interfaces:
QMenuItemContainerInterface, QMetaDataObject, Serializable, Cloneable
Direct Known Subclasses:
QMenuDefaultViewScreenActionsMenu

public class QMenu extends Object implements QMetaDataObject, Cloneable, QMenuItemContainerInterface
A list of items that can be selected by a user of a qqq application.
See Also:
  • Constructor Details

    • QMenu

      public QMenu()
  • Method Details

    • getLabel

      public String getLabel()
      Getter for label
      See Also:
    • setLabel

      public void setLabel(String label)
      Setter for label
      See Also:
    • withLabel

      public QMenu withLabel(String label)
      Fluent setter for label
      Parameters:
      label - user-facing text to display as the label for this menu. e.g., "File, Edit, View" or "Actions",
      Returns:
      this
    • getIcon

      public QIcon getIcon()
      Getter for icon
      See Also:
    • setIcon

      public void setIcon(QIcon icon)
      Setter for icon
      See Also:
    • withIcon

      public QMenu withIcon(QIcon icon)
      Fluent setter for icon
      Parameters:
      icon - Optional icon to display with this menu.
      Returns:
      this
    • getSlot

      public QMenuSlotInterface getSlot()
      Getter for slot
      See Also:
    • setSlot

      public void setSlot(QMenuSlotInterface slot)
      Setter for slot
      See Also:
    • withSlot

      public QMenu withSlot(QMenuSlotInterface slot)
      Fluent setter for slot
      Parameters:
      slot - Where this menu is displayed. e.g., on a query screen as the actions menu, or on a view screen as an additional custom menu.
      Returns:
      this
    • getItems

      public List<QMenuItemInterface> getItems()
      Getter for items
      Specified by:
      getItems in interface QMenuItemContainerInterface
      Returns:
      the list of menu items, which may be empty but should not be null
      See Also:
    • setItems

      public void setItems(List<QMenuItemInterface> items)
      Setter for items
      See Also:
    • withItems

      public QMenu withItems(List<QMenuItemInterface> items)
      Fluent setter for items
      Parameters:
      items - Contents of the menu.
      Returns:
      this
    • withItem

      public QMenu withItem(QMenuItemInterface item)
      Fluently add a single item
      Parameters:
      item - one item to add to the menu.
      Returns:
      this
    • validate

      public void validate(QInstanceValidator validator, QInstance qInstance, QMetaDataObject parentObject)
      As part of QInstanceValidation, verify that the meta-data in this object is all fully valid.

      Subclasses should generally include a call to super.validate

    • clone

      public QMenu clone()
      Creates and returns a deep copy of this menu.

      The cloned menu will have its own copy of the items list, with each item also being cloned. This ensures that modifications to the cloned menu or its items will not affect the original.

      Overrides:
      clone in class Object
      Returns:
      a deep clone of this menu
      Throws:
      RuntimeException - if cloning is not supported (should not occur)