Package com.extjs.gxt.ui.client.util

Examples of com.extjs.gxt.ui.client.util.Margins


    treeStore.add(createAlbum("Album 1"), false);
    tree.setLeaf(treeStore.getRootItems().get(0), false);

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 200, 100, 300);
    westData.setMargins(new Margins(5, 0, 5, 5));
    westData.setSplit(true);
    container.add(west, westData);

    ContentPanel center = new ContentPanel();
    center.setHeading("My Images");
//    center.setScrollMode(Scroll.AUTO);
    center.setLayout(new FitLayout());

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5));
    container.add(center, centerData);

    final ExampleServiceAsync service = (ExampleServiceAsync) Registry.get(Examples.SERVICE);

    RpcProxy<List<Photo>> proxy = new RpcProxy<List<Photo>>() {
View Full Code Here


    // west
    ContentPanel panel = new ContentPanel();
    panel.setHeading("West");
    BorderLayoutData data = new BorderLayoutData(LayoutRegion.WEST, 150, 100, 250);
    data.setMargins(new Margins(0, 5, 0, 0));
    data.setSplit(true);
    data.setCollapsible(true);
    complex.add(panel, data);

    // center
View Full Code Here

    settings.setHeading("Settings");
    settings.setBorders(false);
    west.add(settings);

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 200, 100, 300);
    westData.setMargins(new Margins(5, 0, 5, 5));
    westData.setCollapsible(true);

    Portal portal = new Portal(3);
    portal.setBorders(true);
    portal.setStyleAttribute("backgroundColor", "white");
    portal.setColumnWidth(0, .33);
    portal.setColumnWidth(1, .33);
    portal.setColumnWidth(2, .33);

    Portlet portlet = new Portlet();
    portlet.setHeading("Grid in a Portlet");
    configPanel(portlet);
    portlet.setLayout(new FitLayout());
    portlet.add(createGrid());
    portlet.setHeight(250);

    portal.add(portlet, 0);

    portlet = new Portlet();
    portlet.setHeading("Another Panel 1");
    configPanel(portlet);
    portlet.addText(getBogusText());
    portal.add(portlet, 0);

    portlet = new Portlet();
    portlet.setHeading("Panel 2");
    configPanel(portlet);
    portlet.addText(getBogusText());
    portal.add(portlet, 1);

    portlet = new Portlet();
    portlet.setHeading("Another Panel 2");
    configPanel(portlet);
    portlet.addText(getBogusText());
    portal.add(portlet, 1);

    portlet = new Portlet();
    portlet.setHeading("Panel 3");
    configPanel(portlet);
    portlet.addText(getBogusText());
    portal.add(portlet, 2);

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(5));

    add(north, northData);
    add(west, westData);
    add(portal, centerData);
  }
View Full Code Here

    BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 150, 150, 250);
    eastData.setSplit(true);

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0, 5, 0, 0));

    chooser.add(main, centerData);
    chooser.add(details, eastData);

    setLayout(new FlowLayout(10));
View Full Code Here

    Text label3 = new Text("Test Label 3");
    label3.addStyleName("pad-text");
    label3.setStyleAttribute("backgroundColor", "white");
    label3.setBorders(true);

    panel.add(label1, new RowData(1, -1, new Margins(4)));
    panel.add(label2, new RowData(1, 1, new Margins(0, 4, 0, 4)));
    panel.add(label3, new RowData(1, -1, new Margins(4)));

    add(panel, new FlowData(10));

    panel = new ContentPanel();
    panel.setHeading("RowLayout: Orientation set to horizontal");
    panel.setLayout(new RowLayout(Orientation.HORIZONTAL));
    panel.setSize(400, 300);
    panel.setFrame(true);
    panel.setCollapsible(true);

    label1 = new Text("Test Label 1");
    label1.addStyleName("pad-text");
    label1.setStyleAttribute("backgroundColor", "white");
    label1.setBorders(true);

    label2 = new Text("Test Label 2");
    label2.addStyleName("pad-text");
    label2.setStyleAttribute("backgroundColor", "white");
    label2.setBorders(true);

    label3 = new Text("Test Label 3");
    label3.addStyleName("pad-text");
    label3.setStyleAttribute("backgroundColor", "white");
    label3.setBorders(true);

    panel.add(label1, new RowData(-1, 1, new Margins(4)));
    panel.add(label2, new RowData(1, 1, new Margins(4, 0, 4, 0)));
    panel.add(label3, new RowData(-1, 1, new Margins(4)));

    add(panel, new FlowData(10));
  }
View Full Code Here

    ThemeSelector selector = new ThemeSelector();
    selector.setWidth(125);
    northPanel.add(selector, "#demo-theme");

    BorderLayoutData data = new BorderLayoutData(LayoutRegion.NORTH, 33);
    data.setMargins(new Margins());
    viewport.add(northPanel, data);
  }
View Full Code Here

    VBoxLayout westLayout = new VBoxLayout();
    westLayout.setPadding(new Padding(5));
    westLayout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
    lcwest.setLayout(westLayout);
    BorderLayoutData west = new BorderLayoutData(LayoutRegion.WEST, 150, 100, 250);
    west.setMargins(new Margins(5));
    west.setSplit(true);

    panel.add(lcwest, west);

    lccenter = new ContentPanel();
    lccenter.setHeaderVisible(false);
    lccenter.setLayout(new FitLayout());
    lccenter.add(new Html(
        "<p style=\"padding:10px;color:#556677;font-size:11px;\">Select a configuration on the left</p>"));
    BorderLayoutData center = new BorderLayoutData(LayoutRegion.CENTER);
    center.setMargins(new Margins(5));
    panel.add(lccenter, center);

    VBoxLayoutData vBoxData = new VBoxLayoutData(5, 5, 5, 5);
    vBoxData.setFlex(1);

    lcwest.add(createToggleButton("Spaced", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        VBoxLayoutData flex = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        flex.setFlex(1);
        c.add(new Text(), flex);
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Multi-Spaced", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        VBoxLayoutData flex = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        flex.setFlex(1);
        c.add(new Text(), flex);
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Text(), flex);
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Text(), flex);
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: left", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.LEFT);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: center", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: right", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.RIGHT);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: stretch", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: stretchmax", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCHMAX);
        c.setLayout(layout);

        c.add(new Button(button1Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button2Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button3Text), new VBoxLayoutData(new Margins(0, 0, 5, 0)));
        c.add(new Button(button4Text), new VBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Flex: All even", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
        c.setLayout(layout);

        VBoxLayoutData flex = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        flex.setFlex(1);
        c.add(new Button(button1Text), flex);
        c.add(new Button(button2Text), flex);
        c.add(new Button(button3Text), flex);

        VBoxLayoutData flex2 = new VBoxLayoutData(new Margins(0));
        flex2.setFlex(1);
        c.add(new Button(button4Text), flex2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Flex: ratio", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
        c.setLayout(layout);

        VBoxLayoutData flex = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        flex.setFlex(1);
        c.add(new Button(button1Text), flex);
        c.add(new Button(button2Text), flex);
        c.add(new Button(button3Text), flex);

        VBoxLayoutData flex2 = new VBoxLayoutData(new Margins(0));
        flex2.setFlex(3);
        c.add(new Button(button4Text), flex2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Flex + Stretch", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
        c.setLayout(layout);

        VBoxLayoutData flex = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        flex.setFlex(1);
        c.add(new Button(button1Text), flex);
        c.add(new Button(button2Text), flex);
        c.add(new Button(button3Text), flex);

        VBoxLayoutData flex2 = new VBoxLayoutData(new Margins(0));
        flex2.setFlex(3);
        c.add(new Button(button4Text), flex2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Pack: start", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
        layout.setPack(BoxLayoutPack.START);
        c.setLayout(layout);

        VBoxLayoutData layoutData = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        c.add(new Button(button1Text), layoutData);
        c.add(new Button(button2Text), layoutData);
        c.add(new Button(button3Text), layoutData);

        VBoxLayoutData layoutData2 = new VBoxLayoutData(new Margins(0));
        c.add(new Button(button4Text), layoutData2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Pack: center", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
        layout.setPack(BoxLayoutPack.CENTER);
        c.setLayout(layout);

        VBoxLayoutData layoutData = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        c.add(new Button(button1Text), layoutData);
        c.add(new Button(button2Text), layoutData);
        c.add(new Button(button3Text), layoutData);

        VBoxLayoutData layoutData2 = new VBoxLayoutData(new Margins(0));
        c.add(new Button(button4Text), layoutData2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Pack: end", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        VBoxLayout layout = new VBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
        layout.setPack(BoxLayoutPack.END);
        c.setLayout(layout);

        VBoxLayoutData layoutData = new VBoxLayoutData(new Margins(0, 0, 5, 0));
        c.add(new Button(button1Text), layoutData);
        c.add(new Button(button2Text), layoutData);
        c.add(new Button(button3Text), layoutData);

        VBoxLayoutData layoutData2 = new VBoxLayoutData(new Margins(0));
        c.add(new Button(button4Text), layoutData2);

        addToCenter(c);
      }
View Full Code Here

    new ListViewDropTarget(list1);
    new ListViewDropTarget(list2);

    RowData data = new RowData(.5, 1);
    data.setMargins(new Margins(5));
  
    cp.add(list1, data);
    cp.add(list2, data);
    add(cp);
   
View Full Code Here

    BorderLayoutData northData = new BorderLayoutData(LayoutRegion.NORTH, 100);
    northData.setCollapsible(true);
    northData.setFloatable(true);
    northData.setHideCollapseTool(true);
    northData.setSplit(true);
    northData.setMargins(new Margins(0, 0, 5, 0));

    BorderLayoutData westData = new BorderLayoutData(LayoutRegion.WEST, 150);
    westData.setSplit(true);
    westData.setCollapsible(true);
    westData.setMargins(new Margins(0,5,0,0));

    BorderLayoutData centerData = new BorderLayoutData(LayoutRegion.CENTER);
    centerData.setMargins(new Margins(0));

    BorderLayoutData eastData = new BorderLayoutData(LayoutRegion.EAST, 150);
    eastData.setSplit(true);
    eastData.setCollapsible(true);
    eastData.setMargins(new Margins(0,0,0,5));

    BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, 100);
    southData.setSplit(true);
    southData.setCollapsible(true);
    southData.setFloatable(true);
    southData.setMargins(new Margins(5, 0, 0, 0));

    add(north, northData);
    add(west, westData);
    add(center, centerData);
    add(east, eastData);
View Full Code Here

    VBoxLayout westLayout = new VBoxLayout();
    westLayout.setPadding(new Padding(5));
    westLayout.setVBoxLayoutAlign(VBoxLayoutAlign.STRETCH);
    lcwest.setLayout(westLayout);
    BorderLayoutData west = new BorderLayoutData(LayoutRegion.WEST, 150, 100, 250);
    west.setMargins(new Margins(5));
    west.setSplit(true);

    panel.add(lcwest, west);

    lccenter = new ContentPanel();
    lccenter.setHeaderVisible(false);
    lccenter.setLayout(new FitLayout());
    lccenter.add(new Html(
        "<p style=\"padding:10px;color:#556677;font-size:11px;\">Select a configuration on the left</p>"));
    BorderLayoutData center = new BorderLayoutData(LayoutRegion.CENTER);
    center.setMargins(new Margins(5));
    panel.add(lccenter, center);

    VBoxLayoutData vBoxData = new VBoxLayoutData(5, 5, 5, 5);
    vBoxData.setFlex(1);

    lcwest.add(createToggleButton("Spaced", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }

        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        HBoxLayoutData flex = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        flex.setFlex(1);
        c.add(new Text(), flex);
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Multi-Spaced", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        HBoxLayoutData flex = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        flex.setFlex(1);
        c.add(new Text(), flex);
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Text(), flex);
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Text(), flex);
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: top", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.TOP);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: middle", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: bottom", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.BOTTOM);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: stretch", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.STRETCH);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Align: stretchmax", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.STRETCHMAX);
        c.setLayout(layout);

        c.add(new Button(button1Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button2Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button3Text), new HBoxLayoutData(new Margins(0, 5, 0, 0)));
        c.add(new Button(button4Text), new HBoxLayoutData(new Margins(0)));

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Flex: All even", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
        c.setLayout(layout);

        HBoxLayoutData flex = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        flex.setFlex(1);
        c.add(new Button(button1Text), flex);
        c.add(new Button(button2Text), flex);
        c.add(new Button(button3Text), flex);

        HBoxLayoutData flex2 = new HBoxLayoutData(new Margins(0));
        flex2.setFlex(1);
        c.add(new Button(button4Text), flex2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Flex: ratio", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
        c.setLayout(layout);

        HBoxLayoutData flex = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        flex.setFlex(1);
        c.add(new Button(button1Text), flex);
        c.add(new Button(button2Text), flex);
        c.add(new Button(button3Text), flex);

        HBoxLayoutData flex2 = new HBoxLayoutData(new Margins(0));
        flex2.setFlex(3);
        c.add(new Button(button4Text), flex2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Flex + Stretch", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.STRETCH);
        c.setLayout(layout);

        HBoxLayoutData flex = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        flex.setFlex(1);
        c.add(new Button(button1Text), flex);
        c.add(new Button(button2Text), flex);
        c.add(new Button(button3Text), flex);

        HBoxLayoutData flex2 = new HBoxLayoutData(new Margins(0));
        flex2.setFlex(3);
        c.add(new Button(button4Text), flex2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Pack: start", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
        layout.setPack(BoxLayoutPack.START);
        c.setLayout(layout);

        HBoxLayoutData layoutData = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        c.add(new Button(button1Text), layoutData);
        c.add(new Button(button2Text), layoutData);
        c.add(new Button(button3Text), layoutData);

        HBoxLayoutData layoutData2 = new HBoxLayoutData(new Margins(0));
        c.add(new Button(button4Text), layoutData2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Pack: center", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
        layout.setPack(BoxLayoutPack.CENTER);
        c.setLayout(layout);

        HBoxLayoutData layoutData = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        c.add(new Button(button1Text), layoutData);
        c.add(new Button(button2Text), layoutData);
        c.add(new Button(button3Text), layoutData);

        HBoxLayoutData layoutData2 = new HBoxLayoutData(new Margins(0));
        c.add(new Button(button4Text), layoutData2);

        addToCenter(c);
      }

    }), vBoxData);

    lcwest.add(createToggleButton("Pack: end", new Listener<ButtonEvent>() {

      public void handleEvent(ButtonEvent ce) {
        if (!ce.<ToggleButton> getComponent().isPressed()) {
          return;
        }
        LayoutContainer c = new LayoutContainer();
        HBoxLayout layout = new HBoxLayout();
        layout.setPadding(new Padding(5));
        layout.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
        layout.setPack(BoxLayoutPack.END);
        c.setLayout(layout);

        HBoxLayoutData layoutData = new HBoxLayoutData(new Margins(0, 5, 0, 0));
        c.add(new Button(button1Text), layoutData);
        c.add(new Button(button2Text), layoutData);
        c.add(new Button(button3Text), layoutData);

        HBoxLayoutData layoutData2 = new HBoxLayoutData(new Margins(0));
        c.add(new Button(button4Text), layoutData2);

        addToCenter(c);
      }
View Full Code Here

TOP

Related Classes of com.extjs.gxt.ui.client.util.Margins

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.