|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAxis2D.TickIterator
public class Axis2D.TickIterator
Iterates along the graduation ticks and provides access to the graduation values. Each
Axis2D.TickIterator
object traverses the graduation of the unclosing Axis2D
object independently from any other TickIterator
objects in use at the same time.
If a change occurs in the underlying Axis2D
object during the iteration, then
refresh()
must be invoked in order to reset the iterator as if a new instance was
created. Except for refresh()
method, using the iterator after a change in the
underlying Axis2D
may thrown a ConcurrentModificationException
.
Constructor Summary | |
---|---|
Axis2D.TickIterator(FontRenderContext fontContext)
Construct an iterator. |
Method Summary | |
---|---|
String |
currentLabel()
Returns the label for current tick. |
Rectangle2D |
currentLabelBounds()
Returns a bounding vector for the current tick label. |
GlyphVector |
currentLabelGlyphs()
Returns the label for current tick as a glyphs vector. |
double |
currentPosition()
Returns the position where to draw the current tick. |
Point2D |
currentPosition(Point2D dest)
Returns the coordinates of the intersection point between current tick and the underlying axis. |
Line2D |
currentTick(Line2D dest)
Returns the coordinates of the current tick. |
double |
currentValue()
Returns the value for current tick. |
Locale |
getLocale()
Returns the locale used for formatting tick labels. |
boolean |
hasNext()
Tests if the iterator has more ticks. |
boolean |
isMajorTick()
Tests if the current tick is a major one. |
void |
next()
Moves the iterator to the next minor or major tick. |
void |
nextMajor()
Moves the iterator to the next major tick. |
void |
refresh()
Reset the iterator on its first tick. |
void |
rewind()
Reset the iterator on its first tick. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Axis2D.TickIterator(FontRenderContext fontContext)
fontContext
- Information needed to correctly measure text, or
null
if unknow. This object is usually given by
Graphics2D.getFontRenderContext()
.Method Detail |
---|
public boolean hasNext()
hasNext
in interface TickIterator
public boolean isMajorTick()
isMajorTick
in interface TickIterator
true
if current tick is a major tick,
or false
if it is a minor tick.public double currentPosition()
currentValue()
. The mean exception is for logarithmic graduation,
in which the tick position is not proportional to the tick value.
currentPosition
in interface TickIterator
public double currentValue()
currentValue
in interface TickIterator
public Point2D currentPosition(Point2D dest)
dest
- A destination point that stores the intersection coordinates,
or null
to create a new Point2D
object.
dest
, or a new Point2D
object if dest
was null.public Line2D currentTick(Line2D dest)
dest
- A destination line that stores the current tick coordinates,
or null
to create a new Line2D
object.
dest
, or a new Line2D
object if dest
was null.public String currentLabel()
null
if it can't produces a label
for current tick.
currentLabel
in interface TickIterator
public GlyphVector currentLabelGlyphs()
currentLabelBounds()
for labels rendering. Do
not change the returned GlyphVector
, since the glyphs vector
is not cloned for performance raisons. This method returns null
if it can't produces a glyph vector for current tick.
public Rectangle2D currentLabelBounds()
This method returnsAxis2D.TickIterator
iterator = axis.newTickIterator
(null}; while (iterator.hasNext()
) {GlyphVector
glyphs = iterator.currentLabelGlyphs()
;Rectangle2D
bounds = iterator.currentLabelBounds()
; graphics.drawGlyphVector(glyphs, (float)bounds.getMinX(), (float)bounds.getMaxY()); iterator.next()
; }
null
if it can't compute bounding box for current tick.
public void next()
next
in interface TickIterator
public void nextMajor()
nextMajor
in interface TickIterator
public void rewind()
rewind
in interface TickIterator
public void refresh()
refresh()
method help to reduce garbage-collection by constructing an Axis2D.TickIterator
object only once and reuse it for each axis's rendering.
public Locale getLocale()
getLocale
in interface TickIterator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |