| Line 11... |
Line 11... |
| 11 |
import com.google.gwt.uibinder.client.UiTemplate;
|
11 |
import com.google.gwt.uibinder.client.UiTemplate;
|
| 12 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
12 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
| 13 |
import com.google.gwt.user.client.ui.DockLayoutPanel;
|
13 |
import com.google.gwt.user.client.ui.DockLayoutPanel;
|
| 14 |
import com.google.gwt.user.client.ui.RootLayoutPanel;
|
14 |
import com.google.gwt.user.client.ui.RootLayoutPanel;
|
| 15 |
|
15 |
|
| - |
|
16 |
/**
|
| - |
|
17 |
* This is the entry point of dashboard application.
|
| - |
|
18 |
*
|
| - |
|
19 |
*/
|
| 16 |
public class CatalogDashboard implements EntryPoint {
|
20 |
public class CatalogDashboard implements EntryPoint {
|
| 17 |
|
21 |
|
| 18 |
@UiTemplate("CatalogDashboard.ui.xml")
|
22 |
@UiTemplate("CatalogDashboard.ui.xml")
|
| 19 |
interface CatalogBinder extends UiBinder<DockLayoutPanel, CatalogDashboard> {
|
23 |
interface CatalogBinder extends UiBinder<DockLayoutPanel, CatalogDashboard> {
|
| 20 |
}
|
24 |
}
|
| 21 |
|
25 |
|
| 22 |
private static final CatalogBinder binder = GWT.create(CatalogBinder.class);
|
26 |
private static final CatalogBinder binder = GWT.create(CatalogBinder.class);
|
| 23 |
private final LoginServiceAsync loginService = GWT.create(LoginService.class);
|
27 |
private final LoginServiceAsync loginService = GWT.create(LoginService.class);
|
| 24 |
|
28 |
|
| 25 |
@UiField TopPanel topPanel;
|
29 |
@UiField TopPanel topPanel; // logo, welcome message and sign out link
|
| 26 |
@UiField Shortcuts shortcuts;
|
30 |
@UiField Shortcuts shortcuts; // anchors to filter item list based on status
|
| 27 |
//@UiField Filters filters;
|
31 |
//TODO @UiField Filters filters;
|
| 28 |
@UiField ItemList itemList;
|
32 |
@UiField ItemList itemList; // list of items
|
| 29 |
@UiField ItemDetails itemDetails;
|
33 |
@UiField ItemDetails itemDetails; // details of an item selected in the list
|
| 30 |
@UiField ItemActions itemActions;
|
34 |
@UiField ItemActions itemActions; // action buttons to update, add item or change item status
|
| 31 |
|
35 |
|
| 32 |
RootLayoutPanel root;
|
36 |
RootLayoutPanel root;
|
| 33 |
LoginScreen login;
|
37 |
LoginScreen login;
|
| 34 |
|
38 |
|
| 35 |
public void onModuleLoad() {
|
39 |
public void onModuleLoad() {
|
| Line 44... |
Line 48... |
| 44 |
authenticateUser(username, password, Utils.ROLE_STAGING);
|
48 |
authenticateUser(username, password, Utils.ROLE_STAGING);
|
| 45 |
}
|
49 |
}
|
| 46 |
});
|
50 |
});
|
| 47 |
}
|
51 |
}
|
| 48 |
|
52 |
|
| - |
|
53 |
/**
|
| - |
|
54 |
* Authenticates username and password and if successful, initialises
|
| - |
|
55 |
* main dashboard panel.
|
| - |
|
56 |
* @param username
|
| - |
|
57 |
* @param password
|
| - |
|
58 |
* @param role -- Utils.ROLE_STAGING (Login role for staging), another role
|
| - |
|
59 |
* is Utils.ROLE_PRODUCTION (for push to production username & password)
|
| - |
|
60 |
*/
|
| 49 |
private void authenticateUser(String username, String password, int role) {
|
61 |
private void authenticateUser(String username, String password, int role) {
|
| 50 |
final String uname = username;
|
62 |
final String uname = username;
|
| 51 |
loginService.authenticateUser(username, password, role, new AsyncCallback<String>() {
|
63 |
loginService.authenticateUser(username, password, role, new AsyncCallback<String>() {
|
| 52 |
@Override
|
64 |
@Override
|
| 53 |
public void onSuccess(String result) {
|
65 |
public void onSuccess(String result) {
|
| Line 81... |
Line 93... |
| 81 |
}
|
93 |
}
|
| 82 |
});
|
94 |
});
|
| 83 |
root.clear();
|
95 |
root.clear();
|
| 84 |
root.add(dashboard);
|
96 |
root.add(dashboard);
|
| 85 |
|
97 |
|
| - |
|
98 |
/**
|
| - |
|
99 |
* listener for anchors to filter item list based on statuses and some other parameters.
|
| - |
|
100 |
* On click event, string of the anchor is passed as argument and the same listener is
|
| - |
|
101 |
* taking different actions based on the different string arguments.
|
| - |
|
102 |
*/
|
| 86 |
shortcuts.getCatalogTree().setTreeListener(new CatalogTree.TreeListener() {
|
103 |
shortcuts.getCatalogTree().setTreeListener(new CatalogTree.TreeListener() {
|
| 87 |
@Override
|
104 |
@Override
|
| 88 |
public void onTreeItemClicked(String itemsType) {
|
105 |
public void onTreeItemClicked(String itemsType) {
|
| 89 |
//showWaitCursor();
|
- |
|
| 90 |
if(CatalogTree.ALL_ITEMS.equals(itemsType)) {
|
106 |
if(CatalogTree.ALL_ITEMS.equals(itemsType)) {
|
| 91 |
itemList.loadAllItems();
|
107 |
itemList.loadAllItems();
|
| 92 |
} else if(CatalogTree.ALL_PHASED_OUT_ITEMS.equals(itemsType)) {
|
108 |
} else if(CatalogTree.ALL_PHASED_OUT_ITEMS.equals(itemsType)) {
|
| 93 |
itemList.loadAllPhasedOutItems();
|
109 |
itemList.loadAllPhasedOutItems();
|
| 94 |
} else if(CatalogTree.ALL_PAUSED_ITEMS.equals(itemsType)) {
|
110 |
} else if(CatalogTree.ALL_PAUSED_ITEMS.equals(itemsType)) {
|