/** * Moves a column. * * @param oldIndex the column index * @param newIndex the new column index */ public void moveColumn(int oldIndex, int newIndex) { if (oldIndex < newIndex) { newIndex--; } ColumnConfig c = configs.remove(oldIndex); configs.add(newIndex, c); if (c != null) { ColumnModelEvent e = new ColumnModelEvent(this, newIndex); fireEvent(Events.ColumnMove, e); } }
/** * Sets the header for a column. * * @param colIndex the column index * @param header the header */ public void setColumnHeader(int colIndex, String header) { ColumnConfig c = getColumn(colIndex); if (c != null) { c.setHeaderHtml(header); ColumnModelEvent e = new ColumnModelEvent(this, colIndex); e.setHeader(header); fireEvent(Events.HeaderChange, e); } }
/** * Sets the column's width. * * @param colIndex the column index * @param width the width * @param supressEvent true to suppress width change event */ public void setColumnWidth(int colIndex, int width, boolean supressEvent) { ColumnConfig c = getColumn(colIndex); if (c != null) { c.setWidth(width); if (!supressEvent) { ColumnModelEvent e = new ColumnModelEvent(this, colIndex); e.setWidth(width); fireEvent(Events.WidthChange, e); } } }
/** * Sets if a column is hidden. * * @param colIndex the column index * @param hidden true to hide the column */ public void setHidden(int colIndex, boolean hidden) { ColumnConfig c = getColumn(colIndex); if (c != null && c.isHidden() != hidden) { c.setHidden(hidden); ColumnModelEvent e = new ColumnModelEvent(this, colIndex); e.setHidden(hidden); fireEvent(Events.HiddenChange, e); } }