本文整理汇总了Java中net.sf.jasperreports.engine.util.JRStyledText类的典型用法代码示例。如果您正苦于以下问题:Java JRStyledText类的具体用法?Java JRStyledText怎么用?Java JRStyledText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JRStyledText类属于net.sf.jasperreports.engine.util包,在下文中一共展示了JRStyledText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFullStyledText
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
@Override
public JRStyledText getFullStyledText(JRStyledTextAttributeSelector attributeSelector)
{
if (getFullText() == null)
{
return null;
}
return
JRStyledTextParser.getInstance().getStyledText(
attributeSelector.getStyledTextAttributes(this),
getFullText(),
!JRCommonText.MARKUP_NONE.equals(getMarkup()),
JRStyledTextAttributeSelector.getTextLocale(this)
);
}
示例2: getRichTextString
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale)
{
String text = styledText.getText();
HSSFRichTextString richTextStr = new HSSFRichTextString(text);
int runLimit = 0;
AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();
while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
{
Map<Attribute,Object> attributes = iterator.getAttributes();
JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes);
short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null ?
getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex() :
forecolor;
HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale);
richTextStr.applyFont(iterator.getIndex(), runLimit, font);
iterator.setIndex(runLimit);
}
return richTextStr;
}
示例3: exportStyledText
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
protected void exportStyledText(JRStyledText styledText, Locale locale, boolean startedHyperlink, boolean isIgnoreTextFormatting)
{
String text = styledText.getText();
int runLimit = 0;
AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();
while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
{
exportStyledTextRun(
iterator.getAttributes(),
text.substring(iterator.getIndex(), runLimit),
locale,
startedHyperlink,
isIgnoreTextFormatting
);
iterator.setIndex(runLimit);
}
}
示例4: getTextRenderer
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected AbstractPdfTextRenderer getTextRenderer(JRPrintText text, JRStyledText styledText)
{
AbstractPdfTextRenderer textRenderer;
if (toUseGlyphRenderer(text)
&& PdfGlyphRenderer.supported()
&& canUseGlyphRendering(text, styledText))
{
textRenderer = new PdfGlyphRenderer(jasperReportsContext, awtIgnoreMissingFont,
glyphRendererAddActualText && !tagHelper.isTagged);
}
else if (text.getLeadingOffset() == 0)
{
textRenderer = new PdfTextRenderer(jasperReportsContext, awtIgnoreMissingFont);
}
else
{
textRenderer = new SimplePdfTextRenderer(jasperReportsContext, awtIgnoreMissingFont);//FIXMETAB optimize this
}
return textRenderer;
}
示例5: getRichTextString
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale) {
String text = styledText.getText();
HSSFRichTextString richTextStr = new HSSFRichTextString(text);
int runLimit = 0;
AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();
while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) {
Map<Attribute,Object> attributes = iterator.getAttributes();
JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes);
short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null
? getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex()
: forecolor;
HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale);
richTextStr.applyFont(iterator.getIndex(), runLimit, font);
iterator.setIndex(runLimit);
}
return richTextStr;
}
示例6: getStyledText
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
@Override
protected JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor)
{
JRStyledText styledText = styledTextUtil.getProcessedStyledText(textElement,
setBackcolor ? allSelector : noBackcolorSelector, getExporterKey());
if (styledText != null)
{
short[] lineBreakOffsets = textElement.getLineBreakOffsets();
if (lineBreakOffsets != null && lineBreakOffsets.length > 0)
{
//insert new lines at the line break positions saved at fill time
//cloning the text first
//FIXME do we need this? styled text instances are no longer shared
styledText = styledText.cloneText();
styledText.insert("\n", lineBreakOffsets);
}
}
return styledText;
}
示例7: DrawVisitor
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
public DrawVisitor(ReportConverter reportConverter, Graphics2D grx)
{
this.convertVisitor = new ConvertVisitor(reportConverter);
JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext();
JRReport report = reportConverter.getReport();
JRPropertiesUtil propUtil = JRPropertiesUtil.getInstance(jasperReportsContext);
this.drawVisitor =
new PrintDrawVisitor(
jasperReportsContext,
new RenderersCache(jasperReportsContext),
propUtil.getBooleanProperty(report, Graphics2DReportConfiguration.MINIMIZE_PRINTER_JOB_SIZE, true),
propUtil.getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false)
);
setGraphics2D(grx);
this.drawVisitor.setClip(true);
}
示例8: exportStyledText
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale)
{
String text = styledText.getText();
int runLimit = 0;
AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();
while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
{
runHelper.export(
style,
iterator.getAttributes(),
text.substring(iterator.getIndex(), runLimit),
locale,
invalidCharReplacement
);
iterator.setIndex(runLimit);
}
}
示例9: exportStyledText
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale, boolean isStyledText)
{
String text = styledText.getText();
int runLimit = 0;
AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator();
while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length())
{
runHelper.export(
style, iterator.getAttributes(),
text.substring(iterator.getIndex(), runLimit),
locale,
invalidCharReplacement,
isStyledText
);
iterator.setIndex(runLimit);
}
}
示例10: getStyledText
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
protected JRStyledText getStyledText()
{
if (styledText == null)
{
String text = getRawText();
if (text != null)
{
styledText =
filler.getStyledTextParser().getStyledText(
getStyledTextAttributes(),
text,
!JRCommonText.MARKUP_NONE.equals(getMarkup()),
filler.getLocale()
);
}
processedStyledText = null;
}
return styledText;
}
示例11: addContentField
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected void addContentField(int pageNo, JRPrintText element) throws IOException {
String allText;
JRStyledText styledText = getStyledText(element);
if (styledText == null) {
allText = "";
} else {
allText = styledText.getText();
}
if (allText != null && allText.length() > 0) {
Field tf = new Field(CONTENT_FIELD, allText, fieldType);
Document doc = new Document();
doc.add(new IntField("pageNo", pageNo, Field.Store.YES));
PrintElementId peid = PrintElementId.forElement(element);
doc.add(new StringField("uid", peid.toString(), Field.Store.YES));
displayTokens(allText, peid.toString());
doc.add(tf);
writer.addDocument(doc);
}
}
示例12: getTextValue
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
@Override
public String getTextValue(JRCsvExporterContext exporterContext, JRGenericPrintElement element)
{
JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT);
if (labelPrintText == null)
{
return null;
}
String text = null;
JRStyledText styledText = ((JRCsvExporter)exporterContext.getExporterRef()).getStyledText(labelPrintText);
if (styledText == null)
{
text = "";
}
else
{
text = styledText.getText();
}
return text;
}
示例13: JSSDrawVisitor
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
public JSSDrawVisitor(ReportConverter reportConverter, Graphics2D grx) {
this.reportConverter = reportConverter;
this.convertVisitor = new JSSConvertVisitor(reportConverter);
final JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext();
this.drawVisitor = new PrintDrawVisitor(jasperReportsContext) {
@Override
public void setTextRenderer(JRReport report) {
AwtTextRenderer textRenderer = new AwtTextRenderer(jasperReportsContext, JRPropertiesUtil.getInstance(
jasperReportsContext).getBooleanProperty(report, JRGraphics2DExporter.MINIMIZE_PRINTER_JOB_SIZE, true),
JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(report,
JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false));
setTextDrawer(new TextDrawer(jasperReportsContext, textRenderer));
setFrameDrawer(new FrameDrawer(jasperReportsContext, null, textRenderer));
}
};
setTextRenderer(reportConverter.getReport());
this.grx = grx;
setGraphics2D(grx);
this.drawVisitor.setClip(true);
}
示例14: getPhrase
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
/**
*
*/
protected Phrase getPhrase(JRStyledText styledText, JRPrintText textElement)
{
String text = styledText.getText();
AttributedString as = styledText.getAttributedString();
return pdfExporter.getPhrase(as, text, textElement);
}
示例15: setRichTextStringCellValue
import net.sf.jasperreports.engine.util.JRStyledText; //导入依赖的package包/类
protected final void setRichTextStringCellValue(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale)
{
if(styledText != null)
{
cell.setCellValue(getRichTextString(styledText, forecolor, defaultFont, locale));
}
}