Package org.apache.fop.fo.flow

Examples of org.apache.fop.fo.flow.TableFObj$PendingSpan


     */
    public Property make(PropertyList propertyList, String value, FObj fo)
                throws PropertyException {
        Property p = super.make(propertyList, value, fo);
       
        TableFObj parent = (TableFObj) propertyList.getParentFObj();
       
        int columnIndex = p.getNumeric().getValue();
        if (columnIndex <= 0) {
            Log log = LogFactory.getLog(TableFObj.class);
            log.warn("Specified negative or zero value for "
                    + "column-number on " + fo.getName() + ": "
                    + columnIndex + " forced to "
                    + parent.getCurrentColumnIndex());
            return NumberProperty.getInstance(parent.getCurrentColumnIndex());
        } else {
            double tmpIndex = p.getNumeric().getNumericValue();
            if (tmpIndex - columnIndex > 0.0) {
                columnIndex = (int) Math.round(tmpIndex);
                Log log = LogFactory.getLog(TableFObj.class);
                log.warn("Rounding specified column-number of "
                        + tmpIndex + " to " + columnIndex);
                p = NumberProperty.getInstance(columnIndex);
            }
        }
       
        parent.setCurrentColumnIndex(columnIndex);
       
        int colSpan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)
                            .getNumeric().getValue();
        int i = -1;
        while (++i < colSpan) {
            if (parent.isColumnNumberUsed(columnIndex + i)) {
                /* if column-number is already in use by another
                 * cell/column => error!
                 */
                StringBuffer errorMessage = new StringBuffer();
                errorMessage.append(fo.getName() + " overlaps in column ")
View Full Code Here


    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"
View Full Code Here

    public Property get(int subpropId, PropertyList propertyList,
                        boolean tryInherit, boolean tryDefault)
            throws PropertyException {
       
        Property p = super.get(0, propertyList, tryInherit, tryDefault);
        TableFObj fo = (TableFObj) propertyList.getFObj();
        TableFObj parent = (TableFObj) propertyList.getParentFObj();
        int columnIndex = p.getNumeric().getValue();
       
        if (columnIndex <= 0) {
            fo.getLogger().warn("Specified negative or zero value for "
                    + "column-number on " + fo.getName() + ": "
                    + columnIndex + " forced to "
                    + parent.getCurrentColumnIndex());
            return new NumberProperty(parent.getCurrentColumnIndex());
        }
        //TODO: check for non-integer value and round
       
        if (fo.getNameId() == Constants.FO_TABLE_CELL) {
            //check if any of the column-numbers occupied by this cell
            //are already in use in the current row...
            int i = -1;
            int colspan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)
                            .getNumeric().getValue();
            while (++i < colspan) {
                //if table has explicit columns and the column-number isn't
                //assigned to any column, increment further until the next
                //column is encountered
                if (fo.getTable().getColumns() != null) {
                    while (columnIndex <= fo.getTable().getColumns().size()
                            && !fo.getTable().isColumnNumberUsed(columnIndex)) {
                        columnIndex++;
                    }
                }
                //if column-number is already in use by another cell
                //in the current row => error!
                if (parent.isColumnNumberUsed(columnIndex + i)) {
                    throw new PropertyException("fo:table-cell overlaps in column "
                            + (columnIndex + i));
                }
            }
        }
       
        //if column-number was explicitly specified, force the parent's current
        //column index to the specified value, so that the updated index will
        //be the correct initial value for the next cell/column (see Rec 7.26.8)
        if (propertyList.getExplicit(Constants.PR_COLUMN_NUMBER) != null) {
            parent.setCurrentColumnIndex(p.getNumeric().getValue());
        }
        return p;
    }
View Full Code Here

    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"
View Full Code Here

                        boolean tryInherit, boolean tryDefault)
            throws PropertyException {
       
        Property p = super.get(0, propertyList, tryInherit, tryDefault);
        FObj fo = propertyList.getFObj();
        TableFObj parent = (TableFObj) propertyList.getParentFObj();
       
        if (p.getNumeric().getValue() <= 0) {
            int columnIndex = parent.getCurrentColumnIndex();
            fo.getLogger().warn("Specified negative or zero value for "
                    + "column-number on " + fo.getName() + ": "
                    + p.getNumeric().getValue() + " forced to "
                    + columnIndex);
            return new NumberProperty(columnIndex);
        }
        //TODO: check for non-integer value and round
       
        //if column-number was explicitly specified, force the parent's current
        //column index to the specified value, so that the updated index will
        //be the correct initial value for the next cell (see Rec 7.26.8)
        if (propertyList.getExplicit(Constants.PR_COLUMN_NUMBER) != null) {
            parent.setCurrentColumnIndex(p.getNumeric().getValue());
        }
        return p;
    }
View Full Code Here

TOP

Related Classes of org.apache.fop.fo.flow.TableFObj$PendingSpan

Copyright © 2018 www.massapicom. 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.