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

项目:jasperreports    文件:JRXmlWriter.java   
@SuppressWarnings("deprecation")
private void writeStretchType(StretchTypeEnum stretchType)
{
    if (isOlderVersionThan(JRConstants.VERSION_6_2_2))
    {
        switch (stretchType)
        {
            case CONTAINER_HEIGHT :
            case CONTAINER_BOTTOM :
            {
                stretchType = StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT;
                break;
            }
            case ELEMENT_GROUP_HEIGHT :
            case ELEMENT_GROUP_BOTTOM :
            {
                stretchType = StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT;
                break;
            }
        }
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_stretchType, stretchType, StretchTypeEnum.NO_STRETCH);
}
项目:jasperreports    文件:JRFillContext.java   
/**
 * Constructs a fill context.
 */
public JRFillContext(BaseReportFiller masterFiller)
{
    this.masterFiller = masterFiller;
    this.jasperReportsContext = masterFiller.getJasperReportsContext();
    this.styledTextUtil = JRStyledTextUtil.getInstance(jasperReportsContext);

    loadedImageRenderers = new HashMap<Object,Renderable>();
    renderersCache = new RenderersCache(jasperReportsContext);
    loadedSubreports = new HashMap<Object,JasperReport>();
    loadedTemplates = new HashMap<Object,JRTemplate>();
    deduplicableRegistry = new DeduplicableRegistry();

    FontUtil.getInstance(jasperReportsContext).resetThreadMissingFontsCache();

    legacyElementStretchEnabled = 
        JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(
            StretchTypeEnum.PROPERTY_LEGACY_ELEMENT_STRETCH_ENABLED
            );

    legacyBandEvaluationEnabled = 
        JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(
            JRCalculator.PROPERTY_LEGACY_BAND_EVALUATION_ENABLED
            );
}
项目:PDFReporter-Studio    文件:PreviewGenerator.java   
/**
 * Create a very minimal jasperdesign where the static text is placed. It is cached
 * since we don't need to create it everytime
 */
private static void createDesign()
 {
      jasperDesign = new JasperDesign();
      JRDesignBand jrBand = new JRDesignBand();
         jasperDesign.setTitle(jrBand);
      textElement = new JRDesignStaticText();
      jasperDesign.setLeftMargin(0);
      jasperDesign.setRightMargin(0);
      jasperDesign.setTopMargin(0);
      jasperDesign.setBottomMargin(0);
      jrBand.addElement(textElement);
      jrBand.setSplitType(SplitTypeEnum.STRETCH);
      textElement.setStretchType(StretchTypeEnum.NO_STRETCH);
      textElement.setPrintRepeatedValues(false);
      textElement.setPrintWhenDetailOverflows(true);
  }
项目:dynamicreports-jasper    文件:Component3Test.java   
@Override
public void test() {
    super.test();

    numberOfPagesTest(1);

    JRElement textField = getJasperReport().getTitle().getElementByKey("title.textField1");
    Assert.assertEquals("position type", PositionTypeEnum.FIX_RELATIVE_TO_TOP, textField.getPositionTypeValue());
    Assert.assertEquals("stretch type", StretchTypeEnum.NO_STRETCH, textField.getStretchTypeValue());
    Assert.assertTrue("print in first whole band", textField.isPrintInFirstWholeBand());
    Assert.assertTrue("print when detail overflows", textField.isPrintWhenDetailOverflows());
    Assert.assertEquals("print when group changes", "group1", textField.getPrintWhenGroupChanges().getName());

    textField = getJasperReport().getDetailSection().getBands()[0].getElementByKey("detail.column_column11");
    Assert.assertTrue("print when detail overflows", textField.isPrintWhenDetailOverflows());
}
项目:openbravo-brazil    文件:ReportDesignBO.java   
private void addFieldValue(GridColumnVO columnVO) throws JRException {
  JRDesignBand bDetalle = (JRDesignBand) jasperDesign.getDetailSection().getBands()[0];

  JRDesignField f = new JRDesignField();
  f.setName(columnVO.getDbName());
  f.setValueClass(columnVO.getFieldClass());
  jasperDesign.addField(f);

  JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
  chunk.setText(columnVO.getDbName());
  chunk.setType(JRDesignExpressionChunk.TYPE_FIELD);
  JRDesignExpression expression = new JRDesignExpression();
  expression.addChunk(chunk);
  JRDesignTextField textField = new JRDesignTextField();
  textField.setWidth(columnVO.getWidth());
  textField.setHeight(bDetalle.getHeight());
  textField.setX(px);
  textField.setExpression(expression);
  textField.setBlankWhenNull(true);
  textField.setFontName(gridReportVO.getDetailBandStyle().getFontName());
  textField.setFontSize(new Float(gridReportVO.getDetailBandStyle().getFontSize()));
  textField.setForecolor(gridReportVO.getDetailBandStyle().getForeColor());
  textField.setBold(gridReportVO.getDetailBandStyle().isBold());
  textField.setItalic(gridReportVO.getDetailBandStyle().isItalic());
  textField.setUnderline(gridReportVO.getDetailBandStyle().isUnderline());
  textField.setStretchWithOverflow(true);
  textField.setStretchType(StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT);

  bDetalle.addElement(textField);
}
项目:jasperreports    文件:JRBaseElement.java   
@Override
public void setStretchType(StretchTypeEnum stretchTypeValue)
{
    StretchTypeEnum old = this.stretchTypeValue;
    this.stretchTypeValue = stretchTypeValue;
    getEventSupport().firePropertyChange(PROPERTY_STRETCH_TYPE, old, this.stretchTypeValue);
}
项目:jasperreports    文件:JRBaseElement.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)
    {
        modeValue = ModeEnum.getByValue(mode);
        positionTypeValue = PositionTypeEnum.getByValue(positionType);
        stretchTypeValue = StretchTypeEnum.getByValue(stretchType);

        mode = null;
    }
}
项目:jasperreports    文件:JRGraphicElementFactory.java   
@Override
public Object createObject(Attributes atts)
{
    JRDesignGraphicElement graphicElement = (JRDesignGraphicElement)digester.peek();

    StretchTypeEnum stretchType = StretchTypeEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_stretchType));
    if (stretchType != null)
    {
        if (log.isWarnEnabled())
        {
            log.warn("The 'stretchType' attribute in <graphicElement> tag is deprecated. Use the same attribut in <reportElement> tag instead.");
        }

        graphicElement.setStretchType(stretchType);
    }

    PenEnum pen = PenEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_pen));
    if (pen != null)
    {
        if (log.isWarnEnabled())
        {
            log.warn("The 'pen' attribute is deprecated. Use the <pen> tag instead.");
        }

        JRPenUtil.setLinePenFromPen(pen, graphicElement.getLinePen());
    }

    FillEnum fill = FillEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_fill));
    if (fill != null)
    {
        graphicElement.setFill(fill);
    }

    return graphicElement;
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 *
 */
private void writeReportElement( JRElement element, String elementName)
{
    if(element != null)
    {
        write( elementName + ".setKey(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(element.getKey()));
        writeStyleReferenceAttr( element, elementName);
        write( elementName + ".setPositionType({0});\n", element.getPositionTypeValue());
        write( elementName + ".setStretchType({0});\n", element.getStretchTypeValue(), StretchTypeEnum.NO_STRETCH);
        write( elementName + ".setPrintRepeatedValues({0});\n", element.isPrintRepeatedValues(),true);
        write( elementName + ".setMode({0});\n", element.getOwnModeValue());
        write( elementName + ".setX({0, number, #});\n", element.getX());
        write( elementName + ".setY({0, number, #});\n", element.getY());
        write( elementName + ".setWidth({0, number, #});\n", element.getWidth());
        write( elementName + ".setHeight({0, number, #});\n", element.getHeight());
        write( elementName + ".setRemoveLineWhenBlank({0});\n", element.isRemoveLineWhenBlank(), false);
        write( elementName + ".setPrintInFirstWholeBand({0});\n", element.isPrintInFirstWholeBand(), false);
        write( elementName + ".setPrintWhenDetailOverflows({0});\n", element.isPrintWhenDetailOverflows(), false);

        if (element.getPrintWhenGroupChanges() != null)
        {
            String groupName = getGroupName( element.getPrintWhenGroupChanges());
            write( elementName + ".setPrintWhenGroupChanges(" + groupName + ");\n");
        }

        write( elementName + ".setForecolor({0});\n", element.getOwnForecolor());
        write( elementName + ".setBackcolor({0});\n", element.getOwnBackcolor());

        writeProperties( element, elementName + ".getPropertiesMap()");
        writePropertyExpressions( element.getPropertyExpressions(), elementName);
        writeExpression( element.getPrintWhenExpression(), elementName, "PrintWhenExpression");
        flush();
    }
}
项目:ireport-fork    文件:StretchTypeProperty.java   
@Override
public List getTagList() 
{
    List tags = new java.util.ArrayList();
    tags.add(new Tag(StretchTypeEnum.NO_STRETCH, I18n.getString("Global.Property.Nostretch")));
    tags.add(new Tag(StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT, I18n.getString("Global.Property.RelativeBandHeight")));
    tags.add(new Tag(StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT, I18n.getString("Global.Property.RBHdetail")));
    return tags;
}
项目:com.opendoorlogistics    文件:ReportBuilderUtils.java   
private static void addAlternativeRowBackground(int width, int height, JRDesignBand band) {
    JRDesignStaticText alt = new JRDesignStaticText();
    alt.setBackcolor(new Color(240, 240, 250));
    alt.setPrintWhenExpression(new JRDesignExpression("new java.lang.Boolean(($V{REPORT_COUNT}.intValue() % 2)==0)"));
    alt.setWidth(width);
    alt.setHeight(height);
    alt.setMode(ModeEnum.OPAQUE);
    alt.setStretchType(StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT);
    band.addElement(alt);
}
项目:jasperreports    文件:JRBaseElement.java   
@Override
public StretchTypeEnum getStretchTypeValue()
{
    return stretchTypeValue;
}
项目:jasperreports    文件:ElementDecorator.java   
@Override
public StretchTypeEnum getStretchTypeValue()
{
    return element.getStretchTypeValue();
}
项目:jasperreports    文件:ElementDecorator.java   
@Override
public void setStretchType(StretchTypeEnum stretchTypeEnum)
{
    throw new UnsupportedOperationException();
}
项目:jasperreports    文件:JRFillElement.java   
@Override
public StretchTypeEnum getStretchTypeValue()
{
    return parent.getStretchTypeValue();
}
项目:jasperreports    文件:JRFillElement.java   
@Override
public void setStretchType(StretchTypeEnum stretchType)
{
    throw new UnsupportedOperationException();
}
项目:ireport-fork    文件:StretchTypeProperty.java   
@SuppressWarnings("unchecked")
public StretchTypeProperty(JRDesignElement element)
{
    super(StretchTypeEnum.class, element);
    this.element = element;
}
项目:ireport-fork    文件:StretchTypeProperty.java   
@Override
public Object getDefaultValue()
{
    return StretchTypeEnum.NO_STRETCH;
}
项目:ireport-fork    文件:StretchTypeProperty.java   
@Override
public void setPropertyValue(Object stretchType)
{
    element.setStretchType((StretchTypeEnum)stretchType);
}
项目:com.opendoorlogistics    文件:ReportBuilderUtils.java   
static int addDetailBand(ODLTableDefinition table, int elementWidth, boolean isHeaderRowForSubreport, JasperDesign ret) {

        // add details
        JRDesignSection detailSection = (JRDesignSection) ret.getDetailSection();
        JRDesignBand band = new JRDesignBand();
        List<Double> colWidths = getColumnWidths(table, elementWidth);

        // decide on the row height.. set differently if have images; assume images are square
        int headerHeight=0;
        int rowHeight = 18;
        if (isHeaderRowForSubreport) {
            headerHeight = 22;
            rowHeight = 24;

            // repeat header for each master report element
            addColumnHeaderToBand(table, elementWidth, band);
        }

        // make row taller if we have an image, based on making the image square
        int nc = table.getColumnCount();
        for (int i = 0; i < nc; i++) {
            if (table.getColumnType(i) == ODLColumnType.IMAGE) {
                rowHeight = Math.max(rowHeight, (int)Math.ceil(colWidths.get(i)));
            }
        }

        // Add alternating row background BEFORE column data (so drawn behind)
        if (!isHeaderRowForSubreport) {
            addAlternativeRowBackground(elementWidth, rowHeight, band);
        }

        // Add column data
        if (nc > 0) {
            double dx=0;
            for (int i = 0; i < nc; i++) {
                int x = (int) Math.round(dx);

                JRDesignElement element;
                if (table.getColumnType(i) == ODLColumnType.IMAGE) {
                    element = createImageField(table, i);

                } else {
                    JRDesignTextField textField = createTextField(table, i);

                    // make bigger if this is the title row for a subreport
                    if (isHeaderRowForSubreport) {
                        textField.setFontSize(16);
                        textField.setBold(true);
                    }

                    element = textField;
                }

                element.setX(x);
                element.setY(headerHeight);
                element.setWidth((int) Math.floor(colWidths.get(i)));
                element.setHeight(rowHeight);

                if (isHeaderRowForSubreport) {
                    //element.setY(0);
                    element.setStretchType(StretchTypeEnum.NO_STRETCH);
                } else {
                    element.setStretchType(StretchTypeEnum.RELATIVE_TO_BAND_HEIGHT);
                }

                band.addElement(element);
                dx += colWidths.get(i);
            }
        }

        band.setHeight(headerHeight + rowHeight);
        detailSection.addBand(band);

        return headerHeight + rowHeight;
    }
项目:jasperreports    文件:JRElement.java   
/**
 * Indicates the stretch type for the element
 * @return a value representing one of the stretch type constants in {@link StretchTypeEnum}
 */
public StretchTypeEnum getStretchTypeValue();
项目:jasperreports    文件:JRElement.java   
/**
 * Specifies how the engine should treat a missing image.
 * @param stretchTypeEnum a value representing one of the stretch type constants in {@link StretchTypeEnum}
 */
public void setStretchType(StretchTypeEnum stretchTypeEnum);