 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.label;
31 import java.awt.Color;
33 import java.util.regex.Pattern;
34 import org.jetbrains.annotations.NotNull;
35 import org.jetbrains.annotations.Nullable;
53 private static final Pattern
PATTERN_DIGITS = Pattern.compile(
"^([0-9]+ )?");
124 public GUINewcharLabel(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final String
name, @NotNull
final CrossfireServerConnection crossfireServerConnection, @NotNull
final Font font, @NotNull
final Font
fontError, @NotNull
final NewcharStat stat, @NotNull
final NewcharType type, @NotNull
final NewCharModel newCharModel, @NotNull
final Color color, @NotNull
final Color
colorError, @NotNull
final GuiFactory guiFactory) {
125 super(
tooltipManager,
elementListener,
name,
null, font, color, color,
null,
type ==
NewcharType.
ERROR ||
type ==
NewcharType.
CHAR_OPTION ?
Alignment.
LEFT :
Alignment.
RIGHT,
"",
guiFactory);
139 public void failure(@NotNull
final String command, @NotNull
final String arguments) {
144 public void clearFailure() {
200 setText(Integer.toString(total));
211 setText(Integer.toString(unusedPoints));
Interface for listeners interested in the "failure" messages received from the Crossfire server.
final NewCharModel newCharModel
The global NewCharModel instance.
int getPriority()
Returns the display priority of the related error message.
int getTotal(@NotNull final NewcharStat stat)
Returns the total points (sum of base, race, and class) for a stat.
final CrossfireServerConnection crossfireServerConnection
The CrossfireServerConnection to monitor.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
void addListener(@NotNull final NewCharModelListener listener)
Adds a listener to notify of changes.
void updateContents()
Updates the displayed information to show the current value.
final GUIElementListener elementListener
The GUIElementListener to notify.
final NewcharType type
The stat type to display.
String getChoiceDescription()
Returns the human-readable choice name.
String getErrorText()
Returns the error text to show.
final CrossfireFailureListener crossfireFailureListener
The CrossfireFailureListener registered to receive failure messages.
Font getTextFont()
Returns the font.
Interface for listeners interested in NewCharModel related changes.
void dispose()
Releases all allocated resources.
CHAR_OPTION
The description of the character option.
int getUnusedPoints()
Returns the number of unused attribute points.
A choice for character creation.
int getClassStatAdjustment(@NotNull final NewcharStat stat)
Returns the class points for a stat.
static final Pattern PATTERN_DIGITS
A Pattern that matches an optional digit prefix.
void setErrorText(final int priority, @Nullable final String text)
Sets an error text.
final Font fontError
The font for invalid values.
String getName()
Returns the display name.
void setText(@NotNull final String text)
Sets the label text.
final NewcharStat stat
The stat value to display.
General information for creating new characters.
final NewCharModelListener listener
The listener attached to newCharModel.
final GuiFactory guiFactory
The global GuiFactory instance.
int getRaceStatAdjustment(@NotNull final NewcharStat stat)
Returns the race points for a stat.
void removeListener(@NotNull final NewCharModelListener listener)
Removes a listener to be notified of changes.
static final int PRIORITY_SERVER_FAILURE
A priority value for setErrorText(int, String).
void notifyOpen()
Called each time the enclosing dialog is opened (or raised).
Factory for creating Gui instances.
final String name
The name of this element.
A GUIHTMLLabel that displays stat information in the character creation dialog.
boolean validValue
Whether a valid value is currently shown.
Choice getOption()
Returns the character options.
GUINewcharLabel(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final Font font, @NotNull final Font fontError, @NotNull final NewcharStat stat, @NotNull final NewcharType type, @NotNull final NewCharModel newCharModel, @NotNull final Color color, @NotNull final Color colorError, @NotNull final GuiFactory guiFactory)
Creates a new instance.
void removeCrossfireFailureListener(@NotNull CrossfireFailureListener listener)
Removes a listener to be notified of failure messages.
Color getTextColor()
Returns the text color.
final Color colorError
The color for invalid values.
final TooltipManager tooltipManager
The TooltipManager to update.
A AbstractLabel that renders the text as a plain string.
static final int PRIORITY_UNUSED_POINTS
A priority value for setErrorText(int, String).
static final long serialVersionUID
The serial version UID.
Listener for GUIElement related events.