当前位置: 首页>>代码示例>>Java>>正文


Java JRDesignField.setValueClassName方法代码示例

本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignField.setValueClassName方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignField.setValueClassName方法的具体用法?Java JRDesignField.setValueClassName怎么用?Java JRDesignField.setValueClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jasperreports.engine.design.JRDesignField的用法示例。


在下文中一共展示了JRDesignField.setValueClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPropertyValue

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public void setPropertyValue(Object id, Object value) {
	JRDesignField jrField = (JRDesignField) getValue();
	if (id.equals(JRDesignParameter.PROPERTY_NAME)) {
		if (!value.equals("")) {
			jrField.setName((String) value);
		}
	} else if (id.equals(JRDesignParameter.PROPERTY_VALUE_CLASS_NAME)){
		jrField.setValueClassName((String) value);
	}
	else if (id.equals(JRDesignParameter.PROPERTY_DESCRIPTION)){
		jrField.setDescription((String) value);
	}
	else if (id.equals(PROPERTY_MAP)) {
		JRPropertiesMap v = (JRPropertiesMap) value;
		String[] names = jrField.getPropertiesMap().getPropertyNames();
		for (int i = 0; i < names.length; i++) {
			jrField.getPropertiesMap().removeProperty(names[i]);
		}
		names = v.getPropertyNames();
		for (int i = 0; i < names.length; i++)
			jrField.getPropertiesMap().setProperty(names[i], v.getProperty(names[i]));
		this.getPropertyChangeSupport().firePropertyChange(PROPERTY_MAP, false, true);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:25,代码来源:MField.java

示例2: getFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Vector getFields(Object obj)
{
    
    Vector fields = new Vector();
    java.beans.PropertyDescriptor[] pd = org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(obj.getClass());
    for (int nd =0; nd < pd.length; ++nd)
    {
               String fieldName = pd[nd].getName();
               if (pd[nd].getPropertyType() != null && pd[nd].getReadMethod() != null)
               {
                   String returnType =  pd[nd].getPropertyType().getName();
                   JRDesignField field = new JRDesignField();
                   field.setName(fieldName);
                   field.setValueClassName(Misc.getJRFieldType(returnType));
                   //field.setDescription(""); //Field returned by " +methods[i].getName() + " (real type: "+ returnType +")");
                   fields.addElement(field);
               }
    }
    
    return fields;
    
    
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:25,代码来源:EJBQLFieldsReader.java

示例3: createField

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public JRDesignField createField(Object obj, int pos)
{
    String fieldName = "COLUMN_" + (pos+1);
    if (pos < 0)
    {
        fieldName = obj.getClass().getName();
        if (fieldName.indexOf(".") > 0)
        {
            fieldName = fieldName.substring(fieldName.indexOf(".")+1);
        }
        if (fieldName.length() == 0) fieldName = "COLUMN_1";
    }
    JRDesignField field = new JRDesignField();
    field.setName(fieldName);
    field.setValueClassName(obj.getClass().getName());
    //field.setDescription("");
    
    return field;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:20,代码来源:EJBQLFieldsReader.java

示例4: readFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> readFields(String query) throws Exception {
    
    List<JRDesignField> fields = new ArrayList<JRDesignField>();

    Vector names = getColumnNames();

    for (int nd =0; nd < names.size(); ++nd) {
        String fieldName = ""+names.elementAt(nd);
        JRDesignField field = new JRDesignField();
        field.setName(fieldName);
        field.setValueClassName("java.lang.String");
        //field.setDescription(null); //Field returned by " +methods[i].getName() + " (real type: "+ returnType +")");
        fields.add(field);
    }
    return  fields;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:17,代码来源:JRCSVDataSourceConnection.java

示例5: readFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> readFields(String query) throws Exception {

        List<JRDesignField> fields = new ArrayList<JRDesignField>();
        List<String> names = getColumnNames();

        for (int nd =0; nd < names.size(); ++nd) {
            String fieldName = ""+names.get(nd);
            JRDesignField field = new JRDesignField();
            field.setName(fieldName);
            field.setValueClassName("java.lang.String");
            //field.setDescription(""); //Field returned by " +methods[i].getName() + " (real type: "+ returnType +")");
            fields.add(field);
        }

        return fields;
    }
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:17,代码来源:JRXlsDataSourceConnection.java

示例6: getFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
/**
 * @see net.sf.jasperreports.engine.JRDataSourceProvider#getFields(net.sf.jasperreports.engine.JasperReport)
 */
@Override
public JRField[] getFields(JasperReport report) throws JRException {
	BeanInfo beanInfo = null;

	try {
		beanInfo = Introspector.getBeanInfo(beanClass);
	} catch (IntrospectionException e) {
		throw new JRException(e);
	}

	PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
	if(descriptors != null) 
	{
		ArrayList<JRField> fields = new ArrayList<JRField>(descriptors.length);
		
		for (int i = 0; i < descriptors.length; i++) {
			PropertyDescriptor descriptor = descriptors[i];
			
			if (!(descriptor instanceof IndexedPropertyDescriptor) && descriptor.getReadMethod() != null) 
			{
				JRDesignField field = new JRDesignField();
				field.setValueClassName(normalizeClass(descriptor.getPropertyType()).getCanonicalName());
				field.setName(descriptor.getName());
				
				fields.add(field);
			}
		}

		return fields.toArray(new JRField[fields.size()]);
	}

	return new JRField[0];
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:37,代码来源:JRAbstractBeanDataSourceProvider.java

示例7: createObject

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Override
public Object createObject(Attributes atts)
{
	JRDesignField field = new JRDesignField();
	
	field.setName(atts.getValue(JRXmlConstants.ATTRIBUTE_name));

	if (atts.getValue(JRXmlConstants.ATTRIBUTE_class) != null)
	{
		field.setValueClassName(atts.getValue(JRXmlConstants.ATTRIBUTE_class));
	}

	return field;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:15,代码来源:JRFieldFactory.java

示例8: getFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset reportDataset) throws JRException, UnsupportedOperationException {
	jrdsp = ((DataSourceProviderDataAdapterService) con).getProvider();
	if (jrdsp != null) {
		JasperReport jr = null;
		try {
			IFile file = (IFile) jConfig.get(FileUtils.KEY_FILE);
			if (file != null && file.exists()) {
				JasperReportCompiler compiler = new JasperReportCompiler();
				jr = compiler.compileReport(jConfig, file);
			}
		} catch (CoreException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		JRField[] aray = jrdsp.getFields(jr);
		if (aray != null) {
			List<JRDesignField> fields = new ArrayList<JRDesignField>();
			for (JRField f : aray) {
				if (f instanceof JRDesignField)
					fields.add((JRDesignField) f);
				else {
					JRDesignField jdf = new JRDesignField();
					jdf.setName(StringUtils.xmlEncode(f.getName(), null));
					jdf.setValueClassName(f.getValueClassName());
					jdf.setDescription(StringUtils.xmlEncode(f.getDescription(), null));
					fields.add(jdf);
				}
			}
			return fields;
		}
	}
	return new ArrayList<JRDesignField>();
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:35,代码来源:JRDSProviderFieldsProvider.java

示例9: addField

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private static void addField(String name, String description, String type, Map<String, JRDesignField> fieldsMap) {
	JRDesignField f = new JRDesignField();
	f.setName(name);
	f.setDescription(description);

	f.setValueClassName(type);

	fieldsMap.put(name, f);
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:10,代码来源:OlapFieldsProviderSupport.java

示例10: getFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Override
public JRField[] getFields(IReportConnection con, JRDataset reportDataset, Map parameters) throws JRException, UnsupportedOperationException {
    /**
         * Copyright (C) 2006 CINCOM SYSTEMS, INC.
         * All Rights Reserved
         * www.cincom.com
         */
        if (con instanceof JRXMLADataSourceConnection)
        {
            try {
                String query = reportDataset.getQuery().getText();
               
                 java.util.ArrayList v_fields = getFields(query, (JRXMLADataSourceConnection)con);
               
                 // Translate 
                JRField[] final_fields = new JRField[v_fields.size()];
                for (int i=0; i<v_fields.size(); ++i)
                {
                    XmlaFieldNode f = (XmlaFieldNode)v_fields.get(i);
                    JRDesignField field = new JRDesignField();
                    field.setName( f.getName() );
                    field.setValueClassName( f.getValueClassName() );
                    field.setDescription( f.getDescription() );
                    final_fields[i] = field;
                }

                return final_fields;
            
                 
            } catch (Exception ex)
            {
                throw new JRException(ex);
            }
        }
        else
        {
                 throw new JRException("The active connection is not of type XMLA. Activate an XMLA connection first.");
        }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:40,代码来源:CincomMDXFieldsProvider.java

示例11: jButton2ActionPerformed1

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void jButton2ActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed1
    IReportConnection conn = IReportManager.getInstance().getDefaultConnection();
    if (conn == null || !(conn instanceof JRCSVDataSourceConnection)) {
        setColumnsError( I18n.getString("ReportQueryDialog.Message.Error4") );
        return;
    }
    else
    {
        JRCSVDataSourceConnection ic = (JRCSVDataSourceConnection)conn;
        try {
            Vector names = ic.getColumnNames();
            DefaultTableModel dtm = (DefaultTableModel)jTableFields.getModel();
            dtm.setRowCount(0);
        
            for (int nd =0; nd < names.size(); ++nd) {
                String fieldName = ""+names.elementAt(nd);
                JRDesignField field = new JRDesignField();
                field.setName(fieldName);
                field.setValueClassName("java.lang.String");
                //field.setDescription(null); //Field returned by " +methods[i].getName() + " (real type: "+ returnType +")");
                
                Vector row = new Vector();
                row.addElement(field);
                row.addElement(field.getValueClassName());
                row.addElement(field.getDescription());
                dtm.addRow(row);
            }
            jTableFields.setRowSelectionInterval(0, names.size()-1);
        } catch (Exception ex)
        {
            setColumnsError( "" + ex.getMessage() );
        
        }
    }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:37,代码来源:ReportQueryDialog.java

示例12: readFields

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> readFields(String query) throws Exception {
    List<JRDesignField> fields = new ArrayList<JRDesignField>();

    try {

        InputStream is = getClass().getResourceAsStream("/com/jaspersoft/ireport/designer/data/data.jrxml");
        JasperDesign dataJd = net.sf.jasperreports.engine.xml.JRXmlLoader.load(is);

        // Remove fields...
        dataJd.getFieldsList().clear(); // This would not be legal...
        dataJd.getFieldsMap().clear();

        JasperReport jr = JasperCompileManager.compileReport(dataJd);

        net.sf.jasperreports.engine.JRField[] jrfields = getDataSourceProvider().getFields( jr );

        for (int i=0; i< jrfields.length; ++i)
        {
            JRDesignField field = new JRDesignField();
            field.setName( jrfields[i].getName());
            field.setDescription( jrfields[i].getDescription());
            field.setValueClassName( jrfields[i].getValueClassName());
            field.setValueClass( jrfields[i].getValueClass());
            ModelUtils.replacePropertiesMap( jrfields[i].getPropertiesMap(), field.getPropertiesMap());
            fields.add(field);
        }
    } catch (Exception ex)
    {}

    return fields;
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:32,代码来源:JRDataSourceProviderConnection.java

示例13: getTemplate

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public byte[] getTemplate(){
		try{
//			design.remadgetFields().
			design.getFieldsList().clear();
			design.getParametersList().clear();
            design.getFieldsMap().clear();
            design.getParametersMap().clear();
            for (JasperReportFieldDto field : fields) {
				if (field.isEmpty()){
					continue;
				}
				JRDesignField f = new JRDesignField();
				f.setValueClassName(field.getTypeAsString());
				f.setValueClass(Class.forName(field.getTypeAsString()));
				f.setName(field.getName());
				design.addField(f);
			}

			for (JasperReportParameterDto param : parameters) {
				if (param.isEmpty()) {
					continue;
				}
				JRDesignParameter p = new JRDesignParameter();
				p.setValueClassName(param.getTypeAsString());
				p.setValueClass(Class.forName(param.getTypeAsString()));
				p.setName(param.getName());
				p.setForPrompting(param.isForPrompting());
				p.setDescription(param.getDescription());
				p.setNestedTypeName(param.getNestedTypeAsString());
				p.setNestedType(param.getNestedType());
				p.getPropertiesMap().setBaseProperties(param.getJRProperties());
				//			p.getPropertiesMap().setProperty(propName, value);
				design.addParameter(p);
			}

			JasperDesign oldDesign = ReportTypeUtil.loadJasperDesign(jasperReportXml);
			oldDesign.getParametersList().clear();
			oldDesign.getParametersList().addAll(design.getParametersList());

			oldDesign.getFieldsList().clear();
			oldDesign.getFieldsList().addAll(design.getFieldsList());

			JRDesignQuery q = new JRDesignQuery();
			q.setLanguage("mql");
			q.setText(query);
			oldDesign.setQuery(q);

			String reportAsString = JRXmlWriter.writeReport(oldDesign, "UTF-8");
			return Base64.encodeBase64(reportAsString.getBytes("UTF-8"));

		} catch (JRException | ClassNotFoundException | SchemaException | UnsupportedEncodingException ex) {
			throw new IllegalStateException(ex.getMessage(), ex.getCause());
		}
		
	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:56,代码来源:JasperReportDto.java

示例14: jButton1ActionPerformed

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    if (jTextFieldName.getText().length() == 0)
    {
        JOptionPane.showMessageDialog(this, 
                //I18n.getString("message.olapBrowser.notValidFieldName",
                I18n.getString("OlapBrowser.Message.Error"),
                I18n.getString("OlapBrowser.Message.Error2"), JOptionPane.ERROR_MESSAGE);
        return;
        
    }
    if (jTextFieldExpression.getText().length() == 0)
    {
        JOptionPane.showMessageDialog(this,
                //I18n.getString("message.olapBrowser.notValidFieldExpression",
                I18n.getString("OlapBrowser.Message.Error3"),
                I18n.getString("OlapBrowser.Message.Error2"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    JRDesignField field = new JRDesignField();
    field.setName(jTextFieldName.getText().trim() );
    field.setValueClassName(""+((Tag)jComboBoxType.getSelectedItem()).getValue());
    field.setDescription( jTextFieldExpression.getText() );
    
   /*  
    try
    {
            MappingLexer lexer = new MappingLexer(new StringReader(jTextFieldExpression.getText()));
            
            //MappingParser parser = new MappingParser(lexer);
            //parser.setMappingMetadata(this);
            parser.mapping();
    }
    catch (Exception e)
    {
        JOptionPane.showMessageDialog(this,"Field expression not valid:\n" + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    */                
    
    
    if (fieldAlreadyExists(field))
    {
        JOptionPane.showMessageDialog(this,
                //I18n.getString("message.olapBrowser.fieldDuplicated",
                I18n.getString("OlapBrowser.Message.Warning"), 
                I18n.getString("OlapBrowser.Message.Error2"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    Vector row = new Vector();
    row.addElement(field);
    row.addElement(field.getValueClassName());
    row.addElement(field.getDescription());
    
    DefaultTableModel dtm = (DefaultTableModel)getJTableFields().getModel();
    dtm.addRow(row);
    getJTableFields().getSelectionModel().addSelectionInterval( getJTableFields().getRowCount()-1, getJTableFields().getRowCount()-1 );
        
    
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:64,代码来源:OlapBrowser.java

示例15: jButton2ActionPerformed

import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

    DefaultTableModel dtm = (DefaultTableModel)getJTableFields().getModel();
     
    TreePath[] paths = jTree1.getSelectionPaths();
    if (paths == null) return;
    for (int i=0; i<paths.length; ++i)
    {
        boolean valid = true;
        TreePath tp = paths[i];

        TreeJRField tjrf =  (TreeJRField)((DefaultMutableTreeNode)tp.getLastPathComponent()).getUserObject();
        String returnType =  Misc.getJRFieldType( tjrf.getObj().getName() );
        
        JRDesignField field = new JRDesignField();
        field.setName(tjrf.getField().getName());
        field.setValueClassName(returnType);
        
        field.setDescription(tjrf.getField().getDescription() );
        Vector row = new Vector();
        row.addElement(field);
        row.addElement(field.getValueClassName());
        row.addElement(field.getDescription());
        
        if (isComboVisible() && jComboBox1.getSelectedItem() instanceof FieldClassWrapper)
        {
            FieldClassWrapper cw = (FieldClassWrapper)jComboBox1.getSelectedItem();
            field.setName( cw.getFieldName() + "." + field.getDescription()   );
            field.setDescription( field.getName() );
        }

        // Check for duplicates fields...
        boolean found = fieldAlreadyExists(field);
        String baseName = field.getName();
        for (int j=1; isPathOnDescription() && found; ++j)
        {
                field.setName(  baseName + "_" + j);
                found = fieldAlreadyExists(field);
        }
        
        if (!found)
        {
            dtm.addRow(row);
            getJTableFields().getSelectionModel().addSelectionInterval( getJTableFields().getRowCount()-1, getJTableFields().getRowCount()-1 );
        }
    }
}
 
开发者ID:JockiHendry,项目名称:ireport-fork,代码行数:49,代码来源:BeanInspectorPanel.java


注:本文中的net.sf.jasperreports.engine.design.JRDesignField.setValueClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。