Crossfire JXClient, Trunk
|
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< TextSegment > | segments () |
void | updatePosition (final int positions) |
Private Attributes | |
int | height = -1 |
int | length |
int | position |
final List< TextSegment > | segments = new ArrayList<>() |
boolean | showFirstSegment |
final int | subtype |
final int | type |
Static Private Attributes | |
static final int | MIN_LINE_HEIGHT = 8 |
Manages the contents of one text line. A text line consists of a sequence of TextSegments.
com.realtime.crossfire.jxclient.gui.log.Line.Line | ( | final int | type, |
final int | subtype, | ||
@NotNull final TextSegment | segment | ||
) |
Creates a new instance.
type | the message type |
subtype | the message subtype |
segment | the 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.
void com.realtime.crossfire.jxclient.gui.log.Line.addTextSegment | ( | @NotNull final TextSegment | segment | ) |
Appends a TextSegment to the end of the line.
segment | the 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.
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.
sb | the string builder instance |
beginSelection | the first selected character |
endSelection | the 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().
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.
linePosition | the absolute buffer position of the first character of the line |
renderWidth | the width to render |
showSentCommands | whether to show commands sent to the server |
showFirstSegment | whether to show the first segment (the timestamp) |
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.
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.
g | the graphics to draw to |
y | the y-coordinate to start drawing |
beginSelection | the first selected character |
endSelection | the first character after the selection |
Definition at line 246 of file Line.java.
References com.realtime.crossfire.jxclient.gui.log.Line.segments.
int com.realtime.crossfire.jxclient.gui.log.Line.getEndPosition | ( | ) |
Returns the absolute buffer position of the first character after this line.
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().
int com.realtime.crossfire.jxclient.gui.log.Line.getHeight | ( | ) |
Returns the height of this line. Returns
until calculateHeight(int, int, boolean, boolean) was called.
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().
TextSegment com.realtime.crossfire.jxclient.gui.log.Line.getLastTextSegment | ( | ) |
Returns the last segment.
Definition at line 120 of file Line.java.
References com.realtime.crossfire.jxclient.gui.log.Line.segments.
int com.realtime.crossfire.jxclient.gui.log.Line.getStartPosition | ( | ) |
Returns the absolute buffer position of the first character of this line.
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().
boolean com.realtime.crossfire.jxclient.gui.log.Line.isVisible | ( | final boolean | showSentCommands | ) |
Returns whether this line is visible.
showSentCommands | whether to show commands sent to the server |
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().
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.
Iterable<TextSegment> com.realtime.crossfire.jxclient.gui.log.Line.segments | ( | ) |
Returns all segments of the line.
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.
void com.realtime.crossfire.jxclient.gui.log.Line.updatePosition | ( | final int | positions | ) |
Shifts the position of this line.
positions | the 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.
|
private |
The total height of this line. Set to
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().
|
private |
The total number of characters in this line.
Definition at line 76 of file Line.java.
Referenced by com.realtime.crossfire.jxclient.gui.log.Line.addTextSegment(), com.realtime.crossfire.jxclient.gui.log.Line.getEndPosition(), com.realtime.crossfire.jxclient.gui.log.Line.Line(), and com.realtime.crossfire.jxclient.gui.log.Line.removeLastTextSegment().
|
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().
|
private |
The absolute buffer position of the first character of this line.
Definition at line 71 of file Line.java.
Referenced by com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight(), com.realtime.crossfire.jxclient.gui.log.Line.getEndPosition(), com.realtime.crossfire.jxclient.gui.log.Line.getStartPosition(), and com.realtime.crossfire.jxclient.gui.log.Line.updatePosition().
|
private |
The segments this line consists of. The first segment should be displayed first; subsequent segments are to be displayed without padding.
Definition at line 51 of file Line.java.
Referenced by com.realtime.crossfire.jxclient.gui.log.Line.addTextSegment(), com.realtime.crossfire.jxclient.gui.log.Line.appendSelection(), com.realtime.crossfire.jxclient.gui.log.Line.calculateHeight(), com.realtime.crossfire.jxclient.gui.log.Line.drawLine(), com.realtime.crossfire.jxclient.gui.log.Line.getLastTextSegment(), com.realtime.crossfire.jxclient.gui.log.Line.Line(), com.realtime.crossfire.jxclient.gui.log.Line.removeLastTextSegment(), com.realtime.crossfire.jxclient.gui.log.Line.segments(), and com.realtime.crossfire.jxclient.gui.log.Line.updatePosition().
|
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().
|
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().
|
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().