Java 类com.google.gwt.event.dom.client.ContextMenuHandler 实例源码

项目:ExpressZip    文件:VOpenLayersMap.java   
/**
 * The constructor should first call super() to initialize the component and
 * then handle any initialization relevant to Vaadin.
 */
public VOpenLayersMap() {
    setWidth("500px");
    setHeight("500px");
    add(map);
    add(fakePaintables);
    fakePaintables.setVisible(false);

    // This method call of the Paintable interface sets the component
    // style name in DOM tree
    setStyleName(CLASSNAME);

    sinkEvents(Event.ONCONTEXTMENU);
    addDomHandler(new ContextMenuHandler() {
        public void onContextMenu(ContextMenuEvent event) {
            handleBodyContextMenu(event);
        }
    }, ContextMenuEvent.getType());
}
项目:platypus-js    文件:ModelGrid.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:ScrollPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusDateField.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:MarginsPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusSlider.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:ToolBar.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusLabel.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusRadioButton.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusToggleButton.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:CardPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:SplitPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusSpinnerField.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusPasswordField.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusProgressBar.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:TabbedPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:BorderPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:GridPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusButton.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusFormattedTextField.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:FlowPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusCheckBox.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusSplitButton.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (contextMenu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        contextMenu = aMenu;
        if (contextMenu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    contextMenu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    contextMenu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:DesktopPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusHtmlEditor.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusTextArea.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusTextField.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:BoxPane.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:PlatypusComboBox.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:platypus-js    文件:ModelDecoratorBox.java   
@Override
public void setPlatypusPopupMenu(PlatypusPopupMenu aMenu) {
    if (menu != aMenu) {
        if (menuTriggerReg != null)
            menuTriggerReg.removeHandler();
        menu = aMenu;
        if (menu != null) {
            menuTriggerReg = super.addDomHandler(new ContextMenuHandler() {

                @Override
                public void onContextMenu(ContextMenuEvent event) {
                    event.preventDefault();
                    event.stopPropagation();
                    menu.setPopupPosition(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                    menu.show();
                }
            }, ContextMenuEvent.getType());
        }
    }
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupportTest.java   
@Test
@SuppressWarnings("unchecked")
public void onContextMenu_RowContextMenu() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();

    uiModel.appendColumn(uiColumn);

    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
        add(dtPresenter);
    }});

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    handler.onContextMenu(event);

    verify(rowContextMenu,
           times(1)).show(any(Integer.class),
                          any(Integer.class));
    verify(cellContextMenu,
           never()).show(any(Integer.class),
                         any(Integer.class));
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupportTest.java   
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithoutCellSelectionManager() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();
    uiModel.appendColumn(uiColumn);

    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
        add(dtPresenter);
    }});

    final GridCell uiCell = mock(GridCell.class);
    when(uiModel.getCell(any(Integer.class),
                         any(Integer.class))).thenReturn(uiCell);
    when(uiCell.getSelectionManager()).thenReturn(null);

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    handler.onContextMenu(event);

    verify(layer,
           never()).batch();
}
项目:drools-wb    文件:GuidedDecisionTableModellerPresenterTest.java   
@Before
public void setup() {
    when(gridLayer.addNodeMouseMoveHandler(any(NodeMouseMoveHandler.class))).thenReturn(mock(HandlerRegistration.class));
    when(gridLayer.addNodeMouseOutHandler(any(NodeMouseOutHandler.class))).thenReturn(mock(HandlerRegistration.class));
    when(view.addKeyDownHandler(any(KeyDownHandler.class))).thenReturn(mock(HandlerRegistration.class));
    when(view.addContextMenuHandler(any(ContextMenuHandler.class))).thenReturn(mock(HandlerRegistration.class));
    when(view.addMouseDownHandler(any(MouseDownHandler.class))).thenReturn(mock(HandlerRegistration.class));
    when(view.getGridLayerView()).thenReturn(gridLayer);
    when(view.getBounds()).thenReturn(bounds);

    final GuidedDecisionTableModellerPresenter wrapped = new GuidedDecisionTableModellerPresenter(view,
                                                                                                  dtablePresenterProvider,
                                                                                                  contextMenuSupport,
                                                                                                  updateRadarEvent,
                                                                                                  pinnedEvent,
                                                                                                  columnHeaderPopOver,
                                                                                                  wizardManagedInstance);
    presenter = spy(wrapped);

    when(dtablePresenterProvider.get()).thenReturn(dtablePresenter);
    when(dtablePresenter.getView()).thenReturn(dtableView);
    when(dtableView.getModel()).thenReturn(new BaseGridData());
}
项目:smonitor    文件:Admin.java   
@Override
public void onModuleLoad() {

    // Rest client configuration
    RestClient.setJacksonMarshallingActive(true);
    RestClient.setApplicationRoot("rs");

    // Disable right click
    RootLayoutPanel.get().addDomHandler(new ContextMenuHandler() {
        @Override
        public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
            event.stopPropagation();
        }
    }, ContextMenuEvent.getType());

    // Create main content
    mainLayout = new MainLayout();
    RootLayoutPanel.get().add(mainLayout);

    // init
    mainLayout.init();
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupportTest.java   
@Test
@SuppressWarnings("unchecked")
public void onContextMenu_CellContextMenu() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new BaseGridColumn(mock(GridColumn.HeaderMetaData.class),
                                                   mock(GridColumnRenderer.class),
                                                   100.0);

    uiModel.appendColumn(uiColumn);

    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
        add(dtPresenter);
    }});

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    handler.onContextMenu(event);

    verify(rowContextMenu,
           never()).show(any(Integer.class),
                         any(Integer.class));
    verify(cellContextMenu,
           times(1)).show(any(Integer.class),
                          any(Integer.class));
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupportTest.java   
@Test
@SuppressWarnings("unchecked")
public void testContextMenuCellIsSelectedCell() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();

    uiModel.appendColumn(uiColumn);

    //Cell associated with Mock onContextMenu Event has indices (0,0)
    uiModel.selectCells(0, 0, 1, 1);

    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(dtPresenter);
        }
    });

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    handler.onContextMenu(event);

    // this method is called if the handler does a selectCell, which should not occur for this test case
    verify(cellSelectionStrategy,
           never()).handleSelection(any(GridData.class),
                                    any(Integer.class),
                                    any(Integer.class),
                                    any(Boolean.class),
                                    any(Boolean.class));

    verify(rowContextMenu,
           times(1)).show(any(Integer.class),
                          any(Integer.class));
    verify(cellContextMenu,
           never()).show(any(Integer.class),
                         any(Integer.class));
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupportTest.java   
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithCellSelectionManagerWithChangeInSelection() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();

    uiModel.appendColumn(uiColumn);

    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
        add(dtPresenter);
    }});
    when(uiModel.getCell(any(Integer.class),
                         any(Integer.class))).thenReturn(uiCell);
    when(cellSelectionStrategy.handleSelection(any(GridData.class),
                                               any(Integer.class),
                                               any(Integer.class),
                                               any(Boolean.class),
                                               any(Boolean.class))).thenReturn(true);

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    handler.onContextMenu(event);

    verify(cellSelectionStrategy,
           times(1)).handleSelection(eq(uiModel),
                                     eq(0),
                                     eq(0),
                                     eq(false),
                                     eq(false));
    verify(layer,
           times(1)).batch();
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupportTest.java   
@Test
@SuppressWarnings("unchecked")
public void onContextMenuWithCellSelectionManagerWithoutChangeInSelection() {
    final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
    final GridData uiModel = dtPresenter.getView().getModel();
    final GridColumn uiColumn = new RowNumberColumn();

    uiModel.appendColumn(uiColumn);

    when(columnInformation.getColumn()).thenReturn(uiColumn);
    when(modellerPresenter.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {{
        add(dtPresenter);
    }});
    when(uiModel.getCell(any(Integer.class),
                         any(Integer.class))).thenReturn(uiCell);

    final ContextMenuHandler handler = contextMenuSupport.getContextMenuHandler(modellerPresenter);

    handler.onContextMenu(event);

    verify(cellSelectionStrategy,
           times(1)).handleSelection(eq(uiModel),
                                     eq(0),
                                     eq(0),
                                     eq(false),
                                     eq(false));
    verify(layer,
           never()).batch();
}
项目:gwt-mousemanager    文件:AdvSurface.java   
public HandlerRegistration addContextMenuHandler(ContextMenuHandler handler) {
    return addDomHandler(handler, ContextMenuEvent.getType());
}
项目:drools-wb    文件:GuidedDecisionTableModellerContextMenuSupport.java   
public ContextMenuHandler getContextMenuHandler(final GuidedDecisionTableModellerView.Presenter modellerPresenter) {
    return new GuidedDecisionTableModellerContextMenuHandler(modellerPresenter,
                                                             cellContextMenu,
                                                             rowContextMenu);
}