我有一个删除渲染并将渲染转换为zul的问题。我在这里有render方法,这个渲染方法删除并且渲染代码写在zul中。

我的祖尔:-

<listbox id="caseInfoCodesViewList" sizedByContent="true"
            sclass="vertical-scroll" vflex="1" model="@bind(vm.folderInfoList)"
            emptyMessage="${a:resource('LABEL_NOROWS')}"
            itemRenderer="@load(vm.itemRenderer)"
            selectedItems="@bind(vm.selectedCodes)" checkmark="@load(vm.data)"
                     multiple="true">
            <listhead >
                <listheader label="@load(vm.getText('FolderInfoDetail:LABEL_DESCRIPTION'))" width="25%"></listheader>
                <listheader label="@load(vm.getText('FolderInfoDetail:LABEL_CODES'))" width="10%"></listheader>
                <listheader label="@load(vm.getText('FolderInfoDetail:LABEL_ORDER'))" width="15%"></listheader>
                <listheader label="@load(vm.getText('FolderInfoDetail:LABEL_PRINT'))" width="15%"></listheader>
                <listheader label="@load(vm.getText('FolderInfoDetail:LABEL_REQUIRED'))" width="20%"></listheader>
                <listheader label="@load(vm.getText('FolderInfoDetail:MANDATORY'))" width="15%"></listheader>
            </listhead>
                </listbox>

View 模型
   @NotifyChange("*")
        public ListitemRenderer getItemRenderer() {

            ListitemRenderer _rowRenderer = null;
            if (_rowRenderer == null) {
                _rowRenderer = new ListitemRenderer() {
                    public void render(Listitem row, Object data, int index) throws Exception {
                        if (row instanceof Listgroup) {
                            Listcell group = new Listcell(data.toString());

                            row.appendChild(group);
                        } else {
                            final FolderInfoData info = (FolderInfoData) data;
                            row.setAttribute("data", info);
                            Listcell descCell = new Listcell();
                            descCell.setValue(info.infoDesc);
                            Label label = new Label();
                            if (StringUtils.isNotBlank(info.infoDesc)) {
                                label.setValue(info.infoDesc);
                            }
                            label.setMaxlength(15);
                            descCell.appendChild(label);

                            row.setValue(String.valueOf(info.infoCode));
                            row.appendChild(descCell);

                            row.setValue(String.valueOf(info.infoCode));
                            row.appendChild(new Listcell(String.valueOf(info.infoCode)));

                            Listcell orderCell = new Listcell();
                            orderCell.setValue(String.valueOf(info.infoDisplayOrder));

                            Intbox tbox = new Intbox();
                            tbox.setValue(info.infoDisplayOrder);
                            tbox.setMaxlength(10);
                            orderCell.appendChild(tbox);
                            row.appendChild(orderCell);

                            Listcell printFlagCell = new Listcell();
                            Radiogroup groupPrintCell = new Radiogroup();
                            Radio yesPrintFlag = new Radio("Yes");
                            yesPrintFlag.setValue("Y");
                            groupPrintCell.appendChild(yesPrintFlag);
                            Radio noPrintFlag = new Radio("No");
                            noPrintFlag.setValue("N");
                            groupPrintCell.appendChild(noPrintFlag);
                            if (abcd.toBoolean(info.infoPrintFlag)) {
                                groupPrintCell.setSelectedItem(yesPrintFlag);
                            } else {
                                groupPrintCell.setSelectedItem(noPrintFlag);
                            }
                            printFlagCell.appendChild(groupPrintCell);
                            row.appendChild(printFlagCell);

                            Listcell setUpCell = new Listcell();
                            Radiogroup groupSetUP = new Radiogroup();
                            Radio yesSetUP = new Radio("Yes");
                            yesSetUP.setValue("Y");
                            groupSetUP.appendChild(yesSetUP);
                            Radio noSetUP = new Radio("No");
                            noSetUP.setValue("N");
                            groupSetUP.appendChild(noSetUP);
                            if (abcd.toBoolean(info.valueRequired)) {
                                groupSetUP.setSelectedItem(yesSetUP);
                            } else {
                                groupSetUP.setSelectedItem(noSetUP);
                            }
                            setUpCell.appendChild(groupSetUP);
                            row.appendChild(setUpCell);

                            Listcell mandatoryCell = new Listcell();
                            Radiogroup groupMandatory = new Radiogroup();
                            Radio yesMandatory = new Radio("Yes");
                            yesMandatory.setValue("Y");
                            groupMandatory.appendChild(yesMandatory);
                            Radio noMandatory = new Radio("No");
                            noMandatory.setValue("N");
                            groupMandatory.appendChild(noMandatory);
                            if (abcd.toBoolean(info.getMandatory())) {
                                groupMandatory.setSelectedItem(yesMandatory);
                            } else {
                                groupMandatory.setSelectedItem(noMandatory);
                            }
                            mandatoryCell.appendChild(groupMandatory);
                            row.appendChild(mandatoryCell);

                        }
                    }

                };
            }
            return _rowRenderer;
        }

谁能告诉我如何将此渲染更改为zul?

最佳答案

就像我看到您使用MVVM一样简单。在ZUl端使用简单的Listbox,因为您现在没有在ZUL页面中添加ListItemListCell,因此您使用了呈现的方式,我建议使用Listbox其他子组件ListItemListCell并检查zul中的值您可以在ZUL中使用表达式以及${"Some Expression"},它将解决您的问题。

关于java - 将渲染转换为Zul?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19922330/

10-09 05:40