com.google.gwt.user.client.Cookies Java Examples

The following examples show how to use com.google.gwt.user.client.Cookies. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SolverCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private void save() {
	String cookie = iLogLevel + "|" + (iTimeGridFilter ? "1" : "0")
			+ "|" + (iAssignedClassesFilter ? "1" : "0") + "|" + iAssignedClassesSort
			+ "|" + (iNotAssignedClassesFilter ? "1" : "0") + "|" + iNotAssignedClassesSort
			+ "|" + iSelectedAssignmentsSort + "|" + iConflictingAssignmentsSort
			+ "|" + iSuggestionsSort + "|" + iPlacementsSort
			+ "|" + (iShowSuggestions ? "1" : "0")
			+ "|" + (iShowConflicts ? "1" : "0") + "|" + iConflictsSort
			+ "|" + (iShowAllStudentConflicts ? "1" : "0") + "|" + (iShowAllDistributionConflicts ? "1" : "0")
			+ "|" + (iShowCBS ? "1" : "0") + "|" + (iShowCBSFilter ? "1" : "0")
			+ "|" + (iSolutionChangesFilter ? "1" : "0") + "|" + iSolutionChangesSort
			+ "|" + (iAssignmentHistoryFilter ? "1" : "0") + "|" + iAssignmentHistorySort
			+ "|" + iListSolutionsSort
			+ "|" + (iSuggestionsFilter == null ? "" : iSuggestionsFilter);
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:Solver", cookie, expires);
}
 
Example #2
Source File: SectioningStatusCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
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++]);
			iStudentTab = Integer.parseInt(params[idx++]);
			iSortByGroup[0] = params[idx++];
			iSortByGroup[1] = params[idx++];
			iEmailIncludeCourseRequests = "1".equals(params[idx++]);
			iEmailIncludeClassSchedule = "1".equals(params[idx++]);
			iEmailCC = params[idx++];
			iEmailSubject = params[idx++];
			iEmailAdvisorRequests = "1".equals(params[idx++]);
			iAdvisorRequestsEmailStudent = "1".equals(params[idx++]);
			iOptionalEmailToggle = parseBoolean(params[idx++]);
		}
	} catch (Exception e) {
	}
}
 
Example #3
Source File: SectioningCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
private SectioningCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Sectioning");
		if (cookie != null && cookie.length() > 0) {
			String[] values = cookie.split(":");
			iCourseDetails = "T".equals(values[0]);
			iShowClassNumbers = "T".equals(values.length >= 2 ? values[1] : "F");
			iRelatedSortBy = Integer.parseInt(values[2]);
			iEnrollmentFilter = EnrollmentFilter.values()[Integer.parseInt(values[3])];
			iEnrollmentSortBy = Integer.parseInt(values[4]);
			iEnrollmentSortBySubpart = values[5];
			iAllChoices = "T".equals(values[6]);
			iShowAllChanges = "T".equals(values[7]);
			iRequestOverridesOpened = "T".equals(values[8]);
			iSolutionsSortBy = Integer.parseInt(values[9]);
			iEnrollmentSortByGroup = values[10];
		}
	} catch (Exception e) {
	}
}
 
Example #4
Source File: CurriculumCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: CurriculumCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
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) {
	}
}
 
Example #6
Source File: UniTimeMobileMenu.java    From unitime with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: UniTimeMobileMenu.java    From unitime with Apache License 2.0 6 votes vote down vote up
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));
			}
		}
	}
}
 
Example #8
Source File: InstructorCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
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) {
	}
}
 
Example #9
Source File: UniTimeSideBar.java    From unitime with Apache License 2.0 6 votes vote down vote up
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);
		}
}
 
Example #10
Source File: WaveWebSocketClient.java    From swellrt with Apache License 2.0 6 votes vote down vote up
@Override
public void onConnect() {
  connected = ConnectState.CONNECTED;
  connectedAtLeastOnce = true;

  // Sends the session cookie to the server via an RPC to work around browser bugs.
  // See: http://code.google.com/p/wave-protocol/issues/detail?id=119
  String token = Cookies.getCookie(JETTY_SESSION_TOKEN_NAME);
  if (token != null) {
    ProtocolAuthenticateJsoImpl auth = ProtocolAuthenticateJsoImpl.create();
    auth.setToken(token);
    send(MessageWrapper.create(sequenceNo++, "ProtocolAuthenticate", auth));
  }

  // Flush queued messages.
  while (!messages.isEmpty() && connected == ConnectState.CONNECTED) {
    send(messages.poll());
  }

  ClientEvents.get().fireEvent(new NetworkStatusEvent(ConnectionStatus.CONNECTED));
}
 
Example #11
Source File: ThemeManager.java    From gwt-material-demo with Apache License 2.0 6 votes vote down vote up
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;
        }
    }
}
 
Example #12
Source File: WaveWebSocketClient.java    From incubator-retired-wave with Apache License 2.0 6 votes vote down vote up
@Override
public void onConnect() {
  connected = ConnectState.CONNECTED;
  connectedAtLeastOnce = true;

  // Sends the session cookie to the server via an RPC to work around browser bugs.
  // See: http://code.google.com/p/wave-protocol/issues/detail?id=119
  String token = Cookies.getCookie(JETTY_SESSION_TOKEN_NAME);
  if (token != null) {
    ProtocolAuthenticateJsoImpl auth = ProtocolAuthenticateJsoImpl.create();
    auth.setToken(token);
    send(MessageWrapper.create(sequenceNo++, "ProtocolAuthenticate", auth));
  }

  // Flush queued messages.
  while (!messages.isEmpty() && connected == ConnectState.CONNECTED) {
    send(messages.poll());
  }

  ClientEvents.get().fireEvent(new NetworkStatusEvent(ConnectionStatus.CONNECTED));
}
 
Example #13
Source File: EventCookie.java    From unitime with Apache License 2.0 6 votes vote down vote up
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) {
	}
}
 
Example #14
Source File: Html5ApplicationCache.java    From gwt-appcache with Apache License 2.0 6 votes vote down vote up
@Override
public boolean removeCache()
{
  Cookies.setCookie( DISABLE_MANIFEST_COOKIE_NAME, DISABLE_MANIFEST_COOKIE_VALUE );

  // Register handlers for every terminal event so we can ensure that we remove the cookie.
  // All of these may be required due to; network failure, intermediate cache not passing
  // back to server, overlapping requests etc.
  final ArrayList<HandlerRegistration> registrations = new ArrayList<>();
  registrations.add( addErrorHandler( e -> cacheRemovalCleanup( registrations ) ) );
  registrations.add( addObsoleteHandler( e -> cacheRemovalCleanup( registrations ) ) );
  registrations.add( addNoUpdateHandler( e -> cacheRemovalCleanup( registrations ) ) );
  registrations.add( addUpdateReadyHandler( e -> cacheRemovalCleanup( registrations ) ) );
  registrations.add( addCachedHandler( e -> cacheRemovalCleanup( registrations ) ) );
  try
  {
    update0();
    return true;
  }
  catch ( final Throwable t )
  {
    cacheRemovalCleanup( registrations );
    return false;
  }
}
 
Example #15
Source File: GwtCookieModel.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public GwtCookieModel(boolean refresh) {
  listeners = new Listeners();
  cookies = new HashMap<String, String>();
  for (String name : Cookies.getCookieNames()) {
    cookies.put(name, Cookies.getCookie(name));
  }
  if (refresh) {
    refresher = new Timer() {
      @Override
      public void run() {
        refresh();
      }
    };
    refresher.scheduleRepeating(REFRESH_TIME);
  }
}
 
Example #16
Source File: FilterBox.java    From unitime with Apache License 2.0 5 votes vote down vote up
private void save() {
	String cookie = "";
	for (String cmd: iCommands)
		cookie += (cookie.isEmpty() ? "" : "|") + cmd;
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:FilterCarrots", cookie, expires);
}
 
Example #17
Source File: EventCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #18
Source File: DegreePlanDialog.java    From unitime with Apache License 2.0 5 votes vote down vote up
private void selectLastTab() {
	try {
		int tab = Integer.valueOf(Cookies.getCookie("UniTime:CourseFinderCourses"));
		if (tab >= 0 || tab < iCourseDetailsTabPanel.getTabCount() && tab != iCourseDetailsTabPanel.getSelectedTab())
			iCourseDetailsTabPanel.selectTab(tab);
		else
			iCourseDetailsTabPanel.selectTab(0);
	} catch (Exception e) {
		iCourseDetailsTabPanel.selectTab(0);
	}
}
 
Example #19
Source File: CookiesManager.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Removes the cookies used to handle the login
 */
public static void removeLogin() {
	try {
		removeSid();
		Cookies.removeCookie(COOKIE_FAILURE);
	} catch (Throwable t) {

	}
}
 
Example #20
Source File: SectioningCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private void save() {
	String cookie = 
		(iCourseDetails ? "T": "F") + ":" +
		(iShowClassNumbers ? "T": "F") + ":" + iRelatedSortBy + ":" + iEnrollmentFilter.ordinal() + ":" + iEnrollmentSortBy + ":" + iEnrollmentSortBySubpart +
		":" + (iAllChoices ? "T" : "F") + 
		":" + (iShowAllChanges ? "T" : "F") + ":" + (iRequestOverridesOpened ? "T" : "F") + ":" + iSolutionsSortBy + ":" + iEnrollmentSortByGroup;
	Cookies.setCookie("UniTime:Sectioning", cookie);
}
 
Example #21
Source File: SectioningStatusCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private void save() {
	String cookie = iOnlineTab + "|" + iOnlineQuery + "|" + iBashTab + "|" + iBashQuery;
	for (int i = 0; i < iSortBy.length; i++)
		cookie += "|" + iSortBy[i];
	cookie += "|" + iStudentTab;
	cookie += "|" + iSortByGroup[0] + "|" + iSortByGroup[1];
	cookie += "|" + (iEmailIncludeCourseRequests ? "1" : "0") + "|" + (iEmailIncludeClassSchedule ? "1" : "0")
			+ "|" + (iEmailCC == null ? "" : iEmailCC) + "|" + (iEmailSubject == null ? "" : iEmailSubject)
			+ "|" + (iEmailAdvisorRequests ? "1" : "0") + "|" + (iAdvisorRequestsEmailStudent ? "1" : "0")
			+ "|" + (iOptionalEmailToggle == null ? "N" : iOptionalEmailToggle.booleanValue() ? "1" : "0");
	Date expires = new Date(new Date().getTime() + 604800000l); // expires in 7 days
	Cookies.setCookie("UniTime:StudentStatus", cookie, expires);
}
 
Example #22
Source File: UniTimeSideBar.java    From unitime with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #23
Source File: ReservationCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private ReservationCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Reservations");
		if (cookie != null && cookie.length() > 0) {
			String[] values = cookie.split(":");
			iCourseDetails = "T".equals(values[0]);
			iSortBy = Integer.valueOf(values[1]);
		}
	} catch (Exception e) {
	}
}
 
Example #24
Source File: DomLogger.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #25
Source File: DomLogger.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #26
Source File: GwtCookieModel.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setCookie(
    String name, String value, Date expires, String domain, String path, boolean secure) {
  if (value == null) {
    removeCookie(name);
  } else {
    Cookies.setCookie(name, value, expires, domain, path, secure);
    if (cookies.put(name, value) == null) {
      listeners.cookieAdded(name, value);
    } else {
      listeners.cookieChanged(name, value);
    }
  }
}
 
Example #27
Source File: AdminCookie.java    From unitime with Apache License 2.0 5 votes vote down vote up
private AdminCookie() {
	try {
		String cookie = Cookies.getCookie("UniTime:Admin");
		if (cookie != null) {
			String[] params = cookie.split("\\|");
			int idx = 0;
			iSortTasksBy = Integer.valueOf(params[idx++]);
			iSortTaskExecutionsBy = Integer.valueOf(params[idx++]);
		}
	} catch (Exception e) {
	}
}
 
Example #28
Source File: AccountLoader.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Load search result and reset paging control 
 */	
private void searchResult(){
	adminView.getUserPage().clear();					//Clear paging area and reload
	adminView.getUserPage().add(page);
	Account currentAccount = new Account();
	currentAccount.setEmail(Cookies.getCookie("bdaemail"));

	accountService.search(currentAccount, searchAccount, 0, 0, new AsyncCallback<List<Account>>(){

		@Override
		public void onFailure(Throwable caught) {
			// TODO Auto-generated method stub
			searchAlert.setContent(caught.getMessage());
			searchAlert.show();
		}

		@Override
		public void onSuccess(List<Account> result) {
			// TODO Auto-generated method stub
			if(result.size() == 0){
				searchAlert.setContent( Constants.adminUIMsg.searchNoResult() );
				searchAlert.show();
			}else{
				resultSize = result.size();				
				pageSize = (int)Math.ceil((double)result.size()/13);
				lastPage = pageSize;
				currentPage = 1;
				pagination = new Pagination(page, pageSize, Pagination.PageType.LARGE);
				pagination.load();
				reload();								
			}
		}

	});
}
 
Example #29
Source File: AccountLoader.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Initialization
 */
private void init(){
	clearInput();											
	adminView.getUserPage().clear();		
	page.addStyleName("admin-page");
	adminView.getUserPage().add(page);
	currentPage = 1;

	Account currentAccount = new Account();
	currentAccount.setEmail(Cookies.getCookie("bdaemail"));
	accountService.getSize(currentAccount, new AsyncCallback<Integer>(){

		@Override
		public void onFailure(Throwable caught) {
			// TODO Auto-generated method stub
			caught.getMessage();
		}

		@Override
		public void onSuccess(Integer result) {
			// TODO Auto-generated method stub
			//Caculate page-related information, initialize and load paging controls
			resultSize = result;
			pageSize = (int)Math.ceil((double)result/13);
			lastPage = pageSize;
			pagination = new Pagination(page, pageSize, Pagination.PageType.LARGE);
			pagination.load();
			//Load user data
			load();
		}
	});
}
 
Example #30
Source File: CookiesManager.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Removes the cookies that store the session ID
 */
public static void removeSid() {
	try {
		Offline.remove(COOKIE_SID);
		Cookies.removeCookie(COOKIE_SID);
		Cookies.removeCookie(COOKIE_JSESSIONID);
	} catch (Throwable t) {

	}
}