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

Public Member Functions

void appendSelection (@NotNull final StringBuilder sb, final int beginSelection, final int endSelection)
 
void draw (@NotNull final Graphics2D g, final int y, final int beginSelection, final int endSelection)
 
String format ()
 
int getHeight ()
 
int getPosition ()
 
RectangularShape getSize ()
 
String getText ()
 
int getWidth ()
 
int getWidth (final int chars, @NotNull final FontRenderContext context)
 
int getX ()
 
int getY ()
 
boolean matches (final boolean bold, final boolean italic, final boolean underline, @NotNull final FontID fontID, @NotNull final Color color, @NotNull final Color selectionColor)
 
void setExtends (final int x, final int y, final int position)
 
 TextSegment (@NotNull final String text, @NotNull final Font font, final boolean bold, final boolean italic, final boolean underline, @NotNull final FontID fontID, @NotNull final Color color, @NotNull final RectangularShape size, final int ascentOffset, final int underlineOffset, @NotNull final Color selectionColor)
 
String toString ()
 
void updatePosition (final int positions)
 

Private Attributes

final int ascentOffset
 
final boolean bold
 
final Color color
 
final Font font
 
final FontID fontID
 
final boolean italic
 
int position
 
final Color selectionColor
 
final RectangularShape size
 
final String text
 
final boolean underline
 
final int underlineOffset
 
int x
 
int y
 

Detailed Description

One segment of a Line which should be displayed without changing attributes.

Author
Andreas Kirschbaum

Definition at line 40 of file TextSegment.java.

Constructor & Destructor Documentation

◆ TextSegment()

com.realtime.crossfire.jxclient.gui.log.TextSegment.TextSegment ( @NotNull final String  text,
@NotNull final Font  font,
final boolean  bold,
final boolean  italic,
final boolean  underline,
@NotNull final FontID  fontID,
@NotNull final Color  color,
@NotNull final RectangularShape  size,
final int  ascentOffset,
final int  underlineOffset,
@NotNull final Color  selectionColor 
)

Creates a new segment.

Parameters
textthe text to display
fontthe font of the text
boldwhether bold face is enabled
italicwhether italic face is enabled
underlinewhether underlining is enabled
fontIDthe font to use
colorthe color to use
sizethe size of this segment in pixels
ascentOffsetthe distance of the ascent from the top of the segment
underlineOffsetthe distance of the underline from the top of the segment
selectionColorthe selection color to use

Definition at line 135 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.ascentOffset, com.realtime.crossfire.jxclient.gui.log.TextSegment.bold, com.realtime.crossfire.jxclient.gui.log.TextSegment.color, com.realtime.crossfire.jxclient.gui.log.TextSegment.font, com.realtime.crossfire.jxclient.gui.log.TextSegment.fontID, com.realtime.crossfire.jxclient.gui.log.TextSegment.italic, com.realtime.crossfire.jxclient.gui.log.TextSegment.selectionColor, com.realtime.crossfire.jxclient.gui.log.TextSegment.size, com.realtime.crossfire.jxclient.gui.log.TextSegment.text, com.realtime.crossfire.jxclient.gui.log.TextSegment.underline, and com.realtime.crossfire.jxclient.gui.log.TextSegment.underlineOffset.

Member Function Documentation

◆ appendSelection()

void com.realtime.crossfire.jxclient.gui.log.TextSegment.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 317 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.position, and com.realtime.crossfire.jxclient.gui.log.TextSegment.text.

◆ draw()

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

◆ format()

String com.realtime.crossfire.jxclient.gui.log.TextSegment.format ( )

Returns a string representation of this text segment.

Returns
the string representation

Definition at line 307 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.text, com.realtime.crossfire.jxclient.gui.log.TextSegment.x, and com.realtime.crossfire.jxclient.gui.log.TextSegment.y.

◆ getHeight()

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

Returns the height to display the segment.

Returns
the height

Definition at line 227 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.size.

Referenced by com.realtime.crossfire.jxclient.gui.log.TextSegment.draw().

Here is the caller graph for this function:

◆ getPosition()

int com.realtime.crossfire.jxclient.gui.log.TextSegment.getPosition ( )

Returns the absolute position of the first character.

Returns
the absolute position of the first character

Definition at line 162 of file TextSegment.java.

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

◆ getSize()

RectangularShape com.realtime.crossfire.jxclient.gui.log.TextSegment.getSize ( )

Returns the size of this segment in pixels.

Returns
the size

Definition at line 261 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.size.

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

Here is the caller graph for this function:

◆ getText()

String com.realtime.crossfire.jxclient.gui.log.TextSegment.getText ( )

◆ getWidth() [1/2]

int com.realtime.crossfire.jxclient.gui.log.TextSegment.getWidth ( )

Returns the width to display the segment.

Returns
the width

Definition at line 209 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.size.

Referenced by com.realtime.crossfire.jxclient.gui.log.TextSegment.draw().

Here is the caller graph for this function:

◆ getWidth() [2/2]

int com.realtime.crossfire.jxclient.gui.log.TextSegment.getWidth ( final int  chars,
@NotNull final FontRenderContext  context 
)

Returns the display width of a prefix of this segment's text.

Parameters
charsthe number of characters in the prefix
contextthe font render context to use
Returns
the width

Definition at line 219 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.font, and com.realtime.crossfire.jxclient.gui.log.TextSegment.text.

◆ getX()

int com.realtime.crossfire.jxclient.gui.log.TextSegment.getX ( )

Returns the x-coordinate to display the segment.

Returns
the x-coordinate

Definition at line 193 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.x.

◆ getY()

int com.realtime.crossfire.jxclient.gui.log.TextSegment.getY ( )

Returns the y-coordinate to display the segment.

Returns
the y-coordinate

Definition at line 201 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.underlineOffset, and com.realtime.crossfire.jxclient.gui.log.TextSegment.y.

◆ matches()

boolean com.realtime.crossfire.jxclient.gui.log.TextSegment.matches ( final boolean  bold,
final boolean  italic,
final boolean  underline,
@NotNull final FontID  fontID,
@NotNull final Color  color,
@NotNull final Color  selectionColor 
)

Returns whether this segment matches the given attributes.

Parameters
boldthe bold attribute
italicthe italic attribute
underlinethe underline attribute
fontIDthe font attribute
colorthe color attribute
selectionColorthe selection color attribute
Returns
whether all attributes do match

Definition at line 275 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.bold, com.realtime.crossfire.jxclient.gui.log.TextSegment.color, com.realtime.crossfire.jxclient.gui.log.TextSegment.fontID, com.realtime.crossfire.jxclient.gui.log.TextSegment.italic, com.realtime.crossfire.jxclient.gui.log.TextSegment.selectionColor, and com.realtime.crossfire.jxclient.gui.log.TextSegment.underline.

Referenced by com.realtime.crossfire.jxclient.gui.log.Parser.processText().

Here is the caller graph for this function:

◆ setExtends()

void com.realtime.crossfire.jxclient.gui.log.TextSegment.setExtends ( final int  x,
final int  y,
final int  position 
)

Sets the extends to display the segment.

Parameters
xthe x-coordinate
ythe y-coordinate
positionthe absolute position of the first character

Definition at line 172 of file TextSegment.java.

References com.realtime.crossfire.jxclient.gui.log.TextSegment.ascentOffset, com.realtime.crossfire.jxclient.gui.log.TextSegment.position, com.realtime.crossfire.jxclient.gui.log.TextSegment.x, and com.realtime.crossfire.jxclient.gui.log.TextSegment.y.

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

Here is the caller graph for this function:

◆ toString()

String com.realtime.crossfire.jxclient.gui.log.TextSegment.toString ( )

◆ updatePosition()

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

Shifts the position of this line.

Parameters
positionsthe number of positions to shift

Definition at line 182 of file TextSegment.java.

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

Member Data Documentation

◆ ascentOffset

final int com.realtime.crossfire.jxclient.gui.log.TextSegment.ascentOffset
private

◆ bold

final boolean com.realtime.crossfire.jxclient.gui.log.TextSegment.bold
private

◆ color

final Color com.realtime.crossfire.jxclient.gui.log.TextSegment.color
private

◆ font

final Font com.realtime.crossfire.jxclient.gui.log.TextSegment.font
private

◆ fontID

final FontID com.realtime.crossfire.jxclient.gui.log.TextSegment.fontID
private

◆ italic

final boolean com.realtime.crossfire.jxclient.gui.log.TextSegment.italic
private

◆ position

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

◆ selectionColor

final Color com.realtime.crossfire.jxclient.gui.log.TextSegment.selectionColor
private

◆ size

final RectangularShape com.realtime.crossfire.jxclient.gui.log.TextSegment.size
private

◆ text

final String com.realtime.crossfire.jxclient.gui.log.TextSegment.text
private

◆ underline

final boolean com.realtime.crossfire.jxclient.gui.log.TextSegment.underline
private

◆ underlineOffset

final int com.realtime.crossfire.jxclient.gui.log.TextSegment.underlineOffset
private

◆ x

int com.realtime.crossfire.jxclient.gui.log.TextSegment.x
private

◆ y

int com.realtime.crossfire.jxclient.gui.log.TextSegment.y
private

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