Crossfire JXClient, Trunk
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.gui.textinput.GUIText Class Referenceabstract
Inheritance diagram for com.realtime.crossfire.jxclient.gui.textinput.GUIText:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.gui.textinput.GUIText:
Collaboration graph

Public Member Functions

Dimension getMaximumSize ()
 
Dimension getMinimumSize ()
 
Dimension getPreferredSize ()
 
String getText ()
 
boolean keyPressed (@NotNull final KeyEvent2 e)
 
void mouseClicked (@NotNull final MouseEvent e)
 
void paintComponent (@NotNull final Graphics g)
 
void setHideInput (final boolean hideInput)
 
void setText (@NotNull final String text)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement
void activateNextElement ()
 
void activatePrevElement ()
 
abstract void execute ()
 
boolean isActive ()
 
void mousePressed (@NotNull final MouseEvent e)
 
void setActive (final boolean active)
 
void setNextActive (@NotNull final ActivatableGUIElement next)
 
void setPrevActive (@NotNull final ActivatableGUIElement prev)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
void dispose ()
 
int getDialogBorderBottom ()
 
int getDialogBorderLeft ()
 
int getDialogBorderRight ()
 
int getDialogBorderTop ()
 
String getName ()
 
abstract TooltipText getTooltip ()
 
void inhibitListeners ()
 
boolean isDefault ()
 
boolean isIgnore ()
 
void mouseDragged (@NotNull final MouseEvent e)
 
void mouseEntered (@NotNull final MouseEvent e)
 
void mouseExited (@NotNull final MouseEvent e)
 
void mouseMoved (@NotNull final MouseEvent e)
 
void mouseReleased (@NotNull final MouseEvent e)
 
void mouseWheelMoved (final int wheelRotation)
 
void setChanged ()
 
void setChangedListener (@Nullable final GUIElementChangedListener changedListener)
 
void setDefault (final boolean isDefault)
 
void setIgnore ()
 
String toString ()
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.GUIElement
void notifyOpen ()
 

Protected Member Functions

void activeChanged ()
 
abstract void execute (@NotNull final String command)
 
 GUIText (@NotNull final CommandCallback commandCallback, @Nullable final CommandHistory commandHistory, @NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final NewCharModel newCharModel, @NotNull final Image activeImage, @NotNull final Image inactiveImage, @NotNull final Font font, @NotNull final Color inactiveColor, @NotNull final Color activeColor, final int margin, @NotNull final String text, @NotNull final GuiFactory guiFactory)
 
- Protected Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement
 ActivatableGUIElement (@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final boolean opaque, @NotNull final GuiFactory guiFactory)
 
void markInactivePending ()
 
void setInactiveIfPending ()
 
- Protected Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
 AbstractGUIElement (@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final boolean opaque, @NotNull final GuiFactory guiFactory)
 
TooltipText newTooltipText (@Nullable final String tooltipText)
 
void tooltipChanged ()
 

Private Member Functions

void copy ()
 
String getDisplayText ()
 
boolean historyNext ()
 
boolean historyPrev ()
 
void insertChar (final char ch)
 
void insertString (@NotNull final String str)
 
void paste ()
 
void setCursor (final int cursor)
 
void updateErrorText ()
 

Private Attributes

final Color activeColor
 
final Image activeImage
 
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
 
final CommandCallback commandCallback
 
final CommandHistory commandHistory
 
int cursor
 
final Font font
 
boolean hideInput
 
final Color inactiveColor
 
final Image inactiveImage
 
final int margin
 
final NewCharModel newCharModel
 
int offset
 
final Dimension preferredSize
 
final Clipboard selection = Toolkit.getDefaultToolkit().getSystemSelection()
 
final Object syncCursor = new Object()
 
final StringBuilder text
 

Static Private Attributes

static final int SCROLL_CHARS = 8
 
static final long serialVersionUID = 1
 

Detailed Description

Abstract base class for text input fields. It allows entering and editing text. Subclasses define the behavior when execute(String) executing the entered text when

ENTER

is pressed.

Author
Lauwenmark
Andreas Kirschbaum

Definition at line 61 of file GUIText.java.

Constructor & Destructor Documentation

◆ GUIText()

com.realtime.crossfire.jxclient.gui.textinput.GUIText.GUIText ( @NotNull final CommandCallback  commandCallback,
@Nullable final CommandHistory  commandHistory,
@NotNull final TooltipManager  tooltipManager,
@NotNull final GUIElementListener  elementListener,
@NotNull final String  name,
@NotNull final NewCharModel  newCharModel,
@NotNull final Image  activeImage,
@NotNull final Image  inactiveImage,
@NotNull final Font  font,
@NotNull final Color  inactiveColor,
@NotNull final Color  activeColor,
final int  margin,
@NotNull final String  text,
@NotNull final GuiFactory  guiFactory 
)
protected

Creates a new instance.

Parameters
commandCallbackthe command callback to use
commandHistorythe command history to use or
null
to disable command history access
tooltipManagerthe tooltip manager to update
elementListenerthe element listener to notify
namethe name of this element
newCharModelthe new char model to show
activeImagethe element's background image when it is active
inactiveImagethe element's background image when it is inactive
fontthe font for rendering displayed text
inactiveColorthe color for rendering displayed text when the element is active; also cursor color
activeColorthe color for rendering displayed text when the element is active
marginthe left margin in pixels
textthe initially entered text
guiFactorythe global GUI factory instance

Definition at line 196 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.activeColor, com.realtime.crossfire.jxclient.gui.textinput.GUIText.activeImage, com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandCallback, com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandHistory, com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.elementListener, com.realtime.crossfire.jxclient.gui.textinput.GUIText.font, com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.guiFactory, com.realtime.crossfire.jxclient.gui.textinput.GUIText.inactiveColor, com.realtime.crossfire.jxclient.gui.textinput.GUIText.inactiveImage, com.realtime.crossfire.jxclient.gui.textinput.GUIText.margin, com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.name, com.realtime.crossfire.jxclient.gui.textinput.GUIText.newCharModel, com.realtime.crossfire.jxclient.gui.textinput.GUIText.preferredSize, com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.setChangedListener(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.text, com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.tooltipManager, and com.realtime.crossfire.jxclient.gui.textinput.GUIText.updateErrorText().

Here is the call graph for this function:

Member Function Documentation

◆ activeChanged()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.activeChanged ( )
protected

Will be called whenever the active state has changed.

Reimplemented from com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.

Definition at line 334 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.setChanged().

Here is the call graph for this function:

◆ copy()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.copy ( )
private

◆ execute()

abstract void com.realtime.crossfire.jxclient.gui.textinput.GUIText.execute ( @NotNull final String  command)
abstractprotected

◆ getDisplayText()

String com.realtime.crossfire.jxclient.gui.textinput.GUIText.getDisplayText ( )
private

Returns the displayed text. The displayed text may differ from the entered text as it may be clipped left because the input field is scrolled or because the input field is a password field that hides input.

Returns
the displayed text

Definition at line 299 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.hideInput, com.realtime.crossfire.jxclient.gui.textinput.GUIText.offset, and com.realtime.crossfire.jxclient.gui.textinput.GUIText.text.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.paintComponent(), and com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor().

Here is the caller graph for this function:

◆ getMaximumSize()

Dimension com.realtime.crossfire.jxclient.gui.textinput.GUIText.getMaximumSize ( )

◆ getMinimumSize()

Dimension com.realtime.crossfire.jxclient.gui.textinput.GUIText.getMinimumSize ( )

◆ getPreferredSize()

Dimension com.realtime.crossfire.jxclient.gui.textinput.GUIText.getPreferredSize ( )

◆ getText()

String com.realtime.crossfire.jxclient.gui.textinput.GUIText.getText ( )

◆ historyNext()

boolean com.realtime.crossfire.jxclient.gui.textinput.GUIText.historyNext ( )
private

Activates the next command from the command history.

Returns
whether command history access is enabled

Definition at line 477 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandHistory, com.realtime.crossfire.jxclient.settings.CommandHistory.down(), and com.realtime.crossfire.jxclient.gui.textinput.GUIText.setText().

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.keyPressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ historyPrev()

boolean com.realtime.crossfire.jxclient.gui.textinput.GUIText.historyPrev ( )
private

Activates the previous command from the command history.

Returns
whether command history access is enabled

Definition at line 462 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandHistory, com.realtime.crossfire.jxclient.gui.textinput.GUIText.setText(), and com.realtime.crossfire.jxclient.settings.CommandHistory.up().

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.keyPressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertChar()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.insertChar ( final char  ch)
private

Inserts a character at the cursor position.

Parameters
chthe character

Definition at line 490 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.cursor, com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.syncCursor, and com.realtime.crossfire.jxclient.gui.textinput.GUIText.text.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.keyPressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertString()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.insertString ( @NotNull final String  str)
private

Inserts a string at the cursor position.

Parameters
strthe string

Definition at line 501 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.cursor, com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.syncCursor, and com.realtime.crossfire.jxclient.gui.textinput.GUIText.text.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.paste().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyPressed()

boolean com.realtime.crossfire.jxclient.gui.textinput.GUIText.keyPressed ( @NotNull final KeyEvent2  e)

Invoked when a key has been pressed.

Parameters
ethe key event for the key
Returns
whether the key event has been consumed

Implements com.realtime.crossfire.jxclient.gui.gui.KeyPressedHandler.

Definition at line 339 of file GUIText.java.

References com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandCallback, com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandHistory, com.realtime.crossfire.jxclient.gui.textinput.GUIText.copy(), com.realtime.crossfire.jxclient.gui.keybindings.KeyEvent2.CTRL, com.realtime.crossfire.jxclient.gui.textinput.GUIText.cursor, com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.execute(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.hideInput, com.realtime.crossfire.jxclient.gui.textinput.GUIText.historyNext(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.historyPrev(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.insertChar(), com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.markInactivePending(), com.realtime.crossfire.jxclient.gui.keybindings.KeyEvent2.MASK, com.realtime.crossfire.jxclient.gui.textinput.GUIText.paste(), com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.setChanged(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor(), com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.setInactiveIfPending(), com.realtime.crossfire.jxclient.gui.textinput.GUIText.syncCursor, com.realtime.crossfire.jxclient.gui.textinput.GUIText.text, and com.realtime.crossfire.jxclient.gui.textinput.CommandCallback.updatePlayerName().

Here is the call graph for this function:

◆ mouseClicked()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.mouseClicked ( @NotNull final MouseEvent  e)

Will be called when the user has clicked (pressed+released) this element. This event will be delivered after mouseReleased(MouseEvent).

Parameters
ethe mouse event relative to this element

Reimplemented from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.

Definition at line 311 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.gui.ActivatableGUIElement.setActive(), and com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.setChanged().

Here is the call graph for this function:

◆ paintComponent()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.paintComponent ( @NotNull final Graphics  g)

◆ paste()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.paste ( )
private

Performs a "paste" operation from the system clipboard.

Definition at line 587 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.clipboard, com.realtime.crossfire.jxclient.gui.textinput.GUIText.insertString(), and com.realtime.crossfire.jxclient.gui.textinput.GUIText.selection.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.keyPressed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCursor()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor ( final int  cursor)
private

◆ setHideInput()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.setHideInput ( final boolean  hideInput)

Enables or disables hidden text.

Parameters
hideInputif set, hide input; else show input

Definition at line 518 of file GUIText.java.

References com.realtime.crossfire.jxclient.gui.textinput.GUIText.hideInput, and com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.setChanged().

Referenced by com.realtime.crossfire.jxclient.skin.io.JXCSkinLoader.parseHideInput(), and com.realtime.crossfire.jxclient.window.GuiManager.setHideInput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setText()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.setText ( @NotNull final String  text)

◆ updateErrorText()

void com.realtime.crossfire.jxclient.gui.textinput.GUIText.updateErrorText ( )
private

Member Data Documentation

◆ activeColor

final Color com.realtime.crossfire.jxclient.gui.textinput.GUIText.activeColor
private

◆ activeImage

final Image com.realtime.crossfire.jxclient.gui.textinput.GUIText.activeImage
private

◆ clipboard

final Clipboard com.realtime.crossfire.jxclient.gui.textinput.GUIText.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
private

The clipboard for cut/copy/paste operations.

Definition at line 109 of file GUIText.java.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.copy(), and com.realtime.crossfire.jxclient.gui.textinput.GUIText.paste().

◆ commandCallback

final CommandCallback com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandCallback
private

◆ commandHistory

final CommandHistory com.realtime.crossfire.jxclient.gui.textinput.GUIText.commandHistory
private

◆ cursor

int com.realtime.crossfire.jxclient.gui.textinput.GUIText.cursor
private

◆ font

final Font com.realtime.crossfire.jxclient.gui.textinput.GUIText.font
private

◆ hideInput

boolean com.realtime.crossfire.jxclient.gui.textinput.GUIText.hideInput
private

◆ inactiveColor

final Color com.realtime.crossfire.jxclient.gui.textinput.GUIText.inactiveColor
private

◆ inactiveImage

final Image com.realtime.crossfire.jxclient.gui.textinput.GUIText.inactiveImage
private

◆ margin

final int com.realtime.crossfire.jxclient.gui.textinput.GUIText.margin
private

◆ newCharModel

final NewCharModel com.realtime.crossfire.jxclient.gui.textinput.GUIText.newCharModel
private

◆ offset

int com.realtime.crossfire.jxclient.gui.textinput.GUIText.offset
private

◆ preferredSize

final Dimension com.realtime.crossfire.jxclient.gui.textinput.GUIText.preferredSize
private

◆ SCROLL_CHARS

final int com.realtime.crossfire.jxclient.gui.textinput.GUIText.SCROLL_CHARS = 8
staticprivate

The number of characters to scroll left/right when the cursor would move outside the visible area.

Definition at line 72 of file GUIText.java.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.setCursor().

◆ selection

final Clipboard com.realtime.crossfire.jxclient.gui.textinput.GUIText.selection = Toolkit.getDefaultToolkit().getSystemSelection()
private

The system selection for cut/copy/paste operations. Set to

null

if the system does not support a selection.

Definition at line 116 of file GUIText.java.

Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.copy(), and com.realtime.crossfire.jxclient.gui.textinput.GUIText.paste().

◆ serialVersionUID

final long com.realtime.crossfire.jxclient.gui.textinput.GUIText.serialVersionUID = 1
staticprivate

The serial version UID.

Definition at line 66 of file GUIText.java.

◆ syncCursor

final Object com.realtime.crossfire.jxclient.gui.textinput.GUIText.syncCursor = new Object()
private

◆ text

final StringBuilder com.realtime.crossfire.jxclient.gui.textinput.GUIText.text
private

The documentation for this class was generated from the following file: