@Override public void start(AcceptsOneWidget panel, EventBus eventBus) { view = clientFactory.getSeattleExpressLanesView(); this.eventBus = eventBus; this.phoneGap = this.clientFactory.getPhoneGap(); accessibility = clientFactory.getAccessibility(); view.setPresenter(this); view.getPullHeader().setHTML("pull down"); inAppBrowser = this.phoneGap.getInAppBrowser(); PullArrowStandardHandler headerHandler = new PullArrowStandardHandler(view.getPullHeader(), view.getPullPanel()); headerHandler.setErrorText("Error"); headerHandler.setLoadingText("Loading"); headerHandler.setNormalText("pull down"); headerHandler.setPulledText("release to load"); headerHandler.setPullActionHandler( new PullActionHandler() { @Override public void onPullAction(final AsyncCallback<Void> callback) { new Timer() { @Override public void run() { createPostList(); view.refresh(); callback.onSuccess(null); } }.schedule(1); } }); view.setHeaderPullHandler(headerHandler); createPostList(); createSchedulesLink(); panel.setWidget(view); accessibility.postScreenChangeNotification(); }
@Override public void start(AcceptsOneWidget panel, final EventBus eventBus) { view = clientFactory.getRestAreaView(); analytics = clientFactory.getAnalytics(); accessibility = clientFactory.getAccessibility(); this.eventBus = eventBus; view.setPresenter(this); Place place = clientFactory.getPlaceController().getWhere(); if (place instanceof RestAreaPlace) { RestAreaPlace restAreaPlace = (RestAreaPlace) place; int restAreaId = Integer.valueOf(restAreaPlace.getId()); String jsonString = AppBundle.INSTANCE.restAreaData().getText(); RestAreaFeed restAreas = JsonUtils.safeEval(jsonString); view.setTitle("Safety Rest Area"); SafeHtmlBuilder detailsHTMLBuilder = new SafeHtmlBuilder(); detailsHTMLBuilder.appendEscaped( restAreas.getRestAreas().get(restAreaId).getRoute() + " - " + restAreas.getRestAreas().get(restAreaId).getLocation()); detailsHTMLBuilder.appendHtmlConstant("<br>"); detailsHTMLBuilder.appendEscaped( "Milepost: " + restAreas.getRestAreas().get(restAreaId).getMilepost() + " - " + restAreas.getRestAreas().get(restAreaId).getDirection()); view.setDetails(detailsHTMLBuilder.toSafeHtml()); if (restAreas.getRestAreas().get(restAreaId).getNotes() == null) { view.hideNotesHeading(); view.setNotes(""); } else { view.showNotesHeading(); view.setNotes(restAreas.getRestAreas().get(restAreaId).getNotes()); } SafeHtmlBuilder amenitiesHTMLBuilder = new SafeHtmlBuilder(); amenitiesHTMLBuilder.appendHtmlConstant("<ul>"); for (int i = 0; i < restAreas.getRestAreas().get(restAreaId).getAmenities().length; i++) { amenitiesHTMLBuilder.appendHtmlConstant("<li>"); amenitiesHTMLBuilder.appendEscaped( restAreas.getRestAreas().get(restAreaId).getAmenities()[i]); amenitiesHTMLBuilder.appendHtmlConstant("</li>"); } if (restAreas.getRestAreas().get(restAreaId).getAmenities().length == 0) { view.hideAmenitiesHeading(); } else { view.showAmenitiesHeading(); } amenitiesHTMLBuilder.appendHtmlConstant("</ul>"); view.setAmenities(amenitiesHTMLBuilder.toSafeHtml()); view.setLatLon( Double.valueOf(restAreas.getRestAreas().get(restAreaId).getLatitude()), Double.valueOf(restAreas.getRestAreas().get(restAreaId).getLongitude())); view.refresh(); } panel.setWidget(view); accessibility.postScreenChangeNotification(); }