Examples of Treerow


Examples of org.zkoss.zul.Treerow

        }
        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

Examples of org.zkoss.zul.Treerow

        final Treecell treecell = (Treecell) treerow.getChildren().get(0);
        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

Examples of org.zkoss.zul.Treerow

                    refreshMaterials();
                }
            });
            Treecell tc = new Treecell();

            Treerow tr = null;
            ti.setValue(node);
            if (ti.getTreerow() == null) {
                tr = new Treerow();
                tr.setParent(ti);
                ti.setOpen(true); // Expand node
            } else {
                tr = ti.getTreerow();
                tr.getChildren().clear();
            }
            tb.setParent(tc);
            tc.setParent(tr);

            final Textbox codeTb = new Textbox(materialCategory.getCode());
View Full Code Here

Examples of org.zkoss.zul.Treerow

        viewStateSnapshot = TreeViewStateSnapshot.takeSnapshot(tree);

        T fromNode = null;
        if (dragged instanceof Treerow) {
            Treerow from = (Treerow) dragged;
            fromNode = type.cast(((Treeitem) from.getParent()).getValue());
        }
        if (dragged instanceof Treeitem) {
            Treeitem from = (Treeitem) dragged;
            fromNode = type.cast(from.getValue());
        }
        if (dropedIn instanceof Tree) {
            getModel().moveToRoot(fromNode);
        }
        if (dropedIn instanceof Treerow) {
            Treerow to = (Treerow) dropedIn;
            T toNode = type.cast(((Treeitem) to.getParent()).getValue());

            getModel().move(fromNode, toNode);
        }
        reloadTreeUIAfterChanges();
    }
View Full Code Here

Examples of org.zkoss.zul.Treerow

            Scenario currentScenario = scenarioManager.getCurrent();
            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);

            // Show the tree expanded at start
            item.setOpen(true);
View Full Code Here

Examples of org.zkoss.zul.Treerow

        }
    }

    public void move(Component dropedIn, Component dragged) {
        snapshotOfOpenedNodes = TreeViewStateSnapshot.snapshotOpened(tree);
        Treerow from = (Treerow) dragged;
        CriterionDTO fromNode = (CriterionDTO) ((Treeitem) from.getParent())
                .getValue();
        if (dropedIn instanceof Tree) {
            getModel().moveToRoot(fromNode,0);
        }
        if (dropedIn instanceof Treerow) {
            Treerow to = (Treerow) dropedIn;
            CriterionDTO toNode = (CriterionDTO) ((Treeitem) to.getParent())
                    .getValue();
            getModel().move(fromNode, toNode,0);
        }
        reloadTree();
    }
View Full Code Here

Examples of org.zkoss.zul.Treerow

                    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)
{
                    DropEvent dropEvent = (DropEvent) arg0;
View Full Code Here

Examples of org.zkoss.zul.Treerow

            SimpleTreeNode simpleTreeNode = (SimpleTreeNode) data;
            final BaseCalendar baseCalendar = (BaseCalendar) simpleTreeNode
                    .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);

            // Show the tree expanded at start
            item.setOpen(true);
View Full Code Here

Examples of org.zkoss.zul.api.Treerow

            disableCodeBoxes(each, disabled);
        }
    }

    private void disableCodeBoxes(Treeitem item, boolean disabled) {
        Treerow row = item.getTreerow();
        InputElement codeBox = (InputElement) ((Treecell) row.getChildren()
                .get(1)).getChildren().get(0);
        codeBox.setDisabled(disabled);
        codeBox.invalidate();

        Set<Treeitem> childrenSet = new HashSet<Treeitem>();
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.