本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignField.setName方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignField.setName方法的具体用法?Java JRDesignField.setName怎么用?Java JRDesignField.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.design.JRDesignField
的用法示例。
在下文中一共展示了JRDesignField.setName方法的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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例6: testDatasourceWithNoFilters
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Test
public void testDatasourceWithNoFilters() throws JRException {
JRDataSource dataSource = new ResourceQueryCommand().executeCommand(getCommand());
assertNotNull(dataSource);
assertTrue(dataSource.next());
JRDesignField pathField = new JRDesignField();
pathField.setName("path");
String pathVal = (String) dataSource.getFieldValue(pathField);
assertNotNull(pathVal);
assertTrue(String.format("Path does not match: %s", pathVal), pathVal.matches(".*src/test/resources/share/rrd/snmp/10/nsVpnMonitor/tun_id_1"));
JRDesignField filterField = new JRDesignField();
filterField.setName("icmp");
String val = (String) dataSource.getFieldValue(filterField);
assertNull(val);
}
示例7: testDatasourceWithFilters
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Test
public void testDatasourceWithFilters() throws JRException {
JRDataSource dataSource = new ResourceQueryCommand().executeCommand(getCommandWithFilter());
assertNotNull(dataSource);
assertTrue(dataSource.next());
JRDesignField pathField = new JRDesignField();
pathField.setName("path");
assertNotNull("", dataSource.getFieldValue(pathField));
JRDesignField filterField = new JRDesignField();
filterField.setName("nsVpnMonBytesIn");
String dsFieldValue = (String) dataSource.getFieldValue(filterField);
assertNotNull(dsFieldValue);
assertTrue(dsFieldValue.matches(".*src/test/resources/share/rrd/snmp/10/nsVpnMonitor/tun_id_1/nsVpnMonBytesIn.jrb"));
}
示例8: testDatasourceWithNoFilters
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Test
public void testDatasourceWithNoFilters() throws JRException {
JRDataSource dataSource = new ResourceQueryCommand().executeCommand(getCommand());
assertNotNull(dataSource);
assertTrue(dataSource.next());
JRDesignField pathField = new JRDesignField();
pathField.setName("path");
String pathVal = (String) dataSource.getFieldValue(pathField);
assertNotNull("", pathVal);
assertTrue(pathVal.matches(".*src/test/resources/share/rrd/snmp/10/nsVpnMonitor/tun_id_1"));
JRDesignField filterField = new JRDesignField();
filterField.setName("icmp");
String val = (String) dataSource.getFieldValue(filterField);
assertNull(val);
}
示例9: addFieldValue
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private void addFieldValue(GridColumnVO columnVO) throws JRException {
JRDesignBand bDetalle = (JRDesignBand) jasperDesign.getDetailSection().getBands()[0];
JRDesignField f = new JRDesignField();
f.setName(columnVO.getDbName());
f.setValueClass(columnVO.getFieldClass());
jasperDesign.addField(f);
JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
chunk.setText(columnVO.getDbName());
chunk.setType(JRDesignExpressionChunk.TYPE_FIELD);
JRDesignExpression expression = new JRDesignExpression();
expression.addChunk(chunk);
JRDesignTextField textField = new JRDesignTextField();
textField.setWidth(columnVO.getWidth());
textField.setHeight(bDetalle.getHeight());
textField.setX(px);
textField.setExpression(expression);
textField.setBlankWhenNull(true);
textField.setFontName(gridReportVO.getDetailBandStyle().getFontName());
textField.setFontSize(new Float(gridReportVO.getDetailBandStyle().getFontSize()));
textField.setForecolor(gridReportVO.getDetailBandStyle().getForeColor());
textField.setBold(gridReportVO.getDetailBandStyle().isBold());
textField.setItalic(gridReportVO.getDetailBandStyle().isItalic());
textField.setUnderline(gridReportVO.getDetailBandStyle().isUnderline());
textField.setStretchWithOverflow(true);
textField.setStretchType(StretchTypeEnum.RELATIVE_TO_TALLEST_OBJECT);
bDetalle.addElement(textField);
}
示例10: 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];
}
示例11: 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;
}
示例12: getFields
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> getFields(
JasperReportsContext context, JRDataset dataset,
Map<String, Object> parameters, ESSearch connection)
throws JRException {
logger.debug("Providing fields a query.");
String query = "{ query: { match_all: {} } }";
if ( dataset.getQuery() != null ) {
query = dataset.getQuery().getText();
}
logger.debug("Passing query to connection: " + query);
connection.setSearch(query);
Map<String, Class<?>> queryFields = connection.getFields(query);
List<JRDesignField> fields = new ArrayList<JRDesignField>();
for (String fieldName: queryFields.keySet() ) {
JRDesignField field = new JRDesignField();
field.setName(fieldName);
field.setValueClass(queryFields.get(fieldName));
field.setDescription(fieldName);
fields.add(field);
}
return fields;
}
示例13: getFields
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset reportDataset) throws JRException, UnsupportedOperationException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("REPORT_PARAMETERS_MAP", new HashMap<String, Object>());
con.contributeParameters(parameters);
ParameterUtil.setParameters(jConfig, reportDataset, parameters);
parameters.put(JRParameter.REPORT_MAX_COUNT, 2);
ExcelDataSource ds = null;
ExcelDataAdapter da = (ExcelDataAdapter) ((AbstractDataAdapterService) con).getDataAdapter();
if (da.isQueryExecuterMode()) {
ExcelQueryExecuter qe = (ExcelQueryExecuter) new ExcelQueryExecuterFactory().createQueryExecuter(jConfig, reportDataset, ParameterUtil.convertMap(parameters, reportDataset));
ds = (ExcelDataSource) qe.createDatasource();
} else {
ds = (ExcelDataSource) parameters.get(JRParameter.REPORT_DATA_SOURCE);
}
if (ds != null) {
ds.setUseFirstRowAsHeader(da.isUseFirstRowAsHeader());
ds.next();
Map<String, Integer> map = ds.getColumnNames();
List<JRDesignField> columns = new ArrayList<JRDesignField>(map.keySet().size());
for (String key : map.keySet()) {
JRDesignField field = new JRDesignField();
field.setName(StringUtils.xmlEncode(key, null));
field.setValueClass(String.class);
columns.add(field);
}
return columns;
}
return null;
}
示例14: getFields
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
public List<JRDesignField> getFields(DataAdapterService con, JasperReportsConfiguration jConfig, JRDataset reportDataset) throws JRException, UnsupportedOperationException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("REPORT_PARAMETERS_MAP", new HashMap<String, Object>());
con.contributeParameters(parameters);
ParameterUtil.setParameters(jConfig, reportDataset, parameters);
parameters.put(JRParameter.REPORT_MAX_COUNT, 2);
JRXlsDataSource ds = null;
XlsDataAdapter da = (XlsDataAdapter) ((AbstractDataAdapterService) con).getDataAdapter();
if (da.isQueryExecuterMode()) {
JRXlsQueryExecuter qe = (JRXlsQueryExecuter) new JRXlsQueryExecuterFactory().createQueryExecuter(jConfig, reportDataset, ParameterUtil.convertMap(parameters, reportDataset));
ds = (JRXlsDataSource) qe.createDatasource();
} else {
ds = (JRXlsDataSource) parameters.get(JRParameter.REPORT_DATA_SOURCE);
}
if (ds != null) {
ds.setUseFirstRowAsHeader(da.isUseFirstRowAsHeader());
ds.next();
Map<String, Integer> map = ds.getColumnNames();
List<JRDesignField> columns = new ArrayList<JRDesignField>(map.keySet().size());
for (String key : map.keySet()) {
JRDesignField field = new JRDesignField();
field.setName(StringUtils.xmlEncode(key, null));
field.setValueClass(String.class);
columns.add(field);
}
return columns;
}
return null;
}
示例15: getFieldsFromObjectNode
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private List<JRDesignField> getFieldsFromObjectNode(ObjectNode node){
List<JRDesignField> fields = new ArrayList<JRDesignField>();
Iterator<String> fieldNames = node.fieldNames();
while(fieldNames.hasNext()){
String name = fieldNames.next();
JRDesignField f=new JRDesignField();
f.setName(ModelUtils.getNameForField(fields, name));
f.setDescription(name);
f.setValueClass(String.class);
fields.add(f);
}
return fields;
}