本文整理汇总了Java中net.fortuna.ical4j.model.parameter.Value类的典型用法代码示例。如果您正苦于以下问题:Java Value类的具体用法?Java Value怎么用?Java Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Value类属于net.fortuna.ical4j.model.parameter包,在下文中一共展示了Value类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRecurrenceDates
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
private DateList getRecurrenceDates(Component event) {
DateList l = null;
if(event==null) {
return null;
}
for (Object property : event.getProperties().getProperties(Property.RDATE)) {
RDate rdate = (RDate) property;
if(l==null) {
if(Value.DATE.equals(rdate.getParameter(Parameter.VALUE))) {
l = new DateList(Value.DATE);
}
else {
l = new DateList(Value.DATE_TIME, rdate.getDates().getTimeZone());
}
}
l.addAll(rdate.getDates());
}
return l;
}
示例2: ICalDate
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Constructs an <code>ICalDate</code> from an iCalendar date.
* @param date The date.
* @throws UnknownTimeZoneException - if something is wrong this exception is thrown.
*/
public ICalDate(Date date) throws UnknownTimeZoneException {
if (date instanceof DateTime) {
value = Value.DATE_TIME;
tz = ((DateTime) date).getTimeZone();
// We only support known tzids (Olson for the most part)
if (tz != null) {
tz = tzTranslator.translateToOlsonTz(tz);
// If timezone can't be translated, then datetime will
// essentiallyi be floating.
if (tz != null) {
String id = tz.getVTimeZone().getProperties().
getProperty(Property.TZID).getValue();
tzid = new TzId(id);
}
}
} else {
value = Value.DATE;
}
this.anytime = false;
text = date.toString();
this.date = date;
}
示例3: setDatePropertyValue
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
protected void setDatePropertyValue(DateProperty prop,
Date date) {
if (prop == null) {
return;
}
Value value = (Value)
prop.getParameters().getParameter(Parameter.VALUE);
if (value != null) {
prop.getParameters().remove(value);
}
// Add VALUE=DATE for Date values, otherwise
// leave out VALUE=DATE-TIME because it is redundant
if(! (date instanceof DateTime)) {
prop.getParameters().add(Value.DATE);
}
}
示例4: setDisplayAlarmTriggerDate
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
public void setDisplayAlarmTriggerDate(DateTime triggerDate) {
VAlarm alarm = getDisplayAlarm();
if(alarm==null) {
return;
}
Trigger oldTrigger = (Trigger) alarm.getProperties().getProperty(
Property.TRIGGER);
if (oldTrigger != null) {
alarm.getProperties().remove(oldTrigger);
}
Trigger newTrigger = new Trigger();
newTrigger.getParameters().add(Value.DATE_TIME);
newTrigger.setDateTime(triggerDate);
alarm.getProperties().add(newTrigger);
}
示例5: testParseDateList
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Tests parse date list.
* @throws Exception - if something is wrong this exception is thrown.
*/
@Test
public void testParseDateList() throws Exception {
String str = ";VALUE=DATE:20021010,20021011,20021012";
DateList dl = new ICalDate(str).getDateList();
Assert.assertNotNull("null date list", dl);
Assert.assertEquals("wrong number of dates", 3, dl.size());
Assert.assertNull("not null timezone", dl.getTimeZone());
Assert.assertEquals("not date", Value.DATE, dl.getType());
Assert.assertEquals("incorrect date", "20021010", dl.get(0).toString());
Assert.assertEquals("incorrect date", "20021011", dl.get(1).toString());
Assert.assertEquals("incorrect date", "20021012", dl.get(2).toString());
}
示例6: setDatePropertyValue
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Sets date property value
* @param prop The date property.
* @param date The date.
*/
protected void setDatePropertyValue(DateProperty prop, Date date) {
if (prop == null) {
return;
}
Value value = (Value) prop.getParameters()
.getParameter(Parameter.VALUE);
if (value != null) {
prop.getParameters().remove(value);
}
// Add VALUE=DATE for Date values, otherwise
// leave out VALUE=DATE-TIME because it is redundant
if (!(date instanceof DateTime)) {
prop.getParameters().add(Value.DATE);
}
}
示例7: setDisplayAlarmTriggerDate
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Sets display alarm trigger date.
* @param triggerDate The trigger date.
*/
public void setDisplayAlarmTriggerDate(DateTime triggerDate) {
VAlarm alarm = getDisplayAlarm();
if (alarm == null) {
return;
}
Trigger oldTrigger = (Trigger) alarm.getProperties().getProperty(Property.TRIGGER);
if (oldTrigger != null) {
alarm.getProperties().remove(oldTrigger);
}
Trigger newTrigger = new Trigger();
newTrigger.getParameters().add(Value.DATE_TIME);
newTrigger.setDateTime(triggerDate);
alarm.getProperties().add(newTrigger);
}
示例8: getRecurrenceIDList
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Get a List of RECURRENCE-ID by recurrence dates and EXDATEs
*
* @param recurDates
* @param exDates
* @param value decide the format of RECURRENCE-ID
* @return
*/
public ArrayList<String> getRecurrenceIDList(DateList recurDates, DateList exDates, Value value) throws ParseException{
ArrayList<String> recurIdList= new ArrayList<String>();
// Date
if( value == Value.DATE ){
fillRecurIDListbyDate(recurIdList, recurDates);
}
// DateTime
else{
fillRecurIDListbyDateTime(recurIdList, recurDates);
}
// remove the exdates
if( exDates != null ){
if( value == Value.DATE ){
removeRecurIDListbyDate(recurIdList, exDates);
}
else{
removeRecurIDListbyDateTime(recurIdList, exDates);
}
}
return recurIdList;
}
示例9: recurTests
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
@Test
public void recurTests()
{
final TimeZone timeZone = DateHelper.EUROPE_BERLIN;
final Recur recur = new Recur();
recur.setFrequency(ICal4JUtils.getCal4JFrequencyString(RecurrenceFrequency.WEEKLY));
recur.setUntil(getDate("2013-01-31", timeZone));
recur.setInterval(2);
final DateList dateList = recur.getDates(getDate("2013-01-01", timeZone), getDate("2012-01-02", timeZone),
getDate("2013-03-31", timeZone), Value.TIME);
Assert.assertEquals(3, dateList.size());
final DateFormat df = new SimpleDateFormat(DateFormats.ISO_TIMESTAMP_MINUTES);
df.setTimeZone(timeZone);
Assert.assertEquals("2013-01-01 00:00", df.format(dateList.get(0)));
Assert.assertEquals("2013-01-15 00:00", df.format(dateList.get(1)));
Assert.assertEquals("2013-01-29 00:00", df.format(dateList.get(2)));
}
示例10: parseValue
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Parses value.
* @param str The string.
*/
private void parseValue(String str) {
if (str.equals("DATE")) {
value = Value.DATE;
}
else if (str.equals("DATE-TIME")) {
value = Value.DATE_TIME;
}
else {
throw new IllegalArgumentException("Bad value " + str);
}
}
示例11: parseDates
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Parses dates.
* @param str The string.
* @throws ParseException - if something is wrong this exception is thrown.
*/
private void parseDates(String str)
throws ParseException {
if (str.indexOf(',')==-1) {
date = isDate() ? new Date(str) : new DateTime(str, tz);
if(isDate() && tz != null) {
throw new ParseException("DATE cannot have timezone",0);
}
}
dates = isDate() ?
new DateList(str, Value.DATE, tz) :
new DateList(str, Value.DATE_TIME, tz);
}
示例12: setDateListPropertyValue
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
protected void setDateListPropertyValue(DateListProperty prop) {
if (prop == null) {
return;
}
Value value = (Value)
prop.getParameters().getParameter(Parameter.VALUE);
if (value != null) {
prop.getParameters().remove(value);
}
value = prop.getDates().getType();
// set VALUE=DATE but not VALUE=DATE-TIME as its redundant
if(value.equals(Value.DATE)) {
prop.getParameters().add(value);
}
// update timezone for now because ical4j DateList doesn't
Parameter param = (Parameter) prop.getParameters().getParameter(
Parameter.TZID);
if (param != null) {
prop.getParameters().remove(param);
}
if(prop.getDates().getTimeZone()!=null) {
prop.getParameters().add(new TzId(prop.getDates().getTimeZone().getID()));
}
}
示例13: fixDateTimeProperties
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
private void fixDateTimeProperties(Component component) {
PropertyList<Property> props = component.getProperties();
for(Property prop : props) {
if(prop instanceof DateProperty || prop instanceof DateListProperty) {
Value v = (Value) prop.getParameter(Parameter.VALUE);
if(Value.DATE_TIME.equals(v)) {
prop.getParameters().remove(v);
}
}
}
}
示例14: setDateListPropertyValue
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
/**
* Sets date list property value.
* @param prop Date list property.
*/
protected void setDateListPropertyValue(DateListProperty prop) {
if (prop == null) {
return;
}
Value value = (Value)
prop.getParameters().getParameter(Parameter.VALUE);
if (value != null) {
prop.getParameters().remove(value);
}
value = prop.getDates().getType();
// set VALUE=DATE but not VALUE=DATE-TIME as its redundant
if (value.equals(Value.DATE)) {
prop.getParameters().add(value);
}
// update timezone for now because ical4j DateList doesn't
Parameter param = (Parameter) prop.getParameters().getParameter(
Parameter.TZID);
if (param != null) {
prop.getParameters().remove(param);
}
if (prop.getDates().getTimeZone() != null) {
prop.getParameters().add(new TzId(prop.getDates().getTimeZone().getID()));
}
}
示例15: addMilestoneEvent
import net.fortuna.ical4j.model.parameter.Value; //导入依赖的package包/类
public void addMilestoneEvent(String projectShortName, java.util.Date date, LabelListValueWithMetadata m,
SearchResults cards) throws URISyntaxException {
URI uri = new URI(String.format("%s%s/milestones/", applicationUrl, projectShortName));
double closed = 0;
double total = 0;
StringBuilder descBuilder = new StringBuilder();
for (CardFullWithCounts card : cards.getFound()) {
if (card.getColumnDefinition() == ColumnDefinition.CLOSED) {
closed++;
}
total++;
descBuilder.append(getEventName(card));
descBuilder.append("\n");
}
final String name = String.format("%s - %s (%.0f%%)", projectShortName, m.getValue(),
total > 0 ? 100 * closed / total : 100);
final UUID id = new UUID(getLong(m.getCardLabelId(), m.getId()), getLong(m.getOrder(), 0));
DateTime dueDate = new DateTime(date.getTime());
dueDate.setUtc(true);
final VEvent event = new VEvent(dueDate, name);
event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE_TIME);
event.getProperties().add(new Description(descBuilder.toString()));
event.getProperties().add(new Uid(id.toString()));
// Reminder on milestone's date
if (!m.getMetadata().containsKey("status") || !m.getMetadata().get("status").equals("CLOSED")) {
event.getAlarms().add(createReminder(name));
}
// Url
event.getProperties().add(new Url(uri));
events.add(event);
}