📄 usertablebuilder.java
字号:
package com.lily.dap.webapp.extremecomponents.table.view;
/*
* Copyright 2004 original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.extremecomponents.table.bean.Column;
import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.view.html.BuilderConstants;
import org.extremecomponents.table.view.html.BuilderUtils;
import org.extremecomponents.table.view.html.TableBuilder;
import org.extremecomponents.util.HtmlBuilder;
/**
* @author Jeff Johnston
*/
public class UserTableBuilder extends TableBuilder{
public UserTableBuilder(TableModel model) {
super(model);
}
public UserTableBuilder(HtmlBuilder html, TableModel model) {
super(html,model);
}
public void headerRow() {
getHtmlBuilder().tr(1).close();
List columns = this.getTableModel().getColumnHandler().getHeaderColumns();
for(int x = 0;x<getMultiColumn();x++){
for (Iterator iter = columns.iterator(); iter.hasNext();) {
Column column = (Column) iter.next();
getHtmlBuilder().append(column.getCellDisplay());
}
}
getHtmlBuilder().trEnd(1);
}
private int getMultiColumn(){
String c = getTableModel().getPreferences().getPreference(UserPreferencesConstants.COLUMN_MULTI);
if(c==null){
return 1;
}else{
return Integer.parseInt(c);
}
}
public void titleRowSpanColumns() {
boolean showTitle = BuilderUtils.showTitle(getTableModel());
if (showTitle) {
String title = getTableModel().getTableHandler().getTable().getTitle();
if (StringUtils.isNotBlank(title)) {
int columnCount = getTableModel().getColumnHandler().columnCount();
getHtmlBuilder().tr(1).styleClass(BuilderConstants.TITLE_ROW_CSS).close();
getHtmlBuilder().td(2).colSpan("" + columnCount*getMultiColumn()).close();
getHtmlBuilder().span().close().append(title).spanEnd();
getHtmlBuilder().tdEnd();
getHtmlBuilder().trEnd(1);
}
}
}
public void filterRow() {
if (!getTableModel().getTableHandler().getTable().isFilterable()) {
return;
}
getHtmlBuilder().tr(1).styleClass(BuilderConstants.FILTER_CSS).close();
List columns = getTableModel().getColumnHandler().getFilterColumns();
for(int x = 0;x<getMultiColumn();x++){
for (Iterator iter = columns.iterator(); iter.hasNext();) {
Column column = (Column) iter.next();
getHtmlBuilder().append(column.getCellDisplay());
}
}
getHtmlBuilder().trEnd(1);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -