Java 类net.sf.jasperreports.engine.JRPrintFrame 实例源码

项目:jasperreports    文件:UniformPrintElementVisitor.java   
@Override
public void visit(JRPrintFrame frame, T arg)
{
    visitElement(frame, arg);

    if (deep)
    {
        List<JRPrintElement> elements = frame.getElements();
        if (elements != null)
        {
            for (JRPrintElement element : elements)
            {
                element.accept(this, arg);
            }
        }
    }
}
项目:jasperreports    文件:JsonMetadataExporter.java   
protected void exportElements(Collection<JRPrintElement> elements) throws IOException
{
    if (elements != null && elements.size() > 0)
    {
        for(Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();)
        {
            JRPrintElement element = it.next();

            if (filter == null || filter.isToExport(element))
            {
                exportElement(element);

                if (element instanceof JRGenericPrintElement)
                {
                    //exportElement(element);
                }
                else if (element instanceof JRPrintFrame)
                {
                    exportElements(((JRPrintFrame) element).getElements());
                }
            }
        }
    }
}
项目:jasperreports    文件:JsonExporter.java   
protected void exportElements(Collection<JRPrintElement> elements) throws IOException
{
    if (elements != null && elements.size() > 0)
    {
        for(Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();)
        {
            JRPrintElement element = it.next();

            if (filter == null || filter.isToExport(element))
            {
                if (element instanceof JRPrintFrame)
                {
                    exportFrame((JRPrintFrame)element);
                }
                else if (element instanceof JRGenericPrintElement)
                {
                    exportGenericElement((JRGenericPrintElement) element);
                }
            }
        }
    }
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
@Override
protected void exportFrame(JRPrintFrame frame) throws JRException {

    for (Object element : frame.getElements()) {
        if (element instanceof JRPrintLine) {
            exportLine((JRPrintLine)element);
        } else if (element instanceof JRPrintRectangle) {
            exportRectangle((JRPrintRectangle)element);
        } else if (element instanceof JRPrintEllipse) {
            exportRectangle((JRPrintEllipse)element);
        } else if (element instanceof JRPrintImage) {
            exportImage((JRPrintImage) element);
        } else if (element instanceof JRPrintText) {
            exportText((JRPrintText)element);
        } else if (element instanceof JRPrintFrame) {
            exportFrame((JRPrintFrame) element);
        } else if (element instanceof JRGenericPrintElement) {
            exportGenericElement((JRGenericPrintElement) element);
        }
    }
}
项目:jasperreports    文件:AbstractHtmlExporter.java   
/**
 * 
 */
public static JRPrintImage getImage(List<JasperPrint> jasperPrintList, JRPrintElementIndex imageIndex)
{
    JasperPrint report = jasperPrintList.get(imageIndex.getReportIndex());
    JRPrintPage page = report.getPages().get(imageIndex.getPageIndex());

    Integer[] elementIndexes = imageIndex.getAddressArray();
    Object element = page.getElements().get(elementIndexes[0].intValue());

    for (int i = 1; i < elementIndexes.length; ++i)
    {
        JRPrintFrame frame = (JRPrintFrame) element;
        element = frame.getElements().get(elementIndexes[i].intValue());
    }

    return (JRPrintImage) element;
}
项目:jasperreports    文件:PrintDrawVisitor.java   
@Override
public void visit(JRPrintFrame frame, Offset offset)
{
    try
    {
        frameDrawer.draw(
            grx,
            frame, 
            offset.getX(), 
            offset.getY()
            );
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRRtfExporter.java   
/**
 *
 * @param frame
 * @throws JRException
 */
public void exportFrame(JRPrintFrame frame) throws JRException, IOException {
    int x = frame.getX() + getOffsetX();
    int y = frame.getY() + getOffsetY();
    int width = frame.getWidth();
    int height = frame.getHeight();

    startElement(frame);

    exportPen(frame.getForecolor());

    finishElement();

    setFrameElementsOffset(frame, false);
    exportElements(frame.getElements());
    restoreElementOffsets();

    exportBox(frame.getLineBox(), x, y, width, height);
}
项目:jasperreports    文件:JRCsvExporterNature.java   
@Override
    public boolean isToExport(JRPrintElement element)
    {
//      JRPrintFrame frame = element instanceof JRPrintFrame ? (JRPrintFrame)element : null;
//      if (frame != null)
//      {
//          List<JRPrintElement> elements = frame.getElements();
//          return elements != null && elements.size() > 0;
//      }
//      return (element instanceof JRPrintText || element instanceof JRGenericPrintElement)
//          && (filter == null || filter.isToExport(element));
        if (element instanceof JRGenericPrintElement)
        {
            JRGenericPrintElement genericElement = (JRGenericPrintElement) element;
            GenericElementHandler handler = handlerEnvironment.getElementHandler(
                    genericElement.getGenericType(), JRAbstractCsvExporter.CSV_EXPORTER_KEY);
            if (handler == null || !handler.toExport(genericElement))
            {
                return false;
            }
        }

        return (element instanceof JRPrintText || element instanceof JRPrintFrame || element instanceof JRGenericPrintElement)
            && (filter == null || filter.isToExport(element));
    }
项目:jasperreports    文件:JRCsvMetadataExporter.java   
protected void exportElements(
        List<JRPrintElement> elements, 
        CsvMetadataReportConfiguration configuration,
        Map<String, String> currentRow,
        Map<String, String> repeatedValues,
        boolean hasDefinedColumns)  throws IOException
{

    for (int i = 0; i < elements.size(); ++i) 
    {
        Object element = elements.get(i);
        if (element instanceof JRPrintText) 
        {
            exportText((JRPrintText) element, configuration, currentRow, repeatedValues, hasDefinedColumns);
        }
        else if (element instanceof JRPrintFrame)
        {
            exportElements(((JRPrintFrame) element).getElements(), configuration, currentRow, repeatedValues, hasDefinedColumns);
        }
    }       
}
项目:jasperreports    文件:JRXmlExporter.java   
protected void exportFrame(JRPrintFrame frame) throws IOException, JRException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_frame);

    setFrameElementsOffset(frame, true);
    try
    {
        exportReportElement(frame);
        exportBox(frame.getLineBox());
        exportElements(frame.getElements());

        xmlWriter.closeElement();
    }
    finally
    {
        restoreElementOffsets();
    }
}
项目:jasperreports    文件:JRTextExporter.java   
protected void exportElements(List<JRPrintElement> elements)
{
    for (int i = 0; i < elements.size();i++)
    {
        Object element = elements.get(i);
        if (element instanceof JRPrintText)
        {
            exportText((JRPrintText) element);
        }
        else if (element instanceof JRPrintFrame)
        {
            JRPrintFrame frame = (JRPrintFrame) element;
            setFrameElementsOffset(frame, false);
            try
            {
                exportElements(frame.getElements());
            }
            finally
            {
                restoreElementOffsets();
            }
        }
    }
}
项目:jasperreports    文件:Tabulator.java   
@Override
public TableCell visit(LayeredCell layeredCell, TablePosition position)
{
    SpanInfo<Column> colSpan = getColumnCellSpan(position, layeredCell);
    SpanInfo<Row> rowSpan = getRowCellSpan(position, layeredCell);
    Color backcolor = getElementBackcolor(layeredCell.getParent());

    JRLineBox box = null;
    FrameCell parentCell = layeredCell.getParent();
    if (parentCell != null)
    {
        boolean[] borders = getFrameCellBorders(position.getTable(), parentCell,
                position.getColumn(), colSpan.lastEntry,
                position.getRow(), rowSpan.lastEntry);
        if (borders[0] || borders[1] || borders[2] || borders[3])
        {
            JRPrintFrame parentFrame = (JRPrintFrame) getCellElement(parentCell);
            box = copyFrameBox(parentCell, parentFrame, null, borders[0], borders[1], borders[2], borders[3]);
        }
    }

    return new TableCell(Tabulator.this, position, layeredCell, null, colSpan.span, rowSpan.span, backcolor, box);
}
项目:jasperreports    文件:Tabulator.java   
protected JRLineBox copyParentBox(Cell cell, JRPrintElement element, JRLineBox baseBox, 
        boolean keepLeft, boolean keepRight, boolean keepTop, boolean keepBottom)
{
    FrameCell parentCell = cell.getParent();
    if (parentCell == null)
    {
        return baseBox;
    }

    // TODO lucianc check this in the table instead?
    JRPrintFrame parentFrame = (JRPrintFrame) getCellElement(parentCell);
    keepLeft &= element.getX() == 0 && parentFrame.getLineBox().getLeftPadding() == 0;
    keepRight &= (element.getX() + element.getWidth() + parentFrame.getLineBox().getLeftPadding()) == parentFrame.getWidth();
    keepTop &= element.getY() == 0 && parentFrame.getLineBox().getTopPadding() == 0;
    keepBottom &= (element.getY() + element.getHeight() + parentFrame.getLineBox().getTopPadding()) == parentFrame.getHeight();

    JRLineBox resultBox = baseBox;
    if (keepLeft || keepRight || keepTop || keepBottom)
    {
        resultBox = copyFrameBox(parentCell, parentFrame, baseBox, 
                keepLeft, keepRight, keepTop, keepBottom);
    }
    return resultBox;
}
项目:jasperreports    文件:ElementGridCell.java   
public JRGridLayout getLayout()
{
    JRPrintElement element = getElement();
    if (!(element instanceof JRPrintFrame))
    {
        // should not happen
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_NOT_FRAME_ELEMENT,
                new Object[]{getElementAddress()});
    }

    JRPrintFrame frame = (JRPrintFrame) element;
    PrintElementIndex frameIndex = new PrintElementIndex(getParentIndex(), getElementIndex());
    return new JRGridLayout(
            container, 
            frame.getElements(),
            frame.getWidth(), 
            frame.getHeight(),
            0, //offsetX
            0, //offsetY
            frameIndex
    );
}
项目:jasperreports    文件:IconLabelComponentFill.java   
protected void copy(JRPrintFrame printFrame)
    {
        //printElement.iconLabelComponent.getLineBox().clone(printElement);
//      if (contentVisible)
//      {
            labelTextField.setAlreadyPrinted(labelTextField.isToPrint() || labelTextField.isAlreadyPrinted());
            iconTextField.setAlreadyPrinted(iconTextField.isToPrint() || iconTextField.isAlreadyPrinted());

            if (labelTextField.isToPrint())
            {
                printElement.addElement(labelPrintText);
            }
            if (iconTextField.isToPrint() && iconsVisible)
            {
                printElement.addElement(iconPrintText);
            }
//      }
    }
项目:jasperreports    文件:ReportConverter.java   
/**
 *
 */
private void addHorizontalGridLine(int x, int y, int width)
{
    JRPrintFrame printFrame = new JRBasePrintFrame(getDefaultStyleProvider());
    printFrame.setX(x);
    printFrame.setY(y);
    printFrame.setWidth(width);
    printFrame.setHeight(1);
    printFrame.getLineBox().getPen().setLineWidth(0);
    printFrame.getLineBox().getPen().setLineStyle(LineStyleEnum.SOLID);
    printFrame.getLineBox().getTopPen().setLineWidth(0.1f);
    printFrame.getLineBox().getTopPen().setLineStyle(LineStyleEnum.DASHED);
    printFrame.getLineBox().getTopPen().setLineColor(GRID_LINE_COLOR);
    pageElements.add(0, printFrame);
}
项目:jasperreports    文件:ReportConverter.java   
/**
 *
 */
private void addVerticalGridLine(int x, int y, int height)
{
    JRPrintFrame printFrame = new JRBasePrintFrame(getDefaultStyleProvider());
    printFrame.setX(x);
    printFrame.setY(y);
    printFrame.setWidth(1);
    printFrame.setHeight(height);
    printFrame.getLineBox().getPen().setLineWidth(0);
    printFrame.getLineBox().getPen().setLineStyle(LineStyleEnum.SOLID);
    printFrame.getLineBox().getLeftPen().setLineWidth(0.1f);
    printFrame.getLineBox().getLeftPen().setLineStyle(LineStyleEnum.DASHED);
    printFrame.getLineBox().getLeftPen().setLineColor(GRID_LINE_COLOR);
    pageElements.add(0, printFrame);
}
项目:jasperreports    文件:DeepPrintElementVisitor.java   
@Override
public void visit(JRPrintFrame frame, T arg)
{
    visitor.visit(frame, arg);

    List<JRPrintElement> elements = frame.getElements();
    if (elements != null)
    {
        for (JRPrintElement element : elements)
        {
            element.accept(this, arg);
        }
    }
}
项目:jasperreports    文件:CompositePrintElementVisitor.java   
@Override
public void visit(JRPrintFrame frame, T arg)
{
    for (PrintElementVisitor<T> visitor : visitors)
    {
        visitor.visit(frame, arg);
    }
}
项目:jasperreports    文件:GenericElementReportTransformer.java   
protected static void transformElements(
        TransformerContext context, 
        String transformerExportKey, 
        List<JRPrintElement> elements)
{
    for (ListIterator<JRPrintElement> it = elements.listIterator(); it.hasNext();)
    {
        JRPrintElement element = it.next();
        if (element instanceof JRGenericPrintElement)
        {
            JRGenericPrintElement genericElement = 
                (JRGenericPrintElement) element;
            GenericElementTransformer handler = 
                    (GenericElementTransformer) GenericElementHandlerEnviroment.getInstance(context.getJasperReportsContext()).getElementHandler(
                    genericElement.getGenericType(), transformerExportKey);
            if (handler != null && handler.toExport(genericElement))
            {
                JRPrintElement transformed = handler.transformElement(
                        context, genericElement);

                if (log.isDebugEnabled())
                {
                    log.debug("Transformed element " + genericElement 
                            + " to " + transformed
                            + " using the " + transformerExportKey + " transformer");
                }

                // assuming that the list is modifiable
                it.set(transformed);
            }
        }
        else if (element instanceof JRPrintFrame)
        {
            JRPrintFrame frame = (JRPrintFrame) element;
            transformElements(context, transformerExportKey, frame.getElements());
        }
    }

}
项目:jasperreports    文件:JRXlsExporter.java   
@Override
protected void exportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int x, int y)
{
    FillPatternType mode = backgroundMode;
    short backcolor = whiteIndex;
    if (frame.getModeValue() == ModeEnum.OPAQUE)
    {
        mode = FillPatternType.SOLID_FOREGROUND;
        backcolor = getWorkbookColor(frame.getBackcolor()).getIndex();
    }

    short forecolor = getWorkbookColor(frame.getForecolor()).getIndex();

    HSSFCellStyle cellStyle =
        getLoadedCellStyle(
            mode,
            backcolor,
            HorizontalAlignment.LEFT,
            VerticalAlignment.TOP,
            (short)0,
            getLoadedFont(getDefaultFont(), forecolor, null, getLocale()),
            gridCell,
            isWrapText(frame),
            isCellLocked(frame),
            isCellHidden(frame),
            isShrinkToFit(frame)
            );

    createMergeRegion(gridCell, x, y, cellStyle);

    cell = row.createCell(x);
    cell.setCellStyle(cellStyle);
}
项目:jasperreports    文件:JROdtExporter.java   
/**
 *
 */
protected void exportFrame(TableBuilder tableBuilder, JRPrintFrame frame, JRExporterGridCell gridCell) throws IOException, JRException
{
    tableBuilder.buildCellHeader(styleCache.getCellStyle(gridCell), gridCell.getColSpan(), gridCell.getRowSpan());

    boolean appendBackcolor =
        frame.getModeValue() == ModeEnum.OPAQUE
        && (backcolor == null || frame.getBackcolor().getRGB() != backcolor.getRGB());

    if (appendBackcolor)
    {
        setBackcolor(frame.getBackcolor());
    }

    try
    {
        JRGridLayout layout = ((ElementGridCell) gridCell).getLayout();
        JRPrintElementIndex frameIndex =
            new JRPrintElementIndex(
                    reportIndex,
                    pageIndex,
                    gridCell.getElementAddress()
                    );
        exportGrid(layout, frameIndex);
    }
    finally
    {
        if (appendBackcolor)
        {
            restoreBackcolor();
        }
    }

    tableBuilder.buildCellFooter();
}
项目:jasperreports    文件:JROdsExporter.java   
@Override
protected void exportFrame(
    JRPrintFrame frame, 
    JRExporterGridCell cell,
    int colIndex, 
    int rowIndex
    ) throws JRException 
{
    addBlankCell(cell, colIndex, rowIndex);
}
项目:jasperreports    文件:JRPdfExporter.java   
public void exportFrame(JRPrintFrame frame) throws DocumentException, IOException, JRException
{
    if (frame.getModeValue() == ModeEnum.OPAQUE)
    {
        int x = frame.getX() + getOffsetX();
        int y = frame.getY() + getOffsetY();

        Color backcolor = frame.getBackcolor();
        pdfContentByte.setRGBColorFill(
            backcolor.getRed(),
            backcolor.getGreen(),
            backcolor.getBlue()
            );
        pdfContentByte.rectangle(
            x,
            pageFormat.getPageHeight() - y,
            frame.getWidth(),
            - frame.getHeight()
            );
        pdfContentByte.fill();
    }

    setFrameElementsOffset(frame, false);
    try
    {
        exportElements(frame.getElements());
    }
    finally
    {
        restoreElementOffsets();
    }

    exportBox(frame.getLineBox(), frame);
}
项目:jasperreports    文件:HtmlExporter.java   
@Override
public void visit(JRPrintFrame frame, TableCell cell)
{
    throw 
        new JRRuntimeException(
            EXCEPTION_MESSAGE_KEY_INTERNAL_ERROR,  
            (Object[])null 
            );
}
项目:jasperreports    文件:FrameDrawer.java   
/**
 *
 */
private void setFrameElementsOffset(JRPrintFrame frame, int offsetX, int offsetY)
{   
    setElementOffsets(
        offsetX + frame.getX() + frame.getLineBox().getLeftPadding().intValue(), 
        offsetY + frame.getY() + frame.getLineBox().getTopPadding().intValue()
        );
}
项目:jasperreports    文件:JRRtfExporter.java   
protected void exportElements(Collection<JRPrintElement> elements) throws JRException, IOException {
    if (elements != null && elements.size() > 0) {
        for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();) {
            JRPrintElement element = it.next();
            if (filter == null || filter.isToExport(element)) {
                if (element instanceof JRPrintLine) {
                    exportLine((JRPrintLine)element);
                }
                else if (element instanceof JRPrintRectangle) {
                    exportRectangle((JRPrintRectangle)element);
                }
                else if (element instanceof JRPrintEllipse) {
                    exportEllipse((JRPrintEllipse)element);
                }
                else if (element instanceof JRPrintImage) {
                    exportImage((JRPrintImage)element);
                }
                else if (element instanceof JRPrintText) {
                    exportText((JRPrintText)element);
                }
                else if (element instanceof JRPrintFrame) {
                    exportFrame((JRPrintFrame)element);
                }
                else if (element instanceof JRGenericPrintElement) {
                    exportGenericElement((JRGenericPrintElement)element);
                }
            }
        }
    }
}
项目:jasperreports    文件:JRXlsAbstractExporterNature.java   
@Override
public boolean isToExport(JRPrintElement element)
{
    return 
        (!isIgnoreGraphics || (element instanceof JRPrintText) || (element instanceof JRPrintFrame) || (element instanceof JRGenericPrintElement))
        && (filter == null || filter.isToExport(element));
}
项目:jasperreports    文件:JRPdfExporterTagHelper.java   
protected void endElement(JRPrintElement element)
{
    if (isTagged)
    {
        if (element instanceof JRPrintFrame)
        {
            if (crtCrosstabRowY >= 0) // crosstab started
            {
                crosstabFrameDepth--;
            }
        }

        createEndTags(element);
    }
}
项目:jasperreports    文件:JRDocxExporter.java   
/**
     * In deep grids, this is called only for empty frames.
     */
    protected void exportFrame(DocxTableHelper tableHelper, JRPrintFrame frame, JRExporterGridCell gridCell) throws JRException
    {
        tableHelper.getCellHelper().exportHeader(frame, gridCell);
//      tableHelper.getCellHelper().exportProps(gridCell);

        boolean appendBackcolor =
            frame.getModeValue() == ModeEnum.OPAQUE
            && (backcolor == null || frame.getBackcolor().getRGB() != backcolor.getRGB());

        if (appendBackcolor)
        {
            setBackcolor(frame.getBackcolor());
        }

        try
        {
            JRGridLayout layout = ((ElementGridCell) gridCell).getLayout();
            JRPrintElementIndex frameIndex =
                new JRPrintElementIndex(
                        reportIndex,
                        pageIndex,
                        gridCell.getElementAddress()
                        );
            exportGrid(layout, frameIndex);
        }
        finally
        {
            if (appendBackcolor)
            {
                restoreBackcolor();
            }
        }

        tableHelper.getParagraphHelper().exportEmptyParagraph();
        tableHelper.getCellHelper().exportFooter();
    }
项目:jasperreports    文件:JRXlsxExporter.java   
public JRPrintImage getImage(ExporterInput exporterInput, JRPrintElementIndex imageIndex) throws JRException//FIXMECONTEXT move these to an abstract up?
{
    List<ExporterInputItem> items = exporterInput.getItems();
    ExporterInputItem item = items.get(imageIndex.getReportIndex());
    JasperPrint report = item.getJasperPrint();
    JRPrintPage page = report.getPages().get(imageIndex.getPageIndex());

    Integer[] elementIndexes = imageIndex.getAddressArray();
    Object element = page.getElements().get(elementIndexes[0].intValue());

    for (int i = 1; i < elementIndexes.length; ++i)
    {
        JRPrintFrame frame = (JRPrintFrame) element;
        element = frame.getElements().get(elementIndexes[i].intValue());
    }

    if(element instanceof JRGenericPrintElement)
    {
        JRGenericPrintElement genericPrintElement = (JRGenericPrintElement)element;
        return ((GenericElementXlsxHandler)GenericElementHandlerEnviroment.getInstance(jasperReportsContext).getElementHandler(
                genericPrintElement.getGenericType(), 
                XLSX_EXPORTER_KEY
                )).getImage(exporterContext, genericPrintElement);
    }

    return (JRPrintImage) element;
}
项目:jasperreports    文件:JRDocxExporterNature.java   
@Override
public boolean isDeep(JRPrintFrame frame)
{
    if (
        frame.hasProperties()
        && frame.getPropertiesMap().containsProperty(DocxReportConfiguration.PROPERTY_FRAMES_AS_NESTED_TABLES)
        )
    {
        // we make this test to avoid reaching the global default value of the property directly
        // and thus skipping the report level one, if present
        return !getPropertiesUtil().getBooleanProperty(frame, DocxReportConfiguration.PROPERTY_FRAMES_AS_NESTED_TABLES, !deepGrid);
    }
    return deepGrid;
}
项目:jasperreports    文件:JRXmlExporter.java   
public void exportElement(JRPrintElement element) throws IOException, JRException
{
    if (filter == null || filter.isToExport(element))
    {
        if (element instanceof JRPrintLine)
        {
            exportLine((JRPrintLine)element);
        }
        else if (element instanceof JRPrintRectangle)
        {
            exportRectangle((JRPrintRectangle)element);
        }
        else if (element instanceof JRPrintEllipse)
        {
            exportEllipse((JRPrintEllipse)element);
        }
        else if (element instanceof JRPrintImage)
        {
            exportImage((JRPrintImage)element);
        }
        else if (element instanceof JRPrintText)
        {
            exportText((JRPrintText)element);
        }
        else if (element instanceof JRPrintFrame)
        {
            exportFrame((JRPrintFrame) element);
        }
        else if (element instanceof JRGenericPrintElement)
        {
            exportGenericElement((JRGenericPrintElement) element);
        }
    }
}
项目:jasperreports    文件:JRGridLayout.java   
public JRPrintElement getElement(PrintElementIndex parentIndex, int index)
{
    // TODO lucianc keep a cache of current element position?
    JRPrintElement element;
    if (parentIndex == null)
    {
        element = elementList.get(index);
    }
    else
    {
        JRPrintFrame parentFrame = (JRPrintFrame) getElement(parentIndex.getParentIndex(), parentIndex.getIndex());
        element = parentFrame.getElements().get(index);
    }
    return element;
}
项目:jasperreports    文件:JRGridLayout.java   
protected void createCuts(List<JRPrintElement> elements, int elementOffsetX, int elementOffsetY, boolean createXCuts)
{
    for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();)
    {
        JRPrintElement element = it.next();
        if (nature.isToExport(element))
        {
            if (createXCuts)
            {
                xCuts.addCutOffset(element.getX() + elementOffsetX);
                xCuts.addCutOffset(element.getX() + element.getWidth() + elementOffsetX);
            }

            yCuts.addCutOffset(element.getY() + elementOffsetY);
            yCuts.addCutOffset(element.getY() + element.getHeight() + elementOffsetY);

            JRPrintFrame frame = element instanceof JRPrintFrame ? (JRPrintFrame)element : null;
            if (frame != null && nature.isDeep(frame))
            {
                createCuts(
                    frame.getElements(),
                    element.getX() + elementOffsetX + frame.getLineBox().getLeftPadding().intValue(),
                    element.getY() + elementOffsetY + frame.getLineBox().getTopPadding().intValue(),
                    createXCuts
                    );
            }
        }
    }
}
项目:jasperreports    文件:JRGridLayout.java   
/**
 * This static method calculates the X cuts for a list of print elements and
 * stores them in the list indicated by the xCuts parameter.
 *
 * @param elementsList
 *            The list of elements to be used to determine the X cuts.
 * @param elementOffsetX
 *            horizontal element position offset
 * @param xCuts
 *            The list to which the X cuts are to be added.
 */
protected static void addXCuts(ExporterNature nature, List<JRPrintElement> elementsList, int elementOffsetX, CutsInfo xCuts)
{
    for (Iterator<JRPrintElement> it = elementsList.iterator(); it.hasNext();)
    {
        JRPrintElement element = it.next();

        if (nature.isToExport(element))
        {
            xCuts.addCutOffset(element.getX() + elementOffsetX);
            xCuts.addCutOffset(element.getX() + element.getWidth() + elementOffsetX);

            if (element instanceof JRPrintFrame)
            {
                JRPrintFrame frame = (JRPrintFrame) element;
                addXCuts(
                    nature,
                    frame.getElements(),
                    element.getX() + elementOffsetX + frame.getLineBox().getLeftPadding().intValue(),
                    xCuts
                    );
            }

            nature.setXProperties(xCuts.getPropertiesMap(), element);
        }
    }
}
项目:jasperreports    文件:Tabulator.java   
protected void setElementCells(Table table, FrameCell parentCell, 
        int xOffset, int yOffset, 
        JRPrintElement element, PrintElementIndex parentIndex, int elementIndex,
        DimensionRange<Column> colRange, DimensionRange<Row> rowRange)
{
    DimensionRange<Column> elementColRange = table.columns.addEntries(colRange);
    DimensionRange<Row> elementRowRange = table.rows.addEntries(rowRange);

    if (element instanceof JRPrintFrame)
    {
        JRPrintFrame frame = (JRPrintFrame) element;
        FrameCell frameCell = new FrameCell(parentCell, parentIndex, elementIndex);
        setElementCells(elementColRange, elementRowRange, frameCell);

        // go deep in the frame
        PrintElementIndex frameIndex = new PrintElementIndex(parentIndex, elementIndex);
        JRLineBox box = frame.getLineBox();
        layoutElements(frame.getElements(), table, frameCell, frameIndex, 
                xOffset + frame.getX() + box.getLeftPadding(), 
                yOffset + frame.getY() + box.getTopPadding(),
                new Bounds(0, frame.getWidth()  - box.getLeftPadding() - box.getRightPadding(),
                        0, frame.getHeight() - box.getTopPadding() - box.getBottomPadding()));
    }
    else
    {
        ElementCell elementCell = new ElementCell(parentCell, parentIndex, elementIndex);
        setElementCells(elementColRange, elementRowRange, elementCell);
    }
}
项目:jasperreports    文件:Tabulator.java   
protected JRPrintElement getCellElement(PrintElementIndex parentIndex, int index)
{
    // TODO lucianc keep a cache of current element position?
    JRPrintElement element;
    if (parentIndex == null)
    {
        element = elements.get(index);
    }
    else
    {
        JRPrintFrame parentFrame = (JRPrintFrame) getCellElement(parentIndex.getParentIndex(), parentIndex.getIndex());
        element = parentFrame.getElements().get(index);
    }
    return element;
}
项目:jasperreports    文件:Tabulator.java   
@Override
public TableCell visit(FrameCell frameCell, TablePosition position)
{
    JRPrintElement element = getCellElement(frameCell);
    Color backcolor = getElementBackcolor(frameCell);

    boolean[] borders = getFrameCellBorders(position.getTable(), frameCell,
            position.getColumn(), position.getColumn(),
            position.getRow(), position.getRow());
    JRLineBox box = copyFrameBox(frameCell, (JRPrintFrame) element, null, borders[0], borders[1], borders[2], borders[3]);

    return new TableCell(Tabulator.this, position, frameCell, element, 1, 1, backcolor, box);
}
项目:jasperreports    文件:Tabulator.java   
protected JRLineBox copyFrameBox(FrameCell frameCell, JRPrintFrame frame, JRLineBox baseBox, 
        boolean keepLeft, boolean keepRight, boolean keepTop, boolean keepBottom)
{
    // TODO lucianc cache
    JRLineBox resultBox = JRBoxUtil.copyBordersNoPadding(frame.getLineBox(), 
            keepLeft, keepRight, keepTop, keepBottom, baseBox);
    // recurse
    resultBox = copyParentBox(frameCell, frame, resultBox, keepLeft, keepRight, keepTop, keepBottom);
    return resultBox;
}