moreInformation.setIconStyle("icon-menu-information");
moreInformation.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
// find out which tab was selected
TCLink link = tabLookup.get(tabPanel.getSelectedItem());
Commands.getInstance().getInformationOn(link.getCurrentDerivedId(), ClientUtils.DERIVED);
}
});
matchMenu.add(moreInformation);
MenuItem gotoStaticDisplay = new MenuItem("Goto static display");
gotoStaticDisplay.setIconStyle("icon-menu-gotoStatic");
gotoStaticDisplay.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
// find out which tab was selected
TCLink link = tabLookup.get(tabPanel.getSelectedItem());
Commands.getInstance().gotoStaticDisplay(link.getCurrentDerivedId(), ClientUtils.DERIVED);
}
});
matchMenu.add(gotoStaticDisplay);
matchMenu.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) {
//
final NoteItem mItem = (NoteItem) tabPanel.getSelectedItem().getWidget(0);
String id = mItem.getId();
new NotesPanel(id, TCNote.TYPE_PARAGRAPH, new NotePanelCallback<TCNote, Integer>(){
public void callback(TCNote note, Integer type) {
if(type == NotesPanel.NOTE_ADDED)
mItem.addNote(note);
}
});
}
});
matchMenu.add(addNote);
MenuItem addNoteMatch = new MenuItem("Add Note to Match");
addNoteMatch.setIconStyle("icon-menu-addNote");
addNoteMatch.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
//
final NoteItem mItem = (NoteItem) tabPanel.getSelectedItem().getWidget(0);
String id = mItem.getId();
new NotesPanel(id, TCNote.TYPE_LINK, new NotePanelCallback<TCNote, Integer>(){
public void callback(TCNote note, Integer type) {
if(type == NotesPanel.NOTE_ADDED)
mItem.addNote(note);
}
});
}
});
matchMenu.add(addNoteMatch);
matchMenu.add(new SeparatorMenuItem());
MenuItem confirmLink = new MenuItem("Confirm Match");
confirmLink.setIconStyle("icon-menu-confirmLink");
confirmLink.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
// find out which tab was selected
TCLink link = tabLookup.get(tabPanel.getSelectedItem());
Commands.getInstance().confirmMatch(link);
}
});
matchMenu.add(confirmLink);
matchMenu.add(new SeparatorMenuItem());
MenuItem deleteLink = new MenuItem("Delete Match");
deleteLink.setIconStyle("icon-menu-deleteLink");
deleteLink.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
// find out which tab was selected
TCLink link = tabLookup.get(tabPanel.getSelectedItem());
Commands.getInstance().removeMatch(link);
}
});
matchMenu.add(deleteLink);
// separator
mb.add(new SeparatorToolItem());
// Highlighting
Button highlightingMenuHead = new Button("Highlighting");
highlightingMenuHead.setIconStyle("icon-menu-highlightMenu");
Menu highlightingMenu = new Menu();
highlightingMenuHead.setMenu(highlightingMenu);
mb.add(highlightingMenuHead);
final MenuItem toggleHighlighting = new MenuItem();
if(ClientState.showHighlighting){
toggleHighlighting.setText("Deactivate Highlighting");
toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
} else {
toggleHighlighting.setText("Activate Highlighting");
toggleHighlighting.setIconStyle("icon-menu-highlightingDeactivated");
}
toggleHighlighting.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
ClientState.showHighlighting = !ClientState.showHighlighting;
if(ClientState.showHighlighting)
tabPanel.addStyleName("showHighlighting");
else
tabPanel.removeStyleName("showHighlighting");
// switch state
if(ClientState.showHighlighting){
toggleHighlighting.setText("Deactivate Highlighting");
toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
} else {
toggleHighlighting.setText("Activate Highlighting");
toggleHighlighting.setIconStyle("icon-menu-highlightingDeactivated");
}
}
});
highlightingMenu.add(toggleHighlighting);
highlightingMenu.add(new SeparatorMenuItem());
MenuItem highlightInSource = new MenuItem("Highlight in Source");
highlightInSource.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
// find out which tab was selected
TCLink link = tabLookup.get(tabPanel.getSelectedItem());
Commands.getInstance().highlightSource(selectedPartsID, link.getCurrentDerivedId());
}
});
highlightingMenu.add(highlightInSource);
// separator