List of usage examples for com.google.gwt.user.client Cookies getCookie
public static String getCookie(String name)
From source file:ecc.gwt.warning.client.JsonRpc.java
License:Apache License
/** * Executes a json-rpc request.// w w w . j a va2 s. c om * * @param url * The location of the service * @param username * The username for basic authentification * @param password * The password for basic authentification * @param params * An array of objects containing the parameters * @param callback * A callbackhandler like in gwt's rpc. */ public void request(final String url, String username, String password, Map paramMap, boolean isStream, final AsyncCallback callback) { HashMap request = new HashMap(); request.putAll(paramMap); //request.put("id", new Integer(requestSerial++)); if (username == null) if (requestUser != null) username = requestUser; if (password == null) if (requestPassword != null) password = requestPassword; RequestCallback handler = new RequestCallback() { public void onResponseReceived(Request request, Response response) { try { String resp = response.getText(); if (resp.equals("")) throw new RuntimeException("empty"); HashMap reply = (HashMap) decode(resp); if (reply == null) { RuntimeException runtimeException = new RuntimeException("parse: " + response.getText()); fireFailure(runtimeException); callback.onFailure(runtimeException); } if (isErrorResponse(reply)) { RuntimeException runtimeException = new RuntimeException("error: " + reply.get("error")); fireFailure(runtimeException); callback.onFailure(runtimeException); } else if (isSuccessfulResponse(reply)) { callback.onSuccess(reply.get("result")); } else { RuntimeException runtimeException = new RuntimeException("syntax: " + response.getText()); fireFailure(runtimeException); callback.onFailure(runtimeException); } } catch (RuntimeException e) { fireFailure(e); callback.onFailure(e); } finally { decreaseRequestCounter(); } } public void onError(Request request, Throwable exception) { try { if (exception instanceof RequestTimeoutException) { RuntimeException runtimeException = new RuntimeException("timeout"); fireFailure(runtimeException); callback.onFailure(runtimeException); } else { RuntimeException runtimeException = new RuntimeException("other"); fireFailure(runtimeException); callback.onFailure(runtimeException); } } catch (RuntimeException e) { fireFailure(e); callback.onFailure(e); } finally { decreaseRequestCounter(); } } private boolean isErrorResponse(HashMap response) { return response.get("error") != null && response.get("result") == null; } private boolean isSuccessfulResponse(HashMap response) { return response.get("error") == null && response.containsKey("result"); } }; increaseRequestCounter(); RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url); if (requestTimeout > 0) builder.setTimeoutMillis(requestTimeout); String body = ""; if (isStream) { builder.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); body = new String(encode(request)); } else { builder.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); StringBuffer sb = new StringBuffer(); for (Iterator iterator = request.entrySet().iterator(); iterator.hasNext();) { Map.Entry<String, Object> entry = (Map.Entry<String, Object>) iterator.next(); sb.append(entry.getKey()).append("=").append(String.valueOf(entry.getValue())).append("&"); } body = sb.toString(); if (body.endsWith("&")) body = body.substring(0, body.length() - 1); } builder.setHeader("Content-Length", Integer.toString(body.length())); if (requestCookie != null) if (Cookies.getCookie(requestCookie) != null) builder.setHeader("X-Cookie", Cookies.getCookie(requestCookie)); if (username != null) builder.setUser(username); if (password != null) builder.setPassword(password); try { builder.sendRequest(body, handler); } catch (RequestException exception) { handler.onError(null, exception); } }
From source file:edu.caltech.ipac.firefly.core.Application.java
private void initAndShow() { // initialize JossoUtil... supply context information JossoUtil.init(Application.getInstance().getProperties().getProperty("sso.server.url"), GWT.getModuleBaseURL(),/* ww w. j a v a 2 s.co m*/ Application.getInstance().getProperties().getProperty("sso.user.profile.url")); commandTable = creator.makeCommandTable(); toolBar = creator.getToolBar(); layoutManager = creator.makeLayoutManager(); if (creator.isApplication()) { requestHandler = getRequestHandler(); History.addValueChangeHandler(requestHandler); } nullFrame = new Frame(); nullFrame.setSize("0px", "0px"); nullFrame.setVisible(false); RootPanel root = RootPanel.get(); root.clear(); root.add(nullFrame); if (BrowserUtil.isTouchInput()) root.addStyleName("disable-select"); if (getLayoutManager() != null) getLayoutManager().layout(creator.getLoadingDiv()); checkMobilAppInstall(); if (SupportedBrowsers.isSupported()) { if (appReady != null) { appReady.ready(); } if (creator.isApplication()) { // save the current state when you leave. DeferredCommand.addCommand(new Command() { public void execute() { Window.addCloseHandler(new CloseHandler<Window>() { public void onClose(CloseEvent<Window> windowCloseEvent) { gotoUrl(null, false); } }); } }); // coming back from prior session String ssoBackTo = Cookies.getCookie(PRIOR_STATE); final Request prevState = Request.parse(ssoBackTo); if (prevState != null && prevState.isSearchResult()) { Cookies.removeCookie(PRIOR_STATE); History.newItem(ssoBackTo, true); } else { // url contains request params String qs = Window.Location.getQueryString().replace("?", ""); if (!StringUtils.isEmpty(qs) && !qs.contains(IGNORE_QUERY_STR)) { String qsDecoded = URL.decodeQueryString(qs); String base = Window.Location.getHref(); base = base.substring(0, base.indexOf("?")); String newUrl = base + "#" + URL.encodePathSegment(qsDecoded); Window.Location.replace(newUrl); } else { String startToken = History.getToken(); if (StringUtils.isEmpty(startToken)) { goHome(); } else { requestHandler.processToken(startToken); } } } if (backgroundMonitor != null) backgroundMonitor.syncWithCache(null); } } else { hideDefaultLoadingDiv(); SupportedBrowsers.showUnsupportedMessage(); } }
From source file:edu.caltech.ipac.firefly.ui.GwtUtil.java
/** * * @param url//from w w w . j av a 2 s.c o m * @param checkIntvlInMsec check interval in milliseconds * @param maxTries * @param confirmationCallback */ public static void submitDownloadUrl(String url, int checkIntvlInMsec, final int maxTries, final Command confirmationCallback) { if (checkIntvlInMsec > 0 && maxTries > 0 && confirmationCallback != null) { Frame f = Application.getInstance().getNullFrame(); final String codId = String.valueOf(System.currentTimeMillis()); url += (url.contains("?") ? "&" : "?") + COD_ID + "=" + codId; f.setUrl(url); Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() { int tries = 0; public boolean execute() { String c = Cookies.getCookie(COD_ID); tries++; if ((c != null && c.equals(codId)) || tries > maxTries) { Cookies.removeCookie(COD_ID, "/"); confirmationCallback.execute(); return false; } else { return true; } } }, checkIntvlInMsec); } else { showDebugMsg("InvalidArgumentException: submitDownloadUrl"); } }
From source file:edu.ucla.loni.pipeline.client.EntryPoint.LONI_Pipeline_Server_Terminal.java
License:Open Source License
public LONI_Pipeline_Server_Terminal() { wbsl = new LONI_Pipeline_ST_Login_Display(); wbst = new LONI_Pipeline_ST_Tabset_Display("Guest"); sessionId.setSessionId(Cookies.getCookie("session")); System.out.println("Get Cookie: session = " + Cookies.getCookie("session")); if (sessionId == null) { System.out.println("sessionId == null"); } else {//from w w w . j a va 2 s. c o m System.out.println("sessionId != null"); } }
From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java
License:Open Source License
public void onModuleLoad() { sessionId = Cookies.getCookie(cookie_name); urlParams = GWTUtils.parseParamString(GWTUtils.getParamString()); /* if specified, 'page' will tell us which tab to select */ String page = (String) urlParams.get("page"); if (page != null) { currentTabIndex = Integer.parseInt(page); }//w w w . j a v a 2 s . c o m currentAction = (String) urlParams.get("action"); displayStatusPage("Loading data from server..."); EucalyptusWebBackend.App.getInstance().getProperties(new AsyncCallback() { public void onSuccess(Object result) { props = (HashMap) result; try { load_props(); /* verify properties */ /* these don't need sessions */ if (currentAction != null && (currentAction.equals("confirm") || currentAction.equals("recover"))) { executeAction(currentAction); } else { /* if we have don't have sessionId saved in a cookie */ if (sessionId == null) { displayLoginPage(); } else /* we have a cookie - try using it */ { check_box.setChecked(true); attemptLogin(); } } } catch (Exception e) { displayErrorPageFinal("Internal error (1): " + e.getMessage()); } } public void onFailure(Throwable caught) { displayErrorPageFinal("Internal error (2): " + caught.getMessage()); } }); }
From source file:egovframework.eam.admin.main.client.Main.java
License:Open Source License
public void onModuleLoad() { final String initToken = History.getToken(); //setup overall layout / viewport VLayout main = new VLayout() { @Override/* w w w .j a va2s . c om*/ protected void onInit() { super.onInit(); if (initToken.length() != 0) { onHistoryChanged(initToken); } } }; ToolStrip topBar = new ToolStrip(); topBar.setHeight(33); topBar.setWidth100(); topBar.addSpacer(6); ImgButton sgwtHomeButton = new ImgButton(); sgwtHomeButton.setSrc("pieces/24/cube_green.png"); sgwtHomeButton.setWidth(24); sgwtHomeButton.setHeight(24); sgwtHomeButton.setPrompt("Go to eGovFrame portal"); sgwtHomeButton.setHoverStyle("interactImageHover"); sgwtHomeButton.setShowRollOver(false); sgwtHomeButton.setShowDownIcon(false); sgwtHomeButton.setShowDown(false); sgwtHomeButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(ClickEvent event) { com.google.gwt.user.client.Window.open("http://www.egovframe.go.kr/", "sgwt", null); } }); topBar.addMember(sgwtHomeButton); topBar.addSpacer(6); Label title = new Label("eGov Access Management System"); title.setStyleName("sgwtTitle"); title.setWidth(300); topBar.addMember(title); topBar.addFill(); ToolStripButton devConsoleButton = new ToolStripButton(); devConsoleButton.setTitle("Developer Console"); devConsoleButton.setIcon("silk/bug.png"); //devConsoleButton.setStylePrimaryName("normal"); devConsoleButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(ClickEvent event) { SC.showConsole(); } }); topBar.addButton(devConsoleButton); topBar.addSeparator(); /* ImgButton imgButton = new ImgButton(); imgButton.setWidth(18); imgButton.setHeight(18); imgButton.setSrc("silk/emoticon.png"); imgButton.setShowFocused(false); imgButton.setShowFocusedIcon(false); imgButton.setPrompt("Bye bye!!"); imgButton.setTitle("logout"); imgButton.setHoverWidth(110); imgButton.setHoverStyle("interactImageHover"); imgButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(ClickEvent event) { com.google.gwt.user.client.Window.Location.replace("/j_spring_security_logout"); } }); topBar.addMember(imgButton); */ ToolStripButton logout = new ToolStripButton("Logout"); logout.setIcon("silk/emoticon.png"); logout.setPrompt("Bye bye!!"); logout.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(ClickEvent event) { com.google.gwt.user.client.Window.Location.replace("/j_spring_security_logout"); } }); topBar.addButton(logout); topBar.addSpacer(6); main.addMember(topBar); main.setWidth100(); main.setHeight100(); main.setStyleName("tabSetContainer"); HLayout hLayout = new HLayout(); hLayout.setLayoutMargin(5); hLayout.setWidth100(); hLayout.setHeight100(); VLayout sideNavLayout = new VLayout(); sideNavLayout.setHeight100(); sideNavLayout.setWidth(185); sideNavLayout.setShowResizeBar(true); sideNav = new SideNavTree(); sideNav.addLeafClickHandler(new LeafClickHandler() { public void onLeafClick(LeafClickEvent event) { TreeNode node = event.getLeaf(); showMenu(node); } }); sideNavLayout.addMember(sideNav); hLayout.addMember(sideNavLayout); mainTabSet = new TabSet(); Layout paneContainerProperties = new Layout(); paneContainerProperties.setLayoutMargin(0); paneContainerProperties.setLayoutTopMargin(1); mainTabSet.setPaneContainerProperties(paneContainerProperties); mainTabSet.setWidth100(); mainTabSet.setHeight100(); mainTabSet.addTabSelectedHandler(new TabSelectedHandler() { public void onTabSelected(TabSelectedEvent event) { Tab selectedTab = event.getTab(); String historyToken = selectedTab.getAttribute("historyToken"); if (historyToken != null) { History.newItem(historyToken, false); } else { History.newItem("main", false); } } }); LayoutSpacer layoutSpacer = new LayoutSpacer(); layoutSpacer.setWidth(5); SelectItem selectItem = new SelectItem(); selectItem.setHeight(21); selectItem.setWidth(130); LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); valueMap.put("EnterpriseBlue", "Enterprise Blue"); valueMap.put("Enterprise", "Enterprise Gray"); valueMap.put("Graphite", "Graphite"); valueMap.put("Simplicity", "Simplicity"); selectItem.setValueMap(valueMap); final String skinCookieName = "skin_name_2_4"; String currentSkin = Cookies.getCookie(skinCookieName); if (currentSkin == null) { currentSkin = "EnterpriseBlue"; } selectItem.setDefaultValue(currentSkin); selectItem.setShowTitle(false); selectItem.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { Cookies.setCookie(skinCookieName, (String) event.getValue()); com.google.gwt.user.client.Window.Location.reload(); } }); DynamicForm form = new DynamicForm(); form.setPadding(0); form.setMargin(0); form.setCellPadding(1); form.setNumCols(1); form.setFields(selectItem); mainTabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, layoutSpacer, form); contextMenu = createContextMenu(); Tab tab = new Tab(); tab.setTitle("Home "); tab.setIcon("pieces/16/cube_green.png", 16); tab.setWidth(80); HLayout mainPanel = new HLayout(); mainPanel.setHeight100(); mainPanel.setWidth100(); // main mainPanel.addMember(new GuidePane()); tab.setPane(mainPanel); mainTabSet.addTab(tab); Canvas canvas = new Canvas(); canvas.setBackgroundImage("[SKIN]/shared/background.gif"); canvas.setWidth100(); canvas.setHeight100(); canvas.addChild(mainTabSet); hLayout.addMember(canvas); main.addMember(hLayout); if (SC.hasFirebug()) { Label label = new Label(); label.setWidth100(); label.setHeight(50); label.setValign(VerticalAlignment.CENTER); label.setAlign(Alignment.CENTER); label.setContents( "Firebug can make the eGov Access Management run slow. For the best performance, we suggest disabling Firebug for this site."); Window fbWindow = new Window(); fbWindow.setTitle("Firebug Detected"); fbWindow.setWidth100(); fbWindow.setHeight(80); fbWindow.addItem(label); fbWindow.setRedrawOnResize(true); main.addMember(fbWindow); } main.draw(); // Add history listener //History.addHistoryListener(this); History.addValueChangeHandler(this); RootPanel p = RootPanel.get("loadingWrapper"); if (p != null) { RootPanel.getBodyElement().removeChild(p.getElement()); } GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { public void onUncaughtException(Throwable e) { SC.say("Error", "Client Error occured."); GWT.log("", e); } }); }
From source file:eml.studio.client.IndexPage.java
License:Open Source License
/** * Enter login action /*from w w w. j a v a2 s. c o m*/ */ public void enterLogin() { Account account = new Account(); if (loginPanel.getAutoLogin()) { account.setEmail(loginPanel.getEmail()); account.setSerial(Cookies.getCookie("bdaserial")); accountSrv.autoLogin(account, new AsyncCallback<Account>() { @Override public void onFailure(Throwable caught) { loginPanel.errorLabel.setText(Constants.logUIMsg.loginErrorMsg()); } @Override public void onSuccess(Account account) { if (account != null) { loginPanel.hide(); String refer = Window.Location.getParameter("url"); if (refer == null) AppController.redirect("EMLStudio.html"); else Window.Location.replace(refer); } else { loginPanel.errorLabel.setText(Constants.logUIMsg.loginWrongMsg()); } } }); } else { account.setEmail(loginPanel.getEmail()); account.setPassword(loginPanel.getPassword()); accountSrv.login(account, new AsyncCallback<Account>() { @Override public void onFailure(Throwable caught) { loginPanel.errorLabel.setText(Constants.logUIMsg.loginErrorMsg()); } @Override public void onSuccess(Account account) { if (account != null) { Cookies.setCookie("bdaemail", account.getEmail(), Util.getCookieExpireDate()); if (loginPanel.getRemmenber()) { Cookies.setCookie("bdaserial", account.getSerial(), Util.getCookieExpireDate()); } loginPanel.hide(); String refer = Window.Location.getParameter("url"); if (refer == null) AppController.redirect("EMLStudio.html"); else Window.Location.replace(refer); } else { loginPanel.errorLabel.setText(Constants.logUIMsg.loginWrongMsg()); } } }); } }
From source file:eml.studio.client.mvp.presenter.AccountLoader.java
License:Open Source License
/** * Initialization/*from w ww. j a v a 2 s . c om*/ */ private void init() { clearInput(); adminView.getUserPage().clear(); page.addStyleName("admin-page"); adminView.getUserPage().add(page); currentPage = 1; Account currentAccount = new Account(); currentAccount.setEmail(Cookies.getCookie("bdaemail")); accountService.getSize(currentAccount, new AsyncCallback<Integer>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub caught.getMessage(); } @Override public void onSuccess(Integer result) { // TODO Auto-generated method stub //Caculate page-related information, initialize and load paging controls resultSize = result; pageSize = (int) Math.ceil((double) result / 13); lastPage = pageSize; pagination = new Pagination(page, pageSize, Pagination.PageType.LARGE); pagination.load(); //Load user data load(); } }); }
From source file:eml.studio.client.mvp.presenter.AccountLoader.java
License:Open Source License
/** * Load data into the page//from w ww.j a v a 2 s . co m */ private void load() { resultStart = (currentPage - 1) * 13; if (currentPage == lastPage) { everyPageSize = resultSize - resultStart; } else { everyPageSize = 13; } adminView.getUserGrid().resize(everyPageSize + 1, 7); adminView.getUserGrid().setText(0, 0, "Email"); adminView.getUserGrid().setText(0, 1, "Username"); adminView.getUserGrid().setText(0, 2, "Company"); adminView.getUserGrid().setText(0, 3, "Position"); adminView.getUserGrid().setText(0, 4, "Join Date"); adminView.getUserGrid().setText(0, 5, "Power"); adminView.getUserGrid().setText(0, 6, "Operation"); Account currentAccount = new Account(); currentAccount.setEmail(Cookies.getCookie("bdaemail")); accountService.findValid(currentAccount, resultStart, everyPageSize, new AsyncCallback<List<Account>>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub alertPanel.setContent(caught.getMessage()); alertPanel.show(); } @Override public void onSuccess(List<Account> result) { // TODO Auto-generated method stub for (int i = 0; i < everyPageSize; i++) { adminView.getUserGrid().setText(i + 1, 0, result.get(i).getEmail()); adminView.getUserGrid().setText(i + 1, 1, result.get(i).getUsername()); adminView.getUserGrid().setText(i + 1, 2, result.get(i).getCompany()); adminView.getUserGrid().setText(i + 1, 3, result.get(i).getPosition()); adminView.getUserGrid().setText(i + 1, 4, formatter.format(result.get(i).getCreatetime())); final HorizontalPanel powerField = new HorizontalPanel(); final CheckBox cb1 = new CheckBox(); final CheckBox cb2 = new CheckBox(); final CheckBox cb3 = new CheckBox(); Label lb1 = new Label(Constants.adminUIMsg.power1()); Label lb2 = new Label(Constants.adminUIMsg.power2()); Label lb3 = new Label(Constants.adminUIMsg.power3()); lb1.getElement().getStyle().setMarginTop(1, Unit.PX); lb2.getElement().getStyle().setMarginTop(1, Unit.PX); lb3.getElement().getStyle().setMarginTop(1, Unit.PX); cb1.getElement().getStyle().setMarginLeft(5, Unit.PX); cb2.getElement().getStyle().setMarginLeft(5, Unit.PX); cb3.getElement().getStyle().setMarginLeft(5, Unit.PX); powerField.add(cb1); powerField.add(lb1); powerField.add(cb2); powerField.add(lb2); powerField.add(cb3); powerField.add(lb3); String arr[] = result.get(i).getPower().split(""); if (arr[1].equals("1")) { cb1.setValue(true); } if (arr[2].equals("1")) { cb2.setValue(true); } if (arr[3].equals("1")) { cb3.setValue(true); } cb1.setEnabled(false); cb2.setEnabled(false); cb3.setEnabled(false); adminView.getUserGrid().setWidget(i + 1, 5, powerField); final String userEmail = result.get(i).getEmail(); final Label editUser = new Label(); editUser.setTitle(Constants.adminUIMsg.editPower()); editUser.addStyleName("admin-user-edit"); editUser.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub cb1.setEnabled(true); cb2.setEnabled(true); cb3.setEnabled(true); editUser.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub String newPower = ""; if (cb1.getValue()) { newPower = newPower + "1"; } else { newPower = newPower + "0"; } if (cb2.getValue()) { newPower = newPower + "1"; } else { newPower = newPower + "0"; } if (cb3.getValue()) { newPower = newPower + "1"; } else { newPower = newPower + "0"; } Account account = new Account(); account.setEmail(userEmail); account.setPower(newPower); accountService.updatePower(account, new AsyncCallback<Account>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub alertPanel.setContent(caught.getMessage()); alertPanel.show(); } @Override public void onSuccess(Account result) { // TODO Auto-generated method stub if (result != null) { alertPanel.setContent(Constants.adminUIMsg.powerSuccess()); alertPanel.show(); } } }); } }); } }); Label deleteUser = new Label(); deleteUser.setTitle(Constants.adminUIMsg.deleteUser()); deleteUser.addStyleName("admin-user-delete"); deleteUser.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub deletePanel.setContent(Constants.adminUIMsg.userDelete1() + userEmail + Constants.adminUIMsg.userDelete2()); deletePanel.show(); deletePanel.getConfirmBtn().addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub Account account = new Account(); account.setEmail(userEmail); accountService.deleteAccount(account, new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub deletePanel.hide(); alertPanel.setContent(caught.getMessage()); alertPanel.show(); } @Override public void onSuccess(String result) { // TODO Auto-generated method stub if (result.equals("success")) { deletePanel.hide(); alertPanel.setContent(Constants.adminUIMsg.userSuccess()); alertPanel.show(); } else { deletePanel.hide(); alertPanel.setContent(result); alertPanel.show(); } } }); } }); } }); HorizontalPanel operate = new HorizontalPanel(); operate.addStyleName("admin-user"); operate.add(editUser); operate.add(deleteUser); if (!userEmail.equals(AppController.email)) { adminView.getUserGrid().setWidget(i + 1, 6, operate); } } } }); }
From source file:eml.studio.client.mvp.presenter.AccountLoader.java
License:Open Source License
/** * Load search result and reset paging control *//* ww w .j ava2 s . c om*/ private void searchResult() { adminView.getUserPage().clear(); //Clear paging area and reload adminView.getUserPage().add(page); Account currentAccount = new Account(); currentAccount.setEmail(Cookies.getCookie("bdaemail")); accountService.search(currentAccount, searchAccount, 0, 0, new AsyncCallback<List<Account>>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub searchAlert.setContent(caught.getMessage()); searchAlert.show(); } @Override public void onSuccess(List<Account> result) { // TODO Auto-generated method stub if (result.size() == 0) { searchAlert.setContent(Constants.adminUIMsg.searchNoResult()); searchAlert.show(); } else { resultSize = result.size(); pageSize = (int) Math.ceil((double) result.size() / 13); lastPage = pageSize; currentPage = 1; pagination = new Pagination(page, pageSize, Pagination.PageType.LARGE); pagination.load(); reload(); } } }); }