Package org.apache.myfaces.custom.schedule.model

Examples of org.apache.myfaces.custom.schedule.model.ScheduleDay


                : (100 / schedule.getModel().size());

        int startHour = getRenderedStartHour(schedule);
        int endHour = getRenderedEndHour(schedule);

        ScheduleDay day = null;

        for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator.hasNext();)
        {
            writer.startElement(HTML.TD_ELEM, schedule);

            writer.writeAttribute(HTML.STYLE_ATTR, "width: " + String.valueOf(columnWidth)+ "%", null);

            day = (ScheduleDay) dayIterator.next();

            writer.startElement(HTML.TABLE_ELEM, schedule);
            writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
            writer.writeAttribute(HTML.CELLSPACING_ATTR, "1", null);
            writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%; height: 100%",
                    null);
            writer.startElement(HTML.TBODY_ELEM, schedule);

            writer.startElement(HTML.TR_ELEM, schedule);

            // the header
            final String dayHeaderId = clientId + "_header_" + ScheduleUtil.getDateId(day.getDate(), schedule.getModel().getTimeZone());

            writer.startElement(HTML.TH_ELEM, schedule);             
            writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
                    "header"), null);
            writer
            .writeAttribute(
                    HTML.STYLE_ATTR,
                    "height: " + headerHeight + "px; vertical-align: top; border-style: none; border-width: 0px; overflow: hidden;",
                    null);

            boolean isToday = ScheduleUtil.isSameDay(day.getDate(), new Date(), schedule.getModel().getTimeZone());

            // write the date
            writer.startElement(HTML.ANCHOR_ELEM, schedule);
            writer.writeAttribute(HTML.ID_ATTR, dayHeaderId, null);
            writer.writeAttribute(HTML.HREF_ATTR, "#", null);
            writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "date")
                    + (isToday ? " today" : ""), null);
            writer
            .writeAttribute(
                    HTML.STYLE_ATTR,
                    "display: block; height: 50%; width: 100%; overflow: hidden; white-space: nowrap;",
                    null);

            //register an onclick event listener to a column header which will
            //be used to determine the date
            if (!schedule.isReadonly() && schedule.isSubmitOnClick()) {
                writer.writeAttribute(
                        HTML.ONCLICK_ATTR,
                        "fireScheduleDateClicked(this, event, '"
                        + formId + "', '"
                        + clientId
                        + "');",
                        null);
            }

            writer.writeText(getDateString(context, schedule, day.getDate()),
                    null);
            writer.endElement(HTML.ANCHOR_ELEM);

            // write the name of the holiday, if there is one
            if ((day.getSpecialDayName() != null)
                    && (day.getSpecialDayName().length() > 0))
            {
                writer.startElement(HTML.SPAN_ELEM, schedule);
                writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
                        "holiday"), null);
                writer
                .writeAttribute(
                        HTML.STYLE_ATTR,
                        "height: 50%; width: 100%; overflow: hidden; white-space: nowrap;",
                        null);
                writer.writeText(day.getSpecialDayName(), null);
                writer.endElement(HTML.SPAN_ELEM);
            }

            writer.endElement(HTML.TH_ELEM);
            writer.endElement(HTML.TR_ELEM);

            // the intervals
            Iterator intervalIt = day.getIntervals(startHour, endHour).iterator();
            boolean even = false;

            while (intervalIt.hasNext())
            {
                Interval interval = (Interval) intervalIt.next();
View Full Code Here


        //entries
        if (!expandToFitEntries(schedule)) return startHour;

        for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator.hasNext();)
        {
            ScheduleDay day = (ScheduleDay) dayIterator.next();
            int dayStart = day.getFirstEventHour();

            if (dayStart < startHour) {
                startHour = dayStart;
            }
        }
View Full Code Here

        //entries
        if (!expandToFitEntries(schedule)) return endHour;

        for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator.hasNext();)
        {
            ScheduleDay day = (ScheduleDay) dayIterator.next();
            int dayEnd = day.getLastEventHour();

            if (dayEnd > endHour) {
                endHour = dayEnd;
            }
        }
View Full Code Here

        }

        for (Iterator dayIterator = getModel().iterator(); dayIterator
                .hasNext();)
        {
            ScheduleDay day = (ScheduleDay) dayIterator.next();

            for (Iterator iter = day.iterator(); iter.hasNext();)
            {
                ScheduleEntry entry = (ScheduleEntry) iter.next();

                if (id.equals(entry.getId()))
                {
View Full Code Here

    public Interval getClickedInterval()
    {
        Date clickedDate = getClickedDate();
       
        for (Iterator intervalIt = getSchedule().getModel().iterator(); intervalIt.hasNext(); ) {
            ScheduleDay day = (ScheduleDay) intervalIt.next();

            if (day.equalsDate(clickedDate))
            {
                return day.getInterval(clickedDate);
            }
        }
       
        return null;
    }
View Full Code Here

        for (
            Iterator dayIterator = schedule.getModel().iterator();
                dayIterator.hasNext();
        ) {
            ScheduleDay day = (ScheduleDay) dayIterator.next();
            Calendar cal = getCalendarInstance(schedule, day.getDate());

            int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
            int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
            boolean isWeekend =
                (dayOfWeek == Calendar.SATURDAY) ||
View Full Code Here

            DateFormat dayOfWeekFormater = getDateFormat(context, schedule, dayOfWeekDateFormat);
            writer.startElement(HTML.THEAD_ELEM, schedule);
            writer.startElement(HTML.TR_ELEM, schedule);

            for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator.hasNext();) {
                ScheduleDay day = (ScheduleDay) dayIterator.next();
                cal.setTime(day.getDate());

                int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);

                writer.startElement(HTML.TH_ELEM, schedule);
                writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "header"), null);

                if (schedule.isSplitWeekend() && dayOfWeek == Calendar.SATURDAY) {
                    // Don't label the weekend
                    writer.endElement(HTML.TH_ELEM);
                    break;
                } else {
                    writer.writeText(dayOfWeekFormater.format(day.getDate()), null);
                    writer.endElement(HTML.TH_ELEM);                   
                }
                if (dayOfWeek == Calendar.SUNDAY) {
                    break;
                }
            }
            writer.endElement(HTML.TR_ELEM);
            writer.endElement(HTML.THEAD_ELEM);
        }

        writer.startElement(HTML.TBODY_ELEM, schedule);

        int selectedMonth = cal.get(Calendar.MONTH);

        for (
            Iterator dayIterator = schedule.getModel().iterator();
            dayIterator.hasNext();
        ) {
            ScheduleDay day = (ScheduleDay) dayIterator.next();
            cal.setTime(day.getDate());

            int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
            int dayOfMonth = cal.get(Calendar.DAY_OF_MONTH);
            int currentMonth = cal.get(Calendar.MONTH);
            boolean isWeekend =
                (dayOfWeek == Calendar.SATURDAY) ||
                (dayOfWeek == Calendar.SUNDAY);

            cal.setTime(day.getDate());

            writeDayCell(
                context, writer, schedule, day, dayOfWeek, dayOfMonth, isWeekend,
                currentMonth == selectedMonth, (!isWeekend && schedule.isSplitWeekend() ? 2 : 1)
            );
View Full Code Here

        String formId = parentFormInfo == null ? null : parentFormInfo.getFormName();

        for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator
                .hasNext();)
        {
            ScheduleDay day = (ScheduleDay) dayIterator.next();
            String dayBodyId = clientId + "_body_" + ScheduleUtil.getDateId(day.getDate(), schedule.getModel().getTimeZone());
            writer.startElement(HTML.TD_ELEM, schedule);
            writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
                    "column"), null);
            writer.writeAttribute(HTML.STYLE_ATTR, "height: 100%;", null);
            writer.startElement(HTML.DIV_ELEM, schedule);
View Full Code Here

        DateFormat minuteFormater = getDateFormat(context, schedule,
                HtmlSchedule.HOUR_NOTATION_12.equals(schedule.getHourNotation()) ? "':'mma" : "mm");       
        DateFormat shortMinuteFormater = getDateFormat(context, schedule,
                HtmlSchedule.HOUR_NOTATION_12.equals(schedule.getHourNotation()) ? "a" : "mm");       

        ScheduleDay day = (ScheduleDay) schedule.getModel().iterator().next();

        writer.startElement(HTML.TABLE_ELEM, schedule);
        writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
        writer.writeAttribute(HTML.CELLSPACING_ATTR, "1", null);
        writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "background"), null);
         writer.writeAttribute(HTML.STYLE_ATTR, "height: 100%", null);
        writer.startElement(HTML.TBODY_ELEM, schedule);

        writer.startElement(HTML.TR_ELEM, schedule);

        // the header gutter
        writer.startElement(HTML.TD_ELEM, schedule);
        writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "gutter"), null);
        writer.writeAttribute(
                HTML.STYLE_ATTR,
                "height: "
                + headerHeight
                + "px; border-style: none; border-width: 0px; overflow: hidden; padding: 0px",
                null);
        writer.startElement(HTML.DIV_ELEM, schedule);
        writer.writeAttribute(HTML.STYLE_ATTR, "height: 1px; width: 56px", null);
        writer.endElement(HTML.DIV_ELEM);
        writer.endElement(HTML.TD_ELEM);
        writer.endElement(HTML.TR_ELEM);

        // the intervals
        Iterator intervalIt = day.getIntervals(startHour, endHour).iterator();

        boolean renderGutter = true;

        while (intervalIt.hasNext())
        {
            Interval interval = (Interval) intervalIt.next();
            int intervalHeight = calcRowHeight(rowHeight, interval.getDuration()) - 1;

            // Don't render rows where the timespan is too small
            if (intervalHeight <= 0)
            {
                continue;
            }

            if (!renderGutter)
            {
                renderGutter = true;
                continue;
            }

            writer.startElement(HTML.TR_ELEM, schedule);

            int gutterHeight = intervalHeight;

            if (day.getIntervals() == null && interval.getStartMinutes(getTimeZone(schedule)) == 0)
            {
                gutterHeight = (gutterHeight * 2) + 1;
                renderGutter = false;
            }                   

View Full Code Here

                : (100 / schedule.getModel().size());

        int startHour = getRenderedStartHour(schedule);
        int endHour = getRenderedEndHour(schedule);

        ScheduleDay day = null;

        for (Iterator dayIterator = schedule.getModel().iterator(); dayIterator.hasNext();)
        {
            writer.startElement(HTML.TD_ELEM, schedule);

            writer.writeAttribute(HTML.STYLE_ATTR, "width: " + String.valueOf(columnWidth)+ "%", null);

            day = (ScheduleDay) dayIterator.next();

            writer.startElement(HTML.TABLE_ELEM, schedule);
            writer.writeAttribute(HTML.CELLPADDING_ATTR, "0", null);
            writer.writeAttribute(HTML.CELLSPACING_ATTR, "1", null);
            writer.writeAttribute(HTML.STYLE_ATTR, "width: 100%; height: 100%",
                    null);
            writer.startElement(HTML.TBODY_ELEM, schedule);

            writer.startElement(HTML.TR_ELEM, schedule);

            // the header
            final String dayHeaderId = clientId + "_header_" + ScheduleUtil.getDateId(day.getDate(), schedule.getModel().getTimeZone());

            writer.startElement(HTML.TH_ELEM, schedule);             
            writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
                    "header"), null);
            writer
            .writeAttribute(
                    HTML.STYLE_ATTR,
                    "height: " + headerHeight + "px; vertical-align: top; border-style: none; border-width: 0px; overflow: hidden;",
                    null);

            boolean isToday = ScheduleUtil.isSameDay(day.getDate(), new Date(), schedule.getModel().getTimeZone());

            // write the date
            writer.startElement(HTML.ANCHOR_ELEM, schedule);
            writer.writeAttribute(HTML.ID_ATTR, dayHeaderId, null);
            writer.writeAttribute(HTML.HREF_ATTR, "#", null);
            writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule, "date")
                    + (isToday ? " today" : ""), null);
            writer
            .writeAttribute(
                    HTML.STYLE_ATTR,
                    "display: block; height: 50%; width: 100%; overflow: hidden; white-space: nowrap;",
                    null);

            //register an onclick event listener to a column header which will
            //be used to determine the date
            if (!schedule.isReadonly() && schedule.isSubmitOnClick()) {
                writer.writeAttribute(
                        HTML.ONCLICK_ATTR,
                        "fireScheduleDateClicked(this, event, '"
                        + formId + "', '"
                        + clientId
                        + "');",
                        null);
            }

            writer.writeText(getDateString(context, schedule, day.getDate()),
                    null);
            writer.endElement(HTML.ANCHOR_ELEM);

            // write the name of the holiday, if there is one
            if ((day.getSpecialDayName() != null)
                    && (day.getSpecialDayName().length() > 0))
            {
                writer.startElement(HTML.SPAN_ELEM, schedule);
                writer.writeAttribute(HTML.CLASS_ATTR, getStyleClass(schedule,
                        "holiday"), null);
                writer
                .writeAttribute(
                        HTML.STYLE_ATTR,
                        "height: 50%; width: 100%; overflow: hidden; white-space: nowrap;",
                        null);
                writer.writeText(day.getSpecialDayName(), null);
                writer.endElement(HTML.SPAN_ELEM);
            }

            writer.endElement(HTML.TH_ELEM);
            writer.endElement(HTML.TR_ELEM);

            // the intervals
            Iterator intervalIt = day.getIntervals(startHour, endHour).iterator();
            boolean even = false;

            while (intervalIt.hasNext())
            {
                Interval interval = (Interval) intervalIt.next();
View Full Code Here

TOP

Related Classes of org.apache.myfaces.custom.schedule.model.ScheduleDay

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.