Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 23 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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