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

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


  ////////////////////////////////////////////////////////////////////////////
  /**
   * Parsing empty <code>com.smartgwt.client.widgets.form.FilterBuilder</code>.
   */
  public void test_parse_empty() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    final Canvas canvas = new Canvas();",
            "    FilterBuilder fb = new FilterBuilder();",
            "    canvas.addChild(fb);",
            "    canvas.draw();",
            "  }",
            "}");
    canvas.refresh();
    FilterBuilderInfo filterBuilder = canvas.getChildren(FilterBuilderInfo.class).get(0);
    //
    assertThat(filterBuilder.getChildren()).isEmpty();
    assertThat(filterBuilder.getDataSource()).isNull();
    Property property = filterBuilder.getPropertyByTitle("dataSource");
    assertThat(property).isNotNull();
View Full Code Here


  /**
   * Parsing <code>com.smartgwt.client.widgets.form.FilterBuilder</code> with assigned DataSource.
   */
  public void test_parse_dataSource() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    final Canvas canvas = new Canvas();",
            "    DataSource dataSource = new DataSource();",
            "   dataSource.addField(new DataSourceTextField('newDSTextField_1', 'New TextField'));",
            "    FilterBuilder fb = new FilterBuilder();",
            "    fb.setDataSource(dataSource);",
            "    canvas.addChild(fb);",
            "    ListGrid listGrid = new ListGrid();",
            "    listGrid.setDataSource(dataSource);",
            "    canvas.addChild(listGrid);",
            "    listGrid.moveTo(44, 90);",
            "    canvas.draw();",
            "  }",
            "}");
    canvas.refresh();
    FilterBuilderInfo filterBuilder = canvas.getChildren(FilterBuilderInfo.class).get(0);
    DataSourceInfo dataSource = filterBuilder.getDataSource();
    //
    assertThat(filterBuilder.getChildren()).isEmpty();
    Property property = filterBuilder.getPropertyByTitle("dataSource");
    assertThat(property).isNotNull();
View Full Code Here

    assertThat(property).isNotNull();
    assertThat(property.getValue()).isSameAs(dataSource.getObject());
  }

  public void test_set_dataSource() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    final Canvas canvas = new Canvas();",
            "    FilterBuilder fb = new FilterBuilder();",
            "    canvas.addChild(fb);",
            "    ListGrid listGrid = new ListGrid();",
            "    DataSource dataSource = new DataSource();",
            "   dataSource.addField(new DataSourceTextField('newDSTextField_1', 'New TextField'));",
            "    listGrid.setDataSource(dataSource);",
            "    canvas.addChild(listGrid);",
            "    listGrid.moveTo(44, 90);",
            "    canvas.draw();",
            "  }",
            "}");
    canvas.refresh();
    FilterBuilderInfo filterBuilder = canvas.getChildren(FilterBuilderInfo.class).get(0);
    ListGridInfo listGrid = canvas.getChildren(ListGridInfo.class).get(0);
    DataSourceInfo dataSource;
    {
      Property property = listGrid.getPropertyByTitle("dataSource");
      ObjectPropertyEditor editor = (ObjectPropertyEditor) property.getEditor();
      dataSource = (DataSourceInfo) editor.getValueComponent(property);
    }
    //
    assertThat(filterBuilder.getChildren()).isEmpty();
    assertThat(filterBuilder.getDataSource()).isNull();
    Property property = filterBuilder.getPropertyByTitle("dataSource");
    assertThat(property).isNotNull();
    assertThat(property.getValue()).isNotNull(); // fake data source used
    // assign DataSiurce
    ObjectPropertyEditor editor = (ObjectPropertyEditor) property.getEditor();
    editor.setComponent((GenericProperty) property, dataSource);
    canvas.refresh();
    // check
    assertThat(filterBuilder.getChildren()).isEmpty();
    assertThat(filterBuilder.getDataSource()).isSameAs(dataSource);
    assertThat(property.getValue()).isSameAs(dataSource.getObject());
    assertEditor(
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_parse_menuButton() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    MenuButton menuButton = new MenuButton('New MenuButton');",
            "    Menu menu = new Menu();",
            "    MenuItem menuItem = new MenuItem('New MenuItem');",
            "    menu.addItem(menuItem);",
            "    menuButton.setMenu(menu);",
            "    canvas.addChild(menuButton);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    MenuButtonInfo menuButton = canvas.getChildren(MenuButtonInfo.class).get(0);
    //
    MenuInfo menu = menuButton.getMenu();
    assertThat(menu).isNotNull();
    assertThat(menu.getItems().size()).isEqualTo(1);
  }
View Full Code Here

    //
    assert_sections_bounds(stack);
  }

  public void test_parse_onCanvas() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(compiledSource(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    SectionStack stack = new SectionStack();",
            "    //sectionsPlace",
            "    canvas.addChild(stack);",
            "    stack.setRect(39, 34, 270, 240);",
            "    canvas.draw();",
            "  }",
            "}"}, "stack"));
    canvas.refresh();
    SectionStackInfo stack = (SectionStackInfo) canvas.getWidgets().get(0);
    assertThat(stack.getWidgets()).isEmpty();
    // check Sections
    List<SectionStackSectionInfo> sections = stack.getSections();
    assertThat(sections.size()).isEqualTo(2);
    SectionStackSectionInfo section_1 = sections.get(0);
View Full Code Here

  /**
   * Test bounds for reverse ordered SectionStack.
   */
  public void test_parse_reverse() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(compiledSource(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    SectionStack stack = new SectionStack();",
            "    //sectionsPlace",
            "    canvas.addChild(stack);",
            "    stack.setRect(10, 10, 270, 240);",
            "    canvas.draw();",
            "  }",
            "}"}, "stack"));
    canvas.refresh();
    SectionStackInfo stack = (SectionStackInfo) canvas.getWidgets().get(0);
    stack.getPropertyByTitle("reverseOrder").setValue(true);
    // check Sections
    int width = stack.getModelBounds().width;
    List<SectionStackSectionInfo> sections = stack.getSections();
    assertThat(sections.size()).isEqualTo(2);
View Full Code Here

        "    rootPanel.add(stack, 41, 42);",
        "    stack.setSize('270px', '200px');",
        "  }",
        "}");
    // add widget on Section
    CanvasInfo newCanvas = createJavaInfo("com.smartgwt.client.widgets.Canvas");
    flowContainer_CREATE(newSection, newCanvas, null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
View Full Code Here

        "{RootPanel.get()} {local-unique: rootPanel} {/RootPanel.get()/ /rootPanel.add(tileLayout)/}",
        "  {new: com.smartgwt.client.widgets.tile.TileLayout} {local-unique: tileLayout} {/new TileLayout()/ /rootPanel.add(tileLayout)/ /tileLayout.addTile(button)/}",
        "    {new: com.smartgwt.client.widgets.Button} {local-unique: button} {/new Button()/ /tileLayout.addTile(button)/}");
    frame.refresh();
    //
    CanvasInfo button = getJavaInfoByName("button");
    Rectangle bounds = button.getBounds();
    assertThat(bounds.x).isGreaterThanOrEqualTo(0);
    assertThat(bounds.y).isGreaterThanOrEqualTo(0);
  }
View Full Code Here

            "      addTile(button);",
            "    }",
            "  }",
            "}");
    layout.refresh();
    CanvasInfo button = getJavaInfoByName("button");
    Rectangle bounds = button.getBounds();
    assertThat(bounds.x).isEqualTo(5);
    assertThat(bounds.y).isEqualTo(5);
  }
View Full Code Here

    assertThat(bounds.x).isEqualTo(5);
    assertThat(bounds.y).isEqualTo(5);
  }

  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();
    //
    TileLayoutInfo newLayout = createJavaInfo("com.smartgwt.client.widgets.tile.TileLayout");
    canvas.command_absolute_CREATE(newLayout, null);
    assertEditor(
        "// filler filler filler",
        "public class Test extends Canvas {",
        "  public Test() {",
        "    {",
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.