I am fairly new to GWT and web development in general, but this issue
seems to be a no-brainer (just not to me!).
I am trying to create a file browser of sorts by using a CellList and
a SimplePager. The CellList recieves static data from an ArrayList
which is added using CellList.setRowData(myArrayList).
Data displays fine if I have no paging, and the first page will
display fine if I do use paging (so will the row count, it'll even
change properly). But when I click to go to the next page, all I see
is the loading widget indefinitely. Changing pages after that doesn't
help. Here's my code (some stuff omitted for brevity - still long
though, sorry!):
public class ArcViewerModuleDisplay extends VerticalPanel {
private VerticalPanel displayHolder;
private CellList<ArchiveRecord> resultDisplayer;
private static class ArchiveRecord implements
Comparable<ArchiveRecord> {
private String fileName;
private String filePath;
private Long timeStamp;
private String timeOfRun;
public ArchiveRecord(String name, String path) {
fileName=name;
filePath=path;
timeStamp=Long.valueOf(name.substring(name.lastIndexOf("-")
+1,name.length()-4));
DateTimeFormat dtf=DateTimeFormat.getFormat("dd MMMM
yyyy '@'
HH:mm:ss");
timeOfRun=dtf.format(new Date(timeStamp));
}
@Override
public int compareTo(ArchiveRecord arg0) {
return (int)(this.timeStamp-arg0.timeStamp);
}
}
private static class ArchiveCell extends
AbstractCell<ArchiveRecord> {
@Override
public void render(com.google.gwt.cell.client.Cell.Context
context,
ArchiveRecord value, SafeHtmlBuilder sb) {
sb.appendEscapedLines(value.fileName+"\n("+value.timeOfRun
+")");
}
}
public ArcViewerModuleDisplay(String displayString,
HashMap<String, String> resultSet) {
final ArrayList<ArchiveRecord> matches=new
ArrayList<ArchiveRecord>();
for(String key: resultSet.keySet()) {
matches.add(new ArchiveRecord(key, resultSet.get(key)));
}
Collections.sort(matches);
setStyleName("x-Content-Module");
ArchiveCell archiveCell=new ArchiveCell();
resultDisplayer=new CellList<ArchiveRecord>(archiveCell);
final MultiSelectionModel<ArchiveRecord> selectionModel=new
MultiSelectionModel<ArchiveRecord>();
resultDisplayer.setSelectionModel(selectionModel);
resultDisplayer.setRowData(matches);
resultDisplayer.setRowCount(matches.size(),true);
resultDisplayer.setPageSize(7);
resultDisplayer.setEmptyListWidget(new Label("No records
found"));
resultDisplayer.setLoadingIndicator(new Image("images/
loading.gif"));
resultDisplayer.setStyleName("arc-Display");
SimplePager pager=new SimplePager();
pager.setDisplay(resultDisplayer);
displayHolder=new VerticalPanel();
displayHolder.setStyleName("arc-Display-Holder");
displayHolder.add(resultDisplayer);
displayHolder.add(pager);
Label displayLabel=new Label(displayString);
displayLabel.setStyleName("x-Label-Small-Header");
add(displayLabel);
add(displayHolder);
}
}
Any help at all is much appreciated!
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.