Package com.peusoft.ical.service

Examples of com.peusoft.ical.service.ICalendarService


        }
    }

    protected void updateDays() {

        ICalendarService cal_srv = null;
        if (getIcalUrl() != null) {
            try {
                cal_srv = ICalendarServiceFactory.createInstance(
                        getIcalUrl());
            } catch (ICalendarServiceException e) {
                LOGGER.error("Can't get the instance of ICalendarService.", e);
                if (!e.getErrCode().equals(ICalendarServiceException.ERR_OUT_OF_PERIOD)) {
                    throw new CalendarException(e);
                }
            }
        }

        int sm = getModel().getSelectedMonth();
        Calendar cal = Calendar.getInstance(getLocale());
        cal.set(Calendar.MONTH, sm);
        cal.set(Calendar.YEAR,
                getModel().getSelectedYear());
        cal.set(Calendar.DAY_OF_MONTH, 1);

        int day_of_week = cal.get(Calendar.DAY_OF_WEEK);
        int day_of_week_idx = ((Integer) dayOrderMap.get(new Integer(day_of_week))).intValue();
        cal.add(Calendar.DAY_OF_YEAR, -day_of_week_idx);

        for (int i = 0; i < MAX_NUMBER_OF_WEEKS; i++) {

            int w = cal.get(Calendar.WEEK_OF_YEAR);
            weekNumbers[i].setText("" + w);

            for (int j = 0; j < MAX_NUMBER_OF_DAYS; j++) {

                days[i][j].setText("" + cal.get(Calendar.DAY_OF_MONTH));

                if (compareCalendar(
                        getModel().getSelectedDate(),
                        cal)) {
                    days[i][j].setBackground(
                            getSelectedDateBackground());
                    days[i][j].setFont(
                            days[i][j].getFont().deriveFont(Font.BOLD));
                    days[i][j].setSelected(true);
                    if (LOGGER.isDebugEnabled()) {
                        LOGGER.debug("Day: selected " + days[i][j].getText());
                    }

                } else {
                    days[i][j].setBackground(
                            getNotSelectedDateBackground());
                    days[i][j].setFont(
                            days[i][j].getFont().deriveFont(Font.PLAIN));
                    days[i][j].setSelected(false);
                }

                int d = cal.get(Calendar.DAY_OF_WEEK);
                int m = cal.get(Calendar.MONTH);
                boolean out_of_month = m != sm;
                days[i][j].setOutOfMonth(out_of_month);
                if (out_of_month) {
                    days[i][j].setForeground(
                            getOutOfMonthDateForeground());
                } else if (d == Calendar.SUNDAY || d == Calendar.SATURDAY) {
                    days[i][j].setForeground(
                            getWeForeground());
                } else {
                    days[i][j].setForeground(
                            getDateForeground());
                }

                String hi = "";
                if (getIcalUrl() != null) {
                    List<String> l = new ArrayList<String>();
                    try {
                        if (cal_srv != null && cal_srv.isHoliday(cal, l)) {
                            hi = cal_srv.getHolidayName(cal, l);
                        }
                    } catch (ICalendarServiceException e) {
                        LOGGER.error("Can't check holidays.", e);
                        if (!e.getErrCode().equals(ICalendarServiceException.ERR_OUT_OF_PERIOD)) {
                            throw new CalendarException(e);
View Full Code Here

TOP

Related Classes of com.peusoft.ical.service.ICalendarService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.