List of usage examples for com.google.gwt.user.client Cookies setCookie
public static void setCookie(String name, String value)
From source file:org.geomajas.quickstart.gwt.client.Application.java
License:Open Source License
private void initializeConstants() { // register Global layout stuff GuwLayout.ribbonBarInternalMargin = 2; GuwLayout.ribbonGroupInternalMargin = 4; GuwLayout.DropDown.ribbonBarDropDownButtonDescriptionIconSize = 24; GuwLayout.ribbonTabOverflow = Overflow.HIDDEN; GsfLayout.searchWindowPositionType = DockableWindowSearchWidget.SearchWindowPositionType.SNAPTO; GsfLayout.searchWindowPosSnapTo = "TR"; // GsfLayout.searchWindowPosLeft = -25; SearchCommService.searchResultSize = 500; //Register crock eye notificator. Notify.getInstance().setHandler(CrocEyeNotificationHandler.getInstance()); GwtCommandDispatcher.getInstance().setCommandExceptionCallback(CrocEyeNotificationHandler.getInstance()); GwtCommandDispatcher.getInstance().setCommunicationExceptionCallback(new CommunicationExceptionCallback() { @Override/* w w w .j ava2 s . co m*/ public void onCommunicationException(Throwable error) { // Hide communication errors from the user, but report to server (try once) String msg = I18nProvider.getGlobal().commandCommunicationError() + ":\n" + error.getMessage(); Log.logError(msg, error); } }); WidgetLayout.crocEyePositionLeft = 150; GuwLayout.DropDown.showDropDownImage = false; Cookies.setCookie("skin_name", "Enterprise"); }
From source file:org.jboss.mjolnir.server.LoginServiceImpl.java
License:Open Source License
@Override public void setSession() { log("setSession() called."); String cookieValue = getThreadLocalRequest().getRequestedSessionId(); Cookies.setCookie("JSESSIONID", cookieValue); log("Session ID cookie set as: " + cookieValue); }
From source file:org.onebusaway.webapp.gwt.notification.NotificationStateDAO.java
License:Apache License
/**** * /* w ww . jav a2s. c om*/ ****/ private void saveState(List<NotificationStateNode> nodes) { JSONArray array = new JSONArray(); int index = 0; for (NotificationStateNode node : nodes) array.set(index++, getNodeAsJSONObject(node)); System.out.println("saving=" + array.toString()); Cookies.setCookie(COOKIE_NAME, array.toString()); }
From source file:org.opennms.gwt.web.ui.asset.client.tools.DisclosurePanelCookie.java
License:Open Source License
@UiConstructor public DisclosurePanelCookie(final String cookieName) { panel.setStyleName("DisclosurePanelCookie"); panel.setAnimationEnabled(true);//w w w. ja v a 2s . com if (Cookies.isCookieEnabled()) { // prepare Cookie if not already set if (Cookies.getCookie(cookieName + "Open") == null) { Cookies.setCookie(cookieName + "Open", "true"); } // check cookie and set open/close by cookie-value if (Cookies.getCookie(cookieName + "Open").equals("true")) { panel.setOpen(true); } else { panel.setOpen(false); } // add openhandler that sets open/true to cookie panel.addOpenHandler(new OpenHandler<DisclosurePanel>() { @Override public void onOpen(OpenEvent<DisclosurePanel> event) { Cookies.setCookie(cookieName + "Open", "true"); } }); // add closehandler that sets close/flase to cookie panel.addCloseHandler(new CloseHandler<DisclosurePanel>() { @Override public void onClose(CloseEvent<DisclosurePanel> event) { Cookies.setCookie(cookieName + "Open", "false"); } }); } initWidget(panel); }
From source file:org.openremote.modeler.client.presenter.UIDesignerPresenter.java
License:Open Source License
public UIDesignerPresenter(EventBus eventBus, UIDesignerView view, WidgetSelectionUtil widgetSelectionUtil) { super();//w ww . java 2 s . co m this.widgetSelectionUtil = widgetSelectionUtil; this.eventBus = eventBus; this.view = view; this.view.getToolbar().setPresenter(this); this.profilePanelPresenter = new ProfilePanelPresenter(eventBus, view.getProfilePanel()); this.templatePanelPresenter = new TemplatePanelPresenter(eventBus, view.getTemplatePanel()); this.screenPanelPresenter = new ScreenPanelPresenter(eventBus, widgetSelectionUtil, view.getScreenPanel()); this.propertyPanelPresenter = new PropertyPanelPresenter(eventBus, widgetSelectionUtil, view.getPropertyPanel()); AsyncServiceFactory.getUtilsRPCServiceAsync().getAccountPath(new AsyncSuccessCallback<String>() { public void onFailure(Throwable caught) { Info.display("Error", "failed to get account path."); super.checkTimeout(caught); } public void onSuccess(String result) { Cookies.setCookie(Constants.CURRETN_RESOURCE_PATH, result); } }); prepareData(); createAutoSaveTimer(); bind(); }
From source file:org.openremote.modeler.client.view.ApplicationView.java
License:Open Source License
private ToggleButton createBMButton() { final ToggleButton bmButton = new ToggleButton(); bmButton.setToolTip("Building Modeler"); bmButton.setIcon(icons.bmIcon());/*ww w. ja v a2 s. com*/ bmButton.addSelectionListener(new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { if (!bmButton.isPressed()) { bmButton.toggle(true); } else { modelerContainer.remove(uiDesignerView); modelerContainer.add(buildingModelerView); Cookies.setCookie(Constants.CURRETN_ROLE, Role.ROLE_MODELER); modelerContainer.layout(); } } }); bmButton.setToggleGroup("modeler-switch"); if (Cookies.getCookie(Constants.CURRETN_ROLE) == null || Role.ROLE_MODELER.equals(Cookies.getCookie(Constants.CURRETN_ROLE))) { bmButton.toggle(true); } return bmButton; }
From source file:org.openremote.modeler.client.view.ApplicationView.java
License:Open Source License
private ToggleButton createUDButton() { final ToggleButton udButton = new ToggleButton(); udButton.setToolTip("UI Designer"); udButton.setIcon(icons.udIcon());/*from ww w . ja va2 s. c om*/ udButton.addSelectionListener(new SelectionListener<ButtonEvent>() { public void componentSelected(ButtonEvent ce) { if (!udButton.isPressed()) { udButton.toggle(true); } else { modelerContainer.remove(buildingModelerView); modelerContainer.add(uiDesignerView); Cookies.setCookie(Constants.CURRETN_ROLE, Role.ROLE_DESIGNER); modelerContainer.layout(); } } }); udButton.setToggleGroup("modeler-switch"); if (Role.ROLE_DESIGNER.equals(Cookies.getCookie(Constants.CURRETN_ROLE))) { udButton.toggle(true); } return udButton; }
From source file:org.openremote.modeler.client.view.UIDesignerView.java
License:Open Source License
/** * Instantiates a new uI designer view./*from w w w . ja va 2 s . co m*/ */ public UIDesignerView() { super(); setText("UI Designer"); AsyncServiceFactory.getUtilsRPCServiceAsync().getAccountPath(new AsyncSuccessCallback<String>() { public void onFailure(Throwable caught) { Info.display("Error", "falid to get account path."); super.checkTimeout(caught); } public void onSuccess(String result) { Cookies.setCookie(Constants.CURRETN_RESOURCE_PATH, result); } }); setLayout(new BorderLayout()); profilePanel = createWest(); createCenter(); createEast(); prepareData(); createAutoSaveTimer(); }
From source file:org.ow2.proactive_grid_cloud_portal.rm.client.RMController.java
License:Open Source License
private void __login(String sessionId, String login) { LoginModel loginModel = LoginModel.getInstance(); loginModel.setLoggedIn(true);/*from w w w.j av a 2 s.com*/ loginModel.setLogin(login); loginModel.setSessionId(sessionId); if (this.loginPage != null) { this.loginPage.destroy(); this.loginPage = null; } this.rmPage = new RMPage(this); this.fetchRMMonitoring(); this.startTimer(); Settings.get().setSetting(SESSION_SETTING, sessionId); if (login != null) { Settings.get().setSetting(LOGIN_SETTING, login); } else { Settings.get().clearSetting(LOGIN_SETTING); } String lstr = ""; if (login != null) { lstr += " as " + login; } // this cookie is reset to a random int on every login: // if another session in another tab has a different localSessionNUm // than the one in the domain cookie, then we exit this.localSessionNum = "" + System.currentTimeMillis() + "_" + Random.nextInt(); Cookies.setCookie(LOCAL_SESSION_COOKIE, this.localSessionNum); LogModel.getInstance().logMessage("Connected to " + Config.get().getRestUrl() + lstr + " (sessionId=" + loginModel.getSessionId() + ")"); }
From source file:org.ow2.proactive_grid_cloud_portal.scheduler.client.SchedulerController.java
License:Open Source License
private void __login(String sessionId, String login) { LoginModel loginModel = LoginModel.getInstance(); loginModel.setLoggedIn(true);/*w w w .j a v a 2 s. co m*/ loginModel.setLogin(login); loginModel.setSessionId(sessionId); if (loginView != null) SchedulerController.this.loginView.destroy(); this.loginView = null; this.schedulerView = new SchedulerPage(this); this.executionController.getJobsController().fetchJobs(true); this.startTimer(); String lstr = ""; if (login != null) { lstr += " as " + login; } Settings.get().setSetting(SESSION_SETTING, sessionId); if (login != null) { Settings.get().setSetting(LOGIN_SETTING, login); } else { Settings.get().clearSetting(LOGIN_SETTING); } // this cookie is reset to a random int on every login: // if another session in another tab has a different localSessionNUm // than the one in the domain cookie, then we exit this.localSessionNum = "" + System.currentTimeMillis() + "_" + Random.nextInt(); Cookies.setCookie(LOCAL_SESSION_COOKIE, this.localSessionNum); LogModel.getInstance().logMessage("Connected to " + SchedulerConfig.get().getRestUrl() + lstr + " (sessionId=" + loginModel.getSessionId() + ")"); }