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

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


        "  }",
        "}");
  }

  public void test_menu_CREATE() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    MenuBar menuBar = new MenuBar();",
            "    Menu menu = new Menu();",
            "    MenuItem menuItem = new MenuItem('New MenuItem');",
            "    menu.addItem(menuItem);",
            "    menuBar.setMenus(new Menu[] { menu });",
            "    canvas.addChild(menuBar);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    MenuBarInfo menuBar = canvas.getChildren(MenuBarInfo.class).get(0);
    // create new Menu
    MenuInfo newMenu = createJavaInfo("com.smartgwt.client.widgets.menu.Menu");
    menuBar.command_CREATE(newMenu, menuBar.getMenus().get(0));
    assertEditor(
        "public class Test implements EntryPoint {",
View Full Code Here


        "  }",
        "}");
  }

  public void test_menu_MOVE() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    MenuBar menuBar = new MenuBar();",
            "    Menu menu = new Menu();",
            "    MenuItem menuItem = new MenuItem('New MenuItem');",
            "    menu.addItem(menuItem);",
            "    menuBar.setMenus(new Menu[] { new Menu(), menu });",
            "    canvas.addChild(menuBar);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    MenuBarInfo menuBar = canvas.getChildren(MenuBarInfo.class).get(0);
    // move Menu
    menuBar.command_MOVE(menuBar.getMenus().get(0), null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
View Full Code Here

        "  }",
        "}");
  }

  public void test_menu_ADD() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    MenuBar menuBar = new MenuBar();",
            "    {",
            "      Menu menu = new Menu();",
            "      MenuItem menuItem = new MenuItem('New MenuItem');",
            "      menu.addItem(menuItem);",
            "      menuBar.setMenus(new Menu[] { new Menu(), menu });",
            "    }",
            "    canvas.addChild(menuBar);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    MenuBarInfo menuBar = canvas.getChildren(MenuBarInfo.class).get(0);
    //
    MenuBarInfo newMenuBar = createJavaInfo("com.smartgwt.client.widgets.menu.MenuBar");
    canvas.command_absolute_CREATE(newMenuBar, null);
    //
    MenuInfo menu = menuBar.getMenus().get(1);
    newMenuBar.command_MOVE(menu, null);
    assertEditor(
        "public class Test implements EntryPoint {",
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_vertical() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Slider slider = new Slider();",
            "      addChild(slider);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo slider = getJavaInfoByName("slider");
    assertThat(slider.getBounds().height).isGreaterThan(200);
  }
View Full Code Here

    CanvasInfo slider = getJavaInfoByName("slider");
    assertThat(slider.getBounds().height).isGreaterThan(200);
  }

  public void test_horizontal() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Slider slider = new Slider();",
            "      slider.setVertical(false);",
            "      addChild(slider);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo slider = getJavaInfoByName("slider");
    assertThat(slider.getBounds().width).isGreaterThan(200);
  }
View Full Code Here

        "}");
  }

  @SuppressWarnings("unchecked")
  public void test_ADD() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "  Canvas canvas = new Canvas();",
            "  " + m_tableClassShortName + " table = new " + m_tableClassShortName + "();",
            "    "
                + m_fieldClassShortName
                + " field = new "
                + m_fieldClassShortName
                + "('field', 'Field');",
            "    table.setFields(new " + m_fieldClassShortName + "[] { field });",
            "    canvas.addChild(table);",
            "    canvas.draw();",
            "  }",
            "}");
    canvas.refresh();
    // table
    T table = getJavaInfoByName("table");
    List<?> fields = (List<?>) ReflectionUtils.invokeMethodEx(table, "getFields()");
    // new table
    T newTable = createJavaInfo(m_tableClassName);
    canvas.command_absolute_CREATE(newTable, null);
    // move field
    F field = (F) fields.get(0);
    ReflectionUtils.invokeMethodEx(newTable, "command_MOVE("
        + field.getClass().getName()
        + ","
View Full Code Here

        "  }",
        "}");
    form.refresh();
    //
    CanvasItemInfo canvasItem = (CanvasItemInfo) form.getItems().get(0);
    CanvasInfo canvas = canvasItem.getCanvas();
    assertThat(canvas).isNotNull();
    assertThat(canvasItem.getBounds().getSize()).isEqualTo(new Dimension(350, 100));
  }
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_parse() throws Exception {
    CanvasInfo calendar =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Calendar calendar = new Calendar();",
            "    DataSource dataSource = new DataSource();",
            "    dataSource.setID('DS');",
            "    DataSourceBooleanField dataSourceBooleanField = new DataSourceBooleanField('dsBooleanField');",
            "    dataSource.addField(dataSourceBooleanField);",
            "    DataSourceDateField dataSourceDateField = new DataSourceDateField('dsDateField');",
            "    dataSource.setFields(dataSourceDateField);",
            "    calendar.setDataSource(dataSource);",
            "    calendar.draw();",
            "  }",
            "}"});
    calendar.refresh();
    //
    DataSourceInfo dataSource =
        NonVisualBeanContainerInfo.get(calendar).getChildren(DataSourceInfo.class).get(0);
    assertThat(NonVisualBeanInfo.getNonVisualInfo(dataSource).getLocation()).isNull();
    // check fields
View Full Code Here

  /**
   * http://forums.instantiations.com/viewtopic.php?f=11&t=5401
   */
  public void test_parse_anonymous() throws Exception {
    CanvasInfo calendar =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Calendar calendar = new Calendar();",
            "    DataSource dataSource = new RestDataSource() {};",
            "    calendar.setDataSource(dataSource);",
            "    calendar.draw();",
            "  }",
            "}"});
    calendar.refresh();
    assertNoErrors(calendar);
    //
    List<DataSourceInfo> dataSources =
        NonVisualBeanContainerInfo.get(calendar).getChildren(DataSourceInfo.class);
    assertThat(dataSources).isNotEmpty();
    assertThat(calendar.getPropertyByTitle("dataSource").getValue()).isSameAs(
        dataSources.get(0).getObject());
  }
View Full Code Here

   * Test for no "destroy()" on dispose DataSource if it is not rendered.
   * <p>
   * Note: no error messages windows must be popped up due this test.
   */
  public void test_noDestroy() throws Exception {
    CanvasInfo calendar =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  /**",
            "  *@wbp.nonvisual location=0,0",
            "  */",
            "  private DataSource dataSource = new DataSource();",
            "  public void onModuleLoad() {",
            "    dataSource.setID('DS');",
            "    Calendar calendar = new Calendar();",
            "    calendar.draw();",
            "  }",
            "}"});
    calendar.refresh();
    assertNoErrors(calendar);
    JavaInfo dataSource = getJavaInfoByName("dataSource");
    assertNoErrors(dataSource);
    // no error messages must be popped
  }
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.