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

Examples of com.google.gdt.eclipse.designer.model.widgets.WidgetInfo


            "      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


            "      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(newHeight, bounds.height);
    }
  }

  public void test_sizeInvocation_setSize_strings() throws Exception {
    WidgetInfo panel =
        parseJavaInfo(
            "// filler filler filler filler filler",
            "public class Test extends HorizontalPanel {",
            "  public Test() {",
            "    setSize('300px', '200px');",
            "  }",
            "}");
    panel.refresh();
    // initial size
    {
      Rectangle bounds = panel.getBounds();
      assertEquals(300, bounds.width);
      assertEquals(200, bounds.height);
    }
    // set bounds
    int newWidth = 500;
    int newHeight = 350;
    panel.getTopBoundsSupport().setSize(newWidth, newHeight);
    assertEditor(
        "// filler filler filler filler filler",
        "public class Test extends HorizontalPanel {",
        "  public Test() {",
        "    setSize('500px', '350px');",
        "  }",
        "}");
    // check that size applied
    panel.refresh();
    {
      Rectangle bounds = panel.getBounds();
      assertEquals(newWidth, bounds.width);
      assertEquals(newHeight, bounds.height);
    }
  }
View Full Code Here

            "      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

            "      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

            "      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

      assertEquals(newHeight, bounds.height);
    }
  }

  public void test_sizeInvocation_setWidth_setHeight_string() throws Exception {
    WidgetInfo panel =
        parseJavaInfo(
            "// filler filler filler filler filler",
            "public class Test extends HorizontalPanel {",
            "  public Test() {",
            "    setWidth('300px');",
            "    setHeight('200px');",
            "  }",
            "}");
    panel.refresh();
    // initial size
    {
      Rectangle bounds = panel.getBounds();
      assertEquals(300, bounds.width);
      assertEquals(200, bounds.height);
    }
    // set bounds
    int newWidth = 500;
    int newHeight = 350;
    panel.getTopBoundsSupport().setSize(newWidth, newHeight);
    assertEditor(
        "// filler filler filler filler filler",
        "public class Test extends HorizontalPanel {",
        "  public Test() {",
        "    setWidth('500px');",
        "    setHeight('350px');",
        "  }",
        "}");
    // check that size applied
    panel.refresh();
    {
      Rectangle bounds = panel.getBounds();
      assertEquals(newWidth, bounds.width);
      assertEquals(newHeight, bounds.height);
    }
  }
View Full Code Here

            "  }",
            "}");
    canvas.refresh();
    assertThat(canvas.getWidgets()).isEmpty();
    //
    WidgetInfo newButton = createButton();
    canvas.command_absolute_CREATE(newButton, null);
    assertEditor(
        "// filler filler filler",
        "public class Test extends Canvas {",
        "  public Test() {",
View Full Code Here

            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button_1 = getJavaInfoByName("button_1");
    //
    WidgetInfo newButton = createButton();
    canvas.command_absolute_CREATE(newButton, button_1);
    assertEditor(
        "public class Test extends Canvas {",
        "  public Test() {",
        "    {",
View Full Code Here

            "  }",
            "}");
    canvas.refresh();
    assertThat(canvas.getWidgets()).isEmpty();
    // create GWT TextBox
    WidgetInfo newTextBox = createJavaInfo("com.google.gwt.user.client.ui.TextBox");
    canvas.command_absolute_CREATE(newTextBox, null);
    // check
    assertThat(canvas.getWidgets()).excludes(newTextBox);
    WidgetCanvasInfo widgetCanvas = canvas.getChildren(WidgetCanvasInfo.class).get(0);
    // check presentation
    {
      IObjectPresentation presentation = widgetCanvas.getPresentation();
      IObjectPresentation widgetPresentation = newTextBox.getPresentation();
      assertThat(presentation.getText().startsWith(widgetPresentation.getText())).isTrue();
      assertThat(presentation.getIcon()).isSameAs(widgetPresentation.getIcon());
    }
    assertThat(widgetCanvas.getWidget()).isSameAs(newTextBox);
    assertEditor(
        "import com.google.gwt.user.client.ui.TextBox;",
        "// filler filler filler",
        "public class Test extends Canvas {",
        "  public Test() {",
        "    {",
        "      WidgetCanvas widgetCanvas = new WidgetCanvas(new TextBox());",
        "      addChild(widgetCanvas);",
        "    }",
        "  }",
        "}");
    // check presentation
    IObjectPresentation presentation = widgetCanvas.getPresentation();
    assertThat(presentation.getChildrenGraphical()).excludes(newTextBox);
    assertThat(presentation.getChildrenTree()).excludes(newTextBox);
    // check properties
    {
      Property[] canvasProperties = widgetCanvas.getProperties();
      Property[] textProperties = newTextBox.getProperties();
      assertThat(canvasProperties).contains((Object[]) textProperties);
    }
    Property canvasProperty = widgetCanvas.getPropertyByTitle("Canvas");
    assertThat(canvasProperty).isInstanceOf(ComplexProperty.class);
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.WidgetInfo

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.