java.lang.Object com.realtime.crossfire.jxclient.window.JXCConnection
public class JXCConnection
Field Summary | |
---|---|
private java.lang.String |
character
The currently logged in character. |
private Pickup |
characterPickup
The Pickup instance to update. |
private CrossfirePickupListener |
crossfirePickupListener
The CrossfirePickupListener for tracking pickup mode changes. |
private static int |
DEFAULT_CROSSFIRE_PORT
The default port number for Crossfire servers. |
private java.awt.Frame |
frame
The Frame for updating the title. |
private GuiStateListener |
guiStateListener
The GuiStateListener for detecting established or dropped
connections. |
private java.lang.String |
hostname
The currently connected server. |
private KeybindingsManager |
keybindingsManager
The KeybindingsManager to update. |
private int |
port
The currently connected port. |
private CrossfireServerConnection |
server
The CrossfireServerConnection instance used to connect to the
Crossfire server. |
private Settings |
settings
The settings instance to use. |
private Shortcuts |
shortcuts
The Shortcuts to update. |
private static java.lang.String |
TITLE_PREFIX
The prefix for the window title. |
Constructor Summary | |
---|---|
JXCConnection(KeybindingsManager keybindingsManager,
Shortcuts shortcuts,
Settings settings,
java.awt.Frame frame,
Pickup characterPickup,
CrossfireServerConnection server,
GuiStateManager guiStateManager)
Creates a new instance. |
Method Summary | |
---|---|
private void |
connect()
Connect to the Crossfire server. |
private void |
disconnect(java.lang.String reason)
Disconnects from the Crossfire server. |
java.lang.String |
getHostname()
Returns the currently connected server. |
int |
getPort()
Returns the currently connected port. |
void |
setCharacter(java.lang.String character)
Update the active character name. |
void |
setHost(java.lang.String serverInfo)
Update information about the connected host. |
private void |
updateTitle()
Update the window title to reflect the current connection state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Nullable private java.lang.String character
null
if not logged
in.
@NotNull private final Pickup characterPickup
Pickup
instance to update.
@NotNull private final CrossfirePickupListener crossfirePickupListener
CrossfirePickupListener
for tracking pickup mode changes.
private static final int DEFAULT_CROSSFIRE_PORT
@NotNull private final java.awt.Frame frame
Frame
for updating the title.
@NotNull private final GuiStateListener guiStateListener
GuiStateListener
for detecting established or dropped
connections.
@Nullable private java.lang.String hostname
null
if unconnected.
@NotNull private final KeybindingsManager keybindingsManager
KeybindingsManager
to update.
private int port
hostname
is set.
@NotNull private final CrossfireServerConnection server
CrossfireServerConnection
instance used to connect to the
Crossfire server.
@NotNull private final Settings settings
@NotNull private final Shortcuts shortcuts
Shortcuts
to update.
@NotNull private static final java.lang.String TITLE_PREFIX
Constructor Detail |
---|
public JXCConnection(@NotNull KeybindingsManager keybindingsManager, @NotNull Shortcuts shortcuts, @NotNull Settings settings, @NotNull java.awt.Frame frame, @NotNull Pickup characterPickup, @NotNull CrossfireServerConnection server, @NotNull GuiStateManager guiStateManager)
keybindingsManager
- the keybindings manager to updateshortcuts
- the shortcuts to updatesettings
- the settings instance to useframe
- the frame instance for updating the titlecharacterPickup
- the character pickup instance to updateserver
- the crossfire server connection instance used to connectguiStateManager
- the gui state manager to watchMethod Detail |
---|
private void connect()
private void disconnect(@NotNull java.lang.String reason)
reason
- the reason for the disconnect@Nullable public java.lang.String getHostname()
null
if unconnectedpublic int getPort()
0
if unconnectedpublic void setCharacter(@Nullable java.lang.String character)
character
- The active character; null
if not logged
in.public void setHost(@Nullable java.lang.String serverInfo)
serverInfo
- The hostname; null
if not connected.private void updateTitle()