java.lang.Objectcom.realtime.crossfire.jxclient.gui.log.MessageBufferUpdater
public class MessageBufferUpdater
Adds drawinfo, drawextinfo, and query messages to a Buffer instance.
| Field Summary | |
|---|---|
private Buffer |
buffer
The buffer to update. |
private static java.lang.String[] |
COLOR_NAMES
The colors names corresponding to colors. |
private java.awt.Color[] |
colors
Maps color index to color. |
private CrossfireDrawextinfoListener |
crossfireDrawextinfoListener
The CrossfireDrawextinfoListener registered to receive
drawextinfo commands. |
private CrossfireDrawinfoListener |
crossfireDrawinfoListener
The CrossfireDrawinfoListener registered to receive drawinfo
commands. |
private CrossfireQueryListener |
crossfireQueryListener
The CrossfireQueryListener registered to receive query commands. |
private CrossfireServerConnection |
crossfireServerConnection
The CrossfireServerConnection to monitor. |
private java.awt.Color |
defaultColor
The color to use for invalid colors indices. |
static int |
NUM_COLORS
The number of supported colors. |
private Parser |
parser
The Parser instance for parsing drawextinfo messages. |
private boolean |
printMessageTypes
Whether message types are included in the buffer output. |
private int |
types
The types to show. |
| Constructor Summary | |
|---|---|
MessageBufferUpdater(CrossfireServerConnection crossfireServerConnection,
Buffer buffer,
java.awt.Color defaultColor)
Creates a new instance. |
|
| Method Summary | |
|---|---|
private java.lang.CharSequence |
addMessageTypePrefix(int type,
int subtype,
java.lang.String message)
Adds a message type prefix to a message if printMessageTypes is
set. |
void |
dispose()
Releases resources. |
private java.awt.Color |
findColor(int index)
Converts a Crossfire color index to a Color instance. |
static java.lang.String |
getColorName(int index)
Returns the name of a color index. |
private boolean |
isTypeShown(int type)
Returns whether a message type should be shown. |
void |
setColor(int index,
java.awt.Color color)
Sets a color mapping. |
void |
setTypes(int types)
Sets the message types to show. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NotNull private final Buffer buffer
@NotNull private static final java.lang.String[] COLOR_NAMES
colors.
@NotNull private final java.awt.Color[] colors
@NotNull private final CrossfireDrawextinfoListener crossfireDrawextinfoListener
CrossfireDrawextinfoListener registered to receive
drawextinfo commands.
@NotNull private final CrossfireDrawinfoListener crossfireDrawinfoListener
CrossfireDrawinfoListener registered to receive drawinfo
commands.
@NotNull private final CrossfireQueryListener crossfireQueryListener
CrossfireQueryListener registered to receive query commands.
@NotNull private final CrossfireServerConnection crossfireServerConnection
CrossfireServerConnection to monitor.
@NotNull private final java.awt.Color defaultColor
public static final int NUM_COLORS
@NotNull private final Parser parser
Parser instance for parsing drawextinfo messages.
private boolean printMessageTypes
private int types
| Constructor Detail |
|---|
public MessageBufferUpdater(@NotNull
CrossfireServerConnection crossfireServerConnection,
@NotNull
Buffer buffer,
@NotNull
java.awt.Color defaultColor)
crossfireServerConnection - the connection instancebuffer - the buffer to updatedefaultColor - the default color to use for undefined colors
indices| Method Detail |
|---|
private java.lang.CharSequence addMessageTypePrefix(int type,
int subtype,
@NotNull
java.lang.String message)
printMessageTypes is
set.
type - the message typesubtype - the message subtypemessage - the message
public void dispose()
@NotNull private java.awt.Color findColor(int index)
Color instance.
index - the color index to look up
@NotNull public static java.lang.String getColorName(int index)
index - the color index
private boolean isTypeShown(int type)
type - the message type
public void setColor(int index,
@NotNull
java.awt.Color color)
index - the color index to changecolor - the color to map topublic void setTypes(int types)
types - the types to show