@Connect(TreeTable.class)
public class TreeTableConnector extends TableConnector {
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
FocusableScrollPanel widget = null;
int scrollPosition = 0;
if (getWidget().collapseRequest) {
widget = (FocusableScrollPanel) getWidget().getWidget(1);
scrollPosition = widget.getScrollPosition();
}
getWidget().animationsEnabled = uidl.getBooleanAttribute("animate");
getWidget().colIndexOfHierarchy = uidl
.hasAttribute(TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX) ? uidl
.getIntAttribute(TreeTableConstants.ATTRIBUTE_HIERARCHY_COLUMN_INDEX)
: 0;
int oldTotalRows = getWidget().getTotalRows();
super.updateFromUIDL(uidl, client);
// super.updateFromUIDL set rendering to false, even though we continue
// rendering here. Set it back to true.
getWidget().rendering = true;
if (getWidget().collapseRequest) {
if (getWidget().collapsedRowKey != null
&& getWidget().scrollBody != null) {
VScrollTableRow row = getWidget().getRenderedRowByKey(
getWidget().collapsedRowKey);
if (row != null) {
getWidget().setRowFocus(row);
getWidget().focus();
}
}
int scrollPosition2 = widget.getScrollPosition();
if (scrollPosition != scrollPosition2) {
widget.setScrollPosition(scrollPosition);
}
// check which rows are needed from the server and initiate a
// deferred fetch
getWidget().onScroll(null);