Example usage for com.google.gwt.user.client Cookies getCookie

List of usage examples for com.google.gwt.user.client Cookies getCookie

Introduction

In this page you can find the example usage for com.google.gwt.user.client Cookies getCookie.

Prototype

public static String getCookie(String name) 

Source Link

Document

Gets the cookie associated with the given name.

Usage

From source file:org.clevermore.monitor.client.utils.LocalStorage.java

License:Apache License

public static String readStoredItem(final String key) {
    if (Storage.isSupported()) {
        String item = Storage.getLocalStorageIfSupported().getItem(key);
        item = item == null ? "" : item;
        Log.debug("Returning value:" + item + ", from local storage with key:" + key);
        return item;
    } else {//from w  w  w  .  j  a v  a 2 s .com
        // get from cookies
        String cookie = Cookies.getCookie(key);
        Log.debug("Returning value:" + cookie + ", from cookie with key:" + key);
        return cookie;
    }
}

From source file:org.ebayopensource.turmeric.policy.adminui.client.AppController.java

License:Open Source License

/**
 * Start the application.//ww  w.ja v a  2 s. c  o m
 */
public void start() {
    bind();
    History.addValueChangeHandler(this);
    final HistoryToken token = HistoryToken.newHistoryToken();
    // See if a security cookie has been stored to identify the user
    AppUser user = AppUser.fromCookie(Cookies.getCookie(AppKeyUtil.COOKIE_SESSID_KEY));
    if (user != null) {
        // the user has been identified take them to the last page they were
        // on
        // unless that was not saved
        if (token == null || token.getPresenterId() == null) {
            // no history, default landing page is dashboard
            History.newItem(HistoryToken.newHistoryToken(MenuController.PRESENTER_ID, null).toString());
        }

        History.fireCurrentHistoryState();
    } else {
        // user not identified, go to the "login" page
        PresenterUtil.forceRedirectToPresenter(token, presenters.get(SplashPresenter.SPLASH_ID));
    }
}

From source file:org.ednovo.gooru.application.client.gin.AppClientFactory.java

License:Open Source License

/**
 *
 * @function getUserStatus/*  ww  w. j ava  2s . co m*/
 *
 * @created_date : 26-Dec-2013
 *
 * @description : This method is used to get the current user stauts.
 *
 *
 * @parm(s) : @return
 *
 * @return : String
 *
 * @throws : <Mentioned if any exceptions>
 *
 */
public static String getUserStatus() {
    return Cookies.getCookie(GOORU_ACTIVE_USER);
}

From source file:org.ednovo.gooru.application.client.gin.BasePopupViewWithHandlers.java

License:Open Source License

@Override
public void hide() {
    super.hide();
    String count = Cookies.getCookie("MyCookie");
    String scrollVal = Cookies.getCookie("getScrollTop");
    if (count != null && Integer.parseInt(count) == 7) {

    } else {//ww  w  . j av  a2s  . com
        Document.get().getDocumentElement().getStyle().setProperty("overflow", "");
    }
    if (!StringUtil.isEmpty(scrollVal)
            && AppClientFactory.getCurrentPlaceToken().equalsIgnoreCase(PlaceTokens.SEARCH_COLLECTION)) {
        Window.scrollTo(0, Integer.parseInt(scrollVal));
    }
}

From source file:org.ednovo.gooru.client.gin.BasePopupViewWithHandlers.java

License:Open Source License

@Override
public void hide() {
    super.hide();
    String count = Cookies.getCookie("MyCookie");
    if (count != null && Integer.parseInt(count) == 7) {

    } else {//ww w.java  2  s  . c  o  m
        Document.get().getDocumentElement().getStyle().setProperty("overflow", "");
    }

}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java

License:Open Source License

private void getOldValuesOnRefresh() {
    String sessionOldId = Cookies.getCookie(getCookieKey() + "-assessmentSessionId");
    String oldCollectionDataLogEventId = Cookies.getCookie(getCookieKey() + "-assessmentDataLogEventId");
    String oldCollectionNewDataLogEventId = Cookies.getCookie(getCookieKey() + "-assessmentNewDataLogEventId");
    String oldCollectionStartTime = Cookies.getCookie(getCookieKey() + "-assessmentStartTime");
    String refreshed = Cookies.getCookie(getCookieKey() + "-isAssessmentRefreshed");
    String resStartTime = Cookies.getCookie(getCookieKey() + "-assessmentResourceStartTime");
    collectionActivityEventIdTemp = Cookies.getCookie(getCookieKey() + "-assessmentActivityEventId");
    if (!StringUtil.isEmpty(sessionOldId) && !StringUtil.isEmpty(oldCollectionNewDataLogEventId)) {
        sessionId = sessionOldId;/*  www  .j a  va  2  s .  co m*/
        collectionNewDataLogEventId = oldCollectionNewDataLogEventId;
        collectionDataLogEventId = oldCollectionDataLogEventId;
        collectionStartTime = collectionStartTime.valueOf(oldCollectionStartTime);
        isRefreshed = refreshed;
        isItem_lodRefreshed = refreshed;
        isItem_Refreshed = refreshed;
        resourceStartTime = Long.parseLong(resStartTime);
        removeCookieValues();
    }
}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerPresenter.java

License:Open Source License

/**
 * Calls session activity API once user logged in between playing the player.
 *//*ww  w .  j av a 2s .com*/
private void updateEventLoggingSessionId() {
    String parentGooruOid = null, mode = "collection";
    if (!AppClientFactory.getPlaceManager().getRequestParameter("cid", "").equals("")) {
        parentGooruOid = classpageId;
        mode = "class";
    }
    sessionId = Cookies.getCookie("sessionId") != null ? Cookies.getCookie("sessionId")
            : GwtUUIDGenerator.uuid();

}

From source file:org.ednovo.gooru.client.mvp.assessments.play.collection.AssessmentsPlayerView.java

License:Open Source License

public void showLogoutMessage(boolean hide) {
    String resourcePlayerFirstTimeUser = Cookies.getCookie("lp");
    if (hide) {//from  w w w .  j a v  a  2s .  co m
        if (logOutToolTip != null) {
            logOutToolTip.hide();
        }
    } else {
        if (AppClientFactory.isAnonymous()) {
            if (resourcePlayerFirstTimeUser == null) {
                logOutToolTip = new GlobalTooltipWithButton(i18n.GL1614(), i18n.GL1615(), i18n.GL0543());
                logOutToolTip.getCloseButton().addClickHandler(new StoreCookieHandler());
                logOutToolTip.setGlassStyleName("playerAddToolTipGlassStyle");
                logOutToolTip.setStyleName("");
                logOutToolTip.getElement().getStyle().setZIndex(999999);
                logOutToolTip.getElement().getStyle().clearLeft();
                logOutToolTip.getElement().getStyle().setFloat(Float.RIGHT);
                logOutToolTip.getElement().getStyle().setRight(23, Unit.PCT);
                logOutToolTip.getElement().getStyle().setTop(15, Unit.PX);
                logOutToolTip.show();
            }
        }
    }
}

From source file:org.ednovo.gooru.client.mvp.classpages.studentView.StudentAssignmentView.java

License:Open Source License

@UiHandler("backToEditPanel")
public void onClickHandler(ClickEvent event) {
    //getPreviousPage();
    String pageSize = Cookies.getCookie("pageSize");
    String classpageid = Cookies.getCookie("classpageid");
    String pageNum = Cookies.getCookie("pageNum");
    String pos = Cookies.getCookie("pos");

    if (AppClientFactory.getPlaceManager().getRequestParameter("source").equalsIgnoreCase("T")) {
        //         AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.TEACH);
    } else if (AppClientFactory.getPlaceManager().getRequestParameter("source").equalsIgnoreCase("E")) {

        Map<String, String> params = new HashMap<String, String>();
        params.put("pageSize", pageSize);
        params.put("classpageid", classpageid);
        params.put("pageNum", pageNum);
        params.put("pos", pos);

        AppClientFactory.getPlaceManager().revealPlace(PlaceTokens.EDIT_CLASSPAGE, params, true);
    }//from www  .  j av a 2 s . com
    backToEditPanel.setVisible(false);
}

From source file:org.ednovo.gooru.client.mvp.folder.toc.FolderTocView.java

License:Open Source License

/**
 * This method is used to set folder TOC Data.
 *///from ww w .j a va2  s. co  m
public void setData() {
    Window.scrollTo(0, 0);
    floderTreeContainer.clear();
    floderTreeContainer.add(folderTocTree);
    folderTocTree.addItem(getLoadingImage());
    int windowHeight = Window.getClientHeight() - (177 + 52);
    whiteBgContainer.getElement().setAttribute("style", "min-height:" + windowHeight + "px");
    folderTocTree.addSelectionHandler(new SelectionHandler<TreeItem>() {
        @Override
        public void onSelection(SelectionEvent<TreeItem> event) {
            final TreeItem item = (TreeItem) event.getSelectedItem();
            Widget folderWidget = item.getWidget();
            FolderTreeItem folderTreeItemWidget = null;
            if (folderWidget instanceof FolderTreeItem) {
                folderTreeItemWidget = (FolderTreeItem) folderWidget;
                if (folderTreeItemWidget.isOpen()) {
                    folderTreeItemWidget.removeStyleName(FolderContainerCBundle.INSTANCE.css().open());
                    folderTreeItemWidget.arrowLabel
                            .removeStyleName(FolderContainerCBundle.INSTANCE.css().arrowActive());
                    folderTreeItemWidget.setOpen(false);
                } else {
                    folderTreeItemWidget.addStyleName(FolderContainerCBundle.INSTANCE.css().open());
                    folderTreeItemWidget.arrowLabel
                            .addStyleName(FolderContainerCBundle.INSTANCE.css().arrowActive());
                    folderTreeItemWidget.setOpen(true);
                }
                removePreviousSelectedItem();
                currentFolderSelectedTreeItem = folderTreeItemWidget;
                previousFolderSelectedTreeItem = currentFolderSelectedTreeItem;
                currentFolderSelectedTreeItem.addStyleName(FolderContainerCBundle.INSTANCE.css().selected());
                TreeItem parent = item.getParentItem();
                item.getTree().setSelectedItem(null, false);
                if (!folderTreeItemWidget.isApiCalled()) {
                    folderTreeItemWidget.setApiCalled(true);
                    item.addItem(loadingTreeItem());
                    getFolderItems(item, folderTreeItemWidget.getGooruOid());
                }
                if (parent != null)
                    parent.setSelected(false);
                item.setState(!item.getState(), false);
            }
        }
    });
    btnBackToPrevious.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            String lastAccessedUrl = Cookies.getCookie(BACK2TOC) != null ? Cookies.getCookie(BACK2TOC) : "";
            String[] placeToken = lastAccessedUrl.split("#");
            Map<String, String> params = new HashMap<String, String>();
            if (placeToken.length > 1) {
                AppClientFactory.getPlaceManager().revealPlace(placeToken[0],
                        StringUtil.splitQuery(lastAccessedUrl));
            } else {
                //If we are viewing TOC from library 
                AppClientFactory.getPlaceManager().revealPlace(placeToken[0], params);
            }
        }
    });
    shareTxtBox.addClickHandler(new OnTextBoxClick());
    shareTxtBox.setReadOnly(true);
}