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

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


  ////////////////////////////////////////////////////////////////////////////
  /**
   * If content widget has forced size, use it.
   */
  public void test_applySize_sizeOfContentWidget() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test() {",
            "    {",
            "      Button button = new Button();",
            "      initWidget(button);",
            "      button.setSize('200px', '100px');",
            "    }",
            "  }",
            "}");
    composite.refresh();
    // check Composite bounds
    Rectangle bounds = composite.getBounds();
    assertEquals(new Rectangle(0, 0, 200, 100), bounds);
  }
View Full Code Here


  /**
   * If no forced size for content widget, use externally specified size of Composite.
   */
  public void test_applySize_sizeOfComposite() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test() {",
            "    {",
            "      Button button = new Button();",
            "      initWidget(button);",
            "    }",
            "  }",
            "}");
    composite.refresh();
    // set external size
    composite.getTopBoundsSupport().setSize(300, 150);
    composite.refresh();
    // check Composite bounds
    Rectangle bounds = composite.getBounds();
    assertEquals(new Rectangle(0, 0, 300, 150), bounds);
  }
View Full Code Here

   * I don't know why users try to set "0" as size, but they do. :-)
   * <p>
   * http://fogbugz.instantiations.com/fogbugz/default.php?41768
   */
  public void test_badSize() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test() {",
            "    {",
            "      AbsolutePanel absolutePanel = new AbsolutePanel();",
            "      initWidget(absolutePanel);",
            "      absolutePanel.setSize('450px', '300px');",
            "      {",
            "        Label label = new Label('New label');",
            "        absolutePanel.add(label, 10, 10);",
            "      }",
            "    }",
            "    setSize('400px', '0px');",
            "  }",
            "}");
    composite.refresh();
    assertNoErrors(composite);
    // check Composite bounds
    Rectangle bounds = composite.getBounds();
    assertEquals(new Rectangle(0, 0, 400, 0), bounds);
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Direct <code>Composite</code> subclass is simple container.
   */
  public void test_simpleContainer_good() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "// filler filler filler filler filler",
            "public class Test extends Composite {",
            "  public Test() {",
            "  }",
View Full Code Here

  /**
   * While <code>TabPanel</code> is subclass of <code>Composite</code>, it is not simple container.
   */
  public void test_simpleContainer_TabPanel() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "// filler filler filler filler filler",
            "public class Test extends TabPanel {",
            "  public Test() {",
            "  }",
View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  private void test_parse(String... lines) throws Exception {
    RootPanelInfo frame = parseJavaInfo(lines);
    frame.refresh();
    CompositeInfo cellBrowser = (CompositeInfo) frame.getChildrenWidgets().get(0);
    assertNoErrors(cellBrowser);
    {
      // check class
      Class<?> cellBrowserClass = cellBrowser.getDescription().getComponentClass();
      assertTrue(ReflectionUtils.isSuccessorOf(
          cellBrowserClass,
          "com.google.gwt.user.cellview.client.CellBrowser"));
    }
    {
      // check properties
      Property[] properties = cellBrowser.getProperties();
      assertTrue(properties.length > 0);
      {
        ComplexProperty constructorProperty =
            (ComplexProperty) cellBrowser.getPropertyByTitle("Constructor");
        assertNull(constructorProperty);
        // check if <tag name="property.no" value="true"/> removed
        //Property[] constructorProperties = constructorProperty.getProperties();
        //assertNotNull(constructorProperties[1].getTitle());
      }
View Full Code Here

            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    frame.refresh();
    //
    CompositeInfo cellBrowser = createJavaInfo("com.google.gwt.user.cellview.client.CellBrowser");
    frame.command_CREATE2(cellBrowser, null);
    frame.command_BOUNDS(cellBrowser, new Point(10, 10), null);
    //
    assertEditor(
        "import com.google.gwt.user.cellview.client.CellBrowser;",
View Full Code Here

  //
  ////////////////////////////////////////////////////////////////////////////
  private void test_parse(String... lines) throws Exception {
    RootPanelInfo frame = parseJavaInfo(lines);
    frame.refresh();
    CompositeInfo cellTree = (CompositeInfo) frame.getChildrenWidgets().get(0);
    assertNoErrors(cellTree);
    {
      // check class
      Class<?> cellTreeClass = cellTree.getDescription().getComponentClass();
      assertTrue(ReflectionUtils.isSuccessorOf(
          cellTreeClass,
          "com.google.gwt.user.cellview.client.CellTree"));
    }
    {
      // check properties
      Property[] properties = cellTree.getProperties();
      assertTrue(properties.length > 0);
      {
        ComplexProperty constructorProperty =
            (ComplexProperty) cellTree.getPropertyByTitle("Constructor");
        assertNull(constructorProperty);
        // check if <tag name="property.no" value="true"/> removed
        //Property[] constructorProperties = constructorProperty.getProperties();
        //assertNotNull(constructorProperties[1].getTitle());
      }
View Full Code Here

            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    frame.refresh();
    //
    CompositeInfo cellTree = createJavaInfo("com.google.gwt.user.cellview.client.CellTree");
    frame.command_CREATE2(cellTree, null);
    frame.command_BOUNDS(cellTree, new Point(10, 10), null);
    //
    assertEditor(
        "import com.google.gwt.user.cellview.client.CellTree;",
View Full Code Here

    frame.refresh();
    assertNoErrors(frame);
  }

  public void test_parseOnComposite() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test() {",
            "    GridPanel grid = new GridPanel();",
            "    initWidget(grid);",
            "    grid.setSize('300px', '200px');",
            "  }",
            "}");
    assertNoErrors(composite);
    // check hierarchy
    assertHierarchy(
        "{this: com.google.gwt.user.client.ui.Composite} {this} {/initWidget(grid)/}",
        "  {new: com.gwtext.client.widgets.grid.GridPanel} {local-unique: grid} {/new GridPanel()/ /initWidget(grid)/ /grid.setSize('300px', '200px')/}");
    // refresh()
    composite.refresh();
    assertNoErrors(composite);
    // check bounds
    {
      Rectangle compositeBounds = composite.getBounds();
      assertThat(compositeBounds.width).isEqualTo(300);
      assertThat(compositeBounds.height).isEqualTo(200);
    }
    {
      Rectangle gridBounds = composite.getWidget().getBounds();
      assertThat(gridBounds.width).isEqualTo(300);
      assertThat(gridBounds.height).isEqualTo(200);
    }
  }
View Full Code Here

TOP

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

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.