本文整理匯總了Java中com.google.gwt.user.client.Cookies.setCookie方法的典型用法代碼示例。如果您正苦於以下問題:Java Cookies.setCookie方法的具體用法?Java Cookies.setCookie怎麽用?Java Cookies.setCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.Cookies
的用法示例。
在下文中一共展示了Cookies.setCookie方法的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);
}
示例2: 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);
}
示例3: 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);
}
}
示例4: gotoUrl
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
public void gotoUrl(String url, boolean saveSearchPage) {
if (doSaveState) {
doSaveState = false;
RequestHandler.Context context = saveSearchPage ? RequestHandler.Context.INCL_SEARCH : RequestHandler.Context.PAGE;
String cState = null;
try {
cState = Application.getInstance().getRequestHandler().getStateInfo(context);
} catch (Exception e) {
GWT.log("error retrieving state info", e);
}
if (cState != null) {
Cookies.setCookie(PRIOR_STATE, cState);
}
}
if (url != null) {
Window.Location.assign(url);
}
}
示例5: save
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
String cookie = iSortAttributesBy + "|" + iSortInstructorsBy +
"|" + iSortTeachingRequestsBy[0] + "|" + iSortTeachingRequestsBy[1] + "|" + iSortTeachingRequestsBy[2] +
"|" + iTeachingRequestsColumns[0] + "|" + iTeachingRequestsColumns[1] + "|" + iTeachingRequestsColumns[2] +
"|" + iSortTeachingAssignmentsBy + "|" + iTeachingAssignmentsColumns +
"|" + iAssignmentChangesBase + "|" + iSortAssignmentChangesBy + "|" + iAssignmentChangesColumns +
"|" + (iShowTeachingRequests ? "T" : "F") +
"|" + (iShowTeachingAssignments ? "T" : "F") +
"|" + (iQuery[0] == null ? "" : iQuery[0]) + "|" + (iQuery[1] == null ? "" : iQuery[1]) + "|" + (iQuery[2] == null ? "" : iQuery[2]);
Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
Cookies.setCookie("UniTime:Instructor", cookie, expires);
}
示例6: save
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
String cookie = iSortRoomsBy + "|" + iSortRoomGroupsBy + "|" + iSortRoomFeaturesBy + "|" + getOrientation() + "|" + iDeptMode;
for (int i = 0; i < iFlags.length; i++) {
cookie += "|" + iFlags[i] + "|" + (iHash[i] == null ? "" : iHash[i]);
}
for (Map.Entry<Long, Integer> e: iFutures.entrySet()) {
cookie += "|" + e.getKey() + ":" + e.getValue();
}
Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
Cookies.setCookie("UniTime:Room", cookie, expires);
}
示例7: save
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
String cookie = iLogLevel + "|" + (iTimeGridFilter ? "1" : "0")
+ "|" + (iAssignedClassesFilter ? "1" : "0") + "|" + iAssignedClassesSort
+ "|" + (iNotAssignedClassesFilter ? "1" : "0") + "|" + iNotAssignedClassesSort;
Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
Cookies.setCookie("UniTime:Solver", cookie, expires);
}
示例8: save
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
String cookie = String.valueOf(iFlags) +
"|" + (iShowDeltedMeetings ? "T": "F") +
"|" + iSortRoomsBy +
"|" + (iRoomsHorizontal ? "T" : "F") +
"|" + (iExpandRoomConflicts ? "T" : "F") +
"|" + (iAutomaticallyApproveNewMeetings ? "T": "F") +
"|" + (iHideDuplicitiesForMeetings ? "T" : "F");
for (Map.Entry<String, String> entry: iHash.entrySet())
cookie += "|" + entry.getKey() + ":" + entry.getValue();
Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
Cookies.setCookie("UniTime:Event", cookie, expires);
}
示例9: save
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
String cookie = iOnlineTab + "|" + iOnlineQuery + "|" + iBashTab + "|" + iBashQuery;
for (int i = 0; i < iSortBy.length; i++)
cookie += "|" + iSortBy[i];
Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
Cookies.setCookie("UniTime:StudentStatus", cookie, expires);
}
示例10: saveState
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
public void saveState() {
List<String> nodes = new ArrayList<String>();
if (iUseStackPanel) {
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));
}
}
}
} else {
for (int i = 0; i < iTree.getItemCount(); i++) {
openedNodes(nodes, iTree.getItem(i), null);
}
}
String sideBarCookie = "";
if (iDisclosurePanel.isOpen()) sideBarCookie += "Root";
for (String node: nodes) {
if (!sideBarCookie.isEmpty()) sideBarCookie += "|";
sideBarCookie += node;
}
sideBarCookie += "|W:" + iPanel.getElement().getClientWidth();
Cookies.setCookie("UniTime:SideBar", sideBarCookie);
resizeWideTables();
}
示例11: setCookieValue
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
/**
* Sets a cookie value with an expiry date a year from now.
* @param key The name of the cookie to set.
* @param value The new value for the cookie.
*/
@SuppressWarnings("deprecation") // Calendar not supported by GWT
public static void setCookieValue(String key, String value) {
// Only set the cookie value if it is changing:
if (value.equals(Cookies.getCookie(key))) {
return;
}
// Set the cookie to expire in one year
Date d = new Date();
d.setYear(d.getYear() + 1);
Cookies.setCookie(key, value, d);
}
示例12: storeToCookies
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private static void storeToCookies( ) {
if( ( userLoginName != null ) && ( userSessionId != null ) &&
( userProfileType != MainUserData.UNKNOWN_USER_TYPE ) &&
( userID != UserData.UNKNOWN_UID ) ) {
Cookies.setCookie( USER_LOGIN_COOKIE_NAME, userLoginName );
Cookies.setCookie( USER_SESSION_COOKIE_NAME, userSessionId );
Cookies.setCookie( USER_ID_COOKIE_NAME, (new Integer(userID)).toString() );
Cookies.setCookie( USER_PROFILE_TYPE_COOKIE_NAME, (new Integer(userProfileType)).toString() );
}
}
示例13: createAsyncResponse
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
/**
* @param input
* @return
*/
private AsyncCallback<LoginResponse> createAsyncResponse (
final LoginRequest input) {
return new AsyncCallback<LoginResponse>() {
@Override
public void onSuccess (LoginResponse result) {
if (result.status == StatusType.StatusTypeSuccess
&& result.session != null) {
session = result.session;
Cookies.setCookie(COOKIE_KEY_ID, session.id.toString(),
DateTimeHelper
.millisFromNow(DateTimeHelper.MILLIS_PER_DAY
* 365L * 20L));
if (user() != null && user().lastLoggedIn == null) {
user().lastLoggedIn = new Date();
}
}
DefaultEventBus.get().fireEventFromSource(
new LoginSuccess(input, result),
SessionController.this);
}
@Override
public void onFailure (Throwable caught) {
DefaultEventBus.get().fireEventFromSource(
new LoginFailure(input, caught),
SessionController.this);
}
};
}
示例14: save
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
private void save() {
String cookie = (iShowDetails ? "T": "F") + ":" + iSortColumn + ":" + (iSortOrder ? "T": "F") + ":" + (iMultiSession ? "T" : "F");
Cookies.setCookie("UniTime:LastChanges", cookie);
}
示例15: onSuccess
import com.google.gwt.user.client.Cookies; //導入方法依賴的package包/類
@Override
public void onSuccess(ServerTimeZoneResponse result) {
sServerTimeZone = TimeZone.createTimeZone(result.toJsonString());
Cookies.setCookie("UniTime:ServerTimeZone", result.toJsonString());
}