anecho.JamochaMUD
Class MuSocket

java.lang.Object
  extended by java.lang.Thread
      extended by anecho.JamochaMUD.MuSocket
All Implemented Interfaces:
TelnetEventListener, java.awt.event.MouseListener, java.lang.Runnable, java.util.EventListener

public class MuSocket
extends java.lang.Thread
implements java.awt.event.MouseListener, TelnetEventListener


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MuSocket()
          The constructor.
 
Method Summary
 void closeSocket()
          Allow other classes to close our socket
 void enableBackgroundPainting(boolean state)
          Enable / disable the ability for the MU* component to paint background colours
 java.lang.String getAddress()
           
 java.lang.String getConnectString()
          Returns to string used to connect to this socket
 java.lang.String getMUName()
          This returns the true name of the MU*, regardless of our connection
 int getPort()
           
 JMSwingText getSwingTextWindow()
           
 JMText getTextWindow()
           
 long getTimeStamp()
           
 java.lang.String getTitle()
          getTitle does a small bit of book-keeping, returning a title based on whether we're connected to the MU* or not.
 boolean isAutoConnect()
          Indicates whether this connection is set to auto connect
 boolean isConnectionActive()
          Return the status of our connection:
 boolean isEchoState()
          Return the state of our "echo"
 boolean isLogging()
          Return our auto-logging status
 boolean isMCCP()
           
 boolean isPaused()
          Return the fact that our connection is either paused -
 boolean isSSL()
           
 void mouseClicked(java.awt.event.MouseEvent mEvent)
           
 void mouseEntered(java.awt.event.MouseEvent mEvent)
           
 void mouseExited(java.awt.event.MouseEvent mEvent)
           
 void mousePressed(java.awt.event.MouseEvent mEvent)
           
 void mouseReleased(java.awt.event.MouseEvent mEvent)
           
 void resetTitle()
          Call this to reset the frame's title to the "standard" title.
 void run()
          This is the main method for our thread.
 void sendText(java.lang.String send)
          Send text out to our MU*
 void setActiveMU(boolean status)
          Indicate that this MU active or inactive
 void setAddress(java.lang.String address)
          The Address of our connection
 void setAutoConnect(boolean status)
           
 void setConnectString(java.lang.String connStr)
           
 void setEchoState(boolean state)
           
 void setLogging(boolean status)
          Enable or disable auto-logging
 void setMCCP(boolean status)
           
 void setMUName(java.lang.String newName)
          The name of our connection
 void setPaused(boolean option)
          Set the paused status of our text area
 void setPort(int port)
          The currentPort our connection will connect to
 void setSSL(boolean ssl)
           
 void setTimeStamp(long time)
          The timestamp of our connection, for internal use mostly
 void spoolText()
          Write any "held" text out to the user's display.
 void telnetMessageReceived(TelnetEvent event)
          Custom telnet message receiver for our TelnetEventListener
 void validate()
           
 void write(java.lang.String output)
          Write out given text to our text component with-out sending it to the MU*.
 void write(java.lang.String output, boolean skip)
          Write out given text to our text component with-out sending it to the MU*.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MuSocket

public MuSocket()
The constructor. Behold!!

Method Detail

mousePressed

public void mousePressed(java.awt.event.MouseEvent mEvent)
Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
mEvent -

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent mEvent)
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
mEvent -

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent mEvent)
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
mEvent -

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent mEvent)
Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
mEvent -

mouseExited

public void mouseExited(java.awt.event.MouseEvent mEvent)
Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
mEvent -

setMUName

public void setMUName(java.lang.String newName)
The name of our connection

Parameters:
newName -

getTitle

public java.lang.String getTitle()
getTitle does a small bit of book-keeping, returning a title based on whether we're connected to the MU* or not. If we're not connected then we'll return "JamochaMUD" instead of the name

Returns:

getMUName

public java.lang.String getMUName()
This returns the true name of the MU*, regardless of our connection

Returns:

resetTitle

public void resetTitle()
Call this to reset the frame's title to the "standard" title. This is usually just the location


setAddress

public void setAddress(java.lang.String address)
The Address of our connection

Parameters:
address -

getAddress

public java.lang.String getAddress()
Returns:

setPort

public void setPort(int port)
The currentPort our connection will connect to

Parameters:
port - The port number to connect to

getPort

public int getPort()
Returns:

setSSL

public void setSSL(boolean ssl)
Parameters:
ssl -

isSSL

public boolean isSSL()
Returns:

setTimeStamp

public void setTimeStamp(long time)
The timestamp of our connection, for internal use mostly

Parameters:
time -

getTimeStamp

public long getTimeStamp()
Returns:

run

public void run()
This is the main method for our thread. Veryvery important! Basically, it'll be a big loop that only gets broken when our connection disappears... either from the socket's end or the user's end

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getTextWindow

public JMText getTextWindow()
Returns:

getSwingTextWindow

public JMSwingText getSwingTextWindow()
Returns:

sendText

public void sendText(java.lang.String send)
Send text out to our MU*

Parameters:
send -

isConnectionActive

public boolean isConnectionActive()
Return the status of our connection:

Returns:
true - Connected false - Not connected

closeSocket

public void closeSocket()
Allow other classes to close our socket


setPaused

public void setPaused(boolean option)
Set the paused status of our text area

Parameters:
option -

isPaused

public boolean isPaused()
Return the fact that our connection is either paused -
true

or not paused -
false

Returns:

spoolText

public void spoolText()
Write any "held" text out to the user's display.


setActiveMU

public void setActiveMU(boolean status)
Indicate that this MU active or inactive

Parameters:
status -

validate

public void validate()

isEchoState

public boolean isEchoState()
Return the state of our "echo"

Returns:

setEchoState

public void setEchoState(boolean state)

write

public void write(java.lang.String output)
Write out given text to our text component with-out sending it to the MU*.

Parameters:
output - The string to be written to the user output

write

public void write(java.lang.String output,
                  boolean skip)
Write out given text to our text component with-out sending it to the MU*.

Parameters:
output - The string to be written to the user output
skip - Indicate if the string should be processed by the output plug-ins

enableBackgroundPainting

public void enableBackgroundPainting(boolean state)
Enable / disable the ability for the MU* component to paint background colours

Parameters:
state - true enables background colour painting false disables background colour painting

telnetMessageReceived

public void telnetMessageReceived(TelnetEvent event)
Custom telnet message receiver for our TelnetEventListener

Specified by:
telnetMessageReceived in interface TelnetEventListener
Parameters:
event -

setLogging

public void setLogging(boolean status)
Enable or disable auto-logging

Parameters:
status -

isLogging

public boolean isLogging()
Return our auto-logging status

Returns:

setAutoConnect

public void setAutoConnect(boolean status)
Parameters:
status -

isAutoConnect

public boolean isAutoConnect()
Indicates whether this connection is set to auto connect

Returns:
true auto-connect is enabled false auto-connect is not enabled

setConnectString

public void setConnectString(java.lang.String connStr)
Parameters:
connStr -

getConnectString

public java.lang.String getConnectString()
Returns to string used to connect to this socket

Returns:

setMCCP

public void setMCCP(boolean status)
Parameters:
status -

isMCCP

public boolean isMCCP()
Returns: