Examples of FObj


Examples of org.apache.fop.fo.FObj

        if ((cachedInstance == null
                || cachedInstance == newInstance)
                && !("".equals(newInstance.backgroundImage))) {
            //Additional processing: preload image
            String uri = URISpecification.getURL(newInstance.backgroundImage);
            FObj fobj = pList.getFObj();
            FOUserAgent userAgent = pList.getFObj().getUserAgent();
            ImageManager manager = userAgent.getFactory().getImageManager();
            ImageSessionContext sessionContext = userAgent.getImageSessionContext();
            ImageInfo info;
            try {
                info = manager.getImageInfo(uri, sessionContext);
                newInstance.backgroundImageInfo = info;
            } catch (ImageException e) {
                ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
                        fobj.getUserAgent().getEventBroadcaster());
                eventProducer.imageError(fobj, uri, e, fobj.getLocator());
            } catch (FileNotFoundException fnfe) {
                ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
                        fobj.getUserAgent().getEventBroadcaster());
                eventProducer.imageNotFound(fobj, uri, fnfe, fobj.getLocator());
            } catch (IOException ioe) {
                ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
                        fobj.getUserAgent().getEventBroadcaster());
                eventProducer.imageIOError(fobj, uri, ioe, fobj.getLocator());
            }
        }

        return (cachedInstance != null ? cachedInstance : newInstance);
    }
View Full Code Here

Examples of org.apache.fop.fo.FObj

                                        PropertyList propertyList, FObj fo)
                    throws PropertyException {
            if (p instanceof ColorProperty) {
                return p;
            }
            FObj fobj = (fo == null ? propertyList.getFObj() : fo);
            FOUserAgent ua = (fobj == null ? null : fobj.getUserAgent());
            Color val = p.getColor(ua);
            if (val != null) {
                return new ColorProperty(val);
            }
            return convertPropertyDatatype(p, propertyList, fo);
View Full Code Here

Examples of org.apache.fop.fo.FObj

        Length distance =
            pInfo.getPropertyList().get("provisional-distance-between-starts").getLength();
        Length separation =
            pInfo.getPropertyList().getNearestSpecified("provisional-label-separation").getLength();

        FObj item = pInfo.getFO();
        while (item != null &&!(item instanceof ListItem)) {
            item = item.getParent();
        }
        if (item == null) {
            throw new PropertyException("label-end() called from outside an fo:list-item");
        }
        Length startIndent = item.properties.get("start-indent").getLength();
View Full Code Here

Examples of org.apache.fop.fo.FObj

     * cases, because this function is not implemented
     */
    public Property eval(Property[] args,
                         PropertyInfo pInfo) throws PropertyException {
       
        FObj fo = pInfo.getPropertyList().getFObj();
       
        /* obtain property Id for the property for which the function is being
         * evaluated */
        int propId = 0;
        if (args.length == 0) {
            propId = pInfo.getPropertyMaker().getPropId();
        } else {
            String propName = args[0].getString();
            propId = FOPropertyMapping.getPropertyId(propName);
        }
       
        /* make sure we have a correct property id ... */
        if (propId != -1) {
            /* obtain column number for which the function is being evaluated: */
            int columnNumber = -1;
            int span = 0;
            if (fo.getNameId() != Constants.FO_TABLE_CELL) {
                // climb up to the nearest cell
                do {
                    fo = (FObj) fo.getParent();
                } while (fo.getNameId() != Constants.FO_TABLE_CELL
                          && fo.getNameId() != Constants.FO_PAGE_SEQUENCE);
                if (fo.getNameId() == Constants.FO_TABLE_CELL) {
                    //column-number is available on the cell
                    columnNumber = ((TableCell) fo).getColumnNumber();
                    span = ((TableCell) fo).getNumberColumnsSpanned();
                } else {
                    //means no table-cell was found...
View Full Code Here

Examples of org.apache.fop.fo.FObj

     * @param   propertyList
     * @return  the default value for column-number
     * @throws  PropertyException
     */
    public Property make(PropertyList propertyList) throws PropertyException {
        FObj fo = propertyList.getFObj();

        if (fo.getNameId() == Constants.FO_TABLE_CELL
                || fo.getNameId() == Constants.FO_TABLE_COLUMN) {
            TableFObj parent = (TableFObj) propertyList.getParentFObj();
            int columnIndex = parent.getCurrentColumnIndex();
            if (fo.getNameId() == Constants.FO_TABLE_CELL
                    && parent.getNameId() == Constants.FO_TABLE_BODY) {
                boolean startsRow = propertyList.get(Constants.PR_STARTS_ROW)
                    .getEnum() == Constants.EN_TRUE;

                //cell w/ starts-row="true", but previous cell
                //didn't have ends-row="true", so index has still has
                //to be reset (for other cases this already happened in
                //body.addChildNode())
                if (startsRow && !((TableBody) parent).lastCellEndedRow()) {
                    //reset column index, and reassign...
                    ((TableBody) parent).resetColumnIndex();
                    columnIndex = parent.getCurrentColumnIndex();
                }
            }
            return new NumberProperty(columnIndex);
        } else {
            throw new PropertyException("column-number property is only allowed"
                    + " on fo:table-cell or fo:table-column, not on "
                    + fo.getName());
        }
    }
View Full Code Here

Examples of org.apache.fop.fo.FObj

        }
        int correspondingId = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
           
        Property p = propertyList.getExplicitOrShorthand(correspondingId);
        if (p != null) {
            FObj parentFO = propertyList.getParentFObj();
            p = baseMaker.convertProperty(p, propertyList, parentFO);
        }
        return p;
    }
View Full Code Here

Examples of org.apache.fop.fo.FObj

     * Set default precedence according to the parent FObj
     *
     * @see PropertyMaker#compute(PropertyList)
     */
    public Property make(PropertyList propertyList) throws PropertyException {
        FObj fo = propertyList.getFObj();
        switch (fo.getNameId()) {
        case Constants.FO_TABLE:
            return num6;
        case Constants.FO_TABLE_CELL:
            return num5;
        case Constants.FO_TABLE_COLUMN:
View Full Code Here

Examples of org.apache.fop.fo.FObj

    public Property get(int subpropId, PropertyList propertyList,
                        boolean tryInherit, boolean tryDefault)
            throws PropertyException {
       
        Property p = super.get(0, propertyList, tryInherit, tryDefault);   
        FObj fo = propertyList.getFObj();
        String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT)
            ? fo.getFOEventHandler().getUserAgent().getPageHeight()
                    : fo.getFOEventHandler().getUserAgent().getPageWidth();
       
        if (p.getEnum() == Constants.EN_INDEFINITE) {
            int otherId = (propId == Constants.PR_PAGE_HEIGHT)
                ? Constants.PR_PAGE_WIDTH : Constants.PR_PAGE_HEIGHT;
            int writingMode = propertyList.get(Constants.PR_WRITING_MODE).getEnum();
            int refOrientation = propertyList.get(Constants.PR_REFERENCE_ORIENTATION)
                        .getNumeric().getValue();
            if (propertyList.getExplicit(otherId) != null
                    && propertyList.getExplicit(otherId).getEnum() == Constants.EN_INDEFINITE) {
                //both set to "indefinite":
                //determine which one of the two defines the dimension
                //in block-progression-direction, and set the other to
                //"auto"
                if ((writingMode != Constants.EN_TB_RL
                        && (refOrientation == 0
                                || refOrientation == 180
                                || refOrientation == -180))
                     || (writingMode == Constants.EN_TB_RL
                             && (refOrientation == 90
                                     || refOrientation == 270
                                     || refOrientation == -270))) {
                    //set page-width to "auto" = use the fallback from FOUserAgent
                    if (propId == Constants.PR_PAGE_WIDTH) {
                        fo.getLogger().warn("Both page-width and page-height set to "
                                + "\"indefinite\". Forcing page-width to \"auto\"");
                        return make(propertyList, fallbackValue, fo);
                    }
                } else {
                    //set page-height to "auto" = use fallback from FOUserAgent
                    fo.getLogger().warn("Both page-width and page-height set to "
                            + "\"indefinite\". Forcing page-height to \"auto\"");
                    if (propId == Constants.PR_PAGE_HEIGHT) {
                        return make(propertyList, fallbackValue, fo);
                    }
                }
View Full Code Here

Examples of org.foray.fotree.FObj

     * @param fobj The FO object for whom this property is being evaluated.
     * @return The value of this function.
     */
    public PropertyValue eval(final Property callingProperty, final FObj fobj) {
        /* TODO: Provide the right context. */
        FObj parent = fobj.effectiveParent(null);
        final FoProperty propertyType = this.getPropertyType();
        Property ps = null;
        while (parent != null && ps == null) {
            ps = parent.getPropertyList().getProperty(propertyType);
            /* TODO: Provide the right context. */
            parent = fobj.effectiveParent(null);
        }
        if (ps == null) {
            return null;
View Full Code Here

Examples of org.foray.fotree.FObj

     * evaluated.
     * @param context An object that knows how to resolve FO context issues.
     * @return The Numeric representation of the function value.
     */
    public DtLength eval(final FObj fobj, final FoContext context) {
        final FObj item = fobj.getNearestListItem(null);
        final int startIndent = item.traitStartIndent(context);
        /* TODO: We don't know how to compute this yet. */
        final int startIntrusionAdjustment = 0;
        final int provisionalDistanceBetweenStarts
                /* TODO: Not sure the parameter passed here is correct. */
                = item.traitProvisionalDistanceBetweenStarts(context);

        final int length
                = startIndent
                + startIntrusionAdjustment
                + provisionalDistanceBetweenStarts;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.