protected void onInitUI() {
super.onInitUI();
createWidgets();
/* top table */
final Grid grid = new Grid(2, 2);
grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
grid.setText(0, 0, Util.C.watchedProjectName());
grid.setWidget(0, 1, nameTxt);
grid.setText(1, 0, Util.C.watchedProjectFilter());
grid.setWidget(1, 1, filterTxt);
final CellFormatter fmt = grid.getCellFormatter();
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().header());
fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
final FlowPanel fp = new FlowPanel();
fp.setStyleName(Gerrit.RESOURCES.css().addWatchPanel());
fp.add(grid);
fp.add(addNew);
fp.add(browse);
add(fp);
/* bottom table */
add(watchesTab);
add(delSel);
/* popup */
final FlowPanel pfp = new FlowPanel();
sp = new ScrollPanel(projectsTab);
sp.setSize("100%", "100%");
pfp.add(sp);
pfp.add(close);
popup.setWidget(pfp);
popup.setHeight("100%");
popupPosition = new PopupPanel.PositionCallback() {
public void setPosition(int offsetWidth, int offsetHeight) {
int top = grid.getAbsoluteTop() - 50; // under page header
// Try to place it to the right of everything else, but not
// right justified
int left =
5 + Math.max(grid.getAbsoluteLeft() + grid.getOffsetWidth(),
watchesTab.getAbsoluteLeft() + watchesTab.getOffsetWidth());
if (top + offsetHeight > Window.getClientHeight()) {
top = Window.getClientHeight() - offsetHeight;
}
if (left + offsetWidth > Window.getClientWidth()) {