Examples of DaySwitcher


Examples of org.openfaces.component.timetable.DaySwitcher

        TimeZone timeZone = switcher.getTimeZone();

        String pattern = dateFormat.toPattern();
        boolean renderText = pattern.length() != 0;

        DaySwitcher daySwitcher = (DaySwitcher) switcher;
        SimpleDateFormat upperDateFormat = CalendarUtil.getSimpleDateFormat(daySwitcher.getUpperDateFormat(), null,
                daySwitcher.getUpperPattern(), DEFAULT_SUP_PATTERN, locale, timeZone);
        String upperPattern = upperDateFormat.toPattern();
        context.getExternalContext().getRequestMap().put(getUpperPatternKey(), upperPattern);
        boolean renderUpperText = upperPattern.length() != 0;

        if (!renderText && !renderUpperText) {
            throw new FacesException("DaySwitcher's pattern and upperPattern are both empty.");
        }

        ResponseWriter writer = context.getResponseWriter();
        String clientId = switcher.getClientId(context);
        if (renderUpperText) {
            writer.startElement("div", switcher);
            writer.writeAttribute("id", clientId + "::upper_text", null);
            String upperTextClass = Styles.getCSSClass(context,
                    switcher, daySwitcher.getUpperTextStyle(),
                    "o_daySwitcher_upper_text", daySwitcher.getUpperTextClass());
            writer.writeAttribute("class", upperTextClass, null);

            writer.write(upperDateFormat.format(date));
            writer.endElement("div");
        }

        if (renderText) {
            writer.startElement("div", switcher);
            writer.writeAttribute("id", clientId + "::text", null);
            String textClass = Styles.getCSSClass(context,
                    switcher, switcher.getTextStyle(), "o_daySwitcher_text", switcher.getTextClass());
            writer.writeAttribute("class", textClass, null);

            writer.write(dateFormat.format(timetableView.getDay()));

            writer.endElement("div");

            if (daySwitcher.isPopupCalendarEnabled()) {
                Calendar calendar = daySwitcher.getPopupCalendar();
                calendar.setRequired(true);
                calendar.setValue(new Date());
                calendar.setLocale(daySwitcher.getLocale());
                calendar.setTimeZone(daySwitcher.getTimeZone());
                calendar.setId(switcher.getId() + TimePeriodSwitcherRenderer.CALENDAR_SUFFIX);
                SimplePopup popup = new SimplePopup("o_daySwitcherPopup", calendar);
                popup.setId(switcher.getId() + TimePeriodSwitcherRenderer.POPUP_SUFFIX);
                try {
                    popup.encodeAll(context);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.