22 package com.realtime.crossfire.jxclient.gui.misc;
34 import java.awt.Color;
36 import org.jetbrains.annotations.NotNull;
37 import org.jetbrains.annotations.Nullable;
75 public void commandDrawinfoReceived(@NotNull
final String
text,
final int type) {
92 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
100 public void setDebugMode(
final boolean printMessageTypes) {
118 super(tooltipManager, elementListener, name, null, font, color, backgroundColor,
Alignment.
LEFT,
"");
121 this.crossfireServerConnection.addCrossfireDrawinfoListener(crossfireDrawinfoListener);
122 this.crossfireServerConnection.addCrossfireDrawextinfoListener(crossfireDrawextinfoListener);
140 final StringBuilder sb =
new StringBuilder();
142 while (pos < text.length()) {
146 while (endPos < pos+MAX_LINE_LENGTH && endPos < text.length() && text.charAt(endPos) !=
'\n') {
150 if (endPos >= pos+MAX_LINE_LENGTH) {
152 int endPos2 = endPos;
153 while (endPos2 > pos) {
155 final int ch = text.charAt(endPos2);
161 sb.append(text.substring(pos, endPos2));
164 sb.append(text.substring(pos, endPos));
167 }
else if (endPos >= text.length()) {
169 sb.append(text.substring(pos));
172 assert text.charAt(endPos) ==
'\n';
174 sb.append(text.substring(pos, endPos));
178 super.setText(sb.length() > 0 ? sb.substring(1) :
"");
Listener for GUIElement related events.
static Gui getGui(@NotNull final Component element)
Returns the Gui an element is part of.
A AbstractLabel that renders the text as a list of plain strings.
Combines a list of GUIElements to for a gui.
final TooltipManager tooltipManager
The TooltipManager to update.
final CrossfireServerConnection crossfireServerConnection
The CrossfireServerConnection to monitor.
void dispose()
Releases all allocated resources.
Interface for listeners interested in drawinfo messages received from the Crossfire server...
final JXCWindowRenderer windowRenderer
The JXCWindowRenderer this element belongs to.
boolean isDialogOpen(@NotNull final Gui dialog)
Returns whether a given dialog is currently visible.
final GUIElementListener elementListener
The GUIElementListener to notify.
final Color backgroundColor
If set, the opaque background color.
final String name
The name of this element.
final CrossfireDrawinfoListener crossfireDrawinfoListener
The CrossfireDrawinfoListener registered to receive drawinfo messages.
Renders a Gui instance into a Frame.
static final long serialVersionUID
The serial version UID.
static final int MAX_LINE_LENGTH
The maximum line length in characters.
GUILabelMessage(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final Font font, @NotNull final Color color, @Nullable final Color backgroundColor)
Creates a new instance.
Utility class for Gui related functions.
A GUIHTMLLabel that displays the last received "drawinfo" message.
Interface for listeners interested in drawextinfo messages received from the Crossfire server...
String text
The label text.
Implements an AbstractLabel that displays HTML contents.
final CrossfireDrawextinfoListener crossfireDrawextinfoListener
The CrossfireDrawextinfoListener registered to receive drawextinfo messages.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
void removeCrossfireDrawinfoListener(@NotNull CrossfireDrawinfoListener listener)
Removes the given listener from the list of objects listening to the drawinfo S->C messages...
void removeCrossfireDrawextinfoListener(@NotNull CrossfireDrawextinfoListener listener)
Removes the given listener from the list of objects listening to the drawextinfo S->C messages...
void setText(@NotNull final String text)