Package cn.com.elements.containstag.table

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


        Grid[] grids = super.getParser().getGroup().grids();
        // 追加容器标签
        DivElementTag containerDiv = new DivElementTag(_TABLE_CONTAINER_DIV_ID, _TABLE_CONTAINER_DIV_CSS);
        for (Grid g : grids) {

            TableElementTag tableContainer = new TableElementTag(_TABLE_CONTAINER_ID, _TABLE_CONTAINER_CSS);
            // 解析表格事件
            // TD跨列的数量
            int columnCount = parserTableEvents(g, tableContainer);
            // 解析表格内容
            parserTableTbody(columnCount, tableContainer, g);
View Full Code Here


     */
    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);
        tdContainer.addChildrenTag(tableDiv);
    }
View Full Code Here

     */
    protected int parserTableThead(Grid g, DivElementTag tableDiv) {
        int columnCount = 0;

        DivElementTag contentDiv;
        TableElementTag tableElement;
        // 表格元素
        tableElement = new TableElementTag(g.id() + _HEADER_TABLE_ID, _INPUT_TABLE_HEADER_CSS);
        // 表格头元素
        TableTheadElementTag theadContainer = new TableTheadElementTag();
        TableThElementTag thContainer = new TableThElementTag();
        if (g.selectabled()) {
            contentDiv = new DivElementTag(_CHECK_TD_ID, _CHECK_THEAD_CSS);
            if (g.isMultiple()) {
                InputElementTag checkboxElement = new InputElementTag();
                checkboxElement.setId(_SELECT_ALL_ID);
                checkboxElement.setType(ElementEnum.CHECKBOX.name());
                checkboxElement.setOnclick(_SELECT_ALL_EVENT);
                contentDiv.addChildrenTag(checkboxElement);
            }
            thContainer.addChildrenTag(contentDiv);
            theadContainer.addChildrenTag(thContainer);
        }
        LabelElementTag labelElement = null;
        for (Element column : g.columns()) {
            thContainer = new TableThElementTag();
            contentDiv = new DivElementTag(column.id() + _CONTENT_TABLE_ELEMNTS_DIV_ID, _CONTENT_DIV_CSS);
            labelElement = new LabelElementTag();
            labelElement.setValue(Element.LabelContent.getLabelContent(StringUtil.isEmpty(column.label()) ? column.id().toUpperCase() : column.label()));
            contentDiv.addChildrenTag(labelElement);
            if (column.required()) {
                parserRequiredElement(column, contentDiv, _REQUIRED_CSS);
            }
            theadContainer.addChildrenTag(thContainer);
            thContainer.addChildrenTag(contentDiv);
            columnCount++;
        }
        tableElement.addChildrenTag(theadContainer);
        // 追加表头
        tableDiv.addChildrenTag(tableElement);

        return columnCount;
    }
View Full Code Here

        Grid[] grids = super.getParser().getGroup().grids();
        // 追加容器标签
        DivElementTag containerDiv = new DivElementTag(_TABLE_CONTAINER_DIV_ID, _TABLE_CONTAINER_DIV_CSS);
        for (Grid g : grids) {

            TableElementTag tableContainer = new TableElementTag(_TABLE_CONTAINER_ID, _TABLE_CONTAINER_CSS);
            // 解析表格事件
            // TD跨列的数量
            int columnCount = parserTableEvents(g, tableContainer);
            // 解析表格内容
            parserTableTbody(columnCount, tableContainer, g);
View Full Code Here

TOP

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

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.