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

Examples of com.google.gdt.eclipse.designer.smart.model.CanvasInfo


  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_CREATE() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "// filler filler filler",
            "public class Test extends Canvas {",
            "  public Test() {",
            "  }",
            "}");
    canvas.refresh();
    assertThat(canvas.getWidgets()).isEmpty();
    //
    LayoutInfo newLayout = createJavaInfo("com.smartgwt.client.widgets.layout.HLayout");
    canvas.command_absolute_CREATE(newLayout, null);
    assertEditor(
        "// filler filler filler",
        "public class Test extends Canvas {",
        "  public Test() {",
        "    {",
View Full Code Here


            "      Button button_2 = new Button();",
            "      addMember(button_2);",
            "    }",
            "  }",
            "}");
    CanvasInfo button_1 = getJavaInfoByName("button_1");
    CanvasInfo button_2 = getJavaInfoByName("button_2");
    layout.refresh();
    //
    FlowContainer flowContainer = new FlowContainerFactory(layout, true).get().get(0);
    assertTrue(flowContainer.validateComponent(button_2));
    assertTrue(flowContainer.validateReference(button_1));
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_parse() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    ToolStrip toolStrip = new ToolStrip();",
            "    toolStrip.setVertical(true);",
            "    toolStrip.addMember(new Label('New Label'));",
            "    toolStrip.addResizer();",
            "    toolStrip.addFormItem(new TextItem('New_TextItem'));",
            "    toolStrip.addButton(new ToolStripButton('New Button'));",
            "    toolStrip.addFill();",
            "    canvas.addChild(toolStrip);",
            "    toolStrip.setRect(35, 25, 200, 200);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    // check ToolStrip
    ToolStripInfo toolStrip = canvas.getChildren(ToolStripInfo.class).get(0);
    assertThat(toolStrip.isHorizontal()).isFalse();
    // check children
    assertThat(toolStrip.getChildrenReal().size()).isEqualTo(4);
    assertThat(toolStrip.getCanvases().length).isEqualTo(4);
    List<AbstractComponentInfo> children = toolStrip.getChildren(AbstractComponentInfo.class);
View Full Code Here

      assertThat(fill.getModelBounds()).isEqualTo(new Rectangle(x, 159, 198, 40));
    }
  }

  public void test_parse_horizontal() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    ToolStrip toolStrip = new ToolStrip();",
            "    toolStrip.addMember(new Label('New Label'));",
            "    toolStrip.addResizer();",
            "    toolStrip.addButton(new ToolStripButton('New Button'));",
            "    toolStrip.addFill();",
            "    canvas.addChild(toolStrip);",
            "    toolStrip.setRect(35, 25, 200, 200);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    // check ToolStrip
    ToolStripInfo toolStrip = canvas.getChildren(ToolStripInfo.class).get(0);
    assertThat(toolStrip.isHorizontal()).isTrue();
    List<AbstractComponentInfo> children = toolStrip.getChildren(AbstractComponentInfo.class);
    assertThat(children.size()).isEqualTo(4);
    // check bounds
    {
View Full Code Here

  //
  // Exit zone :-) XXX
  //
  ////////////////////////////////////////////////////////////////////////////
  private ToolStripInfo createDefaultModule() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    ToolStrip toolStrip = new ToolStrip();",
            "    toolStrip.setVertical(true);",
            "    toolStrip.addMember(new Label('New Label'));",
            "    toolStrip.addMember(new Button('New Button'));",
            "    canvas.addChild(toolStrip);",
            "    toolStrip.setRect(35, 25, 200, 200);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    return canvas.getChildren(ToolStripInfo.class).get(0);
  }
View Full Code Here

        "  }",
        "}");
  }

  public void test_item_MOVE_ext() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo( // filler
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    DynamicForm form = new DynamicForm();",
            "    form.setFields(new FormItem[] { new TextItem('newTextItem'), new DateItem('newDateItem')});",
            "    canvas.addChild(form);",
            "    canvas.draw();",
            "  }",
            "}");
    canvas.refresh();
    DynamicFormInfo form = canvas.getChildren(DynamicFormInfo.class).get(0);
    List<FormItemInfo> items = form.getItems();
    assertThat(items.size()).isEqualTo(2);
    // create new form
    DynamicFormInfo newForm = createJavaInfo("com.smartgwt.client.widgets.form.DynamicForm");
    canvas.command_absolute_CREATE(newForm, null);
    // move field
    newForm.command_MOVE(items.get(0), null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
View Full Code Here

        "  public Test() {",
        "  }",
        "}");
    form.refresh();
    // create field
    CanvasInfo newLabel = createJavaInfo("com.smartgwt.client.widgets.Label");
    form.command_CREATE(newLabel, null);
    assertThat(newLabel.getParent()).isInstanceOf(FormItemInfo.class);
    assertThat(newLabel.getParent().getParent()).isSameAs(form);
    //
    assertEditor(
        "public class Test extends DynamicForm {",
        "  public Test() {",
        "    CanvasItem canvasItem = new CanvasItem('newCanvasItem_1', 'New CanvasItem');",
View Full Code Here

    assertThat(bounds.width).isEqualTo(BUTTON_WIDTH);
    assertThat(bounds.height).isEqualTo(BUTTON_HEIGHT);
  }

  public void test_onCanvas_setRect() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button = new Button('My Button');",
            "      addChild(button);",
            "      button.setRect(100, 50, 200, 75);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button = getJavaInfoByName("button");
    // check that location/size applied
    Rectangle bounds = button.getBounds();
    assertThat(bounds.x).isEqualTo(100);
    assertThat(bounds.y).isEqualTo(50);
    assertThat(bounds.width).isEqualTo(200);
    assertThat(bounds.height).isEqualTo(75);
  }
View Full Code Here

  //
  // Size
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_setSize_resizeTo() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button = new Button('My Button');",
            "      addChild(button);",
            "      button.resizeTo(50, 25);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button = getJavaInfoByName("button");
    //
    button.getSizeSupport().setSize(100, 50);
    assertEditor(
        "public class Test extends Canvas {",
        "  public Test() {",
        "    {",
        "      Button button = new Button('My Button');",
View Full Code Here

        "  }",
        "}");
  }

  public void test_setSize_setRect_intWidthHeight() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button = new Button('My Button');",
            "      addChild(button);",
            "      button.setRect(1, 2, 50, 25);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button = getJavaInfoByName("button");
    //
    button.getSizeSupport().setSize(100, 50);
    assertEditor(
        "public class Test extends Canvas {",
        "  public Test() {",
        "    {",
        "      Button button = new Button('My Button');",
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.smart.model.CanvasInfo

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.