Java 类com.google.gwt.user.client.Cookies 实例源码

项目:unitimes    文件:InstructorCookie.java   
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) {
    }
}
项目:unitimes    文件:CurriculumCookie.java   
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) {
    }
}
项目:unitimes    文件:CurriculumCookie.java   
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);
}
项目:unitimes    文件:SolverCookie.java   
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) {
    }
}
项目:unitimes    文件:EventCookie.java   
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) {
    }
}
项目:unitimes    文件:SectioningStatusCookie.java   
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) {
    }
}
项目:unitimes    文件:UniTimeMobileMenu.java   
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);
}
项目:unitimes    文件:UniTimeMobileMenu.java   
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));
            }
        }
    }
}
项目:unitimes    文件:UniTimeSideBar.java   
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);
        }
}
项目:WebConsole    文件:LocalDataServiceImpl.java   
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);
    }
}
项目:WebConsole    文件:LocalDataServiceImpl.java   
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;
}
项目:aggregate    文件:AggregateUI.java   
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;
}
项目:gwt-material-demo    文件:ThemeManager.java   
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;
        }
    }
}
项目:firefly    文件:ServiceLocator.java   
@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);
            }
        }
    }
}
项目:firefly    文件:GwtUtil.java   
/**
 *
 * @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");
    }
}
项目:firefly    文件:Application.java   
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);
    }
}
项目:unitime    文件:InstructorCookie.java   
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) {
    }
}
项目:unitime    文件:CurriculumCookie.java   
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) {
    }
}
项目:unitime    文件:CurriculumCookie.java   
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);
}
项目:unitime    文件:SolverCookie.java   
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) {
    }
}
项目:unitime    文件:EventCookie.java   
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) {
    }
}
项目:unitime    文件:SectioningStatusCookie.java   
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) {
    }
}
项目:unitime    文件:UniTimeMobileMenu.java   
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);
}
项目:unitime    文件:UniTimeMobileMenu.java   
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));
            }
        }
    }
}
项目:unitime    文件:UniTimeSideBar.java   
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);
        }
}
项目:appformer    文件:MenuAuthorizationTest.java   
@Override
protected void gwtSetUp() throws Exception {
    MarshallerFramework.initializeDefaultSessionProvider();

    // because UberFire uses @Inject User, the only way we can set the current user is by putting this
    // cookie in place before the GWT modules get bootstrapped (so before super.gwtSetUp())
    Collection<? extends Role> roles = Arrays.asList(new RoleImpl("admin"));
    admin = new UserImpl("admin",
                         roles);
    Cookies.setCookie(UserCookieEncoder.USER_COOKIE_NAME,
                      UserCookieEncoder.toCookieValue(admin));

    super.gwtSetUp();
    placeManager = IOC.getBeanManager().lookupBean(PlaceManager.class).getInstance();
    securityContext = IOC.getBeanManager().lookupBean(SecurityContext.class).getInstance();
}
项目:mvp4g-examples    文件:LoginPresenter.java   
@Override
public void bindView() {
    view.getLoginButton().addClickHandler( new ClickHandler() {

        public void onClick( ClickEvent event ) {
            String username = view.getUserName().getValue();
            if ( ( username == null ) || ( username.length() == 0 ) ) {
                eventBus.displayMessage( "Please enter your username" );
            } else {
                Cookies.setCookie( Constants.USERNAME, username );
                eventBus.login( username );
                eventBus.displayMessage( "" );
            }
        }

    } );
}
项目:EasyML    文件:AccountLoader.java   
/**
 * 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();
        }
    });
}
项目:EasyML    文件:AccountLoader.java   
/**
 * 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();                               
            }
        }

    });
}
项目:unitimes    文件:InstructorCookie.java   
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);
}
项目:unitimes    文件:RoomNoteChanges.java   
private LastChangesCookie() {
    try {
        String cookie = Cookies.getCookie("UniTime:LastChanges");
        if (cookie != null && cookie.length() > 0) {
            String[] values = cookie.split(":");
            iShowDetails = "T".equals(values[0]);
            iSortColumn = Integer.parseInt(values[1]);
            iSortOrder = "T".equals(values[2]);
            iMultiSession = "T".equals(values[3]);
        }
    } catch (Exception e) {
    }
}
项目:unitimes    文件:RoomCookie.java   
private RoomCookie() {
    iFlags = new int[RoomsPageMode.values().length];
    iHash = new String[RoomsPageMode.values().length];
    for (int i = 0; i < iFlags.length; i++) {
        iFlags[i] = 0;
        iHash[i] = "";
    }
    try {
        String cookie = Cookies.getCookie("UniTime:Room");
        if (cookie != null) {
            String[] params = cookie.split("\\|");
            int idx = 0;
            iSortRoomsBy = Integer.valueOf(params[idx++]);
            iSortRoomGroupsBy = Integer.valueOf(params[idx++]);
            iSortRoomFeaturesBy = Integer.valueOf(params[idx++]);
            setOrientation(params[idx++]);
            iDeptMode = Integer.valueOf(params[idx++]);
            for (int i = 0; i < iFlags.length; i++) {
                iFlags[i] = Integer.parseInt(params[idx++]);
                iHash[i] = params[idx++];
            }
            while (idx < params.length) {
                String[] x = params[idx++].split(":");
                iFutures.put(Long.valueOf(x[0]), new Integer(x[1]));
            }
        }
    } catch (Exception e) {
    }
}
项目:unitimes    文件:RoomCookie.java   
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);
}
项目:unitimes    文件:SolverCookie.java   
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);
}
项目:unitimes    文件:CourseFinderCourses.java   
private void selectLastTab() {
    try {
        int tab = Integer.valueOf(Cookies.getCookie("UniTime:CourseFinderCourses"));
        if (tab >= 0 || tab < iCourseDetailsTabBar.getTabCount() && tab != iCourseDetailsTabBar.getSelectedTab())
            iCourseDetailsTabBar.selectTab(tab, true);
        else
            iCourseDetailsTabBar.selectTab(0, true);
    } catch (Exception e) {
        iCourseDetailsTabBar.selectTab(0, true);
    }
}
项目:unitimes    文件:EventCookie.java   
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);
}
项目:unitimes    文件:DegreePlanDialog.java   
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);
    }
}
项目:unitimes    文件:SectioningCookie.java   
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];
        }
    } catch (Exception e) {
    }
}
项目:unitimes    文件:SectioningStatusCookie.java   
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);
}
项目:unitimes    文件:UniTimeSideBar.java   
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();
}