Class GuiStateManager

  • Direct Known Subclasses:
    SwingGuiStateManager

    public abstract class GuiStateManager
    extends java.lang.Object
    Maintains the current GuiState. Notifies registered listeners about changes.
    • Constructor Detail

      • GuiStateManager

        protected GuiStateManager()
        Creates a new instance.
    • Method Detail

      • changeGUI

        public void changeGUI​(@NotNull
                              @NotNull GuiState guiState)
        Sets a new GuiState.
        Parameters:
        guiState - the new gui state
      • doChangeGUI

        protected abstract void doChangeGUI​(@NotNull
                                            @NotNull java.lang.Runnable runnable)
        Calls the Runnable.
        Parameters:
        runnable - the runnable
      • getGuiState

        @Nullable
        public @Nullable GuiState getGuiState()
        Returns the current GuiState.
        Returns:
        the gui state
      • addGuiStateListener

        public void addGuiStateListener​(@NotNull
                                        @NotNull GuiStateListener listener)
        Adds a gui state listener.
        Parameters:
        listener - the listener to add
      • removeGuiStateListener

        public void removeGuiStateListener​(@NotNull
                                           @NotNull GuiStateListener listener)
        Removes a gui state listener.
        Parameters:
        listener - the listener to remove
      • connect

        public void connect​(@NotNull
                            @NotNull java.lang.String serverInfo)
        Connects to a Crossfire server.
        Parameters:
        serverInfo - the server to connect to
      • disconnect

        public void disconnect()
        Disconnects from the Crossfire server.
      • setClientSocketState

        public void setClientSocketState​(@NotNull
                                         @NotNull ClientSocketState clientSocketState)
        Sets the new ClientSocketState.
        Parameters:
        clientSocketState - the new state
      • disconnecting

        public void disconnecting​(@NotNull
                                  @NotNull java.lang.String reason,
                                  boolean isError)
        Called when the connection is being teared down.
        Parameters:
        reason - the disconnect reason
        isError - whether the disconnect is unexpected
      • disconnected

        public void disconnected()
        Called after the connection has been closed.