contentPanel.setBodyBorder(false);
contentPanel.setScrollMode(Scroll.AUTO);
contentPanel.setStyleName("tc-right-panel");
// create list of proposals
final TCMatchProposal matchProp = new TCMatchProposal(results.getProposals());
// create menu
ToolBar mb = new ToolBar();
mb.setWidth("100%");
// cancel
createCancelToolbarButton(mb, "Cancel", selectedPartsID);
// separator
mb.add(new SeparatorToolItem());
// Proposal
Button proposalMenuHead = new Button("Proposal");
Menu proposalMenu = new Menu();
proposalMenuHead.setMenu(proposalMenu);
mb.add(proposalMenuHead);
MenuItem entireProposal = new MenuItem("Show Proposal");
entireProposal.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
matchProp.showProposal();
}
});
proposalMenu.add(entireProposal);
MenuItem moreInformation = new MenuItem("More Information");
moreInformation.setIconStyle("icon-menu-information");
moreInformation.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
matchProp.displayInformation();
}
});
proposalMenu.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) {
MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
if(null == selectedProposal)
Window.alert("Please select proposal");
else
Commands.getInstance().gotoStaticDisplay(selectedProposal.getId(), ClientUtils.DERIVED);
}
});
proposalMenu.add(gotoStaticDisplay);
proposalMenu.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) {
//
MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
if(null == selectedProposal)
Window.alert("Please select proposal.");
else {
String id = selectedProposal.getId();
new NotesPanel(id, TCNote.TYPE_PARAGRAPH, new NotePanelCallback<TCNote, Integer>(){
public void callback(TCNote note, Integer type) {
if(type == NotesPanel.NOTE_ADDED)
matchProp.addNote(note);
}
});
}
}
});
proposalMenu.add(addNote);
proposalMenu.add(new SeparatorMenuItem());
MenuItem createLink = new MenuItem("Create Link");
createLink.setIconStyle("icon-menu-createLink");
createLink.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
if(null == selectedProposal)
Window.alert("Please select proposal.");
else if(selectedProposal.isMatched())
Window.alert("The match has has already been established.");
else
Commands.getInstance().createLink(selectedPartsID, selectedProposal);
}
});
proposalMenu.add(createLink);
// sepearator
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-highlightingDeactivated");
} else {
toggleHighlighting.setText("Activate Highlighting");
toggleHighlighting.setIconStyle("icon-menu-highlightingActivated");
}
toggleHighlighting.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
matchProp.toggleHighlighting();
// 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 Proposal in Source");
highlightInSource.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override
public void componentSelected(MenuEvent ce) {
MatchProposal selectedProposal = matchProp.getSelectedMatchProposal();
if(null == selectedProposal)
Window.alert("Please select proposal");
else
Commands.getInstance().highlightSource(selectedPartsID, selectedProposal.getId());
}