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

项目:jasperreports    文件:TableUtil.java   
public static List<?> getGroupList(TableComponent table, JRReport report) 
{
    List<?> groupsList = null;
    JRDatasetRun datasetRun = table.getDatasetRun();
    if (datasetRun != null) 
    {
        String dataSetName = datasetRun.getDatasetName();
        JRDataset[] datasets = report.getDatasets();
        if (datasets != null && dataSetName != null)
        {
            for (JRDataset ds : datasets)
            {
                JRGroup[] groups = ds.getGroups();
                if (dataSetName.equals(ds.getName()) && groups != null)
                {
                    groupsList = Arrays.asList(groups);
                    break;
                }
            }
        }
    }
    return groupsList;
}
项目:jasperreports    文件:JRJpaQueryExecuter.java   
/**
 * 
 */
public JRJpaQueryExecuter(
    JasperReportsContext jasperReportsContext, 
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parameters
    ) 
{
    super(jasperReportsContext, dataset, parameters);

    em = (EntityManager)getParameterValue(JRJpaQueryExecuterFactory.PARAMETER_JPA_ENTITY_MANAGER);
    reportMaxCount = (Integer)getParameterValue(JRParameter.REPORT_MAX_COUNT);

    if (em == null) {
        log.warn("The supplied javax.persistence.EntityManager object is null.");
    }

    parseQuery();
}
项目:jasperreports    文件:JaxenXPathQueryExecuter.java   
/**
 * 
 */
public JaxenXPathQueryExecuter(
    JasperReportsContext jasperReportsContext,
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parametersMap
    )
{
    super(jasperReportsContext, dataset, parametersMap);

    document = (Document) getParameterValue(JaxenXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT);
    documentBuilderFactory = (DocumentBuilderFactory) getParameterValue(
            JaxenXPathQueryExecuterFactory.PARAMETER_DOCUMENT_BUILDER_FACTORY, true);
    namespacesMap = (Map<String, String>) getParameterValue(
            JaxenXPathQueryExecuterFactory.PARAMETER_XML_NAMESPACE_MAP, true);

    if (document == null)
    {
        log.warn("The supplied org.w3c.dom.Document object is null.");
    }

    parseQuery();
}
项目:jasperreports    文件:XalanXPathQueryExecuter.java   
/**
 * 
 */
public XalanXPathQueryExecuter(
    JasperReportsContext jasperReportsContext, 
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parametersMap
    )
{
    super(jasperReportsContext, dataset, parametersMap);

    document = (Document) getParameterValue(XalanXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT);
    documentBuilderFactory = (DocumentBuilderFactory) getParameterValue(
            XalanXPathQueryExecuterFactory.PARAMETER_DOCUMENT_BUILDER_FACTORY, true);
    namespacesMap = (Map<String, String>) getParameterValue(
            XalanXPathQueryExecuterFactory.PARAMETER_XML_NAMESPACE_MAP, true);

    if (document == null)
    {
        log.warn("The supplied org.w3c.dom.Document object is null.");
    }

    parseQuery();
}
项目:jasperreports    文件:JRHibernateQueryExecuter.java   
/**
 * 
 */
public JRHibernateQueryExecuter(
    JasperReportsContext jasperReportsContext, 
    JRDataset dataset, Map<String, ? extends JRValueParameter> parameters
    )
{
    super(jasperReportsContext, dataset, parameters);

    session = (Session) getParameterValue(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION);
    reportMaxCount = (Integer) getParameterValue(JRParameter.REPORT_MAX_COUNT);
    isClearCache = getPropertiesUtil().getBooleanProperty(dataset, 
            JRHibernateQueryExecuterFactory.PROPERTY_HIBERNATE_CLEAR_CACHE,
            false);

    if (session == null)
    {
        log.warn("The supplied org.hibernate.Session object is null.");
    }

    parseQuery();
}
项目:jasperreports    文件:JRXmlWriter.java   
public void writeDataset(JRDataset dataset) throws IOException
{
    writer.startElement(JRXmlConstants.ELEMENT_subDataset, getNamespace());
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, dataset.getName());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_scriptletClass, dataset.getScriptletClass());
    writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_resourceBundle, dataset.getResourceBundle());
    writer.addAttribute(JRXmlConstants.ATTRIBUTE_whenResourceMissingType, dataset.getWhenResourceMissingTypeValue(), WhenResourceMissingTypeEnum.NULL);
    if (
        isNewerVersionOrEqual(JRConstants.VERSION_4_6_0)
        && !isExcludeUuids() 
        )
    {
        writer.addAttribute(JRXmlConstants.ATTRIBUTE_uuid, dataset.getUUID().toString());
    }

    writeProperties(dataset);

    if (isNewerVersionOrEqual(JRConstants.VERSION_6_3_1))
    {
        writePropertyExpressions(dataset.getPropertyExpressions());
    }

    writeDatasetContents(dataset);

    writer.closeElement();
}
项目:jasperreports    文件:JRApiWriter.java   
/**
 * 
 */
public void writeDataset( JRDataset dataset, String datasetName)
{
    if(dataset != null)
    {
        write( "JRDesignDataset " + datasetName + " = new JRDesignDataset(" + dataset.isMainDataset() + ");\n");    

        write( datasetName + ".setName(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(dataset.getName()));
        write( datasetName + ".setScriptletClass(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(dataset.getScriptletClass()));
        write( datasetName + ".setResourceBundle(\"{0}\");\n", JRStringUtil.escapeJavaStringLiteral(dataset.getResourceBundle()));
        write( datasetName + ".setWhenResourceMissingType({0});\n", dataset.getWhenResourceMissingTypeValue(), WhenResourceMissingTypeEnum.NULL);

        writeProperties( dataset, datasetName);
        writePropertyExpressions( dataset.getPropertyExpressions(), datasetName);

        writeDatasetContents( dataset, datasetName);
        flush();
    }

}
项目:jasperreports    文件:JRVerifier.java   
private void verifyDatasets()
{
    JRDataset[] datasets = jasperDesign.getDatasets();
    if (datasets != null && datasets.length > 0)
    {
        for (int i = 0; i < datasets.length; ++i)
        {
            JRDesignDataset dataset = (JRDesignDataset) datasets[i];

            if (dataset.getName() == null || dataset.getName().trim().length() == 0)
            {
                addBrokenRule("Dataset name is missing.", dataset);
            }

            verifyDataset(dataset);
        }
    }
}
项目:jasperreports    文件:JRReportCompileData.java   
/**
 * Returns the compile data for a dataset.
 * 
 * @param dataset the dataset
 * @return the compile data
 * @throws JRException
 */
public Serializable getDatasetCompileData(JRDataset dataset) throws JRException
{
    Serializable compileData;
    if (dataset.isMainDataset())
    {
        compileData = getMainDatasetCompileData();
    }
    else
    {
        compileData = datasetCompileData.get(dataset.getName());
        if (compileData == null)
        {
            throw 
                new JRException(
                    EXCEPTION_MESSAGE_KEY_COMPILE_DATA_FOR_DATASET_NOT_FOUND,
                    new Object[]{dataset.getName()});
        }
    }

    return compileData;
}
项目:jasperreports    文件:JasperDesign.java   
/**
 * Removes a sub dataset from the report.
 *
 * @param dataset the dataset to be removed
 * @return the dataset
 */
public JRDataset removeDataset(JRDataset dataset)
{
    if (dataset != null)
    {
        int idx = datasetList.indexOf(dataset);
        if (idx >= 0)
        {
            datasetList.remove(idx);
            datasetMap.remove(dataset.getName());
            getEventSupport().fireCollectionElementRemovedEvent(PROPERTY_DATASETS, dataset, idx);
        }
    }

    return dataset;
}
项目:jasperreports    文件:JRAbstractCompiler.java   
protected static String getUnitName(JRReport report, JRDataset dataset, String nameSuffix)
{
    String className;
    if (dataset.isMainDataset())
    {
        className = report.getName();
    }
    else
    {
        className = report.getName() + "_" + dataset.getName();
    }

    className = JRStringUtil.getJavaIdentifier(className) + nameSuffix;

    return className;
}
项目:jasperreports    文件:JRFillDataset.java   
private void setVariables(JRDataset dataset, JRFillObjectFactory factory)
{
    JRVariable[] jrVariables = dataset.getVariables();
    if (jrVariables != null && jrVariables.length > 0)
    {
        List<JRFillVariable> variableList = new ArrayList<JRFillVariable>(jrVariables.length * 3);

        variablesMap = new HashMap<String,JRFillVariable>();
        for (int i = 0; i < jrVariables.length; i++)
        {
            addVariable(jrVariables[i], variableList, factory);
        }

        setVariables(variableList);
    }
}
项目:jasperreports    文件:JRFillObjectFactory.java   
protected JRFillElementDataset[] getElementDatasets(JRDataset dataset)
{
    JRFillElementDataset[] elementDatasetsArray;
    List<JRFillElementDataset> elementDatasetsList;
    if (dataset.isMainDataset())
    {
        elementDatasetsList = elementDatasets;
    }
    else
    {
        elementDatasetsList = elementDatasetMap.get(dataset.getName());
    }

    if (elementDatasetsList == null || elementDatasetsList.size() == 0)
    {
        elementDatasetsArray = new JRFillElementDataset[0];
    }
    else
    {
        elementDatasetsArray = new JRFillElementDataset[elementDatasetsList.size()];
        elementDatasetsList.toArray(elementDatasetsArray);
    }

    return elementDatasetsArray;
}
项目:jasperreports    文件:BaseReportFiller.java   
private void createDatasets() throws JRException
{
    datasetMap = new HashMap<String,JRFillDataset>();

    JRDataset[] datasets = jasperReport.getDatasets();
    if (datasets != null && datasets.length > 0)
    {
        for (int i = 0; i < datasets.length; i++)
        {
            JRFillDataset fillDataset = factory.getDataset(datasets[i]);
            fillDataset.createCalculator(jasperReport);

            datasetMap.put(datasets[i].getName(), fillDataset);
        }
    }
}
项目:jasperreports    文件:JRMondrianQueryExecuter.java   
/**
 * 
 */
public JRMondrianQueryExecuter(
    JasperReportsContext jasperReportsContext, 
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parametersMap
    )
{
    super(jasperReportsContext, dataset, parametersMap);

    connection = (Connection) getParameterValue(JRMondrianQueryExecuterFactory.PARAMETER_MONDRIAN_CONNECTION);

    if (connection == null)
    {
        log.warn("The supplied mondrian.olap.Connection object is null.");
    }

    parseQuery();
}
项目:PDFReporter-Studio    文件:RemoteXMLDataAdapterDescriptor.java   
@Override
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset jDataset) throws JRException, UnsupportedOperationException {
    Throwable t = null;
    ArrayList<JRDesignField> fields = new ArrayList<JRDesignField>();
    try {
        String fileName = getDataAdapter().getFileName();
        Document doc = JRXmlUtils.parse(new URL(fileName), XMLUtils.isNamespaceAware(getDataAdapter(), jConfig.getJasperDesign()));
        fields.addAll(getFieldsFromDocument(doc, jConfig, jDataset));
    } catch (IOException e) {
        t = e;
    }

    if (t != null) {
        UIUtils.showError(t);
    }
    return fields;
}
项目:PDFReporter-Studio    文件:XmlaFieldsProvider.java   
@Override
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset jDataset) throws JRException, UnsupportedOperationException {

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("REPORT_PARAMETERS_MAP", new HashMap<String, Object>());
    try {
        //Here there is the password of the connection
        con.contributeParameters(parameters);
    } catch (JRException e) {
        e.printStackTrace();
    }
    ParameterUtil.setParameters(jConfig, jDataset, parameters);
    parameters.put(JRParameter.REPORT_MAX_COUNT, 2);
    Map<String,? extends JRValueParameter> tmpMap  = ParameterUtil.convertMap(parameters, jDataset);

    JRXmlaQueryExecuter qe = new JRXmlaQueryExecuter(jConfig, jDataset, tmpMap);
    JROlapResult result = qe.getResult();
    return OlapFieldsProviderSupport.getFieldsFromResult(result);
}
项目:PDFReporter-Studio    文件:XMLDataAdapterDescriptor.java   
/**
 * Returns the list of fields provided by an XML document and the related
 * query.
 * 
 * @param doc
 *          the W3C XML document
 * @param jConfig
 *          the JasperReports configuration instance
 * @param jDataset
 *          the current dataset
 * @return the list of fields
 * @throws JRException
 */
protected List<JRDesignField> getFieldsFromDocument(Document doc, JasperReportsConfiguration jConfig, JRDataset jDataset) throws JRException {
    JRXPathExecuterFactory xPathExecuterFactory = JRXPathExecuterUtils.getXPathExecuterFactory(jConfig);
    JRXPathExecuter xPathExecuter = xPathExecuterFactory.getXPathExecuter();
    NodeList nodes = xPathExecuter.selectNodeList(doc, jDataset.getQuery().getText());
    LinkedHashMap<String, JRDesignField> fieldsMap = new LinkedHashMap<String, JRDesignField>();
    for (int nIdx = 0; nIdx < nodes.getLength(); nIdx++) {
        Node currNode = nodes.item(nIdx);
        findDirectChildrenAttributes(currNode,fieldsMap,"");
        if(currNode.getNodeType() == Node.ELEMENT_NODE) {
            NodeList childNodes = currNode.getChildNodes();
            findChildFields(childNodes, fieldsMap,"");
        }
    }
    return new ArrayList<JRDesignField>(fieldsMap.values());
}
项目:PDFReporter-Studio    文件:MondrianFieldsProvider.java   
@Override
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset jDataset) throws JRException, UnsupportedOperationException {
    Map<String, Object> parameters = new HashMap<String, Object>();
    con.contributeParameters(parameters);

    ParameterUtil.setParameters(jConfig, jDataset, parameters);
    parameters.put(JRParameter.REPORT_MAX_COUNT, 0);

    // JasperReports query executer instances require
    // REPORT_PARAMETERS_MAP parameter to be defined and not null
    Map<String, JRValueParameter> tmpMap = ParameterUtil.convertMap(parameters, jDataset);
    tmpMap.put(JRParameter.REPORT_PARAMETERS_MAP, new SimpleValueParameter(new HashMap<String, JRValueParameter>()));

    JRMondrianQueryExecuter qe = new JRMondrianQueryExecuter(jConfig, jDataset, tmpMap);
    qe.createDatasource();

    JRMondrianResult result = new JRMondrianResult(qe.getResult());
    return OlapFieldsProviderSupport.getFieldsFromResult(result);
}
项目:PDFReporter-Studio    文件:ComboParametersPage.java   
/**
 * Set the valued edited by this dialog
 * 
 * @param value a ParametersDTO (not null) of the parameters list that the user manipulate  
 * @param datasetRun the (not null) dataset run from where the value is extracted
 */
public void setValue(ParameterDTO value, MDatasetRun datasetRun) {
    this.value = value;
    if (value == null) {
        value = new ParameterDTO();
    }
    //get the dataset referenced by the dataset run
    JRDataset dataset = datasetRun.getJasperDesign().getDatasetMap().get(datasetRun.getPropertyValue(JRDesignDatasetRun.PROPERTY_DATASET_NAME));
    if (dataset != null) {
        List<JRParameter> userParameters = new ArrayList<JRParameter>();
        //flag to add or not the system parameters
        boolean addSystemParameters = true;
        for(JRParameter param : dataset.getParameters()){
            if (!param.isSystemDefined() || addSystemParameters) userParameters.add(param);
        }
        //the original dataset parameters are cached
        datasetParameters = userParameters.toArray(new JRParameter[userParameters.size()]);
    }
    else datasetParameters = new JRDesignParameter[0];
    if (table != null)
        fillTable(table);
}
项目:PDFReporter-Studio    文件:DatasetRunBaseComposite.java   
private void updateSubDatasetInformation(int selIndex) {
    if (selIndex==0){
        // Must force the use of the report main dataset
        this.datasetRunInstance.resetDatasetRun(true);
        tabFolderDataSetRun.setEnabled(false);
        tabFolderDataSetRun.setVisible(false);
    }
    else {
        this.datasetRunInstance.resetDatasetRun(false);
        String selectDatasetName=comboSubDataset.getItem(selIndex);
        List<JRDataset> datasetsList = this.datasetRunInstance.getEditableDataset().getJasperDesign().getDatasetsList();
        for (JRDataset ds : datasetsList){
            if (ds.getName().equals(selectDatasetName)){
                this.datasetRunInstance.setDatasetName(selectDatasetName);
                break;
            }
        }
        tabFolderDataSetRun.setEnabled(true);
        tabFolderDataSetRun.setVisible(true);
    }
}
项目:PDFReporter-Studio    文件:SyncDatasetRunParameters.java   
public static List<JRDesignDatasetRun> getDatasetRun(MReport mrep, JRDataset jDataset) {
    final String dsName = jDataset.getName();
    final List<JRDesignDatasetRun> dsRuns = new ArrayList<JRDesignDatasetRun>();
    new ModelVisitor<Object>(mrep) {

        @Override
        public boolean visit(INode n) {
            if (n instanceof IDatasetContainer) {
                List<MDatasetRun> dsRunList = ((IDatasetContainer) n).getDatasetRunList();
                if (dsRunList != null)
                    for (MDatasetRun mdsrun : dsRunList) {
                        JRDesignDatasetRun dsrun = mdsrun.getValue();
                        if (dsrun.getDataSourceExpression() != null)
                            continue;
                        if (dsrun.getDatasetName() != null && dsrun.getDatasetName().equals(dsName))
                            dsRuns.add(dsrun);
                    }
            }
            return true;
        }
    };
    return dsRuns;
}
项目:PDFReporter-Studio    文件:MGraphicElement.java   
@Override
protected void postDescriptors(IPropertyDescriptor[] descriptors) {
    super.postDescriptors(descriptors);
    // initialize style
    JasperDesign jd = getJasperDesign();
    if (jd != null && getValue() != null) {
        JRDataset dataset = getElementDataset();
        //Calculate the groups list for the current element
        if (dataset != null){
            JRGroup[] groups = dataset.getGroups();
            String[] items = new String[groups.length];
            for (int j = 0; j < groups.length; j++) {
                items[j] = groups[j].getName();
            }
            setGroupItems(items);
        }
    }
}
项目:PDFReporter-Studio    文件:MTextField.java   
/**
 * Return the dataset nearest to this element
 * 
 * @param node the actual node
 * @return the dataset nearest to this element or null if it can't be found
 */
private JRDataset getElementDataset(ANode node){
    if (node instanceof APropertyNode){
        APropertyNode pnode = (APropertyNode)node;
        MDatasetRun mdataset = (MDatasetRun) pnode.getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN);
        if (mdataset != null) {
                JRDesignDatasetRun datasetRun = mdataset.getValue();
                if (datasetRun != null) {
                    String dsname = datasetRun.getDatasetName();
                    return getJasperDesign().getDatasetMap().get(dsname);
                }
        } 
    }
    ANode parent = node.getParent();
    if (parent != null){
        return getElementDataset(parent);
    } else if (getJasperDesign() != null){
        return getJasperDesign().getMainDataset();
    } else {
        return null;
    }
}
项目:PDFReporter-Studio    文件:MImage.java   
/**
 * Return the dataset nearest to this element
 * 
 * @param node the actual node
 * @return the dataset nearest to this element or null if it can't be found
 */
private JRDataset getElementDataset(ANode node){
    if (node instanceof APropertyNode){
        APropertyNode pnode = (APropertyNode)node;
        MDatasetRun mdataset = (MDatasetRun) pnode.getPropertyValue(JRDesignElementDataset.PROPERTY_DATASET_RUN);
        if (mdataset != null) {
                JRDesignDatasetRun datasetRun = mdataset.getValue();
                if (datasetRun != null) {
                    String dsname = datasetRun.getDatasetName();
                    return getJasperDesign().getDatasetMap().get(dsname);
                }
        } 
    }
    ANode parent = node.getParent();
    if (parent != null){
        return getElementDataset(parent);
    } else if (getJasperDesign() != null){
        return getJasperDesign().getMainDataset();
    } else {
        return null;
    }
}
项目:PDFReporter-Studio    文件:JrxmlEditor.java   
public void gotoMarker(IMarker marker) {
    if (activePage == PAGE_DESIGNER) {
        try {
            Object expr = marker.getAttribute(JRErrorHandler.MARKER_ERROR_JREXPRESSION);
            if (expr != null && expr instanceof String) {
                JRDesignExpression expression = new JRDesignExpression();
                expression.setId(new Integer((String) expr));
                JasperDesign jd = getJasperDesign();
                JRExpressionCollector rc = JRExpressionCollector.collector(jrContext, jd);
                if (!VErrorPreview.openExpressionEditor(jrContext, rc, (JRDesignDataset) jd.getMainDataset(), expression))
                    for (JRDataset d : jd.getDatasetsList())
                        if (VErrorPreview.openExpressionEditor(jrContext, rc, (JRDesignDataset) d, expression))
                            return;
            }
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }
    setActivePage(PAGE_XMLEDITOR);
    IDE.gotoMarker(xmlEditor, marker);
}
项目:PDFReporter-Studio    文件:ExpressionContextUtils.java   
/**
 * Returns the {@link ResourceBundle} associated to the specified dataset.
 * As fallback solution we look in the main dataset.
 * 
 * @param dataset the dataset to look into
 * @param jconfig the {@link JasperReportsContext} instance
 * @return the {@link ResourceBundle} if any, <code>null</code> otherwise
 */
public static ResourceBundle getResourceBundle(JRDataset dataset, JasperReportsConfiguration jconfig) {
    String baseName = dataset.getResourceBundle();
    ResourceBundle loadedBundle = null;
    if(baseName==null) {
        baseName = jconfig.getJasperDesign().getMainDataset().getResourceBundle();
    }
    if(!Misc.isNullOrEmpty(baseName)) {
        Locale locale = Locale.getDefault();
        Object obj = jconfig.getJRParameters().get(JRParameter.REPORT_LOCALE);
        if (obj instanceof Locale) {
            locale = (Locale) obj;
        }
        try {
            loadedBundle = JRResourcesUtil.loadResourceBundle(baseName, locale, jconfig.getClassLoader());
        }
        catch (MissingResourceException e) {
            JaspersoftStudioPlugin.getInstance().logError(
                    NLS.bind("Unable to get the resource bundle with base name {0}.",baseName), e);
        }
    }
    return loadedBundle;
}
项目:ireport-fork    文件:MapMarkersPanel.java   
public void updateSubDatasets()
   {

       if (getJasperDesign() == null)
{
           jComboBoxSubDataset.removeAllItems();
           jComboBoxSubDataset.addItem("");//NOI18N
       }
       else
       {
           List<String> datasetNames = new ArrayList<String>();
           for (int i=0; i<getJasperDesign().getDatasetsList().size(); ++i)
           {
               datasetNames.add( ((JRDataset)getJasperDesign().getDatasetsList().get(i)).getName());
           }

           Misc.updateComboBox(jComboBoxSubDataset, datasetNames, true);
       }
   }
项目:ireport-fork    文件:SpiderChartPanel.java   
public void updateSubDatasets()
   {

       if (getJasperDesign() == null)
{
           jComboBoxSubDataset.removeAllItems();
           jComboBoxSubDataset.addItem("");//NOI18N
       }
       else
       {
           List<String> datasetNames = new ArrayList<String>();
           for (int i=0; i<getJasperDesign().getDatasetsList().size(); ++i)
           {
               datasetNames.add( ((JRDataset)getJasperDesign().getDatasetsList().get(i)).getName());
           }

           Misc.updateComboBox(jComboBoxSubDataset, datasetNames, true);
       }
   }
项目:ireport-fork    文件:ChartPropertiesDialog.java   
public void updateSubDatasets()
   {

       if (getJasperDesign() == null)
{
           jComboBoxSubDataset.removeAllItems();
           jComboBoxSubDataset.addItem("");//NOI18N
       }    
       else
       {
           List<String> datasetNames = new ArrayList<String>();
           for (int i=0; i<getJasperDesign().getDatasetsList().size(); ++i)
           {
               datasetNames.add( ((JRDataset)getJasperDesign().getDatasetsList().get(i)).getName());
           }

           Misc.updateComboBox(jComboBoxSubDataset, datasetNames, true);
       }
   }
项目:ireport-fork    文件:CrosstabDataDialog.java   
public void updateSubDatasets()
   {

       if (getJasperDesign() == null)
{
           jComboBoxSubDataset.removeAllItems();
           jComboBoxSubDataset.addItem("");
       }    
       else
       {
           List<String> datasetNames = new ArrayList<String>();
           for (int i=0; i<getJasperDesign().getDatasetsList().size(); ++i)
           {
               datasetNames.add( ((JRDataset)getJasperDesign().getDatasetsList().get(i)).getName());
           }

           Misc.updateComboBox(jComboBoxSubDataset, datasetNames, true);
       }
   }
项目:ireport-fork    文件:SQLFieldsProvider.java   
public static Map<String, JRValueParameter> convertMap(JRDataset dataset, Map<String, ?> inmap) {
        Map<String, JRValueParameter> outmap = new HashMap<String, JRValueParameter>();
        for (String key : inmap.keySet())
        {
                SimpleValueParameter svp = new SimpleValueParameter(inmap.get(key));

                // Let's set the correct class name for this parameter...
                for (JRParameter p : dataset.getParameters() )
                {
                    if (p.getName() != null && p.getName().equals(key))
                    {
                        svp.setValueClassName( p.getValueClassName());
                        break;
                    }
                }
                outmap.put(key, svp);
        }
        return outmap;
}
项目:ireport-fork    文件:IRExpressionCollector.java   
@Override
public void collect(JRChart element)
{
        JRDesignChart chart = (JRDesignChart)element;
        super.collect(element);
        chart.getDataset().collectExpressions(this);
        chart.getPlot().collectExpressions(this);
        JRDatasetRun datasetRun = chart.getDataset().getDatasetRun();


        if (datasetRun != null &&
            datasetRun.getDatasetName() != null)
        {
                JRExpressionCollector collector = getCollector( (JRDataset)jasperDesign.getDatasetMap().get(datasetRun.getDatasetName()));
                extraExpressions.addAll(collector.getExpressions());
        }
        System.out.flush();

}
项目:jasperreports    文件:HttpDataService.java   
protected String getPropertyOrParameterValue(String propName, String paramName, Map<String, Object> parameterValues)
{
    String value = null;

    JRDataset dataset = context.getDataset();

    if (dataset != null && dataset.hasProperties())
    {
        value = JRPropertiesUtil.getOwnProperty(dataset, propName);
    }

    if (paramName != null && parameterValues.containsKey(paramName))//FIXMEDATAADAPTER should we fallback to prop name used as param name?
    {
        value = (String) parameterValues.get(paramName);
    }

    if (dataset != null)
    {
        JRParameter[] parameters = dataset.getParameters();
        if (parameters != null)
        {
            for (JRParameter parameter : parameters)
            {
                if (
                    parameter.hasProperties()
                    && parameter.getPropertiesMap().containsProperty(propName) 
                    && parameterValues.containsKey(parameter.getName()) 
                    )
                {
                    value = (String)parameterValues.get(parameter.getName());
                }
            }
        }
    }

    return value;
}
项目:jasperreports    文件:JRBaseReport.java   
/**
 * Constructs a copy of a report.
 */
public JRBaseReport(JRReport report, JRBaseObjectFactory factory)
{
    /*   */
    name = report.getName();
    language = report.getLanguage();
    columnCount = report.getColumnCount();
    printOrderValue = report.getPrintOrderValue();
    columnDirection = report.getColumnDirection();
    pageWidth = report.getPageWidth();
    pageHeight = report.getPageHeight();
    orientationValue = report.getOrientationValue();
    whenNoDataTypeValue = report.getWhenNoDataTypeValue();
    sectionType = report.getSectionType();
    columnWidth = report.getColumnWidth();
    columnSpacing = report.getColumnSpacing();
    leftMargin = report.getLeftMargin();
    rightMargin = report.getRightMargin();
    topMargin = report.getTopMargin();
    bottomMargin = report.getBottomMargin();
    isTitleNewPage = report.isTitleNewPage();
    isSummaryNewPage = report.isSummaryNewPage();
    isSummaryWithPageHeaderAndFooter = report.isSummaryWithPageHeaderAndFooter();
    isFloatColumnFooter = report.isFloatColumnFooter();
    ignorePagination = report.isIgnorePagination();

    formatFactoryClass = report.getFormatFactoryClass();

    /*   */
    String[] imports = report.getImports();
    if (imports != null && imports.length > 0)
    {
        importsSet = new HashSet<String>(imports.length);
        importsSet.addAll(Arrays.asList(imports));
    }

    /*   */
    factory.setDefaultStyleProvider(this);

    copyTemplates(report, factory);

    /*   */
    defaultStyle = factory.getStyle(report.getDefaultStyle());

    /*   */
    JRStyle[] jrStyles = report.getStyles();
    if (jrStyles != null && jrStyles.length > 0)
    {
        styles = new JRStyle[jrStyles.length];
        for(int i = 0; i < styles.length; i++)
        {
            styles[i] = factory.getStyle(jrStyles[i]);
        }
    }

    mainDataset = factory.getDataset(report.getMainDataset());

    JRDataset[] datasetArray = report.getDatasets();
    if (datasetArray != null && datasetArray.length > 0)
    {
        datasets = new JRDataset[datasetArray.length];
        for (int i = 0; i < datasets.length; i++)
        {
            datasets[i] = factory.getDataset(datasetArray[i]);
        }
    }

    background = factory.getBand(report.getBackground());
    title = factory.getBand(report.getTitle());
    pageHeader = factory.getBand(report.getPageHeader());
    columnHeader = factory.getBand(report.getColumnHeader());
    detailSection = factory.getSection(report.getDetailSection());
    columnFooter = factory.getBand(report.getColumnFooter());
    pageFooter = factory.getBand(report.getPageFooter());
    lastPageFooter = factory.getBand(report.getLastPageFooter());
    summary = factory.getBand(report.getSummary());
    noData = factory.getBand(report.getNoData());
}
项目:jasperreports    文件:JRBaseObjectFactory.java   
public JRBaseDataset getDataset(JRDataset dataset)
{
    JRBaseDataset baseDataset = null;

    if (dataset != null)
    {
        baseDataset = (JRBaseDataset)get(dataset);
        if (baseDataset == null)
        {
            baseDataset = new JRBaseDataset(dataset, this);
        }
    }

    return baseDataset;
}
项目:jasperreports    文件:JsonQueryExecuter.java   
/**
 * 
 */
public JsonQueryExecuter(
    JasperReportsContext jasperReportsContext,
    JRDataset dataset, 
    Map<String, ? extends JRValueParameter> parametersMap
    )
{
    super(jasperReportsContext, dataset, parametersMap);
}
项目:jasperreports    文件:JRXlsxQueryExecuterFactory.java   
@Override
public JRQueryExecuter createQueryExecuter(
    JasperReportsContext jasperReportsContext,
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parameters
    ) throws JRException 
{
    return new JRXlsxQueryExecuter(jasperReportsContext, dataset, parameters);
}
项目:jasperreports    文件:JRXPathQueryExecuterFactory.java   
@Override
public JRQueryExecuter createQueryExecuter(
    JasperReportsContext jasperReportsContext, 
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parameters
    ) throws JRException
{
    return new JRXPathQueryExecuter(jasperReportsContext, dataset, parameters);
}
项目:jasperreports    文件:JRJpaQueryExecuterFactory.java   
@Override
public JRQueryExecuter createQueryExecuter(
    JasperReportsContext jasperReportsContext,
    JRDataset dataset, 
    Map<String,? extends JRValueParameter> parameters
    ) throws JRException 
{
    return new JRJpaQueryExecuter(jasperReportsContext, dataset, parameters);
}