Java 类net.sf.jasperreports.engine.util.JRStyledTextParser 实例源码

项目:jasperreports    文件:JRBasePrintText.java   
@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)
            );
}
项目:jasperreports    文件:JRTemplatePrintText.java   
@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)
            );
}
项目:jasperreports    文件:JRAbstractExporter.java   
/**
 *
 */
protected void initReport()
{
    JRStyledTextParser.setLocale(getLocale());

    setOffset();

    filter = getCurrentItemConfiguration().getExporterFilter();
    if (filter == null)
    {
        filter = createFilter();
    }
}
项目:jasperreports    文件:JRStyledTextAttributeSelector.java   
/**
 * 
 */
private static Locale getLocale()
{
    return JRStyledTextParser.getLocale();
}
项目:jasperreports    文件:JRBaseFiller.java   
/**
 *
 */
public JRStyledTextParser getStyledTextParser()
{
    return styledTextParser;
}
项目:ireport-fork    文件:DefaultTableCellElementsLayout.java   
public void animatorFinished(AnimatorEvent arg0) {
    animations--;
    if (animations == 0)
    {
        for (Iterator iter = getNewSizes().keySet().iterator(); iter.hasNext(); )
        {
            JRDesignElement element = (JRDesignElement)iter.next();
            Rectangle rectangle = getNewSizes().get(element);
            element.setX( rectangle.x);
            element.setY( rectangle.y);
            element.setWidth( rectangle.width);
            element.setHeight( rectangle.height);

            // Calculate the best font height...
            if (element instanceof JRDesignTextElement)
            {
                JRStyledTextParser styledTextParser = JRStyledTextParser.getInstance();
                JRDesignTextElement dte = (JRDesignTextElement)element;
                dte.setFontSize(null);
                for (int i=dte.getFontSize()-1; i>1 ; --i)
                {
                        String text = "test";

                        // Convert the element in a print element...
                        Map attributes = JRFontUtil.getAttributes(new HashMap(), dte, Locale.getDefault());

                        JRStyledText styledText =
                            styledTextParser.getStyledText(
                            attributes,
                            text,
                            JRCommonText.MARKUP_STYLED_TEXT.equals(dte.getMarkup()),//FIXMEMARKUP only static styled text appears on preview. no other markup
                            Locale.getDefault()
                            );


                        JRTextMeasurer measurer = JRTextMeasurerUtil.getInstance(DefaultJasperReportsContext.getInstance()).createTextMeasurer(dte);
                        JRMeasuredText measuredText = measurer.measure(  styledText, 0, dte.getHeight(), true);

                        if  (measuredText.getTextHeight() > dte.getHeight())
                        {
                            if (i>1)
                            {
                                dte.setFontSize(i);
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            break;
                        }
                }
            }
        }
    }
}
项目:ireport-fork    文件:DefaultCellElementsLayout.java   
public void animatorFinished(AnimatorEvent arg0) {
        animations--;
        if (animations == 0)
        {
            for (Iterator iter = getNewSizes().keySet().iterator(); iter.hasNext(); )
            {
                JRDesignElement element = (JRDesignElement)iter.next();
                Rectangle rectangle = getNewSizes().get(element);
                element.setX( rectangle.x);
                element.setY( rectangle.y);
                element.setWidth( rectangle.width);
                element.setHeight( rectangle.height);

                // Calculate the best font height...
                if (element instanceof JRDesignTextElement)
                {
                    JRStyledTextParser styledTextParser = JRStyledTextParser.getInstance();
                    JRDesignTextElement dte = (JRDesignTextElement)element;
                    dte.setFontSize(null);
                    for (int i=dte.getFontSize()-1; i>1 ; --i)
                    {
                            String text = "test";

                            // Convert the element in a print element...
                            Map<Attribute, Object> attributes = JRFontUtil.getAttributes(new HashMap(), dte, Locale.getDefault());

                            JRStyledText styledText = 
                                styledTextParser.getStyledText(
                                attributes, 
                                text, 
                                JRCommonText.MARKUP_STYLED_TEXT.equals(dte.getMarkup()),//FIXMEMARKUP only static styled text appears on preview. no other markup
                                Locale.getDefault()
);

                            JasperReportsContext context = IRLocalJasperReportsContext.getInstance();

                            JRTextMeasurerUtil measurerUtil = JRTextMeasurerUtil.getInstance(context);
                            JRTextMeasurer measurer = measurerUtil.createTextMeasurer(dte);
                            JRMeasuredText measuredText = measurer.measure(  styledText, 0, dte.getHeight(), true);

                            if  (measuredText.getTextHeight() > dte.getHeight())
                            {
                                if (i>1)
                                {
                                    dte.setFontSize(i);
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                    }
                }
            }
        }
    }