⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reservationhelper.java

📁 Rapla是一个灵活的多用户资源管理系统。它提供的一些功能有:日历GUI
💻 JAVA
字号:
package org.rapla.entities.domain;

import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.rapla.facade.PeriodModel;

public class ReservationHelper
{

    static public void makeRepeatingForPeriod(PeriodModel model, Appointment appointment, RepeatingType repeatingType, int repeatings) {
    	appointment.setRepeatingEnabled(true);
        Repeating repeating = appointment.getRepeating();
        repeating.setType( repeatingType );
        Period period = model.getNearestPeriodForStartDate( appointment.getStart());
        if ( period != null && repeatings <=1) {
    		repeating.setEnd(period.getEnd());
    	} else {
            repeating.setNumber( repeatings );
    	}
    }

    /** find the first visible reservation*/
    static public Date findFirst( List reservationList) {
        Date firstStart = null;
        Iterator it = reservationList.iterator();
        while (it.hasNext()) {
            Appointment[] appointments = ((Reservation) it.next()).getAppointments();
            for (int i=0;i<appointments.length;i++) {
                Date start = appointments[i].getStart();
                Repeating r = appointments[i].getRepeating();
                if (firstStart == null) {
                    firstStart = start;
                    continue;
                }
                if (!start.before(firstStart))
                    continue;
                
                if ( r== null || !r.isException(start.getTime()))
                {
                    firstStart = start;
                } 
                else 
                {
                    AppointmentBlockArray blocks = new AppointmentBlockArray();
                    appointments[i].createBlocks( start, firstStart, blocks );
                    for (int j=0;j<blocks.size();j++) {
                        if (blocks.getStartAt(j)<firstStart.getTime()) {
                            firstStart = new Date(blocks.getStartAt(j));
                            continue;
                        }
                    }
                }
            }
        }
        return firstStart;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -