Class GuiStateManager
java.lang.Object
com.realtime.crossfire.jxclient.guistate.GuiStateManager
- Direct Known Subclasses:
SwingGuiStateManager
Maintains the current
GuiState. Notifies registered listeners about
changes.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddGuiStateListener(@NotNull GuiStateListener listener) Adds a gui state listener.voidSets a newGuiState.voidConnects to a Crossfire server.voidDisconnects from the Crossfire server.voidCalled after the connection has been closed.voiddisconnecting(@NotNull String reason, boolean isError) Called when the connection is being torn down.protected abstract voiddoChangeGUI(@NotNull Runnable runnable) Calls theRunnable.@Nullable GuiStateReturns the currentGuiState.voidremoveGuiStateListener(@NotNull GuiStateListener listener) Removes a gui state listener.voidsetClientSocketState(@NotNull ClientSocketState clientSocketState, @NotNull String param) Sets the newClientSocketState.
-
Constructor Details
-
GuiStateManager
protected GuiStateManager()Creates a new instance.
-
-
Method Details
-
changeGUI
Sets a newGuiState.- Parameters:
guiState- the new gui state
-
doChangeGUI
Calls theRunnable.- Parameters:
runnable- the runnable
-
getGuiState
Returns the currentGuiState.- Returns:
- the gui state
-
addGuiStateListener
Adds a gui state listener.- Parameters:
listener- the listener to add
-
removeGuiStateListener
Removes a gui state listener.- Parameters:
listener- the listener to remove
-
connect
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, @NotNull @NotNull String param) Sets the newClientSocketState.- Parameters:
clientSocketState- the new stateparam- additional information; currently only used in stateClientSocketState.REQUESTINFO
-
disconnecting
Called when the connection is being torn down.- Parameters:
reason- the disconnect reasonisError- whether the disconnect is unexpected
-
disconnected
public void disconnected()Called after the connection has been closed.
-