Subversion Repositories eFlore/Archives.cel-v1

Rev

Rev 12 | Blame | Last modification | View Log | RSS feed

package org.tela_botanica.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;



/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Cel implements EntryPoint,  WindowResizeListener {

  
  private TopPanel topPanel = null;
  private CenterPanel centerPanel = null;
  private LeftPanel leftPanel = null;
  private EntryPanel entryPanel = null;
  private ActionPanel actionPanel = null;
  private SearchPanel searchPanel = null;
  
  private VerticalPanel rightPanel = null;
  private Mediator mediator = null;


  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {


         mediator= new Mediator();
         mediator.registerCel(this);
         mediator.initUser(); // Appelle initAsync suivant
                
                
  }
  
  public void initAsync() {
          

          centerPanel = new CenterPanel(mediator);
         
          
          topPanel = new TopPanel(mediator);
          leftPanel = new LeftPanel(mediator);
          

          entryPanel = new EntryPanel(mediator);
          actionPanel = new ActionPanel(mediator);
          searchPanel = new SearchPanel(mediator);
          rightPanel = new VerticalPanel();
          
          // Information haut de page (nom application, connexion ... etc).
          // A regler 
          
          entryPanel.setStyleName("item-Input");
         
          rightPanel.add(searchPanel);
          rightPanel.add(actionPanel);
          rightPanel.add(centerPanel);
          rightPanel.add(entryPanel);
          
          
          
          rightPanel.setWidth("100%");
          centerPanel.setWidth("100%");
          
          entryPanel.setWidth("100%");
          topPanel.setWidth("100%");


          rightPanel.setSpacing(2);
          
          
          // DockPanel permet d'arranger plusieurs panneaux au coins cardinaux, le panneau central remplissant
          // l'espace laissé.
          
          
          DockPanel outer = new DockPanel();
          outer.add(topPanel, DockPanel.NORTH);
          outer.add(rightPanel, DockPanel.CENTER);
          outer.add(leftPanel, DockPanel.WEST);
//        outer.add(bottomPanel, DockPanel.SOUTH);
          
          // LeftPanel : 
          // Pour l'instant : relevés.
          
          outer.setWidth("100%");

          outer.setSpacing(4);
          outer.setCellWidth(rightPanel, "100%");
         
//        Window.enableScrolling(false);
          Window.setMargin("0px");

          mediator.onInit();
          
          
          RootPanel.get().add(outer);


            // Call the window resized handler to get the initial sizes setup. Doing
            // this in a deferred command causes it to occur after all widgets' sizes
            // have been computed by the browser.
            DeferredCommand.add(new Command() {
              public void execute() {
                onWindowResized(Window.getClientWidth(), Window.getClientHeight());
              }
            });


  }
  
  
  public void onWindowResized(int width, int height) {
            // Adjust the shortcut panel and detail area to take up the available room
            // in the window.
            int shortcutHeight = height - leftPanel.getAbsoluteTop() - 8;
            if (shortcutHeight < 1)
              shortcutHeight = 1;
            leftPanel.setHeight("" + shortcutHeight);

            
          }


  

}