Package com.google.gdt.eclipse.designer.gxt.model.widgets

Examples of com.google.gdt.eclipse.designer.gxt.model.widgets.LayoutContainerInfo


   *          the {@link Point} of new location of widget. May be <code>null</code>.
   * @param size
   *          the {@link Dimension} of new size of widget. May be <code>null</code>.
   */
  public void command_BOUNDS(WidgetInfo widget, Point location, Dimension size) throws Exception {
    LayoutContainerInfo container = getContainer();
    Assert.isTrue(container.getChildren().contains(widget), "%s is not child of %s.", widget, this);
    AbsoluteDataInfo absoluteData = getAbsoluteData(widget);
    if (location != null) {
      absoluteData.materialize();
      absoluteData.getPropertyByTitle("left").setValue(location.x);
      absoluteData.getPropertyByTitle("top").setValue(location.y);
    }
    if (size != null) {
      absoluteData.setAnchor(Property.UNKNOWN_VALUE);
      widget.getSizeSupport().setSize(size);
    }
    // check creation flow
    if (location != null && useCreationFlow()) {
      // apply creation flow
      AbsoluteLayoutCreationFlowSupport.apply(
          container,
          container.getChildren(WidgetInfo.class),
          widget,
          location,
          size);
    }
  }
View Full Code Here


  // IEditPartConfigurator
  //
  ////////////////////////////////////////////////////////////////////////////
  public void configure(EditPart context, EditPart editPart) {
    if (editPart.getModel() instanceof LayoutContainerInfo) {
      LayoutContainerInfo container = (LayoutContainerInfo) editPart.getModel();
      if (container.hasLayout()) {
        new LayoutTracker(container, editPart);
      }
    }
  }
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_setLayout() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "// filler filler filler",
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "  }",
            "}");
    // set VBoxLayout
    VBoxLayoutInfo layout = createJavaInfo("com.extjs.gxt.ui.client.widget.layout.VBoxLayout");
    container.setLayout(layout);
    assertEditor(
        "// filler filler filler",
        "public class Test extends LayoutContainer {",
        "  public Test() {",
        "    setLayout(new VBoxLayout());",
        "  }",
        "}");
    assertHierarchy(
        "{this: com.extjs.gxt.ui.client.widget.LayoutContainer} {this} {/setLayout(new VBoxLayout())/}",
        "  {new: com.extjs.gxt.ui.client.widget.layout.VBoxLayout} {empty} {/setLayout(new VBoxLayout())/}");
    assertSame(layout, container.getLayout());
  }
View Full Code Here

        "  {new: com.extjs.gxt.ui.client.widget.layout.VBoxLayout} {empty} {/setLayout(new VBoxLayout())/}");
    assertSame(layout, container.getLayout());
  }

  public void test_flex() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      VBoxLayoutData data = new VBoxLayoutData();",
            "      data.setFlex(2.3);",
            "      add(button, data);",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    // current value
    assertEquals(2, boxData.getFlex());
    // set new value
    boxData.setFlex(3);
View Full Code Here

  //
  // Margins
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_getMargin() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      add(button, new VBoxLayoutData(1, 2, 3, 4));",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    // check margins
    assertEquals(1, boxData.getMarginTop());
    assertEquals(2, boxData.getMarginRight());
    assertEquals(3, boxData.getMarginBottom());
View Full Code Here

    assertEquals(3, boxData.getMarginBottom());
    assertEquals(4, boxData.getMarginLeft());
  }

  public void test_getMargin_virtual() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      add(button);",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    // check margins
    assertEquals(0, boxData.getMarginTop());
    assertEquals(0, boxData.getMarginRight());
    assertEquals(0, boxData.getMarginBottom());
View Full Code Here

    assertEquals(0, boxData.getMarginBottom());
    assertEquals(0, boxData.getMarginLeft());
  }

  public void test_marginProperties_get() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      add(button, new VBoxLayoutData(1, 2, 3, 4));",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    // check margins
    assertEquals(1, boxData.getPropertyByTitle("margin-top").getValue());
    assertEquals(2, boxData.getPropertyByTitle("margin-right").getValue());
    assertEquals(3, boxData.getPropertyByTitle("margin-bottom").getValue());
View Full Code Here

    assertEquals(3, boxData.getPropertyByTitle("margin-bottom").getValue());
    assertEquals(4, boxData.getPropertyByTitle("margin-left").getValue());
  }

  public void test_setMargin() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      add(button, new VBoxLayoutData());",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    // set margin
    boxData.setMarginTop(10);
    assertEditor(
        "public class Test extends LayoutContainer {",
View Full Code Here

        "  }",
        "}");
  }

  public void test_setMarginAll() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      add(button, new VBoxLayoutData());",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    Property marginAllProperty = boxData.getPropertyByTitle("margin-all");
    // set margin
    marginAllProperty.setValue(10);
    assertEditor(
View Full Code Here

        "  }",
        "}");
  }

  public void test_setMargin_deleteWhenZero() throws Exception {
    LayoutContainerInfo container =
        parseJavaInfo(
            "public class Test extends LayoutContainer {",
            "  public Test() {",
            "    setLayout(new VBoxLayout());",
            "    {",
            "      Button button = new Button();",
            "      add(button, new VBoxLayoutData(10, 0, 0, 0));",
            "    }",
            "  }",
            "}");
    container.refresh();
    WidgetInfo button = container.getWidgets().get(0);
    VBoxLayoutDataInfo boxData = VBoxLayoutInfo.getVBoxData(button);
    Property marginTopProperty = boxData.getPropertyByTitle("margin-top");
    // set margin
    marginTopProperty.setValue(0);
    assertEditor(
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.gxt.model.widgets.LayoutContainerInfo

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.