public void showPopup(boolean show) { if (popup.isShowing() == show) return; if (show) { popup.center(); } else popup.hide(); }
public static void init() { panel.setSize("300px", "80px"); panel.add(label); panel.add(fileUpload); popup.setGlassEnabled(true); popup.setAutoHideEnabled(true); popup.center(); popup.add(panel); }
// @UiHandler({"edit_items"}) public void editItemsCmd(ClickEvent ev) { PopupPanel p = new PopupPanel(true); // p.setTitle("Редактирование элементов..."); p.setModal(false); // p.setPopupPosition(200, 200); p.setSize("100%", "100%"); p.setWidget(new MultiValuedEntity(this.dto, null, this.filling, "", this)); p.show(); p.center(); }
// @UiHandler({"edit_field"}) public void editFieldCmd(ClickEvent ev) { PopupPanel p = new PopupPanel(); // p.setTitle("Редактирование поля..."); p.setModal(true); // p.setPopupPosition(200, 200); p.setSize("100%", "100%"); p.setWidget(new FieldEditor(new MultiValuedField(this.dto, null, this.filling, base_name), p)); p.show(); p.center(); }
// @UiHandler({"edit_selection"}) public void editSelectionCmd(ClickEvent ev) { // DialogBox dialogBox = createDialogBox("Редактирование выбора..."); // dialogBox.setGlassEnabled(true); // dialogBox.setAnimationEnabled(true); PopupPanel p = new PopupPanel(true); p.setModal(false); // p.setPopupPosition(200, 200); p.setAnimationEnabled(true); // p.setTitle("Редактирование выбора..."); // dialogBox.setModal(true); // dialogBox.center(); p.setSize("100%", "100%"); p.setWidget(new MultiselectionEditor(this, p)); p.setVisible(true); p.show(); p.center(); }
// Method response to user click of "Search" menu in top menubar. // Causes popup panel to appear protected void doPostSearch() { VerticalPanel content = new VerticalPanel(); content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); HorizontalPanel inputRow = new HorizontalPanel(); Label searchTermLabel = new Label("Search Title Term: "); final TextBox searchTermTextBox = new TextBox(); inputRow.add(searchTermLabel); inputRow.add(searchTermTextBox); HorizontalPanel btnRow = new HorizontalPanel(); btnRow.setStyleName("search-button-row"); Button cancelBtn = new Button("Cancel"); cancelBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { searchPopup.hide(); } }); Button searchBtn = new Button("Search"); searchBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { control.handleTitleSearchRequest(searchTermTextBox.getText()); searchPopup.hide(); } }); btnRow.add(cancelBtn); btnRow.add(new Label("")); btnRow.add(searchBtn); content.add(inputRow); content.add(btnRow); searchPopup.setWidget(content); searchPopup.center(); }
// Method response to user click of "Address" button in a post row // Causes popup panel to appear protected void doMapPopup(PostData post) { VerticalPanel content = new VerticalPanel(); content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); final String address = post.getAddress(); // Create a Panel to hold the map HorizontalPanel mapPanel = new HorizontalPanel(); mapPanel.setSize("400px", "400px"); // Create the Google Map object, with set options MapOptions myOptions = MapOptions.create(); myOptions.setZoom(8.0); myOptions.setCenter(LatLng.create(-34.397, 150.644)); myOptions.setMapTypeId(MapTypeId.ROADMAP); final GoogleMap map = GoogleMap.create(mapPanel.getElement(), myOptions); // GeoCoder is Google Maps API for taking an address and finding // latitude-longitude. Geocoder geocoder = Geocoder.create(); GeocoderRequest request = GeocoderRequest.create(); request.setAddress(address); geocoder.geocode( request, new Callback() { public void handle(JsArray<GeocoderResult> results, GeocoderStatus status) { if (status == GeocoderStatus.OK) { GeocoderResult location = results.get(0); // Bug Fix - Needed to make sure that map is re-sized to parent panel map.triggerResize(); map.setCenter(location.getGeometry().getLocation()); // Create Marker (red) to show location MarkerOptions markerOpts = MarkerOptions.create(); markerOpts.setMap(map); // Title of Marker will be address markerOpts.setTitle(address); // Place Marker at address location markerOpts.setPosition(location.getGeometry().getLocation()); Marker.create(markerOpts); } else { Window.alert("Geocode was not successful for the following reason: " + status); } } }); HorizontalPanel btnRow = new HorizontalPanel(); btnRow.setStyleName("search-button-row"); Button cancelBtn = new Button("Cancel"); cancelBtn.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { searchPopup.hide(); } }); btnRow.add(cancelBtn); content.add(mapPanel); content.add(btnRow); searchPopup.setWidget(content); searchPopup.center(); }
public void switchSection(String token) { popup.hide(); tokenHistory.add(token); Map<String, String> parameters = getHistoryTokenParameters(token); AppPlace place = getPlace(token); if (mainPresenter != null) { mainPresenter.clearNotifications(); } if (ClientSessionUtil.checkSession()) { switch (place) { case HOME: HomePresenter homePresenter = new HomePresenter(new HomeView(), eventBus); homePresenter.bind(); getLayout().clear(); getLayout().add(homePresenter.getDisplay().asWidget()); break; case REQUEST: RequestPresenter requestPresenter = new RequestPresenter(new RequestView(), eventBus); requestPresenter.bind(); getLayout().clear(); getLayout().add(requestPresenter.getDisplay().asWidget()); break; case LOGOUT: ClientSessionUtil.destroySession(); eventBus.fireEvent(new LoginRequiredEvent()); break; case REQUESTSTATUS: try { Integer requestId = Integer.parseInt(parameters.get("requestId")); RequestStatusPresenter requestStatusPresenter = new RequestStatusPresenter(new RequestStatusView(), eventBus); requestStatusPresenter.bind(); requestStatusPresenter.showRequest(requestId); getLayout().clear(); getLayout().add(requestStatusPresenter.getDisplay().asWidget()); } catch (Exception e) { showNotification( "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR); } break; case EDITREQUEST: try { Integer requestId = Integer.parseInt(parameters.get("requestId")); RequestEditPresenter editPresenter = new RequestEditPresenter(new RequestEditView(), eventBus); editPresenter.bind(); editPresenter.showRequest(requestId); getLayout().clear(); getLayout().add(editPresenter.getDisplay().asWidget()); } catch (Exception e) { showNotification( "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR); } break; case RESPONSE: try { Integer requestId = Integer.parseInt(parameters.get("requestId")); RequestResponsePresenter requestResponsePresenter = new RequestResponsePresenter(new RequestResponseView(), eventBus); requestResponsePresenter.bind(); requestResponsePresenter.showRequest(requestId); getLayout().clear(); getLayout().add(requestResponsePresenter.getDisplay().asWidget()); } catch (Exception e) { showNotification( "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR); } break; case LIST: try { String listType = parameters.get("type"); RequestListPresenter requestListPresenter = new RequestListPresenter(new RequestListView(), eventBus); requestListPresenter.bind(); requestListPresenter.loadRequests(0, 100, listType); getLayout().clear(); getLayout().add(requestListPresenter.getDisplay().asWidget()); } catch (Exception e) { showNotification( "Tipo de lista incorrecto: No se puede cargar la lista", NotificationEventType.ERROR); } break; case STATISTICS: StatisticsPresenter statistics = new StatisticsPresenter(new StatisticsView(), eventBus); statistics.bind(); getLayout().clear(); getLayout().add(statistics.getDisplay().asWidget()); break; case ABOUTPROJECT: AboutProjectPresenter aboutProjectPresenter = new AboutProjectPresenter(new AboutProjectView(), eventBus); aboutProjectPresenter.bind(); getLayout().clear(); getLayout().add(aboutProjectPresenter.getDisplay().asWidget()); break; case ASOCIATES: AsociatesPresenter asociatesPresenter = new AsociatesPresenter(new AsociatesView(), eventBus); asociatesPresenter.bind(); getLayout().clear(); getLayout().add(asociatesPresenter.getDisplay().asWidget()); break; case USERPROFILE: UserProfileEditPresenter userProfilePresenter = new UserProfileEditPresenter(new UserProfileEditView(), eventBus); userProfilePresenter.bind(); getLayout().clear(); getLayout().add(userProfilePresenter.getDisplay().asWidget()); break; default: History.newItem(AppPlace.HOME.toString()); } } else { switch (place) { case HOME: HomePresenter homePresenter = new HomePresenter(new HomeView(), eventBus); homePresenter.bind(); getLayout().clear(); getLayout().add(homePresenter.getDisplay().asWidget()); break; case REQUEST: case LOGIN: LoginPresenter loginPresenter = new LoginPresenter(new LoginView(), eventBus); loginPresenter.bind(); popup.setModal(true); popup.setGlassEnabled(true); popup.clear(); popup.add(loginPresenter.getDisplay().asWidget()); popup.center(); break; case REGISTER: RegisterPresenter registerPresenter = new RegisterPresenter(new RegisterView(), eventBus); registerPresenter.bind(); getLayout().clear(); getLayout().add(registerPresenter.getDisplay().asWidget()); break; case RESPONSE: try { Integer requestId = Integer.parseInt(parameters.get("requestId")); RequestResponsePresenter requestResponsePresenter = new RequestResponsePresenter(new RequestResponseView(), eventBus); requestResponsePresenter.bind(); requestResponsePresenter.showRequest(requestId); getLayout().clear(); getLayout().add(requestResponsePresenter.getDisplay().asWidget()); } catch (Exception e) { showNotification( "Id incorrecta: No se puede cargar la solicitud", NotificationEventType.ERROR); } break; case LIST: try { String listType = parameters.get("type"); RequestListPresenter requtesListPresenter = new RequestListPresenter(new RequestListView(), eventBus); requtesListPresenter.bind(); requtesListPresenter.loadRequests(0, 100, listType); getLayout().clear(); getLayout().add(requtesListPresenter.getDisplay().asWidget()); } catch (Exception e) { showNotification( "Tipo de lista incorrecto: No se puede cargar la lista", NotificationEventType.ERROR); } break; case STATISTICS: StatisticsPresenter statistics = new StatisticsPresenter(new StatisticsView(), eventBus); statistics.bind(); getLayout().clear(); getLayout().add(statistics.getDisplay().asWidget()); break; case ABOUTPROJECT: AboutProjectPresenter aboutProjectPresenter = new AboutProjectPresenter(new AboutProjectView(), eventBus); aboutProjectPresenter.bind(); getLayout().clear(); getLayout().add(aboutProjectPresenter.getDisplay().asWidget()); break; case ASOCIATES: AsociatesPresenter asociatesPresenter = new AsociatesPresenter(new AsociatesView(), eventBus); asociatesPresenter.bind(); getLayout().clear(); getLayout().add(asociatesPresenter.getDisplay().asWidget()); break; case PASSWORDRECOVERY: PasswordRecoveryPresenter passwordRecoveryPresenter = new PasswordRecoveryPresenter(new PasswordRecoveryView(), eventBus); passwordRecoveryPresenter.bind(); getLayout().clear(); getLayout().add(passwordRecoveryPresenter.getDisplay().asWidget()); break; default: History.newItem(AppPlace.HOME.toString()); } } }
public void show() { popupPanel.center(); popupPanel.show(); }