Class DefaultJXCSkin

java.lang.Object
com.realtime.crossfire.jxclient.skin.skin.DefaultJXCSkin
All Implemented Interfaces:
JXCSkin, Iterable<Gui>

public class DefaultJXCSkin extends Object implements JXCSkin
Default JXCSkin implementation.
  • Constructor Details

    • DefaultJXCSkin

      public DefaultJXCSkin(@NotNull @NotNull KeyBindings defaultKeyBindings, @NotNull @NotNull OptionManager optionManager, @NotNull @NotNull Dialogs dialogs)
      Creates a new instance.
      Parameters:
      defaultKeyBindings - the default key bindings
      optionManager - the option manager to use
      dialogs - the dialogs to use
  • Method Details

    • getSkinName

      @NotNull public @NotNull String getSkinName()
      Description copied from interface: JXCSkin
      Returns a short name for the skin. It is used to construct path or file names.
      Specified by:
      getSkinName in interface JXCSkin
      Returns:
      the skin name
    • setSkinName

      public void setSkinName(@NotNull @NotNull String skinName, @NotNull @NotNull Resolution minResolution, @NotNull @NotNull Resolution maxResolution)
      Sets the skin name.
      Parameters:
      skinName - the skin name
      minResolution - the minimal supported resolution
      maxResolution - the maximal supported resolution
    • getMinResolution

      @NotNull public @NotNull Resolution getMinResolution()
      Description copied from interface: JXCSkin
      Returns the minimal resolution of this skin.
      Specified by:
      getMinResolution in interface JXCSkin
      Returns:
      the minimal resolution
    • getMaxResolution

      @NotNull public @NotNull Resolution getMaxResolution()
      Description copied from interface: JXCSkin
      Returns the maximal resolution of this skin.
      Specified by:
      getMaxResolution in interface JXCSkin
      Returns:
      the maximal resolution
    • getDialogQuit

      @Nullable public @Nullable Gui getDialogQuit()
      Description copied from interface: JXCSkin
      Returns the "really quit?" dialog. It is opened when the user presses ESCAPE.
      Specified by:
      getDialogQuit in interface JXCSkin
      Returns:
      the dialog or null if the dialog does not exist
    • getDialogDisconnect

      @Nullable public @Nullable Gui getDialogDisconnect()
      Description copied from interface: JXCSkin
      Returns the "disconnect from server?" dialog. It is opened when the user presses ESCAPE.
      Specified by:
      getDialogDisconnect in interface JXCSkin
      Returns:
      the dialog or null if the dialog does not exist
    • getDialogConnect

      @Nullable public @Nullable Gui getDialogConnect()
      Description copied from interface: JXCSkin
      Returns the "connection in progress" dialog. It is opened while the connection establishment is in progress.
      Specified by:
      getDialogConnect in interface JXCSkin
      Returns:
      the dialog or null if the dialog does not exist
    • getDialogKeyBind

      @NotNull public @NotNull Gui getDialogKeyBind()
      Description copied from interface: JXCSkin
      Returns the key bindings dialog.
      Specified by:
      getDialogKeyBind in interface JXCSkin
      Returns:
      the dialog
    • getDialogQuery

      @NotNull public @NotNull Gui getDialogQuery()
      Description copied from interface: JXCSkin
      Returns the dialog for query text input.
      Specified by:
      getDialogQuery in interface JXCSkin
      Returns:
      the dialog
    • getDialogBook

      @NotNull public @NotNull Gui getDialogBook(int bookNo)
      Description copied from interface: JXCSkin
      Returns the popup dialog for readables.
      Specified by:
      getDialogBook in interface JXCSkin
      Parameters:
      bookNo - the book ID
      Returns:
      the dialog
    • getMainInterface

      @NotNull public @NotNull Gui getMainInterface()
      Description copied from interface: JXCSkin
      Returns the main window.
      Specified by:
      getMainInterface in interface JXCSkin
      Returns:
      the dialog
    • getMetaInterface

      @NotNull public @NotNull Gui getMetaInterface()
      Description copied from interface: JXCSkin
      Returns the server selection window.
      Specified by:
      getMetaInterface in interface JXCSkin
      Returns:
      the dialog
    • getStartInterface

      @NotNull public @NotNull Gui getStartInterface()
      Description copied from interface: JXCSkin
      Returns the start window.
      Specified by:
      getStartInterface in interface JXCSkin
      Returns:
      the dialog
    • getDialog

      @NotNull public @NotNull Gui getDialog(@NotNull @NotNull String name) throws JXCSkinException
      Description copied from interface: JXCSkin
      Returns a dialog by name.
      Specified by:
      getDialog in interface JXCSkin
      Parameters:
      name - the dialog's name
      Returns:
      the dialog
      Throws:
      JXCSkinException - if the dialog does not exist
    • iterator

      @NotNull public @NotNull Iterator<Gui> iterator()
      Description copied from interface: JXCSkin
      Returns all gui instances of this skin. The instances have no defined order.
      Specified by:
      iterator in interface Iterable<Gui>
      Specified by:
      iterator in interface JXCSkin
      Returns:
      an iterator returning all gui instances
    • getCommandList

      @NotNull public @NotNull CommandList getCommandList(@NotNull @NotNull String name) throws JXCSkinException
      Description copied from interface: JXCSkin
      Returns a named command list.
      Specified by:
      getCommandList in interface JXCSkin
      Parameters:
      name - the name of the command list
      Returns:
      the command list
      Throws:
      JXCSkinException - if the command list does not exist
    • getCommandListNames

      @NotNull public @NotNull Collection<String> getCommandListNames()
      Description copied from interface: JXCSkin
      Returns the names of all named command lists.
      Specified by:
      getCommandListNames in interface JXCSkin
      Returns:
      the names in alphabetical order
    • getDefaultKeyBindings

      @NotNull public @NotNull KeyBindings getDefaultKeyBindings()
      Description copied from interface: JXCSkin
      Returns the default key bindings for this skin.
      Specified by:
      getDefaultKeyBindings in interface JXCSkin
      Returns:
      the default key bindings
    • attach

      public void attach(@NotNull @NotNull TooltipManagerImpl tooltipManager)
      Description copied from interface: JXCSkin
      Attaches this skin to a gui manager.
      Specified by:
      attach in interface JXCSkin
      Parameters:
      tooltipManager - the tooltip manager to attach to
    • detach

      public void detach()
      Description copied from interface: JXCSkin
      Frees all allocated resources.
      Specified by:
      detach in interface JXCSkin
    • insertGuiElement

      public void insertGuiElement(@NotNull @NotNull GUIElement guiElement)
      Adds a new GUIElement to this skin.
      Parameters:
      guiElement - the GUI element
    • addDialog

      public void addDialog(@NotNull @NotNull String dialogName)
      Defines a new dialog.
      Parameters:
      dialogName - the dialog's name
    • getDialogToLoad

      @Nullable public @Nullable String getDialogToLoad()
      Returns one dialog pending loading. Each dialog is returned only once.
      Returns:
      a dialog pending loading or null
    • addCommandList

      public void addCommandList(@NotNull @NotNull String commandListName, @NotNull @NotNull CommandListType commandListType) throws JXCSkinException
      Defines a new command list.
      Parameters:
      commandListName - the command list's name
      commandListType - the command list's type
      Throws:
      JXCSkinException - if the command list cannot be created
    • addInitEvent

      public void addInitEvent(@NotNull @NotNull CommandList commandList)
      Adds a command list to be executed on "init" events.
      Parameters:
      commandList - the command list
    • addOption

      public void addOption(@NotNull @NotNull String optionName, @NotNull @NotNull String documentation, @NotNull @NotNull Option commandCheckBoxOption) throws JXCSkinException
      Add a new option.
      Parameters:
      optionName - the option name to add
      documentation - the documentation string for the settings
      commandCheckBoxOption - the option instance to forward to
      Throws:
      JXCSkinException - if the option cannot be created
    • setTooltipLabel

      public void setTooltipLabel(@Nullable @Nullable AbstractLabel tooltipLabel)
      Sets the AbstractLabel that is used to display tooltips.
      Parameters:
      tooltipLabel - the label or null to disable tooltips
    • getTooltipLabel

      @Nullable public @Nullable AbstractLabel getTooltipLabel()
      Description copied from interface: JXCSkin
      Returns the AbstractLabel that is used to display tooltips.
      Specified by:
      getTooltipLabel in interface JXCSkin
      Returns:
      the label or null if tooltips are disabled
    • addSkinEvent

      public void addSkinEvent(@NotNull @NotNull SkinEvent skinEvent)
      Records a SkinEvent attached to this instance.
      Parameters:
      skinEvent - the skin event to add