You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Finn Bock <bc...@worldonline.dk> on 2004/08/30 14:22:27 UTC

Re: cvs commit: xml-fop/src/java/org/apache/fop/render/rtf TextAttributesConverter.java

gmazza@apache.org wrote:

>   Log:
>   Convenience method fobj.getPropLength() added to simplify some of the code.

>   --- FObj.java	20 Aug 2004 09:38:21 -0000	1.69
>   +++ FObj.java	29 Aug 2004 20:17:34 -0000	1.70
>   @@ -196,6 +196,17 @@
>         */
>        public String getPropString(int propId) {
>            return propertyList.get(propId).getString();
>   +    }
>   +
>   +    /**
>   +     * Convenience method to quickly obtain the length value of a property
>   +     * for this FO, without querying for the propertyList first.
>   +     * Meaningful only for properties having a length representation
>   +     * @param propId - the Constants ID of the desired property to obtain
>   +     * @return the length value of the property value
>   +     */
>   +    public int getPropLength(int propId) {
>   +        return propertyList.get(propId).getLength().getValue();
>        }


Careful here. The final getValue() call can not be performed during 
addProperties() because no base values has yet been assigned to resolve 
relative percentages against.

The getValue() method can only be called from the 
LayoutManager.getNextBreakPoss() loop.

The code you changed in the FO classes was also wrong before, luckily 
the resulting values was never used (I hope).

regards,
finn

Re: cvs commit: xml-fop/src/java/org/apache/fop/render/rtf TextAttributesConverter.java

Posted by Glen Mazza <gr...@yahoo.com>.
Thanks--I'll add a comment to that effect.

Glen

--- Finn Bock <bc...@worldonline.dk> wrote:

> gmazza@apache.org wrote:
> 
> >   Log:
> >   Convenience method fobj.getPropLength() added to
> simplify some of the code.
> 
> >   --- FObj.java	20 Aug 2004 09:38:21 -0000	1.69
> >   +++ FObj.java	29 Aug 2004 20:17:34 -0000	1.70
> >   @@ -196,6 +196,17 @@
> >         */
> >        public String getPropString(int propId) {
> >            return
> propertyList.get(propId).getString();
> >   +    }
> >   +
> >   +    /**
> >   +     * Convenience method to quickly obtain the
> length value of a property
> >   +     * for this FO, without querying for the
> propertyList first.
> >   +     * Meaningful only for properties having a
> length representation
> >   +     * @param propId - the Constants ID of the
> desired property to obtain
> >   +     * @return the length value of the property
> value
> >   +     */
> >   +    public int getPropLength(int propId) {
> >   +        return
> propertyList.get(propId).getLength().getValue();
> >        }
> 
> 
> Careful here. The final getValue() call can not be
> performed during 
> addProperties() because no base values has yet been
> assigned to resolve 
> relative percentages against.
> 
> The getValue() method can only be called from the 
> LayoutManager.getNextBreakPoss() loop.
> 
> The code you changed in the FO classes was also
> wrong before, luckily 
> the resulting values was never used (I hope).
> 
> regards,
> finn
>