Class ActivatableGUIElement

All Implemented Interfaces:
GUIElement, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
AbstractButton, GUICharacter, GUICheckBox, GUIItem, GUIList, GUIMetaElement, GUIScrollBar, GUISpinner, GUIText

public abstract class ActivatableGUIElement extends AbstractGUIElement
A GUIElement that can be set to active or inactive.
See Also:
  • Constructor Details

    • ActivatableGUIElement

      protected ActivatableGUIElement(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull String name, boolean opaque, @NotNull @NotNull GuiFactory guiFactory)
      Creates a new instance.
      Parameters:
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      name - the name of this element
      opaque - whether this element is opaque
      guiFactory - the global GUI factory instance
  • Method Details

    • activeChanged

      protected abstract void activeChanged()
      Will be called whenever the active state has changed.
    • mousePressed

      public void mousePressed(@NotNull @NotNull MouseEvent e)
      Will be called when the user has pressed the mouse inside this element.
      Specified by:
      mousePressed in interface GUIElement
      Overrides:
      mousePressed in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • markInactivePending

      protected void markInactivePending()
      Marks this GUI element as pending inactive.
    • setInactiveIfPending

      protected void setInactiveIfPending()
      Unsets the active state of this GUI element if it is pending.
    • setActive

      public void setActive(boolean active)
      Sets the active state of a GUI element.
      Parameters:
      active - the active state
    • isActive

      public boolean isActive()
      Returns whether a GUI element is active.
      Returns:
      whether the element is active
    • execute

      public abstract void execute()
      Executes the actions associated with this GUI element. Does nothing if this element has no associated actions.
    • activateNextElement

      public void activateNextElement()
      Activates the following element.
    • activatePrevElement

      public void activatePrevElement()
      Activates the previous element.
    • setNextActive

      public void setNextActive(@NotNull @NotNull ActivatableGUIElement next)
      Sets the next activatable GUI element in the same dialog.
      Parameters:
      next - the element
    • setPrevActive

      public void setPrevActive(@NotNull @NotNull ActivatableGUIElement prev)
      Sets the previous activatable GUI element in the same dialog.
      Parameters:
      prev - the element