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

TextProxy

public class TextProxy extends StructureNodeProxy
A TextProxy proxies a Text node and computes its expanded content from the proxied text's data content.
version
$Id: TextProxy.java,v 1.10 2006/06/29 10:47:35 ln156897 Exp $

Fields Summary
protected RenderingManager
renderingManager
Used to track the node's rendering area and the rendered areas.
protected GlyphLayout
firstChunk
Points to the first text chunk.
protected GlyphLayout
lastChunk
Points to the last text chunk.
Constructors Summary
public TextProxy(Text proxiedText)

param
proxiedText Text node to proxy.

        super(proxiedText);
        if (DirtyAreaManager.ON) {
            renderingManager = new RenderingManager(this);
        }
    
Methods Summary
com.sun.perseus.j2d.BoxaddNodeBBox(com.sun.perseus.j2d.Box bbox, com.sun.perseus.j2d.Transform t)

param
bbox the bounding box to which this node's bounding box should be appended. That bounding box is in the target coordinate space. It may be null, in which case this node should create a new one.
param
t the transform from the node coordinate system to the coordinate system into which the bounds should be computed.
return
the bounding box of this node, in the target coordinate space,

        checkLayout();
        return ((Text) proxied).addNodeBBox(bbox, t, firstChunk);
    
voidcheckLayout()
Checks that the text's layout has been computed and computes it in case it was not.

        if (firstChunk == null) {
            firstChunk = ((Text) proxied).layoutText(this);
            GlyphLayout cur = firstChunk;
            while (cur.nextSibling != null) {
                cur = cur.nextSibling;
            }
            lastChunk = (GlyphLayout) cur;
        }
    
public voidclearLayouts()
Clears the node's layout cache. For ElementNodeProxy, we just reset the node so that expanded content be computed again and we request the proxied node to also clear its layout cache. This is to ensure that Font Data Base changes are covered.

        modifyingNode();
        clearLayoutsQuiet();
        super.clearLayouts();
        modifiedNode();
    
public voidclearLayoutsQuiet()
Clears all cached layout information but does not generate modification events for this node.

        firstChunk = null;
        lastChunk = null;
    
protected voidcomputeRenderingTile(com.sun.perseus.j2d.Tile tile)
This method is overridden for elements which has special renderings, such as the ShapeNodes.

param
tile the Tile instance whose bounds should be set.

        checkLayout();
        ((Text) proxied).computeRenderingTile(tile, txf, this, firstChunk);
    
public org.w3c.dom.svg.SVGRectgetBBox()

return
the tight bounding box in current user coordinate space.

        return addNodeBBox(null, null);
    
public booleanhasNodeRendering()
An TextProxy has something to render

return
true

        return true;
    
public voidpaint(com.sun.perseus.j2d.RenderGraphics rg)
Paints this node into the input RenderGraphics.

param
rg the RenderGraphics where the node should paint itself

        checkLayout();

        if (canRenderState != 0) {
            return;
        }

        if (DirtyAreaManager.ON) {
            Tile primitiveTile = getRenderingTile();
            if (primitiveTile == null 
                || 
                rg.getRenderingTile().isHit(primitiveTile)) {
                // rg.setPrimitiveTile(primitiveTile);
                ((Text) proxied).paintRendered(rg, this, txf, firstChunk);

                // nodeRendered is called seperately from paintRendered
                // because paintRendered is used in different contexts,
                // for example by proxy nodes to render, using their
                // proxied node's paintRendered method.
                nodeRendered();
            }
        } else {
            ((Text) proxied).paintRendered(rg, this, txf, firstChunk);
        }
    
final voidrenderingDirty()
Should be called whenever this node's rendering becomes dirty.

        if (DirtyAreaManager.ON) {
            renderingManager.dirty();
        }
    
public voidsetDisplay(boolean newDisplay)

param
newDisplay the new computed display value

        super.setDisplay(newDisplay);

        renderingDirty();
    
public voidsetFill(com.sun.perseus.j2d.PaintServer newFill)

param
newFill the new computed fill property.

        this.fill = newFill;
        renderingDirty();
    
public voidsetFillOpacity(float newFillOpacity)

param
newFillOpacity the new computed value for the fill opacity property.

                
        super.setFillOpacity(newFillOpacity);
        
        if (fill != null) {
            renderingDirty();
        }
    
public voidsetFontFamily(java.lang.String[] newFontFamily)

param
newFontFamily the new computed font-family property value.

        this.fontFamily = newFontFamily;

        clearLayoutsQuiet();

        if (stroke != null || fill != null) {
            renderingDirty();
        }
    
public voidsetFontSize(float newFontSize)

param
newFontSize the new computed font-size property value.

        this.fontSize = newFontSize;
        
        if (stroke != null || fill != null) {
            renderingDirty();
        }

        computeCanRenderFontSizeBit(newFontSize);
    
public voidsetFontStyle(int newFontStyle)

param
newFontStyle the new computed font-style property.

        super.setFontStyle(newFontStyle);
        if (stroke != null || fill != null) {
            renderingDirty();
        }

        clearLayoutsQuiet();
    
public voidsetFontWeight(int newFontWeight)

param
newFontWeight new computed value for the font-weight property.

        super.setFontWeight(newFontWeight);

        if (stroke != null || fill != null) {
            renderingDirty();
        }

        clearLayoutsQuiet();
    
protected voidsetProxied(ElementNode newProxied)
Disallow proxing of anything else than Text nodes.

param
newProxied this node's new proxied node
throws
IllegalArgumentException if the input new proxy is not a Text node.
see
ElementNodeProxy#setProxied

        if (newProxied != null && !(newProxied instanceof Text)) {
            throw new IllegalArgumentException();
        }

        super.setProxied(newProxied);
        clearLayoutsQuiet();
    
public voidsetStroke(com.sun.perseus.j2d.PaintServer newStroke)

param
newStroke the new computed stroke property.

        this.stroke = newStroke;
        renderingDirty();
    
public voidsetStrokeDashArray(float[] newStrokeDashArray)

param
newStrokeDashArray the new computed stroke-dasharray property value.

        strokeDashArray = newStrokeDashArray;

        if (stroke != null) {
            renderingDirty();
        }
    
public voidsetStrokeDashOffset(float newStrokeDashOffset)

param
newStrokeDashOffset the new stroke-dashoffset computed property value.

        strokeDashOffset = newStrokeDashOffset;

        if (stroke != null && strokeDashArray != null) {
            renderingDirty();
        }
    
public voidsetStrokeLineCap(int newStrokeLineCap)

param
newStrokeLineCap the new value for the stroke-linecap property.

        super.setStrokeLineCap(newStrokeLineCap);

        if (stroke != null) {
            renderingDirty();
        }
    
public voidsetStrokeLineJoin(int newStrokeLineJoin)

param
newStrokeLineJoin the new computed value for stroke-line-join

        super.setStrokeLineJoin(newStrokeLineJoin);

        if (stroke != null) {
            renderingDirty();
        }
    
public voidsetStrokeMiterLimit(float newStrokeMiterLimit)

param
newStrokeMiterLimit the new computed stroke-miterlimit property.

        strokeMiterLimit = newStrokeMiterLimit; 

        if (stroke != null && getStrokeLineJoin() == JOIN_MITER) {
            renderingDirty();
        }
    
public voidsetStrokeOpacity(float newStrokeOpacity)

param
newStrokeOpacity the new computed stroke-opacity property.

        super.setStrokeOpacity(newStrokeOpacity);
        
        if (stroke != null) {
            renderingDirty();
        }
    
public voidsetStrokeWidth(float newStrokeWidth)

param
newStrokeWidth the new computed stroke-width property value.

        strokeWidth = newStrokeWidth;

        // Only dirty rendering if the object is actually stroked.
        if (stroke != null) {
            renderingDirty();
        }
    
public voidsetTextAnchor(int newTextAnchor)
Sets the value of the computed text anchor property.

param
newTextAnchor the new value for the computed text anchor property.

        super.setTextAnchor(newTextAnchor);

        if (stroke != null || fill != null) {            
            renderingDirty();
        }
    
public voidsetVisibility(boolean newVisibility)

param
newVisibility the new computed visibility property.

        super.setVisibility(newVisibility);

        renderingDirty();