List of usage examples for com.google.gwt.user.client.ui ResizeLayoutPanel ResizeLayoutPanel
public ResizeLayoutPanel()
From source file:$.ResizableMapLayout.java
License:Open Source License
/** * Create a resizable map layout for the given map. The map will be added to this layout. * //from w w w. j a va 2 s .com * @param mapPresenter * The map to add. */ public ResizableMapLayout(final MapPresenter mapPresenter) { this.mapPresenter = mapPresenter; mapPresenter.getEventBus().addHandler(MapInitializationHandler.TYPE, new RedrawMapInitializationHandler()); layout = new ResizeLayoutPanel(); layout.setSize("100%", "100%"); layout.add(mapPresenter.asWidget()); // Add an automatic resize handler to set the correct size when the window resizes: Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { applySize(); } }); // Calculate the correct size on load: layout.addAttachHandler(new AttachEvent.Handler() { public void onAttachOrDetach(AttachEvent event) { Timer timer = new Timer() { @Override public void run() { if (!applySize()) { schedule(50); } } }; timer.run(); } }); }
From source file:be.progs.routeshare.client.ResizableMapLayout.java
License:Open Source License
/** * Create a resizable map layout for the given map. The map will be added to this layout. * * @param mapPresenter The map to add./*from ww w .j a va 2 s . c om*/ */ public ResizableMapLayout(final MapPresenter mapPresenter) { this.mapPresenter = mapPresenter; mapPresenter.getEventBus().addHandler(MapInitializationHandler.TYPE, new RedrawMapInitializationHandler()); layout = new ResizeLayoutPanel(); layout.setSize("100%", "100%"); layout.add(mapPresenter.asWidget()); // Add an automatic resize handler to set the correct size when the window resizes: Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent event) { applySize(); } }); // Calculate the correct size on load: layout.addAttachHandler(new AttachEvent.Handler() { public void onAttachOrDetach(AttachEvent event) { Timer timer = new Timer() { @Override public void run() { if (!applySize()) { schedule(50); } } }; timer.run(); } }); }
From source file:ch.unifr.pai.twice.layout.client.eclipseLayout.MiceSplitLayoutPanel.java
License:Apache License
/** * Adds a widget to the panel. If the widget is a {@link ResizeLayoutPanel}, this means that it is a container and therefore should be added directly. * Otherwise it has to be wrapped with such a {@link ResizeLayoutPanel} to ensure, that it is resizing accordingly to changing dimensions. * //from www. j a v a 2 s. c om * If the widget that shall be added is {@link MiceSplitLayoutPanel} or a {@link MiceLayoutTabPanel}, it can be added to the newly created * {@link ResizeLayoutPanel} directly. For all other widgets, a new {@link MiceLayoutTabPanel} has to be introduced and the widget (or if it is a * {@link ComplexPanel} the children of the widget) has/have to be added to this tab. * * @see com.google.gwt.user.client.ui.SplitLayoutPanel#insert(com.google.gwt.user.client.ui.Widget, com.google.gwt.user.client.ui.DockLayoutPanel.Direction, * double, com.google.gwt.user.client.ui.Widget) */ @Override public void insert(Widget child, Direction direction, double size, Widget before) { if (child instanceof ResizeLayoutPanel) { super.insert(child, direction, size, before); } else { ResizeLayoutPanel panel = new ResizeLayoutPanel(); if (child instanceof MiceSplitLayoutPanel || child instanceof MiceLayoutTabPanel) { panel.setWidget(child); super.insert(panel, direction, size, before); } else { MiceLayoutTabPanel slot = new MiceLayoutTabPanel(20); if (child instanceof ComplexPanel) { ComplexPanel p = (ComplexPanel) child; for (int i = p.getWidgetCount(); i > 0; i--) { slot.add(p.getWidget(i - 1)); } if (slot.getWidgetCount() > 0) slot.selectTab(0); } else { slot.add(child); } panel.setWidget(slot); super.insert(panel, direction, size, before); } } }
From source file:org.eclipse.che.ide.extension.machine.client.processes.container.ConsolesContainerViewImpl.java
License:Open Source License
@Inject public ConsolesContainerViewImpl(PartStackUIResources partStackUIResources, MachineResources machineResources, MachineLocalizationConstant localizationConstant) { super(partStackUIResources); this.machineResources = machineResources; this.localizationConstant = localizationConstant; splitLayoutPanel = new SplitLayoutPanel(1); setContentWidget(splitLayoutPanel);/*from ww w . j a va 2 s . co m*/ processesPanel = new ResizeLayoutPanel(); terminalsPanel = new ResizeLayoutPanel(); splitLayoutPanel.add(processesPanel); addToolButtons(); tuneSplitter(); defaultModeButton.getElement().getFirstChildElement().setAttribute(ACTIVE_STATE_TOOLBUTTON_ATTRIBUTE, ""); minimizeButton.ensureDebugId("consoles-minimizeButton"); }
From source file:org.geomajas.gwt2.example.client.sample.general.AlternativeControlsPanel.java
License:Open Source License
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);// www . ja v a2 s. co m // 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; }
From source file:org.geomajas.gwt2.example.client.sample.general.MapFillPanel.java
License:Open Source License
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);/*from w w w .j av a 2s. c om*/ // Initialize the map, and return the layout: GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "gwt-app", "mapOsm"); return resizeLayoutPanel; }
From source file:org.geomajas.gwt2.example.client.sample.general.MapTraceNavigationPanel.java
License:Open Source License
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);/*from w ww. ja va 2 s. c o m*/ // Initialize the map, and return the layout: GeomajasServerExtension.getInstance().initializeMap(mapPresenter, "gwt-app", "mapOsm"); return resizeLayoutPanel; }
From source file:org.geomajas.gwt2.plugin.corewidget.example.client.sample.feature.FeatureClickedExample.java
License:Open Source License
/** * Default constructor./*from ww w. j a v a2 s. c om*/ */ 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(); }
From source file:org.geomajas.gwt2.plugin.corewidget.example.client.sample.feature.FeatureMouseOverExample.java
License:Open Source License
/** * Default constructor.//ww w .j a v a 2 s. c om */ 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(); }
From source file:org.geomajas.gwt2.plugin.geocoder.example.client.sample.GeoCoderExample.java
License:Open Source License
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);/*w w w.ja va 2s . co m*/ // create geocoder widget GeocoderWidget geocoder = new GeocoderWidget(mapPresenter); geocoder.asWidget().getElement().getStyle().setTop(7, Style.Unit.PX); geocoder.asWidget().getElement().getStyle().setLeft(100, Style.Unit.PX); // add geocoder widget to the map mapPresenter.getWidgetPane().add(geocoder.asWidget()); mapPanel.setWidget(resizeLayoutPanel); }