Search in sources :

Example 1 with JRDesignField

use of net.sf.jasperreports.engine.design.JRDesignField in project opennms by OpenNMS.

the class JRobinFieldsProvider method addStepField.

private void addStepField(List<JRField> fields) {
    JRDesignField field = new JRDesignField();
    field.setName("Step");
    field.setDescription("Step");
    field.setValueClass(Integer.class);
    fields.add(field);
}
Also used : JRDesignField(net.sf.jasperreports.engine.design.JRDesignField)

Example 2 with JRDesignField

use of net.sf.jasperreports.engine.design.JRDesignField in project opennms by OpenNMS.

the class JRobinFieldsProvider method getFields.

public JRField[] getFields(IReportConnection irConn, JRDataset reportDataset, Map parameters) throws JRException, UnsupportedOperationException {
    String query = "";
    if (reportDataset.getQuery() == null || reportDataset.getQuery().getText() == null || reportDataset.getQuery().getText().length() == 0) {
        return new JRField[0];
    }
    List<JRField> fields = new ArrayList<JRField>();
    //Add timestamp field
    addTimestampField(fields);
    query = reportDataset.getQuery().getText();
    if (query.contains("--step")) {
        addStepField(fields);
    }
    Matcher matcher = m_pattern.matcher(query);
    boolean matchFound = matcher.find();
    int i = 0;
    while (matchFound) {
        JRDesignField field = new JRDesignField();
        String fieldName = matcher.group();
        if (fieldName.contains(":")) {
            String[] split = fieldName.split(":");
            fieldName = split[split.length - 1];
        }
        field.setName(fieldName);
        field.setValueClass(Double.class);
        field.setDescription(fieldName);
        fields.add(field);
        matchFound = matcher.find();
        i++;
    }
    System.out.println("match count: " + matcher.groupCount());
    return fields.toArray(new JRField[fields.size()]);
}
Also used : JRField(net.sf.jasperreports.engine.JRField) Matcher(java.util.regex.Matcher) ArrayList(java.util.ArrayList) JRDesignField(net.sf.jasperreports.engine.design.JRDesignField)

Example 3 with JRDesignField

use of net.sf.jasperreports.engine.design.JRDesignField in project opennms by OpenNMS.

the class MeasurementDataSource method createField.

protected static JRField createField(String name, Class clazz) {
    final JRDesignField field = new JRDesignField();
    field.setValueClass(clazz);
    field.setName(name);
    return field;
}
Also used : JRDesignField(net.sf.jasperreports.engine.design.JRDesignField)

Example 4 with JRDesignField

use of net.sf.jasperreports.engine.design.JRDesignField in project opennms by OpenNMS.

the class JRobinFieldsProvider method addTimestampField.

private void addTimestampField(List<JRField> fields) {
    JRDesignField field = new JRDesignField();
    field.setName("Timestamp");
    field.setDescription("Timestamp");
    field.setValueClass(Date.class);
    fields.add(field);
}
Also used : JRDesignField(net.sf.jasperreports.engine.design.JRDesignField)

Example 5 with JRDesignField

use of net.sf.jasperreports.engine.design.JRDesignField in project opennms by OpenNMS.

the class ResourceQueryFieldsProvider method addPathColumn.

private void addPathColumn(List<JRField> fields) {
    JRDesignField field = new JRDesignField();
    field.setName("Path");
    field.setDescription("Path");
    field.setValueClass(String.class);
    fields.add(field);
}
Also used : JRDesignField(net.sf.jasperreports.engine.design.JRDesignField)

Aggregations

JRDesignField (net.sf.jasperreports.engine.design.JRDesignField)7 ArrayList (java.util.ArrayList)2 JRField (net.sf.jasperreports.engine.JRField)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Matcher (java.util.regex.Matcher)1 JRException (net.sf.jasperreports.engine.JRException)1 JRDesignParameter (net.sf.jasperreports.engine.design.JRDesignParameter)1 JRDesignQuery (net.sf.jasperreports.engine.design.JRDesignQuery)1 JasperDesign (net.sf.jasperreports.engine.design.JasperDesign)1