本文整理汇总了Java中ro.nextreports.engine.queryexec.QueryParameter.getValueClassName方法的典型用法代码示例。如果您正苦于以下问题:Java QueryParameter.getValueClassName方法的具体用法?Java QueryParameter.getValueClassName怎么用?Java QueryParameter.getValueClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ro.nextreports.engine.queryexec.QueryParameter
的用法示例。
在下文中一共展示了QueryParameter.getValueClassName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueAt
import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
public Object getValueAt(int rowIndex, int columnIndex) {
QueryParameter row = (QueryParameter) elements.get(rowIndex);
switch (columnIndex) {
case 0:
return row.getName();
case 1:
return row.getValueClassName();
default:
return null;
}
}
示例2: getValueAt
import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
public Object getValueAt(int rowIndex, int columnIndex) {
QueryParameter row = (QueryParameter) elements.get(rowIndex);
switch (columnIndex) {
case 0:
return row.getName();
case 1:
return row.getValueClassName();
// case 2:
// return row.getDescription();
default:
return null;
}
}
示例3: isDateTime
import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
/**
* Test if a parameter has a date or time class name: Date, Time, Timestamp
* @param qp parameter
* @return true if a parameter has a date or time class name
*/
public static boolean isDateTime(QueryParameter qp) {
String className = qp.getValueClassName();
return className.equals(QueryParameter.DATE_VALUE) ||
className.equals(QueryParameter.TIME_VALUE) ||
className.equals(QueryParameter.TIMESTAMP_VALUE);
}
示例4: getParameterValue
import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
private Object getParameterValue(JComponent component, QueryParameter parameter) throws Exception {
Object value = null;
if (component instanceof JTextField) {
value = ((JTextField) component).getText();
if (value.equals("")) {
if (parameter.isMandatory()) {
throw new Exception("Value for parameter '" + parameter.getRuntimeName() + "' is not entered.");
} else {
value = null;
}
}
} else if (component instanceof JComboBox) {
JComboBox combo = (JComboBox) component;
if (combo.getSelectedIndex() == 0) {
if (parameter.isMandatory()) {
throw new Exception("Value for parameter '" + parameter.getRuntimeName() + "' is not selected.");
} else {
value = null;
}
} else {
value = combo.getSelectedItem();
}
} else if (component instanceof JList) {
value = ((JList) component).getSelectedValuesList();
if (((Object[]) value).length == 0) {
if (parameter.isMandatory()) {
throw new Exception("Value for parameter '" + parameter.getRuntimeName() + "' is not selected.");
} else {
value = new Object[]{NULL};
}
}
} else if (component instanceof JDateChooser) {
value = ((JDateChooser) component).getDate();
if (value == null) {
if (parameter.isMandatory()) {
throw new Exception("Value for parameter '" + parameter.getRuntimeName() + "' is not entered.");
}
}
} else if (component instanceof JCheckBox) {
value = ((JCheckBox) component).isSelected();
}
if (value == null) {
return value;
}
try {
if (QueryParameter.STRING_VALUE.equals(value.getClass().getName())) {
String className = parameter.getValueClassName();
value = ParameterUtil.getParameterValueFromString(className, (String)value);
}
} catch (Exception e) {
throw new Exception("Invalid parameter value " + value +
" for parameter '" + parameter.getRuntimeName() +
"' of type " + parameter.getValueClassName() + " .");
}
return value;
}
示例5: addUrlQueryParameters
import ro.nextreports.engine.queryexec.QueryParameter; //导入方法依赖的package包/类
public static void addUrlQueryParameters(Settings settings, Entity entity, Map<String, Object> allParameters, Map<String, Object> urlQueryParameters) throws Exception {
if ((urlQueryParameters == null) || (urlQueryParameters.size() == 0)) {
return;
}
ro.nextreports.engine.Report nextReport;
if (entity instanceof Chart) {
Chart chart = (Chart) entity;
nextReport = NextUtil.getNextReport(settings, chart);
} else {
Report report = (Report) entity;
nextReport = NextUtil.getNextReport(settings, report);
}
Map<String, QueryParameter> parameters = ParameterUtil.getUsedParametersMap(nextReport);
for (String key : urlQueryParameters.keySet()) {
Object value = urlQueryParameters.get(key);
QueryParameter parameter = parameters.get(key);
if (parameter == null) {
// mispelled inside embeddd code
continue;
}
String className = parameter.getValueClassName();
Object convertedValue;
// on Server Locale can be en_US, fr_FR or ro_RO (from internationalization)
// we must use a hardcoded one and this must be used when we pass Date parameters inside url
SimpleDateFormat sdf = new SimpleDateFormat("MM.dd.yyyy hh:mm", Locale.US);
if (value instanceof String) {
convertedValue = ParameterUtil.getParameterValueFromString(className, (String) value, sdf);
} else {
// multiple values
String[] values = (String[]) value;
Object[] convertedValues = new Object[values.length];
for (int i = 0, size = values.length; i < size; i++) {
convertedValues[i] = ParameterUtil.getParameterValueFromString(className, values[i], sdf);
}
convertedValue = convertedValues;
}
allParameters.put(key, convertedValue);
}
}