public GeoCoderExample() { rootElement = UIBINDER.createAndBindUi(this); // Create the MapPresenter mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); // Initialize the map mapPresenter.getEventBus().addMapInitializationHandler(new MyMapInitializationHandler()); GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "geocoder-app", "mapOsm"); ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel(); final MapLayoutPanel layout = new MapLayoutPanel(); resizeLayoutPanel.setWidget(layout); resizeLayoutPanel.setSize("100%", "100%"); layout.setPresenter(mapPresenter); // create geocoder widget GeocoderWidget geocoder = new GeocoderWidget(mapPresenter); // add geocoder widget to the map mapPresenter.getWidgetPane().add(geocoder.asWidget()); mapPanel.setWidget(resizeLayoutPanel); }
public Widget asWidget() { // Define the layout: ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel(); final MapLayoutPanel layout = new MapLayoutPanel(); resizeLayoutPanel.setWidget(layout); resizeLayoutPanel.setSize("100%", "100%"); // Create the MapPresenter and add to the layout: mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); mapPresenter.getEventBus().addMapInitializationHandler(new MyMapInitializationHandler()); layout.setPresenter(mapPresenter); // Initialize the map, and return the layout: GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "gwt-app", "mapOsm"); return resizeLayoutPanel; }
public Widget asWidget() { // Define the layout: ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel(); final MapLayoutPanel layout = new MapLayoutPanel(); resizeLayoutPanel.setWidget(layout); resizeLayoutPanel.setSize("100%", "100%"); // Create the MapPresenter and add to the layout: mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); layout.setPresenter(mapPresenter); // Initialize the map, and return the layout: GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "gwt-app", "mapOsm", new DefaultMapWidget[] { DefaultMapWidget.ZOOM_TO_RECTANGLE_CONTROL, DefaultMapWidget.PAN_CONTROL, DefaultMapWidget.ZOOM_STEP_CONTROL, DefaultMapWidget.SCALEBAR }); return resizeLayoutPanel; }
public Widget asWidget() { // Define the layout: ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel(); final MapLayoutPanel layout = new MapLayoutPanel(); resizeLayoutPanel.setWidget(layout); resizeLayoutPanel.setSize("100%", "100%"); // Create the MapPresenter and add to the layout: mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); mapPresenter.getConfiguration().setHintValue(MapConfiguration.ANIMATION_TIME, 1000); mapPresenter.getEventBus().addMapInitializationHandler(new MyMapInitializationHandler()); layout.setPresenter(mapPresenter); // Initialize the map, and return the layout: GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "gwt-app", "mapOsm"); return resizeLayoutPanel; }
@Test public void testPanels() throws Exception { invokeAllAccessibleMethods(new AbsolutePanel() {}); invokeAllAccessibleMethods(new CellPanel() {}); invokeAllAccessibleMethods(new ComplexPanel() {}); invokeAllAccessibleMethods(new DeckLayoutPanel() {}); invokeAllAccessibleMethods(new DeckPanel() {}); invokeAllAccessibleMethods(new DecoratorPanel() {}); invokeAllAccessibleMethods(new DockLayoutPanel(Unit.PX) {}); invokeAllAccessibleMethods(new DockPanel() {}); invokeAllAccessibleMethods(new FlowPanel() {}); invokeAllAccessibleMethods(new FocusPanel() {}); invokeAllAccessibleMethods(new HorizontalPanel() {}); invokeAllAccessibleMethods(new HTMLPanel("") {}); invokeAllAccessibleMethods(new LayoutPanel() {}); invokeAllAccessibleMethods(new PopupPanel() {}); invokeAllAccessibleMethods(new RenderablePanel("") {}); invokeAllAccessibleMethods(new ResizeLayoutPanel() {}); invokeAllAccessibleMethods(new SimpleLayoutPanel() {}); invokeAllAccessibleMethods(new SimplePanel() {}); invokeAllAccessibleMethods(new SplitLayoutPanel() {}); invokeAllAccessibleMethods(new StackPanel() {}); invokeAllAccessibleMethods(new VerticalPanel() {}); }
public GreenScrollPanel(boolean withHorizontalScroll) { mainPanel = new ResizeLayoutPanel() { @Override protected void onAttach() { super.onAttach(); // hack to hide scrollbar in chrome when leaflet map is also // displayed (check GreenScrollImpl.onAttach too) if (isChrome()) { try { ((Element) (getElement().getChild(1))).getStyle().setZIndex(-1000); ((Element) (getElement().getChild(2))).getStyle().setZIndex(-1000); } catch (Exception e) { GWT.log("", e); } } } }; if (hasMacNanoScrollBar()) { this.impl = new ScrollPanel(); } else { this.impl = new GreenScrollImpl(withHorizontalScroll); } mainPanel.setWidget(impl); impl.addDomHandler(new MouseWheelHandler() { @Override public void onMouseWheel(MouseWheelEvent event) { event.stopPropagation(); } }, MouseWheelEvent.getType()); }
/** * Default constructor. */ public FeatureClickedExample() { rootElement = UIBINDER.createAndBindUi(this); // Create the MapPresenter mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); // add FeatureClickedHandler where we handle FeaturesClickedEvent mapPresenter.getEventBus().addHandler(FeatureClickedHandler.TYPE, new MyFeatureClickedHandler()); // Define the layout: ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel(); layout = new MapLayoutPanel(); resizeLayoutPanel.setWidget(layout); resizeLayoutPanel.setSize("100%", "100%"); layout.setPresenter(mapPresenter); mapPanel.add(resizeLayoutPanel); // Initialize the map GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "appCoreWidget", "mapCoreWidget"); // add feature clicked listener. FeatureClickedListener mapListener = new FeatureClickedListener(); mapPresenter.addMapListener(mapListener); // Create the tooltip. toolTip = new ToolTip(); }
@Inject DefaultIneFrameMasterPageView( IneFrameHeader.View header, MenuRenderer.View menu, MessagePanelWidget messagePanel, NavigationDrawer navigationDrawer) { this.header = header; this.menu = menu; this.navigationDrawer = navigationDrawer; this.messagePanel = messagePanel; messagePanel.getElement().setId("MessagePanel"); messagePanel.addStyleName(Res.INST.get().style().MessagePanel()); getElement().setId("MasterPage"); setSize("100%", "100%"); setStyleName(Res.INST.get().style().MasterPage()); clickHandlerLayout = new ClickableFlowPanel(); clickHandlerLayout.getElement().setId("ClickHandler"); clickHandlerLayout.setSize("100%", "100%"); clickHandlerLayout.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { closeNavigationDrawer(); } }); headerAndPageRoot = new ResizeLayoutPanel(); headerAndPageRoot.getElement().setId("HeaderAndPageRoot"); headerAndPageRoot.setSize("100%", "100%"); headerAndPageRoot.setStyleName(Res.INST.get().style().HeaderAndPageRoot()); headerAndPage = new LayoutPanel(); headerAndPage.getElement().setId("HeaderAndPage"); headerAndPage.setStyleName(Res.INST.get().style().HeaderAndPage()); headerAndPage.add(header.asWidget()); headerAndPage.add(menu.asWidget()); header.asWidget().asWidget().getElement().setId("Header"); menu.asWidget().asWidget().getElement().setId("Menu"); headerAndPage.setWidgetTopHeight( header.asWidget(), 0, Unit.PX, DesignConstants.base() + borderWidth, Unit.PX); headerAndPage.setWidgetTopBottom( menu.asWidget(), DesignConstants.base() + borderWidth, Unit.PX, 0, Unit.PX); headerAndPageRoot.setWidget(headerAndPage); navigationDrawer.asWidget().setSize(DesignConstants.b5WithUnit(), "100%"); navigationDrawer.asWidget().getElement().setId("NavigationDrawer"); navigationDrawer.asWidget().addStyleName(Res.INST.get().style().NavigationDrawer()); add(messagePanel); add(navigationDrawer); add(headerAndPageRoot); }
/** * Default constructor. */ public FeatureMouseOverExample() { rootElement = UIBINDER.createAndBindUi(this); // Create the MapPresenter mapPresenter = GeomajasImpl.getInstance().createMapPresenter(); // add FeatureClickedHandler where we handle FeaturesClickedEvent mapPresenter.getEventBus().addHandler(FeatureMouseOverHandler.TYPE, new MyFeatureMouseOverHandler()); // Define the layout: ResizeLayoutPanel resizeLayoutPanel = new ResizeLayoutPanel(); layout = new MapLayoutPanel(); resizeLayoutPanel.setWidget(layout); resizeLayoutPanel.setSize("100%", "100%"); layout.setPresenter(mapPresenter); mapPanel.add(resizeLayoutPanel); // Initialize the map GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "appCoreWidget", "mapCoreWidget"); /////////////////////////////////////////////////////////////////////////////////////////// // We have to add the FeatureMouseOverListener after the map has been initialized. /////////////////////////////////////////////////////////////////////////////////////////// // add feature mouse over listener. mapPresenter.getEventBus().addMapInitializationHandler(new MapInitializationHandler() { @Override public void onMapInitialized(MapInitializationEvent event) { FeatureMouseOverListener listener = new FeatureMouseOverListener(); mapPresenter.addMapListener(listener); } }); /////////////////////////////////////////////////////////////////////////////////////////// // Create the tooltip and keep track of the mouse pointer position. /////////////////////////////////////////////////////////////////////////////////////////// toolTip = new ToolTip(); }
/** * Returns a collection of classes whose non-abstract methods should always be replaced with * no-ops. By default, this list includes {@link Composite}, {@link DOM} {@link UIObject}, * {@link Widget}, {@link Image}, and most subclasses of {@link Panel}. It will also include any * classes specified via the {@link WithClassesToStub} annotation on the test class. This makes * it much safer to test code that uses or extends these types. * <p> * This list can be customized via {@link WithClassesToStub} or by defining a new test runner * extending {@link GwtMockitoTestRunner} and overriding this method. This allows users to * explicitly stub out particular classes that are causing problems in tests. If you override this * method, you will probably want to retain the classes that are stubbed here by doing something * like this: * * <pre> * @Override * protected Collection<Class<?>> getClassesToStub() { * Collection<Class<?>> classes = super.getClassesToStub(); * classes.add(MyBaseWidget.class); * return classes; * } * </pre> * * @return a collection of classes whose methods should be stubbed with no-ops while running tests */ protected Collection<Class<?>> getClassesToStub() { Collection<Class<?>> classes = new LinkedList<Class<?>>(); classes.add(Composite.class); classes.add(DOM.class); classes.add(UIObject.class); classes.add(Widget.class); classes.add(DataGrid.class); classes.add(HTMLTable.class); classes.add(Image.class); classes.add(AbsolutePanel.class); classes.add(CellList.class); classes.add(CellPanel.class); classes.add(CellTable.class); classes.add(ComplexPanel.class); classes.add(DeckLayoutPanel.class); classes.add(DeckPanel.class); classes.add(DecoratorPanel.class); classes.add(DockLayoutPanel.class); classes.add(DockPanel.class); classes.add(FlowPanel.class); classes.add(FocusPanel.class); classes.add(HorizontalPanel.class); classes.add(HTMLPanel.class); classes.add(LayoutPanel.class); classes.add(Panel.class); classes.add(PopupPanel.class); classes.add(RenderablePanel.class); classes.add(ResizeLayoutPanel.class); classes.add(SimpleLayoutPanel.class); classes.add(SimplePanel.class); classes.add(SplitLayoutPanel.class); classes.add(StackPanel.class); classes.add(VerticalPanel.class); classes.add(ValueListBox.class); WithClassesToStub annotation = unitTestClass.getAnnotation(WithClassesToStub.class); if (annotation != null) { classes.addAll(Arrays.asList(annotation.value())); } return classes; }