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

项目:jasperreports    文件:JRBaseObjectFactory.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    JRBaseSubreport baseSubreport = null;

    if (subreport != null)
    {
        baseSubreport = (JRBaseSubreport)get(subreport);
        if (baseSubreport == null)
        {
            baseSubreport = new JRBaseSubreport(subreport, this);
        }
    }

    setVisitResult(baseSubreport);
}
项目:jasperreports    文件:JRFillObjectFactory.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    JRFillSubreport fillSubreport = null;

    if (subreport != null)
    {
        fillSubreport = (JRFillSubreport)get(subreport);
        if (fillSubreport == null)
        {
            fillSubreport = new JRFillSubreport(filler, subreport, this);
        }
    }

    setVisitResult(fillSubreport);
}
项目:jasperreports    文件:JRFillSubreport.java   
/**
 *
 */
protected JRFillSubreport(
    JRBaseFiller filler,
    JRSubreport subreport, 
    JRFillObjectFactory factory
    )
{
    super(filler, subreport, factory);

    parameters = subreport.getParameters();
    returnValues = new FillReturnValues(subreport.getReturnValues(), factory, filler);

    loadedEvaluators = new HashMap<JasperReport,JREvaluator>();
    checkedReports = new HashSet<JasperReport>();

    this.defaultGenerateRectangle = filler.getPropertiesUtil().getProperty( 
            PROPERTY_SUBREPORT_GENERATE_RECTANGLE, subreport, filler.getMainDataset());
    this.dynamicGenerateRectangle = hasDynamicProperty(PROPERTY_SUBREPORT_GENERATE_RECTANGLE);
}
项目:PDFReporter-Studio    文件:RVPropertyPage.java   
private void getSubreport() {
    JRSubreport sr = (JRSubreport) dto.getProp1();
    if (sr.getExpression() != null) {
        String path = sr.getExpression().getText();
        path = path.replace("\"", ""); //$NON-NLS-1$ //$NON-NLS-2$

        JRBaseReport jd = getFromJRXML(path.replaceAll(".jasper", ".jrxml"));
        if (jd == null)
            jd = getFromJasper(path);

        if (jd != null) {
            JRParameter[] prms = jd.getParameters();
            for (JRParameter p : prms)
                srcParamNames.add(p.getName());
        }
    }
}
项目:jasperreports    文件:JRBaseSubreport.java   
/**
 *
 */
protected JRBaseSubreport(JRSubreport subreport, JRBaseObjectFactory factory)
{
    super(subreport, factory);

    isUsingCache = subreport.getUsingCache();

    runToBottom = subreport.isRunToBottom();
    overflowType = subreport.getOverflowType();

    parametersMapExpression = factory.getExpression(subreport.getParametersMapExpression());

    /*   */
    JRSubreportParameter[] jrSubreportParameters = subreport.getParameters();
    if (jrSubreportParameters != null && jrSubreportParameters.length > 0)
    {
        parameters = new JRSubreportParameter[jrSubreportParameters.length];
        for(int i = 0; i < parameters.length; i++)
        {
            parameters[i] = factory.getSubreportParameter(jrSubreportParameters[i]);
        }
    }

    connectionExpression = factory.getExpression(subreport.getConnectionExpression());
    dataSourceExpression = factory.getExpression(subreport.getDataSourceExpression());

    JRSubreportReturnValue[] subrepReturnValues = subreport.getReturnValues();
    if (subrepReturnValues != null && subrepReturnValues.length > 0)
    {
        this.returnValues = new JRSubreportReturnValue[subrepReturnValues.length];
        for (int i = 0; i < subrepReturnValues.length; i++)
        {
            this.returnValues[i] = factory.getSubreportReturnValue(subrepReturnValues[i]);
        }
    }

    expression = factory.getExpression(subreport.getExpression());
}
项目:jasperreports    文件:ConvertVisitor.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    JRPrintElement printImage = SubreportConverter.getInstance().convert(reportConverter, subreport);
    addElement(parentFrame, printImage);
    addContour(reportConverter, parentFrame, printImage);
}
项目:jasperreports    文件:XmlWriterVisitor.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    try
    {
        xmlWriter.writeSubreport(subreport);
    }
    catch (IOException e)
    {
        throw new JRRuntimeException(e);
    }
}
项目:jasperreports    文件:JRVerifier.java   
public void verifyElement(JRElement element)
{
    if (element instanceof JRStaticText)
    {
        verifyStaticText((JRStaticText)element);
    }
    else if (element instanceof JRTextField)
    {
        verifyTextField((JRTextField)element);
    }
    else if (element instanceof JRImage)
    {
        verifyImage((JRImage)element);
    }
    else if (element instanceof JRSubreport)
    {
        verifySubreport((JRSubreport)element);
    }
    else if (element instanceof JRCrosstab)
    {
        verifyCrosstab((JRDesignCrosstab) element);
    }
    else if (element instanceof JRChart)
    {
        verifyChart((JRChart) element);
    }
    else if (element instanceof JRFrame)
    {
        verifyFrame((JRFrame) element);
    }
    else if (element instanceof JRComponentElement)
    {
        verifyComponentElement((JRComponentElement) element);
    }
    else if (element instanceof JRGenericElement)
    {
        verifyGenericElement((JRGenericElement) element);
    }
}
项目:jasperreports    文件:JRTemplateRectangle.java   
/**
 *
 */
protected JRTemplateRectangle(JROrigin origin, JRDefaultStyleProvider defaultStyleProvider, JRSubreport subreport)
{
    super(origin, defaultStyleProvider);

    setSubreport(subreport);
}
项目:jasperreports    文件:JRTemplateRectangle.java   
/**
 *
 */
protected void setSubreport(JRSubreport subreport)
{
    super.setElement(subreport);

    // don't want to inherit mode because of different defaults for rectangles and subreports
    setMode(subreport.getModeValue());

    linePen = new JRBasePen(this);

    getLinePen().setLineWidth(0f);
    setFill(FillEnum.SOLID);
}
项目:jasperreports    文件:FillTableSubreport.java   
protected FillTableSubreport(FillContext fillContext, JRSubreport subreport,
        JRFillObjectFactory factory, TableJasperReport tableReport, 
        BuiltinExpressionEvaluatorFactory builtinEvaluatorFactory)
{
    super(fillContext.getFiller(), subreport, factory);

    this.fillContainerContext = fillContext.getFillContainerContext();
    this.tableReport = tableReport;
    this.builtinEvaluatorFactory = builtinEvaluatorFactory;
}
项目:PDFReporter-Studio    文件:SubreportFigure.java   
@Override
protected void draw(JSSDrawVisitor drawVisitor, JRElement jrElement) {
    if (cachedGraphics == null || model.hasChangedProperty()){
        model.setChangedProperty(false);
        Graphics2D oldGraphics = drawVisitor.getGraphics2d();
        cachedGraphics = new StackGraphics2D(oldGraphics);
        drawVisitor.setGraphics2D(cachedGraphics);
        drawVisitor.visitSubreport((JRSubreport) jrElement);
        drawVisitor.setGraphics2D(oldGraphics);
    }
    cachedGraphics.setRealDrawer(drawVisitor.getGraphics2d());
    cachedGraphics.paintStack();
}
项目:ireport-fork    文件:ElementNameVisitor.java   
/**
 *
 */
public void visitSubreport(JRSubreport subreport)
{
    name = Misc.getExpressionText( subreport.getExpression() );
    if (name.length() > 15)
    {
        name = name.substring(0,15) + "...";
    }
}
项目:jasperreports    文件:JRXmlWriter.java   
/**
 *
 */

public void writeSubreport(JRSubreport subreport) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_subreport, getNamespace());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_isUsingCache, subreport.getUsingCache());
    if(isNewerVersionOrEqual(JRConstants.VERSION_3_5_0))
    {
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_runToBottom, subreport.isRunToBottom());
    }
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_overflowType, subreport.getOverflowType());

    writeReportElement(subreport);

    writeExpression(JRXmlConstants.ELEMENT_parametersMapExpression, subreport.getParametersMapExpression(), false);

    /*   */
    JRSubreportParameter[] parameters = subreport.getParameters();
    if (parameters != null && parameters.length > 0)
    {
        for(int i = 0; i < parameters.length; i++)
        {
            writeSubreportParameter(parameters[i], getNamespace());
        }
    }

    writeExpression(JRXmlConstants.ELEMENT_connectionExpression, subreport.getConnectionExpression(), false);
    writeExpression(JRXmlConstants.ELEMENT_dataSourceExpression, subreport.getDataSourceExpression(), false);

    JRSubreportReturnValue[] returnValues = subreport.getReturnValues();
    if (returnValues != null && returnValues.length > 0)
    {
        for(int i = 0; i < returnValues.length; i++)
        {
            writeSubreportReturnValue(returnValues[i], getNamespace());
        }
    }

    writeExpression(JRXmlConstants.ELEMENT_subreportExpression, subreport.getExpression(), true);

    writer.closeElement();
}
项目:jasperreports    文件:JRDelegationVisitor.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    visitor.visitSubreport(subreport);
}
项目:jasperreports    文件:UniformElementVisitor.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    visitElement(subreport);
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 *
 */
public void writeSubreport( JRSubreport subreport, String subreportName)
{
    if(subreport != null)
    {
        write( "JRDesignSubreport " + subreportName + " = new JRDesignSubreport(jasperDesign);\n");
        write( subreportName + ".setUsingCache({0});\n", subreport.getUsingCache());
        write( subreportName + ".setRunToBottom({0});\n", subreport.isRunToBottom());
        write(subreportName + ".setOverflowType({0});\n", subreport.getOverflowType());
        writeReportElement( subreport, subreportName);

        writeExpression( subreport.getParametersMapExpression(), subreportName, "ParametersMapExpression");

        JRSubreportParameter[] parameters = subreport.getParameters();
        if (parameters != null && parameters.length > 0)
        {
            for(int i = 0; i < parameters.length; i++)
            {
                writeSubreportParameter( parameters[i], subreportName + "Parameter" + i);
                write( subreportName + ".addParameter(" + subreportName + "Parameter" + i + ");\n");
            }
        }

        writeExpression( subreport.getConnectionExpression(), subreportName, "ConnectionExpression");

        writeExpression( subreport.getDataSourceExpression(), subreportName, "DataSourceExpression");

        JRSubreportReturnValue[] returnValues = subreport.getReturnValues();
        if (returnValues != null && returnValues.length > 0)
        {
            for(int i = 0; i < returnValues.length; i++)
            {
                writeSubreportReturnValue( returnValues[i], subreportName + "ReturnValue" + i);
                write( subreportName + ".addReturnValue(" + subreportName + "ReturnValue" + i + ");\n");
            }
        }

        writeExpression( subreport.getExpression(), subreportName, "Expression");

        flush();
    }
}
项目:jasperreports    文件:JRApiWriter.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    apiWriter.writeSubreport(subreport, name);
}
项目:jasperreports    文件:JRVisitorSupport.java   
@Override
public void visitSubreport(JRSubreport subreport)
{
    // NOOP
}
项目:jasperreports    文件:JRVerifier.java   
/**
 *
 */
private void verifySubreport(JRSubreport subreport)
{
    if (subreport != null)
    {
        verifyReportElement(subreport);

        JRSubreportParameter[] parameters = subreport.getParameters();
        if (parameters != null && parameters.length > 0)
        {
            for(int index = 0; index < parameters.length; index++)
            {
                JRSubreportParameter parameter = parameters[index];

                if (parameter.getName() == null || parameter.getName().trim().length() == 0)
                {
                    addBrokenRule("Subreport parameter name missing.", parameter);
                }
            }
        }

        if (
            subreport.getConnectionExpression() != null &&
            subreport.getDataSourceExpression() != null
            )
        {
            addBrokenRule("Subreport cannot have both connection expresion and data source expression.", subreport);
        }

        JRSubreportReturnValue[] returnValues = subreport.getReturnValues();
        if (returnValues != null && returnValues.length > 0)
        {
            for (int i = 0; i < returnValues.length; i++)
            {
                JRSubreportReturnValue returnValue = returnValues[i];

                if (returnValue.getFromVariable() == null || returnValue.getFromVariable().trim().length() == 0)
                {
                    addBrokenRule("Subreport return value variable name missing.", returnValue);
                }

                if (returnValue.getToVariable() == null || returnValue.getToVariable().trim().length() == 0)
                {
                    addBrokenRule("Subreport return value to variable name missing.", returnValue);
                }

                if (!jasperDesign.getVariablesMap().containsKey(returnValue.getToVariable()))
                {
                    addBrokenRule("Subreport return value to variable not found.", returnValue);
                }
            }
        }
    }
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public Boolean isRunToBottom()
{
    return ((JRSubreport) parent).isRunToBottom();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public OverflowType getOverflowType()
{
    return ((JRSubreport) parent).getOverflowType();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public JRExpression getParametersMapExpression()
{
    return ((JRSubreport)parent).getParametersMapExpression();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public JRExpression getConnectionExpression()
{
    return ((JRSubreport)parent).getConnectionExpression();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public JRExpression getDataSourceExpression()
{
    return ((JRSubreport)parent).getDataSourceExpression();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public JRExpression getExpression()
{
    return ((JRSubreport)parent).getExpression();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public JRSubreportReturnValue[] getReturnValues()
{
    return ((JRSubreport) parent).getReturnValues();
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
public Boolean getUsingCache()
{
    return ((JRSubreport)parent).getUsingCache();
}
项目:jasperreports    文件:PropertiesMetadataUtil.java   
protected boolean inScope(PropertyMetadata property, JRElement element)
{
    List<PropertyScope> scopes = property.getScopes();
    if (scopes.contains(PropertyScope.ELEMENT))
    {
        return true;
    }

    if (element instanceof JRTextElement && scopes.contains(PropertyScope.TEXT_ELEMENT))
    {
        return true;
    }

    if (element instanceof JRImage && scopes.contains(PropertyScope.IMAGE_ELEMENT))
    {
        return true;
    }

    if (element instanceof JRChart && scopes.contains(PropertyScope.CHART_ELEMENT))
    {
        return true;
    }

    if (element instanceof JRCrosstab && scopes.contains(PropertyScope.CROSSTAB))
    {
        return true;
    }

    if (element instanceof JRFrame && scopes.contains(PropertyScope.FRAME))
    {
        return true;
    }

    if (element instanceof JRSubreport && scopes.contains(PropertyScope.SUBREPORT))
    {
        return true;
    }

    //TODO lucianc generic element

    if (element instanceof JRComponentElement && scopes.contains(PropertyScope.COMPONENT))
    {
        List<String> qualifications = property.getScopeQualifications();
        if (qualifications == null || qualifications.isEmpty())
        {
            //assuming all components
            return true;
        }

        JRComponentElement componentElement = (JRComponentElement) element;
        String qualification;
        if (componentElement.getComponent() instanceof Designated)
        {
            qualification = ((Designated) componentElement.getComponent()).getDesignation();
        }
        else
        {
            ComponentKey key = componentElement.getComponentKey();
            if (key == null || key.getNamespace() == null || key.getName() == null)
            {
                //key is missing
                qualification = null;
            }
            else
            {
                qualification = key.getNamespace() 
                        + PropertyConstants.COMPONENT_KEY_QUALIFICATION_SEPARATOR 
                        + key.getName();
            }
        }

        return qualification != null && qualifications.contains(qualification);
    }

    return false;
}
项目:ireport-fork    文件:ElementNodeVisitor.java   
/**
 *
 */
public void visitSubreport(JRSubreport subreport)
{
    node = new ElementNode(jasperDesign, (JRDesignSubreport)subreport,doLkp);
    node.setIconBaseWithExtension(ICON_SUBREPORT);
}
项目:ireport-fork    文件:HasExpressionVisitor.java   
/**
 *
 */
public void visitSubreport(JRSubreport subreport)
{
    collector.collect(subreport);
}
项目:ireport-fork    文件:NodeCellRenderer.java   
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

   label.setIcon(null);

   if (value instanceof Node)
   {
       Node node = (Node)value;
       String text = node.getDisplayName();

       if (node instanceof ElementNode)
       {
           text = "";
           JRDesignElement element = ((ElementNode)node).getElement();
           if (element instanceof JRBreak) text += "Break";
           if (element instanceof JRChart) text += "Chart";
           if (element instanceof JRCrosstab) text += "Crosstab";
           if (element instanceof JRElementGroup) text += "Element Group";
           if (element instanceof JREllipse) text += "Ellipse";
           if (element instanceof JRFrame) text += "Frame";
           if (element instanceof JRImage) text += "Image";
           if (element instanceof JRLine) text += "Line";
           if (element instanceof JRRectangle) text += "Rectangle";
           if (element instanceof JRStaticText) text += "Static Text";
           if (element instanceof JRSubreport) text += "Subreport";
           if (element instanceof JRTextField) text += "Text Field";

           JRElementGroup parent = ModelUtils.getTopElementGroup(element);
           if (parent != null && parent instanceof JRDesignBand) text += " in band " + ModelUtils.nameOf(((JRDesignBand)parent).getOrigin());
           else if (parent != null && parent instanceof JRDesignCellContents) text += " in cell " + ModelUtils.nameOf(((JRDesignCellContents)parent).getOrigin());

           text += " " + node.getDisplayName();
       }

       label.setText(text);
       label.setIcon( new ImageIcon(node.getIcon(BeanInfo.ICON_COLOR_16x16)));
   }
   else if (value instanceof JRDesignExpression)
   {
       JRDesignExpression exp = (JRDesignExpression)value;
       label.setText(exp.getText());
       label.setIcon(expressionIcon);
   }

   return label;
}