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


Java Event.getEndDate方法代码示例

本文整理汇总了Java中net.sf.memoranda.Event.getEndDate方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getEndDate方法的具体用法?Java Event.getEndDate怎么用?Java Event.getEndDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.memoranda.Event的用法示例。


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

示例1: toApi

import net.sf.memoranda.Event; //导入方法依赖的package包/类
/**
 * Converts the given internal event to the corresponding API event.
 * @param event internal event to convert
 * @return converted API event
 */
public static ApiEvent toApi(Event event) {
    Date endDate = null;
    if (event.getEndDate() != null) {
        endDate = event.getEndDate().getDate();
    }
    return new ApiEvent.Builder()
            .setId(event.getId())
            .setTime(event.getTime())
            .setText(event.getText())
            .setRepeatType(event.getRepeatType().ordinal())
            .setStartDate(event.getStartDate().getDate())
            .setEndDate(endDate)
            .setPeriod(event.getPeriod())
            .setRepeatable(event.isRepeatable())
            .setWorkingDays(event.getWorkingDays())
            .setDuration(event.getDuration())
            .setRepeatDays(event.getRepeatDays())
            .setSendsSms(event.getSendSMS())
            .create();
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:26,代码来源:ApiEventDto.java

示例2: EventInformationDialog

import net.sf.memoranda.Event; //导入方法依赖的package包/类
public EventInformationDialog(Frame owner, String title, Event event) {
	
	super(owner, title, true);
	
	JPanel panel = new JPanel();
	panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	
	panel.add(new JLabel("Event Name: "));
	panel.add(new JLabel(event.getText()));

	if (event.getStartDate() != null) {
		panel.add(new JLabel("Start Date: "));
		panel.add(new JLabel(event.getStartDate().getShortDateString() + " @ " + event.getTimeString()));
	}
	
	if (event.getEndDate() != null) {
		panel.add(new JLabel("End Date: "));
		panel.add(new JLabel(event.getEndDate().getShortDateString() + " @ " + event.getTimeString()));
	}
	
	panel.add(new JLabel("Repeatable Event: "));
	panel.add(new JLabel(Boolean.toString(event.isRepeatable())));
	
	panel.setLayout(new GridLayout(panel.getComponentCount() / 2, 2, 10, 10));
	add(panel);
	
	setLocationRelativeTo(null);
	pack();
}
 
开发者ID:cst316,项目名称:spring16project-Modula-2,代码行数:30,代码来源:EventInformationDialog.java

示例3: convertEvent

import net.sf.memoranda.Event; //导入方法依赖的package包/类
/**
 * Converts an Event into a VEVENT block for iCalendar
 * @param e Event to convert
 * @return string for a VEVENT in an iCalendar
 */
private static String convertEvent(Event e){
	SimpleDateFormat calF = new SimpleDateFormat("yyyyMMdd'T'HHmm'00'");
	calF.setTimeZone(TimeZone.getTimeZone("UTC"));
	//Date startDate = (e.getStartDate() != null)? e.getStartDate().getDate(): e.getTime();
	Date startDate = e.getTime();
	Date stampDate = e.getTime();		
	String durEndDateStr = "";
	if(e.getDuration() != 0){
		Date durEndDate = e.getTime();
		durEndDate.setTime(startDate.getTime()+e.getDuration()*60*1000);
		durEndDateStr = "DTEND:" + calF.format(durEndDate) + "\n";
	}
	String endDateString = "";
	if(e.getEndDate() != null){
		Date endDate = e.getEndDate().getDate();
		endDateString = ";UNTIL=" + calF.format(endDate) + "Z";
	}		
	
	
	String repeat = "";
	if(e.isRepeatable()){
		String repeatType = "";
		switch(e.getRepeatType()){
			case REPEAT_DAILY: repeatType = "DAILY";
				break;
			case REPEAT_WEEKLY: repeatType = "WEEKLY";
				break;
			case REPEAT_MONTHLY: repeatType = "MONTHLY";
				break;
			case REPEAT_YEARLY: repeatType = "YEARLY";
				break;
			default: repeatType = "DAILY";
		}
		repeat = "RRULE:FREQ=" + repeatType;
		if(e.getRepeatType()==Event.RepeatType.REPEAT_WEEKLY && e.getRepeatDays()!= null){
			repeat+=";BYDAY=";
			String[] days = {"SU","MO","TU","WE","TH","FR","SA"};
			for(int i = 0;i<7;i++)
				if(e.getRepeatDays()[i])
					repeat += days[i] + ",";
			repeat = repeat.substring(0,repeat.length()-1);//get rid of last ,
		}
		else
			repeat+= ";INTERVAL=" + e.getPeriod();
		repeat+=endDateString+"\n";
		
	}
	return String.format("BEGIN:VEVENT\n"
			+ "SUMMARY:%s\n"
			+ "UID:%s\n"
			+ "DTSTART:%s\n"
			+ "%s"
			+ "%s"
			+ "DTSTAMP:%s\n"
			+ "END:VEVENT\n",
			e.getText(),
			e.getId(),
			calF.format(startDate),
			durEndDateStr,
			repeat,
			calF.format(stampDate));
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:68,代码来源:ICalendarFileManager.java


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