Java 类net.sf.jasperreports.engine.type.RunDirectionEnum 实例源码

项目:PDFReporter-Studio    文件:MCrosstab.java   
@Override
public void setPropertyValue(Object id, Object value) {
    JRDesignCrosstab jrElement = (JRDesignCrosstab) getValue();

    if (id.equals(JRDesignCrosstab.PROPERTY_REPEAT_COLUMN_HEADERS))
        jrElement.setRepeatColumnHeaders((Boolean) value);
    else if (id.equals(JRDesignCrosstab.PROPERTY_REPEAT_ROW_HEADERS))
        jrElement.setRepeatRowHeaders((Boolean) value);
    else if (id.equals(JRBaseCrosstab.PROPERTY_HORIZONTAL_POSITION))
        jrElement.setHorizontalPosition(HorizontalPositionUtil.getTextPosition4Pos((Integer) value));
    else if (id.equals(JRDesignCrosstab.PROPERTY_IGNORE_WIDTH))
        jrElement.setIgnoreWidth((Boolean) value);
    else if (id.equals(JRDesignCrosstab.PROPERTY_COLUMN_BREAK_OFFSET))
        jrElement.setColumnBreakOffset((Integer) value);
    if (id.equals(JRBaseCrosstab.PROPERTY_RUN_DIRECTION)) {
        jrElement.setRunDirection((RunDirectionEnum) runDirectionD.getEnumValue(value));

        getCrosstabManager().refresh();
        getPropertyChangeSupport().firePropertyChange(new PropertyChangeEvent(this, JRBaseCrosstab.PROPERTY_RUN_DIRECTION, null, value));
    } else if (id.equals(JRDesignCrosstab.PROPERTY_PARAMETERS_MAP_EXPRESSION))
        jrElement.setParametersMapExpression(ExprUtil.setValues(jrElement.getParametersMapExpression(), value));
    else
        super.setPropertyValue(id, value);
}
项目:jasperreports    文件:ReportConverter.java   
/**
 *
 */
private void addBand(JRBand band, boolean isColumnBand)
{
    if (band != null)
    {
        JRBasePrintFrame frame = new JRBasePrintFrame(null);
        frame.setX(
            isColumnBand && report.getColumnDirection() == RunDirectionEnum.RTL 
                ? report.getPageWidth() - report.getRightMargin() - report.getColumnWidth() 
                : report.getLeftMargin()
            );
        frame.setY(offsetY);
        frame.setWidth(
            isColumnBand
            ? report.getColumnWidth()
            : report.getPageWidth() - report.getLeftMargin() - report.getRightMargin()
            );
        frame.setHeight(band.getHeight());

        band.visit(new ConvertVisitor(this, frame));

        pageElements.add(frame);

        offsetY += band.getHeight();
        addBandSeparator(offsetY);
    }
}
项目:jasperreports    文件:JasperDesign.java   
/**
 * Sets the column direction.
 */
public void setColumnDirection(RunDirectionEnum columnDirection)
{
    Object old = this.columnDirection;
    this.columnDirection = columnDirection;
    getEventSupport().firePropertyChange(PROPERTY_COLUMN_DIRECTION, old, this.columnDirection);
}
项目:jasperreports    文件:SimplePdfTextRenderer.java   
@Override
public void render()
{
    ColumnText colText = new ColumnText(pdfContentByte);
    colText.setSimpleColumn(
        getPhrase(styledText, text),
        x + leftPadding,
        pdfExporter.getCurrentPageFormat().getPageHeight()
            - y
            - topPadding
            - verticalAlignOffset
            - text.getLeadingOffset(),
            //+ text.getLineSpacingFactor() * text.getFont().getSize(),
        x + width - rightPadding,
        pdfExporter.getCurrentPageFormat().getPageHeight()
            - y
            - height
            + bottomPadding,
        0,//text.getLineSpacingFactor(),// * text.getFont().getSize(),
        horizontalAlignment == Element.ALIGN_JUSTIFIED_ALL ? Element.ALIGN_JUSTIFIED : horizontalAlignment
        );

    colText.setLeading(0, text.getLineSpacingFactor());// * text.getFont().getSize());
    colText.setRunDirection(
        text.getRunDirectionValue() == RunDirectionEnum.LTR
        ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_RTL
        );

    try
    {
        colText.go();
    }
    catch (DocumentException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRFillCrosstab.java   
protected HorizontalPosition concreteHorizontalPosition()
{
    HorizontalPosition position = getHorizontalPosition();
    if (position == null)
    {
        position = getRunDirectionValue() == RunDirectionEnum.RTL 
                ? HorizontalPosition.RIGHT : HorizontalPosition.LEFT;
    }
    return position;
}
项目:jasperreports    文件:JRHorizontalFiller.java   
/**
 *
 */
private void setOffsetX()
{
    if (columnDirection == RunDirectionEnum.RTL)
    {
        offsetX = pageWidth - rightMargin - columnWidth - columnIndex * (columnSpacing + columnWidth);
    }
    else
    {
        offsetX = leftMargin + columnIndex * (columnSpacing + columnWidth);
    }
}
项目:jasperreports    文件:JRTemplatePrintText.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        runDirectionValue = RunDirectionEnum.getByValue(runDirection);
    }
}
项目:jasperreports    文件:JRVerticalFiller.java   
/**
 *
 */
private void setOffsetX()
{
    if (columnDirection == RunDirectionEnum.RTL)
    {
        offsetX = pageWidth - rightMargin - columnWidth - columnIndex * (columnSpacing + columnWidth);
    }
    else
    {
        offsetX = leftMargin + columnIndex * (columnSpacing + columnWidth);
    }
}
项目:jasperreports    文件:JRBaseCrosstab.java   
@Override
public void setRunDirection(RunDirectionEnum runDirectionValue)
{
    RunDirectionEnum old = this.runDirectionValue;
    this.runDirectionValue = runDirectionValue;
    getEventSupport().firePropertyChange(PROPERTY_RUN_DIRECTION, old, this.runDirectionValue);
}
项目:jasperreports    文件:JRDesignCrosstab.java   
@Override
public void setRunDirection(RunDirectionEnum runDirectionValue)
{
    RunDirectionEnum old = this.runDirectionValue;
    this.runDirectionValue = runDirectionValue;
    getEventSupport().firePropertyChange(JRBaseCrosstab.PROPERTY_RUN_DIRECTION, old, this.runDirectionValue);
}
项目:eMonocot    文件:JRVerticalReportWriter.java   
/**
 *
 */
private void setOffsetX()
{
    if (columnDirection == RunDirectionEnum.RTL)
    {
        offsetX = pageWidth - rightMargin - columnWidth - columnIndex * (columnSpacing + columnWidth);
    }
    else
    {
        offsetX = leftMargin + columnIndex * (columnSpacing + columnWidth);
    }
}
项目:ireport-fork    文件:ReportNode.java   
@SuppressWarnings("unchecked")
public ColumnDirectionProperty(JasperDesign jd)
{
    super(RunDirectionEnum.class,jd);
    this.jd = jd;
    setValue("suppressCustomEditor", Boolean.TRUE);
}
项目:ireport-fork    文件:ReportNode.java   
public List getTagList()
{
    List tags = new java.util.ArrayList();
    tags.add(new Tag(RunDirectionEnum.LTR, I18n.getString("Global.Property.ColumnDirection.LTR")));
    tags.add(new Tag(RunDirectionEnum.RTL, I18n.getString("Global.Property.ColumnDirection.RTL")));

    return tags;
}
项目:ireport-fork    文件:ReportNode.java   
@Override
public void setPropertyValue(Object value) {
    if (value != null && value instanceof RunDirectionEnum)
    {
        jd.setColumnDirection( (RunDirectionEnum)value);
    }
}
项目:ireport-fork    文件:CrosstabNode.java   
@SuppressWarnings("unchecked")
public RunDirectionProperty(JRDesignCrosstab crosstab)
{
    super(RunDirectionEnum.class, crosstab);
    this.crosstab = crosstab;
    setValue("suppressCustomEditor", Boolean.TRUE);
}
项目:ireport-fork    文件:CrosstabNode.java   
public List getTagList() {
    List list = new ArrayList();
    list.add(new Tag(RunDirectionEnum.LTR, "Left to Right"));
    list.add(new Tag(RunDirectionEnum.RTL, "Right to Left"));
    return list;

}
项目:dynamicreports-jasper    文件:CrosstabTest.java   
@Override
public void test() {
    super.test();

    JRBaseCrosstab crosstab = (JRBaseCrosstab) getJasperReport().getSummary().getElementByKey("summary.crosstab1");
    Assert.assertFalse("Crosstab repeatColumnHeaders", crosstab.isRepeatColumnHeaders());
    Assert.assertFalse("Crosstab repeatRowHeaders", crosstab.isRepeatRowHeaders());
    Assert.assertEquals("Crosstab columnBreakOffset", 100, crosstab.getColumnBreakOffset());
    Assert.assertTrue("Crosstab ignoreWidth", crosstab.getIgnoreWidth());
    Assert.assertEquals("Crosstab runDirection", RunDirectionEnum.RTL, crosstab.getRunDirectionValue());
    Assert.assertEquals("Crosstab row group position", CrosstabRowPositionEnum.STRETCH, crosstab.getRowGroups()[0].getPositionValue());
    Assert.assertEquals("Crosstab column group position", CrosstabColumnPositionEnum.STRETCH, crosstab.getColumnGroups()[0].getPositionValue());
}
项目:jasperreports    文件:JRBaseReport.java   
@Override
public RunDirectionEnum getColumnDirection()
{
    return columnDirection;
}
项目:jasperreports    文件:JRBasePrintText.java   
@Override
public RunDirectionEnum getRunDirectionValue()
{
    return this.runDirectionValue;
}
项目:jasperreports    文件:JRBasePrintText.java   
@Override
public void setRunDirection(RunDirectionEnum runDirectionValue)
{
    this.runDirectionValue = runDirectionValue;
}
项目:jasperreports    文件:JRBasePrintText.java   
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
    in.defaultReadObject();

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_3_7_2)
    {
        horizontalAlignmentValue = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getByValue(horizontalAlignment);
        verticalAlignmentValue = net.sf.jasperreports.engine.type.VerticalAlignEnum.getByValue(verticalAlignment);
        rotationValue = RotationEnum.getByValue(rotation);
        runDirectionValue = RunDirectionEnum.getByValue(runDirection);
        lineSpacingValue = LineSpacingEnum.getByValue(lineSpacing);

        horizontalAlignment = null;
        verticalAlignment = null;
        rotation = null;
        lineSpacing = null;
    }

    if (isStyledText != null)
    {
        markup = isStyledText.booleanValue() ? JRCommonText.MARKUP_STYLED_TEXT : JRCommonText.MARKUP_NONE;
        isStyledText = null;
    }

    if (linkType == null)
    {
         linkType = JRHyperlinkHelper.getLinkType(HyperlinkTypeEnum.getByValue(hyperlinkType));
    }

    if (linkTarget == null)
    {
         linkTarget = JRHyperlinkHelper.getLinkTarget(HyperlinkTargetEnum.getByValue(hyperlinkTarget));
    }

    if (paragraph == null)
    {
        paragraph = new JRBaseParagraph(this);
        paragraph.setLineSpacing(lineSpacingValue);
        lineSpacingValue = null;
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_5_5_2)
    {
        fontsize = fontSize == null ? null : fontSize.floatValue();

        fontSize = null;
    }

    if (PSEUDO_SERIAL_VERSION_UID < JRConstants.PSEUDO_SERIAL_VERSION_UID_6_0_2)
    {
        horizontalTextAlign = net.sf.jasperreports.engine.type.HorizontalAlignEnum.getHorizontalTextAlignEnum(horizontalAlignmentValue);
        verticalTextAlign = net.sf.jasperreports.engine.type.VerticalAlignEnum.getVerticalTextAlignEnum(verticalAlignmentValue);

        horizontalAlignmentValue = null;
        verticalAlignmentValue = null;
    }
}
项目:jasperreports    文件:CrosstabConverter.java   
/**
 *
 */
private List<JRPrintElement> getCrosstabChildren(ReportConverter reportConverter, JRCrosstab crosstab)
{
    List<JRPrintElement> crosstabElements = new ArrayList<JRPrintElement>();

    int yOffset = 0;
    if (crosstab.getTitleCell() != null
            && crosstab.getTitleCell().getHeight() > 0
            && crosstab.getTitleCell().getCellContents() != null)
    {
        crosstabElements.add(getCrosstabCellFrame(reportConverter, crosstab.getTitleCell().getCellContents(), 
                0, yOffset, false, false, false));

        yOffset += crosstab.getTitleCell().getHeight();
    }

    JRCrosstabRowGroup[] rowGroups = crosstab.getRowGroups();
    int rowHeadersXOffset = 0;
    for (int i = 0; i < rowGroups.length; i++)
    {
        rowHeadersXOffset += rowGroups[i].getWidth();
    }

    JRCrosstabColumnGroup[] columnGroups = crosstab.getColumnGroups();
    int colHeadersYOffset = yOffset;
    for (int i = 0; i < columnGroups.length; i++)
    {
        colHeadersYOffset += columnGroups[i].getHeight();
    }

    JRCellContents headerCell = crosstab.getHeaderCell();
    if (headerCell != null)
    {
        if (headerCell.getWidth() != 0 && headerCell.getHeight() != 0)
        {
            crosstabElements.add(
                getCrosstabCellFrame(
                    reportConverter,
                    headerCell, 
                    0, 
                    yOffset, 
                    false, 
                    false, 
                    false
                    ));

        }

    }

    addCrosstabColumnHeaders(
        reportConverter,
        crosstab, 
        rowHeadersXOffset,
        yOffset,
        crosstabElements
        );
    addCrosstabRows(
        reportConverter,
        crosstab, 
        rowHeadersXOffset, 
        colHeadersYOffset, 
        crosstabElements
        );

    if (crosstab.getRunDirectionValue() == RunDirectionEnum.RTL)
    {
        mirrorElements(crosstabElements, crosstab.getX(), crosstab.getWidth());
    }

    return crosstabElements;
}
项目:jasperreports    文件:ParagraphStyle.java   
/**
 *
 */
public ParagraphStyle(WriterHelper styleWriter, JRPrintText text, boolean isIgnoreTextFormatting)
{
    super(styleWriter);

    horizontalAlignment = getHorizontalAlignment(
            text.getHorizontalTextAlign(), 
            text.getVerticalTextAlign(), 
            (isIgnoreTextFormatting ? RotationEnum.NONE : text.getRotationValue()));
    verticalAlignment = getVerticalAlignment(
            text.getHorizontalTextAlign(), 
            text.getVerticalTextAlign(), 
            (isIgnoreTextFormatting ? RotationEnum.NONE : text.getRotationValue()));

    if(isIgnoreTextFormatting)
    {
        textRotation = "0";
    }
    else 
    {
        switch(text.getRotationValue())
        {
            case LEFT:
            {
                textRotation = "90";
                break;
            }
            case RIGHT:
            {
                textRotation = "270";
                break;
            }
            case UPSIDE_DOWN://FIXMEODT possible?
            case NONE:
            default:
            {
                textRotation = "0";
            }
        }
    }

    runDirection = null;
    if (text.getRunDirectionValue() == RunDirectionEnum.RTL)
    {
        runDirection = "rl";
    }

    paragraph = text.getParagraph();
}
项目:jasperreports    文件:PdfTextRenderer.java   
@Override
public void draw()
{
    TabSegment segment = segments.get(segmentIndex);

    float advance = segment.layout.getAdvance();

    ColumnText colText = new ColumnText(pdfContentByte);
    colText.setSimpleColumn(
        pdfExporter.getPhrase(segment.as, segment.text, text),
        x + drawPosX + leftOffsetFactor * advance,// + leftPadding
        pdfExporter.getCurrentPageFormat().getPageHeight()
            - y
            - topPadding
            - verticalAlignOffset
            //- text.getLeadingOffset()
            + lineHeight
            - drawPosY,
        x + drawPosX  + segment.layout.getAdvance() + rightOffsetFactor * advance,// + leftPadding
        pdfExporter.getCurrentPageFormat().getPageHeight()
            - y
            - topPadding
            - verticalAlignOffset
            //- text.getLeadingOffset()
            -400//+ lineHeight//FIXMETAB
            - drawPosY,
        0,//text.getLineSpacingFactor(),// * text.getFont().getSize(),
        horizontalAlignment
        );

    //colText.setLeading(0, text.getLineSpacingFactor());// * text.getFont().getSize());
    colText.setLeading(lineHeight);
    colText.setRunDirection(
        text.getRunDirectionValue() == RunDirectionEnum.LTR
        ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_RTL
        );

    try
    {
        colText.go();
    }
    catch (DocumentException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 * @throws IOException 
 *
 */
public void exportText(JRPrintText text) throws IOException
{
    xmlWriter.startElement(JRXmlConstants.ELEMENT_text);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_textAlignment, text.getOwnHorizontalTextAlign());
    VerticalTextAlignEnum vTextAlign = text.getOwnVerticalTextAlign();
    if (isOlderVersionThan(JRConstants.VERSION_6_2_1))
    {
        vTextAlign = vTextAlign == VerticalTextAlignEnum.JUSTIFIED ? VerticalTextAlignEnum.TOP : vTextAlign;
    }
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_verticalAlignment, vTextAlign);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_textHeight, text.getTextHeight());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_rotation, text.getOwnRotationValue());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_runDirection, text.getRunDirectionValue(), RunDirectionEnum.LTR);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_markup, text.getOwnMarkup());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_lineSpacingFactor, text.getLineSpacingFactor(), 0f);
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_leadingOffset, text.getLeadingOffset(), 0f);

    JRHyperlinkProducerFactory hyperlinkProducerFactory = getCurrentItemConfiguration().getHyperlinkProducerFactory();
    if (hyperlinkProducerFactory == null)
    {
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, text.getLinkType());
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkReference, text.getHyperlinkReference());
        xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkAnchor, text.getHyperlinkAnchor());
        xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkPage, text.getHyperlinkPage());
    }
    else
    {
        String reference = hyperlinkProducerFactory.produceHyperlink(text);
        if (reference != null)
        {
            xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkType, HyperlinkTypeEnum.REFERENCE);
            xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkReference, reference);
        }
    }

    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTarget, text.getLinkTarget());
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_hyperlinkTooltip, text.getHyperlinkTooltip());
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_anchorName, text.getAnchorName());
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_bookmarkLevel, text.getBookmarkLevel(), JRAnchor.NO_BOOKMARK);

    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_valueClass, text.getValueClassName());
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pattern, text.getPattern());     
    xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_formatFactoryClass, text.getFormatFactoryClass());      
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_locale, text.getLocaleCode());       
    xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_timezone, text.getTimeZoneId());     

    exportReportElement(text);
    exportBox(text.getLineBox());

    exportFont(text);
    exportParagraph(text.getParagraph());

    if (text.getOriginalText() != null)
    {
        xmlWriter.writeCDATAElement(JRXmlConstants.ELEMENT_textContent, text.getOriginalText(),
                JRXmlConstants.ATTRIBUTE_truncateIndex, text.getTextTruncateIndex());
    }

    xmlWriter.writeCDATAElement(JRXmlConstants.ELEMENT_textTruncateSuffix, text.getTextTruncateSuffix());

    short[] lineBreakOffsets = text.getLineBreakOffsets();
    if (lineBreakOffsets != null)
    {
        StringBuilder offsetsString = formatTextLineBreakOffsets(lineBreakOffsets);
        xmlWriter.writeCDATAElement(JRXmlConstants.ELEMENT_lineBreakOffsets, 
                offsetsString.toString());
    }

    if (hyperlinkProducerFactory == null)
    {
        exportHyperlinkParameters(text);
    }

    xmlWriter.closeElement();
}
项目:jasperreports    文件:AbstractPdfTextRenderer.java   
/**
 * 
 */
public void initialize(
    JRPdfExporter pdfExporter, 
    PdfContentByte pdfContentByte,
    JRPrintText text, JRStyledText styledText, 
    int offsetX,
    int offsetY
    )
{
    this.pdfExporter = pdfExporter;
    this.pdfContentByte = pdfContentByte;

    horizontalAlignment = Element.ALIGN_LEFT;
    leftOffsetFactor = 0f;
    rightOffsetFactor = 0f;

    //FIXMETAB 0.2f was a fair approximation
    switch (text.getHorizontalTextAlign())
    {
        case JUSTIFIED :
        {
            horizontalAlignment = Element.ALIGN_JUSTIFIED_ALL;
            leftOffsetFactor = 0f;
            rightOffsetFactor = 0f;
            break;
        }
        case RIGHT :
        {
            if (text.getRunDirectionValue() == RunDirectionEnum.LTR)
            {
                horizontalAlignment = Element.ALIGN_RIGHT;
            }
            else
            {
                horizontalAlignment = Element.ALIGN_LEFT;
            }
            leftOffsetFactor = -0.2f;
            rightOffsetFactor = 0f;
            break;
        }
        case CENTER :
        {
            horizontalAlignment = Element.ALIGN_CENTER;
            leftOffsetFactor = -0.1f;
            rightOffsetFactor = 0.1f;
            break;
        }
        case LEFT :
        default :
        {
            if (text.getRunDirectionValue() == RunDirectionEnum.LTR)
            {
                horizontalAlignment = Element.ALIGN_LEFT;
            }
            else
            {
                horizontalAlignment = Element.ALIGN_RIGHT;
            }
            leftOffsetFactor = 0f;
            rightOffsetFactor = 0.2f;
            break;
        }
    }

    super.initialize(text, styledText, offsetX, offsetY);
}
项目:jasperreports    文件:JRFillCrosstab.java   
protected void addCrosstabChunk(List<JRPrintElement> elements, int yOffset)
{
    JRTemplatePrintFrame printFrame = new JRTemplatePrintFrame(getTemplateFrame(), printElementOriginator);
    //printFrame.setUUID(getUUID());
    printFrame.setX(0);
    printFrame.setY(yOffset);

    Collections.sort(elements, new JRYXComparator());//FIXME make singleton comparator; same for older comparator

    int xLimit = Integer.MIN_VALUE;
    int yLimit = Integer.MIN_VALUE;
    for (Iterator<JRPrintElement> it = elements.iterator(); it.hasNext();)
    {
        JRPrintElement element = it.next();
        if (element.getX() + element.getWidth() > xLimit)
        {
            xLimit = element.getX() + element.getWidth();
        }
        if (element.getY() + element.getHeight() > yLimit)
        {
            yLimit = element.getY() + element.getHeight();
        }
    }

    JRLineBox lineBox = getLineBox();
    int width = xLimit + lineBox.getLeftPadding() + lineBox.getRightPadding();
    printFrame.setWidth(width);

    HorizontalPosition position = concreteHorizontalPosition();
    switch (position)
    {
    case RIGHT:
        // the position does not apply when the crosstab is bigger than the element (ignoreWidth is set)
        // still, it applies if the crosstab is RTL
        if (width < getWidth() || getRunDirectionValue() == RunDirectionEnum.RTL)
        {
            // move to the right
            printFrame.setX(getWidth() - width);
        }
        break;
    case CENTER:
        // the position does not apply when the crosstab is bigger than the element (ignoreWidth is set)
        if (width < getWidth())
        {
            int centeredX = (getWidth() - width) / 2;
            printFrame.setX(centeredX);
        }
        break;
    case LEFT:
    default:
        // x = 0 already set
        break;
    }

    int height = yLimit + lineBox.getTopPadding() + lineBox.getBottomPadding();
    printFrame.setHeight(height);

    if (getRunDirectionValue() == RunDirectionEnum.RTL)
    {
        mirrorPrintElements(elements, xLimit);
    }

    int chunkIndex = getChunkIndex();
    String chunkId = getUUID().toString() + "." + chunkIndex;

    if (interactive)
    {
        printFrame.getPropertiesMap().setProperty(CrosstabInteractiveJsonHandler.PROPERTY_CROSSTAB_ID, 
                chunkId);

        JRTemplateGenericPrintElement genericElement = createInteractiveElement(chunkId, floatingHeaders);
        printFrame.addElement(genericElement);
    }

    // dump all elements into the print frame
    printFrame.addElements(elements);

    // add this frame to the list to the list of crosstab chunks
    printFrames.add(printFrame);
}
项目:jasperreports    文件:JRFillCrosstab.java   
private boolean prepareDataCell(CrosstabCell data, int column, int availableHeight, int xOffset) throws JRException
{
    int rowY = rowYs.get(rowIdx).intValue();

    JRFillCrosstabCell cell = crossCells[data.getRowTotalGroupIndex()][data.getColumnTotalGroupIndex()];
    JRFillCellContents contents = cell == null ? null : cell.getFillContents();
    if (contents == null || contents.getWidth() <= 0 || contents.getHeight() <= 0)
    {
        return false;
    }

    boolean overflow = availableHeight < rowY + contents.getHeight();
    if (!overflow)
    {
        boolean leftEmpty = startColumnIndex != 0 && !isRepeatRowHeaders();
        boolean topEmpty = startRowIndex != 0 && !isRepeatColumnHeaders();

        setCountVars(rowIdx + startRowIndex, column);
        setGroupVariables(rowGroups, data.getRowBucketValues());
        setGroupVariables(columnGroups, data.getColumnBucketValues());
        setMeasureVariables(data);

        boolean firstOnRow = leftEmpty && column == startColumnIndex;
        contents = contents.getBoxContents(
                firstOnRow && getRunDirectionValue() == RunDirectionEnum.LTR,
                firstOnRow && getRunDirectionValue() == RunDirectionEnum.RTL,
                topEmpty && rowIdx == 0);
        contents = contents.getWorkingClone();

        contents.evaluate(JRExpression.EVALUATION_DEFAULT);
        contents.prepare(availableHeight - rowY);

        if (interactive)
        {
            contents.setPrintProperty(CrosstabInteractiveJsonHandler.PROPERTY_COLUMN_INDEX, Integer.toString(column));
            contents.addHtmlClass("jrxtdatacell");
        }

        preparedRow.add(contents);

        overflow = contents.willOverflow();

        if (!overflow)
        {
            contents.setX(columnXOffsets[column] - columnXOffsets[startColumnIndex] + xOffset);
            contents.setY(rowY + yOffset);

            int rowCellHeight = contents.getPrintHeight();
            if (rowCellHeight > preparedRowHeight)
            {
                preparedRowHeight = rowCellHeight;
            }
        }
    }

    return overflow;
}
项目:jasperreports    文件:JRFillCrosstab.java   
@Override
public RunDirectionEnum getRunDirectionValue()
{
    return parentCrosstab.getRunDirectionValue();
}
项目:jasperreports    文件:JRFillCrosstab.java   
@Override
public void setRunDirection(RunDirectionEnum runDirection)
{
    throw new UnsupportedOperationException();
}
项目:jasperreports    文件:JRFillTextElement.java   
/**
 *
 */
public RunDirectionEnum getRunDirectionValue()
{
    return isLeftToRight ? RunDirectionEnum.LTR : RunDirectionEnum.RTL;
}
项目:jasperreports    文件:JRTemplatePrintText.java   
@Override
public RunDirectionEnum getRunDirectionValue()
{
    return this.runDirectionValue;
}
项目:jasperreports    文件:JRTemplatePrintText.java   
@Override
public void setRunDirection(RunDirectionEnum runDirectionValue)
{
    this.runDirectionValue = runDirectionValue;
}
项目:jasperreports    文件:JRTemplatePrintText.java   
@Override
public void readVirtualized(VirtualizationInput in) throws IOException
{
    super.readVirtualized(in);

    int flags = in.readIntCompressed();
    text = (String) in.readJRObject();

    if ((flags & SERIALIZATION_FLAG_HAS_VALUE) != 0)
    {
        value = in.readJRObject();
    }
    else
    {
        value = text;
    }

    lineSpacingFactor = in.readFloat();
    leadingOffset = in.readFloat();
    textHeight = in.readFloat();

    if ((flags & SERIALIZATION_FLAG_TRUNCATION) != 0)
    {
        textTruncateIndex = (Integer) in.readJRObject();
        textTruncateSuffix = (String) in.readJRObject();
    }

    if ((flags & SERIALIZATION_FLAG_LINE_BREAK_OFFSETS) != 0)
    {
        if ((flags & SERIALIZATION_FLAG_ZERO_LINE_BREAK_OFFSETS) != 0)
        {
            lineBreakOffsets = JRPrintText.ZERO_LINE_BREAK_OFFSETS;
        }
        else
        {
            int offsetCount = in.readIntCompressed();
            lineBreakOffsets = new short[offsetCount];
            for (int i = 0; i < offsetCount; i++)
            {
                lineBreakOffsets[i] = (short) in.readIntCompressed();
            }
        }
    }

    if ((flags & SERIALIZATION_FLAG_ANCHOR) != 0)
    {
        anchorName = (String) in.readJRObject();
        bookmarkLevel = in.readIntCompressed();
    }
    else
    {
        bookmarkLevel = JRAnchor.NO_BOOKMARK;
    }

    if ((flags & SERIALIZATION_FLAG_HYPERLINK_OMITTED) != 0)
    {
        hyperlinkOmitted = true;
    }

    if ((flags & SERIALIZATION_FLAG_HYPERLINK) != 0)
    {
        hyperlinkReference = (String) in.readJRObject();
        hyperlinkAnchor = (String) in.readJRObject();
        hyperlinkPage = (Integer) in.readJRObject();
        hyperlinkTooltip = (String) in.readJRObject();
        hyperlinkParameters = (JRPrintHyperlinkParameters) in.readJRObject();
    }

    runDirectionValue = (flags & SERIALIZATION_FLAG_RTL) != 0 ? RunDirectionEnum.RTL : RunDirectionEnum.LTR;

    PSEUDO_SERIAL_VERSION_UID = JRConstants.PSEUDO_SERIAL_VERSION_UID;
}
项目:jasperreports    文件:JRBaseCrosstab.java   
@Override
public RunDirectionEnum getRunDirectionValue()
{
    return this.runDirectionValue;
}
项目:jasperreports    文件:JRCrosstabFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2);

    JRDesignCrosstab crosstab = new JRDesignCrosstab(jasperDesign);

    String columnBreakOffsetAttr = atts.getValue(ATTRIBUTE_columnBreakOffset);
    if (columnBreakOffsetAttr != null && columnBreakOffsetAttr.length() > 0)
    {
        crosstab.setColumnBreakOffset(Integer.parseInt(columnBreakOffsetAttr));
    }

    String repeatColHeadersAttr = atts.getValue(ATTRIBUTE_isRepeatColumnHeaders);
    if (repeatColHeadersAttr != null && repeatColHeadersAttr.length() > 0)
    {
        crosstab.setRepeatColumnHeaders(Boolean.valueOf(repeatColHeadersAttr).booleanValue());
    }

    String repeatRowHeadersAttr = atts.getValue(ATTRIBUTE_isRepeatRowHeaders);
    if (repeatRowHeadersAttr != null && repeatColHeadersAttr.length() > 0)
    {
        crosstab.setRepeatRowHeaders(Boolean.valueOf(repeatRowHeadersAttr).booleanValue());
    }

    String runDirectionAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_runDirection);
    if (runDirectionAttr != null)
    {
        RunDirectionEnum runDir = RunDirectionEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_runDirection));
        if (runDir != null)
        {
            crosstab.setRunDirection(runDir);
        }
    }

    String ignoreWidthAttr = atts.getValue(ATTRIBUTE_ignoreWidth);
    if (ignoreWidthAttr != null)
    {
        crosstab.setIgnoreWidth(Boolean.valueOf(ignoreWidthAttr));
    }

    return crosstab;
}
项目:jasperreports    文件:JRDesignCrosstab.java   
@Override
public RunDirectionEnum getRunDirectionValue()
{
    return this.runDirectionValue;
}
项目:jasperreports    文件:AbstractXlsReportConfiguration.java   
@Override
public RunDirectionEnum getSheetDirection()
{
    return sheetDirection;
}
项目:jasperreports    文件:AbstractXlsReportConfiguration.java   
/**
 * 
 */
public void setSheetDirection(RunDirectionEnum sheetDirection)
{
    this.sheetDirection = sheetDirection;
}
项目:jasperreports    文件:TableReport.java   
@Override
public RunDirectionEnum getColumnDirection()
{
    return RunDirectionEnum.LTR;
}