Methods Summary |
---|
public boolean | end(java.io.Writer writer, java.lang.String body)
if (sortableAttr && model instanceof SortableTableModel) {
LOG.debug("we are looking for " + getSortColumnLinkName());
String sortColumn = request.getParameter(getSortColumnLinkName());
String sortOrder = request.getParameter(getSortOrderLinkName());
try {
if ((sortColumn != null) || (sortOrder != null)) {
if (sortColumn != null) {
try {
this.sortColumn = Integer.parseInt(sortColumn);
} catch (Exception ex) {
if (LOG.isDebugEnabled()) {
LOG.debug("coudn't convert column, take default");
}
}
}
if (sortOrder != null) {
this.sortOrder = sortOrder;
}
} else {
LOG.debug("no sorting info in the request");
}
if (this.sortColumn >= 0) {
LOG.debug("we have the sortColumn " + Integer.toString(this.sortColumn));
LOG.debug("we have the sortOrder " + this.sortOrder);
try {
((SortableTableModel) model).sort(this.sortColumn, this.sortOrder);
} catch (Exception ex) {
if (LOG.isDebugEnabled()) {
LOG.debug("couldn't sort the data");
}
}
LOG.debug("we just sorted the data");
}
} catch (Exception e) {
throw new StrutsException("Error with WebTable: " + toString(e), e);
}
}
return super.end(writer, body);
|
protected void | evaluateExtraParams()
if (modelName != null) {
modelName = findString(modelName);
Object obj = stack.findValue(this.modelName);
if (obj instanceof TableModel) {
setModel((TableModel) obj);
}
}
super.evaluateExtraParams();
|
public WebTableColumn | getColumn(int index)
try {
return (columns[index]);
} catch (Exception E) {
//blank
}
return null;
|
public int | getColumnCount()
return (columns.length);
|
public void | getColumnDisplayName(int column)
columns[column].getDisplayName();
|
public org.apache.struts2.components.table.renderer.CellRenderer | getColumnRenderer(int column)
return columns[column].getRenderer();
|
public WebTableColumn[] | getColumns()
return columns;
|
protected java.lang.String | getDefaultTemplate()
return TEMPLATE;
|
public java.lang.String[] | getFormattedRow(int row)
ArrayList data = new ArrayList(getNumberOfVisibleColumns());
for (int i = 0; i < getColumnCount(); ++i) {
if (columns[i].isVisible()) {
data.add(columns[i].getRenderer().renderCell(this, model.getValueAt(row, i), row, i));
}
}
return (String[]) data.toArray(new String[0]);
|
public javax.swing.table.TableModel | getModel()
return (model);
|
public java.lang.String | getModelName()
return modelName;
|
protected int | getNumberOfVisibleColumns()
int count = 0;
for (int i = 0; i < columns.length; ++i) {
if (!columns[i].isHidden()) {
++count;
}
}
return count;
|
public java.lang.Object | getRawData(int row, int column)
return model.getValueAt(row, column);
|
public java.util.Iterator | getRawDataRowIterator()
return new WebTableRowIterator(this, WebTableRowIterator.RAW_DATA);
|
public java.lang.Object[] | getRow(int row)
ArrayList data = new ArrayList(getNumberOfVisibleColumns());
for (int i = 0; i < getColumnCount(); ++i) {
if (columns[i].isVisible()) {
data.add(model.getValueAt(row, i));
}
}
return data.toArray(new Object[0]);
|
public int | getRowCount()
return model.getRowCount();
|
public java.util.Iterator | getRowIterator()
return new WebTableRowIterator(this);
|
public int | getSortColumn()
if (model instanceof SortableTableModel) {
return ((SortableTableModel) model).getSortedColumnNumber();
}
return -1;
|
public java.lang.String | getSortColumnLinkName()
return "WEBTABLE_" + modelName + "_SORT_COLUMN";
|
public java.lang.String | getSortOrder()
if ((model instanceof SortableTableModel) && (getSortColumn() >= 0)) {
return ((SortableTableModel) model).getSortedDirection(getSortColumn());
}
return SortableTableModel.NONE;
|
public java.lang.String | getSortOrderLinkName()
return "WEBTABLE_" + modelName + "_SORT_ORDER";
|
public boolean | isColumnHidden(int column)
return columns[column].isHidden();
|
public boolean | isSortable()
return sortableAttr;
|
public void | setColumnDisplayName(int column, java.lang.String displayName)
columns[column].setDisplayName(displayName);
|
public void | setColumnHidden(int column, boolean hide)
columns[column].setHidden(hide);
|
public void | setColumnRenderer(int column, org.apache.struts2.components.table.renderer.CellRenderer renderer)
columns[column].setRenderer(renderer);
|
public void | setModel(javax.swing.table.TableModel model)
this.model = model;
columns = new WebTableColumn[this.model.getColumnCount()];
for (int i = 0; i < columns.length; ++i) {
columns[i] = new WebTableColumn(this.model.getColumnName(i), i);
}
if ((sortableAttr) && !(this.model instanceof SortableTableModel)) {
this.model = new SortFilterModel(this.model);
}
|
public void | setModelName(java.lang.String modelName)The name of model to use
this.modelName = modelName;
|
public void | setSortColumn(int sortColumn)
this.sortColumn = sortColumn;
|
public void | setSortOrder(java.lang.String sortOrder)
if (sortOrder.equals(SortableTableModel.NONE)) {
this.sortOrder = SortableTableModel.NONE;
} else if (sortOrder.equals(SortableTableModel.DESC)) {
this.sortOrder = SortableTableModel.DESC;
} else if (sortOrder.equals(SortableTableModel.ASC)) {
this.sortOrder = SortableTableModel.ASC;
} else {
this.sortOrder = SortableTableModel.NONE;
}
|
public void | setSortable(boolean sortable)
sortableAttr = sortable;
if ((sortableAttr) && (model != null) && !(model instanceof SortableTableModel)) {
model = new SortFilterModel(model);
}
|