List of usage examples for com.google.gwt.user.client Cookies getCookie
public static String getCookie(String name)
From source file:org.obiba.opal.web.gwt.rest.client.RequestCredentials.java
License:Open Source License
public String extractObibaCredentials() { return Cookies.getCookie(OBIBASID); }
From source file:org.olanto.mySelfQD.client.MainEntryPoint.java
License:Open Source License
private void getPropertiesMyParse() { rpcM.InitPropertiesFromFile(Cookies.getCookie(CookiesNamespace.InterfaceLanguage), new AsyncCallback<GwtProp>() { @Override/*from w w w.j a v a 2s. c o m*/ public void onFailure(Throwable caught) { Window.alert("Couldn't get properties List"); } @Override public void onSuccess(GwtProp result) { InitProperties(result); if (GuiConstant.MAXIMIZE_ON) { Window.moveTo(0, 0); Window.resizeTo(getScreenWidth(), getScreenHeight()); maximize(); } setParseWidget(); } }); }
From source file:org.olanto.mySelfQD.client.MyParseCookies.java
License:Open Source License
public static void initCookie(String name, String value) { Date expires = new Date(System.currentTimeMillis() + (1000L * 3600L * 24L * (long) GuiConstant.EXP_DAYS)); if ((Cookies.getCookie(name) == null)) { Cookies.setCookie(name, value, expires); }/* ww w. j a va2 s .co m*/ }
From source file:org.olanto.mySelfQD.client.ParseWidget.java
License:Open Source License
private void setHeader() { initWidget(mainWidget);// w ww . j a va 2 s. c o m mainWidget.setStyleName("mainContent"); mainWidget.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); mainWidget.add(headerContainer); mainWidget.add(mainContainer); mainWidget.add(statusContainer); headerContainer.setBodyBorder(true); headerContainer.setHeaderVisible(false); headerContainer.add(headPanel); headerContainer.setStylePrimaryName("searchHeader"); headPanel.setStylePrimaryName("searchHeader"); headPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); headerPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); headerPanel.add(fileUpload); headerPanel.add(GoSrch); headerPanel.add(minLn); headerPanel.add(minLength); headerPanel.add(minFr); headerPanel.add(minFreq); headerPanel.add(help); headerPanel.add(save); if (GuiConstant.CHOOSE_GUI_LANG) { headerPanel.add(chooseLang); headerPanel.add(langInterface); } headerPanel.setStylePrimaryName("searchHeader"); headPanel.add(leftheadPanel); headPanel.add(SQDText); headPanel.setCellHorizontalAlignment(SQDText, HorizontalPanel.ALIGN_RIGHT); if ((!GuiConstant.LOGO_PATH.isEmpty()) && (!GuiConstant.LOGO_PATH.isEmpty())) { if ((!GuiConstant.LOGO_PATH.equalsIgnoreCase(" ")) && (!GuiConstant.LOGO_PATH.equalsIgnoreCase(" "))) { headPanel.add(im); headPanel.setCellHorizontalAlignment(im, HorizontalPanel.ALIGN_RIGHT); } } topJobsSet.setTabBarPosition(Side.TOP); topJobsSet.setDefaultHeight(H_Unit); topJobsSet.setPaneContainerClassName("searchHeader"); leftheadPanel.add(topJobsSet); leftheadPanel.add(headerPanel); mainContainer.setBodyBorder(true); mainContainer.setHeaderVisible(false); mainContainer.setStylePrimaryName("mainContent"); statusContainer.setBodyBorder(true); statusContainer.setHeaderVisible(false); statusContainer.add(statusPanel); statusPanel.setHeight(H_Unit + "px"); statusPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); statusPanel.add(msg); statusPanel.setCellHorizontalAlignment(msg, HorizontalPanel.ALIGN_LEFT); statusPanel.add(contact); statusPanel.setCellHorizontalAlignment(contact, HorizontalPanel.ALIGN_RIGHT); contact.setPixelSize(300, 25); contact.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE); Anchor poweredBy = new Anchor(GuiConstant.OLANTO_URL.substring(0, GuiConstant.OLANTO_URL.indexOf("|")), true, GuiConstant.OLANTO_URL.substring(GuiConstant.OLANTO_URL.indexOf("|") + 1, GuiConstant.OLANTO_URL.lastIndexOf("|")), GuiConstant.OLANTO_URL.substring(GuiConstant.OLANTO_URL.lastIndexOf("|") + 1)); contact.add(poweredBy); poweredBy.setStylePrimaryName("contactInfo"); contact.setCellHorizontalAlignment(poweredBy, HorizontalPanel.ALIGN_LEFT); contact.add(new HTML(" || ")); Anchor feedback = new Anchor( GuiConstant.FEEDBACK_MAIL.substring(0, GuiConstant.FEEDBACK_MAIL.indexOf("|"))); contact.add(new HTML(" ")); contact.setCellHorizontalAlignment(feedback, HorizontalPanel.ALIGN_RIGHT); contact.add(feedback); feedback.setStylePrimaryName("contactInfo"); statusContainer.setStylePrimaryName("statusPanel"); statusPanel.setStylePrimaryName("statusPanel"); mainContainer.add(htmlWrapper); refArea.setVisible(true); refArea.setStyleName("TextBlock"); fileUpload.addOnStartUploadHandler(onStartUploaderHandler); fileUpload.addOnFinishUploadHandler(onFinishUploaderHandler); help.addListener(Events.OnClick, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { Window.open(GuiConstant.SQD_HELP_URL, "", GuiConstant.W_OPEN_FEATURES); } }); fileUpload.setAutoSubmit(true); setMessage("warning", GuiConstant.MSG_5); for (int i = GuiConstant.MIN_FREQ; i < GuiConstant.MAX_FREQ; i++) { minFreq.addItem("" + i); } for (int i = GuiConstant.MIN_OCCU; i < GuiConstant.MAX_OCCU; i++) { minLength.addItem("" + i); } minLength.setSelectedIndex(Integer.parseInt(Cookies.getCookie(CookiesNamespace.ParseMinLength))); minFreq.setSelectedIndex(Integer.parseInt(Cookies.getCookie(CookiesNamespace.ParseMinFreq))); minFreq.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { MyParseCookies.updateCookie(CookiesNamespace.ParseMinFreq, "" + minFreq.getSelectedIndex()); } }); minLength.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { MyParseCookies.updateCookie(CookiesNamespace.ParseMinLength, "" + minLength.getSelectedIndex()); } }); if (GuiConstant.CHOOSE_GUI_LANG) { langInterface.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { MyParseCookies.updateCookie(CookiesNamespace.InterfaceLanguage, INT_LANG[langInterface.getSelectedIndex()]); Window.Location.reload(); } }); } if ((!GuiConstant.LOGO_PATH.isEmpty()) && (!GuiConstant.LOGO_PATH.isEmpty())) { im.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Window.open(GuiConstant.LOGO_URL, "", GuiConstant.W_OPEN_FEATURES); } }); } feedback.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { mailto(GuiConstant.FEEDBACK_MAIL.substring(GuiConstant.FEEDBACK_MAIL.lastIndexOf("|") + 1), GuiConstant.MSG_6 + GuiConstant.SELF_QD); } }); }
From source file:org.olanto.mySelfQD.client.ParseWidget.java
License:Open Source License
public void draWidget() { setbuttonstyle(GoSrch, GoSrch.getText().length() * 2 * CHAR_W, H_Unit); setbuttonstyle(help, help.getText().length() * (CHAR_W + 2), H_Unit); setbuttonstyle(save, save.getText().length() * (CHAR_W + 2), H_Unit); minFr.setStyleName("gwt-w-label"); minLn.setStyleName("gwt-w-label"); SQDText.setText(GuiConstant.SELF_QD); SQDText.setStyleName("gwt-im-text"); chooseLang.setStyleName("gwt-w-label"); for (int i = 0; i < INT_LANG.length; i++) { langInterface.addItem(INT_LANG[i]); }/*from ww w.jav a2 s. c om*/ langInterface.setWidth(2 * W_Unit + "px"); langInterface.setSelectedIndex(getIndex(INT_LANG, Cookies.getCookie(CookiesNamespace.InterfaceLanguage))); htmlWrapper.setPixelSize((Window.getClientWidth() - 2 * W_Unit), (Window.getClientHeight() - 4 * H_Unit)); refArea.setWidth((Window.getClientWidth() - 3 * W_Unit) + "px"); if ((GuiConstant.JOBS_ITEMS != null) && (GuiConstant.JOBS_ITEMS.length() > 1)) { String jobs = GuiConstant.JOBS_ITEMS; String[] tablist = jobs.split("\\;"); Tab tinv = new Tab(); topJobsSet.addTab(tinv); tinv.setTitle("Select Tab : "); tinv.setID("Empty"); tinv.setDisabled(true); if (tablist.length > 0) { for (int i = 0; i < tablist.length; i++) { Tab tTab = new Tab(); tTab.setIcon("./icons/16/folder_document.png"); tTab.setTitle(tablist[i].substring(0, tablist[i].indexOf("|"))); tTab.setAttribute("URL", tablist[i].substring(tablist[i].indexOf("|") + 1, tablist[i].lastIndexOf("|"))); tTab.setAttribute("MODE", tablist[i].substring(tablist[i].lastIndexOf("|") + 1)); topJobsSet.addTab(tTab); } } topJobsSet.setSelectedTab(0); topJobsSet.addTabSelectedHandler(new TabSelectedHandler() { @Override public void onTabSelected(TabSelectedEvent event) { if (!(event.getTab().getID().contains("Empty"))) { Window.open(event.getTab().getAttribute("URL"), event.getTab().getAttribute("MODE"), ""); } } }); topJobsSet.setWidth(headerPanel.getOffsetWidth()); topJobsSet.draw(); topJobsSet.setCursor(Cursor.HAND); } else { leftheadPanel.remove(topJobsSet); } adaptSize(); }
From source file:org.olanto.TranslationText.client.InterfaceMeasures.java
License:Open Source License
public void setMeasuresfromCookies() { this.TA_TEXTAREA_WIDTH = Integer.parseInt(Cookies.getCookie(CookiesNamespace.TA_TEXTAREA_WIDTH)); this.TA_TEXTAREA_HEIGHT = Integer.parseInt(Cookies.getCookie(CookiesNamespace.TA_TEXTAREA_HEIGHT)); this.QD_HTMLAREA_HEIGHT = Integer.parseInt(Cookies.getCookie(CookiesNamespace.QD_HTMLAREA_HEIGHT)); this.QD_TEXTAREA_HEIGHT = Integer.parseInt(Cookies.getCookie(CookiesNamespace.QD_TEXTAREA_HEIGHT)); this.DOC_LIST_WIDTH = Integer.parseInt(Cookies.getCookie(CookiesNamespace.DOC_LIST_WIDTH)); this.DOC_LIST_HEIGHT = Integer.parseInt(Cookies.getCookie(CookiesNamespace.DOC_LIST_HEIGHT)); this.QD_DOC_LIST_HEIGHT = Integer.parseInt(Cookies.getCookie(CookiesNamespace.QD_DOC_LIST_HEIGHT)); this.utilWidth = Window.getClientWidth(); }
From source file:org.olanto.TranslationText.client.MainEntryPoint.java
License:Open Source License
private void getPropertiesMyCat() { rpcM.InitPropertiesFromFile(Cookies.getCookie(CookiesNamespace.InterfaceLanguage), new AsyncCallback<GwtProp>() { @Override//from www .ja v a 2 s . c o m public void onFailure(Throwable caught) { Window.alert("Warning: Could not get the list of properties: " + caught.getMessage()); } @Override public void onSuccess(GwtProp result) { InitProperties(result); // Window.alert(GuiConstant.show()); // Window.alert(GuiMessageConst.show()); if (GuiConstant.MAXIMIZE_ON) { Window.moveTo(0, 0); Window.resizeTo(getScreenWidth(), getScreenHeight()); maximize(); } if (!Window.Navigator.isCookieEnabled()) { Window.alert(GuiMessageConst.MSG_63); } initCookies(); if (MyCatCookies.areInterfaceMeasuresSaved() && GuiConstant.AUTO_ON) { IMeasures.setMeasuresfromCookies(); } else { IMeasures.setDefaultMeasures(); } setSettingsColMycat(); setSettingsColMyQuote(); getLanguages(); } }); }
From source file:org.olanto.TranslationText.client.MainEntryPoint.java
License:Open Source License
private void setLanguagesQD() { int s = 0, t = 0; quoteDetectorWidget.langS.clear();/* ww w.j av a 2s . c om*/ quoteDetectorWidget.langT.clear(); for (int i = 0; i < languages.length; i++) { quoteDetectorWidget.langS.addItem(languages[i]); quoteDetectorWidget.langT.addItem(languages[i]); if (languages[i].equalsIgnoreCase(Cookies.getCookie(CookiesNamespace.MyQuotelangS))) { s = i; } if (languages[i].equalsIgnoreCase(Cookies.getCookie(CookiesNamespace.MyQuotelangT))) { t = i; } } quoteDetectorWidget.langS.setSelectedIndex(s); quoteDetectorWidget.langT.setSelectedIndex(t); }
From source file:org.olanto.TranslationText.client.MainEntryPoint.java
License:Open Source License
private void setLanguagesTA() { int s = 0, t = 0; textAlignerWidget.langS.clear();/*from w w w .j a v a 2 s . c o m*/ textAlignerWidget.langT.clear(); for (int i = 0; i < languages.length; i++) { textAlignerWidget.langS.addItem(languages[i]); textAlignerWidget.langT.addItem(languages[i]); if (languages[i].equalsIgnoreCase(Cookies.getCookie(CookiesNamespace.MyCatlangS))) { s = i; } if (languages[i].equalsIgnoreCase(Cookies.getCookie(CookiesNamespace.MyCatlangT))) { t = i; } } textAlignerWidget.langS.setSelectedIndex(s); textAlignerWidget.langT.setSelectedIndex(t); }
From source file:org.olanto.TranslationText.client.MyCatCookies.java
License:Open Source License
public static boolean areInterfaceMeasuresSaved() { if (((Cookies.getCookie(CookiesNamespace.TA_TEXTAREA_WIDTH) != null) || !(Cookies.getCookie(CookiesNamespace.TA_TEXTAREA_WIDTH).equalsIgnoreCase("null"))) && ((Cookies.getCookie(CookiesNamespace.TA_TEXTAREA_HEIGHT) != null) || !(Cookies.getCookie(CookiesNamespace.TA_TEXTAREA_HEIGHT).equalsIgnoreCase("null"))) && ((Cookies.getCookie(CookiesNamespace.QD_HTMLAREA_HEIGHT) != null) || !(Cookies.getCookie(CookiesNamespace.QD_HTMLAREA_HEIGHT).equalsIgnoreCase("null"))) && ((Cookies.getCookie(CookiesNamespace.QD_TEXTAREA_HEIGHT) != null) || !(Cookies.getCookie(CookiesNamespace.QD_TEXTAREA_HEIGHT).equalsIgnoreCase("null"))) && ((Cookies.getCookie(CookiesNamespace.DOC_LIST_WIDTH) != null) || !(Cookies.getCookie(CookiesNamespace.DOC_LIST_WIDTH).equalsIgnoreCase("null"))) && ((Cookies.getCookie(CookiesNamespace.DOC_LIST_HEIGHT) != null) || !(Cookies.getCookie(CookiesNamespace.DOC_LIST_HEIGHT).equalsIgnoreCase("null"))) && ((Cookies.getCookie(CookiesNamespace.QD_DOC_LIST_HEIGHT) != null) || !(Cookies.getCookie(CookiesNamespace.QD_DOC_LIST_HEIGHT).equalsIgnoreCase("null")))) { return true; }//from w w w . j a va 2 s . c om return false; }