ru.biosoft.graphics
Class View

java.lang.Object
  extended byru.biosoft.graphics.View
Direct Known Subclasses:
CompositeView, HtmlView, ImageView, LineView, ShapeView, TextView

public abstract class View
extends java.lang.Object

Base class for vizualization.

Version:
1.0
Author:
DevelopmentOnTheEdge

Field Summary
static int ACTIVE
          Bit field of type.It is set, if the view can be selected.
protected  java.awt.geom.AffineTransform at
          Affine transformer of view
static int BASELINE
          Alignment mode.
static int BOTTOM
          Alignment mode.
static int CENTER
          Alignment mode.
static int HIDE
          Bit field of type.It is set, if the view has visible state.
static int LEFT
          Alignment mode.
protected  java.lang.Object model
          The model of the view.
static int RIGHT
          Alignment mode.
protected  java.awt.Shape shape
          Shape of view
static int TOP
          Alignment mode.
protected  int type
          Type of view.
 
Constructor Summary
View(java.awt.Shape shape)
          Constructs View using specified Shape
 
Method Summary
 java.awt.Rectangle getBounds()
          Returns an integer Rectangle that completely encloses the View.
 java.lang.Object getModel()
          Returns model of view
 java.awt.Shape getShape()
          Returns shape of View.
 boolean intersects(java.awt.Rectangle rect)
          Tests if this View's shape intersects the interior of a specified rectangle.
 boolean isActive()
          Returns true if view is active
 boolean isVisible()
          Returns true if view is visible
abstract  void move(int x, int y)
          Moves View to the new location using specified offsets.
 void move(java.awt.Point offset)
          Moves View to the new location using specified offset.
 void paint(java.awt.Graphics2D g2)
          Paints this view on specified Graphics2D.
 void scale(double sx, double sy)
          Scales view in relation to old values.
 void setActive(boolean isActive)
          Sets active state of view
 void setLocation(int x, int y)
          Set the location of the upper left corner of the view x, y coordinates.
 void setLocation(java.awt.Point pt)
          Set the location of the upper left corner of the view x, y coordinates.
 void setModel(java.lang.Object model)
          Sets model of view
 void setToScale(double factorX, double factorY)
          Scales view absolutely.
 void setVisible(boolean isVisible)
          Sets visible state of view
 void updateBounds()
          Synchronizes the Rectangle rectangle returned by getBounds() with view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shape

protected java.awt.Shape shape
Shape of view


type

protected int type
Type of view.


model

protected java.lang.Object model
The model of the view. Object for which view is created


at

protected java.awt.geom.AffineTransform at
Affine transformer of view


ACTIVE

public static final int ACTIVE
Bit field of type.It is set, if the view can be selected.

See Also:
Constant Field Values

HIDE

public static final int HIDE
Bit field of type.It is set, if the view has visible state.

See Also:
Constant Field Values

LEFT

public static final int LEFT
Alignment mode.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Alignment mode.

See Also:
Constant Field Values

CENTER

public static final int CENTER
Alignment mode.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Alignment mode.

See Also:
Constant Field Values

TOP

public static final int TOP
Alignment mode.

See Also:
Constant Field Values

BASELINE

public static final int BASELINE
Alignment mode.

See Also:
Constant Field Values
Constructor Detail

View

public View(java.awt.Shape shape)
Constructs View using specified Shape

Parameters:
shape - Shape of view
See Also:
Shape
Method Detail

getModel

public java.lang.Object getModel()
Returns model of view

Returns:
model of view
See Also:
model

setModel

public void setModel(java.lang.Object model)
Sets model of view

Parameters:
model - New model
See Also:
model

getBounds

public java.awt.Rectangle getBounds()
Returns an integer Rectangle that completely encloses the View.

Returns:
an integer Rectangle that completely encloses the View.

getShape

public java.awt.Shape getShape()
Returns shape of View.

Returns:
Shape of the View.

updateBounds

public void updateBounds()
Synchronizes the Rectangle rectangle returned by getBounds() with view. Base implementation of method does nothing.


intersects

public boolean intersects(java.awt.Rectangle rect)
Tests if this View's shape intersects the interior of a specified rectangle.

Parameters:
rect - specified rectangle
Returns:
true if intersects,false otherwise

setLocation

public void setLocation(int x,
                        int y)
Set the location of the upper left corner of the view x, y coordinates.

Parameters:
x - new coordinate along X axis
y - new coordinate along Y axis

setLocation

public void setLocation(java.awt.Point pt)
Set the location of the upper left corner of the view x, y coordinates.

Parameters:
pt - Point of new location

move

public abstract void move(int x,
                          int y)
Moves View to the new location using specified offsets.

Parameters:
x - offset along the X axis direction.
y - offset along the Y axis direction.

move

public void move(java.awt.Point offset)
Moves View to the new location using specified offset.

Parameters:
offset - Point that units both coordinates.

setToScale

public void setToScale(double factorX,
                       double factorY)
Scales view absolutely.

Parameters:
factorX - sets factor along the X axis direction
factorY - sets factor along the Y axis direction

scale

public void scale(double sx,
                  double sy)
Scales view 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

isActive

public boolean isActive()
Returns true if view is active

Returns:
true if view is active

setActive

public void setActive(boolean isActive)
Sets active state of view

Parameters:
isActive - new active value

isVisible

public boolean isVisible()
Returns true if view is visible

Returns:
true if view is visible

setVisible

public void setVisible(boolean isVisible)
Sets visible state of view

Parameters:
isVisible - new value of visible flag

paint

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

Parameters:
g2 - specified Graphics2D.


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