recordStopButton = new ToggleButton(controllerContainer, css);
recordStopButton.setStyleName(css.control() + " " + css.recordStopButton()
+ " " + css.control());
this.setIsRecording(true);
recordStopButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
setIsRecordingTitle(recordStopButton.isDown());
Controller.this.monitor.setIsRecording(recordStopButton.isDown());
}
});
final Button resetButton = new Button(controllerContainer);
resetButton.setStyleName(css.control() + " " + css.resetButton());
resetButton.getElement().setAttribute("title", "Discard Data and Reset");
resetButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
doReset();
}
});
final Button saveButton = new Button(controllerContainer);
saveButton.setStyleName(css.control() + " " + css.saveButton());
saveButton.getElement().setAttribute("title", "Save Data to a File");
saveButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
Controller me = Controller.this;
saveRecords(getVisitedUrls(), monitor.getVersion(),
me.dataDispatcher.getTraceCopy());
}
// TODO(jaimeyap): Revisit this since it is kinda yucky to be using a
// view component as a model.
private JSOArray<String> getVisitedUrls() {
JSOArray<String> visitedUrls = JSOArray.create();
int numberVisited = pages.getOptionCount();
for (int i = 0; i < numberVisited; i++) {
visitedUrls.push(getPageUrlForIndex(i));
}
return visitedUrls;
}
});
infoScreen = new InfoScreen(this, css);
final Button zoomOutButton = new Button(controllerContainer);
zoomOutButton.setStyleName(css.control() + " " + css.zoomOutButton());
zoomOutButton.getElement().setAttribute("title", "Zoom Out");
zoomOutButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
overviewTimeline.zoom(-2);
}
});
final Button zoomInButton = new Button(controllerContainer);
zoomInButton.setStyleName(css.control() + " " + css.zoomInButton());
zoomInButton.getElement().setAttribute("title", "Zoom In");
zoomInButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
overviewTimeline.zoom(2);
}
});
final Button zoomAllButton = new Button(controllerContainer);
zoomAllButton.setStyleName(css.control() + " " + css.zoomAllButton());
zoomAllButton.getElement().setAttribute("title", "Zoom All");
zoomAllButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
overviewTimeline.zoomAll();
}
});
// TODO(jaimeyap): Is this the best way to do the capability detection?
if (hasSetProfilingOptionsApi()) {
final Button settingsButton = new Button(controllerContainer);
settingsButton.setStyleName(css.control() + " " + css.settingsButton());
settingsButton.getElement().setAttribute("title", "Set Profiling Options");
profilingOptions = ProfilingOptionsPanel.create(getElement(),
settingsButton.getAbsoluteLeft() + 10,
settingsButton.getOffsetHeight(), dataDispatcher);
settingsButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
profilingOptions.show();
}
});
}
pages = new Select(controllerContainer);
pages.setStyleName(css.control() + " " + css.pageSelect());
pages.addChangeListener(new ChangeListener() {
public void onChange(ChangeEvent event) {
int selected = pages.getSelectedIndex();
Controller.this.monitor.setStateForPageAtIndex(selected);
// If we are not selecting the most resent ApplicationState, we should
// disable the record/stop button
if (selected != Controller.this.monitor.getNumberOfPagesViewed() - 1) {
recordStopButton.getElement().setPropertyBoolean("disabled", true);
} else {
recordStopButton.getElement().setPropertyBoolean("disabled", false);
}
}
});
final Button reportButton = new Button(controllerContainer);
reportButton.setStyleName(css.control() + " " + css.reportButton());
reportButton.getElement().setAttribute("title",
"Display the Hintlet Report");
reportButton.addClickListener(new ClickListener() {
public void onClick(ClickEvent event) {
reportDialog.setVisible(true);
}
});