Package org.zkoss.zul

Examples of org.zkoss.zul.Treecell


        return null;
    }

    private Textbox getMaterialCategoryTextbox(Treeitem treeitem) {
        final Treerow tr = treeitem.getTreerow();
        final Treecell tc = (Treecell) tr.getChildren().get(0);
        return (Textbox) tc.getChildren().get(0);
    }
View Full Code Here


        messagesForUser.showInvalidValues(validationException);
    }

    private Textbox getCategoryTextbox(Treeitem treeitem) {
        final Treerow treerow = (Treerow) treeitem.getChildren().get(0);
        final Treecell treecell = (Treecell) treerow.getChildren().get(0);
        return (Textbox) treecell.getChildren().get(0);
    }
View Full Code Here

        return (Textbox) treecell.getChildren().get(0);
    }

    private Textbox getCategoryCodeTextbox(Treeitem treeitem) {
        final Treerow treerow = (Treerow) treeitem.getChildren().get(0);
        final Treecell treecell = (Treecell) treerow.getChildren().get(1);
        return (Textbox) treecell.getChildren().get(0);
    }
View Full Code Here

            boolean isCurrentScenario = currentScenario.getId().equals(
                    scenario.getId());

            Treerow treerow = new Treerow();

            Treecell nameTreecell = new Treecell();
            Label nameLabel = new Label(scenario.getName());
            nameTreecell.appendChild(nameLabel);
            treerow.appendChild(nameTreecell);

            Treecell operationsTreecell = new Treecell();

            Button createDerivedButton = new Button();
            createDerivedButton.setTooltiptext(_("Create derived"));
            createDerivedButton.setSclass("icono");
            createDerivedButton.setImage("/common/img/ico_derived1.png");
            createDerivedButton.setHoverImage("/common/img/ico_derived.png");

            createDerivedButton.addEventListener(Events.ON_CLICK,
                    new EventListener() {

                @Override
                public void onEvent(Event event) {
                    goToCreateDerivedForm(scenario);
                }

            });
            operationsTreecell.appendChild(createDerivedButton);

            Button editButton = Util.createEditButton(new EventListener() {

                @Override
                public void onEvent(Event event) {
                    goToEditForm(scenario);
                }

            });
            operationsTreecell.appendChild(editButton);

            Button removeButton = Util.createRemoveButton(new EventListener() {

                @Override
                public void onEvent(Event event) {
                    confirmDelete(scenario);
                }

            });

            boolean isMainScenario = PredefinedScenarios.MASTER.getScenario()
                    .getId().equals(scenario.getId());
            List<Scenario> derivedScenarios = scenarioModel
                    .getDerivedScenarios(scenario);
            if (isCurrentScenario || isMainScenario
                    || !derivedScenarios.isEmpty()) {
                removeButton.setDisabled(true);
            }
            operationsTreecell.appendChild(removeButton);

            Button connectButton = new Button(_("Connect"));
            connectButton.addEventListener(Events.ON_CLICK,
                    new EventListener() {

                        @Override
                        public void onEvent(Event event) {
                            connectTo(scenario);
                        }

                        private void connectTo(Scenario scenario) {
                            templateModel.setScenario(SecurityUtils
                                    .getSessionUserLoginName(),
                                    scenario,
                                    new IOnFinished() {
                                        @Override
                                        public void onWithoutErrorFinish() {
                                            Executions
                                                    .sendRedirect("/scenarios/scenarios.zul");
                                        }

                                        @Override
                                        public void errorHappened(
                                                Exception exceptionHappened) {
                                            errorHappenedDoingReassignation(exceptionHappened);
                                        }
                                    });
                        }

                    });
            if (isCurrentScenario) {
                connectButton.setDisabled(true);
            }
            operationsTreecell.appendChild(connectButton);

            treerow.appendChild(operationsTreecell);

            item.appendChild(treerow);
View Full Code Here

            if (snapshotOfOpenedNodes != null) {
                snapshotOfOpenedNodes.openIfRequired(item);
            }

            Treecell cellForName = new Treecell();
            Textbox textboxName= new Textbox();
            textboxName.setWidth("400px");
            cellForName.appendChild(Util.bind(textboxName,
                    new Util.Getter<String>() {

                        @Override
                        public String get() {
                            return criterionForThisRow.getName();
                        }
                    }, new Util.Setter<String>() {

                        @Override
                        public void set(String value) {
                            criterionForThisRow.setName(value);
                        }
                    }));
            String message = _("cannot be empty");
            textboxName
                    .setConstraint("no empty:"+message);

            Treecell cellForActive = new Treecell();
            cellForActive.setStyle("center");
            Checkbox checkboxActive = new Checkbox();
            cellForActive.appendChild(Util.bind(checkboxActive,
                    new Util.Getter<Boolean>() {

                        @Override
                        public Boolean get() {
                            return criterionForThisRow.isActive();
                        }
                    }, new Util.Setter<Boolean>() {

                        @Override
                        public void set(Boolean value) {
                            criterionForThisRow.setActive(value);
                        }
                    }));

            checkboxActive.addEventListener(Events.ON_CHECK,new EventListener() {
                @Override
                        public void onEvent(Event event) {
                    getModel().updateEnabledCriterions(criterionForThisRow.isActive(),criterionForThisRow);
                    reloadTree();
                }
            });

            Treerow tr = null;
            /*
             * Since only one treerow is allowed, if treerow is not null, append
             * treecells to it. If treerow is null, contruct a new treerow and
             * attach it to item.
             */
            if (item.getTreerow() == null) {
                tr = new Treerow();
                tr.setParent(item);
            } else {
                tr = item.getTreerow();
                tr.getChildren().clear();
            }
            // Attach treecells to treerow
            tr.setDraggable("true");
            tr.setDroppable("true");

            // Treecell with the cost category of the Criterion
            Treecell cellForCostCategory = new Treecell();
            criterionForThisRow.getCriterion().getCostCategory();
            cellForCostCategory.appendChild(appendAutocompleteType(item));

            // Treecell with the code of the Criterion
            Treecell cellForCode = new Treecell();
            cellForCode.setStyle("center");
            Textbox codeLabel = new Textbox();
            codeLabel.setDisabled(codeEditionDisabled);
            cellForCode.appendChild(Util.bind(codeLabel,
                    new Util.Getter<String>() {

                @Override
                public String get() {
                    return criterionForThisRow.getCriterion().getCode();
                }
            }, new Util.Setter<String>() {

                @Override
                public void set(String value) {
                    criterionForThisRow.getCriterion().setCode(value);
                }
            }));

            cellForName.setParent(tr);
            cellForCostCategory.setParent(tr);
            cellForCode.setParent(tr);
            cellForActive.setParent(tr);

            Treecell tcOperations = new Treecell();
            Button upbutton = new Button("", "/common/img/ico_bajar1.png");
            upbutton.setHoverImage("/common/img/ico_bajar.png");
            upbutton.setParent(tcOperations);
            upbutton.setSclass("icono");
            upbutton.addEventListener(Events.ON_CLICK, new EventListener() {
                @Override
                public void onEvent(Event event) {
                    getModel().down(criterionForThisRow);
                    reloadTree();
                }
            });

            Button downbutton = new Button("", "/common/img/ico_subir1.png");
            downbutton.setHoverImage("/common/img/ico_subir.png");
            downbutton.setParent(tcOperations);
            downbutton.setSclass("icono");
            downbutton.addEventListener(Events.ON_CLICK, new EventListener() {
                @Override
                public void onEvent(Event event) {
                    getModel().up(criterionForThisRow);
                    reloadTree();
                }
            });

            Button indentbutton = createButtonIndent();
            indentbutton.setParent(tcOperations);
            if(getModel().getCriterionType().allowHierarchy()){
                    indentbutton.addEventListener(Events.ON_CLICK, new EventListener() {
                @Override
                            public void onEvent(Event event) {
                    getModel().indent(criterionForThisRow);
                    reloadTree();
                }
                });
            }

            Button unindentbutton = createButtonUnindent();
            unindentbutton.setParent(tcOperations);
            if(getModel().getCriterionType().allowHierarchy()){
                unindentbutton.addEventListener(Events.ON_CLICK,
                    new EventListener() {
                        @Override
                            public void onEvent(Event event) {
                            getModel().unindent(criterionForThisRow);
                            reloadTree();
                        }
                    });
            }

            Button removebutton = createButtonRemove(criterionForThisRow);
            removebutton.setParent(tcOperations);
            if (criterionsModel.isDeletable(criterionForThisRow.getCriterion())) {
            removebutton.addEventListener(Events.ON_CLICK, new EventListener() {
            @Override
                            public void onEvent(Event event) {
                getModel().removeNode(criterionForThisRow);
                                if (!criterionForThisRow.isNewObject()) {
                                    criterionsModel
                                            .addForRemoval(criterionForThisRow
                                                    .getCriterion());
                                }
                reloadTree();
                }
            });
        }

            tcOperations.setParent(tr);
            tr.addEventListener("onDrop", new EventListener() {

                @Override
                public void onEvent(org.zkoss.zk.ui.event.Event arg0)
{
View Full Code Here

                    .getData();
            item.setValue(data);

            Treerow treerow = new Treerow();

            Treecell nameTreecell = new Treecell();
            Label nameLabel = new Label(baseCalendar.getName());
            nameTreecell.appendChild(nameLabel);
            treerow.appendChild(nameTreecell);

            // append start date of the current work week
            Treecell startDateTreecell = new Treecell();
            Label startDateLabel = new Label("---");
            CalendarData version = baseCalendar.getCalendarData(LocalDate
                    .fromDateFields(new Date()));
            CalendarData prevVersion = baseCalendar.getPrevious(version);
            if ((prevVersion != null)
                    && (prevVersion.getExpiringDate() != null)) {
                startDateLabel.setValue(prevVersion
                        .getExpiringDate().toString());
            }
            startDateTreecell.appendChild(startDateLabel);
            treerow.appendChild(startDateTreecell);

            // append expiring date of the current work week
            Treecell expiringDateTreecell = new Treecell();
            Label expiringDateLabel = new Label("---");
            if (version.getExpiringDate() != null) {
                expiringDateLabel
                        .setValue(version.getExpiringDate().toString());
            }
            expiringDateTreecell.appendChild(expiringDateLabel);
            treerow.appendChild(expiringDateTreecell);

            Treecell operationsTreecell = new Treecell();

            Button createDerivedButton = new Button();
            createDerivedButton.setTooltiptext(_("Create derived"));
            createDerivedButton.setSclass("icono");
            createDerivedButton.setImage("/common/img/ico_derived1.png");
            createDerivedButton.setHoverImage("/common/img/ico_derived.png");

            createDerivedButton.addEventListener(Events.ON_CLICK,
                    new EventListener() {

                @Override
                public void onEvent(Event event) {
                    goToCreateDerivedForm(baseCalendar);
                }

            });
            operationsTreecell.appendChild(createDerivedButton);
            Button createCopyButton = new Button();
            createCopyButton.setSclass("icono");
            createCopyButton.setTooltiptext(_("Create copy"));
            createCopyButton.setImage("/common/img/ico_copy1.png");
            createCopyButton.setHoverImage("/common/img/ico_copy.png");

            createCopyButton.addEventListener(Events.ON_CLICK,
                    new EventListener() {

                @Override
                public void onEvent(Event event) {
                    goToCreateCopyForm(baseCalendar);
                }

            });
            operationsTreecell.appendChild(createCopyButton);

            Button editButton = new Button();
            editButton.setTooltiptext(_("Edit"));
            editButton.setSclass("icono");
            editButton.setImage("/common/img/ico_editar1.png");
            editButton.setHoverImage("/common/img/ico_editar.png");

            editButton.addEventListener(Events.ON_CLICK, new EventListener() {

                @Override
                public void onEvent(Event event) {
                    goToEditForm(baseCalendar);
                }

            });
            operationsTreecell.appendChild(editButton);

            Button removeButton = new Button();
            removeButton.setTooltiptext(_("Remove"));
            removeButton.setSclass("icono");
            removeButton.setImage("/common/img/ico_borrar1.png");
            removeButton.setHoverImage("/common/img/ico_borrar.png");

            removeButton.addEventListener(Events.ON_CLICK, new EventListener() {

                @Override
                public void onEvent(Event event) {
                    confirmRemove(baseCalendar);
                }

            });
            if (baseCalendarModel.isDefaultCalendar(baseCalendar)) {
                removeButton.setDisabled(true);
                removeButton.setImage("/common/img/ico_borrar_out.png");
                removeButton.setHoverImage("/common/img/ico_borrar_out.png");
            }
            operationsTreecell.appendChild(removeButton);

            treerow.appendChild(operationsTreecell);

            item.appendChild(treerow);
View Full Code Here

TOP

Related Classes of org.zkoss.zul.Treecell

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.