curPhrase = (curPhrase + 1) % phrases.length;
}
};
// Create a menu bar
MenuBar menu = new MenuBar();
menu.setAutoOpen(true);
menu.setWidth("500px");
menu.setAnimationEnabled(true);
// Create a sub menu of recent documents
MenuBar recentDocsMenu = new MenuBar(true);
String[] recentDocs = constants.cwMenuBarFileRecents();
for (int i = 0; i < recentDocs.length; i++) {
recentDocsMenu.addItem(recentDocs[i], menuCommand);
}
// Create the file menu
MenuBar fileMenu = new MenuBar(true);
fileMenu.setAnimationEnabled(true);
menu.addItem(new MenuItem(constants.cwMenuBarFileCategory(), fileMenu));
String[] fileOptions = constants.cwMenuBarFileOptions();
for (int i = 0; i < fileOptions.length; i++) {
if (i == 3) {
fileMenu.addSeparator();
fileMenu.addItem(fileOptions[i], recentDocsMenu);
fileMenu.addSeparator();
} else {
fileMenu.addItem(fileOptions[i], menuCommand);
}
}
// Create the edit menu
MenuBar editMenu = new MenuBar(true);
menu.addItem(new MenuItem(constants.cwMenuBarEditCategory(), editMenu));
String[] editOptions = constants.cwMenuBarEditOptions();
for (int i = 0; i < editOptions.length; i++) {
editMenu.addItem(editOptions[i], menuCommand);
}
// Create the GWT menu
MenuBar gwtMenu = new MenuBar(true);
menu.addItem(new MenuItem("GWT", true, gwtMenu));
String[] gwtOptions = constants.cwMenuBarGWTOptions();
for (int i = 0; i < gwtOptions.length; i++) {
gwtMenu.addItem(gwtOptions[i], menuCommand);
}
// Create the help menu
MenuBar helpMenu = new MenuBar(true);
menu.addSeparator();
menu.addItem(new MenuItem(constants.cwMenuBarHelpCategory(), helpMenu));
String[] helpOptions = constants.cwMenuBarHelpOptions();
for (int i = 0; i < helpOptions.length; i++) {
helpMenu.addItem(helpOptions[i], menuCommand);
}
// Return the menu
menu.ensureDebugId("cwMenuBar");
return menu;