com.jidesoft.gantt
Class AbstractPeriodBackgroundPainter<T>
java.lang.Object
com.jidesoft.gantt.AbstractPeriodBackgroundPainter<T>
- Type Parameters:
T
- The type of the bases unit of the scale, for example Date or Integer.
- All Implemented Interfaces:
- PeriodBackgroundPainter<T>
- Direct Known Subclasses:
- AbstractPeriodMarker, DefaultPeriodBackgroundPainter, IntervalMarker
public abstract class AbstractPeriodBackgroundPainter<T>
- extends Object
- implements PeriodBackgroundPainter<T>
AbstractPeriodBackgroundPainter
provides an abstract implementation for
PeriodBackgroundPainter
.
Method Summary |
protected Stroke |
deriveStroke(Stroke stroke,
int offset)
By default if the stroke is a BasicStroke with a dash pattern, a new BasicStroke is returned with the dash phase
set to the offset. |
protected abstract Paint |
getBackgroundPaint(T startInstant,
T endInstant)
|
protected abstract Paint |
getOutlinePaint(T startInstant,
T endInstant)
|
protected abstract int |
getOutlineSides(T startInstant,
T endInstant)
|
protected abstract Stroke |
getOutlineStroke(T startInstant,
T endInstant)
|
Period |
getPeriod()
If the period is null, paint periodChartBackground will be called once, but the start and end instant will be
null and the coordinates will be invalid. |
protected void |
paintBackground(Graphics2D graphics,
Paint paint,
int x,
int y,
int width,
int height)
|
void |
paintPeriodBackground(GanttChart<T,GanttEntry<T>> ganttChart,
Graphics2D g,
T startInstant,
T endInstant,
int periodStartX,
int periodStartY,
int periodEndX,
int periodEndY)
Paints the background. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OUTLINE_DEFAULT
public static final int OUTLINE_DEFAULT
- See Also:
- Constant Field Values
OUTLINE_START
public static final int OUTLINE_START
- See Also:
- Constant Field Values
OUTLINE_END
public static final int OUTLINE_END
- See Also:
- Constant Field Values
AbstractPeriodBackgroundPainter
public AbstractPeriodBackgroundPainter(Period forPeriod)
getBackgroundPaint
protected abstract Paint getBackgroundPaint(T startInstant,
T endInstant)
getOutlinePaint
protected abstract Paint getOutlinePaint(T startInstant,
T endInstant)
getOutlineStroke
protected abstract Stroke getOutlineStroke(T startInstant,
T endInstant)
getOutlineSides
protected abstract int getOutlineSides(T startInstant,
T endInstant)
getPeriod
public Period getPeriod()
- Description copied from interface:
PeriodBackgroundPainter
- If the period is null, paint periodChartBackground will be called once, but the start and end instant will be
null and the coordinates will be invalid. The latter should be calculated by the painter itself using the scale
area and model.
- Specified by:
getPeriod
in interface PeriodBackgroundPainter<T>
- Returns:
- The Period this painter paints a background for or null to mark a specific interval.
paintPeriodBackground
public void paintPeriodBackground(GanttChart<T,GanttEntry<T>> ganttChart,
Graphics2D g,
T startInstant,
T endInstant,
int periodStartX,
int periodStartY,
int periodEndX,
int periodEndY)
- Description copied from interface:
PeriodBackgroundPainter
- Paints the background.
- Specified by:
paintPeriodBackground
in interface PeriodBackgroundPainter<T>
- Parameters:
ganttChart
- the gantt chart.g
- the graphicsstartInstant
- the starting value of the current period. The painter will paint the background of gantt
chart period by period. Each time, this method will be called for each period. The
startInstant is the starting value of the current period.endInstant
- the ending value of the current period.periodStartX
- the startX of the current period.periodStartY
- the startY of the current period.periodEndX
- the endX of the current period.periodEndY
- the endY of the current period.
deriveStroke
protected Stroke deriveStroke(Stroke stroke,
int offset)
- By default if the stroke is a BasicStroke with a dash pattern, a new BasicStroke is returned with the dash phase
set to the offset.
- Parameters:
stroke
- current strokeoffset
- the offset
- Returns:
- A Stroke adjusted for the specified y-offset.
paintBackground
protected void paintBackground(Graphics2D graphics,
Paint paint,
int x,
int y,
int width,
int height)