Package cn.com.elements.containstag.table

Examples of cn.com.elements.containstag.table.TableTrElementTag


    }

    protected int parserTableEvents(Grid g, TableElementTag tableContainer) {
        DivElementTag tableDiv = new DivElementTag(g.id() + _HEADER_TABLE_DIV_ID, _HEADER_TABLE_DIV_CSS);
        TableTdElementTag tdContainer = new TableTdElementTag();
        TableTrElementTag tableTrElement = new TableTrElementTag();
        // 添加对表格中行进行增加及删除操作的DIV
        // TODO 需要追加如果配置的删除追加就必须为可选择
        if (g.addabled() || g.deletabled()) {
            DivElementTag buttonDiv = new DivElementTag(g.id() + _TABLE_BUTTON_DIV_ID, _TABLE_BUTTON_DIV_CSS);
            if (g.addabled()) {
                InputElementTag buttonElement = new InputElementTag();
                buttonElement.setId(_ADD_ITEM_ID);
                buttonElement.setCssClass(_TABLE_BUTTON_CSS);
                buttonElement.setType(ElementEnum.BUTTON.name());
                buttonElement.setValue(Element.LabelContent.getLabelContent(_ADD_BUTTON_LABEL_ID));
                buttonElement.setOnclick(_ADDED_TABLETR_FONT + g.id() + _ADDED_TABLETR_FOOT);
                buttonDiv.addChildrenTag(buttonElement);
            }
            if (g.deletabled()) {
                InputElementTag buttonElement = new InputElementTag();
                buttonElement.setId(_DELETE_ITEM_ID);
                buttonElement.setCssClass(_TABLE_BUTTON_CSS);
                buttonElement.setType(ElementEnum.BUTTON.name());
                buttonElement.setOnclick(_DELETE_TABLE_TR_FONT + g.id() + _DELETE_TABLE_TR_FOOT);
                buttonElement.setValue(Element.LabelContent.getLabelContent(_DELETE_BUTTON_LABEL));
                buttonDiv.addChildrenTag(buttonElement);
            }
            if (g.copyabled()) {
                InputElementTag buttonElement = new InputElementTag();
                buttonElement.setId(_COPY_ITEM_ID);
                buttonElement.setCssClass(_TABLE_BUTTON_CSS);
                buttonElement.setType(ElementEnum.BUTTON.name());
                buttonElement.setValue(Element.LabelContent.getLabelContent(_COPY_BUTTON_LABEL));
                buttonElement.setOnclick(_ADDED_TABLETR_FONT + g.id() + _COPY_TABLE_TR_FOOT);
                buttonDiv.addChildrenTag(buttonElement);
            }
            tableDiv.addChildrenTag(buttonDiv);
        }
        int columnCount = parserTableThead(g, tableDiv);
        tdContainer.addChildrenTag(tableDiv);
        tableTrElement.addChildrenTag(tdContainer);
        tableContainer.addChildrenTag(tableTrElement);

        return columnCount;
    }
View Full Code Here


     * @param tableContainer
     * @param g
     * @throws AppException
     */
    protected void parserTableTbody(int columnCount, TableElementTag tableContainer, Grid g) throws AppException {
        TableTrElementTag tableTrElement;
        DivElementTag contentDiv;
        TableTdElementTag tableTdElement;
        TableElementTag tableElement;
        DivElementTag tableDiv;
        // 表格内容
        tableTrElement = new TableTrElementTag();
        TableTdElementTag tdContainer = new TableTdElementTag();
        tdContainer.setColspan(String.valueOf(columnCount));
        tableTrElement.addChildrenTag(tdContainer);
        tableContainer.addChildrenTag(tableTrElement);
        tableDiv = new DivElementTag(g.id() + _CONTENT_TABLE_DIV_ID, _BODY_CONTAINER_CSS);
        // 填充实体bean中的数据
        // 表格元素
        tableElement = new TableElementTag(g.id() + _CONTENT_TABLE_ID, _INPUT_TABLE_CONTENT_CSS);
        List tableData = super.getParser().getGridValue(g.id());
        if (tableData != null) {
            int idx = 0;
            String cssClass = null;
            for (Object obj : tableData) {
                if (idx++ % 2 == 0) {
                    cssClass = _DOUBLE_TR_CSS;
                } else {
                    cssClass = _SINGLE_TR_CSS;
                }
                tableTrElement = new TableTrElementTag(g.id() + _CONTENT_TABLE_TR_ID + idx, cssClass);
                // 解析表格选择框
                parserCheckboxElement(g, idx, tableTrElement);
                for (Element e : g.columns()) {
                    tableTdElement = new TableTdElementTag(e.id() + _CONTENT_TABLE_TD_ID);
                    contentDiv = new DivElementTag(e.id() + _CONTENT_DIV_ID, _CONTENT_DIV_CSS);
                    // 解析单元素
                    parserElement(g.id(), e, contentDiv, null, null, super.getParser().invokeValue(obj, e));
                    tableTdElement.addChildrenTag(contentDiv);
                    tableTrElement.addChildrenTag(tableTdElement);
                }
                tableElement.addChildrenTag(tableTrElement);
            }
        }
        tableDiv.addChildrenTag(tableElement);
View Full Code Here

TOP

Related Classes of cn.com.elements.containstag.table.TableTrElementTag

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.