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.log.GUILog Class Referenceabstract
Inheritance diagram for com.realtime.crossfire.jxclient.gui.log.GUILog:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.gui.log.GUILog:
Collaboration graph

Public Member Functions

void addScrollableListener (@NotNull final ScrollableListener listener)
 
boolean canScroll (final int distance)
 
void dispose ()
 
Buffer getBuffer ()
 
void mouseDragged (@NotNull final MouseEvent e)
 
void mousePressed (@NotNull final MouseEvent e)
 
void mouseReleased (@NotNull final MouseEvent e)
 
void mouseWheelMoved (final int wheelRotation)
 
void paintComponent (@NotNull final Graphics g)
 
void removeScrollableListener (@NotNull final ScrollableListener listener)
 
void resetScroll ()
 
void scroll (final int distance)
 
void scrollTo (final int pos)
 
void setBounds (final int x, final int y, final int width, final int height)
 
void setShowSentCommands (final boolean showSentCommands)
 
void setShowTimestamps (final boolean showTimestamps)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement
int getDialogBorderBottom ()
 
int getDialogBorderLeft ()
 
int getDialogBorderRight ()
 
int getDialogBorderTop ()
 
String getName ()
 
abstract TooltipText getTooltip ()
 
void inhibitListeners ()
 
boolean isDefault ()
 
boolean isIgnore ()
 
void mouseClicked (@NotNull final MouseEvent e)
 
void mouseEntered (@NotNull final MouseEvent e)
 
void mouseExited (@NotNull final MouseEvent e)
 
void mouseMoved (@NotNull final MouseEvent e)
 
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

 GUILog (@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @Nullable final Image backgroundImage, @NotNull final Fonts fonts, @NotNull final GuiFactory guiFactory)
 
- 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 autoScroll ()
 
void copy ()
 
int getEndPosition ()
 
int getStartPosition ()
 
void setSelection (final int selection)
 

Private Attributes

final Image backgroundImage
 
int beginSelection
 
final Buffer buffer
 
final BufferListener bufferListener
 
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard()
 
int endSelection
 
final EventListenerList2< ScrollableListenerlisteners = new EventListenerList2<>()
 
final RenderStateListener renderStateListener
 
final RenderStateManager renderStateManager
 
boolean scrollForwards
 
final Clipboard selection = Toolkit.getDefaultToolkit().getSystemSelection()
 
int startSelection
 
final ActionListener timeoutEvent = e -> autoScroll()
 
final Timer timer = new Timer(TIMEOUT_AUTO_SCROLL, timeoutEvent)
 

Static Private Attributes

static final int SCROLL_PIXEL = 48
 
static final long serialVersionUID = 1
 
static final int TIMEOUT_AUTO_SCROLL = 25
 

Detailed Description

Abstract base class for gui elements implementing text fields.

Author
Lauwenmark
Andreas Kirschbaum

Definition at line 55 of file GUILog.java.

Constructor & Destructor Documentation

◆ GUILog()

com.realtime.crossfire.jxclient.gui.log.GUILog.GUILog ( @NotNull final TooltipManager  tooltipManager,
@NotNull final GUIElementListener  elementListener,
@NotNull final String  name,
@Nullable final Image  backgroundImage,
@NotNull final Fonts  fonts,
@NotNull final GuiFactory  guiFactory 
)
protected

Member Function Documentation

◆ addScrollableListener()

void com.realtime.crossfire.jxclient.gui.log.GUILog.addScrollableListener ( @NotNull final ScrollableListener  listener)

Adds a scrollable listener to be informed about changes.

Parameters
listenerthe listener to add

Implements com.realtime.crossfire.jxclient.gui.scrollable.GUIScrollable2.

Definition at line 296 of file GUILog.java.

References com.realtime.crossfire.jxclient.gui.log.GUILog.listeners.

◆ autoScroll()

void com.realtime.crossfire.jxclient.gui.log.GUILog.autoScroll ( )
private

◆ canScroll()

boolean com.realtime.crossfire.jxclient.gui.log.GUILog.canScroll ( final int  distance)

Returns whether scrolling is possible.

Parameters
distancethe distance to scroll
Returns
whether scrolling is possible

Implements com.realtime.crossfire.jxclient.gui.scrollable.GUIScrollable.

Definition at line 263 of file GUILog.java.

References com.realtime.crossfire.jxclient.gui.log.RenderStateManager.canScrollDown(), com.realtime.crossfire.jxclient.gui.log.RenderStateManager.canScrollUp(), and com.realtime.crossfire.jxclient.gui.log.GUILog.renderStateManager.

Here is the call graph for this function:

◆ copy()

void com.realtime.crossfire.jxclient.gui.log.GUILog.copy ( )
private

◆ dispose()

void com.realtime.crossfire.jxclient.gui.log.GUILog.dispose ( )

◆ getBuffer()

Buffer com.realtime.crossfire.jxclient.gui.log.GUILog.getBuffer ( )

◆ getEndPosition()

int com.realtime.crossfire.jxclient.gui.log.GUILog.getEndPosition ( )
private

◆ getStartPosition()

int com.realtime.crossfire.jxclient.gui.log.GUILog.getStartPosition ( )
private

◆ mouseDragged()

void com.realtime.crossfire.jxclient.gui.log.GUILog.mouseDragged ( @NotNull final MouseEvent  e)

◆ mousePressed()

void com.realtime.crossfire.jxclient.gui.log.GUILog.mousePressed ( @NotNull final MouseEvent  e)

◆ mouseReleased()

void com.realtime.crossfire.jxclient.gui.log.GUILog.mouseReleased ( @NotNull final MouseEvent  e)

◆ mouseWheelMoved()

void com.realtime.crossfire.jxclient.gui.log.GUILog.mouseWheelMoved ( final int  wheelRotation)

Will be called when the mouse wheel has been moved.

Parameters
wheelRotationthe movement amount; negative=away from the user, positive=towards the user

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

Definition at line 366 of file GUILog.java.

References com.realtime.crossfire.jxclient.gui.log.GUILog.scroll().

Here is the call graph for this function:

◆ paintComponent()

void com.realtime.crossfire.jxclient.gui.log.GUILog.paintComponent ( @NotNull final Graphics  g)

◆ removeScrollableListener()

void com.realtime.crossfire.jxclient.gui.log.GUILog.removeScrollableListener ( @NotNull final ScrollableListener  listener)

Removes a scrollable listener.

Parameters
listenerthe listener to remove

Implements com.realtime.crossfire.jxclient.gui.scrollable.GUIScrollable2.

Definition at line 301 of file GUILog.java.

References com.realtime.crossfire.jxclient.gui.log.GUILog.listeners.

◆ resetScroll()

void com.realtime.crossfire.jxclient.gui.log.GUILog.resetScroll ( )

Resets the scroll index to the default value.

Implements com.realtime.crossfire.jxclient.gui.scrollable.GUIScrollable.

Definition at line 286 of file GUILog.java.

References com.realtime.crossfire.jxclient.gui.log.GUILog.renderStateManager, and com.realtime.crossfire.jxclient.gui.log.RenderStateManager.resetScroll().

Here is the call graph for this function:

◆ scroll()

void com.realtime.crossfire.jxclient.gui.log.GUILog.scroll ( final int  distance)

◆ scrollTo()

void com.realtime.crossfire.jxclient.gui.log.GUILog.scrollTo ( final int  pos)

Scrolls to the given location. The possible range is given by a previous notification through a listener registered with addScrollableListener(ScrollableListener).

Parameters
posthe location to scroll to

Implements com.realtime.crossfire.jxclient.gui.scrollable.GUIScrollable2.

Definition at line 291 of file GUILog.java.

References com.realtime.crossfire.jxclient.gui.log.GUILog.renderStateManager, and com.realtime.crossfire.jxclient.gui.log.RenderStateManager.scrollTo().

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILabelLog.updateText().

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

◆ setBounds()

void com.realtime.crossfire.jxclient.gui.log.GUILog.setBounds ( final int  x,
final int  y,
final int  width,
final int  height 
)

◆ setSelection()

void com.realtime.crossfire.jxclient.gui.log.GUILog.setSelection ( final int  selection)
private

◆ setShowSentCommands()

void com.realtime.crossfire.jxclient.gui.log.GUILog.setShowSentCommands ( final boolean  showSentCommands)

◆ setShowTimestamps()

void com.realtime.crossfire.jxclient.gui.log.GUILog.setShowTimestamps ( final boolean  showTimestamps)

Member Data Documentation

◆ backgroundImage

final Image com.realtime.crossfire.jxclient.gui.log.GUILog.backgroundImage
private

◆ beginSelection

int com.realtime.crossfire.jxclient.gui.log.GUILog.beginSelection
private

◆ buffer

final Buffer com.realtime.crossfire.jxclient.gui.log.GUILog.buffer
private

◆ bufferListener

final BufferListener com.realtime.crossfire.jxclient.gui.log.GUILog.bufferListener
private
Initial value:
= new BufferListener() {
@Override
public void lineAdded() {
}
@Override
public void lineReplaced() {
}
@Override
public void linesRemoved(@NotNull final List<Line> lines) {
final int endPosition = lines.get(lines.size()-1).getEndPosition();
if (beginSelection > endPosition) {
beginSelection -= endPosition;
endSelection -= endPosition;
} else if (endSelection > endPosition) {
endSelection -= endPosition;
} else if (beginSelection > 0 || endSelection > 0) {
}
}
}

The BufferListener attached to buffer.

Definition at line 171 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.dispose(), and com.realtime.crossfire.jxclient.gui.log.GUILog.GUILog().

◆ clipboard

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

The clipboard for cut/copy/paste operations.

Definition at line 102 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.copy().

◆ endSelection

int com.realtime.crossfire.jxclient.gui.log.GUILog.endSelection
private

◆ listeners

final EventListenerList2<ScrollableListener> com.realtime.crossfire.jxclient.gui.log.GUILog.listeners = new EventListenerList2<>()
private

◆ renderStateListener

final RenderStateListener com.realtime.crossfire.jxclient.gui.log.GUILog.renderStateListener
private
Initial value:
= new RenderStateListener() {
@Override
public void stateChanged() {
for (ScrollableListener listener : listeners) {
listener.setRange(0, buffer.getTotalHeight(), renderStateManager.getScrollPos(), getHeight());
}
}
@Override
public int getHeight() {
return Math.max(1, GUILog.this.getHeight());
}
}

The RenderStateListener attached to renderStateManager.

Definition at line 150 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.GUILog().

◆ renderStateManager

final RenderStateManager com.realtime.crossfire.jxclient.gui.log.GUILog.renderStateManager
private

◆ SCROLL_PIXEL

final int com.realtime.crossfire.jxclient.gui.log.GUILog.SCROLL_PIXEL = 48
staticprivate

The number of pixels to scroll.

Definition at line 65 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.autoScroll(), and com.realtime.crossfire.jxclient.gui.log.GUILog.scroll().

◆ scrollForwards

boolean com.realtime.crossfire.jxclient.gui.log.GUILog.scrollForwards
private

The scrolling direction during auto-scrolling:

true

=scroll forwards,

false

=scroll backwards.

Definition at line 143 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.autoScroll(), and com.realtime.crossfire.jxclient.gui.log.GUILog.mouseDragged().

◆ selection

final Clipboard com.realtime.crossfire.jxclient.gui.log.GUILog.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 109 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.copy(), and com.realtime.crossfire.jxclient.gui.log.GUILog.setSelection().

◆ serialVersionUID

final long com.realtime.crossfire.jxclient.gui.log.GUILog.serialVersionUID = 1
staticprivate

The serial version UID.

Definition at line 60 of file GUILog.java.

◆ startSelection

int com.realtime.crossfire.jxclient.gui.log.GUILog.startSelection
private

The starting point of the selection. Only used while a selection is created.

Definition at line 127 of file GUILog.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.GUILog.mousePressed(), and com.realtime.crossfire.jxclient.gui.log.GUILog.setSelection().

◆ TIMEOUT_AUTO_SCROLL

final int com.realtime.crossfire.jxclient.gui.log.GUILog.TIMEOUT_AUTO_SCROLL = 25
staticprivate

The delay in milliseconds for automatically scrolling during text selection.

Definition at line 71 of file GUILog.java.

◆ timeoutEvent

final ActionListener com.realtime.crossfire.jxclient.gui.log.GUILog.timeoutEvent = e -> autoScroll()
private

The ActionListener for generating auto-scrolling events.

Definition at line 115 of file GUILog.java.

◆ timer

final Timer com.realtime.crossfire.jxclient.gui.log.GUILog.timer = new Timer(TIMEOUT_AUTO_SCROLL, timeoutEvent)
private

The documentation for this class was generated from the following file:
com.realtime.crossfire.jxclient.gui.log.GUILog.beginSelection
int beginSelection
Definition: GUILog.java:132
com.realtime.crossfire.jxclient.gui.log.GUILog.listeners
final EventListenerList2< ScrollableListener > listeners
Definition: GUILog.java:77
com.realtime.crossfire.jxclient.gui.log.RenderStateManager.getScrollPos
int getScrollPos()
Definition: RenderStateManager.java:171
com.realtime.crossfire.jxclient.gui.log.GUILog.endSelection
int endSelection
Definition: GUILog.java:137
com.realtime.crossfire.jxclient.gui.log.GUILog.mouseDragged
void mouseDragged(@NotNull final MouseEvent e)
Definition: GUILog.java:342
com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.mouseMoved
void mouseMoved(@NotNull final MouseEvent e)
Definition: AbstractGUIElement.java:211
com.realtime.crossfire.jxclient.gui.log.GUILog.renderStateManager
final RenderStateManager renderStateManager
Definition: GUILog.java:96
com.realtime.crossfire.jxclient.gui.log.Buffer.getTotalHeight
int getTotalHeight()
Definition: Buffer.java:275
com.realtime.crossfire.jxclient.gui.log.GUILog.buffer
final Buffer buffer
Definition: GUILog.java:83
com.realtime.crossfire.jxclient.gui.log.GUILog.GUILog
GUILog(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @Nullable final Image backgroundImage, @NotNull final Fonts fonts, @NotNull final GuiFactory guiFactory)
Definition: GUILog.java:210
com.realtime.crossfire.jxclient.gui.gui.AbstractGUIElement.setChanged
void setChanged()
Definition: AbstractGUIElement.java:223