List of usage examples for com.google.gwt.user.client Cookies getCookie
public static String getCookie(String name)
From source file:org.geomajas.example.gwt.client.GeomajasSamples.java
License:Open Source License
public void onModuleLoad() { org.geomajas.gwt.client.i18n.I18nProvider.setLookUp(GWT.<ConstantsWithLookup>create(Samples.class)); // Setup the overall layout: VLayout main = new VLayout(); main.setWidth100();/*from w w w . j av a 2 s . c om*/ main.setHeight100(); main.setStyleName("tabSetContainer"); // Top bar: ToolStrip topBar = new ToolStrip(); topBar.setHeight(33); topBar.setWidth100(); topBar.addSpacer(6); Img icon = new Img("[ISOMORPHIC]/geomajas/geomajas_desktopicon_small.png"); icon.setSize(24); topBar.addMember(icon); Label title = new Label("Geomajas GWT Showcase"); title.setStyleName("sgwtTitle"); title.setWidth(300); topBar.addMember(title); topBar.addFill(); ToolStripButton devConsoleButton = new ToolStripButton(); devConsoleButton.setTitle("Developer Console"); devConsoleButton.setIcon("[ISOMORPHIC]/geomajas/silk/bug.png"); devConsoleButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { SC.showConsole(); } }); topBar.addButton(devConsoleButton); topBar.addSeparator(); // Skin select: SelectItem selectItem = new SelectItem(); selectItem.setHeight(21); selectItem.setWidth(130); LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); valueMap.put("Graphite", "Graphite"); valueMap.put("EnterpriseBlue", "Enterprise Blue"); valueMap.put("Enterprise", "Enterprise Gray"); selectItem.setValueMap(valueMap); String currentSkin = Cookies.getCookie("skin_name"); if (currentSkin == null) { currentSkin = "Graphite"; } selectItem.setDefaultValue(currentSkin); selectItem.setShowTitle(false); selectItem.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { Cookies.setCookie("skin_name", (String) event.getValue()); com.google.gwt.user.client.Window.Location.reload(); } }); topBar.addFormItem(selectItem); main.addMember(topBar); // Horizontal layout: HLayout hLayout = new HLayout(); hLayout.setWidth100(); hLayout.setHeight100(); hLayout.setLayoutMargin(5); VLayout leftTreeLayout = new VLayout(); leftTreeLayout.setHeight100(); leftTreeLayout.setWidth(200); leftTreeLayout.setShowResizeBar(true); leftTreeLayout.setMembersMargin(1); SampleTree sampleTree = new SampleTree(); sampleTree.addLeafClickHandler(new LeafClickHandler() { public void onLeafClick(LeafClickEvent event) { TreeNode node = event.getLeaf(); prepareSample(node); } }); leftTreeLayout.addMember(sampleTree); // Show a user label: final Label userLabel = new Label(); userLabel.setHeight(20); userLabel.setWidth100(); userLabel.setPadding(3); userLabel.setBorder("1px solid #A0A0A0"); Authentication.getInstance().addLoginHandler(new LoginHandler() { public void onLoginFailure(LoginFailureEvent event) { } public void onLoginSuccess(LoginSuccessEvent event) { userLabel.setContents("Logged in with: " + Authentication.getInstance().getUserId()); } }); Authentication.getInstance().addLogoutHandler(new LogoutHandler() { public void onLogoutFailure(LogoutFailureEvent event) { } public void onLogoutSuccess(LogoutSuccessEvent event) { userLabel.setContents("No user is logged in."); } }); Authentication.getInstance().login("luc", "luc", null); leftTreeLayout.addMember(userLabel); // Show an ActivityMonitor: ActivityMonitor monitor = new ActivityMonitor(); leftTreeLayout.addMember(monitor); hLayout.addMember(leftTreeLayout); mainTabSet = new TabSet(); mainTabSet.setWidth100(); mainTabSet.setHeight100(); LayoutSpacer layoutSpacer = new LayoutSpacer(); layoutSpacer.setWidth(5); LocaleSelect localeSelect = new LocaleSelect("English"); mainTabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, layoutSpacer, localeSelect); hLayout.addMember(mainTabSet); main.addMember(hLayout); main.draw(); showIntroductionTab(); }
From source file:org.geomajas.gwt.example.base.ExampleLayout.java
License:Open Source License
public void buildUi() { // Setup the overall layout: VLayout main = new VLayout(); main.setWidth100();/*w w w. j av a2s .co m*/ main.setHeight100(); main.setStyleName("tabSetContainer"); // Top bar: ToolStrip topBar = new ToolStrip(); topBar.setHeight(33); topBar.setWidth100(); topBar.addSpacer(6); Img icon = new Img(WidgetLayout.iconGeomajas); icon.setSize(24); topBar.addMember(icon); Label title = new Label("Geomajas GWT Showcase"); title.setStyleName("sgwtTitle"); title.setWidth(300); topBar.addMember(title); topBar.addFill(); ToolStripButton devConsoleButton = new ToolStripButton(); devConsoleButton.setTitle("Developer Console"); devConsoleButton.setIcon("[ISOMORPHIC]/geomajas/silk/bug.png"); devConsoleButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) { SC.showConsole(); } }); topBar.addButton(devConsoleButton); topBar.addSeparator(); // Skin select: SelectItem selectItem = new SelectItem(); selectItem.setHeight(21); selectItem.setWidth(130); LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); valueMap.put("Graphite", "Graphite"); valueMap.put("EnterpriseBlue", "Enterprise Blue"); valueMap.put("Enterprise", "Enterprise Gray"); selectItem.setValueMap(valueMap); String currentSkin = Cookies.getCookie("skin_name"); if (currentSkin == null) { currentSkin = "Graphite"; } selectItem.setDefaultValue(currentSkin); selectItem.setShowTitle(false); selectItem.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { Cookies.setCookie("skin_name", (String) event.getValue()); com.google.gwt.user.client.Window.Location.reload(); } }); topBar.addFormItem(selectItem); main.addMember(topBar); // Horizontal layout: HLayout hLayout = new HLayout(); hLayout.setWidth100(); hLayout.setHeight100(); hLayout.setLayoutMargin(5); VLayout leftTreeLayout = new VLayout(); leftTreeLayout.setHeight100(); leftTreeLayout.setWidth(200); leftTreeLayout.setShowResizeBar(true); leftTreeLayout.setMembersMargin(1); SampleTree sampleTree = new SampleTree(); sampleTree.addLeafClickHandler(new LeafClickHandler() { public void onLeafClick(LeafClickEvent event) { TreeNode node = event.getLeaf(); prepareSample(node); } }); leftTreeLayout.addMember(sampleTree); // Show a user label: userLabel.setHeight(20); userLabel.setWidth100(); userLabel.setPadding(3); userLabel.setBorder("1px solid #A0A0A0"); leftTreeLayout.addMember(userLabel); // Show an ActivityMonitor: ActivityMonitor monitor = new ActivityMonitor(); leftTreeLayout.addMember(monitor); hLayout.addMember(leftTreeLayout); mainTabSet = new TabSet(); mainTabSet.setWidth100(); mainTabSet.setHeight100(); LayoutSpacer layoutSpacer = new LayoutSpacer(); layoutSpacer.setWidth(5); LocaleSelect localeSelect = new LocaleSelect("English"); mainTabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, layoutSpacer, localeSelect); hLayout.addMember(mainTabSet); main.addMember(hLayout); main.draw(); showIntroductionTab(); }
From source file:org.gk.engine.client.Engine.java
License:Open Source License
private static String getCookie(String name) { return Cookies.getCookie(name); }
From source file:org.gss_project.gss.web.client.GSS.java
License:Open Source License
/** * Parse and store the user credentials to the appropriate fields. *//* w w w. j a v a 2 s. c o m*/ private void parseUserCredentials() { Configuration conf = (Configuration) GWT.create(Configuration.class); String cookie = conf.authCookie(); String auth = Cookies.getCookie(cookie); if (auth == null) { authenticateUser(); // Redundant, but silences warnings about possible auth NPE, below. return; } int sepIndex = auth.indexOf(conf.cookieSeparator()); if (sepIndex == -1) authenticateUser(); token = auth.substring(sepIndex + 1); final String username = auth.substring(0, sepIndex); if (username == null) authenticateUser(); refreshWebDAVPassword(); DeferredCommand.addCommand(new Command() { @Override public void execute() { fetchUser(username); } }); }
From source file:org.gss_project.gss.web.client.GSS.java
License:Open Source License
public void refreshWebDAVPassword() { Configuration conf = (Configuration) GWT.create(Configuration.class); String domain = Window.Location.getHostName(); String path = Window.Location.getPath(); String cookie = conf.webdavCookie(); webDAVPassword = Cookies.getCookie(cookie); Cookies.setCookie(cookie, "", null, domain, path, false); }
From source file:org.gwtportlets.portlet.client.ui.Theme.java
License:Open Source License
/** * Load the name of the selected theme from a cookie or something or * return null if none. */ protected String loadThemeName() { return Cookies.getCookie(themeCookie); }
From source file:org.jahia.ajax.gwt.client.widget.content.ContentExport.java
License:Open Source License
private void startProgress(ProgressBar progressBar, final GWTJahiaNode n) { progressBar.setIncrement(50);/* w ww. ja va2 s .com*/ progressBar.auto(); new Timer() { @Override public void run() { String exportedNode = Cookies.getCookie("exportedNode"); if (exportedNode != null && exportedNode.equals(n.getUUID())) { hide(); Cookies.removeCookie("exportedNode", "/"); this.cancel(); } } }.scheduleRepeating(1000); }
From source file:org.javahispano.javaleague.client.application.login.LoginPresenter.java
License:Apache License
private String getLoggedInCookie() { return Cookies.getCookie(ApiParameters.LOGIN_COOKIE); }
From source file:org.jboss.as.console.client.core.Preferences.java
License:Open Source License
public static String get(Key key) { return Cookies.getCookie(COOKIE_PREFIX + key.getToken()); }
From source file:org.jboss.as.console.client.shared.Preferences.java
License:Open Source License
public static String get(Key key) { return Cookies.getCookie(AS7_UI + key.getToken()); }