Example usage for com.google.gwt.user.client Window setMargin

List of usage examples for com.google.gwt.user.client Window setMargin

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window setMargin.

Prototype

public static void setMargin(String size) 

Source Link

Usage

From source file:com.urlisit.siteswrapper.cloud.client.RenderedPage.java

License:Apache License

@SuppressWarnings("deprecation")
public static AbsolutePanel renderLayout() {
    Window.setMargin(RenderedPage.windowMargin + "px");
    RenderedPage.sizeLayoutElements();/*from   w  ww  . ja va2 s  .c om*/
    RenderedPage.locLangSelector.addItem("United States / English");
    RenderedPage.locLangSelector.addItem("Costa Rica / Spanish");
    RenderedPage.searchField.setText("Search");
    RenderedPage.mainMenu.setText(0, 0, "");
    RenderedPage.mainMenu.getElement().getStyle()
            .setBackgroundImage("url('" + Resources.resources.mainMenuSprite().getURL() + "')");
    RenderedPage.mainMenu.getElement().getStyle().setProperty("BackgroundRepeat", "repeat-x");
    int x = 0;
    while (RenderedPage.pageMap.get("page" + x) != null) {
        RenderedPage.instanceMap.get(RenderedPage.pageMap.get("page" + x)).mainMenuHyperLink
                .setHTML(RenderedPage.instanceMap.get(RenderedPage.pageMap.get("page" + x)).getMainMenuLink());
        RenderedPage.mainMenu.setWidget(0, x + 1, mainMenuLinks.get(x));
        x++;
    }
    int cellWidth = (int) Math.round(RenderedPage.windowWidth / RenderedPage.mainMenu.getCellCount(0));
    int y = RenderedPage.mainMenu.getCellCount(0);
    for (x = 0; x <= y; x++) {
        RenderedPage.mainMenu.getCellFormatter().setWidth(0, x, cellWidth + "px");
        RenderedPage.mainMenu.getCellFormatter().setHorizontalAlignment(0, x,
                HasHorizontalAlignment.ALIGN_CENTER);
    }
    RenderedPage.mainPanel.add(RenderedPage.locLangSelector, RenderedPage.locLangSelectorLeft,
            RenderedPage.locLangSelectorTop);
    RenderedPage.mainPanel.add(RenderedPage.searchField, RenderedPage.searchFieldLeft,
            RenderedPage.searchFieldTop);
    RenderedPage.mainPanel.add(RenderedPage.searchButton, RenderedPage.searchButtonLeft,
            RenderedPage.searchButtonTop);
    RenderedPage.mainPanel.add(RenderedPage.mainMenu, RenderedPage.mainMenuLeft, RenderedPage.mainMenuTop);
    /*
     * If renderLayout is called with an empty instanceMap report it using an alert box and fail gracefully
     * by returning an AbsolutePanel without any page instances to render. This situation happens when the
     * RenderedPage.renderLayout() method is called before new instance objects are created or the configuration
     * in the datastore is empty.  
     */
    if (RenderedPage.instanceMap.isEmpty()) {
        Window.alert("RenderedPage instanceMap is empty. Check the configuration database.");
    } else {
        RenderedPage.instanceMap.get(Window.getTitle()).materialize();
    }
    return RenderedPage.mainPanel;
}

From source file:com.urlisit.siteswrapper.cloud.client.SitesWrapper.java

License:Apache License

public void onModuleLoad() {
    AsyncCallback<DTO> configuration = new AsyncCallback<DTO>() {
        public void onFailure(Throwable caught) {
            Window.alert(factory.getLiterals().rpcErrorMessage());
        }//from www. j a v  a2 s.  co m

        @Override
        public void onSuccess(DTO pages) {
            for (Page page : pages.getPages()) {
                factory.newView(factory.getPresenter(), factory.getSelector(), page, factory.getSite(),
                        factory.getStyle(), factory.getLiterals());
            }
            if (History.getToken().length() == 0) {
                History.newItem(factory.getSite().getDefaultPage(), false);
            }
            Window.setMargin("0px");
            Window.setTitle(History.getToken());
            History.fireCurrentHistoryState();
        }
    };
    RootPanel.getBodyElement().getStyle().setBackgroundColor(factory.getStyle().getPrimaryColor());
    factory.getRpc().getDTO(configuration);
}

From source file:com.webgocommerce.client.Main.java

@Override
public void onModuleLoad() {
    Window.setMargin("0px");
    MGWT.applySettings(MGWTSettings.getAppSetting());
    panel.add(btnEntrar);//from  w  w  w. j a v  a  2 s .  c o m
    panel.add(img);
    RootPanel.get().add(panel);
    initListener();
    initStyle();
    //History.newItem("X");
    //History.addValueChangeHandler(valueChangeHandler);
}

From source file:com.webgocommerce.client.MainAdmin.java

@Override
public void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

        @Override/* w  w  w . j  av a 2 s .  c  om*/
        public void onUncaughtException(Throwable e) {
            Throwable unwrapped = unwrap(e);
            GWT.log(e.getMessage() + "-" + e.getLocalizedMessage(), unwrapped);
            //Window.alert(e.getMessage());
        }
    });
    Window.setMargin("0px");
    MGWT.applySettings(MGWTSettings.getAppSetting());
    RootPanel.get().add(new DUILoginAdminImpl());
    //History.newItem("X");
    //History.addValueChangeHandler(valueChangeHandler);
}

From source file:com.webgocommerce.client.MainSesionSuperAdmin.java

@Override
public void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

        @Override//  w  ww.  ja va 2s  . c  o  m
        public void onUncaughtException(Throwable e) {
            Throwable unwrapped = unwrap(e);
            GWT.log(e.getMessage() + "-" + e.getLocalizedMessage(), unwrapped);
            //Window.alert(e.getMessage());
        }
    });
    Window.setMargin("0px");
    MGWT.applySettings(MGWTSettings.getAppSetting());
    RootPanel.get().add(new UISesionImpl());
    //RootPanel.get().add(new UIAddItemListaImpl());
    //RootPanel.get().add(new UIMantCategoriaLista("NUEVO"));        
    History.newItem("X");
    History.addValueChangeHandler(valueChangeHandler);
}

From source file:com.webgocommerce.client.MainSuperAdmin.java

@Override
public void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

        @Override//  www. ja v a  2s  .  c  o  m
        public void onUncaughtException(Throwable e) {
            Throwable unwrapped = unwrap(e);
            GWT.log(e.getMessage() + "-" + e.getLocalizedMessage(), unwrapped);
            //Window.alert(e.getMessage());
        }
    });
    Window.setMargin("0px");
    MGWT.applySettings(MGWTSettings.getAppSetting());
    /*Button btn=new Button("Click me");
    btn.addClickHandler(new ClickHandler(){
            
    @Override
    public void onClick(ClickEvent event) {
        PopupProgress popup=new PopupProgress();
        popup.showPopup();
    }
    });*/
    RootPanel.get().add(new DUILoginSuperAdminImpl());
    //RootPanel.get().add(btn);
    //ToolBarButton pnl=new ToolBarButton();        
    //pnl.addSlideBar(new ButtonBar(new Image(MyResource.INSTANCE.getImgPerson32())), new HTML("NAVA1"));
    //pnl.addSlideBar(new ButtonBar(new Image(MyResource.INSTANCE.getImgAbajo32())), new HTML("NAVA2"));
    //pnl.addSlideBar(new ButtonBar(new Image(MyResource.INSTANCE.getImgRefresh32())), new HTML("NAVA3"));
    //pnl.setWidth("100%");        
    //RootPanel.get().add(new UISearchAddCliente());
    //History.newItem("X");
    //History.addValueChangeHandler(valueChangeHandler);
}

From source file:com.webgocommerce.client.MainUser.java

@Override
public void onModuleLoad() {
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

        @Override/*from w  w  w .ja  v a2 s . com*/
        public void onUncaughtException(Throwable e) {
            Throwable unwrapped = unwrap(e);
            GWT.log(e.getMessage() + "-" + e.getLocalizedMessage(), unwrapped);
            //Window.alert(e.getMessage());
        }
    });
    Window.setMargin("0px");
    MGWT.applySettings(MGWTSettings.getAppSetting());
    RootPanel.get().add(new DUILoginUserImpl());
    //History.newItem("X");
    //History.addValueChangeHandler(valueChangeHandler);
}

From source file:edu.udes.bio.genus.client.GenUS.java

License:Open Source License

/**
 * This is the entry point method.//from   ww w.j a v  a  2s .c o m
 */
public void onModuleLoad() {
    // Setup the browser window
    Window.enableScrolling(false);
    Window.setMargin("0px");
    Window.setTitle("GenUS : Genetic profiling tool");

    // Setup the root panel
    RootPanel.get().setSize("100%", "100%");

    // Setup the background panel
    setSize("100%", "100%");
    RootPanel.get().add(this);

    // Set display area
    this.add(GenUS.displayArea, 0, 0);

    // Add the zoomer
    final Scaler zoomer = new Scaler(GenUS.displayArea);
    this.add(zoomer, Window.getClientWidth() - 21, 0);

    // Add the main menu
    this.add(GenUS.mainMenu, 0, 0);

    // Add the properties panel
    this.add(GenUS.propMenu, Window.getClientWidth() - 502, Window.getClientHeight() - 125);

    // ### TESTING : Add a strand to pool
    // try {
    // // final RNAssDrawable testStrand = new RNAssDrawable("..((((((((......))))))))..", "ACGUGCCACGAUUCAACGUGGCACAG", GenUS.displayArea);
    // // testStrand.setName("TEST").scale(GenUS.displayArea.scaleFactor);
    // //
    // // GenUS.rnaPool.addToPool(testStrand);
    // //
    // // final RNAssDrawable testStrand2 = new RNAssDrawable(".(((....)..))..", "ACGUGCCACGAU", GenUS.displayArea);
    // // testStrand.setName("TEST2").scale(GenUS.displayArea.scaleFactor).setDrawStyle(DrawStyle.Linear_Round);
    // //
    // // GenUS.rnaPool.addToPool(testStrand2);
    //
    // /*
    // * for (int i = 0; i < 5; i++) { RNAssDrawable testStrand2 = new RNAssDrawable("..((......))", i + "  ", displayArea); testStrand2.setName("TEST" + i).scale(displayArea.scaleFactor); testStrand2.setDrawStyle(RNAssDrawable.DrawStyle.Linear_Round);
    // *
    // * rnaPool.addToPool(testStrand2); }
    // */
    //
    // } catch (final Exception e) {
    // Window.alert("TESTING STRAND ERROR GOTTA FIX TAHT SHIT: " + e.getMessage());
    // }
}

From source file:es.ugr.rodgom.ludiuca.client.profesor.ProfesorGUI.java

License:Apache License

/**
 * This method constructs the application user interface by instantiating
 * controls and hooking up event handler.
 *///from   w  ww.  jav  a2 s  .  c  o  m
public ProfesorGUI() {
    // Inject global styles.
    GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected();
    GWT.log("Antes del binder");
    // Create the UI defined in Mail.ui.xml.
    DockLayoutPanel outer = binder.createAndBindUi(this);
    GWT.log("Despus del binder");
    //Cargamos el contexto

    Context.setCentralPan(centralPan);
    Context.setTopPanel(topPanel);
    Context.setShortCuts(shortcuts);
    GWT.log("Despus de actualizar el contexto");
    // Get rid of scrollbars, and clear out the window's built-in margin,
    // because we want to take advantage of the entire client area.
    Window.enableScrolling(true);
    Window.setMargin("0px");

    // Special-case stuff to make topPanel overhang a bit.
    Element topElem = outer.getWidgetContainerElement(topPanel);
    topElem.getStyle().setZIndex(2);
    topElem.getStyle().setOverflow(Overflow.VISIBLE);

    // Add the outer panel to the RootLayoutPanel, so that it will be
    // displayed.
    RootLayoutPanel root = RootLayoutPanel.get();
    //root.clear();
    root.add(outer);
}

From source file:es.ugr.rodgom.ludiuca.client.student.StudentGUI.java

License:Apache License

/**
 * This method constructs the application user interface by instantiating
 * controls and hooking up event handler.
 */// w  w  w .  j av a 2  s  . c om
public StudentGUI() {
    // Inject global styles.
    GWT.<GlobalResources>create(GlobalResources.class).css().ensureInjected();
    GWT.log("Antes del binder");
    // Create the UI defined in Mail.ui.xml.
    DockLayoutPanel outer = binder.createAndBindUi(this);
    GWT.log("Despus del binder");
    //Cargamos el contexto

    ContextStudent.setCentralPan(centralPan);
    ContextStudent.setTopPanel(topPanel);
    ContextStudent.setShortCuts(shortcuts);
    GWT.log("Despus de actualizar el contexto");
    // Get rid of scrollbars, and clear out the window's built-in margin,
    // because we want to take advantage of the entire client area.
    Window.enableScrolling(true);
    Window.setMargin("0px");

    // Special-case stuff to make topPanel overhang a bit.
    Element topElem = outer.getWidgetContainerElement(topPanel);
    topElem.getStyle().setZIndex(2);
    topElem.getStyle().setOverflow(Overflow.VISIBLE);

    // Add the outer panel to the RootLayoutPanel, so that it will be
    // displayed.
    RootLayoutPanel root = RootLayoutPanel.get();
    //root.clear();
    root.add(outer);
}