Package org.openfaces.component.timetable

Examples of org.openfaces.component.timetable.EventEditorDialog


        return "350px";
    }

    @Override
    protected void encodeCustomContent(FacesContext context, PopupLayer popupLayer) throws IOException {
        final EventEditorDialog dialog = (EventEditorDialog) popupLayer;
        final TimetableView timetableView = (TimetableView) dialog.getParent();
        TimetableEditingOptions editingOptions = timetableView.getEditingOptions();
        final boolean useResourceSeparationMode = (Boolean) timetableView.getAttributes().
                get(TimeScaleTableRenderer.USE_RESOURCE_SEPARATION_MODE_ATTR) && (editingOptions != null && editingOptions.isEventResourceEditable());
        final boolean eventDurationEditable = (editingOptions != null && editingOptions.isEventDurationEditable());
        final UIComponent[][] components = new UIComponent[][]{
                {
                        createLabelComponent(context, dialog, "nameLabel", dialog.getNameLabel()),
                        getNameField(context, dialog)
                },
                {
                        createLabelComponent(context, dialog, "resourceLabel", dialog.getResourceLabel()),
                        getResourceField(context, dialog)
                },
                {
                        createLabelComponent(context, dialog, "startLabel", dialog.getStartLabel()),
                        createDateTimeFields(context, dialog, "start")
                },
                {
                        createLabelComponent(context, dialog, "endLabel", dialog.getEndLabel()),
                        createDateTimeFields(context, dialog, "end")
                },
                {
                        createLabelComponent(context, dialog, "descriptionLabel", dialog.getDescriptionLabel()),
                },
                {
                        getDescriptionField(context, dialog)
                },
                {
                        null
                }
        };

        new TableRenderer() {

            @Override
            protected void writeTableAttributes(FacesContext context, ResponseWriter writer, UIComponent component) throws IOException {
                super.writeTableAttributes(context, writer, component);
                writer.writeAttribute("class", "o_fullWidthAndHeight", null);
            }

            protected boolean isRowVisible(int rowIndex) {
                switch (rowIndex) {
                    case 1:
                        return useResourceSeparationMode;
                    case 3:
                        return eventDurationEditable;
                    default:
                        return true;
                }
            }

            @Override
            protected void writeRowAttributes(ResponseWriter writer, int rowIndex) throws IOException {
                if (rowIndex == 5) {
                    writer.writeAttribute("style", "height: 100%;", null);
                }
            }

            @Override
            protected void writeCellAttributes(ResponseWriter writer, int rowIndex, int cellIndex) throws IOException {
                super.writeCellAttributes(writer, rowIndex, cellIndex);
                if (rowIndex < 4 && cellIndex == 0)
                    writer.writeAttribute("style", "width: 0", null);
                if (rowIndex == 5)
                    writer.writeAttribute("style", "vertical-align: top;", null);
            }

            @Override
            protected void encodeCellContents(FacesContext context, ResponseWriter writer, UIComponent component, int rowIndex, int colIndex) throws IOException {
                super.encodeCellContents(context, writer, component, rowIndex, colIndex);
                if (rowIndex == components.length - 1) {
                    writer.startElement("div", component);
                    writer.writeAttribute("class", "o_eventEditor_buttonsArea", null);

                    HtmlCommandButton deleteButton = Components.createButtonFacet(context, dialog, "deleteButton", dialog.getDeleteButtonText());
                    deleteButton.setStyle(Styles.mergeStyles("float: left", dialog.getDeleteButtonStyle()));
                    deleteButton.setStyleClass(dialog.getDeleteButtonClass());
                    deleteButton.encodeAll(context);

                    HtmlCommandButton okButton = Components.createButtonFacet(context, dialog, "okButton", dialog.getOkButtonText());
                    okButton.setStyle(dialog.getOkButtonStyle());
                    okButton.setStyleClass(dialog.getOkButtonClass());
                    okButton.encodeAll(context);
                    HtmlCommandButton cancelButton = Components.createButtonFacet(context, dialog, "cancelButton", dialog.getCancelButtonText());
                    writer.write(HTML.NBSP_ENTITY);
                    cancelButton.setStyle(dialog.getCancelButtonStyle());
                    cancelButton.setStyleClass(dialog.getCancelButtonClass());
                    cancelButton.encodeAll(context);
                    writer.endElement("div");

                    Rendering.renderInitScript(context, new ScriptBuilder().functionCall("O$.Timetable._initEventEditorDialog",
                            timetableView,
                            dialog,
                            dialog.getCreateEventCaption(),
                            dialog.getEditEventCaption(),
                            dialog.isCentered()).semicolon());
                }
            }

        }.render(popupLayer, components);
    }
View Full Code Here

TOP

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

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.