Example usage for com.google.gwt.layout.client Layout Layout

List of usage examples for com.google.gwt.layout.client Layout Layout

Introduction

In this page you can find the example usage for com.google.gwt.layout.client Layout Layout.

Prototype

public Layout(Element parent) 

Source Link

Document

Constructs a new layout associated with the given parent element.

Usage

From source file:com.google.gwt.examples.LayoutExample.java

License:Apache License

public void onModuleLoad() {
    // The following is a very simple example, which constructs a layout around
    // a parent element, and attaches two child elements that split their
    // parent's space vertically. It then goes on to animate from the first
    // state to a horizontal stacking that uses EM units rather than
    // percentages.
    Document doc = Document.get();
    Element parent = doc.createDivElement();
    doc.getBody().appendChild(parent);/*from w w w .  j  av  a  2 s  .com*/

    Layout layout = new Layout(parent);
    layout.onAttach();

    Element topChild = doc.createDivElement(), bottomChild = doc.createDivElement();
    Layer topLayer = layout.attachChild(topChild);
    Layer bottomLayer = layout.attachChild(bottomChild);

    // Stack the two children vertically, meeting at 50%.
    topLayer.setLeftRight(0, PX, 0, PX);
    bottomLayer.setLeftRight(0, PX, 0, PX);
    topLayer.setTopHeight(0, PCT, 50, PCT);
    bottomLayer.setBottomHeight(0, PCT, 50, PCT);
    layout.layout();

    // Update the two children to stack horizontally, meeting at 10em.
    // Also have them animate for 500ms.
    topLayer.setTopBottom(0, PX, 0, PX);
    bottomLayer.setTopBottom(0, PX, 0, PX);
    topLayer.setLeftWidth(0, EM, 10, EM);
    bottomLayer.setLeftRight(10, EM, 0, EM);
    layout.layout(500);
}

From source file:org.kaaproject.kaa.server.admin.client.layout.CustomDeckLayoutPanel.java

License:Apache License

/**
 * Creates an empty deck panel./*from w  ww .  j  a  v a  2  s .c  om*/
 */
public CustomDeckLayoutPanel() {
    setElement(Document.get().createDivElement());
    layout = new Layout(getElement());
    layoutCmd = new DeckAnimateCommand(layout);
}

From source file:org.viewer.client.MyDockLayoutPanel.java

License:Apache License

/**
 * Creates an empty dock panel./*from w ww .  j a v a2  s. c o m*/
 *
 * @param unit the unit to be used for layout
 */
public MyDockLayoutPanel(Unit unit) {
    this.unit = unit;

    setElement(Document.get().createDivElement());
    layout = new Layout(getElement());
    layoutCmd = new DockAnimateCommand(layout);
}