Class GuiStateManager
- java.lang.Object
-
- com.realtime.crossfire.jxclient.guistate.GuiStateManager
-
- Direct Known Subclasses:
SwingGuiStateManager
public abstract class GuiStateManager extends java.lang.ObjectMaintains the currentGuiState. Notifies registered listeners about changes.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGuiStateManager()Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddGuiStateListener(@NotNull GuiStateListener listener)Adds a gui state listener.voidchangeGUI(@NotNull GuiState guiState)Sets a newGuiState.voidconnect(@NotNull java.lang.String serverInfo)Connects to a Crossfire server.voiddisconnect()Disconnects from the Crossfire server.voiddisconnected()Called after the connection has been closed.voiddisconnecting(@NotNull java.lang.String reason, boolean isError)Called when the connection is being teared down.protected abstract voiddoChangeGUI(@NotNull java.lang.Runnable runnable)Calls theRunnable.@Nullable GuiStategetGuiState()Returns the currentGuiState.voidremoveGuiStateListener(@NotNull GuiStateListener listener)Removes a gui state listener.voidsetClientSocketState(@NotNull ClientSocketState clientSocketState)Sets the newClientSocketState.
-
-
-
Method Detail
-
changeGUI
public void changeGUI(@NotNull @NotNull GuiState guiState)Sets a newGuiState.- Parameters:
guiState- the new gui state
-
doChangeGUI
protected abstract void doChangeGUI(@NotNull @NotNull java.lang.Runnable runnable)Calls theRunnable.- Parameters:
runnable- the runnable
-
getGuiState
@Nullable public @Nullable GuiState getGuiState()
Returns the currentGuiState.- 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 newClientSocketState.- 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 reasonisError- whether the disconnect is unexpected
-
disconnected
public void disconnected()
Called after the connection has been closed.
-
-