ToolBar mb = new ToolBar();
mb.setWidth("100%");
// Selected paragraph
Button selectionMenuHead = new Button("Selected Paragraph");
Menu selectiontMenu = new Menu();
selectionMenuHead.setMenu(selectiontMenu);
mb.add(selectionMenuHead);
MenuItem getInformation = new MenuItem("More Information");
getInformation.setIconStyle("icon-menu-information");
getInformation.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
//
String id = contentSection.getSelectedItemsId();
if(null == id)
Window.alert("Please select item");
else
Commands.getInstance().getInformationOn(id, ClientUtils.MASTER);
}
});
selectiontMenu.add(getInformation);
MenuItem gotoStaticDisplay = new MenuItem("Goto Static Display");
gotoStaticDisplay.setIconStyle("icon-menu-gotoStatic");
gotoStaticDisplay.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
//
String id = contentSection.getSelectedItemsId();
if(null == id)
Window.alert("Please select item");
else
Commands.getInstance().gotoStaticDisplay(id, ClientUtils.MASTER);
}
});
selectiontMenu.add(gotoStaticDisplay);
selectiontMenu.add(new SeparatorMenuItem());
MenuItem addNote = new MenuItem("Add Note to Paragraph");
addNote.setIconStyle("icon-menu-addNote");
addNote.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
//
String id = contentSection.getSelectedItemsId();
if(null == id)
Window.alert("Please select item");
else {
new NotesPanel(id, TCNote.TYPE_PARAGRAPH, new NotePanelCallback<TCNote, Integer>(){
public void callback(TCNote note, Integer type) {
if(type == NotesPanel.NOTE_ADDED)
contentSection.addNote(note);
}
});
}
}
});
selectiontMenu.add(addNote);
selectiontMenu.add(new SeparatorMenuItem());
MenuItem showMatches = new MenuItem("Display Matches");
showMatches.setIconStyle("icon-menu-displayMatches");
showMatches.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
contentSection.loadAndDisplayMatches();
}
});
selectiontMenu.add(showMatches);
// Navigation
createNavigateInSectionMenu(mb, ClientState.workFile, ClientState.selectedSectionMaster, new CommandCallback<Section>(){
public void cc_callback(Section value) {
// display section in master panel