当前位置: 首页>>代码示例>>Java>>正文


Java VAlarm类代码示例

本文整理汇总了Java中biweekly.component.VAlarm的典型用法代码示例。如果您正苦于以下问题:Java VAlarm类的具体用法?Java VAlarm怎么用?Java VAlarm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VAlarm类属于biweekly.component包,在下文中一共展示了VAlarm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import biweekly.component.VAlarm; //导入依赖的package包/类
/**
 * Converts a {@link VAlarm} component to a vCal alarm property.
 * @param valarm the component
 * @param parent the component's parent
 * @return the vCal alarm property or null if it cannot be converted
 */
private static VCalAlarmProperty convert(VAlarm valarm, ICalComponent parent) {
	VCalAlarmProperty property = create(valarm);
	if (property == null) {
		return null;
	}

	property.setStart(determineStartDate(valarm, parent));

	DurationProperty duration = valarm.getDuration();
	if (duration != null) {
		property.setSnooze(duration.getValue());
	}

	Repeat repeat = valarm.getRepeat();
	if (repeat != null) {
		property.setRepeat(repeat.getValue());
	}

	return property;
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:27,代码来源:VAlarmScribe.java

示例2: checkForDataModelConversions_snooze

import biweekly.component.VAlarm; //导入依赖的package包/类
@Test
public void checkForDataModelConversions_snooze() {
	Action action = Action.audio();
	Duration snooze = new Duration.Builder().minutes(10).build();

	VAlarm alarm = new VAlarm(action, null);
	alarm.setDuration(snooze);
	try {
		scribe.checkForDataModelConversions(alarm, null, V1_0);
	} catch (DataModelConversionException e) {
		AudioAlarm expected = new AudioAlarm();
		expected.setSnooze(snooze);
		assertNull(e.getOriginalProperty());
		assertEquals(Arrays.asList(expected), e.getProperties());
		assertEquals(Arrays.asList(), e.getComponents());
	}
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:18,代码来源:VAlarmScribeTest.java

示例3: checkForDataModelConversions_repeat

import biweekly.component.VAlarm; //导入依赖的package包/类
@Test
public void checkForDataModelConversions_repeat() {
	Action action = Action.audio();
	int repeat = 2;

	VAlarm alarm = new VAlarm(action, null);
	alarm.setRepeat(repeat);
	try {
		scribe.checkForDataModelConversions(alarm, null, V1_0);
	} catch (DataModelConversionException e) {
		AudioAlarm expected = new AudioAlarm();
		expected.setRepeat(repeat);
		assertNull(e.getOriginalProperty());
		assertEquals(Arrays.asList(expected), e.getProperties());
		assertEquals(Arrays.asList(), e.getComponents());
	}
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:18,代码来源:VAlarmScribeTest.java

示例4: toVAlarm

import biweekly.component.VAlarm; //导入依赖的package包/类
/**
 * Converts an instance of a vCal alarm property into a {@link VAlarm}
 * component.
 * @param property the property to convert
 * @return the component
 */
protected VAlarm toVAlarm(T property) {
	Trigger trigger = new Trigger(property.getStart());
	VAlarm valarm = new VAlarm(action(), trigger);
	valarm.setDuration(property.getSnooze());
	valarm.setRepeat(property.getRepeat());

	toVAlarm(valarm, property);
	return valarm;
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:16,代码来源:VCalAlarmPropertyScribe.java

示例5: toVAlarm

import biweekly.component.VAlarm; //导入依赖的package包/类
@Override
protected void toVAlarm(VAlarm valarm, AudioAlarm property) {
	Attachment attach = buildAttachment(property);
	if (attach != null) {
		valarm.addAttachment(attach);
	}
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:8,代码来源:AudioAlarmScribe.java

示例6: toVAlarm

import biweekly.component.VAlarm; //导入依赖的package包/类
@Override
protected void toVAlarm(VAlarm valarm, EmailAlarm property) {
	String email = property.getEmail();
	if (email != null) {
		valarm.addAttendee(new Attendee(null, email));
	}
	valarm.setDescription(property.getNote());
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:9,代码来源:EmailAlarmScribe.java

示例7: checkForDataModelConversions

import biweekly.component.VAlarm; //导入依赖的package包/类
@Override
public void checkForDataModelConversions(VAlarm component, ICalComponent parent, ICalVersion version) {
	if (version != ICalVersion.V1_0) {
		return;
	}

	VCalAlarmProperty vcalAlarm = convert(component, parent);
	if (vcalAlarm == null) {
		return;
	}

	DataModelConversionException e = new DataModelConversionException(null);
	e.getProperties().add(vcalAlarm);
	throw e;
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:16,代码来源:VAlarmScribe.java

示例8: determineStartDate

import biweekly.component.VAlarm; //导入依赖的package包/类
/**
 * Determines what the alarm property's start date should be.
 * @param valarm the component that is being converted to a vCal alarm
 * property
 * @param parent the component's parent
 * @return the start date or null if it cannot be determined
 */
private static Date determineStartDate(VAlarm valarm, ICalComponent parent) {
	Trigger trigger = valarm.getTrigger();
	if (trigger == null) {
		return null;
	}

	Date triggerStart = trigger.getDate();
	if (triggerStart != null) {
		return triggerStart;
	}

	Duration triggerDuration = trigger.getDuration();
	if (triggerDuration == null) {
		return null;
	}

	if (parent == null) {
		return null;
	}

	Related related = trigger.getRelated();
	Date date = null;
	if (related == Related.START) {
		date = ValuedProperty.getValue(parent.getProperty(DateStart.class));
	} else if (related == Related.END) {
		date = ValuedProperty.getValue(parent.getProperty(DateEnd.class));
		if (date == null) {
			Date dateStart = ValuedProperty.getValue(parent.getProperty(DateStart.class));
			Duration duration = ValuedProperty.getValue(parent.getProperty(DurationProperty.class));
			if (duration != null && dateStart != null) {
				date = duration.add(dateStart);
			}
		}
	}

	return (date == null) ? null : triggerDuration.add(date);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:45,代码来源:VAlarmScribe.java

示例9: checkForDataModelConversions_version

import biweekly.component.VAlarm; //导入依赖的package包/类
@Test
public void checkForDataModelConversions_version() {
	VAlarm alarm = new VAlarm(Action.audio(), new Trigger(date));

	try {
		scribe.checkForDataModelConversions(alarm, null, V1_0);
		fail();
	} catch (DataModelConversionException e) {
		assertNull(e.getOriginalProperty());
		assertEquals(1, e.getProperties().size());
		assertEquals(0, e.getComponents().size());
	}
	scribe.checkForDataModelConversions(alarm, null, V2_0_DEPRECATED);
	scribe.checkForDataModelConversions(alarm, null, V2_0);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:16,代码来源:VAlarmScribeTest.java

示例10: example4

import biweekly.component.VAlarm; //导入依赖的package包/类
@Test
public void example4() throws Throwable {
	ICalendar ical = new ICalendar();
	ical.getProperties().clear();
	ical.setProductId("-//ABC Corporation//NONSGML My Product//EN");
	{
		VTodo todo = new VTodo();
		todo.getProperties().clear();
		todo.setDateTimeStamp(utc("1998-01-30 13:45:00"));
		todo.setSequence(2);
		todo.setUid("[email protected]");
		todo.setOrganizer("[email protected]");

		Attendee attendee = new Attendee(null, "[email protected]");
		attendee.setParticipationStatus(ParticipationStatus.ACCEPTED);
		todo.addAttendee(attendee);

		todo.setDateDue(date("1998-04-15"));
		todo.setStatus(Status.needsAction());
		todo.setSummary("Submit Income Taxes");
		{
			Trigger trigger = new Trigger(utc("1998-04-03 12:00:00"));
			Attachment attach = new Attachment("audio/basic", "http://example.com/pub/audio-files/ssbanner.aud");
			VAlarm alarm = VAlarm.audio(trigger, attach);
			alarm.setRepeat(4);
			alarm.setDuration(Duration.builder().hours(1).build());
			todo.addAlarm(alarm);
		}

		ical.addTodo(todo);
	}

	assertValidate(ical).versions(V2_0_DEPRECATED, V2_0).run();
	TimezoneInfo tzinfo = ical.getTimezoneInfo();
	tzinfo.setFloating(ical.getTodos().get(0).getDateDue(), true);
	assertExample(ical, "rfc5545-example4.ics", V2_0);
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:38,代码来源:ICalWriterTest.java

示例11: populateReminders

import biweekly.component.VAlarm; //导入依赖的package包/类
void populateReminders(Event e) throws RemoteException {
	// reminders
	Uri remindersUri = Reminders.CONTENT_URI.buildUpon()
			.appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
			.build();
	@Cleanup Cursor c = providerClient.query(remindersUri, new String[]{
			/* 0 */ Reminders.MINUTES, Reminders.METHOD
	}, Reminders.EVENT_ID + "=?", new String[]{String.valueOf(e.getLocalID())}, null);
	while (c != null && c.moveToNext()) {
		//Duration duration = new Duration.Builder().prior(true).minutes(c.getInt(0)).build();
		Duration duration = new Duration.Builder().minutes(c.getInt(0)).build();
		Trigger trigger = new Trigger(duration, Related.START);
		VAlarm alarm = VAlarm.display(trigger, e.getSummary());
		e.addAlarm(alarm);
	}
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:17,代码来源:LocalCalendar.java

示例12: addDataRows

import biweekly.component.VAlarm; //导入依赖的package包/类
@Override
protected void addDataRows(Resource resource, long localID, int backrefIdx) {
	Event event = (Event)resource;
	for (Attendee attendee : event.getAttendees())
		pendingOperations.add(buildAttendee(newDataInsertBuilder(Attendees.CONTENT_URI, Attendees.EVENT_ID, localID, backrefIdx), attendee).build());
	for (VAlarm alarm : event.getAlarms())
		pendingOperations.add(buildReminder(newDataInsertBuilder(Reminders.CONTENT_URI, Reminders.EVENT_ID, localID, backrefIdx), alarm).build());
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:9,代码来源:LocalCalendar.java

示例13: buildReminder

import biweekly.component.VAlarm; //导入依赖的package包/类
protected Builder buildReminder(Builder builder, VAlarm alarm) {
	int minutes = 0;

	if (alarm.getTrigger() != null && alarm.getTrigger().getDuration() != null)
		//minutes = duration.getDays() * 24*60 + duration.getHours()*60 + duration.getMinutes();
		minutes = (int)(alarm.getTrigger().getDuration().toMillis()/60000);

	Log.d(TAG, "Adding alarm " + minutes + " min before");
	
	return builder
			.withValue(Reminders.METHOD, Reminders.METHOD_ALERT)
			.withValue(Reminders.MINUTES, minutes);
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:14,代码来源:LocalCalendar.java

示例14: toVAlarm

import biweekly.component.VAlarm; //导入依赖的package包/类
@Override
protected void toVAlarm(VAlarm valarm, DisplayAlarm property) {
	valarm.setDescription(property.getText());
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:5,代码来源:DisplayAlarmScribe.java

示例15: toVAlarm

import biweekly.component.VAlarm; //导入依赖的package包/类
@Override
protected void toVAlarm(VAlarm valarm, ProcedureAlarm property) {
	valarm.setDescription(property.getPath());
}
 
开发者ID:mangstadt,项目名称:biweekly,代码行数:5,代码来源:ProcedureAlarmScribe.java


注:本文中的biweekly.component.VAlarm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。