|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.gui2.Alignment
Class, that makes alignments esiear.
Field Summary | |
static byte |
BOTTOM
Bottom-alignment constant ( == ). |
static byte |
CENTER
Center-alignment constant. |
static byte |
LEFT
Left-alignment constant. |
static byte |
RIGHT
Right-alignment constant. |
static byte |
SOURCE
Source-alignment constant ( == ). |
static byte |
TARGET
Target-alignment constant ( == ). |
static byte |
TOP
Top-alignment constant ( == ). |
Constructor Summary | |
protected |
Alignment(int x,
int y,
java.lang.Object source_object,
byte h_align,
byte v_align,
byte h_t_align,
byte v_t_align)
Constructs a new Alignment . |
|
Alignment(int x,
int y,
java.lang.String source_painter_name,
byte h_align,
byte v_align)
Constructs a new Alignment . |
|
Alignment(int x,
int y,
java.lang.String source_painter_name,
byte h_align,
byte v_align,
byte h_t_align,
byte v_t_align)
Constructs a new Alignment . |
Method Summary | |
void |
align(DrawObject source,
Painter target)
Aligns the given target- Painter according to this
Alignment relatively to the given source-Painter . |
void |
align(int x,
int y,
Painter painter)
Aligns the given Painter according to this
Alignment relatively to the given absolute point (ignoring
source-alignment settings). |
static double |
convertAlignmentToPercent(byte align)
Returns the given alignment value as double value between 0
and 1 . |
static Alignment |
createCenterAlignment(java.lang.String source_painter_name)
|
static Alignment |
createLeftTopAlignment(java.lang.String source_painter_name)
|
static java.awt.Point |
getReferencePoint(java.awt.Point p,
byte h_align,
byte v_align,
int x,
int y,
int width,
int height)
Calculates a reference point on a line according to the given alignment value. |
static java.awt.Point |
getReferencePoint(java.awt.Point p,
byte align,
int x1,
int y1,
int x2,
int y2)
Calculates a reference point on a line according to the given alignment value. |
int |
getX()
Returns the x-coordinate of the distance vector. |
int |
getY()
Returns the y-coordinate of the distance vector. |
byte |
hSourceAlignment()
Returns the horizontal alignment. |
double |
hSourceAlignmentPercent()
Returns the vertical alignment as double value between 0
and 1 . |
byte |
hTargetAlignment()
Returns the horizontal alignment for the target. |
double |
hTargetAlignmentPercent()
Returns the vertical alignment as double value between 0
and 1 . |
java.lang.String |
toString()
Overrides java.lang.Object.toString() . |
java.awt.Point |
vector()
Returns the distance vector. |
byte |
vSourceAlignment()
Returns the vertical alignment. |
double |
vSourceAlignmentPercent()
Returns the vertical alignment as double value between 0
and 1 . |
byte |
vTargetAlignment()
Returns the vertical alignment for the target. |
double |
vTargetAlignmentPercent()
Returns the vertical alignment as double value between 0
and 1 . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte LEFT
public static final byte RIGHT
public static final byte CENTER
public static final byte TOP
==LEFT
).public static final byte BOTTOM
==RIGHT
).public static final byte SOURCE
==LEFT
).public static final byte TARGET
==RIGHT
).Constructor Detail |
protected Alignment(int x, int y, java.lang.Object source_object, byte h_align, byte v_align, byte h_t_align, byte v_t_align)
Alignment
. The point to align to is located
relatively to the source area or line as specified via the vertical
and horizontal alignment constants. An object will be aligned at the
specified distance vector from this point.x,y
- distance vectorsource_object
- the source alignment objecth_align
- horizontal alignment constant (for the source object)v_align
- vertical alignment constant (for the source object)h_t_align
- horizontal alignment constant (for the target object)v_t_align
- vertical alignment constant (for the target object)public Alignment(int x, int y, java.lang.String source_painter_name, byte h_align, byte v_align, byte h_t_align, byte v_t_align)
Alignment
. The point to align to is located
relatively to the source area or line as specified via the vertical
and horizontal alignment constants. An object will be aligned at the
specified distance vector from this point.x,y
- distance vectorsource_painter_name
- the name of the painter to align toh_align
- horizontal alignment constant (for the source object)v_align
- vertical alignment constant (for the source object)h_t_align
- horizontal alignment constant (for the target object)v_t_align
- vertical alignment constant (for the target object)public Alignment(int x, int y, java.lang.String source_painter_name, byte h_align, byte v_align)
Alignment
. The point to align to is located
relatively to the source area or line as specified via the vertical
and horizontal alignment constants. An object will be aligned at the
specified distance vector from this point.x,y
- distance vectorsource_painter_name
- the name of the painter to align toh_align
- horizontal alignment constant (for the source object)v_align
- vertical alignment constant (for the source object)Method Detail |
public static final Alignment createLeftTopAlignment(java.lang.String source_painter_name)
public static final Alignment createCenterAlignment(java.lang.String source_painter_name)
public java.lang.String toString()
java.lang.Object.toString()
.toString
in class java.lang.Object
Object.toString()
public byte vSourceAlignment()
public double vSourceAlignmentPercent()
0
and 1
. The value 0
means TOP
alignment, the value 1
BOTTOM
, e.g the value
0.5
CENTER
.public byte hSourceAlignment()
public double hSourceAlignmentPercent()
0
and 1
. The value 0
means LEFT
alignment, the value 1
RIGHT
, e.g the value
0.5
CENTER
.public byte vTargetAlignment()
public double vTargetAlignmentPercent()
0
and 1
. The value 0
means TOP
alignment, the value 1
BOTTOM
, e.g the value
0.5
CENTER
.public byte hTargetAlignment()
public double hTargetAlignmentPercent()
0
and 1
. The value 0
means LEFT
alignment, the value 1
RIGHT
, e.g the value
0.5
CENTER
.public int getX()
public int getY()
public java.awt.Point vector()
public static double convertAlignmentToPercent(byte align)
0
and 1
. The value 0
means
LEFT
==TOP
==SOURCE
alignment, the value 1
RIGHT
==BOTTOM
==TARGET
,
e.g the value 0.5
CENTER
.public static final java.awt.Point getReferencePoint(java.awt.Point p, byte align, int x1, int y1, int x2, int y2)
p
- a Point
object where to store the calculated point or
null
.align
- an alignment value
(-128==SOURCE
≤0==CENTER
≤127==TARGET
)x1,y1
- source point of the linex2,y2
- target point of the linep
, if p!=null
)public static final java.awt.Point getReferencePoint(java.awt.Point p, byte h_align, byte v_align, int x, int y, int width, int height)
p
- a Point
object where to store the calculated point or
null
.h_align
- an alignment value
(-128==LEFT
≤0==CENTER
≤127==RIGHT
)
for the horizontal alignmentv_align
- an alignment value
(-128==TOP
≤0==CENTER
≤127==BOTTOM
)
for the vertical alignmentx,y
- the top left point of the rectangular areawidth
- the with of the rectangular areaheight
- the height of the rectangular areap
, if p!=null
)public void align(int x, int y, Painter painter)
Painter
according to this
Alignment
relatively to the given absolute point (ignoring
source-alignment settings).x,y
- absolute point to align topainter
- the Painter
to alignpublic void align(DrawObject source, Painter target)
Painter
according to this
Alignment
relatively to the given source-Painter
.source
- the source Painter
(already positioned)target
- the target Painter
to align
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |