HEADER

ru.biosoft.graphics
Class View

Direct Known Subclasses:
CompositeView, ImageView, LineView, ShapeView, TextView

public abstract class View

Base class for vizualization.

Version: 1.0

Field Summary
 final static intACTIVE
          Bit field of type.It is set, if the view can be selected.
 final static intBASELINE
          Alignment mode.
 final static intBOTTOM
          Alignment mode.
 final static intCENTER
          Alignment mode.
 final static intHIDE
          Bit field of type.It is set, if the view has visible state.
 final static intLEFT
          Alignment mode.
 final static intRIGHT
          Alignment mode.
 final static intTOP
          Alignment mode.

Constructor Summary
View(Shape shape)
          Constructs View using specified Shape

Method Summary
 RectanglegetBounds()
          Returns an integer Rectangle that completely encloses the View.
 ObjectgetModel()
          Returns model of view
 ShapegetShape()
          Returns shape of View.
 booleanintersects(Rectangle rect)
          Tests if this View's shape intersects the interior of a specified rectangle.
 booleanisActive()
          Returns true if view is active
 booleanisVisible()
          Returns true if view is visible
 abstract voidmove(int x, int y)
          Moves View to the new location using specified offsets.
 voidmove(Point offset)
          Moves View to the new location using specified offset.
 voidpaint(Graphics2D g2)
          Paints this view on specified Graphics2D.
 voidscale(double sx, double sy)
          Scales view in relation to old values.
 voidsetActive(boolean isActive)
          Sets active state of view
 voidsetLocation(int x, int y)
          Set the location of the upper left corner of the view x, y coordinates.
 voidsetLocation(Point pt)
          Set the location of the upper left corner of the view x, y coordinates.
 voidsetModel(Object model)
          Sets model of view
 voidsetToScale(double factorX, double factorY)
          Scales view absolutely.
 voidsetVisible(boolean isVisible)
          Sets visible state of view
 voidupdateBounds()
          Synchronizes the Rectangle rectangle returned by getBounds() with view.

Field Detail

ACTIVE

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

BASELINE

public final static int BASELINE
Alignment mode.

BOTTOM

public final static int BOTTOM
Alignment mode.

CENTER

public final static int CENTER
Alignment mode.

HIDE

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

LEFT

public final static int LEFT
Alignment mode.

RIGHT

public final static int RIGHT
Alignment mode.

TOP

public final static int TOP
Alignment mode.
Constructor Detail

View

public View(Shape shape)
Constructs View using specified Shape
Parameters:
shape - Shape of view
See Also:
Shape
Method Detail

getBounds

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

getModel

public Object getModel()
Returns model of view
Returns: model of view
See Also:
model

getShape

public Shape getShape()
Returns shape of View.
Returns: Shape of the View.

intersects

public boolean intersects(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

isActive

public boolean isActive()
Returns true if view is active
Returns: true if view is active

isVisible

public boolean isVisible()
Returns true if view is visible
Returns: true if view is visible

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(Point offset)
Moves View to the new location using specified offset.
Parameters:
offset - Point that units both coordinates.

paint

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

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

setActive

public void setActive(boolean isActive)
Sets active state of view
Parameters:
isActive - new active value

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(Point pt)
Set the location of the upper left corner of the view x, y coordinates.
Parameters:
pt - Point of new location

setModel

public void setModel(Object model)
Sets model of view
Parameters:
model - New model
See Also:
model

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

setVisible

public void setVisible(boolean isVisible)
Sets visible state of view
Parameters:
isVisible - new value of visible flag

updateBounds

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

Association Links

to Class java.awt.Shape

Shape of view

to Class java.awt.geom.AffineTransform

Affine transformer of view

FOOTER

BOTTOM