Package org.openfaces.component.timetable

Examples of org.openfaces.component.timetable.AbstractSwitcher


        int viewIndex = 0;
        for (int i = 0, count = children.size(); i < count; i++) {
            SubPanel subPanel = (SubPanel) children.get(i);
            if (subPanel.getChildCount() != 1)
                throw new IllegalArgumentException("One child component expected, but was " + subPanel.getChildCount() + "; panel index: " + i);
            AbstractSwitcher viewInThisPanel = (AbstractSwitcher) subPanel.getChildren().get(0);
            Timetable.ViewType viewType = viewInThisPanel.getApplicableViewType();
            TimetableView appropriateView = timetable.getViewByType(viewType);
            viewInThisPanel.setFor(":" + appropriateView.getClientId(context));
            if (viewType == currentViewType) {
                viewIndex = i;
            }

        }
View Full Code Here


    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        if (!component.isRendered())
            return;

        AbstractSwitcher switcher = (AbstractSwitcher) component;

        Locale locale = switcher.getLocale();
        Rendering.registerDateTimeFormatObject(locale);

        TimetableView timetableView = switcher.getTimetableView();
        TimeZone timeZone = switcher.getTimeZone();

        SimpleDateFormat dateFormat = CalendarUtil.getSimpleDateFormat(switcher.getDateFormat(),
                DEFAULT_DATE_FORMAT, getPattern(switcher), null, locale, timeZone);
        String pattern = dateFormat.toPattern();

        ResponseWriter writer = context.getResponseWriter();
        writer.startElement("table", switcher);

        writeIdAttribute(context, switcher);
        writer.writeAttribute("cellspacing", "0", null);
        writer.writeAttribute("cellpadding", "0", null);
        writer.writeAttribute("border", "0", null);
        String styleClass = Styles.getCSSClass(context,
                switcher, switcher.getStyle(), "o_timeSwitcher", switcher.getStyleClass());
        writer.writeAttribute("class", styleClass, null);
        writer.startElement("tbody", switcher);
        writer.startElement("tr", switcher);

        boolean enabled = switcher.isEnabled();

        if (enabled) {
            renderPreviousButton(context, switcher);
        }

        writer.startElement("td", switcher);
        writer.writeAttribute("class", "o_timeTextContainer", null);

        renderText(context, switcher, timetableView, dateFormat);

        writer.endElement("td");

        if (enabled) {
            renderNextButton(context, switcher);
        }

        writer.endElement("tr");

        writer.endElement("tbody");
        writer.endElement("table");

        JSONObject stylingParams = getStylingParamsObj(context, switcher);
        Styles.renderStyleClasses(context, switcher);

        Date dayInitParam = getDayInitParam(timetableView);
        Object[] params = {
                timetableView,
                DataUtil.formatDateTimeForJs(dayInitParam, timeZone),
                pattern,
                locale,
                stylingParams,
                enabled
        };

        Object[] additionalParams = getAdditionalParams(context);

        String switcherClassName = switcher.getClass().getName();
        int i = switcherClassName.lastIndexOf(".");
        switcherClassName = switcherClassName.substring(i + 1);

        ScriptBuilder script = new ScriptBuilder().initScript(context, switcher, "O$." + switcherClassName + "._init",
                concatenateArrays(params, additionalParams)
View Full Code Here

TOP

Related Classes of org.openfaces.component.timetable.AbstractSwitcher

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.