private Button forceLayout = new Button("Force layout");
private Button analyzeLayout = new Button("Analyze layouts");
private Button savePosition = new Button("Save pos");
+ private CheckBox autoScroll = new CheckBox("Autoscroll");
private HorizontalPanel actions;
private boolean collapsed = false;
private void setToDefaultSizeAndPos() {
String cookie = Cookies.getCookie(POS_COOKIE_NAME);
int width, height, top, left;
+ boolean autoScrollValue = false;
if (cookie != null) {
String[] split = cookie.split(",");
left = Integer.parseInt(split[0]);
top = Integer.parseInt(split[1]);
width = Integer.parseInt(split[2]);
height = Integer.parseInt(split[3]);
+ autoScrollValue = Boolean.valueOf(split[4]);
} else {
width = 400;
height = 150;
}
setPixelSize(width, height);
setPopupPosition(left, top);
+ autoScroll.setValue(autoScrollValue);
}
@Override
* The message to log. Must not be null.
*/
private void logToDebugWindow(String msg, boolean error) {
+ Widget row;
if (error) {
- panel.add(createErrorHtml(msg));
+ row = createErrorHtml(msg);
} else {
- panel.add(new HTML(msg));
+ row = new HTML(msg);
+ }
+ panel.add(row);
+ if (autoScroll.getValue()) {
+ row.getElement().scrollIntoView();
}
}
actions.add(savePosition);
savePosition
.setTitle("Saves the position and size of debug console to a cookie");
+ actions.add(autoScroll);
+ autoScroll
+ .setTitle("Automatically scroll so that new messages are visible");
panel.add(actions);
savePosition.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String pos = getAbsoluteLeft() + "," + getAbsoluteTop()
- + "," + getOffsetWidth() + "," + getOffsetHeight();
+ + "," + getOffsetWidth() + "," + getOffsetHeight()
+ + "," + autoScroll.getValue();
Cookies.setCookie(POS_COOKIE_NAME, pos);
}
});