本文整理汇总了Java中net.sf.jasperreports.types.date.DateRange类的典型用法代码示例。如果您正苦于以下问题:Java DateRange类的具体用法?Java DateRange怎么用?Java DateRange使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DateRange类属于net.sf.jasperreports.types.date包,在下文中一共展示了DateRange类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInput
import net.sf.jasperreports.types.date.DateRange; //导入依赖的package包/类
@Override
public void createInput(Composite parent, final IParameter param, final Map<String, Object> params) {
super.createInput(parent, param, params);
Class<?> valueClass = param.getValueClass();
if (java.sql.Date.class.isAssignableFrom(valueClass)) {
createDate(parent, param, params);
} else if (java.sql.Time.class.isAssignableFrom(valueClass)) {
createTime(parent, param, params);
} else if (java.sql.Timestamp.class.isAssignableFrom(valueClass)
|| java.util.Date.class.isAssignableFrom(valueClass)) {
createTimestamp(parent, param, params);
} else if (TimestampRange.class.isAssignableFrom(valueClass))
createTimestampRange(parent, param, params);
else if (DateRange.class.isAssignableFrom(valueClass))
createDateRange(parent, param, params);
date.setToolTipText(VParameters.createToolTip(param));
date.addFocusListener(focusListener);
}
示例2: createInput
import net.sf.jasperreports.types.date.DateRange; //导入依赖的package包/类
@Override
public void createInput(Composite parent, IParameter param, Map<String, Object> params) {
if (param instanceof PResourceDescriptor) {
PResourceDescriptor p = (PResourceDescriptor) param;
ServerProfile sp = WSClientHelper.getServerProfile(p.getWsClient());
if (sp != null)
setSupportDateRange(sp.isSupportsDateRanges());
isNumeric = !p.getWsClient().isSupported(Feature.SEARCHREPOSITORY);
}
this.params = params;
this.param = param;
Class<?> valueClass = param.getValueClass();
if (java.sql.Date.class.isAssignableFrom(valueClass)) {
if (supportDateRange)
createDateRange(parent, param, params);
else
createDate(parent, param, params);
} else if (java.sql.Time.class.isAssignableFrom(valueClass)) {
createTime(parent, param, params);
} else if (java.sql.Timestamp.class.isAssignableFrom(valueClass) || java.util.Date.class.isAssignableFrom(valueClass)) {
if (supportDateRange)
createTimestampRange(parent, param, params);
else
createTimestamp(parent, param, params);
} else if (TimestampRange.class.isAssignableFrom(valueClass))
createTimestampRange(parent, param, params);
else if (DateRange.class.isAssignableFrom(valueClass))
createDateRange(parent, param, params);
date.setToolTipText(VParameters.createToolTip(param));
date.addFocusListener(focusListener);
}
示例3: updateInput
import net.sf.jasperreports.types.date.DateRange; //导入依赖的package包/类
public void updateInput() {
Object d = params.get(param.getName());
if (d != null) {
if (d instanceof String) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(date.getPattern());
sdf.parse((String) d);
} catch (ParseException e) {
e.printStackTrace();
}
}
if (d instanceof Date) {
date.setSelection((Date) d);
} else if (d instanceof Long) {
date.setSelection(new Date((Long) d));
isNumeric = true;
} else if (d instanceof DateRange) {
DateRange dr = (DateRange) d;
if (dr instanceof DateRangeExpression) {
String expr = ((DateRangeExpression) dr).getExpression();
if (expr != null) {
((DRDateTime) date).setText(expr);
return;
}
}
date.setSelection(dr.getStart());
}
} else {
date.setSelection(null);
}
}
示例4: publish
import net.sf.jasperreports.types.date.DateRange; //导入依赖的package包/类
public void publish(MReportUnit mrunit, IProgressMonitor monitor, JasperDesign jasper, JasperReportsConfiguration jrConfig) throws Exception {
ResourceDescriptor runit = mrunit.getValue();
for (JRParameter p : jasper.getParametersList()) {
if (p.isSystemDefined() || !p.isForPrompting())
continue;
ResourceDescriptor rd = MInputControl.createDescriptor(mrunit);
rd.setName(p.getName());
rd.setLabel(p.getName());
rd.setDescription(p.getDescription());
rd.setVisible(true);
rd.setReadOnly(false);
rd.setMandatory(false);
rd.setResourceProperty(ResourceDescriptor.PROP_INPUTCONTROL_TYPE, ResourceDescriptor.IC_TYPE_SINGLE_VALUE);
rd.setParentFolder(runit.getUriString() + "_files");
rd.setUriString(runit.getUriString() + "_files/" + rd.getName());
MInputControl mres = (MInputControl) ResourceFactory.getResource(mrunit, rd, -1);
if (Boolean.class.isAssignableFrom(p.getValueClass())) {
rd.setControlType(ResourceDescriptor.IC_TYPE_BOOLEAN);
} else if (String.class.isAssignableFrom(p.getValueClass())) {
addType(rd, mres, ResourceDescriptor.DT_TYPE_TEXT);
} else if (Timestamp.class.isAssignableFrom(p.getValueClass())) {
addType(rd, mres, ResourceDescriptor.DT_TYPE_DATE_TIME);
} else if (Date.class.isAssignableFrom(p.getValueClass())) {
addType(rd, mres, ResourceDescriptor.DT_TYPE_DATE);
} else if (TimestampRange.class.isAssignableFrom(p.getValueClass())) {
addType(rd, mres, ResourceDescriptor.DT_TYPE_DATE_TIME);
} else if (DateRange.class.isAssignableFrom(p.getValueClass())) {
addType(rd, mres, ResourceDescriptor.DT_TYPE_DATE);
} else if (Number.class.isAssignableFrom(p.getValueClass())) {
addType(rd, mres, ResourceDescriptor.DT_TYPE_NUMBER);
} else if (Collection.class.isAssignableFrom(p.getValueClass())) {
rd.setControlType(ResourceDescriptor.IC_TYPE_MULTI_SELECT_LIST_OF_VALUES);
ResourceDescriptor dt = new ResourceDescriptor();
dt.setWsType(ResourceDescriptor.TYPE_LOV);
dt.setName("lov_" + rd.getName());
dt.setLabel("lov_" + rd.getName());
dt.setIsNew(true);
dt.setParentFolder(rd.getUriString() + "_files");
dt.setUriString(dt.getParentFolder() + "/" + rd.getName());
List<ListItem> values = new ArrayList<ListItem>();
dt.setListOfValues(values);
rd.getChildren().add(dt);
} else {
mrunit.removeChild(mres);
continue;
}
mres.setPublishOptions(new PublishOptions());
PublishUtil.getResources(mrunit, monitor, jrConfig).add(mres);
}
}
示例5: isForType
import net.sf.jasperreports.types.date.DateRange; //导入依赖的package包/类
public boolean isForType(Class<?> valueClass) {
return Date.class.isAssignableFrom(valueClass) || DateRange.class.isAssignableFrom(valueClass);
}