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

项目:jasperreports    文件:GenericChartTheme.java   
protected void setChartBorder(JFreeChart jfreeChart)
{
    JRLineBox lineBox = getChart().getLineBox();
    if (
        lineBox.getLeftPen().getLineWidth().floatValue() == 0
        && lineBox.getBottomPen().getLineWidth().floatValue() == 0
        && lineBox.getRightPen().getLineWidth().floatValue() == 0
        && lineBox.getTopPen().getLineWidth().floatValue() == 0
        )
    {
        boolean isVisible = getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_BORDER_VISIBLE) == null ?
                false : 
                ((Boolean)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_BORDER_VISIBLE)).booleanValue();
        if (isVisible)
        {
            BasicStroke stroke = (BasicStroke)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_BORDER_STROKE);
            if (stroke != null)
                jfreeChart.setBorderStroke(stroke);
            Paint paint = (Paint)getDefaultValue(defaultChartPropertiesMap, ChartThemesConstants.CHART_BORDER_PAINT);
            if (paint != null)
                jfreeChart.setBorderPaint(paint);
        }

        jfreeChart.setBorderVisible(isVisible);
    }
}
项目:jasperreports    文件:JRXmlBaseWriter.java   
/**
 *
 */
public void writeBox(JRLineBox box, XmlNamespace namespace) throws IOException
{
    if (box != null)
    {
        writer.startElement(JRXmlConstants.ELEMENT_box, namespace);

        writer.addAttribute(JRXmlConstants.ATTRIBUTE_padding, box.getOwnPadding());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_topPadding, box.getOwnTopPadding());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_leftPadding, box.getOwnLeftPadding());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_bottomPadding, box.getOwnBottomPadding());
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_rightPadding, box.getOwnRightPadding());

        writePen(JRXmlConstants.ELEMENT_pen, box.getPen());
        writePen(JRXmlConstants.ELEMENT_topPen, box.getTopPen());
        writePen(JRXmlConstants.ELEMENT_leftPen, box.getLeftPen());
        writePen(JRXmlConstants.ELEMENT_bottomPen, box.getBottomPen());
        writePen(JRXmlConstants.ELEMENT_rightPen, box.getRightPen());

        writer.closeElement(true);
    }
}
项目:jasperreports    文件:JRGridLayout.java   
BoxKey(JRLineBox box, JRLineBox cellBox, boolean left, boolean right, boolean top, boolean bottom)
{
    this.box = box;
    this.cellBox = cellBox;
    this.left = left;
    this.right = right;
    this.top = top;
    this.bottom = bottom;

    int hash = box.hashCode();
    if (cellBox != null)
    {
        hash = 31*hash + cellBox.hashCode();
    }
    hash = 31*hash + (left ? 1231 : 1237);
    hash = 31*hash + (right ? 1231 : 1237);
    hash = 31*hash + (top ? 1231 : 1237);
    hash = 31*hash + (bottom ? 1231 : 1237);
    hashCode = hash;
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
public JRStyle getBaseStyle(JRLineBox box)
{
    if (box != null)
    {
        JRBoxContainer boxContainer = box.getBoxContainer();

        if (boxContainer instanceof JRStyle)
        {
            return getBaseStyle((JRStyle)boxContainer);
        }

        return getBaseStyle(boxContainer);
    }
    return null;
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
public JRStyle getBaseStyle(JRPen pen)
{
    if (pen != null)
    {
        JRPenContainer penContainer = pen.getPenContainer();

        if (penContainer instanceof JRStyle)
        {
            return getBaseStyle((JRStyle)penContainer);
        }

        if (penContainer instanceof JRLineBox)
        {
            return getBaseStyle((JRLineBox)penContainer);
        }

        return getBaseStyle(penContainer);
    }
    return null;
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
public Integer getPadding(JRLineBox box)
{
    Integer ownPadding = box.getOwnPadding();
    if (ownPadding != null)
    {
        return ownPadding;
    }
    JRStyle baseStyle = getBaseStyle(box);
    if (baseStyle != null)
    {
        Integer padding = baseStyle.getLineBox().getPadding();
        if (padding != null)
        {
            return padding;
        }
    }
    return INTEGER_ZERO;
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
public Integer getLeftPadding(JRLineBox box)
{
    Integer ownLeftPadding = box.getOwnLeftPadding();
    if (ownLeftPadding != null)
    {
        return ownLeftPadding;
    }
    Integer ownPadding = box.getOwnPadding();
    if (ownPadding != null)
    {
        return ownPadding;
    }
    JRStyle style = getBaseStyle(box);
    if (style != null)
    {
        Integer leftPadding = style.getLineBox().getLeftPadding();
        if (leftPadding != null)
        {
            return leftPadding;
        }
    }
    return INTEGER_ZERO;
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
public Integer getRightPadding(JRLineBox box)
{
    Integer ownRightPadding = box.getOwnRightPadding();
    if (ownRightPadding != null)
    {
        return ownRightPadding;
    }
    Integer ownPadding = box.getOwnPadding();
    if (ownPadding != null)
    {
        return ownPadding;
    }
    JRStyle style = getBaseStyle(box);
    if (style != null)
    {
        Integer rightPadding = style.getLineBox().getRightPadding();
        if (rightPadding != null)
        {
            return rightPadding;
        }
    }
    return INTEGER_ZERO;
}
项目:jasperreports    文件:JRGridLayout.java   
protected GridCellStyle cellStyle(Color backcolor, Color forecolor, JRLineBox box)
{
    if (backcolor == null && forecolor == null && box == null)
    {
        return null;
    }

    GridCellStyle key = new GridCellStyle(backcolor, forecolor, box);
    GridCellStyle style = cellStyles.get(key);
    if (style == null)
    {
        style = key;
        cellStyles.put(key, style);

        if (log.isTraceEnabled())
        {
            log.trace(this + " added cell style " + style);
        }
    }
    return style;
}
项目:jasperreports    文件:JRXlsExporter.java   
public BoxStyle(JRExporterGridCell gridCell)
{
    if(gridCell != null)
    {
        JRLineBox lineBox = gridCell.getBox();
        if (lineBox != null)
        {
            setBox(lineBox);
        }
        JRPrintElement element = gridCell.getElement();
        if (element instanceof JRCommonGraphicElement)
        {
            setPen(((JRCommonGraphicElement)element).getLinePen());
        }

        hash = computeHash();
    }
}
项目:jasperreports    文件:JRXlsExporter.java   
public void setBox(JRLineBox box)
{
    borderStyle[TOP] = JRXlsExporter.getBorderStyle(box.getTopPen());
    borderColour[TOP] = JRXlsExporter.this.getWorkbookColor(box.getTopPen().getLineColor()).getIndex();

    borderStyle[BOTTOM] = JRXlsExporter.getBorderStyle(box.getBottomPen());
    borderColour[BOTTOM] = JRXlsExporter.this.getWorkbookColor(box.getBottomPen().getLineColor()).getIndex();

    borderStyle[LEFT] = JRXlsExporter.getBorderStyle(box.getLeftPen());
    borderColour[LEFT] = JRXlsExporter.this.getWorkbookColor(box.getLeftPen().getLineColor()).getIndex();

    borderStyle[RIGHT] = JRXlsExporter.getBorderStyle(box.getRightPen());
    borderColour[RIGHT] = JRXlsExporter.this.getWorkbookColor(box.getRightPen().getLineColor()).getIndex();

    hash = computeHash();
}
项目:jasperreports    文件:JRDocxExporter.java   
/**
 *
 */
protected void exportRectangle(DocxTableHelper tableHelper, JRPrintRectangle rectangle, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(rectangle.getLinePen().getLineColor());
    pen.setLineStyle(rectangle.getLinePen().getLineStyleValue());
    pen.setLineWidth(rectangle.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    tableHelper.getCellHelper().exportHeader(rectangle, gridCell);
    tableHelper.getParagraphHelper().exportEmptyParagraph(startPage, bookmarkIndex, pageAnchor);
    if (startPage)
    {
        // increment the bookmarkIndex for the first cell in the sheet, due to page anchor creation
        bookmarkIndex++;
    }
    tableHelper.getCellHelper().exportFooter();
}
项目:jasperreports    文件:JRDocxExporter.java   
/**
 *
 */
protected void exportEllipse(DocxTableHelper tableHelper, JRPrintEllipse ellipse, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(ellipse.getLinePen().getLineColor());
    pen.setLineStyle(ellipse.getLinePen().getLineStyleValue());
    pen.setLineWidth(ellipse.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    tableHelper.getCellHelper().exportHeader(ellipse, gridCell);
    tableHelper.getParagraphHelper().exportEmptyParagraph(startPage, bookmarkIndex, pageAnchor);
    if (startPage)
    {
        // increment the bookmarkIndex for the first cell in the sheet, due to page anchor creation
        bookmarkIndex++;
    }
    tableHelper.getCellHelper().exportFooter();
}
项目:jasperreports    文件:JRXlsxExporter.java   
@Override
protected void exportRectangle(
    JRPrintGraphicElement rectangle,
    JRExporterGridCell gridCell, 
    int colIndex, 
    int rowIndex
    ) throws JRException 
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(rectangle.getLinePen().getLineColor());
    pen.setLineStyle(rectangle.getLinePen().getLineStyleValue());
    pen.setLineWidth(rectangle.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    cellHelper.exportHeader(gridCell, rowIndex, colIndex, maxColumnIndex, sheetInfo);
    sheetHelper.exportMergedCells(rowIndex, colIndex, maxColumnIndex, gridCell.getRowSpan(), gridCell.getColSpan());
    cellHelper.exportFooter();
}
项目:jasperreports    文件:XlsxBorderInfo.java   
/**
 *
 */
public XlsxBorderInfo(JRLineBox box, LineDirectionEnum direction)
{
    if(direction != null)
    {
        setBorder(box.getPen(), DIAGONAL_BORDER);
    }
    else
    {
        setBorder(box.getTopPen(), TOP_BORDER);
        borderPadding[TOP_BORDER] = String.valueOf(LengthUtil.twip(box.getTopPadding().intValue()));
        setBorder(box.getLeftPen(), LEFT_BORDER);
        borderPadding[LEFT_BORDER] = String.valueOf(LengthUtil.twip(box.getLeftPadding().intValue()));
        setBorder(box.getBottomPen(), BOTTOM_BORDER);
        borderPadding[BOTTOM_BORDER] = String.valueOf(LengthUtil.twip(box.getBottomPadding().intValue()));
        setBorder(box.getRightPen(), RIGHT_BORDER);
        borderPadding[RIGHT_BORDER] = String.valueOf(LengthUtil.twip(box.getRightPadding().intValue()));
    }
    this.direction = direction;
}
项目:jasperreports    文件:SimpleChartTheme.java   
protected void setChartBorder(JFreeChart jfreeChart)
{
    ChartSettings chartSettings = getChartSettings();
    JRLineBox lineBox = getChart().getLineBox();
    if (
        lineBox.getLeftPen().getLineWidth().floatValue() == 0
        && lineBox.getBottomPen().getLineWidth().floatValue() == 0
        && lineBox.getRightPen().getLineWidth().floatValue() == 0
        && lineBox.getTopPen().getLineWidth().floatValue() == 0
        )
    {
        boolean isVisible = chartSettings.getBorderVisible() == null 
            ? true 
            : chartSettings.getBorderVisible().booleanValue();
        if (isVisible)
        {
            Stroke stroke = chartSettings.getBorderStroke();
            if (stroke != null)
                jfreeChart.setBorderStroke(stroke);
            Paint paint = chartSettings.getBorderPaint() == null
                    ? null
                    : chartSettings.getBorderPaint().getPaint();
            if (paint != null)
                jfreeChart.setBorderPaint(paint);
        }

        jfreeChart.setBorderVisible(isVisible);
    }
}
项目:jasperreports    文件:JRBaseBoxPen.java   
/**
 *
 */
public JRBaseBoxPen(JRLineBox box)
{
    super(box);

    this.lineBox = 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;
}
项目:jasperreports    文件:Tabulator.java   
@Override
public TableCell visit(ElementCell cell, TablePosition position)
{
    JRPrintElement element = getCellElement(cell);
    int colSpan = getColumnCellSpan(position, cell).span;
    int rowSpan = getRowCellSpan(position, cell).span;
    Color backcolor = getElementBackcolor(cell);

    JRLineBox elementBox = (element instanceof JRBoxContainer) ? ((JRBoxContainer) element).getLineBox() : null;
    JRLineBox box = copyParentBox(cell, element, elementBox, true, true, true, true);

    TableCell tableCell = new TableCell(Tabulator.this, position, cell, element, colSpan, rowSpan, backcolor, box);
    return tableCell;
}
项目:jasperreports    文件:JRPenFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRLineBox box = (JRLineBox) digester.peek();
    setPenAttributes(atts, box.getPen());
    return box;
}
项目:jasperreports    文件:JRPenFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRLineBox box = (JRLineBox) digester.peek();
    setPenAttributes(atts, box.getTopPen());
    return box;
}
项目:jasperreports    文件:JRPenFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRLineBox box = (JRLineBox) digester.peek();
    setPenAttributes(atts, box.getLeftPen());
    return box;
}
项目:jasperreports    文件:JRPenFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRLineBox box = (JRLineBox) digester.peek();
    setPenAttributes(atts, box.getRightPen());
    return box;
}
项目:jasperreports    文件:CachingLineBox.java   
public CachingLineBox(JRLineBox base)
{
    this.base = base;

    padding = base.getPadding();
    topPadding = base.getTopPadding();
    bottomPadding = base.getBottomPadding();
    leftPadding = base.getLeftPadding();
    rightPadding = base.getRightPadding();
}
项目:jasperreports    文件:JRBoxUtil.java   
/**
 * 
 */
public static void copy(JRLineBox source, JRLineBox dest)
{
    dest.setLeftPadding(source.getOwnLeftPadding());
    dest.copyLeftPen(source.getLeftPen());
    dest.setRightPadding(source.getOwnRightPadding());
    dest.copyRightPen(source.getRightPen());
    dest.setTopPadding(source.getOwnTopPadding());
    dest.copyTopPen(source.getTopPen());
    dest.setBottomPadding(source.getOwnBottomPadding());
    dest.copyBottomPen(source.getBottomPen());
    dest.setPadding(source.getOwnPadding());
    dest.copyPen(source.getPen());
}
项目:jasperreports    文件:StyleUtil.java   
protected boolean hasPadding(JRBoxContainer boxContainer, BoxSideSelector penSelector)
{
    JRLineBox lineBox = boxContainer.getLineBox();
    Integer sidePadding = penSelector.getPadding(lineBox);
    if (sidePadding != null)
    {
        return sidePadding > 0;
    }

    Integer padding = lineBox.getOwnPadding();
    if (padding != null)
    {
        return padding > 0;
    }

    JRStyle style = boxContainer.getStyle();
    if (style != null)
    {
        return hasPadding(style, penSelector);
    }

    String styleReference = boxContainer.getStyleNameReference();
    if (styleReference != null)
    {
        // we can't resolve the style reference, return pessimistically
        return true;
    }

    return false;
}
项目:jasperreports    文件:TableBuilder.java   
/**
 *
 */
public void exportRectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell)
{
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(rectangle.getLinePen().getLineColor());
    pen.setLineStyle(rectangle.getLinePen().getLineStyleValue());
    pen.setLineWidth(rectangle.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box

    buildCellHeader(styleCache.getCellStyle(gridCell), gridCell.getColSpan(), gridCell.getRowSpan());
    buildCellFooter();
}
项目:jasperreports    文件:JRRtfExporter.java   
/**
 *
 */
private void exportBox(JRLineBox box, int x, int y, int width, int height) throws IOException
{
    exportTopPen(box.getTopPen(), box.getLeftPen(), box.getRightPen(), x, y, width, height);
    exportLeftPen(box.getTopPen(), box.getLeftPen(), box.getBottomPen(), x, y, width, height);
    exportBottomPen(box.getLeftPen(), box.getBottomPen(), box.getRightPen(), x, y, width, height);
    exportRightPen(box.getTopPen(), box.getBottomPen(), box.getRightPen(), x, y, width, height);
}
项目:jasperreports    文件:DocxBorderInfo.java   
/**
 *
 */
public DocxBorderInfo(JRLineBox box)
{
    setBorder(box.getTopPen(), TOP_BORDER);
    borderPadding[TOP_BORDER] = String.valueOf(LengthUtil.twip(box.getTopPadding().intValue()));
    setBorder(box.getLeftPen(), LEFT_BORDER);
    borderPadding[LEFT_BORDER] = String.valueOf(LengthUtil.twip(box.getLeftPadding().intValue()));
    setBorder(box.getBottomPen(), BOTTOM_BORDER);
    borderPadding[BOTTOM_BORDER] = String.valueOf(LengthUtil.twip(box.getBottomPadding().intValue()));
    setBorder(box.getRightPen(), RIGHT_BORDER);
    borderPadding[RIGHT_BORDER] = String.valueOf(LengthUtil.twip(box.getRightPadding().intValue()));
}
项目:jasperreports    文件:DocxBorderHelper.java   
/**
 *
 */
public void export(JRLineBox box)
{
    if (box != null)
    {
        export(new DocxBorderInfo(box));
    }
}
项目:jasperreports    文件:JRFillTextElement.java   
@Override
public JRLineBox getLineBox()
{
    return lineBox == null 
            ? (fillStyleObjects == null ? initLineBox : fillStyleObjects.lineBox) 
            : lineBox;
}
项目:jasperreports    文件:XlsxBorderHelper.java   
/**
 *
 */
public void export(JRLineBox box)
{
    if (box != null)
    {
        export(new XlsxBorderInfo(box));
    }
}
项目:jasperreports    文件:FillTable.java   
@Override
public FillPrepareResult prepare(int availableHeight)
{
    try
    {
        if (fillColumns.isEmpty())
        {
            //no columns to print
            return FillPrepareResult.NO_PRINT_NO_OVERFLOW;
        }

        JRTemplatePrintFrame printFrame = new JRTemplatePrintFrame(getFrameTemplate(), printElementOriginator);
        JRLineBox lineBox = printFrame.getLineBox();
        int verticalPadding = lineBox.getTopPadding() + lineBox.getBottomPadding();

        FillPrepareResult result = 
            fillSubreport.prepareSubreport(
                availableHeight - verticalPadding, 
                filling
                );

        if (verticalPadding != 0)
        {
            result = result.addStretch(verticalPadding);
        }

        filling = result.willOverflow();
        return result;
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRTemplateFrame.java   
/**
 *
 */
public void copyBox(JRLineBox lineBox)
{
    this.lineBox = lineBox.clone(this);
}
项目:jasperreports    文件:JRBaseTextElement.java   
@Override
public JRLineBox getLineBox()
{
    return lineBox;
}
项目:jasperreports    文件:JRDesignCrosstab.java   
@Override
public JRLineBox getLineBox()
{
    return lineBox;
}
项目:jasperreports    文件:JRBaseBoxPen.java   
@Override
public JRPen getPen(JRLineBox box) 
{
    return box.getPen();
}
项目:jasperreports    文件:JRBasePrintText.java   
@Override
public JRLineBox getLineBox()
{
    return lineBox;
}
项目:jasperreports    文件:TableCell.java   
public void setBox(JRLineBox box)
{
    this.box = box;
}
项目:jasperreports    文件:JRBaseBoxBottomPen.java   
/**
 *
 */
public JRBaseBoxBottomPen(JRLineBox box)
{
    super(box);
}