Examples of JRBasePrintText


Examples of net.sf.jasperreports.engine.base.JRBasePrintText

  /**
   *
   */
  public JRPrintElement convert(ReportConverter reportConverter, JRElement element)
  {
    JRBasePrintText printText = new JRBasePrintText(reportConverter.getDefaultStyleProvider());
    JRTextField textField = (JRTextField)element;
   
    copyTextElement(reportConverter, textField, printText);
   
    printText.setMarkup(JRCommonText.MARKUP_NONE);//text fields are never converted to styled print text elements
    printText.setAnchorName(JRExpressionUtil.getExpressionText(textField.getAnchorNameExpression()));
    printText.setBookmarkLevel(textField.getBookmarkLevel());
    printText.setLinkType(textField.getLinkType());
    printText.setPattern(textField.getOwnPattern());
   
    printText.setText(JRExpressionUtil.getExpressionText(textField.getExpression()));
   
    measureTextElement(printText);

    return printText;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

   */
  public Object createObject(Attributes atts)
  {
    JasperPrint jasperPrint = (JasperPrint)digester.peek(digester.getCount() - 2);

    JRBasePrintText text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());

    HorizontalAlignEnum horizontalAlignment = HorizontalAlignEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_textAlignment));
    if (horizontalAlignment != null)
    {
      text.setHorizontalAlignment(horizontalAlignment);
    }

    VerticalAlignEnum verticalAlignment = VerticalAlignEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_verticalAlignment));
    if (verticalAlignment != null)
    {
      text.setVerticalAlignment(verticalAlignment);
    }

    RotationEnum rotation = RotationEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_rotation));
    if (rotation != null)
    {
      text.setRotation(rotation);
    }

    RunDirectionEnum runDirection = RunDirectionEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_runDirection));
    if (runDirection != null)
    {
      text.setRunDirection(runDirection);
    }

    String textHeight = atts.getValue(JRXmlConstants.ATTRIBUTE_textHeight);
    if (textHeight != null && textHeight.length() > 0)
    {
      text.setTextHeight(Float.parseFloat(textHeight));
    }

    LineSpacingEnum lineSpacing = LineSpacingEnum.getByName(atts.getValue(JRXmlConstants.ATTRIBUTE_lineSpacing));
    if (lineSpacing != null)
    {
      if (log.isWarnEnabled())
      {
        log.warn("The 'lineSpacing' attribute is deprecated. Use the <paragraph> tag instead.");
      }
      text.getParagraph().setLineSpacing(lineSpacing);
    }

    text.setMarkup(atts.getValue(JRXmlConstants.ATTRIBUTE_markup));

    String isStyledText = atts.getValue(JRXmlConstants.ATTRIBUTE_isStyledText);
    if (isStyledText != null && isStyledText.length() > 0)
    {
      if (log.isWarnEnabled())
      {
        log.warn("The 'isStyledText' attribute is deprecated. Use the 'markup' attribute instead.");
      }
       
      text.setMarkup(Boolean.valueOf(isStyledText) ? JRCommonText.MARKUP_STYLED_TEXT : JRCommonText.MARKUP_NONE);
    }

//    String lineSpacingFactor = atts.getValue(JRXmlConstants.ATTRIBUTE_lineSpacingFactor);
//    if (lineSpacingFactor != null && lineSpacingFactor.length() > 0)
//    {
//      text.setLineSpacingFactor(Float.parseFloat(lineSpacingFactor));
//    }

//    String leadingOffset = atts.getValue(JRXmlConstants.ATTRIBUTE_leadingOffset);
//    if (leadingOffset != null && leadingOffset.length() > 0)
//    {
//      text.setLeadingOffset(Float.parseFloat(leadingOffset));
//    }

    text.setLinkType(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkType));
    text.setLinkTarget(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTarget));
    text.setAnchorName(atts.getValue(JRXmlConstants.ATTRIBUTE_anchorName));
    text.setHyperlinkReference(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkReference));
    text.setHyperlinkAnchor(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkAnchor));
   
    String hyperlinkPage = atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkPage);
    if (hyperlinkPage != null)
    {
      text.setHyperlinkPage(Integer.valueOf(hyperlinkPage));
    }
   
    text.setHyperlinkTooltip(atts.getValue(JRXmlConstants.ATTRIBUTE_hyperlinkTooltip));

    String bookmarkLevelAttr = atts.getValue(JRXmlConstants.ATTRIBUTE_bookmarkLevel);
    if (bookmarkLevelAttr != null)
    {
      text.setBookmarkLevel(Integer.parseInt(bookmarkLevelAttr));
    }
   
    String valueClass = atts.getValue(JRXmlConstants.ATTRIBUTE_valueClass);
    if (valueClass != null)
    {
      text.setValueClassName(valueClass);
    }
   
    String pattern = atts.getValue(JRXmlConstants.ATTRIBUTE_pattern);
    if (pattern != null)
    {
      text.setPattern(pattern);
    }
   
    String formatFactoryClass = atts.getValue(JRXmlConstants.ATTRIBUTE_formatFactoryClass);
    if (formatFactoryClass != null)
    {
      text.setFormatFactoryClass(formatFactoryClass);
    }
   
    String locale = atts.getValue(JRXmlConstants.ATTRIBUTE_locale);
    if (locale != null)
    {
      text.setLocaleCode(locale);
    }
   
    String timezone = atts.getValue(JRXmlConstants.ATTRIBUTE_timezone);
    if (timezone != null)
    {
      text.setTimeZoneId(timezone);
    }
   
    return text;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

    for(reportIndex = 0; reportIndex < jasperPrintList.size(); reportIndex++)
    {
      setJasperPrint((JasperPrint)jasperPrintList.get(reportIndex));
     
      defaultFont = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
     
      setSheetNames();

      if(
        getParameter(JRXlsAbstractExporterParameter.SHEET_NAMES) == null
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

      appendSizeStyle(text, text, styleBuffer);
      appendBorderStyle(text.getLineBox(), styleBuffer);
    }
    else
    {
      JRBasePrintText rotatedText = new JRBasePrintText(text.getDefaultStyleProvider());
      rotatedText.setX(text.getX());
      rotatedText.setY(text.getY());
      rotatedText.setWidth(text.getWidth());
      rotatedText.setHeight(text.getHeight());
      rotatedText.copyBox(text.getLineBox());
     
      JRBoxUtil.rotate(rotatedText.getLineBox(), text.getRotationValue());
     
      int rotationIE = 0;
      int rotationAngle = 0;
      int translateX = 0;
      int translateY = 0;
      switch (text.getRotationValue())
      {
        case LEFT :
        {
          translateX = - (text.getHeight() - text.getWidth()) / 2;
          translateY = (text.getHeight() - text.getWidth()) / 2;
          rotatedText.setWidth(text.getHeight());
          rotatedText.setHeight(text.getWidth());
          rotationIE = 3;
          rotationAngle = -90;
          break;
        }
        case RIGHT :
        {
          translateX = - (text.getHeight() - text.getWidth()) / 2;
          translateY = (text.getHeight() - text.getWidth()) / 2;
          rotatedText.setWidth(text.getHeight());
          rotatedText.setHeight(text.getWidth());
          rotationIE = 1;
          rotationAngle = 90;
          break;
        }
        case UPSIDE_DOWN :
        {
          rotationIE = 2;
          rotationAngle = 180;
          break;
        }
        case NONE :
        default :
        {
        }
      }
     
      appendPositionStyle(rotatedText, styleBuffer);
      appendSizeStyle(rotatedText, rotatedText, styleBuffer);
      appendBorderStyle(rotatedText.getLineBox(), styleBuffer);

      styleBuffer.append("-webkit-transform: translate(" + translateX + "px," + translateY + "px) ");
      styleBuffer.append("rotate(" + rotationAngle + "deg); ");
      styleBuffer.append("-moz-transform: translate(" + translateX + "px," + translateY + "px) ");
      styleBuffer.append("rotate(" + rotationAngle + "deg); ");
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

  /**
   *
   */
  public void exportProps(JRStyle style, Locale locale)
  {
    JRPrintText text = new JRBasePrintText(null);
    text.setStyle(style);
    Map styledTextAttributes = new HashMap();
    JRFontUtil.getAttributesWithoutAwtFont(styledTextAttributes, text);
    styledTextAttributes.put(TextAttribute.FOREGROUND, text.getForecolor());
    if (style.getModeValue() == null || style.getModeValue() == ModeEnum.OPAQUE)
    {
      styledTextAttributes.put(TextAttribute.BACKGROUND, style.getBackcolor());
    }

View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

  /**
   *
   */
  private Map getAttributes(JRStyle style)//FIXMEDOCX put this in util?
  {
    JRPrintText text = new JRBasePrintText(null);
    text.setStyle(style);
   
    Map styledTextAttributes = new HashMap();
    //JRFontUtil.getAttributes(styledTextAttributes, text, (Locale)null);//FIXMEDOCX getLocale());
    JRFontUtil.getAttributesWithoutAwtFont(styledTextAttributes, text);
    styledTextAttributes.put(TextAttribute.FOREGROUND, text.getForecolor());
    if (text.getModeValue() == ModeEnum.OPAQUE)
    {
      styledTextAttributes.put(TextAttribute.BACKGROUND, text.getBackcolor());
    }

    return styledTextAttributes;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

  /**
   *
   */
  public void exportProps(JRStyle style, Locale locale)
  {
    JRPrintText text = new JRBasePrintText(null);
    text.setStyle(style);
    Map styledTextAttributes = new HashMap(); //FIXMEPPTX is this map useless; check all run helpers
    JRFontUtil.getAttributesWithoutAwtFont(styledTextAttributes, text);
    styledTextAttributes.put(TextAttribute.FOREGROUND, text.getForecolor());
    if (style.getModeValue() == null || style.getModeValue() == ModeEnum.OPAQUE)
    {
      styledTextAttributes.put(TextAttribute.BACKGROUND, style.getBackcolor());
    }

View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

  /**
   *
   */
  private Map getAttributes(JRStyle style)//FIXMEDOCX put this in util?
  {
    JRPrintText text = new JRBasePrintText(null);
    text.setStyle(style);
   
    Map styledTextAttributes = new HashMap();
    //JRFontUtil.getAttributes(styledTextAttributes, text, (Locale)null);//FIXMEDOCX getLocale());
    JRFontUtil.getAttributesWithoutAwtFont(styledTextAttributes, text);
    styledTextAttributes.put(TextAttribute.FOREGROUND, text.getForecolor());
    if (text.getModeValue() == ModeEnum.OPAQUE)
    {
      styledTextAttributes.put(TextAttribute.BACKGROUND, text.getBackcolor());
    }

    return styledTextAttributes;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

  public JRPrintText getTextElementReplacement(
    JRExporterContext exporterContext,
    JRGenericPrintElement element
    )
  {
    JRBasePrintText text = new JRBasePrintText(exporterContext.getExportedReport().getDefaultStyleProvider());
    text.setX(element.getX());
    text.setY(element.getY());
    text.setWidth(element.getWidth());
    text.setHeight(element.getHeight());
    text.setText("[Open Flash Chart Component]");
    text.setMode(ModeEnum.OPAQUE);
    text.setBackcolor(Color.lightGray);
    text.setHorizontalAlignment(HorizontalAlignEnum.CENTER);
    text.setVerticalAlignment(VerticalAlignEnum.MIDDLE);
    text.getLineBox().getPen().setLineWidth(1f);
    text.getLineBox().getPen().setLineColor(Color.black);
    text.getLineBox().getPen().setLineStyle(LineStyleEnum.DASHED);
   
    TextElementConverter.measureTextElement(text);
   
    return text;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.base.JRBasePrintText

    writer.write(" <office:styles>\n")
    writer.write("<draw:stroke-dash draw:name=\"Dashed\" draw:display-name=\"Dashed\" " +
      "draw:style=\"rect\" draw:dots1=\"1\" draw:dots1-length=\"0.05cm\" draw:dots2=\"1\" " +
      "draw:dots2-length=\"0.05cm\" draw:distance=\"0.05cm\"/>");
    writer.write(" <style:default-style style:family=\"paragraph\"><style:paragraph-properties style:tab-stop-distance=\"" +
        LengthUtil.inch(new JRBasePrintText(jasperPrint.getDefaultStyleProvider()).getParagraph().getTabStopWidth()) +
        "in\"/></style:default-style>\n")
    writer.write(" </office:styles>\n")
    writer.write(" <office:automatic-styles>\n")
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.