Crossfire JXClient, Trunk
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.gui.log.Line Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.gui.log.Line:
Collaboration graph

Public Member Functions

void addTextSegment (@NotNull final TextSegment segment)
 
void appendSelection (@NotNull final StringBuilder sb, final int beginSelection, final int endSelection)
 
int calculateHeight (final int linePosition, final int renderWidth, final boolean showSentCommands, final boolean showFirstSegment)
 
void drawLine (@NotNull final Graphics2D g, final int y, final int beginSelection, final int endSelection)
 
int getEndPosition ()
 
int getHeight ()
 
TextSegment getLastTextSegment ()
 
int getStartPosition ()
 
boolean isVisible (final boolean showSentCommands)
 
 Line (final int type, final int subtype, @NotNull final TextSegment segment)
 
void removeLastTextSegment ()
 
Iterable< TextSegmentsegments ()
 
void updatePosition (final int positions)
 

Private Attributes

int height = -1
 
int length
 
int position
 
final List< TextSegmentsegments = new ArrayList<>()
 
boolean showFirstSegment
 
final int subtype
 
final int type
 

Static Private Attributes

static final int MIN_LINE_HEIGHT = 8
 

Detailed Description

Manages the contents of one text line. A text line consists of a sequence of TextSegments.

Author
Andreas Kirschbaum

Definition at line 39 of file Line.java.

Constructor & Destructor Documentation

◆ Line()

com.realtime.crossfire.jxclient.gui.log.Line.Line ( final int  type,
final int  subtype,
@NotNull final TextSegment  segment 
)

Creates a new instance.

Parameters
typethe message type
subtypethe message subtype
segmentthe timestamp of this line

Definition at line 89 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.length, com.realtime.crossfire.jxclient.gui.log.Line.segments, com.realtime.crossfire.jxclient.gui.log.Line.subtype, and com.realtime.crossfire.jxclient.gui.log.Line.type.

Member Function Documentation

◆ addTextSegment()

void com.realtime.crossfire.jxclient.gui.log.Line.addTextSegment ( @NotNull final TextSegment  segment)

Appends a TextSegment to the end of the line.

Parameters
segmentthe text segment

Definition at line 100 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.length, and com.realtime.crossfire.jxclient.gui.log.Line.segments.

◆ appendSelection()

void com.realtime.crossfire.jxclient.gui.log.Line.appendSelection ( @NotNull final StringBuilder  sb,
final int  beginSelection,
final int  endSelection 
)

Appends the selected text to a StringBuilder instance.

Parameters
sbthe string builder instance
beginSelectionthe first selected character
endSelectionthe first character after the selection

Definition at line 258 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.segments.

Referenced by com.realtime.crossfire.jxclient.gui.log.Buffer.getText().

Here is the caller graph for this function:

◆ calculateHeight()

int com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight ( final int  linePosition,
final int  renderWidth,
final boolean  showSentCommands,
final boolean  showFirstSegment 
)

Determines the height in pixels.

Parameters
linePositionthe absolute buffer position of the first character of the line
renderWidththe width to render
showSentCommandswhether to show commands sent to the server
showFirstSegmentwhether to show the first segment (the timestamp)
Returns
the height in pixels

Definition at line 172 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.getSize(), com.realtime.crossfire.jxclient.gui.log.TextSegment.getText(), com.realtime.crossfire.jxclient.gui.log.Line.height, com.realtime.crossfire.jxclient.gui.log.Line.isVisible(), com.realtime.crossfire.jxclient.gui.log.Line.MIN_LINE_HEIGHT, com.realtime.crossfire.jxclient.gui.log.Line.position, com.realtime.crossfire.jxclient.gui.log.Line.segments, com.realtime.crossfire.jxclient.gui.log.TextSegment.setExtends(), and com.realtime.crossfire.jxclient.gui.log.Line.showFirstSegment.

Here is the call graph for this function:

◆ drawLine()

void com.realtime.crossfire.jxclient.gui.log.Line.drawLine ( @NotNull final Graphics2D  g,
final int  y,
final int  beginSelection,
final int  endSelection 
)

Draws this line to a Graphics2D instance.

Parameters
gthe graphics to draw to
ythe y-coordinate to start drawing
beginSelectionthe first selected character
endSelectionthe first character after the selection

Definition at line 246 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.segments.

◆ getEndPosition()

int com.realtime.crossfire.jxclient.gui.log.Line.getEndPosition ( )

Returns the absolute buffer position of the first character after this line.

Returns
the buffer position

Definition at line 158 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.length, and com.realtime.crossfire.jxclient.gui.log.Line.position.

Referenced by com.realtime.crossfire.jxclient.gui.log.Buffer.getText(), and com.realtime.crossfire.jxclient.gui.log.Buffer.prune().

Here is the caller graph for this function:

◆ getHeight()

int com.realtime.crossfire.jxclient.gui.log.Line.getHeight ( )

Returns the height of this line. Returns

-1

until calculateHeight(int, int, boolean, boolean) was called.

Returns
the height of this line

Definition at line 140 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.height.

Referenced by com.realtime.crossfire.jxclient.gui.log.Buffer.prune().

Here is the caller graph for this function:

◆ getLastTextSegment()

TextSegment com.realtime.crossfire.jxclient.gui.log.Line.getLastTextSegment ( )

Returns the last segment.

Returns
the last segment or
null
if the line is empty

Definition at line 120 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.segments.

◆ getStartPosition()

int com.realtime.crossfire.jxclient.gui.log.Line.getStartPosition ( )

Returns the absolute buffer position of the first character of this line.

Returns
the buffer position

Definition at line 149 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.position.

Referenced by com.realtime.crossfire.jxclient.gui.log.Buffer.getText(), and com.realtime.crossfire.jxclient.gui.log.Buffer.prune().

Here is the caller graph for this function:

◆ isVisible()

boolean com.realtime.crossfire.jxclient.gui.log.Line.isVisible ( final boolean  showSentCommands)

Returns whether this line is visible.

Parameters
showSentCommandswhether to show commands sent to the server
Returns
whether this line is visible

Definition at line 221 of file Line.java.

References com.realtime.crossfire.jxclient.protocol.MessageType.MSG_SUBTYPE_JXCLIENT_COMMAND, com.realtime.crossfire.jxclient.protocol.MessageType.MSG_TYPE_JXCLIENT, com.realtime.crossfire.jxclient.gui.log.Line.subtype, and com.realtime.crossfire.jxclient.gui.log.Line.type.

Referenced by com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight(), and com.realtime.crossfire.jxclient.gui.log.Buffer.getText().

Here is the caller graph for this function:

◆ removeLastTextSegment()

void com.realtime.crossfire.jxclient.gui.log.Line.removeLastTextSegment ( )

Removes the last segment. The line must not be empty.

Definition at line 127 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.getText(), com.realtime.crossfire.jxclient.gui.log.Line.length, and com.realtime.crossfire.jxclient.gui.log.Line.segments.

Here is the call graph for this function:

◆ segments()

Iterable<TextSegment> com.realtime.crossfire.jxclient.gui.log.Line.segments ( )

Returns all segments of the line.

Returns
the segments

Definition at line 110 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.segments, and com.realtime.crossfire.jxclient.gui.log.Line.showFirstSegment.

◆ updatePosition()

void com.realtime.crossfire.jxclient.gui.log.Line.updatePosition ( final int  positions)

Shifts the position of this line.

Parameters
positionsthe number of positions to shift

Definition at line 229 of file Line.java.

References com.realtime.crossfire.jxclient.gui.log.Line.position, and com.realtime.crossfire.jxclient.gui.log.Line.segments.

Member Data Documentation

◆ height

int com.realtime.crossfire.jxclient.gui.log.Line.height = -1
private

The total height of this line. Set to

-1

if unknown.

Definition at line 66 of file Line.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight(), and com.realtime.crossfire.jxclient.gui.log.Line.getHeight().

◆ length

int com.realtime.crossfire.jxclient.gui.log.Line.length
private

◆ MIN_LINE_HEIGHT

final int com.realtime.crossfire.jxclient.gui.log.Line.MIN_LINE_HEIGHT = 8
staticprivate

The minimal height of a line in pixels. Normally applies to empty lines.

Definition at line 44 of file Line.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight().

◆ position

int com.realtime.crossfire.jxclient.gui.log.Line.position
private

◆ segments

final List<TextSegment> com.realtime.crossfire.jxclient.gui.log.Line.segments = new ArrayList<>()
private

◆ showFirstSegment

boolean com.realtime.crossfire.jxclient.gui.log.Line.showFirstSegment
private

Whether to show the first segment (the timestamp).

Definition at line 81 of file Line.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight(), and com.realtime.crossfire.jxclient.gui.log.Line.segments().

◆ subtype

final int com.realtime.crossfire.jxclient.gui.log.Line.subtype
private

The message subtype of this line.

Definition at line 61 of file Line.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.Line.isVisible(), and com.realtime.crossfire.jxclient.gui.log.Line.Line().

◆ type

final int com.realtime.crossfire.jxclient.gui.log.Line.type
private

The message type of this line.

Definition at line 56 of file Line.java.

Referenced by com.realtime.crossfire.jxclient.gui.log.Line.isVisible(), and com.realtime.crossfire.jxclient.gui.log.Line.Line().


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