Examples of AbstractCalendar


Examples of org.richfaces.component.AbstractCalendar

        return shiftedLabels;
    }

    protected Map<String, Object> getLocaleOptions(FacesContext facesContext, UIComponent component) {
        AbstractCalendar calendarComponent = (AbstractCalendar) component;

        Map<String, Object> map = new HashMap<String, Object>();

        Locale locale = CalendarHelper.getAsLocale(facesContext, calendarComponent);
        DateFormatSymbols dateFormat = new DateFormatSymbols(locale);

        Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarComponent);
        int maximum = calendar.getActualMaximum(Calendar.DAY_OF_WEEK);
        int minimum = calendar.getActualMinimum(Calendar.DAY_OF_WEEK);

        int monthMax = calendar.getActualMaximum(Calendar.MONTH);
        int monthMin = calendar.getActualMinimum(Calendar.MONTH);

        String[] weekDayLabels = RenderKitUtils.asArray(calendarComponent.getWeekDayLabels());
        if (isEmptyArray(weekDayLabels)) {
            weekDayLabels = dateFormat.getWeekdays();
            weekDayLabels = shiftDates(minimum, maximum, weekDayLabels);
        }
        RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS, weekDayLabels);

        String[] weekDayLabelsShort = RenderKitUtils.asArray(calendarComponent.getWeekDayLabelsShort());
        if (isEmptyArray(weekDayLabelsShort)) {
            weekDayLabelsShort = dateFormat.getShortWeekdays();
            weekDayLabelsShort = shiftDates(minimum, maximum, weekDayLabelsShort);
        }
        RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);

        String[] monthLabels = RenderKitUtils.asArray(calendarComponent.getMonthLabels());
        if (isEmptyArray(monthLabels)) {
            monthLabels = dateFormat.getMonths();
            monthLabels = shiftDates(monthMin, monthMax, monthLabels);
        }
        RenderKitUtils.addToScriptHash(map, MONTH_LABELS, monthLabels);

        String[] monthLabelsShort = RenderKitUtils.asArray(calendarComponent.getMonthLabelsShort());
        if (isEmptyArray(monthLabelsShort)) {
            monthLabelsShort = dateFormat.getShortMonths();
            monthLabelsShort = shiftDates(monthMin, monthMax, monthLabelsShort);
        }
        RenderKitUtils.addToScriptHash(map, MONTH_LABELS_SHORT, monthLabelsShort);

        int minDaysInFirstWeek = calendarComponent.getMinDaysInFirstWeek();

        if (1 > minDaysInFirstWeek || minDaysInFirstWeek > 7) {
            minDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
        }

        if (0 <= minDaysInFirstWeek && minDaysInFirstWeek <= 7) {
            RenderKitUtils.addToScriptHash(map, MIN_DAYS_IN_FIRST_WEEK, minDaysInFirstWeek);
        }

        int day = calendarComponent.getFirstWeekDay();
        if (day < 0 || 6 < day) {
            day = calendar.getFirstDayOfWeek() - calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
        }

        if (0 <= day && day <= 6) {
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

        }
        return true;
    }

    public String getPopupStyle(FacesContext facesContext, UIComponent component) {
        AbstractCalendar calendar = (AbstractCalendar) component;
        int zindex = calendar.getZindex();
        if (zindex < 0) {
            zindex = 3;
        }

        return HtmlUtil.concatStyles("z-index: " + zindex, calendar.getPopupStyle());
    }
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

    public Locale getAsLocale(FacesContext facesContext, UIComponent component) {
        return CalendarHelper.getAsLocale(facesContext, component);
    }

    public String writePreloadBody(FacesContext context, UIComponent component) throws IOException {
        AbstractCalendar calendar = (AbstractCalendar) component;
        Object preload = calendar.getPreload();
        if (preload != null) {
            return RenderKitUtils.toScriptArgs(preload);
        } else {
            return null;
        }
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

        return result;
    }

    public static Locale getAsLocale(FacesContext facesContext, UIComponent component) {
        AbstractCalendar calendar = (AbstractCalendar) component;

        if (calendar == null || facesContext == null) {
            return null;
        }

        Object locale = calendar.getLocale();
        return getAsLocale(facesContext, calendar, locale);
    }
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

        }
        return true;
    }

    public String getPopupStyle(FacesContext facesContext, UIComponent component) {
        AbstractCalendar calendar = (AbstractCalendar) component;
        int zindex = calendar.getZindex();
        if (zindex < 0) {
            zindex = 3;
        }

        return HtmlUtil.concatStyles("z-index: " + zindex, calendar.getPopupStyle());
    }
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

    public Locale getAsLocale(FacesContext facesContext, UIComponent component) {
        return CalendarHelper.getAsLocale(facesContext, component);
    }

    public String writePreloadBody(FacesContext context, UIComponent component) throws IOException {
        AbstractCalendar calendar = (AbstractCalendar) component;
        Object preload = calendar.getPreload();
        if (preload != null) {
            return RenderKitUtils.toScriptArgs(preload);
        } else {
            return null;
        }
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

    protected void doDecode(FacesContext context, UIComponent component) {
        if (!(component instanceof AbstractCalendar)) {
            return;
        }

        AbstractCalendar calendar = (AbstractCalendar) component;
        if (calendar.isDisabled()) {
            return;
        }

        Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();

        String clientId = calendar.getClientId(context);
        String currentDateString = (String) requestParameterMap.get(clientId + CURRENT_DATE_INPUT);
        if (currentDateString != null) {
            calendar.queueEvent(new CurrentDateChangeEvent(calendar, currentDateString));
        }

        String selectedDateString = requestParameterMap.get(clientId + "InputDate");
        if (selectedDateString != null) {
            calendar.setSubmittedValue(selectedDateString);
        }

        if (requestParameterMap.get(component.getClientId(context) + ".ajax") != null) {
            PartialViewContext pvc = context.getPartialViewContext();
            pvc.getRenderIds().add(
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

        return buttonIcon;
    }

    public Object getSelectedDate(FacesContext facesContext, UIComponent component) throws IOException {
        Object returnValue = null;
        AbstractCalendar calendar = (AbstractCalendar) component;
        if (calendar.isValid()) {
            Date date;
            Object value = calendar.getValue();
            date = CalendarHelper.getAsDate(facesContext, calendar, value);
            if (date != null) {
                returnValue = formatSelectedDate(CalendarHelper.getTimeZoneOrDefault(calendar), date);
            }
        }
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

        return returnValue;
    }

    public static Object formatSelectedDate(TimeZone timeZone, Date date) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        AbstractCalendar calendarInstance = (AbstractCalendar) AbstractCalendar.getCurrentComponent(facesContext);
        Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarInstance);

        calendar.setTimeZone(timeZone);
        calendar.setTime(date);
View Full Code Here

Examples of org.richfaces.component.AbstractCalendar

        return result;
    }

    public Object getCurrentDate(FacesContext facesContext, UIComponent component) throws IOException {
        AbstractCalendar calendar = (AbstractCalendar) component;
        Date date = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
        return formatDate(date);
    }
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.