java.lang.Objectcom.realtime.crossfire.jxclient.guistate.GuiStateManager
public class GuiStateManager
Maintains the current GuiState. Notifies registered listeners about
changes.
| Field Summary | |
|---|---|
private ClientSocketListener |
clientSocketListener
The ClientSocketListener used to detect connection state
changes. |
private CrossfireServerConnectionListener |
crossfireServerConnectionListener
The CrossfireServerConnectionListener used to detect connection
progress changes. |
private GuiState |
guiState
The current GUI state. |
private java.util.Collection<GuiStateListener> |
guiStateListeners
The connection state listeners to notify. |
private java.lang.Object |
sync
The synchronization object for accessing guiState. |
| Constructor Summary | |
|---|---|
GuiStateManager(CrossfireServerConnection crossfireServerConnection)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
addGuiStateListener(GuiStateListener listener)
Adds a gui state listener. |
void |
changeGUI(GuiState guiState)
Sets a new GuiState. |
private void |
changeGUI(GuiState guiState,
java.lang.String param)
Sets a new GuiState. |
void |
connect(java.lang.String serverInfo)
Connects to a Crossfire server. |
void |
disconnect()
Disconnects from the Crossfire server. |
GuiState |
getGuiState()
Returns the current GuiState. |
void |
removeGuiStateListener(GuiStateListener listener)
Removes a gui state listener. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NotNull private final ClientSocketListener clientSocketListener
ClientSocketListener used to detect connection state
changes.
@NotNull private final CrossfireServerConnectionListener crossfireServerConnectionListener
CrossfireServerConnectionListener used to detect connection
progress changes.
@Nullable private GuiState guiState
@NotNull private final java.util.Collection<GuiStateListener> guiStateListeners
@NotNull private final java.lang.Object sync
guiState.
| Constructor Detail |
|---|
public GuiStateManager(@NotNull
CrossfireServerConnection crossfireServerConnection)
crossfireServerConnection - the crossfire server connection to
monitor| Method Detail |
|---|
public void addGuiStateListener(@NotNull
GuiStateListener listener)
listener - the listener to addpublic void changeGUI(GuiState guiState)
GuiState.
guiState - the new gui state
private void changeGUI(@NotNull
GuiState guiState,
@Nullable
java.lang.String param)
GuiState.
guiState - the new gui stateparam - a parameter for the new gui state
public void connect(@NotNull
java.lang.String serverInfo)
serverInfo - the server to connect topublic void disconnect()
@Nullable public GuiState getGuiState()
GuiState.
public void removeGuiStateListener(@NotNull
GuiStateListener listener)
listener - the listener to remove