Lanes are drawn as columns left-to-right in the graph, and the commit short message is drawn to the right of the lane lines for this cell. It is assumed that the commits are being drawn as rows of some sort of table.
Client applications can subclass this implementation to provide the necessary drawing primitives required to display a commit graph. Most of the graph layout is handled by this class, allowing applications to implement only a handful of primitive stubs.
This class is suitable for us within an AWT TableCellRenderer or within a SWT PaintListener registered on a Table instance. It is meant to rubber stamp the graphics necessary for one row of a plotted commit list.
Subclasses should call paintCommit(PlotCommit, int) after they have
otherwise configured their instance to draw one commit into the current
location.
All drawing methods assume the coordinate space for the current commit's cell starts at (upper left corner is) 0,0. If this is not true (like say in SWT) the implementation must perform the cell offset computations within the various draw methods.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static int | |
| protected abstract void | drawBoundaryDot(int
upper left of the oval's bounding box. x, int upper left of the oval's bounding box. y, int width of the oval's bounding box. w, int height of the oval's bounding box. h)Draw a single boundary commit (aka uninteresting commit) dot. |
| protected abstract void | drawCommitDot(int
upper left of the oval's bounding box. x, int upper left of the oval's bounding box. y, int width of the oval's bounding box. w, int height of the oval's bounding box. h)Draw a single commit dot. |
| protected abstract int | |
| protected abstract void | drawLine(TColor
the color to use while drawing the line. color, int starting X coordinate, 0 based. x1, int starting Y coordinate, 0 based. y1, int ending X coordinate, 0 based. x2, int ending Y coordinate, 0 based. y2, int number of pixels wide for the line. Always at least 1. width)Draw a single line within this cell. |
| protected abstract void | drawText(String
the text to draw. Does not contain LFs. msg, int first pixel from the left that the text can be drawn at.
Character data must not appear before this position. x, int pixel coordinate of the baseline of the text. Implementations
must adjust this coordinate to account for the way their
implementation handles font rendering. y)Draw a single line of text. |
| private static int | |
| protected abstract TColor | Returns: graphics specific color reference. Must be a valid color.the current lane. May be null. myLane)Obtain the color reference used to paint this lane. |
| private static int | |
| protected void | paintCommit(PlotCommit<TLane>
the commit to render in this cell. Must not be null. commit, int total height (in pixels) of this cell. h)Paint one commit using the underlying graphics library. |
| LANE_WIDTH | back to summary |
|---|---|
| private static final int LANE_WIDTH | |
| LEFT_PAD | back to summary |
|---|---|
| private static final int LEFT_PAD | |
| LINE_WIDTH | back to summary |
|---|---|
| private static final int LINE_WIDTH | |
| AbstractPlotRenderer | back to summary |
|---|---|
| public AbstractPlotRenderer() | |
| computeDotSize | back to summary |
|---|---|
| private static int computeDotSize(int h) | |
| drawBoundaryDot | back to summary |
|---|---|
| protected abstract void drawBoundaryDot(int x, int y, int w, int h) Draw a single boundary commit (aka uninteresting commit) dot. Usually a boundary commit dot is a light gray oval with a white center.
| |
| drawCommitDot | back to summary |
|---|---|
| protected abstract void drawCommitDot(int x, int y, int w, int h) Draw a single commit dot. Usually the commit dot is a filled oval in blue, then a drawn oval in black, using the same coordinates for both operations.
| |
| drawLabel | back to summary |
|---|---|
| protected abstract int drawLabel(int x, int y, Ref ref) Draw a decoration for the Ref ref at x,y
| |
| drawLine | back to summary |
|---|---|
| protected abstract void drawLine(TColor color, int x1, int y1, int x2, int y2, int width) Draw a single line within this cell.
| |
| drawText | back to summary |
|---|---|
| protected abstract void drawText(String msg, int x, int y) Draw a single line of text. The font and colors used to render the text are left up to the implementation.
| |
| laneC | back to summary |
|---|---|
| private static int laneC(PlotLane myLane) | |
| laneColor | back to summary |
|---|---|
| protected abstract TColor laneColor(TLane myLane) Obtain the color reference used to paint this lane. Colors returned by this method will be passed to the other drawing primitives, so the color returned should be application specific. If a null lane is supplied the return value must still be acceptable to a drawing method. Usually this means the implementation should return a default color.
| |
| laneX | back to summary |
|---|---|
| private static int laneX(PlotLane myLane) | |
| paintCommit | back to summary |
|---|---|
| protected void paintCommit(PlotCommit<TLane> commit, int h) Paint one commit using the underlying graphics library.
| |