line.setAddresses(createAddresses());
}
private void testFlowPanel2() {
final Menu contextMenu = new Menu();
MenuItem item = new MenuItem("Test 1");
contextMenu.setItems(item);
contextMenu.setCanSelectParentItems(true);
contextMenu.setAutoDraw(true);
VLayout layout = new VLayout();
layout.setSize("100%", "100%");
layout.setShowEdges(true);
layout.setOverflow(Overflow.VISIBLE);
contextMenu.setParentElement(layout);
// layout.setContextMenu(contextMenu);
FlowPanel flowPanel = new FlowPanel();
// Add some content to the panel
for (int i = 0; i < 30; i++) {
// CheckBox checkbox = new CheckBox("Item" + " " + i);
ImageHyperlink checkbox = new ImageHyperlink(
new Image(GWT.getHostPageBaseURL()
+ ImageProvider.IMAGE_PREFIX
+ ImageProvider.MSG_ATTACHMENT), "Item" + " " + i,
"#");
checkbox.addLeftButtonHandler(new MouseDownHandler() {
public void onMouseDown(MouseDownEvent event) {
GWT.log(event.getX() + "", null);
contextMenu.setLeft(event.getX());
contextMenu.setTop(event.getY());
contextMenu.setVisibility(Visibility.VISIBLE);
contextMenu.draw();
}
});
checkbox.addRightButtonHandler(new RightMouseDownHandler() {
public void onRightMouseDown(RightMouseDownEvent event) {
GWT.log(event.getX() + "", null);
contextMenu.setLeft(event.getX());
contextMenu.setTop(event.getY());
contextMenu.setVisibility(Visibility.VISIBLE);
contextMenu.draw();
}
});
flowPanel.add(checkbox);
}
final WidgetCanvas widgetConvas = new WidgetCanvas(flowPanel);
contextMenu.addMouseOutHandler(new MouseOutHandler() {
public void onMouseOut(MouseOutEvent event) {
if (contextMenu.isVisible()) {
contextMenu.hide();
}
}
});
layout.setMembers(widgetConvas);
layout.draw();