/** * This method constructs the application user interface by instantiating controls and hooking up * event handler. */ public void init() { // Inject global styles. GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected(); // Create the UI defined in Mail.ui.xml. DockLayoutPanel outer = binder.createAndBindUi(this); // Get rid of scrollbars, and clear out the window's built-in margin, // because we want to take advantage of the entire client area. Window.enableScrolling(false); Window.setMargin("0px"); // Special-case stuff to make topPanel overhang a bit. Element topElem = outer.getWidgetContainerElement(topPanel); topElem.getStyle().setZIndex(2); topElem.getStyle().setOverflow(Overflow.VISIBLE); // Listen for item selection, displaying the currently-selected item in // the detail area. // mailList.setListener(new MailList.Listener() { // public void onItemSelected(MailItem item) { // mailDetail.setItem(item); // } // }); // Add the outer panel to the RootLayoutPanel, so that it will be // displayed. // MenuMain PRINCIPAL RootLayoutPanel.get().add(outer); }
/** * constructor TabGeographic * * @return the widget composed by the Geographic Tab */ public TabGeographic() { queryButton.setText(constants.runQuery()); // set style titleLabel.removeStyleName("gwt-Label"); // set form names setFormName(); // initialize widget initWidget(uiBinder.createAndBindUi(this)); // add scroll bars dock.getWidgetContainerElement(dock.getWidget(0)).addClassName("auto"); dock.getWidgetContainerElement(dock.getWidget(0)).getStyle().clearOverflow(); Element myTable = dock.getElement().getElementsByTagName("table").getItem(0); @SuppressWarnings("unused") String txt = myTable.getInnerHTML(); myTable.getStyle().clearPosition(); if (summaryHTML.getHTML().isEmpty()) summaryHTML.removeFromParent(); // HTML matchFound = new HTML("<div style=\"height:300px;overflow:auto;\"><div // id=\"responseCount\" style=\"display:none;\"><span style=\"font-weight: bold;\">Matches // found:</span><span id=\"matchCount\" style=\"display:none;\"></span><div // id=\"matches\"></div></div>"); // Workaround to the problem of the map position // Issue 366: Google Map widget does not initialize correctly inside a LayoutPanel if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("google")) { map = new com.google.gwt.maps.client.MapWidget(); nativeMakeMap( map.getElement(), geoBoundsObj.newTextBoxNorth.getElement(), geoBoundsObj.newTextBoxEast.getElement(), geoBoundsObj.newTextBoxSouth.getElement(), geoBoundsObj.newTextBoxWest.getElement(), queryTextBox.getElement()); mapPanel.add(map); // google.maps.event.trigger(map, 'resize'); // mapPanel.add(matchFound); // Event.trigger(mapWidget.getMap(), "resize"); } else if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) { queryPanel.removeFromParent(); if (mapWidget == null) { initMapGwtOl(); mapPanel.add(mapWidget); mapWidget .getElement() .getFirstChildElement() .getStyle() .setZIndex(0); // force the map to fall behind popups MG 06.05.2015 } } else { queryPanel.removeFromParent(); sinkEvents(Event.ONMOUSEUP); Element map_el = DOM.getElementById("mapstraction"); mxnMakeMap(map_el, EUOSMEGWT.apiMapstraction); mapPanel.getElement().insertFirst(map_el); } preferredObj.add(country); country.myListBox.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String selValue = country.myListBox.getValue(country.myListBox.getSelectedIndex()); if (!selValue.isEmpty()) { // selValue contains a value like S:-21.39;W:55.84;N:51.09;E:-63.15 String[] coordinates = selValue.split(";"); String south = ""; String west = ""; String north = ""; String east = ""; for (int i = 0; i < coordinates.length; i++) { if (coordinates[i].startsWith("S:")) south = coordinates[i].substring(2); if (coordinates[i].startsWith("W:")) west = coordinates[i].substring(2); if (coordinates[i].startsWith("N:")) north = coordinates[i].substring(2); if (coordinates[i].startsWith("E:")) east = coordinates[i].substring(2); } if (!north.isEmpty() && !east.isEmpty() && !south.isEmpty() && !west.isEmpty()) { geoBoundsObj.newTextBoxSouth.setValue(south); geoBoundsObj.newTextBoxWest.setValue(west); geoBoundsObj.newTextBoxNorth.setValue(north); geoBoundsObj.newTextBoxEast.setValue(east); geoBoundsObj.newButton.click(); // zoom to the country bound if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) { Map map = mapWidget.getMap(); map.zoomToExtent( new Bounds( Double.parseDouble(west), Double.parseDouble(south), Double.parseDouble(east), Double.parseDouble(north))); } else setBoundsMapstraction( Double.parseDouble(south), Double.parseDouble(west), Double.parseDouble(north), Double.parseDouble(east)); } else Window.alert(constants.geoCodeListError()); } } }); geoBoundsObj.myListBox.addBlurHandler( new BlurHandler() { @Override public void onBlur(BlurEvent event) { // refresh the map to avoid shifting cursor if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) { mapWidget.getMap().setCenter(mapWidget.getMap().getCenter()); } } }); geoBoundsObj.newButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // refresh the map to avoid shifting cursor if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) { mapWidget.getMap().setCenter(mapWidget.getMap().getCenter()); } } }); }