本文整理汇总了Java中net.sf.jasperreports.engine.design.JRDesignField.setValueClass方法的典型用法代码示例。如果您正苦于以下问题:Java JRDesignField.setValueClass方法的具体用法?Java JRDesignField.setValueClass怎么用?Java JRDesignField.setValueClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.design.JRDesignField
的用法示例。
在下文中一共展示了JRDesignField.setValueClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: addNewField
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private void addNewField(String nodeName,
LinkedHashMap<String, JRDesignField> fieldsMap, Node item, String prefix) {
JRDesignField f = new JRDesignField();
f.setName(ModelUtils.getNameForField(
new ArrayList<JRDesignField>(fieldsMap.values()), nodeName));
f.setValueClass(String.class);
if (item.getNodeType() == Node.ATTRIBUTE_NODE) {
f.setDescription(prefix + "@" + item.getNodeName()); //$NON-NLS-1$
} else {
f.setDescription(prefix + item.getNodeName());
}
fieldsMap.put(nodeName, f);
}
示例7: getAdapter
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Override
public Object getAdapter(Class adapter) {
if(adapter==JRDesignField.class || adapter==JRField.class){
JRDesignField field=new JRDesignField();
field.setName(nodeText);
field.setDescription(expression);
field.setValueClass(String.class);
return field;
}
return super.getAdapter(adapter);
}
示例8: getAdapter
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
@Override
public Object getAdapter(Class adapter) {
if(adapter==JRDesignField.class || adapter==JRField.class){
JRDesignField field=new JRDesignField();
field.setName(nodeName);
field.setDescription(xpathExpression);
field.setValueClass(String.class);
return field;
}
return super.getAdapter(adapter);
}
示例9: createField
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private static JRDesignField createField(String fieldName, Class<?> _class) {
JRDesignField field = new JRDesignField();
field.setName(fieldName);
field.setValueClass(_class);
field.setDescription(null);
return field;
}
示例10: 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;
}
示例11: addReportFieldsFor
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
/**
* Determines from the {@link Class} of a {@link ReportInfo} instance what {@link Field}s attached to it are
* qualified as {@link JRDesignParameter}s to add to your {@link JasperDesign}
*
* @param report the {@link ReportInfo} instance representing the report
* @param designObj the {@link JasperDesign} instance to add parameters to
*/
protected void addReportFieldsFor(final ReportInfo report, final JasperDesign designObj) throws Exception {
final Class dataClass = findDataClassFor(report);
LOG.debug("Found data class "+ dataClass);
for (final Field field : dataClass.getDeclaredFields()) {
final JRDesignField designField = new JRDesignField();
LOG.debug("Adding field " + field.getName());
designField.setName(field.getName());
designField.setValueClass(field.getType());
designObj.addField(designField);
}
}
示例12: addPathColumn
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private void addPathColumn(List<JRField> fields) {
JRDesignField field = new JRDesignField();
field.setName("Path");
field.setDescription("Path");
field.setValueClass(String.class);
fields.add(field);
}
示例13: addStepField
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private void addStepField(List<JRField> fields) {
JRDesignField field = new JRDesignField();
field.setName("Step");
field.setDescription("Step");
field.setValueClass(Integer.class);
fields.add(field);
}
示例14: addTimestampField
import net.sf.jasperreports.engine.design.JRDesignField; //导入方法依赖的package包/类
private void addTimestampField(List<JRField> fields) {
JRDesignField field = new JRDesignField();
field.setName("Timestamp");
field.setDescription("Timestamp");
field.setValueClass(Date.class);
fields.add(field);
}
示例15: 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());
}
}