HEADER

ru.biosoft.graphics
Class CompositeView

ru.biosoft.graphics.View
  |
  +--ru.biosoft.graphics.CompositeView
Direct Known Subclasses:
ArrowView, Ruler

public class CompositeView
extends View

Container for View objects.

Version: 1.0

Field Summary
 final static intREL
          If this bit is cleared,then coordinates are used directly from x,y coordinates of view location
 final static intX_CC
          Arrange mode, view is arranged by center along X axis to the center along X axis of previous rectangle
 final static intX_LC
          Arrange mode, view is arranged by center along X axis to the left of previous rectangle
 final static intX_LL
          Arrange mode, view is arranged by left side to the left side of previous rectangle
 final static intX_LR
          Arrange mode, view is arranged by right side to the left side of previous rectangle
 final static intX_RC
          Arrange mode, view is arranged by center along X axis to the right of previous rectangle
 final static intX_RL
          Arrange mode, view is arranged by left side to the right of previous rectangle
 final static intX_RR
          Arrange mode, view is arranged by right side to the right side of previous rectangle
 final static intX_UN
          Arrange mode, X coordinate is get from x coordinate of view location
 final static intY_BB
          Arrange mode, view is arranged by bottom side to the bottom of previous rectangle
 final static intY_BC
          Arrange mode, view is arranged by center along Y axis to the bottom of previous rectangle
 final static intY_BT
          Arrange mode, view is arranged by top side to the bottom of previous rectangle
 final static intY_CC
          Arrange mode, view is arranged by center along Y axis to the center along Y axis of previous rectangle
 final static intY_TB
          Arrange mode, view is arranged by bottom side to the top of previous rectangle
 final static intY_TC
          Arrange mode, view is arranged by center along Y axis to the top of previous rectangle
 final static intY_TT
          Arrange mode, view is arranged by top side to the top of previous rectangle
 final static intY_UN
          Arrange mode, Y coordinate is get from y coordinate of view location

Fields inherited from class ru.biosoft.graphics.View
ACTIVE, BASELINE, BOTTOM, CENTER, HIDE, LEFT, RIGHT, TOP

Constructor Summary
CompositeView()
          Constructs composite view

Method Summary
 voidadd(View v, int mode)
          Adds element with insets coordinates ( 0,0 )
 voidadd(View v, int mode, Point insets)
          Adds new elements and arrange them relative the previous objects.
 voidadd(View v)
          Adds the view to the children list and corrects rectangle of composite view bound.
 ViewelementAt(int index)
          Returns the view at the specified index.
 RectanglegetBounds()
          Returns rectangle bound of this composite view
 EnumerationgetChildren()
          Returns an enumeration of the views of this composite view.
 ViewgetDeepestActive(Point pt)
          Returns deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.
 PointgetLocation()
          Returns the location of this Rectangle bound.
 voidinsert(View v, int i)
          Inserts view in specified position.
 booleanintersects(Rectangle rect)
          Tests if this composite view bound intersects the interior of a specified rectangle.
 voidmove(int x, int y)
          Moves all children to the new location using specified offsets
 voidpaint(Graphics2D g)
          Paints this composite view on specified Graphics2D.
 booleanremove(View v)
          Removes specified view from composite view
 voidscale(double sx, double sy)
          Scales all children of container in relation to old values.
 intsize()
          Return size of composite view
 voidupdateBounds()
          Synchronizes the Rectangle rectangle returned by getBounds() with composite view.

Methods inherited from class ru.biosoft.graphics.View
getModel, getShape, isActive, isVisible, move, setActive, setLocation, setLocation, setModel, setToScale, setVisible

Field Detail

REL

public final static int REL
If this bit is cleared,then coordinates are used directly from x,y coordinates of view location

X_CC

public final static int X_CC
Arrange mode, view is arranged by center along X axis to the center along X axis of previous rectangle

X_LC

public final static int X_LC
Arrange mode, view is arranged by center along X axis to the left of previous rectangle

X_LL

public final static int X_LL
Arrange mode, view is arranged by left side to the left side of previous rectangle

X_LR

public final static int X_LR
Arrange mode, view is arranged by right side to the left side of previous rectangle

X_RC

public final static int X_RC
Arrange mode, view is arranged by center along X axis to the right of previous rectangle

X_RL

public final static int X_RL
Arrange mode, view is arranged by left side to the right of previous rectangle

X_RR

public final static int X_RR
Arrange mode, view is arranged by right side to the right side of previous rectangle

X_UN

public final static int X_UN
Arrange mode, X coordinate is get from x coordinate of view location

Y_BB

public final static int Y_BB
Arrange mode, view is arranged by bottom side to the bottom of previous rectangle

Y_BC

public final static int Y_BC
Arrange mode, view is arranged by center along Y axis to the bottom of previous rectangle

Y_BT

public final static int Y_BT
Arrange mode, view is arranged by top side to the bottom of previous rectangle

Y_CC

public final static int Y_CC
Arrange mode, view is arranged by center along Y axis to the center along Y axis of previous rectangle

Y_TB

public final static int Y_TB
Arrange mode, view is arranged by bottom side to the top of previous rectangle

Y_TC

public final static int Y_TC
Arrange mode, view is arranged by center along Y axis to the top of previous rectangle

Y_TT

public final static int Y_TT
Arrange mode, view is arranged by top side to the top of previous rectangle

Y_UN

public final static int Y_UN
Arrange mode, Y coordinate is get from y coordinate of view location
Constructor Detail

CompositeView

public CompositeView()
Constructs composite view
Method Detail

add

public void add(View v, int mode)
Adds element with insets coordinates ( 0,0 )
Parameters:
v
mode
See Also:
add(ru.biosoft.graphics.View,int,java.awt.Point)

add

public void add(View v, int mode, Point insets)
Adds new elements and arrange them relative the previous objects.
Parameters:
v - specified View
mode - mode to arrange new element relative previous: Abrevations:
X_RL
| ||
| |--- boundary of new element
| ---- boundary of minimal rectangle, described all
|      previous elements
------ x or y coordinate

X - the x coordinate:
L - left boundary of the object
C - center of the object
R - right boundary of the object

Y - the y coordinate:
T - top boundary of the object
C - center of the object
B - bottom boundary of the object

Special:
UN  - don't change the corresponding x or y boundory of new element.
REL - If this bit is cleared, target coordinates is used from location of view.
insets - Determines the insets of this view in relation to the side of rectangle.
When mode along X axis is X_RR or X_LR added view shifts to the left. Otherwise it shifts to the right for the rest of modes.
When mode along Y axis is Y_BB or Y_TB added view shifts to the up. Otherwise it shifts to the down for the rest of modes.

add

public void add(View v)
Adds the view to the children list and corrects rectangle of composite view bound. The location of view is copied from view location
Parameters:
v - the added view

elementAt

public View elementAt(int index)
Returns the view at the specified index.
Parameters:
an - index into this composite view.
Returns: the view at the specified index.

getBounds

public Rectangle getBounds()
Returns rectangle bound of this composite view
Returns: rectangle bound of this composite view

getChildren

public Enumeration getChildren()
Returns an enumeration of the views of this composite view.
Returns: an enumeration of the views of this composite view.

getDeepestActive

public View getDeepestActive(Point pt)
Returns deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.
Parameters:
pt - specified point
Returns: deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.

getLocation

public Point getLocation()
Returns the location of this Rectangle bound.
Returns: the location of this Rectangle bound.

insert

public void insert(View v, int i)
throws java.lang.ArrayIndexOutOfBoundsException
Inserts view in specified position.
Parameters:
v - inserted View
i - target position
Throws:
ArrayIndexOutOfBoundsException - if the index was invalid.

intersects

public boolean intersects(Rectangle rect)
Tests if this composite view bound intersects the interior of a specified rectangle.
Parameters:
rect - specified rectangle
Returns: true if intersects,false otherwise

move

public void move(int x, int y)
Moves all children to the new location using specified offsets
Parameters:
x - offset along the X axis direction.
y - offset along the Y axis direction.

paint

public void paint(Graphics2D g)
Paints this composite view on specified Graphics2D.
Parameters:
g2 - specified Graphics2D.

remove

public boolean remove(View v)
Removes specified view from composite view
Parameters:
v - specified view
Returns: true if view is removed or false otherwise.

scale

public void scale(double sx, double sy)
Scales all children of container in relation to old values.
Parameters:
sx - the factor by which coordinates are scaled along the X axis direction
sy - the factor by which coordinates are scaled along the Y axis direction

size

public int size()
Return size of composite view
Returns: size of composite view

updateBounds

public void updateBounds()
Synchronizes the Rectangle rectangle returned by getBounds() with composite view.

Association Links

to Class java.awt.Rectangle

Rectangle bound of this composite view

to Class java.util.Vector

Storage for child views

to Class ru.biosoft.graphics.View

to Class java.awt.Rectangle


FOOTER

BOTTOM