I have a need to extend the Viewport class to cause it to not take up all of the page real estate. In order to do this, I need access to the "task" member variable. Since this member is private, I had to copy and paste the source for Viewport into a new class (which I called ExtendableViewport), and change "task" to protected.

I am hoping that in a future release you will be willing to change this member from private to protected to facilitate extending the Viewport class.

Below is the code for my class that extends Viewport:

package community.bizblog.ticketq.client.widgets;

import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.util.DelayedTask;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;

public class TrimmedViewport extends ExtendableViewport {

protected int trimTop, trimBottom;

public TrimmedViewport( final int trimTop, final int trimBottom ) {
this( trimTop, 0, trimBottom, 0 );
}

public TrimmedViewport( final int trimTop, final int trimRight, final int trimBottom, final int trimLeft ) {
super();
this.trimTop = trimTop;
this.trimBottom = trimBottom;

task = new DelayedTask(new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
el().setBounds(trimRight,
trimTop,
Window.getClientWidth() - ( trimRight + trimLeft ),
Window.getClientHeight() - (trimTop + trimBottom ) );
layout();
}
});
}

protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
el().setLeftTop(0, trimTop);
}
}