Subversion Repositories eFlore/Archives.cel-v1

Rev

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