Java 类net.sf.jasperreports.engine.JRRuntimeException 实例源码

项目:jasperreports    文件:TextInputComponentFill.java   
@Override
public JRPrintElement fill()
{
    try
    {
        printText = (JRPrintText)textField.fill();
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }

    printElement.setY(fillContext.getElementPrintY());
    printElement.setHeight(printText.getHeight());

    copy(printElement);

    return printElement;
}
项目:jasperreports    文件:JRValueStringUtils.java   
@Override
public Object deserialize(String data)
{
    if (data.equals("true"))
    {
        return Boolean.TRUE;
    }
    if (data.equals("false"))
    {
        return Boolean.FALSE;
    }
    throw 
        new JRRuntimeException(
            EXCEPTION_MESSAGE_KEY_UNKNOWN_DATA,
            new Object[]{data});
}
项目:jasperreports    文件:JRCsvDataSource.java   
/**
 * Specifies an array of strings representing column names matching field names in the report template
 */
public void setColumnNames(String[] columnNames)
{
    if (processingStarted)
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_CANNOT_MODIFY_PROPERTIES_AFTER_START,
                (Object[])null);
    }
    this.columnNames = new LinkedHashMap<String, Integer>();
    for (int i = 0; i < columnNames.length; i++)
    {
        this.columnNames.put(columnNames[i], Integer.valueOf(i));
    }
}
项目:jasperreports    文件:FillTable.java   
@Override
public FillColumn visitColumn(Column column)
{
    try
    {
        boolean toPrint = toPrintColumn(column, evaluation);
        if (toPrint)
        {
            JRPropertiesMap properties = evaluateProperties(column, evaluation);
            return new FillColumn(column, properties); 
        }
        return null;
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:BarcodeXmlWriter.java   
@Override
public void visitUPCA(UPCAComponent upcA)
{
    try
    {
        startBarcode(upcA);
        writeBaseAttributes(upcA);
        xmlWriteHelper.addAttribute("checksumMode", upcA.getChecksumMode());
        writeBaseContents(upcA);
        endBarcode();
    }
    catch (IOException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:ChartUtil.java   
/**
 * 
 */
public ChartRenderableFactory getChartRenderableFactory(String renderType)
{
    String factoryClass = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(ChartRenderableFactory.PROPERTY_CHART_RENDERER_FACTORY_PREFIX + renderType);
    if (factoryClass == null)
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_RENDERER_FACTORY_NOT_SPECIFIED,
                new Object[]{renderType});
    }

    try
    {
        return CHART_RENDERABLE_FACTORY_CACHE.getCachedInstance(factoryClass);
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JavaScriptCompiledData.java   
public ExpressionIndexes getExpression(int id)
{
    if (id >= expressionIndexes.size())
    {
        throw 
            new JRRuntimeException(
                JavaScriptCompileData.EXCEPTION_MESSAGE_KEY_EXPRESSION_NOT_FOUND,
                new Object[]{id});
    }
    ExpressionIndexes expr = expressionIndexes.get(id);
    if (expr == null)
    {
        throw 
            new JRRuntimeException(
                JavaScriptCompileData.EXCEPTION_MESSAGE_KEY_EXPRESSION_NOT_FOUND,
                new Object[]{id});
    }
    return expr;
}
项目:jasperreports    文件:JRGraphEnvInitializer.java   
/**
 *
 */
public static synchronized void initializeGraphEnv()
{
    if (AVAILABLE_FONT_FACE_NAMES == null)
    {
        AVAILABLE_FONT_FACE_NAMES = new HashSet<String>();

        try
        {
            AVAILABLE_FONT_FACE_NAMES.addAll(
                Arrays.asList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames())
                );
        }
        catch(Exception e)
        {
            throw 
                new JRRuntimeException(
                    EXCEPTION_MESSAGE_KEY_INITIALIZATION_ERROR,
                    (Object[])null,
                    e);
        }
    }
}
项目:jasperreports    文件:SaveAction.java   
@Override
    public void performAction() 
    {
//      JasperDesign jasperDesign = getJasperDesign();
        JasperDesignCache cache = JasperDesignCache.getInstance(getJasperReportsContext(), getReportContext());
        Map<String, JasperDesignReportResource> cachedResources = cache.getCachedResources();
        for (String uri : cachedResources.keySet())
        {
            JasperDesignReportResource resource = cachedResources.get(uri);
            JasperDesign jasperDesign = resource.getJasperDesign();
            if (jasperDesign != null)
            {
                JasperReport jasperReport = resource.getReport();
                String appRealPath = null;//FIXMECONTEXT WebFileRepositoryService.getApplicationRealPath();
                try
                {
                    JRSaver.saveObject(jasperReport, new File(new File(new File(appRealPath), "WEB-INF/repository"), uri));//FIXMEJIVE harcoded
                }
                catch (JRException e)
                {
                    throw new JRRuntimeException(e);
                }
            }
        }
    }
项目:jasperreports    文件:JavaScriptEvaluatorScope.java   
public Object evaluateExpression(Script expression)
{
    ensureContext();

    Object value = expression.exec(context, scope);

    Object javaValue;
    // not converting Number objects because the generic conversion call below
    // always converts to Double
    if (value == null || value instanceof Number)
    {
        javaValue = value;
    }
    else
    {
        try
        {
            javaValue = Context.jsToJava(value, Object.class);
        }
        catch (EvaluatorException e)
        {
            throw new JRRuntimeException(e);
        }
    }
    return javaValue;
}
项目:jasperreports    文件:FontWebResourceHandler.java   
/**
 * 
 */
protected byte[] processFont(JasperReportsContext jasperReportsContext, String basePath, HtmlFontFamily htmlFontFamily)
{
    FontFamilyHtmlResourceHandler resourceHandler = new FontFamilyHtmlResourceHandler(basePath, htmlFontFamily);

    String fontCss = HtmlFontUtil.getInstance(jasperReportsContext).getHtmlFont(resourceHandler, null, htmlFontFamily, true, true);

    try
    {
        return fontCss.getBytes("UTF-8");
    }
    catch (UnsupportedEncodingException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRBaseCrosstabMeasure.java   
@Override
public Class<?> getPercentageCalculatorClass()
{
    if (percentageCalculatorClass == null)
    {
        String className = getPercentageCalculatorClassRealName();
        if (className != null)
        {
            try
            {
                percentageCalculatorClass = JRClassLoader.loadClassForName(className);
            }
            catch (ClassNotFoundException e)
            {
                throw 
                    new JRRuntimeException(
                        EXCEPTION_MESSAGE_KEY_MEASURE_PERCENTAGE_CALCULATOR_CLASS_LOAD_ERROR,
                        (Object[])null,
                        e);
            }
        }
    }

    return percentageCalculatorClass;
}
项目:jasperreports    文件:JRBaseCrosstabBucket.java   
@Override
public Class<?> getValueClass()
{
    if (valueClass == null)
    {
        String className = getValueClassRealName();
        if (className != null)
        {
            try
            {
                valueClass = JRClassLoader.loadClassForName(className);
            }
            catch (ClassNotFoundException e)
            {
                throw 
                    new JRRuntimeException(
                        EXCEPTION_MESSAGE_KEY_BUCKET_LOAD_ERROR,
                        (Object[])null,
                        e);
            }
        }
    }

    return valueClass;
}
项目:jasperreports    文件:SubreportFillPart.java   
protected BaseReportFiller createSubreportFiller(final PartPrintOutput output) throws JRException
{
    SectionTypeEnum sectionType = jasperReport.getSectionType();
    sectionType = sectionType == null ? SectionTypeEnum.BAND : sectionType;

    BaseReportFiller filler;
    switch (sectionType)
    {
    case BAND:
        filler = createBandSubfiller(output);
        break;
    case PART:
        filler = createPartSubfiller(output);
        break;
    default:
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_UNKNOWN_REPORT_SECTION_TYPE,
                new Object[]{sectionType});
    }

    return filler;
}
项目:jasperreports    文件:BaseDataMeasure.java   
@Override
public Class<?> getIncrementerFactoryClass()
{
    if (incrementerFactoryClass == null)
    {
        String className = JRClassLoader.getClassRealName(incrementerFactoryClassName);
        if (className != null)
        {
            try
            {
                incrementerFactoryClass = JRClassLoader.loadClassForName(className);
            }
            catch (ClassNotFoundException e)
            {
                throw 
                    new JRRuntimeException(
                        EXCEPTION_MESSAGE_KEY_MEASURE_INCREMENTER_LOAD_ERROR,
                        (Object[])null,
                        e);
            }
        }
    }

    return incrementerFactoryClass;
}
项目:jasperreports    文件:VirtualizationOutput.java   
protected void putReference(int typeValue, ReferenceType referenceType, Object value)
{
    Map<Object, Integer> objectsMap = writtenObjects[typeValue - SerializationConstants.OBJECT_TYPE_OFFSET];
    if (objectsMap == null)
    {
        switch (referenceType)
        {
        case OBJECT:
            objectsMap = new HashMap<Object, Integer>();
            break;
        case IDENTITY:
            objectsMap = new IdentityHashMap<Object, Integer>();
            break;
        default:
            throw 
                new JRRuntimeException(
                    EXCEPTION_MESSAGE_KEY_UNSUPPORTED_REFERENCE_TYPE,
                    new Object[]{referenceType});
        }

        writtenObjects[typeValue - SerializationConstants.OBJECT_TYPE_OFFSET] = objectsMap;
    }

    int objectIndex = objectsMap.size();
    objectsMap.put(value, objectIndex);
}
项目:jasperreports    文件:ProcessOutputReader.java   
public boolean waitConfirmation(int processStartTimeout)
{
    try
    {
        boolean done = startLatch.await(processStartTimeout, TimeUnit.MILLISECONDS);
        if (log.isDebugEnabled())
        {
            log.debug(processId + " done " + done + ", confirmed " + confirmed);
        }
        return confirmed;
    }
    catch (InterruptedException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:BarcodeXmlWriter.java   
@Override
public void visitUSPSIntelligentMail(
        USPSIntelligentMailComponent intelligentMail)
{
    try
    {
        startBarcode(intelligentMail);
        writeBaseAttributes(intelligentMail);
        writeFourStateAttributes(intelligentMail);
        writeBaseContents(intelligentMail);
        endBarcode();
    }
    catch (IOException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRBaseExpression.java   
/**
 * @deprecated To be removed.
 */
@Override
public Class<?> getValueClass()
{
    if (valueClass == null)
    {
        String className = getValueClassRealName();
        if (className != null)
        {
            try
            {
                valueClass = JRClassLoader.loadClassForName(className);
            }
            catch(ClassNotFoundException e)
            {
                throw new JRRuntimeException(e);
            }
        }
    }

    return valueClass;
}
项目:jasperreports    文件:JRBaseVariable.java   
@Override
public Class<?> getIncrementerFactoryClass()
{
    if (incrementerFactoryClass == null)
    {
        String className = getIncrementerFactoryClassRealName();
        if (className != null)
        {
            try
            {
                incrementerFactoryClass = JRClassLoader.loadClassForName(className);
            }
            catch(ClassNotFoundException e)
            {
                throw new JRRuntimeException(e);
            }
        }
    }

    return incrementerFactoryClass;
}
项目:jasperreports    文件:VerticalFillList.java   
@Override
public void rewind()
{
    if (fillStarted)
    {
        try
        {
            listContents.rewind();
        }
        catch (JRException e)
        {
            throw new JRRuntimeException(e);
        }
    }

    super.rewind();
}
项目:jasperreports    文件:PrintDrawVisitor.java   
@Override
public void visit(JRPrintImage image, Offset offset)
{
    try
    {
        imageDrawer.draw(
                grx,
                image, 
                offset.getX(), 
                offset.getY()
                );
    } 
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:FillFunctionContext.java   
/**
 * Returns the value of a parameter.
 * 
 * @param parameterName the parameter name
 * @param ignoreMissing if set, <code>null</code> will be returned for inexisting parameters
 * @return the parameter value
 */
@Override
public Object getParameterValue(String parameterName, boolean ignoreMissing)
{
    JRFillParameter param = parametersMap.get(parameterName);
    Object value;
    if (param == null)
    {
        if (!ignoreMissing)
        {
            throw 
                new JRRuntimeException(
                    EXCEPTION_MESSAGE_KEY_PARAMETER_NOT_FOUND,
                    new Object[]{parameterName});
        }

        // look into REPORT_PARAMETERS_MAP
        Map<String, Object> valuesMap = getParameterValuesMap();
        value = valuesMap == null ? null : valuesMap.get(parameterName);
    }
    else
    {
        value = param.getValue();
    }
    return value;
}
项目:jasperreports    文件:HtmlFontUtil.java   
/**
 * 
 */
public void handleHtmlFont(
    HtmlResourceHandler cssResourceSaver,
    HtmlResourceHandler fontPathProvider,
    HtmlResourceHandler fontResourceSaver,
    HtmlFontFamily htmlFontFamily,
    boolean useShortId,
    boolean useLocal
    )
{
    if (cssResourceSaver != null)
    {
        String fontCss = getHtmlFont(fontPathProvider, fontResourceSaver, htmlFontFamily, useShortId, useLocal);

        try
        {
            cssResourceSaver.handleResource(htmlFontFamily.getId(), fontCss.getBytes("UTF-8"));
        }
        catch (UnsupportedEncodingException e)
        {
            throw new JRRuntimeException(e);
        }
    }
}
项目:jasperreports    文件:PartReportFiller.java   
@Override
public void addStyles(Collection<JRStyle> stylesList)
{
    for (JRStyle style : stylesList)
    {
        try
        {
            jasperPrint.addStyle(style, true);
        }
        catch (JRException e)
        {
            // should not happen
            throw new JRRuntimeException(e);
        }
    }
}
项目:jasperreports    文件:JRStyledTextParser.java   
/**
 *
 */
public JRStyledText parse(Map<Attribute,Object> attributes, String text, Locale locale) throws SAXException
{
    JRStyledText styledText = new JRStyledText(locale);

    Document document = null;

    try
    {
        document = documentBuilder.parse(new InputSource(new StringReader(ROOT_START + text + ROOT_END)));
    }
    catch (IOException e)
    {
        throw new JRRuntimeException(e);
    }

    hyperlink = null;

    parseStyle(styledText, document.getDocumentElement());

    styledText.setGlobalAttributes(attributes);

    return styledText;
}
项目:jasperreports    文件:FillPrintPartQueue.java   
protected void replace(FillPrintPart originalPart, FillPrintPart newPart)
{
    if (originalPart == head)
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_CANNOT_REPLACE_HEAD_PART,
                (Object[])null);
    }

    newPart.setPreviousPart(originalPart.previousPart());
    newPart.setNextPart(originalPart.nextPart());

    originalPart.previousPart().setNextPart(newPart);

    if (originalPart == tail)
    {
        tail = newPart;
    }
    else
    {
        originalPart.nextPart().setPreviousPart(newPart);
    }
}
项目:jasperreports    文件:ParameterTypeSelectorClauseFunction.java   
@Override
public void apply(JRClauseTokens clauseTokens, JRQueryClauseContext queryContext)
{
    List<Class<?>> parameterTypes = new ArrayList<Class<?>>(parameterPositions.length);
    for (int position : parameterPositions)
    {
        Class<?> parameterType = determineParameterType(clauseTokens,
                queryContext, position);
        parameterTypes.add(parameterType);
    }

    JRClauseFunction function = getForParameterTypes(clauseTokens, queryContext, parameterTypes);
    if (function == null)
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_QUERY_PARAMETER_TYPE_SELECTOR_CLAUSE_IMPLEMENTATION_NOT_FOUND,
                new Object[]{clauseTokens.getClauseId(), parameterTypes});
    }

    function.apply(clauseTokens, queryContext);
}
项目:jasperreports    文件:BaseDataLevelBucket.java   
@Override
public Class<?> getValueClass()
{
    if (valueClass == null)
    {
        String className = getValueClassRealName();
        if (className != null)
        {
            try
            {
                valueClass = JRClassLoader.loadClassForName(className);
            }
            catch (ClassNotFoundException e)
            {
                throw 
                    new JRRuntimeException(
                        EXCEPTION_MESSAGE_KEY_BUCKET_LOAD_ERROR,
                        (Object[])null,
                        e);
            }
        }
    }

    return valueClass;
}
项目:jasperreports    文件:JRStyledTextParser.java   
/**
 *
 */
private JRStyledTextParser()
{
    try
    {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setFeature(JRXmlUtils.FEATURE_DISALLOW_DOCTYPE, true);

        documentBuilder = factory.newDocumentBuilder();
        documentBuilder.setErrorHandler(this);
    }
    catch (ParserConfigurationException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:DefaultElementHandlerBundle.java   
/**
 * Uses the handler map to locate a handler for the element name
 * and exporter key.
 * 
 * @throws JRRuntimeException if no handler is found
 */
@Override
public GenericElementHandler getHandler(String elementName,
        String exporterKey)
{
    Map<String,GenericElementHandler> handlers = elementHandlers.get(elementName);
    if (handlers == null)
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_HANDLERS_NOT_FOUND_FOR_TYPE,
                new Object[]{namespace, elementName});
    }

    GenericElementHandler handler = handlers.get(exporterKey);

    if (handler == null && log.isDebugEnabled())
    {
        log.debug("No " + exporterKey 
                + " handler for generic elements of type "
                + namespace + "#" + elementName);
    }

    return handler;
}
项目:jasperreports    文件:JRAbstractQueryExecuter.java   
/**
 * Returns the list of {@link QueryParameter query parameters} in the order in which they appear in the query.
 * 
 * @return the list of query parameters
 */
protected List<QueryParameter> getCollectedParameters()
{
    List<QueryParameter> params = new ArrayList<QueryParameter>(queryParameters.size());
    for (QueryParameterEntry parameterEntry : queryParameters)
    {
        if (!(parameterEntry instanceof QueryParameter))
        {
            throw 
                new JRRuntimeException(
                    EXCEPTION_MESSAGE_KEY_UNSUPPORTED_PARAMETER_TYPE,
                    new Object[]{"getCollectedParameters()", parameterEntry.getClass().getName()});
        }
        params.add((QueryParameter) parameterEntry);
    }
    return Collections.unmodifiableList(params);
}
项目:jasperreports    文件:JRXmlaHierarchy.java   
protected String parseUniqueName(String originalDimensionName)
{
    Matcher m = DIMENSION_HIERARCHY_PATTERN.matcher(originalDimensionName);
    Boolean gotMatch = m.matches();
    if (gotMatch)
    {
        int startIndex = originalDimensionName.lastIndexOf(".[");
        int endIndex = originalDimensionName.lastIndexOf(']'); 
        if (startIndex == -1 || endIndex == -1 || startIndex + 3 >= endIndex)
        {
            throw 
                new JRRuntimeException(
                    EXCEPTION_MESSAGE_KEY_XMLA_INVALID_DIMENSION_HIERARCHY,
                    new Object[]{originalDimensionName});
        }
        else
        {
            return originalDimensionName.substring(startIndex + 2, endIndex);
        }
    }
    return originalDimensionName;
}
项目:jasperreports    文件:JRJpaQueryExecuter.java   
/**
 * Creates a data source out of the query result.
 * 
 * @return the data source
 */
protected JRDataSource createResultDatasource() {
    JRDataSource resDatasource;

    try {
        int pageSize = getPropertiesUtil().getIntegerProperty(dataset, 
                JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_PAGE_SIZE,
                0);

        resDatasource = new JRJpaDataSource(this, pageSize);
    }
    catch (NumberFormatException e) {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_NUMERIC_TYPE_REQUIRED,
                new Object[]{JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_PAGE_SIZE},
                e);
    }

    return resDatasource;
}
项目:jasperreports    文件:OracleProcedureCallHandler.java   
@Override
public boolean setParameterValue(int parameterIndex, 
        Class<?> type, Object value) throws SQLException
{
    if (java.sql.ResultSet.class.isAssignableFrom(type))
    {
        if (cursorParameter > 0)
        {
            throw new JRRuntimeException("A stored procedure can have at most one cursor parameter : " 
                    + parameterIndex + " class " + type.getName());
        }

        cursorParameter = parameterIndex;
        if (isDataDirectDriver)
        {
            statement.setInt(parameterIndex, 0);
        }
        else
        {
            statement.registerOutParameter(parameterIndex, ORACLE_CURSOR_TYPE);
        }
        return true;
    }

    return false;
}
项目:jasperreports    文件:BaseMultiAxisData.java   
protected void addDataAxis(DataAxis axis)
{
    if (axis.getAxis() == null)
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_DATA_AXIS_LEVEL_NOT_SPECIFIED,
                (Object[])null);
    }

    int axisIndex = axis.getAxis().ordinal();
    DataAxis existingAxis = axes[axisIndex];
    if (existingAxis == null)
    {
        axes[axisIndex] = axis;
        axisList.add(axis);
    }
    else if (existingAxis != axis)// testing for object identity
    {
        throw 
            new JRRuntimeException(
                EXCEPTION_MESSAGE_KEY_DUPLICATE_AXIS,
                new Object[]{axis.getAxis()});
    }
}
项目:openbravo-pos    文件:JRViewer300.java   
public ImageMapPanel(Rectangle renderingArea, JRImageMapRenderer imageMap)
{
    try
    {
        imageAreaHyperlinks = imageMap.getImageAreaHyperlinks(renderingArea);//FIXMECHART
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }

    addMouseListener(this);
    addMouseMotionListener(this);
}
项目:jasperreports    文件:FileBufferedWriter.java   
/**
 * 
 */
public FileBufferedWriter()
{
    fbos = new FileBufferedOutputStream();
    try
    {
        osw = new BufferedWriter(new OutputStreamWriter(fbos, "UTF-8"));
    }
    catch (UnsupportedEncodingException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:TextInputElementPdfHandler.java   
@Override
    public void exportElement(JRPdfExporterContext exporterContext, JRGenericPrintElement element)
    {
        PdfWriter writer = exporterContext.getPdfWriter();
        JasperPrint jasperPrint = exporterContext.getExportedReport();

        JRPrintText printText = (JRPrintText)element.getParameterValue(TextInputElement.PARAMETER_PRINT_TEXT_ELEMENT);
        if (printText == null) //FIXMEINPUT deal with xml serialization
        {
            return;
        }

        Rectangle rectangle = new Rectangle(
                element.getX() + exporterContext.getOffsetX(),
                jasperPrint.getPageHeight() - element.getY() - exporterContext.getOffsetY(),
                element.getX() + exporterContext.getOffsetX() + element.getWidth(),
                jasperPrint.getPageHeight() - element.getY() - exporterContext.getOffsetY() - element.getHeight()
                );
        TextField text = new TextField(writer, rectangle, getFieldName(element));
        Color backColor = printText.getBackcolor();
        if(backColor != null){
            text.setBackgroundColor(backColor);
        }
        Color forecolor = printText.getForecolor();
        if(forecolor != null){
            text.setTextColor(forecolor);
        }
        text.setText(printText.getFullText());
        text.setDefaultText("default:" + printText.getFullText());
//      text.setBackgroundColor(element.getBackcolor());
//      text.setTextColor(element.getForecolor());
//      text.setText(getText(element));
//      text.setDefaultText(getDefaultText(element));

        //FIXME: dynamic settings below:

//      text.setAlignment(Element.ALIGN_LEFT);
//      text.setBorderColor(Color.BLACK);
//      text.setBorderWidth(TextField.BORDER_WIDTH_THIN);
//      text.setBorderStyle(PdfBorderDictionary.STYLE_INSET);

//      text.setChoiceExports(null);
//      text.setChoices(null);
//      text.setChoiceSelection(0);
//      text.setExtensionFont(null);
//      text.setExtraMargin(0, 0);
//      try{
//          text.setFont(BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1250, true));
//      }catch(Exception e){
//          throw new JRRuntimeException(e);
//      }
        text.setFontSize(printText.getFontsize());
        if (Boolean.TRUE.equals(element.getParameterValue(TextInputElement.PARAMETER_MULTI_LINE)))
        {
            text.setOptions(TextField.MULTILINE);
        }
//      text.setRotation(90);
        text.setVisibility(TextField.VISIBLE);

        try{
            PdfFormField field = text.getTextField();
            writer.addAnnotation(field);
        }catch(Exception e){
            throw new JRRuntimeException(e);
        }

    }
项目:jasperreports    文件:FileImageProvider.java   
@Override
public Image getImage(JasperReportsContext jasperReportsContext)
{
    try
    {
        return
            JRImageLoader.getInstance(jasperReportsContext).loadAwtImageFromBytes(
                RepositoryUtil.getInstance(jasperReportsContext).getBytesFromLocation(file)
                );
    }
    catch (JRException e)
    {
        throw new JRRuntimeException(e);
    }
}