Class GUIMetaElement

All Implemented Interfaces:
GUIElement, GUIScrollable, ImageObserver, MenuContainer, Serializable

public class GUIMetaElement extends ActivatableGUIElement implements GUIScrollable
Display a Crossfire server entry.
See Also:
  • Constructor Details

    • GUIMetaElement

      public GUIMetaElement(@NotNull @NotNull TooltipManager tooltipManager, @NotNull @NotNull GUIElementListener elementListener, @NotNull @NotNull MetaserverModel metaserverModel, @NotNull @NotNull String name, @Nullable @Nullable Image image, @NotNull @NotNull Font font, int defaultIndex, @NotNull @NotNull String format, @NotNull @NotNull String tooltip, @NotNull @NotNull GuiFactory guiFactory)
      Creates a new instance.
      Parameters:
      tooltipManager - the tooltip manager to update
      elementListener - the element listener to notify
      metaserverModel - the metaserver model to monitor
      name - the name of this element
      image - an image to draw before the server description; may be null to draw no image
      font - the font to use
      defaultIndex - the initial metaserver index
      format - the format used to display metaserver instances
      tooltip - the format used for displaying tooltips
      guiFactory - the global GUI factory instance
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: GUIElement
      Releases all allocated resources.
      Specified by:
      dispose in interface GUIElement
      Overrides:
      dispose in class AbstractGUIElement
    • paintComponent

      public void paintComponent(@NotNull @NotNull Graphics g)
      Overrides:
      paintComponent in class JComponent
    • getPreferredSize

      @Nullable public @Nullable Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      @Nullable public @Nullable Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • mouseClicked

      public void mouseClicked(@NotNull @NotNull MouseEvent e)
      Description copied from interface: GUIElement
      Will be called when the user has clicked (pressed+released) this element. This event will be delivered after GUIElement.mouseReleased(MouseEvent).
      Specified by:
      mouseClicked in interface GUIElement
      Overrides:
      mouseClicked in class AbstractGUIElement
      Parameters:
      e - the mouse event relative to this element
    • getTooltip

      @Nullable public @Nullable TooltipText getTooltip()
      Description copied from class: AbstractGUIElement
      Returns the current tooltip text.
      Specified by:
      getTooltip in class AbstractGUIElement
      Returns:
      the tooltip text or null to not show a tooltip
    • notifyOpen

      public void notifyOpen()
      Description copied from interface: GUIElement
      Called each time the enclosing dialog is opened (or raised).
      Specified by:
      notifyOpen in interface GUIElement
    • execute

      public void execute()
      Description copied from class: ActivatableGUIElement
      Executes the actions associated with this GUI element. Does nothing if this element has no associated actions.
      Specified by:
      execute in class ActivatableGUIElement
    • canScroll

      public boolean canScroll(int distance)
      Description copied from interface: GUIScrollable
      Returns whether scrolling is possible.
      Specified by:
      canScroll in interface GUIScrollable
      Parameters:
      distance - the distance to scroll
      Returns:
      whether scrolling is possible
    • scroll

      public void scroll(int distance)
      Description copied from interface: GUIScrollable
      Scrolls the element.
      Specified by:
      scroll in interface GUIScrollable
      Parameters:
      distance - the distance to scroll
    • resetScroll

      public void resetScroll()
      Description copied from interface: GUIScrollable
      Resets the scroll index to the default value.
      Specified by:
      resetScroll in interface GUIScrollable
    • activeChanged

      protected void activeChanged()
      Description copied from class: ActivatableGUIElement
      Will be called whenever the active state has changed.
      Specified by:
      activeChanged in class ActivatableGUIElement
    • getIndex

      public int getIndex()
      Returns the index of this element.
      Returns:
      the index
    • setIndex

      public void setIndex(int index)
      Sets the index of this element.
      Parameters:
      index - the index
    • setSelected

      public void setSelected(boolean selected)
      Sets the selected state.
      Parameters:
      selected - whether this element should be drawn as "selected"