Package org.openfaces.component.timetable

Examples of org.openfaces.component.timetable.Timetable


public class TimetableRenderer extends TimetableRendererBase {

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        Timetable timetable = (Timetable) component;

        if (!component.isRendered())
            return;

        Rendering.registerDateTimeFormatObject(timetable.getLocale());
        AjaxUtil.prepareComponentForAjax(context, timetable);

        timetable.setEvent(null);
        String clientId = timetable.getClientId(context);
        writer.startElement("table", timetable);
        writer.writeAttribute("id", clientId, "id");
        writer.writeAttribute("cellspacing", "0", null);
        writer.writeAttribute("cellpadding", "0", null);
        writer.writeAttribute("border", "0", null);
        writer.writeAttribute("class", Styles.getCSSClass(context,
                timetable, timetable.getStyle(), "o_timetableView", timetable.getStyleClass()), null);
        Rendering.writeStandardEvents(writer, timetable);
        writer.startElement("tbody", timetable);

        renderHeader(context, timetable);

        writer.startElement("tr", timetable);
        writer.writeAttribute("class", "o_timetableView_tableRow", null);
        writer.startElement("td", timetable);
        writer.writeAttribute("style", "height: 100%", null);

        LayeredPane layeredPane = getLayeredPane(timetable);
        layeredPane.encodeAll(context);

        List<String> viewIds = new ArrayList<String>();
        for (UIComponent c : layeredPane.getChildren()) {
            SubPanel subPanel = (SubPanel) c;
            if (subPanel.getChildCount() != 1) throw new IllegalStateException();
            VirtualContainer container = (VirtualContainer) subPanel.getChildren().get(0);
            TimetableView timetableView = (TimetableView) container.getVirtualChild();
            String viewId = timetableView.getClientId(context);
            viewIds.add(viewId);
        }

        Rendering.renderInitScript(context, new ScriptBuilder().initScript(context, timetable, "O$.Timetable._init",
                layeredPane,
                viewIds,
                timetable.getViewType(),
                Rendering.getEventsParam(timetable, "onviewtypechange")

        ), getTimetableJsURL(context));

        writer.endElement("td");
View Full Code Here


        writer.writeAttribute("border", "0", null);
    }

    @Override
    protected void writeHeaderRightAreaAttributes(ResponseWriter writer, TimetableView timetableView) throws IOException {
        Timetable timetable = (Timetable) timetableView;
        Rendering.writeStyleAndClassAttributes(writer, timetable, "headerRight", "o_timetable_headerRightCell");
    }
View Full Code Here

    }

    @Override
    public void decode(FacesContext context, UIComponent component) {
        super.decode(context, component);
        Timetable timetable = (Timetable) component;
        String viewStr = Faces.requestParam(timetable.getClientId(context) + Rendering.CLIENT_ID_SUFFIX_SEPARATOR + "view");
        Timetable.ViewType viewType = Timetable.ViewType.valueOf(viewStr.toUpperCase());
        timetable.setViewType(viewType);
    }
View Full Code Here

        writer.startElement("span", switcher);
        writeIdAttribute(context, switcher);
        LayeredPane layeredPane = getLayeredPane(switcher);
        layeredPane.encodeAll(context);

        Timetable timetable = switcher.getTimetableView();
        Rendering.renderInitScript(context, new ScriptBuilder().initScript(context, switcher,
                "O$.TimePeriodSwitcher._init", timetable),
                Resources.utilJsURL(context),
                TimetableRenderer.getTimetableJsURL(context));
View Full Code Here

            children.add(new SubPanel(null, switcher.getMonthSwitcher()));
            children.add(new SubPanel(null, switcher.getWeekSwitcher()));
            children.add(new SubPanel(null, switcher.getDaySwitcher()));
        }

        Timetable timetable = switcher.getTimetableView();

        Timetable.ViewType currentViewType = timetable.getViewType();
        List<UIComponent> children = layeredPane.getChildren();
        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

        writer.startElement("table", timetableView);
        writer.writeAttribute("id", clientId, "id");
        writer.writeAttribute("cellspacing", "0", null);
        writer.writeAttribute("cellpadding", "0", null);
        writer.writeAttribute("border", "0", null);
        Timetable timetable = timetableView.getTimetable();
        writer.writeAttribute("class", Styles.getCSSClass(context,
                timetableView, timetableView.getStyle(),
                timetable == null ? "o_timetableView" : "o_timetableView o_timetableView_embedded",
                timetableView.getStyleClass()), null);
        Rendering.writeStandardEvents(writer, timetableView);
View Full Code Here

        JSONArray areaSettings = encodeEventAreas(context, timetableView, events);

        UITimetableEvent uiEvent = timetableView.getUITimetableEvent();

        Timetable timetable = timetableView.getTimetable();

        try {
            Rendering.renderInitScript(context,
                    new ScriptBuilder().initScript(context, timetableView, getJsInitFunctionName(),
                            DataUtil.formatDateTimeForJs(timetableView.getDay(), timeZone),
View Full Code Here

        writer.startElement("table", timetableView);
        writer.writeAttribute("id", clientId, "id");
        writer.writeAttribute("cellspacing", "0", null);
        writer.writeAttribute("cellpadding", "0", null);
        writer.writeAttribute("border", "0", null);
        Timetable timetable = timetableView.getTimetable();
        writer.writeAttribute("class", Styles.getCSSClass(context,
                timetableView, timetableView.getStyle(),
                timetable == null ? "o_timetableView" : "o_timetableView o_timetableView_embedded",
                timetableView.getStyleClass()), null);
        Rendering.writeStandardEvents(writer, timetableView);
View Full Code Here

        JSONArray areaSettings = encodeEventAreas(context, timetableView, events);

        UITimetableEvent uiEvent = timetableView.getUITimetableEvent();

        Timetable timetable = timetableView.getTimetable();

        try {
            Rendering.renderInitScript(context,
                    new ScriptBuilder().initScript(
                            context,
View Full Code Here

public class TimetableViewSwitcherRenderer extends TabSetRenderer {
    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        TimetableViewSwitcher switcher = (TimetableViewSwitcher) component;
        Timetable timetable = switcher.getTimetable();
        List<UIComponent> children = switcher.getChildren();
        children.clear();
        children.add(createTabSetItem("Month", switcher, "monthItem"));
        children.add(createTabSetItem("Week", switcher, "weekItem"));
        children.add(createTabSetItem("Day", switcher, "dayItem"));
View Full Code Here

TOP

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

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.