org.zaval.lw
Class LwImgRender

java.lang.Object
  |
  +--org.zaval.util.ValidationObject
        |
        +--org.zaval.lw.LwView
              |
              +--org.zaval.lw.LwRender
                    |
                    +--org.zaval.lw.LwImgRender
All Implemented Interfaces:
Validationable
Direct Known Subclasses:
LwImgSetRender

public class LwImgRender
extends LwRender

This class implements image render. The target object is java.awt.Image object.


Fields inherited from class org.zaval.lw.LwView
MOSAIC, ORIGINAL, STRETCH
 
Fields inherited from class org.zaval.util.ValidationObject
isValidFlag
 
Constructor Summary
LwImgRender(java.awt.Image img, int type)
          Constructs the render with the specified target image and the view type.
LwImgRender(java.lang.String name)
          Constructs the render with the specified target image name.
LwImgRender(java.lang.String name, int type)
          Constructs the render with the specified target image name and the view type.
 
Method Summary
protected  java.awt.Dimension calcPreferredSize()
          Calculates and returns the view preferred size.
 java.awt.Image getImage()
          Gets the target image object that is painted with the render.
 void paint(java.awt.Graphics g, int x, int y, int w, int h, Drawable d)
          Paints the view using a given width and height.
 
Methods inherited from class org.zaval.lw.LwRender
getTarget, setTarget, targetWasChanged
 
Methods inherited from class org.zaval.lw.LwView
getInsets, getPreferredSize, getType, ownerChanged, paint, recalc, setType
 
Methods inherited from class org.zaval.util.ValidationObject
invalidate, isValid, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LwImgRender

public LwImgRender(java.awt.Image img,
                   int type)
Constructs the render with the specified target image and the view type.
Parameters:
img - the specified target image to be rendered.
type - the specified view type.

LwImgRender

public LwImgRender(java.lang.String name)
Constructs the render with the specified target image name. The name is a path to the image file relatively the "org/zaval/lw" directory The constructor sets MOSAIC view type as default.
Parameters:
name - the specified image name.

LwImgRender

public LwImgRender(java.lang.String name,
                   int type)
Constructs the render with the specified target image name and the view type. The name is a path to the image file relatively light weight resource directory ("org/zaval/lw").
Parameters:
name - the specified image name.
type - the specified view type.
Method Detail

getImage

public java.awt.Image getImage()
Gets the target image object that is painted with the render.
Returns:
a target image object.

paint

public void paint(java.awt.Graphics g,
                  int x,
                  int y,
                  int w,
                  int h,
                  Drawable d)
Paints the view using a given width and height. The location where the view has to be painted is determined with x and y coordinates.
Overrides:
paint in class LwView
Parameters:
g - the specified context to be used for painting.
x - the x coordinate.
y - the y coordinate.
w - the width of the view.
h - the height of the view.
d - the owner component.

calcPreferredSize

protected java.awt.Dimension calcPreferredSize()
Calculates and returns the view preferred size. The render returns the target image size as the "pure" preferred size.
Overrides:
calcPreferredSize in class LwView
Returns:
a "pure" preferred size of the view.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org