|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectanecho.JamochaMUD.CHandler
public final class CHandler
To allow an easier time of dealing with multiple connections, any input or output from JamochaMUD will pass through the CHandler class. This class will then determine which MU* the outbound traffic will go out (eg. the "active" MU* if from the DataIn window) or the appropriate window to send incoming traffic based on the socket it is received from. CHandler now extends the Container class so that it can act as it's own autonomous "widget" coordinating views of MU*s and their actual connections. CHandler will "hold" the actual MuSockets but for considering which connection is visible/active, we will always ask our display object, be it the JMTextPanel or the JTabbedPane.
| Method Summary | |
|---|---|
void |
addNewMU(java.lang.String name,
java.lang.String address,
int port,
MuSocket msock)
Add the text display component owned by the given MuSocket to our display object. |
void |
closeActiveMU(java.lang.String stamp)
Close the connection to the active MU* |
void |
closeSocket(MuSocket socket)
Close and "destroy" an existing socket. |
void |
connectToNewMU()
Show MU* Connector and set-up a connection to a new MU* |
void |
connectToNewMU(java.lang.String muName,
java.lang.String address,
int port)
|
JMSwingText |
getActiveMUDSwingText()
This returns the active JMSwingText |
JMText |
getActiveMUDText()
Deprecated. use JMText getActiveMUDText(String stamp) |
JMText |
getActiveMUDText(java.lang.String stamp)
Return the active JMText component, verified with the passed timestamp |
MuSocket |
getActiveMUHandle()
Return the MuSocket for the currently "active" MU* |
int |
getActiveMUIndex()
Return the index of the active MU |
java.lang.String |
getActiveTitle()
Return the title of the active MU* |
java.util.Vector |
getAllMUs()
Return an array of all the MU*s. |
static CHandler |
getInstance()
Returns an instance of this class if it has already been instantiated. |
MuSocket |
getMUHandle(int muNum)
Return the proper MuSocket for the requested mu |
java.awt.Component |
getTextObject()
Deprecated. This method has been moved to MuckMain and broken into three separate methods: getTextPanel(), getFancyTextPanel(), and getLegacyTextPanel() |
java.lang.String |
getTitle(int index)
Return the title of the MU based on the given index |
boolean |
isActiveMU(MuSocket mSock)
Determines if the given MU* is the currently active MU*. |
boolean |
isActiveMUDConnected()
Return the connection status of the active MU* |
boolean |
isActiveMUEchoState()
Return the ECHO state for the active MU* |
void |
nextMU()
Make the next MU* in the list the active MU* The process that makes the call to this method is responsible for updating the display appropriately |
MuSocket |
openSocket(java.lang.String name,
java.lang.String address,
int port,
boolean ssl)
Create a new MuSocket that will be set-up with the supplied information and start its thread. |
void |
previousMU()
Make the previous MU* in the list the active MU*. |
void |
reconnectToMU()
Reconnect to the currently active (visible) MU* |
void |
removeActiveMU(java.lang.String stamp)
Remove the active MU* from our list altogether |
void |
removeMU(MuSocket mSock)
Remove the MU* indicated by the MuSocket and timeStamp |
void |
sendText(java.lang.String send)
Send the text to the currently active MU* |
void |
sendText(java.lang.String send,
MuSocket msock)
Send a string to the supplied MU*, using the proper encoding method (ASCII or Unicode) |
void |
setActiveMU(int target)
Sets the active MU* (the MU* visible to the user) based on the index number provided. |
void |
setAllAttribs(java.awt.Font fontFace,
java.awt.Color fgColour,
java.awt.Color bgColour,
java.awt.Color[] newPal)
Change the font face and size on all the connections |
void |
setAllColours(java.awt.Color fgColour,
java.awt.Color bgColour)
Set the foreground and background colours for all the MU*s. |
void |
setAllFonts(java.awt.Font newStyle)
Set the Font for all active MU*s |
void |
setAntiAliasing(boolean state)
Change between aliased and antialised text in our output windows. |
void |
setCustomPalette(java.awt.Color[] newPal)
This method sets the custom colours to be used on all our MU* windows. |
void |
setDoubleBuffer(boolean state)
Change the drawing type for the JMText... |
void |
setLogging(boolean state)
Activate or deactivate logging in all connections |
void |
setLowColour(boolean state)
Set the MU* displays to operating in either "low colour" (8 colours, normal and bold) or "high colour" (16 colours). |
void |
showLatestMU()
This method displays the last MU* connected to that is still open. |
int |
totalConnections()
Get the total number of MU*s open regardless of their connection status |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static CHandler getInstance()
public java.awt.Component getTextObject()
public void setActiveMU(int target)
target - The index number repesenting which MU* should be set active.public void showLatestMU()
public void addNewMU(java.lang.String name,
java.lang.String address,
int port,
MuSocket msock)
name - The human-readable name of the MU*address - The numeric or human-readable address for the MU* serverport - The MU* server port to connect tomsock - The MuSocket which is responsible for communicating between
JamochaMUD the new MU*.
public MuSocket openSocket(java.lang.String name,
java.lang.String address,
int port,
boolean ssl)
ssl - Returns whether the connection is to be encrypted (SSL)
or plain text.
true - encrypted connection
false - plain text connectionname - The human-readable name for the new MU*address - The human-readable or numeric address for the MU* serverport - The MU* server port to connect to
public void nextMU()
public void previousMU()
public void closeActiveMU(java.lang.String stamp)
stamp - Timestamp of MU* to be closed (as confirmation)public void removeActiveMU(java.lang.String stamp)
stamp - This is the time stamp used to verify that we are closing
the proper MU*.public void removeMU(MuSocket mSock)
mSock - The MuSocket to close and removepublic void closeSocket(MuSocket socket)
socket - The socket to be closed.public JMText getActiveMUDText()
public JMSwingText getActiveMUDSwingText()
public JMText getActiveMUDText(java.lang.String stamp)
stamp - A timestamp to verify the component returned
public int getActiveMUIndex()
public java.lang.String getTitle(int index)
index - Index representing the MU* we are to retrieve the title of.
indexpublic MuSocket getMUHandle(int muNum)
muNum - This variable represents the index of the MU* to retrieve
muNumpublic MuSocket getActiveMUHandle()
public boolean isActiveMUDConnected()
throws java.lang.Exception
true - The active MU* is connected to a server
false - The active MU* is not connected to a server
java.lang.Exception - if there are no current connectionspublic void sendText(java.lang.String send)
send -
public void sendText(java.lang.String send,
MuSocket msock)
send - The String to be sent to the active MU*msock -
public void setAllAttribs(java.awt.Font fontFace,
java.awt.Color fgColour,
java.awt.Color bgColour,
java.awt.Color[] newPal)
newPal - This array represents the colour palette that is to be usedfontFace - The Font to use for the display.fgColour - The foreground colour to usebgColour - The background colour to usepublic void setLogging(boolean state)
state - true - enable logging
false - disable logging
public void setAllColours(java.awt.Color fgColour,
java.awt.Color bgColour)
fgColour - The foreground colour to usebgColour - The background colour to usepublic void setCustomPalette(java.awt.Color[] newPal)
newPal - An array containing our new Colors.public void setAllFonts(java.awt.Font newStyle)
newStyle - The Font style to use
public void connectToNewMU(java.lang.String muName,
java.lang.String address,
int port)
muName - address - port - public void connectToNewMU()
public int totalConnections()
public boolean isActiveMU(MuSocket mSock)
mSock - The MuSocket to check to see if it is current the active MU*.
true - the provided MU* is the active MU*
false - the provided MU* is not the active MU*public java.lang.String getActiveTitle()
public void setDoubleBuffer(boolean state)
state - true - set the display to double buffer
false - set the display to work without bufferingpublic void setAntiAliasing(boolean state)
state - true - enable antialiasing
false - disalbe antialiasingpublic void setLowColour(boolean state)
state - true - set the display to low colour mode
false - set display to high colour modepublic boolean isActiveMUEchoState()
true - the active MU* echo mode is enabled
false - the active MU* is not in echo modepublic void reconnectToMU()
public java.util.Vector getAllMUs()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||