for(final DocModeHelper mode : main.getModeHelpers()) {
String name = getString("misc.new").toString() + " " + mode.getModeName();
if(mode.isAlpha()) {
name = "[ALPHA] " + name;
}
grid.addControl(new Button(name).onClicked(new Callback<ActionEvent>() {
public void call(ActionEvent event) throws Exception {
SAction action = mode.getNewDocAction(main);
action.execute();
stage.hide();
}
}).addCSSClass("newdocbutton"));
count++;
if(count%2==0) {
grid.nextRow();
}
}
this.setBoxAlign(Align.Stretch);
this.add(grid,1);
this.add(new Button("Open Existing Document").onClicked(new Callback<ActionEvent>() {
public void call(ActionEvent actionEvent) throws Exception {
new OpenAction(main).execute();
if (!main.getContexts().isEmpty()) {
stage.hide();
}
}
}));
this.add(new Button("Exit").onClicked(new Callback<ActionEvent>() {
public void call(ActionEvent actionEvent) throws Exception {
System.exit(0);
}
}));