/**
* Builds the top menu
*/
private void buildMenu() {
// configure menu
ToolBar topMenuBar = new ToolBar();
topMenuBar.setWidth("100%");
// build select section
final Button selectSection = new Button("Select Section");
selectSection.setEnabled(false);
selectSection.addSelectionListener(new SelectionListener<ButtonEvent>(){
@Override
public void componentSelected(ButtonEvent ce) {
Commands.getInstance().showSelectSection( new TableOfContentsPanelItemSelectedListener(){
public void tocp_itemSelected(TableOfContentsEntry entry) {
// call server
Commands.getInstance().selectSection(ClientState.workFile, entry, new CommandCallback<Section>(){
public void cc_callback(Section section) {
// display section in master panel
Outline.getInstance().updateMasterPanel(section);
}
});
}
}
);
}
});
// select document
Button selectDocumentMenuHead = new Button("Select Document");
Menu selectDocumentMenu = new Menu();
selectDocumentMenuHead.setMenu(selectDocumentMenu);
topMenuBar.add(selectDocumentMenuHead);
final CheckMenuItem selectDoc1 = new CheckMenuItem(initialization.getFile1Name());
selectDoc1.setGroup("docSelection");
selectDoc1.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
selectDoc1.setChecked(true);
ClientState.workFile = ClientUtils.FILE1;
selectSection.setEnabled(true);
clearMainPanel();
Commands.getInstance().selectDocument(ClientUtils.FILE1);
}
});
selectDocumentMenu.add(selectDoc1);
final CheckMenuItem selectDoc2 = new CheckMenuItem(initialization.getFile2Name());
selectDoc2.setGroup("docSelection");
selectDoc2.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
selectDoc2.setChecked(true);
ClientState.workFile = ClientUtils.FILE2;
selectSection.setEnabled(true);
clearMainPanel();
Commands.getInstance().selectDocument(ClientUtils.FILE2);
}
});
selectDocumentMenu.add(selectDoc2);
// add select section
topMenuBar.add(selectSection);
// about
/*
TextToolItem about = new TextToolItem("About");
about.addSelectionListener(new SelectionListener<ComponentEvent>(){
@Override
public void componentSelected(ComponentEvent ce) {
About.getInstance().execute();
}
});
topMenuBar.add(about);
*/
// add fill
topMenuBar.add(new FillToolItem());
// title
Button title = new Button("TEI Comparator beta " + TEI_Comparator.VERSION);
title.setEnabled(false);
topMenuBar.add(title);
// add menu to dock panel
dockPanel.add(topMenuBar,DockPanel.NORTH);
// adjust height