Examples of RTFRow


Examples of net.sourceforge.rtf.document.RTFRow

     * @param content
     *            RTF start row keyword <b>\trowd</b>.
     * @throws IOException
     */
    protected void startRow(String content) throws IOException {
        RTFRow row = null;
        boolean isNewRow = true;
        if (currentRTFElement instanceof RTFRow) {
            // current RTF element parsed id ROW
            // (Sometimes there is Row into Row. Why???)
            // new RTFRow object must not instanciate
            row = (RTFRow) currentRTFElement;
            isNewRow = false;
        } else {
            // current RTF element parsed id ROW
            // instanciate new RTFRow and add it to current element
            row = new RTFRow();
        }

        if (startGroup != null) {
            // Last character parsed is start group '{'
            // add it to RTF Row element
            row.addRTFString(startGroup);
            startGroup = null;
        }
        // Add content of row to RTF row
        row.addRTFString(content);
        if (isNewRow)
            getCurrentRTFElement().addRTFElement(row);
        // RTF ROW built is the current element.
        currentRTFElement = row;
    }
View Full Code Here

Examples of net.sourceforge.rtf.document.RTFRow

     * @throws IOException
     */
    protected void inTable(String content) throws IOException {
        // if it is not already in a row, put it in one.
        if (currentRTFElement instanceof RTFDocument) {
            RTFRow row = new RTFRow();
            // not checking startgroup, cause it's not necessary
            row.addRTFString(getCurrentRTFElement().removeCurrentRTFString()
                    .toString());
            getCurrentRTFElement().addRTFElement(row);
            currentRTFElement = row;
        }
        currentRTFElement.addRTFString(content);
View Full Code Here

Examples of net.sourceforge.rtf.document.RTFRow

        field.addRTFString(content);
        RTFElement element = getCurrentRTFElement();
        if (element instanceof RTFRow) {
            // Current element is Row
            // Add Field to Row
            RTFRow rtfRow = (RTFRow) element;
            rtfRow.addRTFField(field);
        } else {
            // Add RTF field to current RTF element
            getCurrentRTFElement().addRTFElement(field);
        }
        // RTF FIELD built is the current element.
View Full Code Here

Examples of net.sourceforge.rtf.document.RTFRow

                            if (loopIsManagedWithBookmark) {

                                // Test if rtfParent is row => to indicate that
                                // row must not generate #foreach
                                if (getType(parentElement) == RTF_ELEMENT_ROW) {
                                    RTFRow row = (RTFRow) parentElement;
                                    if (rowMustNotGenerateForeachList == null) {
                                        rowMustNotGenerateForeachList = new ArrayList();
                                    }
                                    rowMustNotGenerateForeachList.add(row);
                                }
                            } else {
                                // Test if rtfParent is row
                                if (getType(parentElement) == RTF_ELEMENT_ROW) {
                                    RTFRow row = (RTFRow) parentElement;
                                    if (row.getFirstRTFString() == null) {
                                        if (rowMustNotGenerateForeachList == null
                                                || !rowMustNotGenerateForeachList
                                                        .contains(row)) {
                                            row.addFirstRTFString(getForeach(
                                                    fieldName,
                                                    fieldNameWithListInfo));
                                            row
                                                    .addLastRTFString(getMacroEndForEach()); // #end
                                        }
                                    }
                                }
                            }

                            // Add item_ after $
                            String fieldContent = field
                                    .getRTFContentOfSimpleElement();
                            if (fieldName.startsWith("$"))
                                fieldName = fieldName.substring(1);
                            newFieldName = getObjectValueList(fieldName,
                                    fieldNameWithListInfo, true);
                            if (newFieldName.startsWith("$"))
                                newFieldName = newFieldName.substring(1);

                            fieldContent = StringUtils.sub(fieldContent,
                                    fieldName, newFieldName);
                            field.replaceElement(fieldContent);
                        }
                    } else {
                        if (fieldType == RTFField.FIELDTYPE_REF) {
                            String condition = field.getCondition();
                            if (condition != null) {
                                // Condition is defined
                                // Field is REF (IF condition)
                                // Get Bookmark with name field
                                RTFBookmark ifBookmark = (RTFBookmark) bookmarkIfMap
                                        .get(fieldName);
                                if (ifBookmark != null) {
                                    // Bookmark IF exists. Replace this RTF code
                                    // with the condition
                                    // comming from field
                                    condition = getMacroIf(condition);
                                    ifBookmark.replaceElement(condition);
                                    // Remove content of the field
                                    field.replaceElement("");
                                    // Replace BKMEND by ""
                                    RTFBookmark ifBookmarkBKMEND = (RTFBookmark) bookmarkBkmIfMap
                                            .get(fieldName);
                                    ifBookmarkBKMEND.replaceElement("");                                   
                                }
                            }
                        }
                    }
                }
                break;

            case RTF_ELEMENT_ROW:
                RTFRow row = (RTFRow) element;
                transform(row, row.getElementList(), contextFieldsMap);
                row.flush();
                break;

            case RTF_ELEMENT_PAGE:
                lastPage = (RTFPage) element;
                break;
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.