Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.guistate.GuiStateManager Class Reference

Maintains the current GuiState. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.guistate.GuiStateManager:

Public Member Functions

void addGuiStateListener (@NotNull final GuiStateListener listener)
 Adds a gui state listener. More...
 
void changeGUI (@NotNull final GuiState guiState)
 Sets a new GuiState. More...
 
void connect (@NotNull final String serverInfo)
 Connects to a Crossfire server. More...
 
void disconnect ()
 Disconnects from the Crossfire server. More...
 
void disconnected ()
 Called after the connection has been closed. More...
 
void disconnecting (@NotNull final String reason, final boolean isError)
 Called when the connection is being teared down. More...
 
GuiState getGuiState ()
 Returns the current GuiState. More...
 
void removeGuiStateListener (@NotNull final GuiStateListener listener)
 Removes a gui state listener. More...
 
void setClientSocketState (@NotNull final ClientSocketState clientSocketState)
 Sets the new ClientSocketState. More...
 

Private Member Functions

void changeGUI (@NotNull final GuiState guiState, @NotNull final String param)
 Sets a new GuiState. More...
 

Private Attributes

GuiState guiState
 The current GUI state. More...
 
final EventListenerList2< GuiStateListenerguiStateListeners = new EventListenerList2<>()
 The connection state listeners to notify. More...
 
final Object sync = new Object()
 The synchronization object for accessing guiState. More...
 

Detailed Description

Maintains the current GuiState.

Notifies registered listeners about changes.

Author
Andreas Kirschbaum

Definition at line 34 of file GuiStateManager.java.

Member Function Documentation

◆ addGuiStateListener()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.addGuiStateListener ( @NotNull final GuiStateListener  listener)

Adds a gui state listener.

Parameters
listenerthe listener to add

Definition at line 152 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.add().

Referenced by com.realtime.crossfire.jxclient.skin.events.ConnectionStateSkinEvent.ConnectionStateSkinEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeGUI() [1/2]

◆ changeGUI() [2/2]

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.changeGUI ( @NotNull final GuiState  guiState,
@NotNull final String  param 
)
private

Sets a new GuiState.

Parameters
guiStatethe new gui state
parama parameter for the new gui state

Definition at line 101 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.guistate.GuiStateManager.guiState, and com.realtime.crossfire.jxclient.guistate.GuiStateManager.sync.

◆ connect()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.connect ( @NotNull final String  serverInfo)

Connects to a Crossfire server.

Parameters
serverInfothe server to connect to

Definition at line 168 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.guistate.GuiStateManager.changeGUI(), and com.realtime.crossfire.jxclient.guistate.GuiState.CONNECTING.

Referenced by com.realtime.crossfire.jxclient.gui.commands.ConnectCommand.execute(), and com.realtime.crossfire.jxclient.main.JXClient.JXClient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disconnect()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.disconnect ( )

Disconnects from the Crossfire server.

Definition at line 175 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.guistate.GuiStateManager.changeGUI(), and com.realtime.crossfire.jxclient.guistate.GuiState.METASERVER.

Referenced by com.realtime.crossfire.jxclient.main.DefaultKeyHandler.escPressed(), and com.realtime.crossfire.jxclient.gui.commands.DisconnectCommand.execute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disconnected()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.disconnected ( )

◆ disconnecting()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.disconnecting ( @NotNull final String  reason,
final boolean  isError 
)

Called when the connection is being teared down.

Parameters
reasonthe disconnect reason
isErrorwhether the disconnect is unexpected

Definition at line 197 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.guistate.GuiStateManager.changeGUI(), com.realtime.crossfire.jxclient.guistate.GuiState.CONNECT_FAILED, com.realtime.crossfire.jxclient.guistate.GuiState.CONNECTED, com.realtime.crossfire.jxclient.guistate.GuiState.CONNECTING, and com.realtime.crossfire.jxclient.guistate.GuiStateManager.sync.

Referenced by com.realtime.crossfire.jxclient.server.socket.ClientSocket.processDisconnect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGuiState()

GuiState com.realtime.crossfire.jxclient.guistate.GuiStateManager.getGuiState ( )

Returns the current GuiState.

Returns
the gui state

Definition at line 142 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.guistate.GuiStateManager.guiState, and com.realtime.crossfire.jxclient.guistate.GuiStateManager.sync.

Referenced by com.realtime.crossfire.jxclient.main.DefaultKeyHandler.escPressed().

+ Here is the caller graph for this function:

◆ removeGuiStateListener()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.removeGuiStateListener ( @NotNull final GuiStateListener  listener)

Removes a gui state listener.

Parameters
listenerthe listener to remove

Definition at line 160 of file GuiStateManager.java.

References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.remove().

Referenced by com.realtime.crossfire.jxclient.skin.events.ConnectionStateSkinEvent.dispose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setClientSocketState()

void com.realtime.crossfire.jxclient.guistate.GuiStateManager.setClientSocketState ( @NotNull final ClientSocketState  clientSocketState)

Member Data Documentation

◆ guiState

GuiState com.realtime.crossfire.jxclient.guistate.GuiStateManager.guiState
private

◆ guiStateListeners

final EventListenerList2<GuiStateListener> com.realtime.crossfire.jxclient.guistate.GuiStateManager.guiStateListeners = new EventListenerList2<>()
private

The connection state listeners to notify.

Definition at line 52 of file GuiStateManager.java.

◆ sync


The documentation for this class was generated from the following file: