本文整理汇总了Java中net.fortuna.ical4j.model.parameter.Related类的典型用法代码示例。如果您正苦于以下问题:Java Related类的具体用法?Java Related怎么用?Java Related使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Related类属于net.fortuna.ical4j.model.parameter包,在下文中一共展示了Related类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putJsonProperty
import net.fortuna.ical4j.model.parameter.Related; //导入依赖的package包/类
public void putJsonProperty(String propertyName, Object propertyValue) {
// This method is called when converting JSON to iCalendar
if ( JSON_VALUEDATATYPE.equals(propertyName) ) {
_trigger.getParameters().add(new Value((String)propertyValue));
}
else if ( JSON_RELATED.equals(propertyName) ) {
_trigger.getParameters().add(new Related((String)propertyValue));
}
else if ( JSON_VALUE.equals(propertyName) ) {
_trigger.setValue((String)propertyValue);
}
}
示例2: getTriggerDate
import net.fortuna.ical4j.model.parameter.Related; //导入依赖的package包/类
/**
* Return the date that a trigger refers to, which can be an absolute
* date or a date relative to the start or end time of a parent
* component (VEVENT/VTODO).
* @param trigger The trigger.
* @param parent The component.
* @return date of trigger.
*/
public static Date getTriggerDate(Trigger trigger, Component parent) {
if(trigger==null) {
return null;
}
// if its absolute then we are done
if(trigger.getDateTime()!=null) {
return trigger.getDateTime();
}
// otherwise we need a start date if VEVENT
DtStart start = (DtStart) parent.getProperty(Property.DTSTART);
if(start==null && parent instanceof VEvent) {
return null;
}
// is trigger relative to start or end
Related related = (Related) trigger.getParameter(Parameter.RELATED);
if(related==null || related.equals(Related.START)) {
// must have start date
if(start==null) {
return null;
}
// relative to start
return Dates.getInstance(trigger.getDuration().getTime(start.getDate()), start.getDate());
} else {
// relative to end
Date endDate = null;
// need an end date or duration or due
DtEnd end = (DtEnd) parent.getProperty(Property.DTEND);
if(end!=null) {
endDate = end.getDate();
}
if(endDate==null) {
Duration dur = (Duration) parent.getProperty(Property.DURATION);
if(dur!=null && start!=null) {
endDate= Dates.getInstance(dur.getDuration().getTime(start.getDate()), start.getDate());
}
}
if(endDate==null) {
Due due = (Due) parent.getProperty(Property.DUE);
if(due!=null) {
endDate = due.getDate();
}
}
// require end date
if(endDate==null) {
return null;
}
return Dates.getInstance(trigger.getDuration().getTime(endDate), endDate);
}
}