FileDocCategorySizeDatePackage
RenderingManager.javaAPI DocphoneME MR2 API (J2ME)3922Wed May 02 18:00:34 BST 2007com.sun.perseus.model

RenderingManager

public class RenderingManager extends Object
The RenderingManager class provides support for efficiently managing rendered areas in ModelNode implementations, such as AbstractShapeNode.
version
$Id: RenderingManager.java,v 1.4 2006/06/29 10:47:33 ln156897 Exp $

Fields Summary
protected ModelNode
node
The associated ModelNode, the one for which RenderingManager tracks regions.
protected boolean
rTileDirty
True when the rendering tile needs to be recomputed.
protected com.sun.perseus.j2d.Tile
rTile
The node's current rendering bounds
protected com.sun.perseus.j2d.Tile
lastRenderedTile
The node's most recent rendered tile.
protected com.sun.perseus.j2d.Tile
lrtCache
A value cached so that we don't reallocate tiles all the time.
Constructors Summary
protected RenderingManager(ModelNode node)

node
the associated ModeNode


             
        
        this.node = node;
    
Methods Summary
protected voidclearLastRenderedTile()
After calling this method, getLastRendered should always return null.

        lastRenderedTile = null;
    
protected final voiddirty()
Marks the rendering as dirty, meaning that the rendering tile cached value cannot be reused, if any value has been cached.

        rTileDirty = true;
        node.modifyingNodeRendering();
    
protected com.sun.perseus.j2d.TilegetLastRenderedTile()

return
the set node's last actual rendering. If this node's hasRendering method returns false, then this method should return null.

        return lastRenderedTile;
    
protected com.sun.perseus.j2d.TilegetRenderingTile()

return
the bounding box, in screen coordinate, which encompasses the node's rendering.

        if (rTileDirty) {
            node.computeRenderingTile(rTile);
            rTileDirty = false;
        }
            
        return rTile;
    
protected voidrendered()
Should be called by ModelNode implementations when they have just rendered so that the rendered area is captured in the lastRenderedTile. Important: it is the responsibility of the classes using this method to make sure the rendering tile is not dirty when calling this method. If the rendering tile is dirty, then the captured value will not correspond to the actual rendering area.

        if (lastRenderedTile == null) {
            lastRenderedTile = lrtCache;
        } 
        lastRenderedTile.x = rTile.x;
        lastRenderedTile.y = rTile.y;
        lastRenderedTile.maxX = rTile.maxX;
        lastRenderedTile.maxY = rTile.maxY;