gui.layout
Class HIGConstraints

java.lang.Object
  extended bygui.layout.HIGConstraints
All Implemented Interfaces:
java.io.Serializable

public class HIGConstraints
extends java.lang.Object
implements java.io.Serializable

Defines constraints for each component added to container with HIGLayout layout manager. Defines components target area: x, y (column, row) of top left corner, width (number of columns or absolute size in pixels), height (number of rows or absolute size in pixels), anchors string, vertical and horizontal corrections. Usually You will use one instance of this class because HIGLayout copies passed constraint object when adds component to container.

Most of methods returns this object so Your can chain more calls into single line of code.

Version:
1.0 1/19/2002
Author:
Daniel Michalik (dmi@autel.cz)
See Also:
Serialized Form

Field Summary
(package private)  java.lang.String anchor
           
private static java.lang.String defaultAnchor
           
(package private)  int h
           
(package private)  int hCorrection
           
(package private)  int w
           
(package private)  int wCorrection
           
(package private)  int x
           
(package private)  int xCorrection
           
(package private)  int y
           
(package private)  int yCorrection
           
 
Constructor Summary
  HIGConstraints()
           
(package private) HIGConstraints(HIGConstraints c)
           
 
Method Summary
 HIGConstraints anchors(java.lang.String anchors)
          Sets anchors string.
 int c()
          Returns current column index.
 HIGConstraints c(int c)
          Sets column index.
 HIGConstraints c(int c, java.lang.String anchors)
          Sets column index and anchors.
 HIGConstraints clearCorrection()
          Clears all corrections.
 HIGConstraints cwh(int c, int w, int h)
          Sets column index, target area width and height.
 HIGConstraints cwh(int c, int w, int h, java.lang.String anchors)
          Sets column index, target area width, height and anchors.
 HIGConstraints H(int h)
          Sets width to absolute size in pixels.
 HIGConstraints next2Col()
          Increases current column index by two.
 HIGConstraints next2Row()
          Increases current row index by two.
 HIGConstraints nextCol()
          Increases current column index by one.
 HIGConstraints nextRow()
          Increases current row index by one.
 int r()
          Returns current row index.
 HIGConstraints r(int r)
          Sets row index.
 HIGConstraints r(int r, java.lang.String anchors)
          Sets row index and anchors.
 HIGConstraints rc(int r, int c)
          Sets row and column index.
 HIGConstraints rc(int r, int c, java.lang.String anchors)
          Sets row and column index and anchors.
 HIGConstraints rcwh(int r, int c, int w, int h)
          Sets row and column index, width and height.
 HIGConstraints rcwh(int r, int c, int w, int h, java.lang.String anchors)
          Sets row and column index, width, height and anchors.
 HIGConstraints rwh(int r, int w, int h)
          Sets row index, target area width and height.
 HIGConstraints rwh(int r, int w, int h, java.lang.String anchors)
          Sets row index, target area width, height and anchors.
 HIGConstraints setHCorrection(int xCorr, int wCorr)
          Set horizontal correction until changed or cleared.
 HIGConstraints setVCorrection(int yCorr, int hCorr)
          Set vertical correction until changed or cleared.
 HIGConstraints W(int w)
          Sets width to absolute size in pixels.
 int x()
          Returns current column index.
 HIGConstraints x(int x)
          Sets column index.
 HIGConstraints x(int x, java.lang.String anchors)
          Sets column index and anchors.
 HIGConstraints xwh(int x, int w, int h)
          Sets column index, target area width and height.
 HIGConstraints xwh(int x, int w, int h, java.lang.String anchors)
          Sets column index, target area width, height and anchors.
 HIGConstraints xy(int x, int y)
          Sets row and column index.
 HIGConstraints xy(int x, int y, java.lang.String anchors)
          Sets row and column index and anchors.
 HIGConstraints xywh(int x, int y, int w, int h)
          Sets row and column index, width and height.
 HIGConstraints xywh(int x, int y, int w, int h, java.lang.String anchors)
          Sets row and column index, width, height and anchors.
 int y()
          Returns current row index.
 HIGConstraints y(int y)
          Sets row index.
 HIGConstraints y(int y, java.lang.String anchors)
          Sets row index and anchors.
 HIGConstraints ywh(int y, int w, int h)
          Sets row index, target area width and height.
 HIGConstraints ywh(int y, int w, int h, java.lang.String anchors)
          Sets row index, target area width, height and anchors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultAnchor

private static final java.lang.String defaultAnchor
See Also:
Constant Field Values

x

int x

y

int y

w

int w

h

int h

xCorrection

int xCorrection

yCorrection

int yCorrection

wCorrection

int wCorrection

hCorrection

int hCorrection

anchor

java.lang.String anchor
Constructor Detail

HIGConstraints

HIGConstraints(HIGConstraints c)

HIGConstraints

public HIGConstraints()
Method Detail

setHCorrection

public HIGConstraints setHCorrection(int xCorr,
                                     int wCorr)
Set horizontal correction until changed or cleared. When layout manager takes component's preferred size it will add to it passed width correction; after positioning it will change position about position correction.

Parameters:
xCorr - correction of horizontal position, in pixels. Can be negative.
wCorr - correction of width, in pixels. Can be negative.
Returns:
this
See Also:
clearCorrection()

setVCorrection

public HIGConstraints setVCorrection(int yCorr,
                                     int hCorr)
Set vertical correction until changed or cleared. When layout manager takes component's preferred size it will add to it passed height correction; after positioning it will change position about position correction.

Parameters:
yCorr - correction of vertical position, in pixels. Can be negative.
hCorr - correction of height, in pixels. Can be negative.
Returns:
this
See Also:
clearCorrection()

clearCorrection

public HIGConstraints clearCorrection()
Clears all corrections.

Returns:
this
See Also:
setHCorrection(int, int), setVCorrection(int, int)

nextRow

public HIGConstraints nextRow()
Increases current row index by one. Preserves all previous settings.

Returns:
this

next2Row

public HIGConstraints next2Row()
Increases current row index by two. Preserves all previous settings.

Returns:
this

nextCol

public HIGConstraints nextCol()
Increases current column index by one. Preserves all previous settings.

Returns:
this

next2Col

public HIGConstraints next2Col()
Increases current column index by two. Preserves all previous settings.

Returns:
this

x

public HIGConstraints x(int x)
Sets column index. Preserves row index, sets anchor to "rltb", width and height to 1.

Parameters:
x - column index
Returns:
this

c

public HIGConstraints c(int c)
Sets column index. Preserves row index, sets anchor to "rltb", width and height to 1.

Parameters:
c - column index
Returns:
this

x

public HIGConstraints x(int x,
                        java.lang.String anchors)
Sets column index and anchors. Preserves row index, sets width and height to 1.

Parameters:
x - column index
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

c

public HIGConstraints c(int c,
                        java.lang.String anchors)
Sets column index and anchors. Preserves row index, sets width and height to 1.

Parameters:
c - column index
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

xwh

public HIGConstraints xwh(int x,
                          int w,
                          int h)
Sets column index, target area width and height. Preserves row index, sets anchors string to "lrtb".

Parameters:
x - column index
w - width, number of columns
h - height, number of rows
Returns:
this

cwh

public HIGConstraints cwh(int c,
                          int w,
                          int h)
Sets column index, target area width and height. Preserves row index, sets anchors string to "lrtb".

Parameters:
c - column index
w - width, number of columns
h - height, number of rows
Returns:
this

xwh

public HIGConstraints xwh(int x,
                          int w,
                          int h,
                          java.lang.String anchors)
Sets column index, target area width, height and anchors. Preserver row index.

Parameters:
x - column index
w - width, number of columns
h - height, number of rows
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

cwh

public HIGConstraints cwh(int c,
                          int w,
                          int h,
                          java.lang.String anchors)
Sets column index, target area width, height and anchors. Preserver row index.

Parameters:
c - column index
w - width, number of columns
h - height, number of rows
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

y

public HIGConstraints y(int y)
Sets row index. Preserves column index, sets anchor to "rltb", width and height to 1.

Parameters:
y - row index
Returns:
this

r

public HIGConstraints r(int r)
Sets row index. Preserves column index, sets anchor to "rltb", width and height to 1.

Parameters:
r - row index
Returns:
this

y

public HIGConstraints y(int y,
                        java.lang.String anchors)
Sets row index and anchors. Preserves column index, width and height to 1.

Parameters:
y - row index
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

r

public HIGConstraints r(int r,
                        java.lang.String anchors)
Sets row index and anchors. Preserves column index, width and height to 1.

Parameters:
r - row index
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

ywh

public HIGConstraints ywh(int y,
                          int w,
                          int h)
Sets row index, target area width and height. Preserves row index, sets anchors string to "lrtb".

Parameters:
y - row index
w - width, number of columns
h - height, number of rows
Returns:
this

rwh

public HIGConstraints rwh(int r,
                          int w,
                          int h)
Sets row index, target area width and height. Preserves row index, sets anchors string to "lrtb".

Parameters:
r - row index
w - width, number of columns
h - height, number of rows
Returns:
this

ywh

public HIGConstraints ywh(int y,
                          int w,
                          int h,
                          java.lang.String anchors)
Sets row index, target area width, height and anchors. Preserver column index.

Parameters:
y - row index
w - width, number of columns
h - height, number of rows
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

rwh

public HIGConstraints rwh(int r,
                          int w,
                          int h,
                          java.lang.String anchors)
Sets row index, target area width, height and anchors. Preserver column index.

Parameters:
r - row index
w - width, number of columns
h - height, number of rows
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

xy

public HIGConstraints xy(int x,
                         int y)
Sets row and column index. Sets anchor to "rltb", width and height to 1.

Parameters:
x - column index
y - row index
Returns:
this

rc

public HIGConstraints rc(int r,
                         int c)
Sets row and column index. Sets anchor to "rltb", width and height to 1.

Parameters:
r - row index
c - column index
Returns:
this

xy

public HIGConstraints xy(int x,
                         int y,
                         java.lang.String anchors)
Sets row and column index and anchors. Sets width and height to 1.

Parameters:
x - column index
y - row index
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

rc

public HIGConstraints rc(int r,
                         int c,
                         java.lang.String anchors)
Sets row and column index and anchors. Sets width and height to 1.

Parameters:
r - row index
c - column index
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

xywh

public HIGConstraints xywh(int x,
                           int y,
                           int w,
                           int h)
Sets row and column index, width and height. Sets anchors to "lrtb".

Parameters:
x - column index
y - row index
w - width, number of columns
h - height, number of rows
Returns:
this

rcwh

public HIGConstraints rcwh(int r,
                           int c,
                           int w,
                           int h)
Sets row and column index, width and height. Sets anchors to "lrtb".

Parameters:
r - row index
c - column index
w - width, number of columns
h - height, number of rows
Returns:
this

xywh

public HIGConstraints xywh(int x,
                           int y,
                           int w,
                           int h,
                           java.lang.String anchors)
Sets row and column index, width, height and anchors.

Parameters:
x - column index
y - row index
w - width, number of columns
h - height, number of rows
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

rcwh

public HIGConstraints rcwh(int r,
                           int c,
                           int w,
                           int h,
                           java.lang.String anchors)
Sets row and column index, width, height and anchors.

Parameters:
r - row index
c - column index
w - width, number of columns
h - height, number of rows
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

W

public HIGConstraints W(int w)
Sets width to absolute size in pixels. Preserves all other settings.

Parameters:
w - width value in pixels
Returns:
this

H

public HIGConstraints H(int h)
Sets width to absolute size in pixels. Preserves all other settings.

Parameters:
h - height value in pixels
Returns:
this

anchors

public HIGConstraints anchors(java.lang.String anchors)
Sets anchors string. Preserves all other settings.

Parameters:
anchors - anchors string (of letters 'l','r','t','b')
Returns:
this

x

public int x()
Returns current column index.

Returns:
current column index

y

public int y()
Returns current row index.

Returns:
current row index.

c

public int c()
Returns current column index.

Returns:
current column index.

r

public int r()
Returns current row index.

Returns:
current row index.