ru.biosoft.graphics
Class CompositeView

java.lang.Object
  extended byru.biosoft.graphics.View
      extended byru.biosoft.graphics.CompositeView
Direct Known Subclasses:
ArrowView, Ruler

public class CompositeView
extends View

Container for View objects.

Version:
1.0
Author:
DevelopmentOnTheEdge

Field Summary
protected  java.util.Vector children
          Storage for child views
protected static int DELTA
           
protected  java.awt.Rectangle rect
          Rectangle bound of this composite view
static int REL
          If this bit is cleared,then coordinates are used directly from x,y coordinates of view location
static int X_CC
          Arrange mode, view is arranged by center along X axis to the center along X axis of previous rectangle
static int X_LC
          Arrange mode, view is arranged by center along X axis to the left of previous rectangle
static int X_LL
          Arrange mode, view is arranged by left side to the left side of previous rectangle
static int X_LR
          Arrange mode, view is arranged by right side to the left side of previous rectangle
static int X_RC
          Arrange mode, view is arranged by center along X axis to the right of previous rectangle
static int X_RL
          Arrange mode, view is arranged by left side to the right of previous rectangle
static int X_RR
          Arrange mode, view is arranged by right side to the right side of previous rectangle
static int X_UN
          Arrange mode, X coordinate is get from x coordinate of view location
static int Y_BB
          Arrange mode, view is arranged by bottom side to the bottom of previous rectangle
static int Y_BC
          Arrange mode, view is arranged by center along Y axis to the bottom of previous rectangle
static int Y_BT
          Arrange mode, view is arranged by top side to the bottom of previous rectangle
static int Y_CC
          Arrange mode, view is arranged by center along Y axis to the center along Y axis of previous rectangle
static int Y_TB
          Arrange mode, view is arranged by bottom side to the top of previous rectangle
static int Y_TC
          Arrange mode, view is arranged by center along Y axis to the top of previous rectangle
static int Y_TT
          Arrange mode, view is arranged by top side to the top of previous rectangle
static int Y_UN
          Arrange mode, Y coordinate is get from y coordinate of view location
 
Fields inherited from class ru.biosoft.graphics.View
ACTIVE, at, BASELINE, BOTTOM, CENTER, HIDE, LEFT, model, RIGHT, shape, TOP, type
 
Constructor Summary
CompositeView()
          Constructs composite view
 
Method Summary
 void add(View v)
          Adds the view to the children list and corrects rectangle of composite view bound.
 void add(View v, int mode)
          Adds element with insets coordinates ( 0,0 )
 void add(View v, int mode, java.awt.Point insets)
          Adds new elements and arrange them relative the previous objects.
 View elementAt(int index)
          Returns the view at the specified index.
 java.awt.Rectangle getBounds()
          Returns rectangle bound of this composite view
 java.util.Enumeration getChildren()
          Returns an enumeration of the views of this composite view.
 View getDeepestActive(java.awt.Point pt)
          Returns deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.
 View getDeepestActive(java.awt.Point pt, java.lang.Object[] ignoreModels, java.lang.Class modelClass)
          Returns deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.
 java.awt.Point getLocation()
          Returns the location of this Rectangle bound.
 void insert(View v, int i)
          Inserts view in specified position.
 boolean intersects(java.awt.Rectangle rect)
          Tests if this composite view bound intersects the interior of a specified rectangle.
 void move(int x, int y)
          Moves all children to the new location using specified offsets
 void paint(java.awt.Graphics2D g)
          Paints this composite view on specified Graphics2D.
protected  boolean recursiveRemove(View v)
          Tracer for remove
 boolean remove(View v)
          Removes specified view from composite view
 void scale(double sx, double sy)
          Scales all children of container in relation to old values.
 int size()
          Return size of composite view
 void updateBounds()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rect

protected java.awt.Rectangle rect
Rectangle bound of this composite view


children

protected java.util.Vector children
Storage for child views


REL

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

See Also:
Constant Field Values

X_UN

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

See Also:
Constant Field Values

X_RL

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

See Also:
Constant Field Values

X_RC

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

See Also:
Constant Field Values

X_RR

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

See Also:
Constant Field Values

X_LL

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

See Also:
Constant Field Values

X_LC

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

See Also:
Constant Field Values

X_LR

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

See Also:
Constant Field Values

X_CC

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

See Also:
Constant Field Values

Y_UN

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

See Also:
Constant Field Values

Y_TT

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

See Also:
Constant Field Values

Y_TC

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

See Also:
Constant Field Values

Y_TB

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

See Also:
Constant Field Values

Y_BT

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

See Also:
Constant Field Values

Y_BC

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

See Also:
Constant Field Values

Y_BB

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

See Also:
Constant Field Values

Y_CC

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

See Also:
Constant Field Values

DELTA

protected static final int DELTA
See Also:
Constant Field Values
Constructor Detail

CompositeView

public CompositeView()
Constructs composite view

Method Detail

getChildren

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

Returns:
an enumeration of the views of this composite view.

scale

public void scale(double sx,
                  double sy)
Scales all children of container in relation to old values.

Overrides:
scale in class View
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

move

public void move(int x,
                 int y)
Moves all children to the new location using specified offsets

Specified by:
move in class View
Parameters:
x - offset along the X axis direction.
y - offset along the Y axis direction.

updateBounds

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

Overrides:
updateBounds in class View

elementAt

public View elementAt(int index)
Returns the view at the specified index.

Returns:
the view at the specified index.

size

public int size()
Return size of composite view

Returns:
size of composite view

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:
java.lang.ArrayIndexOutOfBoundsException - if the index was invalid.

add

public void add(View v,
                int mode)
Adds element with insets coordinates ( 0,0 )

Parameters:
v -
mode -
See Also:
add(View v, int mode, Point insets)

add

public void add(View v,
                int mode,
                java.awt.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.

recursiveRemove

protected boolean recursiveRemove(View v)
Tracer for remove

Parameters:
v - current view
Returns:
true if view is found in current node of tree

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.

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

getBounds

public java.awt.Rectangle getBounds()
Returns rectangle bound of this composite view

Overrides:
getBounds in class View
Returns:
rectangle bound of this composite view

intersects

public boolean intersects(java.awt.Rectangle rect)
Tests if this composite view bound intersects the interior of a specified rectangle.

Overrides:
intersects in class View
Parameters:
rect - specified rectangle
Returns:
true if intersects,false otherwise

getDeepestActive

public View getDeepestActive(java.awt.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.

getDeepestActive

public View getDeepestActive(java.awt.Point pt,
                             java.lang.Object[] ignoreModels,
                             java.lang.Class modelClass)
Returns deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.

Parameters:
pt - specified point
ignoreModels - ignore views whose modes are listed at ignoreModelsArray.
modelClass - if this parameter is specified the view model should be assignable to the specified class.
Returns:
deepest view in tree hierarchy, that has View.ACTIVE state and intersects the specified point.

getLocation

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

Returns:
the location of this Rectangle bound.

paint

public void paint(java.awt.Graphics2D g)
Paints this composite view on specified Graphics2D.

Overrides:
paint in class View
Parameters:
g - specified Graphics2D.


Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.