java.lang.Object
org.rrd4j.graph.LegendComposer.Line
- Enclosing class:
LegendComposer
Line-style graph element with configurable width and color.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<CommentText> Comment lines waiting to be drawn.private MarkersThe marker last processed.private booleanTrue to skip right-justifying the values.private intLeading spaces used to align the current line.private doubleWidth of the widest legend line so far.Constructor Summary
ConstructorsMethod Summary
Private MethodsModifier and TypeMethodDescription(package private) voidadd(CommentText comment) Appends a comment, widening the line and recording its marker as the new last marker(package private) booleancanAccommodate(CommentText comment) Reports whether the line has room for the comment and may honour its alignment(package private) voidclear()Discards the line's comments and resets its width and marker stateprivate doublegetCommentWidth(CommentText comment) Measures a comment line.(package private) voidlayoutAndAdvance(boolean isLastLine) Places the line's comments according to the last marker and advances the legend y offsetprivate voidplaceComments(double xStart, double space) Assigns an x and y coordinate to each of the line's comments
Field Details
lastMarker
The marker last processed.width
private double widthWidth of the widest legend line so far.spaceCount
private int spaceCountLeading spaces used to align the current line.noJustification
private boolean noJustificationTrue to skip right-justifying the values.comments
Comment lines waiting to be drawn.
Constructor Details
Line
Line()Creates an empty line, holding no comments and no measured width yet.
Method Details
clear
void clear()Discards the line's comments and resets its width and marker statecanAccommodate
Reports whether the line has room for the comment and may honour its alignment- Parameters:
comment- the candidate comment, measured against the unused legend width- Returns:
- true if the line can still hold the comment and honour the current alignment
add
Appends a comment, widening the line and recording its marker as the new last marker- Parameters:
comment- the comment to append, whose marker becomes the line's new last marker
layoutAndAdvance
void layoutAndAdvance(boolean isLastLine) Places the line's comments according to the last marker and advances the legend y offset- Parameters:
isLastLine- true for the legend's closing line, which spreads the comments over the full legend width even when no \J justification marker was given
getCommentWidth
Measures a comment line.- Parameters:
comment- the line to measure- Returns:
- its width, in pixels
placeComments
private void placeComments(double xStart, double space) Assigns an x and y coordinate to each of the line's comments- Parameters:
xStart- the x coordinate of the first commentspace- the gap to leave between consecutive comments