|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
jview.JNormalizedCanvas
jview.JViewportCanvas
jview.JFrameCanvas
jview.JBoxedCanvas
public class JBoxedCanvas
A class that allows drawing of ticks and labels on a shape canvas. The following properties are supported:
KEY_TICKAT:KEY_LABELAT:KEY_TICKXINSIDE:KEY_TICKYINSIDE:KEY_LABELXINSIDE:KEY_LABELYINSIDE:KEY_TICKXSIZE:KEY_TICKYSIZE:KEY_TICKSTRETCH:KEY_FONT:KEY_LABELXFORMAT:KEY_LABELYFORMAT:KEY_TICKXSTART:KEY_TICKYSTART:KEY_TICKXEND:KEY_TICKYEND:KEY_TICKXSTEP:KEY_TICKYSTEP:KEY_TICKXAUTO:KEY_TICKYAUTO:KEY_LABELXSTART:KEY_LABELYSTART:KEY_LABELXEND:KEY_LABELYEND:KEY_LABELXSTEP:KEY_LABELYSTEP:KEY_LABELXAUTO:KEY_LABELYAUTO:#KEY_LABELXUNIT:#KEY_LABELYUNIT:KEY_TICKXGRID:KEY_TICKYGRID:KEY_TICKCOLOR:KEY_LABELCOLOR:KEY_GRIDCOLOR:Shapes and
JNormalizedCanvas.TextDraw objects.
| Nested Class Summary | |
|---|---|
static class |
JBoxedCanvas.Datum
A test class for testing the date format. |
static class |
JBoxedCanvas.Test
A test class for testing the layout |
| Nested classes/interfaces inherited from class jview.JViewportCanvas |
|---|
JViewportCanvas.ViewportKey |
| Nested classes/interfaces inherited from class jview.JNormalizedCanvas |
|---|
JNormalizedCanvas.ShowImage |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static double[] |
AUTODATE
Default allowed rounding on ticks and labels if date (sec.) |
private static double[] |
AUTOSTEP
Default allowed rounding on ticks and labels. |
static int |
BOTTOM
The integer value vor ticks/label at bottom. |
private static int[] |
DATECLEAR
The calender integer fields to clear. |
private static double[] |
DATECLEARSTEP
Default fields to clear for start determination on date. |
private static String[] |
DATEFORMAT
An array of possible date formats to above steps. |
private static Color |
DEFGRIDCOLOR
The key . |
private static boolean |
DEFIGNOREFORMAT
The key . |
private static int |
DEFLABELAT
The key . |
private static Color |
DEFLABELCOLOR
The key . |
private static double |
DEFLABELXANGLE
The key . |
private static int |
DEFLABELXAUTO
The key . |
private static int |
DEFLABELXEXTRA
The key . |
private static boolean |
DEFLABELXINSIDE
The key . |
private static double |
DEFLABELYANGLE
The key . |
private static int |
DEFLABELYAUTO
The key . |
private static int |
DEFLABELYEXTRA
The key . |
private static boolean |
DEFLABELYINSIDE
The key . |
private static int |
DEFMAXLABELS
The key . |
private static int |
DEFMAXTICKS
The key . |
private static int |
DEFTICKAT
The key . |
private static Color |
DEFTICKCOLOR
The key . |
private static float |
DEFTICKSTRETCH
The key . |
private static int |
DEFTICKXAUTO
The key . |
private static boolean |
DEFTICKXGRID
The key . |
private static boolean |
DEFTICKXINSIDE
The key . |
private static float |
DEFTICKXSIZE
The key . |
private static int |
DEFTICKYAUTO
The key . |
private static boolean |
DEFTICKYGRID
The key . |
private static boolean |
DEFTICKYINSIDE
The key . |
private static float |
DEFTICKYSIZE
The key . |
private static boolean |
DEFXISDATE
The key . |
private static boolean |
DEFXLOGARITHMIC
The key . |
private static boolean |
DEFYISDATE
The key . |
private static boolean |
DEFYLOGARITHMIC
The key . |
private List<ShapeDraw> |
grid
The list of grid lines. |
static String |
KEY_FONT
The key . |
static String |
KEY_GRIDCOLOR
The key . |
static String |
KEY_IGNOREFORMAT
The key . |
static String |
KEY_LABELAT
The key . |
static String |
KEY_LABELCOLOR
The key . |
static String |
KEY_LABELXANGLE
The key . |
static String |
KEY_LABELXAUTO
The key . |
static String |
KEY_LABELXEND
The key . |
static String |
KEY_LABELXEXTRA
The key . |
static String |
KEY_LABELXFORMAT
The key . |
static String |
KEY_LABELXINSIDE
The key . |
static String |
KEY_LABELXSTART
The key . |
static String |
KEY_LABELXSTEP
The key . |
static String |
KEY_LABELYANGLE
The key . |
static String |
KEY_LABELYAUTO
The key . |
static String |
KEY_LABELYEND
The key . |
static String |
KEY_LABELYEXTRA
The key . |
static String |
KEY_LABELYFORMAT
The key . |
static String |
KEY_LABELYINSIDE
The key . |
static String |
KEY_LABELYSTART
The key . |
static String |
KEY_LABELYSTEP
The key . |
static String |
KEY_MAXLABELS
The key . |
static String |
KEY_MAXTICKS
The key . |
static String |
KEY_TICKAT
The key . |
static String |
KEY_TICKCOLOR
The key . |
static String |
KEY_TICKSTRETCH
The key . |
static String |
KEY_TICKXAUTO
The key . |
static String |
KEY_TICKXEND
The key . |
static String |
KEY_TICKXGRID
The key . |
static String |
KEY_TICKXINSIDE
The key . |
static String |
KEY_TICKXSIZE
The key . |
static String |
KEY_TICKXSTART
The key . |
static String |
KEY_TICKXSTEP
The key . |
static String |
KEY_TICKYAUTO
The key . |
static String |
KEY_TICKYEND
The key . |
static String |
KEY_TICKYGRID
The key . |
static String |
KEY_TICKYINSIDE
The key . |
static String |
KEY_TICKYSIZE
The key . |
static String |
KEY_TICKYSTART
The key . |
static String |
KEY_TICKYSTEP
The key . |
static String |
KEY_XISDATE
If this key points to a boolean, label format x is a simple date. |
static String |
KEY_XLOGARITHMIC
If this key points to a boolean, label format x is a simple date. |
static String |
KEY_YISDATE
If this key points to a boolean, label format y is a simple date. |
static String |
KEY_YLOGARITHMIC
If this key points to a boolean, label format y is a simple date. |
static int |
LEFT
The integer value vor ticks/label at left. |
private CoordinateTransforming |
linear
The user set transformation into normalized pixel space. |
static int |
RIGHT
The integer value vor ticks/label at right. |
private List<ShapeDraw> |
tick
The list of tick shapes active. |
static int |
TOP
The integer value vor ticks/label at top. |
private List<TextDraw> |
xlabels
The list of labels on the x-axes. |
private List<TextDraw> |
ylabels
The list of labels on the y-axes. |
| Fields inherited from class jview.JViewportCanvas |
|---|
MAXVIEW, VIEWPORTIMAGEPROPERTY, VIEWPORTPROPERTY |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JBoxedCanvas(ResourceSupplying prop)
Constructs a new boxed canvas with auto-scaling enabled. |
|
| Method Summary | |
|---|---|
private void |
addLabelsX(Point2D stencil,
float vjust,
Format form,
Font labelfont,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
Point2D off)
We step from the starting value to the end value using the step size set in the property container. |
private void |
addLabelsY(Point2D stencil,
float hjust,
Format form,
Font labelfont,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
Point2D off)
We step from the starting value to the end value using the step size. |
private void |
addTicksX(Line2D stencil,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
List<ShapeDraw> where)
Uses a template tick line and adds it between the starting point and the end point using the specified step size. |
private void |
addTicksY(Line2D stencil,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
List<ShapeDraw> where)
Uses a template tick line and adds it between the starting point and the end point using the specified step size. |
private static double |
decimalEnd(double start,
double end,
double step)
|
private static double |
decimalStart(double start,
double end,
double step)
|
private static double |
decimalStepSize(double raw)
Returns a decimal step size. |
static Format |
getBestDateFormat(double stepdays)
For a given step size in date, return a good estimate on the format to use. |
Format |
getDefaultFormatX()
Returns the number format used on the x-labels. |
Format |
getDefaultFormatY()
Returns the number format used on the y-labels. |
private double |
getEnd(double start,
double end,
double step,
boolean log,
boolean date)
Uses the stepsize to return the end point of ticks or labels on an axis. |
private double |
getNextStep(double cur,
double step0)
Returns the next step width, if the step width for ticking or labeling is not constant, but slowly varying. |
private double |
getStart(double start,
double end,
double step,
boolean log,
boolean date)
Uses the stepsize to return the starting point of ticks or labels on an axis. |
private double |
getStepSize(double start,
double end,
int mark,
boolean date,
boolean log)
Derives the ideal stepsize to use for producing close to the target number ticks/labels on an axis. |
CoordinateTransforming |
getUserTransformation()
Returns the morphing instance assigned to this componenet. |
CoordinateTransforming |
getUserTransformation(int type)
Returns the morphing instance assigned to this componenet, ignores type |
void |
init()
Initializes the boxed canvas by initializing the tick, grid and label lists. |
protected void |
prepareCanvas(Graphics g)
This method is called at the beginning of the paint process of this component. |
protected void |
printComponent(Graphics g)
If the fonts change during printing, this could mean that our labels are bigger, thus we should cache to absoulte inset parameters. |
void |
setComposedProperties(ResourceSupplying prop)
Adds additional default mappings. |
void |
setUserTransformation(CoordinateTransforming xy)
Registers the CoordinateTransforming instance that transforms
user coordinates into normalized pixel space. |
void |
setUserTransformation(CoordinateTransforming xy,
int type)
Registers the CoordinateTransforming instance that transforms
user coordinates into normalized pixel space. |
protected boolean |
silentlySelectViewport(Rectangle2D newview)
This method is called when the visible viewport in normalized coordinate changes. |
boolean |
xIsDate()
Returns true if x axis show a data. |
boolean |
yIsDate()
Returns true if x axis show a data. |
| Methods inherited from class jview.JFrameCanvas |
|---|
calculateActiveCanvas, calculateShapeTransform, getArea, isScreenInNormalized, paintObjects, wasReshaped |
| Methods inherited from class jview.JViewportCanvas |
|---|
addAttachedViewport, addZoom, getViewport, getViewportImage, isMaximalViewport, isNormalizedOnScreen, removeAttachedViewport, resetViewport, selectArea, selectViewport, setViewportImage, transferView |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jview.NormalizedCoordinates |
|---|
getArea, getNormalized, getNormalizedRect, getScreen, getScreenRect, getViewport, isNormalizedOnScreen, isScreenInNormalized |
| Field Detail |
|---|
public static final int TOP
public static final int LEFT
public static final int BOTTOM
public static final int RIGHT
public static final String KEY_MAXTICKS
public static final String KEY_MAXLABELS
public static final String KEY_TICKAT
public static final String KEY_LABELAT
public static final String KEY_TICKXINSIDE
public static final String KEY_TICKYINSIDE
public static final String KEY_LABELXINSIDE
public static final String KEY_LABELYINSIDE
public static final String KEY_TICKXSIZE
public static final String KEY_TICKYSIZE
public static final String KEY_TICKSTRETCH
public static final String KEY_FONT
public static final String KEY_IGNOREFORMAT
public static final String KEY_LABELXFORMAT
public static final String KEY_LABELYFORMAT
public static final String KEY_TICKXSTART
public static final String KEY_TICKYSTART
public static final String KEY_TICKXEND
public static final String KEY_TICKYEND
public static final String KEY_TICKXSTEP
public static final String KEY_TICKYSTEP
public static final String KEY_TICKXAUTO
public static final String KEY_TICKYAUTO
public static final String KEY_LABELXSTART
public static final String KEY_LABELYSTART
public static final String KEY_LABELXEND
public static final String KEY_LABELYEND
public static final String KEY_LABELXSTEP
public static final String KEY_LABELYSTEP
public static final String KEY_LABELXANGLE
public static final String KEY_LABELYANGLE
public static final String KEY_LABELXAUTO
public static final String KEY_LABELYAUTO
public static final String KEY_LABELXEXTRA
public static final String KEY_LABELYEXTRA
public static final String KEY_TICKXGRID
public static final String KEY_TICKYGRID
public static final String KEY_TICKCOLOR
public static final String KEY_LABELCOLOR
public static final String KEY_GRIDCOLOR
public static final String KEY_XISDATE
public static final String KEY_YISDATE
public static final String KEY_XLOGARITHMIC
public static final String KEY_YLOGARITHMIC
private static final int DEFMAXTICKS
private static final int DEFMAXLABELS
private static final int DEFTICKAT
private static final int DEFLABELAT
private static final boolean DEFTICKXINSIDE
private static final boolean DEFTICKYINSIDE
private static final boolean DEFLABELXINSIDE
private static final boolean DEFLABELYINSIDE
private static final float DEFTICKXSIZE
private static final float DEFTICKYSIZE
private static final float DEFTICKSTRETCH
private static final int DEFLABELXEXTRA
private static final int DEFLABELYEXTRA
private static final int DEFTICKXAUTO
private static final int DEFTICKYAUTO
private static final int DEFLABELXAUTO
private static final int DEFLABELYAUTO
private static final double DEFLABELXANGLE
private static final double DEFLABELYANGLE
private static final boolean DEFTICKXGRID
private static final boolean DEFTICKYGRID
private static final boolean DEFXISDATE
private static final boolean DEFYISDATE
private static final boolean DEFXLOGARITHMIC
private static final boolean DEFYLOGARITHMIC
private static final boolean DEFIGNOREFORMAT
private static final Color DEFTICKCOLOR
private static final Color DEFLABELCOLOR
private static final Color DEFGRIDCOLOR
private static final double[] AUTOSTEP
public static final double[] AUTODATE
private static String[] DATEFORMAT
private static final double[] DATECLEARSTEP
private static final int[] DATECLEAR
private CoordinateTransforming linear
private List<ShapeDraw> tick
private List<ShapeDraw> grid
private List<TextDraw> xlabels
private List<TextDraw> ylabels
| Constructor Detail |
|---|
public JBoxedCanvas(ResourceSupplying prop)
setUserTransformation(jview.CoordinateTransforming)| Method Detail |
|---|
public void init()
init in interface Initializableinit in class JFrameCanvaspublic void setComposedProperties(ResourceSupplying prop)
setComposedProperties in interface ResourceAwaresetComposedProperties in class JFrameCanvaspublic void setUserTransformation(CoordinateTransforming xy)
CoordinateTransforming instance that transforms
user coordinates into normalized pixel space. Normal action will require
calling the JViewportCanvas.selectViewport(java.awt.geom.Rectangle2D) with the current viewport afterwards
to ensure proper labeling.
setUserTransformation in interface UserCoordinates
public void setUserTransformation(CoordinateTransforming xy,
int type)
CoordinateTransforming instance that transforms
user coordinates into normalized pixel space. Normal action will require
calling the JViewportCanvas.selectViewport(java.awt.geom.Rectangle2D) with the current viewport afterwards
to ensure proper labeling. Ignores type.
setUserTransformation in interface UserCoordinatespublic CoordinateTransforming getUserTransformation()
getUserTransformation in interface UserCoordinatespublic CoordinateTransforming getUserTransformation(int type)
getUserTransformation in interface UserCoordinatestype - Zero for main type, others for special use.public static Format getBestDateFormat(double stepdays)
protected boolean silentlySelectViewport(Rectangle2D newview)
Calling this method sparks the following things:
KEY_TICKAT, ticks are registerd as
Line2D to the drawable shapes of the parental class.KEY_TICKSTRETCH, tick point either to the inside or to the
outside of the drawable canvas, according to KEY_TICKXINSIDE and
KEY_TICKYINSIDE.#KEY_LABELXUNIT and #KEY_LABELYUNIT.
There pointing (insdie or outside the canvas) is defined with
KEY_LABELXINSIDE and KEY_LABELYINSIDE. Formatting is
done with KEY_LABELXFORMAT and KEY_LABELYFORMAT, the
KEY_LABELAT key defines where they are plotted.KEY_TICKXSTART etc.KEY_TICKXGRID or the KEY_TICKYGRID keys are
present, gris lines are added to the parent.
silentlySelectViewport in class JViewportCanvaspublic boolean xIsDate()
public boolean yIsDate()
protected void printComponent(Graphics g)
printComponent in class JNormalizedCanvasprotected void prepareCanvas(Graphics g)
prepareCanvas in class JFrameCanvaspublic Format getDefaultFormatX()
Morphing
instance registered to the box is not a FormattingMorphing, then
the box-specific format is used.
public Format getDefaultFormatY()
private double getStepSize(double start,
double end,
int mark,
boolean date,
boolean log)
AUTOSTEP.
start - The x(y) value at pixel coordinate zero.end - The x(y) value at pixel coordinate one.mark - The number of steps
private static double decimalStepSize(double raw)
private double getStart(double start,
double end,
double step,
boolean log,
boolean date)
start - The coordinate value at pixel zero.end - The coordinate value at pixel one.step - The stepwidth on this axis.
private static double decimalStart(double start,
double end,
double step)
private static double decimalEnd(double start,
double end,
double step)
private double getEnd(double start,
double end,
double step,
boolean log,
boolean date)
start - The coordinate value at pixel zero.end - The coordinate value at pixel one.step - The stepwidth on this axis.
private double getNextStep(double cur,
double step0)
private void addTicksX(Line2D stencil,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
List<ShapeDraw> where)
private void addTicksY(Line2D stencil,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
List<ShapeDraw> where)
private void addLabelsX(Point2D stencil,
float vjust,
Format form,
Font labelfont,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
Point2D off)
FormattingMorphing assigned to this box, we use it to format the
label, otherwise the default, box-internal format is used.
stencil - Used for shifting the drawing position of the label.vjust - Vertical adjustment of labelform - A default formatter, if box-morphing cannot format.unit - A string appended to the label.labelfont - The font used to draw the label.labelcol - The color used to draw the label.pixstart - The starting label in pixel space.pixend - The end label in pixel space.pixstep - The pixel stepping size.off - Additional offset.
private void addLabelsY(Point2D stencil,
float hjust,
Format form,
Font labelfont,
Vector2D first,
Vector2D last,
double step,
boolean log,
boolean date,
Point2D off)
stencil - Used for shifting the drawing position of the label.hjust - Vertical adjustment of labelform - A default formatter, if box-morphing cannot format.unit - A string appended to the label.labelfont - The font used to draw the label.labelcol - The color used to draw the label.pixstart - The starting label in pixel space.pixend - The end label in pixel space.pixstep - The pixel stepping size.off - Additional offset.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||