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);
// 追加表头