| 2 |
ddelon |
1 |
package org.tela_botanica.client;
|
|
|
2 |
|
|
|
3 |
import com.google.gwt.core.client.EntryPoint;
|
| 13 |
ddelon |
4 |
import com.google.gwt.user.client.Command;
|
|
|
5 |
import com.google.gwt.user.client.DeferredCommand;
|
| 14 |
ddelon |
6 |
import com.google.gwt.user.client.History;
|
| 2 |
ddelon |
7 |
import com.google.gwt.user.client.Window;
|
| 13 |
ddelon |
8 |
import com.google.gwt.user.client.WindowResizeListener;
|
| 2 |
ddelon |
9 |
import com.google.gwt.user.client.ui.DockPanel;
|
|
|
10 |
import com.google.gwt.user.client.ui.RootPanel;
|
| 13 |
ddelon |
11 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 2 |
ddelon |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
/**
|
|
|
16 |
* Entry point classes define <code>onModuleLoad()</code>.
|
|
|
17 |
*/
|
| 13 |
ddelon |
18 |
public class Cel implements EntryPoint, WindowResizeListener {
|
| 2 |
ddelon |
19 |
|
| 10 |
ddelon |
20 |
|
|
|
21 |
private TopPanel topPanel = null;
|
|
|
22 |
private CenterPanel centerPanel = null;
|
|
|
23 |
private LeftPanel leftPanel = null;
|
| 12 |
ddelon |
24 |
private EntryPanel entryPanel = null;
|
| 13 |
ddelon |
25 |
private ActionPanel actionPanel = null;
|
|
|
26 |
private SearchPanel searchPanel = null;
|
| 11 |
ddelon |
27 |
|
| 13 |
ddelon |
28 |
private VerticalPanel rightPanel = null;
|
| 10 |
ddelon |
29 |
private Mediator mediator = null;
|
|
|
30 |
|
| 12 |
ddelon |
31 |
|
| 2 |
ddelon |
32 |
/**
|
|
|
33 |
* This is the entry point method.
|
|
|
34 |
*/
|
|
|
35 |
public void onModuleLoad() {
|
|
|
36 |
|
| 10 |
ddelon |
37 |
|
|
|
38 |
mediator= new Mediator();
|
|
|
39 |
mediator.registerCel(this);
|
| 11 |
ddelon |
40 |
mediator.initUser(); // Appelle initAsync suivant
|
| 10 |
ddelon |
41 |
|
| 14 |
ddelon |
42 |
|
| 10 |
ddelon |
43 |
}
|
|
|
44 |
|
|
|
45 |
public void initAsync() {
|
| 2 |
ddelon |
46 |
|
| 10 |
ddelon |
47 |
|
|
|
48 |
centerPanel = new CenterPanel(mediator);
|
| 13 |
ddelon |
49 |
|
| 12 |
ddelon |
50 |
|
| 11 |
ddelon |
51 |
topPanel = new TopPanel(mediator);
|
| 10 |
ddelon |
52 |
leftPanel = new LeftPanel(mediator);
|
| 13 |
ddelon |
53 |
|
| 10 |
ddelon |
54 |
|
| 12 |
ddelon |
55 |
entryPanel = new EntryPanel(mediator);
|
| 13 |
ddelon |
56 |
actionPanel = new ActionPanel(mediator);
|
|
|
57 |
searchPanel = new SearchPanel(mediator);
|
|
|
58 |
rightPanel = new VerticalPanel();
|
| 10 |
ddelon |
59 |
|
| 2 |
ddelon |
60 |
// Information haut de page (nom application, connexion ... etc).
|
|
|
61 |
// A regler
|
|
|
62 |
|
| 12 |
ddelon |
63 |
entryPanel.setStyleName("item-Input");
|
| 13 |
ddelon |
64 |
|
|
|
65 |
rightPanel.add(searchPanel);
|
| 14 |
ddelon |
66 |
rightPanel.add(entryPanel);
|
|
|
67 |
rightPanel.add(centerPanel);
|
| 13 |
ddelon |
68 |
rightPanel.add(actionPanel);
|
| 12 |
ddelon |
69 |
|
| 13 |
ddelon |
70 |
|
|
|
71 |
rightPanel.setWidth("100%");
|
|
|
72 |
centerPanel.setWidth("100%");
|
|
|
73 |
|
|
|
74 |
entryPanel.setWidth("100%");
|
|
|
75 |
topPanel.setWidth("100%");
|
| 2 |
ddelon |
76 |
|
| 13 |
ddelon |
77 |
|
|
|
78 |
rightPanel.setSpacing(2);
|
| 2 |
ddelon |
79 |
|
| 13 |
ddelon |
80 |
|
| 2 |
ddelon |
81 |
// DockPanel permet d'arranger plusieurs panneaux au coins cardinaux, le panneau central remplissant
|
|
|
82 |
// l'espace laissé.
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
DockPanel outer = new DockPanel();
|
|
|
86 |
outer.add(topPanel, DockPanel.NORTH);
|
| 13 |
ddelon |
87 |
outer.add(rightPanel, DockPanel.CENTER);
|
| 10 |
ddelon |
88 |
outer.add(leftPanel, DockPanel.WEST);
|
| 12 |
ddelon |
89 |
// outer.add(bottomPanel, DockPanel.SOUTH);
|
| 2 |
ddelon |
90 |
|
| 10 |
ddelon |
91 |
// LeftPanel :
|
| 2 |
ddelon |
92 |
// Pour l'instant : relevés.
|
|
|
93 |
|
|
|
94 |
outer.setWidth("100%");
|
|
|
95 |
|
| 14 |
ddelon |
96 |
outer.setSpacing(2);
|
| 13 |
ddelon |
97 |
outer.setCellWidth(rightPanel, "100%");
|
| 2 |
ddelon |
98 |
|
|
|
99 |
// Window.enableScrolling(false);
|
|
|
100 |
Window.setMargin("0px");
|
|
|
101 |
|
| 12 |
ddelon |
102 |
mediator.onInit();
|
|
|
103 |
|
|
|
104 |
|
| 2 |
ddelon |
105 |
RootPanel.get().add(outer);
|
|
|
106 |
|
|
|
107 |
|
| 13 |
ddelon |
108 |
// Call the window resized handler to get the initial sizes setup. Doing
|
|
|
109 |
// this in a deferred command causes it to occur after all widgets' sizes
|
|
|
110 |
// have been computed by the browser.
|
|
|
111 |
DeferredCommand.add(new Command() {
|
|
|
112 |
public void execute() {
|
|
|
113 |
onWindowResized(Window.getClientWidth(), Window.getClientHeight());
|
|
|
114 |
}
|
|
|
115 |
});
|
|
|
116 |
|
|
|
117 |
|
| 2 |
ddelon |
118 |
}
|
|
|
119 |
|
|
|
120 |
|
| 13 |
ddelon |
121 |
public void onWindowResized(int width, int height) {
|
|
|
122 |
// Adjust the shortcut panel and detail area to take up the available room
|
|
|
123 |
// in the window.
|
|
|
124 |
int shortcutHeight = height - leftPanel.getAbsoluteTop() - 8;
|
|
|
125 |
if (shortcutHeight < 1)
|
|
|
126 |
shortcutHeight = 1;
|
|
|
127 |
leftPanel.setHeight("" + shortcutHeight);
|
| 2 |
ddelon |
128 |
|
| 13 |
ddelon |
129 |
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
|
| 12 |
ddelon |
133 |
|
| 4 |
ddelon |
134 |
|
| 2 |
ddelon |
135 |
}
|