[gradebook2-dev] Refreshing the column headers
Thomas Amsler
tpamsler at ucdavis.edu
Tue Aug 31 15:18:26 PDT 2010
The column headers are constructed in
MultiGradeContentPanel's buildColumn(...) method:
ColumnConfig config = new ColumnConfig(id, name, columnWidth);
where the name is something like HW 1 [100pts].
You can overwrite this by getting the ColumnConfig objects from the grid.
Since your functionality is a toggle, you probably want to restore the
original column header titles. Here is some sample code:
e.g.
Class Member: private Map<String, String> columnConfigBackup = null;
private void changeColumnConfigHeaders() {
columnConfigBackup = new HashMap<String, String>();
List<ColumnConfig> columnConfigs = grid.getColumnModel().getColumns();
for(ColumnConfig columnConfig : columnConfigs) {
if(columnConfig.getId().matches("[+-]?[0-9]+")) {
columnConfigBackup.put(columnConfig.getId(),
columnConfig.getHeader());
columnConfig.setHeader("something");
}
}
}
private void restoreColumnConfigHeaders() {
for(String id : columnConfigBackup.keySet()) {
grid.getColumnModel().getColumnById(id).setHeader(columnConfigBackup.get(id));
}
}
Let me know if this works.
Best,
-- Thomas
On Mon, Aug 30, 2010 at 5:56 PM, Jim Eng <jimeng at umich.edu> wrote:
> As part of David's work on GRBK-483, he would like to refresh the column
> headers. I think Thomas or Michael said there was a bug in 1.2.x that made
> that harder, but it would be fixed in 1.3.x. Is that correct? I think David
> has already written code that puts corrected values in the header cells
> (corrected to fit the updated context), but they are not showing up. Can you
> tell us what method call in the event handler would cause the headers to
> refresh?
>
> Thanks.
>
> Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/gradebook2-dev/attachments/20100831/ac4267c0/attachment.html
More information about the gradebook2-dev
mailing list