Project

General

Profile

« Previous | Next » 

Revision 35582

Changed the way we handle the history items and I know keep the current and previous token so that when needed I can go back to where I previously was.

View differences:

modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/UserInfoElement.java
3 3
import com.google.gwt.event.dom.client.ClickEvent;
4 4
import com.google.gwt.event.dom.client.ClickHandler;
5 5
import com.google.gwt.user.client.Cookies;
6
import com.google.gwt.user.client.History;
6 7
import com.google.gwt.user.client.ui.*;
7 8

  
8 9
/**
......
22 23
        userName.addClickHandler(new ClickHandler() {
23 24
            @Override
24 25
            public void onClick(ClickEvent clickEvent) {
25
                NavigationManager.getInstance().navigate("myAccount");
26
                History.newItem("myAccount");
26 27
            }
27 28
        });
28 29

  
......
39 40
                RootPanel.get("loginRegister").add(RegisterLoginElement.getInstance().asWidget());
40 41

  
41 42
                NavigationManager.getInstance().update();
42
                NavigationManager.getInstance().navigate("home");
43
                History.newItem("home");
43 44
            }
44 45
        });
45 46

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/MyAccountWidget.java
3 3
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
4 4
import com.google.gwt.event.dom.client.ClickEvent;
5 5
import com.google.gwt.event.dom.client.ClickHandler;
6
import com.google.gwt.user.client.History;
6 7
import com.google.gwt.user.client.ui.*;
7 8

  
8 9
/**
......
65 66
        newRequestAnchor.addClickHandler(new ClickHandler() {
66 67
            @Override
67 68
            public void onClick(ClickEvent clickEvent) {
68
                NavigationManager.getInstance().navigate("newRequest");
69
                History.newItem("newRequest");
69 70
            }
70 71
        });
71 72

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/MyPersonalInfoWidget.java
3 3
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
4 4
import com.google.gwt.event.dom.client.ClickEvent;
5 5
import com.google.gwt.event.dom.client.ClickHandler;
6
import com.google.gwt.user.client.History;
6 7
import com.google.gwt.user.client.ui.*;
7 8
import eu.dnetlib.goldoa.domain.Affiliation;
8 9
import eu.dnetlib.goldoa.domain.Person;
......
37 38
        editInfoAnchor.addClickHandler(new ClickHandler() {
38 39
            @Override
39 40
            public void onClick(ClickEvent clickEvent) {
40
                NavigationManager.getInstance().navigate("editAccountInfo");
41
                History.newItem("editAccountInfo");
41 42
            }
42 43
        });
43 44

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/MainMenu.java
6 6
import com.google.gwt.core.client.GWT;
7 7
import com.google.gwt.event.dom.client.ClickEvent;
8 8
import com.google.gwt.event.dom.client.ClickHandler;
9
import com.google.gwt.user.client.History;
9 10
import com.google.gwt.user.client.Window;
10 11
import com.google.gwt.user.client.ui.IsWidget;
11 12
import com.google.gwt.user.client.ui.Widget;
......
34 35
        home.addClickHandler(new ClickHandler() {
35 36
            @Override
36 37
            public void onClick(ClickEvent clickEvent) {
37
                NavigationManager.getInstance().navigate("home");
38
                History.newItem("home");
38 39
            }
39 40
        });
40 41

  
......
45 46
        newRequest.addClickHandler(new ClickHandler() {
46 47
            @Override
47 48
            public void onClick(ClickEvent clickEvent) {
48
                NavigationManager.getInstance().navigate("newRequest");
49
                History.newItem("newRequest");
49 50
            }
50 51
        });
51 52

  
......
54 55
        existingRequests.addClickHandler(new ClickHandler() {
55 56
            @Override
56 57
            public void onClick(ClickEvent clickEvent) {
57
                NavigationManager.getInstance().navigate("existingRequests");
58
                History.newItem("existingRequests");
58 59
            }
59 60
        });
60 61

  
......
63 64
        monitor.addClickHandler(new ClickHandler() {
64 65
            @Override
65 66
            public void onClick(ClickEvent clickEvent) {
66
                NavigationManager.getInstance().navigate("monitor");
67
                History.newItem("monitor");
67 68
            }
68 69
        });
69 70

  
......
72 73
        help.addClickHandler(new ClickHandler() {
73 74
            @Override
74 75
            public void onClick(ClickEvent clickEvent) {
75
                NavigationManager.getInstance().navigate("help");
76
                History.newItem("help");
76 77
            }
77 78
        });
78 79

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/NavigationManager.java
35 35
            }
36 36
        }
37 37

  
38
        History.newItem(token);
38
        GoldOAPortal.previousToken = GoldOAPortal.currentToken;
39
        GoldOAPortal.currentToken = token;
39 40

  
41
        Window.alert("Previous token = " + GoldOAPortal.previousToken + "  -  Current token = " + GoldOAPortal.currentToken);
42

  
40 43
        if(breadcrumbsMenu!=null)
41 44
            breadcrumbsMenu.updateBreadcrumbsMenu(token);
42 45
        if(mainMenu!=null)
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/BreadcrumbsMenu.java
5 5
import com.google.gwt.core.client.GWT;
6 6
import com.google.gwt.event.dom.client.ClickEvent;
7 7
import com.google.gwt.event.dom.client.ClickHandler;
8
import com.google.gwt.user.client.History;
8 9
import com.google.gwt.user.client.Window;
9 10
import com.google.gwt.user.client.ui.IsWidget;
10 11
import com.google.gwt.user.client.ui.Widget;
......
41 42
        home.addClickHandler(new ClickHandler() {
42 43
            @Override
43 44
            public void onClick(ClickEvent clickEvent) {
44
                NavigationManager.getInstance().navigate("home");
45
                History.newItem("home");
45 46
            }
46 47
        });
47 48

  
......
50 51
        newFundingRequest.addClickHandler(new ClickHandler() {
51 52
            @Override
52 53
            public void onClick(ClickEvent clickEvent) {
53
                NavigationManager.getInstance().navigate("newRequest");
54
                History.newItem("newRequest");
54 55
            }
55 56
        });
56 57

  
......
59 60
        existingFundingRequests.addClickHandler(new ClickHandler() {
60 61
            @Override
61 62
            public void onClick(ClickEvent clickEvent) {
62
                NavigationManager.getInstance().navigate("existingRequests");
63
                History.newItem("existingRequests");
63 64
            }
64 65
        });
65 66

  
......
68 69
        monitor.addClickHandler(new ClickHandler() {
69 70
            @Override
70 71
            public void onClick(ClickEvent clickEvent) {
71
                NavigationManager.getInstance().navigate("monitor");
72
                History.newItem("monitor");
72 73
            }
73 74
        });
74 75

  
......
77 78
        help.addClickHandler(new ClickHandler() {
78 79
            @Override
79 80
            public void onClick(ClickEvent clickEvent) {
80
                NavigationManager.getInstance().navigate("help");
81
                History.newItem("help");
81 82
            }
82 83
        });
83 84

  
......
86 87
        login.addClickHandler(new ClickHandler() {
87 88
            @Override
88 89
            public void onClick(ClickEvent clickEvent) {
89
                NavigationManager.getInstance().navigate("login");
90
                History.newItem("login");
90 91
            }
91 92
        });
92 93

  
......
95 96
        register.addClickHandler(new ClickHandler() {
96 97
            @Override
97 98
            public void onClick(ClickEvent clickEvent) {
98
                NavigationManager.getInstance().navigate("register");
99
                History.newItem("register");
99 100
            }
100 101
        });
101 102

  
......
104 105
        myAccount.addClickHandler(new ClickHandler() {
105 106
            @Override
106 107
            public void onClick(ClickEvent clickEvent) {
107
                NavigationManager.getInstance().navigate("myAccount");
108
                History.newItem("myAccount");
108 109
            }
109 110
        });
110 111

  
......
113 114
        editAccountInfo.addClickHandler(new ClickHandler() {
114 115
            @Override
115 116
            public void onClick(ClickEvent clickEvent) {
116
                NavigationManager.getInstance().navigate("editAccountInfo");
117
                History.newItem("editAccountInfo");
117 118
            }
118 119
        });
119 120

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/RegisterLoginElement.java
2 2

  
3 3
import com.google.gwt.event.dom.client.ClickEvent;
4 4
import com.google.gwt.event.dom.client.ClickHandler;
5
import com.google.gwt.user.client.History;
5 6
import com.google.gwt.user.client.ui.Anchor;
6 7
import com.google.gwt.user.client.ui.FlowPanel;
7 8
import com.google.gwt.user.client.ui.IsWidget;
......
25 26
        login.addClickHandler(new ClickHandler() {
26 27
            @Override
27 28
            public void onClick(ClickEvent event) {
28
                NavigationManager.getInstance().navigate("login");
29
                History.newItem("login");
29 30
            }
30 31
        });
31 32

  
......
34 35
        register.addClickHandler(new ClickHandler() {
35 36
            @Override
36 37
            public void onClick(ClickEvent event) {
37
                NavigationManager.getInstance().navigate("register");
38
                History.newItem("register");
38 39
            }
39 40
        });
40 41

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/GoldOAPortal.java
21 21

  
22 22
    public static Person currentUser = null;
23 23

  
24
    public static String currentToken = "home";
25
    public static String previousToken = "home";
26

  
24 27
    public static List<Role> userRoles = new ArrayList<>();
25 28

  
26 29
    private DataServiceAsync dataService = GWT.create(DataService.class);
......
35 38

  
36 39
                String historyToken = event.getValue();
37 40
                if(historyToken!=null && !historyToken.equals("")) {
41
                    History.newItem(historyToken);
38 42
                    NavigationManager.getInstance().navigate(historyToken);
39 43
                } else {
40 44
                    //TODO kapou peftei se loop
45
                    History.newItem("home");
41 46
                    NavigationManager.getInstance().navigate("home");
42 47
                }
43 48
            }
......
78 83
                            RootPanel.get("loginRegister").add(userInfoElement.asWidget());
79 84

  
80 85
                            NavigationManager.getInstance().update();
81
                            NavigationManager.getInstance().navigate(initLoad.getGoTo());
86
                            History.newItem(initLoad.getGoTo());
82 87

  
83 88
                        } else {
84 89

  
85 90
                            if(initLoad.getErrorMessage()!=null) {
86 91

  
87 92
                                NavigationManager.getInstance().update();
88
                                NavigationManager.getInstance().navigate(initLoad.getGoTo());
93
                                History.newItem(initLoad.getGoTo());
89 94
                                //TODO display error message
90 95

  
91 96
                            } else {
92 97

  
93 98
                                NavigationManager.getInstance().update();
94
                                NavigationManager.getInstance().navigate(initLoad.getGoTo());
99
                                History.newItem(initLoad.getGoTo());
95 100
                            }
96 101
                        }
97 102
                    }
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/user/UserLoginForm.java
14 14
import com.google.gwt.event.dom.client.ClickHandler;
15 15
import com.google.gwt.user.client.Cookies;
16 16
import com.google.gwt.user.client.DOM;
17
import com.google.gwt.user.client.History;
17 18
import com.google.gwt.user.client.Window;
18 19
import com.google.gwt.user.client.rpc.AsyncCallback;
19 20
import com.google.gwt.user.client.ui.*;
......
118 119
                            RootPanel.get("loginRegister").add(userInfoElement.asWidget());
119 120

  
120 121
                            NavigationManager.getInstance().update();
121
                            NavigationManager.getInstance().navigate("myAccount");
122
                            History.newItem("myAccount");
122 123
                        }
123 124
                    });
124 125
                }
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/user/UserRegistrationForm.java
7 7
import com.google.gwt.event.dom.client.ChangeHandler;
8 8
import com.google.gwt.event.dom.client.ClickEvent;
9 9
import com.google.gwt.event.dom.client.ClickHandler;
10
import com.google.gwt.user.client.History;
10 11
import com.google.gwt.user.client.Window;
11 12
import com.google.gwt.user.client.rpc.AsyncCallback;
12 13
import com.google.gwt.user.client.ui.FlowPanel;
......
408 409
            @Override
409 410
            public void onSuccess(Person person) {
410 411
                GoldOAPortal.currentUser = person;
411
                NavigationManager.getInstance().navigate("myAccount");
412
                History.newItem(GoldOAPortal.previousToken);
412 413
            }
413 414
        });
414 415
    }

Also available in: Unified diff