private void setupVersionChecker() { versionChecker = new ClientVersionChecker(new ClientVersionChecker.Listener() { @Override public void onClientUpdated() { UpdateIndicatorWidget.create(RootPanel.get("banner"), new UpdateIndicatorWidget.Listener() { @Override public void refresh() { completeWave(new Command() { @Override public void execute() { Location.assign(GWT.getHostPageBaseURL()); } }); } }); } }, LOG); }
private static String getUiSwitcherUrl(String token) { UrlBuilder builder = new UrlBuilder(); builder.setProtocol(Location.getProtocol()); builder.setHost(Location.getHost()); String port = Location.getPort(); if (port != null && !port.isEmpty()) { builder.setPort(Integer.parseInt(port)); } String[] tokens = token.split("@", 2); if (Location.getPath().endsWith("/") && tokens[0].startsWith("/")) { tokens[0] = tokens[0].substring(1); } builder.setPath(Location.getPath() + tokens[0]); if (tokens.length == 2) { builder.setHash(tokens[1]); } builder.setParameter("polygerrit", "1"); return builder.buildString(); }
private void loadContactDetails(final JSONObject self) { final String addContactToken = Location.getParameter("id"); CollaborationClient.getInstance().getContactDetails(addContactToken, new JsonCallback() { public void onJsonReceived(JSONValue jsonValue) { if (jsonValue.isObject().containsKey("error")) { SC.say("Error", "This invitation is no longer valid"); } else { JSONObject contact = jsonValue.isObject(); if (self.get("localId").isString().stringValue().equals(contact.get("localId").isString().stringValue()) && self.get("accountType").isNumber().equals(contact.get("accountType").isNumber())) { SC.say("You cannot add your own account as a contact. <br> Login with a different account to ARLearn to accept this invitation."); } else { buildPage(jsonValue.isObject(), addContactToken); } } } }); }
/** * Appends an additional path to the application URL. * * @param additionalPath * The additional path to append to the application URL. * @return the new URL. */ public static String appendToApplicationUrl(String additionalPath) { final UrlBuilder urlBuilder = new UrlBuilder(); urlBuilder.setProtocol(Location.getProtocol()); urlBuilder.setHost(Location.getHost()); final Integer port = asInt(Location.getPort()); if (port != null) { urlBuilder.setPort(port); } urlBuilder.setPath(Location.getPath() + additionalPath); return urlBuilder.buildString(); }
/** * <p> * Launches the given {@code downloadUrl} corresponding download action (simple {@code GET} access on the URL). * </p> * <p> * In <em>script</em> mode, assigns window location to the given {@code downloadUrl}.<br> * In <em>hosted</em> (dev) mode, opens a new window to avoid loosing the entire JS application context in case of * error. * </p> * * @param downloadUrl * The download URL. * @throws IllegalArgumentException * If the given {@code downloadUrl} is blank. */ public static final void launchDownload(final String downloadUrl) { if (isBlank(downloadUrl)) { throw new IllegalArgumentException("Invalid download URL '" + downloadUrl + "'."); } if (GWT.isScript()) { // Production mode: switch to new page. Window.Location.assign(downloadUrl); } else { // Hosted mode: avoid loosing the entire JS application context in case of error. openWindow(downloadUrl); } }
private void buildUrlAndGoToGraphPage(List<ResourceListItem> reports) { StringBuilder sb = new StringBuilder(); sb.append(m_baseUrl + "graph/results.htm?reports=all&resourceId="); boolean first = true; for(ResourceListItem item : reports) { if(!first) { sb.append("&resourceId="); } sb.append(item.getId()); first = false; } Location.assign(sb.toString()); }
/** * This method is called by the default {@link #deactivate()} * implementation to build the contents of this overlay when the * device goes online and the online app was not loaded previously. * * The simplest method to customize this view mode is to override * this method and add a custom app to the panel returned by the * {@link #getPanel()} method. */ protected void buildReloadContent() { getPanel().clear(); FlowPanel fp = new FlowPanel(); getPanel().add(fp); fp.setStyleName("v-touchkit-offlinemode-panel"); fp.add(new HTML("<h1>" + msg.networkBack() + "<h1>")); VNativeButton vButton = new VNativeButton(); vButton.setText(msg.reload()); vButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { overlay.hide(); Location.reload(); } }); fp.add(vButton); }
public SolverPage() { addStyleName("unitime-SolverPage"); iType = SolverType.valueOf(Location.getParameter("type").toUpperCase()); switch (iType) { case COURSE: UniTimePageLabel.getInstance().setPageName(MESSAGES.pageCourseTimetablingSolver()); break; case EXAM: UniTimePageLabel.getInstance().setPageName(MESSAGES.pageExaminationTimetablingSolver()); break; case INSTRUCTOR: UniTimePageLabel.getInstance().setPageName(MESSAGES.pageInstructorSchedulingSolver()); break; case STUDENT: UniTimePageLabel.getInstance().setPageName(MESSAGES.pageStudentSchedulingSolver()); break; } iSolverHeader = new UniTimeHeaderPanel(CONSTANTS.solverType()[iType.ordinal()]); addHeaderRow(iSolverHeader); iSolverButtons = new UniTimeHeaderPanel(); iSolverButtons.addButton("load", MESSAGES.opSolverLoad(), createClickHandler(SolverOperation.LOAD)); iSolverButtons.addButton("start", MESSAGES.opSolverStart(), createClickHandler(SolverOperation.START)); iSolverButtons.addButton("stop", MESSAGES.opSolverStop(), createClickHandler(SolverOperation.STOP)); iSolverButtons.addButton("sectioning", MESSAGES.opSolverStudentSectioning(), createClickHandler(SolverOperation.STUDENT_SECTIONING)); iSolverButtons.addButton("reload", MESSAGES.opSolverReload(), createClickHandler(SolverOperation.RELOAD)); iSolverButtons.addButton("save", MESSAGES.opSolverSave(), createClickHandler(SolverOperation.SAVE)); iSolverButtons.addButton("save new", MESSAGES.opSolverSaveAsNew(), createClickHandler(SolverOperation.SAVE_AS_NEW)); iSolverButtons.addButton("commit", MESSAGES.opSolverSaveCommit(), createClickHandler(SolverOperation.SAVE_COMMIT)); iSolverButtons.addButton("uncommit", MESSAGES.opSolverSaveUncommit(), createClickHandler(SolverOperation.SAVE_UNCOMMIT)); iSolverButtons.addButton("clear", MESSAGES.opSolverClear(), createClickHandler(SolverOperation.CLEAR)); iSolverButtons.addButton("csv", MESSAGES.opSolverExportCSV(), createClickHandler(SolverOperation.EXPORT_CSV)); iSolverButtons.addButton("unload", MESSAGES.opSolverUnload(), createClickHandler(SolverOperation.UNLOAD)); iSolverButtons.addButton("refresh", MESSAGES.opSolverRefresh(), createClickHandler(SolverOperation.CHECK)); execute(SolverOperation.INIT); }
public HistoryToken(PageType type) { iType = type.name(); // 1. take page type defaults --> DEFAULTS if (type.getParams() != null) for (int i = 0; 1 + i < type.getParams().length; i += 2) iDefaults.put(type.getParams()[i], type.getParams()[i + 1]); // 2. take page parameters --> DEFAULTS (on top of the page type defaults) for (Map.Entry<String, List<String>> params: Window.Location.getParameterMap().entrySet()) iDefaults.put(params.getKey(), params.getValue().get(0)); // 3. take cookie --> PARAMS (override defaults) String cookie = EventCookie.getInstance().getHash(iType); if (cookie != null) { for (String pair: cookie.split("\\&")) { int idx = pair.indexOf('='); if (idx >= 0) { String key = pair.substring(0, idx); if (Location.getParameter(key) == null) iParams.put(key, URL.decodeQueryString(pair.substring(idx + 1))); } } } // 4. take page token (hash) --> PARAMS (override cookie) parse(History.getToken()); }
@Override public void execute() { final DialogBox db = new DialogBox(false, true); db.setText("About The Companion"); db.setStyleName("ode-DialogBox"); db.setHeight("200px"); db.setWidth("400px"); db.setGlassEnabled(true); db.setAnimationEnabled(true); db.center(); String downloadinfo = ""; if (!YaVersion.COMPANION_UPDATE_URL1.equals("")) { String url = "http://" + Window.Location.getHost() + YaVersion.COMPANION_UPDATE_URL1; downloadinfo = "<br/>\n<a href=" + url + ">Download URL: " + url + "</a><br/>\n"; downloadinfo += BlocklyPanel.getQRCode(url); } VerticalPanel DialogBoxContents = new VerticalPanel(); HTML message = new HTML( "Companion Version " + BlocklyPanel.getCompVersion() + downloadinfo ); SimplePanel holder = new SimplePanel(); Button ok = new Button("Close"); ok.addClickListener(new ClickListener() { public void onClick(Widget sender) { db.hide(); } }); holder.add(ok); DialogBoxContents.add(message); DialogBoxContents.add(holder); db.setWidget(DialogBoxContents); db.show(); }
private void setupLocaleSelect() { final SelectElement select = (SelectElement) Document.get().getElementById(LANG_ELEMENT_ID); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); for (String locale : localeNames) { if (!DEFAULT_LOCALE.equals(locale)) { String displayName = LocaleInfo.getLocaleNativeDisplayName(locale); OptionElement option = Document.get().createOptionElement(); option.setValue(locale); option.setText(displayName); select.add(option, null); if (locale.equals(currentLocale)) { select.setSelectedIndex(select.getLength() - 1); } } } EventDispatcherPanel.of(select).registerChangeHandler(null, new WaveChangeHandler() { @Override public boolean onChange(ChangeEvent event, Element context) { UrlBuilder builder = Location.createUrlBuilder().setParameter( LOCALE_URLBUILDER_PARAMETER, select.getValue()); Window.Location.replace(builder.buildString()); localeService.storeLocale(select.getValue()); return true; } }); }
@Override public void requestNavigateTo(String url) { log("GW.requestNavigateTo: url=" + url); // NOTE(user): Currently only allow the gadgets to change the fragment part of the URL. String newFragment = url.replaceFirst(BEFORE_FRAGMENT_PATTERN, ""); if (newFragment.matches(FRAGMENT_VALIDATION_PATTERN)) { Location.replace(Location.getHref().replaceFirst(FRAGMENT_PATTERN, "") + "#" + newFragment); } else { log("Navigate request denied."); } }
/** * Tests the IFrame URI generator of Gadget class. */ public void testIframeUri() { String href = "http://" + Location.getHost(); String hrefEscaped = href.replace("?", "%3F"); if (hrefEscaped.endsWith("/")) { hrefEscaped = hrefEscaped.substring(0, hrefEscaped.length() - 1); } int clientInstanceId = 1234; GadgetUserPrefs userPrefs = GadgetUserPrefs.create(); userPrefs.put("pref1", "value1"); userPrefs.put("pref2", "value2"); WaveId waveId = WaveId.of("wave.google.com", "123"); WaveletId waveletId = WaveletId.of("wave.google.com", "conv+root"); WaveletName name = WaveletName.of(waveId, waveletId); GadgetWidget gadget = GadgetWidget.createForTesting(clientInstanceId, userPrefs, name, new FakeLocale()); int gadgetInstanceId = -12345; String url = gadget.buildIframeUrl(gadgetInstanceId, "http://test.com/gadget.xml"); String expectedValue = "//0" + GADGET_SERVER + "/gadgets" + "/ifr?url=http://test.com/gadget.xml&view=canvas&nocache=1&mid=" + gadgetInstanceId + "&lang=wizard&country=OZ&parent=" + hrefEscaped + "&wave=1&waveId=" + URL.encodeQueryString(ModernIdSerialiser.INSTANCE.serialiseWaveId(waveId)) + "#rpctoken=" + gadget.getRpcToken() + "&up_pref1=value1&up_pref2=value2"; assertEquals(expectedValue, url); }
public static String selfRedirect(String suffix) { // Clean up the path. Users seem to like putting extra slashes into the URL // which can break redirections by misinterpreting at either client or server. String path = Location.getPath(); if (path == null || path.isEmpty()) { path = "/"; } else { while (path.startsWith("//")) { path = path.substring(1); } while (path.endsWith("//")) { path = path.substring(0, path.length() - 1); } if (!path.endsWith("/")) { path = path + "/"; } } if (suffix != null) { while (suffix.startsWith("/")) { suffix = suffix.substring(1); } path += suffix; } UrlBuilder builder = new UrlBuilder(); builder.setProtocol(Location.getProtocol()); builder.setHost(Location.getHost()); String port = Location.getPort(); if (port != null && !port.isEmpty()) { builder.setPort(Integer.parseInt(port)); } builder.setPath(path); return builder.buildString(); }
private static void initHostname() { myHost = Location.getHostName(); final int d1 = myHost.indexOf('.'); if (d1 < 0) { return; } final int d2 = myHost.indexOf('.', d1 + 1); if (d2 >= 0) { myHost = myHost.substring(0, d2); } }
private static LinkMenuItem addProjectLink(LinkMenuBar m, TopMenuItem item) { LinkMenuItem i = new ProjectLinkMenuItem(item.getName(), item.getUrl()) { @Override protected void onScreenLoad(Project.NameKey project) { String p = panel.replace(PROJECT_NAME_MENU_VAR, URL.encodeQueryString(project.get())); if (!panel.startsWith("/x/") && !isAbsolute(panel)) { UrlBuilder builder = new UrlBuilder(); builder.setProtocol(Location.getProtocol()); builder.setHost(Location.getHost()); String port = Location.getPort(); if (port != null && !port.isEmpty()) { builder.setPort(Integer.parseInt(port)); } builder.setPath(Location.getPath()); p = builder.buildString() + p; } getElement().setPropertyString("href", p); } @Override public void go() { String href = getElement().getPropertyString("href"); if (href.startsWith("#")) { super.go(); } else { Window.open(href, getElement().getPropertyString("target"), ""); } } }; if (item.getTarget() != null && !item.getTarget().isEmpty()) { i.getElement().setAttribute("target", item.getTarget()); } if (item.getId() != null) { i.getElement().setAttribute("id", item.getId()); } m.addItem(i); return i; }
@Override public boolean isActivated() { String disabled = Location.getParameter(DISABLE_PARAM); if (disabled == null) { return true; } return !Boolean.valueOf(disabled); }
public void onClick(ClickEvent event) { NS2GServiceAsync.Util.getInstance().fakeLogin(new MyAsyncCallback<Void>() { @Override public void onSuccess(Void result) { Location.reload(); } }); }
public void onClick(ClickEvent event) { NS2GServiceAsync.Util.getInstance().loginAnonymously(new MyAsyncCallback<Void>() { @Override public void onSuccess(Void result) { Location.reload(); } }); }
public void onClick(ClickEvent event) { switch (gatherStatusLabel.getGatherState()) { case CLOSED: case OPEN: case ONTIMER: if (!Window.confirm("Вы действительно хотите покинуть сбор? Если все остальные участники проголосуют, " + "вы не сможете вернуться к ним и попадёте в новый сбор.")) { return; } break; case PLAYERS: case SIDEPICK: Window.alert("Голосование уже завершено. Пожалуйста, дождитесь выбора сторон и набора команд. " + "Не закрывайте вкладку, если вы покинете сбор на этой стадии, к вам могут быть применены санкции согласно правилам."); return; case COMPLETED: if (!Window .confirm("Вы действительно хотите покинуть сбор? После входа вы попадёте в новый сбор и больше не сможете посмотреть " + "результаты этого сбора и пароль для подключения. Вы также можете нажать кнопку «Зайти в новый сбор», чтобы попасть в новый сбор без перезахода.")) { return; } break; } if (pingTimer != null) { pingTimer.cancel(); } ns2gService.logout(new MyAsyncCallback<Void>() { @Override public void onSuccess(Void result) { Cookies.removeCookie(CookieSettingsManager.REMEMBER_STEAM_ID); Location.reload(); } }); }
public void onClick(ClickEvent event) { ns2gService.resetGatherPresence(new MyAsyncCallback<Void>() { @Override public void onSuccess(Void result) { Location.reload(); } }); }
/** * Initializes the login bar with the current user's email address if applicable. */ private void initializeLoginBar() { String returnUrl = Location.getHref(); userService.getLoginStatus(returnUrl, new TaCallback<LoginStatus>("Querying Login Status") { @Override public void onSuccess(LoginStatus result) { refreshView(result); } }); }
/** * Handler executed on login button click. */ private void onLoginAction() { final String login = view.getLoginField().getValue(); final String password = view.getPasswordField().getValue(); final String language = view.getLanguagesField().getValue(view.getLanguagesField().getSelectedIndex()); // Executes login command. dispatch.execute(new LoginCommand(login, password, Language.fromString(language)), new CommandResultHandler<Authentication>() { @Override protected void onCommandSuccess(final Authentication authentication) { if (Log.isInfoEnabled()) { Log.info("Authentication proccesed successfully, reloading application."); } injector.getAuthenticationProvider().login(authentication); eventBus.fireEvent(new UpdateEvent(UpdateEvent.USER_LOGGED_IN)); if (GWT.isScript()) { // PRODUCTION: Reloads entire application in order to set the selected language into HTML meta. Location.assign(ClientUtils.getApplicationUrl()); } else { // DEV MODE: To avoid full page reloading, a simple redirection is executed. Selected language is not taken // into account. eventBus.navigate(null, view.getLoadables()); } } }, view.getLoadables()); }
/** * Returns the current application URL (with current optional parameters) with the given additional parameter * {@code paramName}. * * @param withParameters * {@code true} to retrieve existing current URL parameters, {@code false} to forget them. * @param paramName * The parameter name. * @param paramValues * The parameter value(s). * @return the current application URL (with current optional parameters) with the given additional parameter * {@code paramName}. */ public static String getApplicationUrl(boolean withParameters, String paramName, String... paramValues) { final UrlBuilder urlBuilder = new UrlBuilder(); urlBuilder.setProtocol(Location.getProtocol()); urlBuilder.setHost(Location.getHost()); final Integer port = asInt(Location.getPort()); if (port != null) { urlBuilder.setPort(port); } urlBuilder.setPath(Location.getPath()); if (Location.getParameterMap() != null) { // "?gwt.codesvr=127.0.0.1:9997" for example. for (final Entry<String, List<String>> param : Location.getParameterMap().entrySet()) { if ("gwt.codesvr".equalsIgnoreCase(param.getKey()) && isNotEmpty(param.getValue())) { // Hosted mode parameter exception. urlBuilder.setParameter(param.getKey(), param.getValue().get(0)); } else if (withParameters) { final String[] values = param.getValue() != null ? param.getValue().toArray(new String[param.getValue().size()]) : null; urlBuilder.setParameter(param.getKey(), values); } } } if (isNotBlank(paramName) && paramValues != null) { urlBuilder.setParameter(paramName, paramValues); } return urlBuilder.buildString(); }
/** * Sends the browser a new {@code mailto} request with the given subject and mail addresses. * * @param subject * The mail's subject (can be null). * @param body * The mail's body (can be null). * @param addresses * The mail's addresses collection. */ public static final void mailTo(final String subject, final String body, final Collection<String> addresses) { if (isEmpty(addresses)) { return; } // Filters mails addresses. final List<String> filteredMails = new ArrayList<String>(addresses.size()); for (final String address : addresses) { if (isNotBlank(address) && EMAIL_CLIENT_REGEXP.test(address.trim())) { filteredMails.add(address); } } if (isEmpty(filteredMails)) { return; } Collections.sort(filteredMails); // Builds mailto link. final StringBuilder mailTos = new StringBuilder("mailto:"); for (final String mail : filteredMails) { mailTos.append(mail); mailTos.append(";"); } mailTos.deleteCharAt(mailTos.length() - 1); if (isNotBlank(subject)) { mailTos.append("?subject="); mailTos.append(URL.encodeQueryString(subject)); } if (isNotBlank(body)) { mailTos.append((isNotBlank(subject) ? "&" : "?") + "body="); mailTos.append(URL.encodeQueryString(body)); } Window.Location.assign(mailTos.toString()); }
public void changeLocale( String locale ) { if( currentPlace == null ) return; String token = placeTokenizer.getToken( currentPlace ); Map<String, List<String>> curParams = new HashMap<String, List<String>>( Location.getParameterMap() ); ArrayList<String> value = new ArrayList<String>(); value.add( locale ); curParams.put( "locale", value ); String queryString = "?"; boolean fAddAnd = false; for( Entry<String, List<String>> e : curParams.entrySet() ) { if( fAddAnd ) queryString += "&"; fAddAnd = true; queryString += URL.encodeQueryString( e.getKey() ) + "=" + URL.encodeQueryString( HexaTools.arrayToString( e.getValue() ) ); } String url = Location.getProtocol() + "//" + Location.getHost() + Location.getPath() + queryString + "#" + token; Window.Location.replace( url ); }
public static boolean redirected() { String authProvider = getAuthProviderFromCookie(); if (authProvider == null) { return false; } if (Location.getParameter("code") != null) //facebook,google,github,windows live return true; if (Location.getParameter("oauth_token") != null) // twitter,yahoo,flickr return true; if (Location.getParameter("oauth_verifier") != null) // Flickr return true; String error = Location.getParameter("error"); if (error != null) { String errorMessage = Location.getParameter("error_description"); Window.alert("Error: " + error + ":" + errorMessage); reload(); return false; } return false; }
private void initNewUserCompany(PrerequisitesInfo result) { CompanyInfo company = new CompanyInfo(); String parentId = ""; if (result != null) { // Unregistered user, need to create Company and User records company.setName(result.getCurrentUser().getUserName() + "'s Company"); // Retrieve the Parent ID param from either the Querystring or the Hash parentId = RiseUtils.getFromQueryString(Location.getQueryString(), PARAM_PARENT_ID); if (RiseUtils.strIsNullOrEmpty(parentId)) { parentId = getFromHash(Location.getHash(), PARAM_PARENT_ID); } UserInfo user = result.getCurrentUser(); user.setRoles(RoleInfo.getStandardRoles()); initUserController(user); } else { company.setName(UserAccountController.getInstance().getUserInfo().getUserName() + "'s Company"); } // if the parentId parameter is provided, than try to register under that ID if (!RiseUtils.strIsNullOrEmpty(parentId)) { company.setParentId(parentId); // company.setPnoStatus(CompanyNetworkOperatorStatus.NO); } else { company.setParentId(ConfigurationController.getInstance().getConfiguration().getRiseId()); // company.setPnoStatus(CompanyNetworkOperatorStatus.SUBSCRIBED); } companyService.saveCompany(company, new RpcSaveCompanyInfoCallBackHandler()); }
private void companyRegistrationFailed() { // if the user is coming from a preview, do not show him the notification if (getFromHash(Location.getHash(), UiEntryPoint.HASH_PARAM_FROM_COMPANY_ID) != null || Window.confirm("Requested Company is not accepting registrations. Would you " + "like to register a regular account?")) { initNewUserCompany(null); } else { UiEntryPoint.trackPageview("User_Registration_Failed"); UserAccountWidget.getInstance().logoutUser(); // Window.Location.replace(ConfigurationController.getInstance().getConfiguration().getLogoutURL()); } }
/** returns all key=value&key=value parts of the url (not decoded) * In case of no parameters an empty String is returned * * This method is to prevent direct calls to Location.getHref() * due to encapsulation and testing reasons * @return */ public String getLocationParameterString() { String full = Location.getHref(); int i = full.indexOf("?"); if (i >= 0) return full.substring(i+1); return ""; }
@Override public void init() { try { String stateParameter = Location.getParameter(getAppController().getLoginManager().getNetworkLoginManager() .getURLParameterForOAuthTokenProcessing()); isPostLogin = stateParameter != null && stateParameter.startsWith(getAppController().getLoginManager().getNetworkLoginManager().getURLParameterValueForOAuthTokenProcessing()); if (isPostLogin) this.postLoginView = new PostLoginOAuthWindowView(this); else this.preLoginView = new LoginOAuthWindowView(this); } catch (Throwable e) { } }
public static void show(String text, int delayMillis, final boolean doReload){ final PopupPanel notificationPopup = new PopupPanel(false); final Label label = new Label(text); notificationPopup.setWidget(label); notificationPopup.setPopupPosition(50, 20); notificationPopup.setVisible(true); notificationPopup.show(); Timer t = new Timer() { @Override public void run() { Animation a = new Animation() { @Override protected void onUpdate(double progress) { notificationPopup.getElement().getStyle().setProperty("opacity", String.valueOf(1-progress)); if(progress == 1) { notificationPopup.hide(); if(doReload) Location.reload(); } } }; a.run(500); } }; t.schedule(delayMillis); }
private void initializeSelectionDisplay(SelectionDisplay selectionDisplay) { m_selectionDisplay = selectionDisplay; m_selectionDisplay.getSubmitButton().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append(getBaseUrl() + "/KSC/formProcMain.htm"); if(m_selectionDisplay.getSelectAction() != null) { if(m_selectionDisplay.getSelectAction().equals(KscCustomSelectionView.VIEW)) { urlBuilder.append("?report_action=View"); }else if(m_selectionDisplay.getSelectAction().equals(KscCustomSelectionView.CUSTOMIZE)) { urlBuilder.append("?report_action=Customize"); }else if(m_selectionDisplay.getSelectAction().equals(KscCustomSelectionView.CREATE_NEW)) { urlBuilder.append("?report_action=Create"); }else if(m_selectionDisplay.getSelectAction().equals(KscCustomSelectionView.CREATE_NEW_FROM_EXISTING)) { urlBuilder.append("?report_action=CreateFrom"); }else if(m_selectionDisplay.getSelectAction().equals(KscCustomSelectionView.DELETE)) { urlBuilder.append("?report_action=Delete"); } if(getView().getSelectedResource() != null) { urlBuilder.append("&report=" + getView().getSelectedResource().getId()); Location.assign(urlBuilder.toString()); } else if(getView().getSelectedResource() == null && m_selectionDisplay.getSelectAction().equals(KscCustomSelectionView.CREATE_NEW)) { Location.assign(urlBuilder.toString()); }else { getView().showWarning(); } } else { getView().showWarning(); } } }); }
@Override public void onResourceItemSelected() { StringBuilder url = new StringBuilder(getBaseUrl()); url.append("graph/chooseresource.htm"); url.append("?reports=all"); url.append("&parentResourceId=" + getView().getSelectedResource().getId()); Location.assign(url.toString()); }