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

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


   * Test for <code>HTMLPanel</code> on <code>Composite</code>.
   * <p>
   * http://fogbugz.instantiations.com/fogbugz/default.php?41059
   */
  public void test_parse_onComposite() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test() {",
            "    HTMLPanel panel = new HTMLPanel('<div id=\\'one\\'></div>');",
            "    initWidget(panel);",
            "    {",
            "      Button button = new Button();",
            "      panel.add(button, 'one');",
            "    }",
            "  }",
            "}");
    assertNoErrors(composite);
    assertHierarchy(
        "{this: com.google.gwt.user.client.ui.Composite} {this} {/initWidget(panel)/}",
        "  {new: com.google.gwt.user.client.ui.HTMLPanel} {local-unique: panel} {/new HTMLPanel('<div id=\\'one\\'></div>')/ /initWidget(panel)/ /panel.add(button, 'one')/}",
        "    {new: com.google.gwt.user.client.ui.Button} {local-unique: button} {/new Button()/ /panel.add(button, 'one')/}");
    // refresh
    composite.refresh();
    assertNoErrors(composite);
  }
View Full Code Here


            "  }",
            "  protected abstract Widget createMyWidget();",
            "}"));
    waitForAutoBuild();
    // parse
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends MyComposite {",
            "  public Test() {",
            "  }",
            "  protected Widget createMyWidget() {",
            "    Button button = new Button();",
            "    return button;",
            "  }",
            "}");
    composite.refresh();
    assertHierarchy(
        "{this: test.client.MyComposite} {this} {}",
        "  {new: com.google.gwt.user.client.ui.Button} {local-unique: button} {/new Button()/ /button/}");
  }
View Full Code Here

            "public interface MyImageBundle extends ImageBundle {",
            "  AbstractImagePrototype first();",
            "}"));
    waitForAutoBuild();
    // parse
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test(MyImageBundle images) {",
            "    Image image = images.first().createImage();",
            "    initWidget(image);",
            "  }",
            "}");
    // check hierarchy
    assertHierarchy(
        "{this: com.google.gwt.user.client.ui.Composite} {this} {/initWidget(image)/}",
        "  {opaque} {local-unique: image} {/images.first().createImage()/ /initWidget(image)/}");
    // refresh
    composite.refresh();
    assertNoErrors(composite);
  }
View Full Code Here

            "      rootPanel.add(valueListBox);",
            "    }",
            "  }",
            "}");
    frame.refresh();
    CompositeInfo valueListBox = (CompositeInfo) frame.getChildrenWidgets().get(0);
    Class<?> valueListBoxClass = valueListBox.getDescription().getComponentClass();
    assertTrue(ReflectionUtils.isSuccessorOf(
        valueListBoxClass,
        "com.google.gwt.user.client.ui.ValueListBox"));
  }
View Full Code Here

            "    RootPanel rootPanel = RootPanel.get();",
            "  }",
            "}");
    frame.refresh();
    // create
    CompositeInfo valuePicker = createJavaInfo("com.google.gwt.user.client.ui.ValueListBox");
    frame.command_CREATE2(valuePicker, null);
    assertEditor(
        "public class Test implements EntryPoint {",
        "  public void onModuleLoad() {",
        "    RootPanel rootPanel = RootPanel.get();",
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_filled() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends ResizeComposite {",
            "  public Test() {",
            "    {",
            "      LayoutPanel panel = new LayoutPanel();",
            "      initWidget(panel);",
            "    }",
            "  }",
            "}");
    assertHierarchy(
        "{this: com.google.gwt.user.client.ui.ResizeComposite} {this} {/initWidget(panel)/}",
        "  {new: com.google.gwt.user.client.ui.LayoutPanel} {local-unique: panel} {/new LayoutPanel()/ /initWidget(panel)/}");
    WidgetInfo panel = composite.getWidget();
    // do refresh()
    composite.refresh();
    assertNoErrors(composite);
    assertFalse(composite.isEmpty());
    // check Composite bounds
    {
      Rectangle bounds = composite.getBounds();
      assertEquals(new Rectangle(0, 0, 450, 300), bounds);
    }
    {
      Image image = composite.getImage();
      assertNotNull(image);
      assertThat(image.getBounds().width).isEqualTo(450);
      assertThat(image.getBounds().height).isEqualTo(300);
    }
    // check Button bounds
View Full Code Here

      assertEquals(new Rectangle(0, 0, 450, 300), bounds);
    }
  }

  public void test_empty() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "// filler filler filler",
            "public class Test extends ResizeComposite {",
            "  public Test() {",
            "  }",
            "}");
    assertHierarchy("{this: com.google.gwt.user.client.ui.ResizeComposite} {this} {}");
    // do refresh()
    composite.refresh();
    assertTrue(composite.isEmpty());
    assertNull(composite.getWidget());
    // no properties
    assertThat(composite.getProperties()).isEmpty();
  }
View Full Code Here

            "      rootPanel.add(dateBox);",
            "    }",
            "  }",
            "}");
    frame.refresh();
    CompositeInfo dateBox = (CompositeInfo) frame.getChildrenWidgets().get(0);
    assertFalse(dateBox.shouldDrawDotsBorder());
  }
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_case39835() throws Exception {
    CompositeInfo composite =
        openComposite(
            "public class Test extends Composite {",
            "  public Test() {",
            "    Grid grid = new Grid(1, 2);",
            "    initWidget(grid);",
            "    {",
            "      FlexTable flexTable = new FlexTable();",
            "      grid.setWidget(0, 1, flexTable);",
            "      {",
            "        Grid grid_1 = new Grid(1, 2);",
            "        flexTable.setWidget(0, 0, grid_1);",
            "        grid_1.setWidget(0, 0, new Label('AAAAAA'));",
            "        grid_1.setWidget(0, 1, new Label('BBBBBB'));",
            "      }",
            "    }",
            "  }",
            "}");
    GridInfo grid = (GridInfo) composite.getWidget();
    FlexTableInfo flexTable = (FlexTableInfo) grid.getChildrenWidgets().get(0);
    GridInfo grid_1 = (GridInfo) flexTable.getChildrenWidgets().get(0);
    WidgetInfo label = grid_1.getChildrenWidgets().get(0);
    // select "label"
    canvas.select(label);
View Full Code Here

  //
  // Tests
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_filled() throws Exception {
    CompositeInfo composite =
        parseJavaInfo(
            "public class Test extends Composite {",
            "  public Test() {",
            "    {",
            "      Button button = new Button();",
            "      initWidget(button);",
            "    }",
            "  }",
            "}");
    assertHierarchy(
        "{this: com.google.gwt.user.client.ui.Composite} {this} {/initWidget(button)/}",
        "  {new: com.google.gwt.user.client.ui.Button} {local-unique: button} {/new Button()/ /initWidget(button)/}");
    WidgetInfo button = composite.getWidget();
    // do refresh()
    composite.refresh();
    assertFalse(composite.isEmpty());
    // check Composite bounds
    {
      Rectangle bounds = composite.getBounds();
      assertEquals(new Rectangle(0, 0, 450, 300), bounds);
    }
    {
      Image image = composite.getImage();
      assertNotNull(image);
      assertThat(image.getBounds().width).isEqualTo(450);
      assertThat(image.getBounds().height).isEqualTo(300);
    }
    // check Button bounds
    {
      Rectangle bounds = button.getBounds();
      assertEquals(new Rectangle(0, 0, 450, 300), bounds);
    }
    // set new bounds
    {
      composite.getTopBoundsSupport().setSize(500, 250);
      composite.refresh();
      assertEquals(new Rectangle(0, 0, 500, 250), composite.getBounds());
    }
  }
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.