當前位置: 首頁>>代碼示例>>Java>>正文


Java Cookies類代碼示例

本文整理匯總了Java中com.google.gwt.user.client.Cookies的典型用法代碼示例。如果您正苦於以下問題:Java Cookies類的具體用法?Java Cookies怎麽用?Java Cookies使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Cookies類屬於com.google.gwt.user.client包,在下文中一共展示了Cookies類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: save

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private void save() {
	String cookie = 
		(iType == null ? "" : iType.name()) + ":" +
		(iMode == null ? "" : iMode.name()) + ":" +
		(iPercent ? "T": "F") + ":" +
		(iRulesPercent ? "T" : "F") + ":" +
		(iRulesShowLastLike ? "T" : "F") + ":" +
		(iCourseDetails ? "T": "F") + ":" +
		iCurMode.toString() + ":" +
		(iShowLast ? "T" : "F") + ":" +
		(iShowProjected ? "T" : "F") + ":" +
		(iShowExpected ? "T" : "F") + ":" +
		(iShowEnrolled ? "T" : "F") + ":" +
		(iShowRequested ? "T" : "F") + ":" + 
		(iShowSnapshotExpected ? "T" : "F") + ":" +
		(iShowSnapshotProjected ? "T" : "F") + ":" +
		iSortBy;
		;
	Cookies.setCookie("UniTime:Curriculum", cookie);
}
 
開發者ID:UniTime,項目名稱:unitime,代碼行數:21,代碼來源:CurriculumCookie.java

示例2: InstructorCookie

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private InstructorCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Instructor");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iSortAttributesBy = Integer.valueOf(params[idx++]);
			iSortInstructorsBy = Integer.valueOf(params[idx++]);
			iSortTeachingRequestsBy = new int[] {Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++])};
			iTeachingRequestsColumns = new int[] {Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++]), Integer.valueOf(params[idx++])};
			iSortTeachingAssignmentsBy = Integer.valueOf(params[idx++]);
			iTeachingAssignmentsColumns = Integer.valueOf(params[idx++]);
			iAssignmentChangesBase = Integer.valueOf(params[idx++]);
			iSortAssignmentChangesBy = Integer.valueOf(params[idx++]);
			iAssignmentChangesColumns = Integer.valueOf(params[idx++]);
			iShowTeachingRequests = "T".equals(params[idx++]);
			iShowTeachingAssignments = "T".equals(params[idx++]);
			iQuery = new String[] {params[idx++], params[idx++], params[idx++]};
		}
	} catch (Exception e) {
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:InstructorCookie.java

示例3: CurriculumCookie

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private CurriculumCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Curriculum");
		if (cookie != null && cookie.length() > 0) {
			String[] values = cookie.split(":");
			iType = CourseCurriculaTable.Type.valueOf(values[0]);
			iMode = CurriculaCourses.Mode.valueOf(values[1]);
			iPercent = "T".equals(values[2]);
			iRulesPercent = "T".equals(values[3]);
			iRulesShowLastLike = "T".equals(values[4]);
			iCourseDetails = "T".equals(values[5]);
			iCurMode.fromString(values[6]);
			iShowLast = !"F".equals(values[7]);
			iShowProjected = !"F".equals(values[8]);
			iShowExpected = !"F".equals(values[9]);
			iShowEnrolled = !"F".equals(values[10]);
			iShowRequested = "T".equals(values[11]);
			iShowSnapshotExpected = !"T".equals(values[12]);
			iShowSnapshotProjected = !"T".equals(values[13]);
			iSortBy = Integer.parseInt(values[14]);
		}
	} catch (Exception e) {
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:25,代碼來源:CurriculumCookie.java

示例4: SolverCookie

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private SolverCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Solver");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iLogLevel = Integer.valueOf(params[idx++]);
			iTimeGridFilter = "1".equals(params[idx++]);
			iAssignedClassesFilter = "1".equals(params[idx++]);
			iAssignedClassesSort = Integer.parseInt(params[idx++]);
			iNotAssignedClassesFilter = "1".equals(params[idx++]);
			iNotAssignedClassesSort = Integer.parseInt(params[idx++]);
		}
	} catch (Exception e) {
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:17,代碼來源:SolverCookie.java

示例5: EventCookie

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private EventCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Event");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iFlags = Integer.parseInt(params[idx++]);
			iShowDeltedMeetings = "T".equals(params[idx++]);
			iSortRoomsBy = Integer.valueOf(params[idx++]);
			iRoomsHorizontal = !"F".equals(params[idx++]);
			iExpandRoomConflicts = "T".equals(params[idx++]);
			iAutomaticallyApproveNewMeetings = "T".equals(params[idx++]);
			iHideDuplicitiesForMeetings = "T".equals(params[idx++]);
			while (idx < params.length) {
				String hash = params[idx++];
				int colon = hash.indexOf(':');
				iHash.put(hash.substring(0, colon), hash.substring(colon + 1));
			}
		}
	} catch (Exception e) {
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:EventCookie.java

示例6: SectioningStatusCookie

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private SectioningStatusCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:StudentStatus");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iOnlineTab = Integer.parseInt(params[idx++]);
			iOnlineQuery = params[idx++];
			iBashTab = Integer.parseInt(params[idx++]);
			iBashQuery = params[idx++];
			for (int i = 0; i < iSortBy.length; i++)
				iSortBy[i] = Integer.parseInt(params[idx++]);
		}
	} catch (Exception e) {
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:17,代碼來源:SectioningStatusCookie.java

示例7: saveState

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
public void saveState() {
	List<String> nodes = new ArrayList<String>();
	nodes.add(iStackPanel.getStackText(iStackPanel.getSelectedIndex()));
	for (int i = 0; i < iStackPanel.getWidgetCount(); i++) {
		if (iStackPanel.getWidget(i) instanceof Tree) {
			Tree t = (Tree)iStackPanel.getWidget(i);
			for (int j = 0; j < t.getItemCount(); j++) {
				openedNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
			}
		}
	}
	String sideBarCookie = "";
	for (String node: nodes) {
		if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
		sideBarCookie += node;
	}
	Cookies.setCookie("UniTime:MobileMenu", sideBarCookie);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:19,代碼來源:UniTimeMobileMenu.java

示例8: restoreState

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
public void restoreState() {
	Set<String> nodes = new HashSet<String>();
	String sideBarCookie = Cookies.getCookie("UniTime:MobileMenu");
	if (sideBarCookie != null)
		for (String node: sideBarCookie.split("\\|"))
			nodes.add(node);
	for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
		if (nodes.contains(iStackPanel.getStackText(i))) {
			iStackPanel.showStack(i);
		}
		if (iStackPanel.getWidget(i) instanceof Tree) {
			Tree t = (Tree)iStackPanel.getWidget(i);
			for (int j = 0; j < t.getItemCount(); j++) {
				openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
			}
		}
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:19,代碼來源:UniTimeMobileMenu.java

示例9: restoreState

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
public void restoreState() {
	Set<String> nodes = new HashSet<String>();
	String sideBarCookie = Cookies.getCookie("UniTime:SideBar");
	if (sideBarCookie != null)
		for (String node: sideBarCookie.split("\\|"))
			nodes.add(node);
	iDisclosurePanel.setOpen(nodes.contains("Root") || sideBarCookie == null);
	if (iUseStackPanel)
		for (int i = 0 ; i < iStackPanel.getWidgetCount(); i++) {
			if (nodes.contains(iStackPanel.getStackText(i))) {
				iStackPanel.showStack(i);
			}
			if (iStackPanel.getWidget(i) instanceof Tree) {
				Tree t = (Tree)iStackPanel.getWidget(i);
				for (int j = 0; j < t.getItemCount(); j++) {
					openNodes(nodes, t.getItem(j), iStackPanel.getStackText(i));
				}
			}
		}
	else
		for (int i = 0; i < iTree.getItemCount(); i++) {
			openNodes(nodes, iTree.getItem(i), null);
		}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:25,代碼來源:UniTimeSideBar.java

示例10: setData

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private void setData(String dataName, String data) {
	String oldData = getObjectString(dataName);
	if (oldData == null || !data.equals(oldData)) {
		String dataNamePath = buildPathString(dataName);
		try {
			if (dataStore != null) {
				dataStore.removeItem(dataNamePath);
				dataStore.setItem(dataNamePath, data);
			} else {
				Cookies.setCookie(dataNamePath, data, new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 365 * 100)));
			}
		} catch (Exception e) {}
		HandlerManager eventBus = ConsoleUnitEventManager.getInstance().getEventBus();
		BindingDataChangeEvent event = new BindingDataChangeEvent(dataName);
		eventBus.fireEvent(event);
	}
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:18,代碼來源:LocalDataServiceImpl.java

示例11: getData

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
private String getData(String dataName) {
	if (dataName == null || dataName.equals("")) return "";
	
	dataName = buildPathString(dataName);
	String data = null;
	try {
		if (dataStore != null) {
			data = dataStore.getItem(dataName);
		} else {
			data = Cookies.getCookie(dataName);
		}
	} catch (Exception e) {}

	if (data == null || data.equals("null")) {
		data = "";
	}
	return data;
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:19,代碼來源:LocalDataServiceImpl.java

示例12: getRealmInfo

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
public RealmSecurityInfo getRealmInfo() {
  if (realmInfo == null) {
    GWT.log("AggregateUI.getRealmInfo: realmInfo is null");
  }
  if (lastRealmInfoUpdateAttemptTimestamp + RefreshTimer.SECURITY_REFRESH_INTERVAL < System
      .currentTimeMillis()) {
    // record the attempt
    lastRealmInfoUpdateAttemptTimestamp = System.currentTimeMillis();
    GWT.log("AggregateUI.getRealmInfo: triggering refresh of realmInfo");
    SecureGWT.getSecurityService().getRealmInfo(Cookies.getCookie("JSESSIONID"),
        new AsyncCallback<RealmSecurityInfo>() {

          @Override
          public void onFailure(Throwable caught) {
            reportError(caught);
          }

          @Override
          public void onSuccess(RealmSecurityInfo result) {
            realmInfo = result;
            updateNotSecureInfo();
          }
        });
  }
  return realmInfo;
}
 
開發者ID:opendatakit,項目名稱:aggregate,代碼行數:27,代碼來源:AggregateUI.java

示例13: setColor

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
public static void setColor(Color color, Color darkerColor, Color lighterColor) {
    final long DURATION = 1000 * 60 * 60 * 24 * 14; //duration remembering login - 2 weeks
    Date expires = new Date(System.currentTimeMillis() + DURATION);
    Cookies.setCookie(COLOR, color.getCssName(), expires, null, "/", false);

    for (MaterialWidget w : map.keySet()) {
        switch (map.get(w)) {
            case REGULAR_SHADE:
                w.setBackgroundColor(color);
                break;
            case DARKER_SHADE:
                w.setBackgroundColor(darkerColor);
                break;
            case LIGHTER_SHADE:
                w.setBackgroundColor(lighterColor);
                break;
            default:
                break;
        }
    }
}
 
開發者ID:GwtMaterialDesign,項目名稱:gwt-material-demo,代碼行數:22,代碼來源:ThemeManager.java

示例14: doFinish

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
@Override
protected void doFinish(RequestBuilder rb) {
    super.doFinish(rb);

    if (checkUserInfo) {
        String userToken = Cookies.getCookie(LoginManagerImpl.COOKIE_USER_KEY);
        userToken = userToken == null ? "" : userToken.replaceAll("\"", "");
        String user = userToken.contains("/") ? userToken.split("/", 2)[1] : null;
        LoginManager loginManager= Application.getInstance().getLoginManager();
        if (user != null && loginManager!=null && loginManager.getLoginInfo()!=null) {
            if (!loginManager.getLoginInfo().getLoginName().equals(user)) {
                loginManager.refreshUserInfo(true);
            }
        }
    }
}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:17,代碼來源:ServiceLocator.java

示例15: submitDownloadUrl

import com.google.gwt.user.client.Cookies; //導入依賴的package包/類
/**
 *
 * @param url
 * @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");
    }
}
 
開發者ID:lsst,項目名稱:firefly,代碼行數:32,代碼來源:GwtUtil.java


注:本文中的com.google.gwt.user.client.Cookies類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。