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

Examples of com.google.gdt.eclipse.designer.gwtext.model.widgets.ContainerInfo


  /**
   * Test for implicit layout in {@link ContainerInfo}.
   */
  public void test_implicitLayout() throws Exception {
    prepareRowPanel();
    ContainerInfo panel =
        parseJavaInfo(
            "// filler filler filler",
            "public class Test extends RowPanel {",
            "  public Test() {",
            "  }",
            "}");
    panel.refresh();
    assertNoErrors(panel);
    assertHierarchy(
        "{this: test.client.RowPanel} {this} {}",
        "  {implicit-layout: com.gwtext.client.widgets.layout.RowLayout} {implicit-layout} {}");
    assertTrue(panel.hasLayout());
    LayoutInfo layout = panel.getLayout();
    // check association
    assertInstanceOf(ImplicitObjectAssociation.class, layout.getAssociation());
    // check creation support
    {
      ImplicitLayoutCreationSupport creationSupport =
          (ImplicitLayoutCreationSupport) layout.getCreationSupport();
      assertEquals(panel.getCreationSupport().getNode(), creationSupport.getNode());
      assertEquals(
          "implicit-layout: com.gwtext.client.widgets.layout.RowLayout",
          creationSupport.toString());
      // validation
      assertFalse(creationSupport.canReorder());
View Full Code Here


  /**
   * Test for materializing implicit {@link LayoutInfo}.
   */
  public void test_implicitLayout_2() throws Exception {
    prepareRowPanel();
    ContainerInfo panel =
        parseJavaInfo(
            "// filler filler filler",
            "public class Test extends RowPanel {",
            "  public Test() {",
            "  }",
            "}");
    LayoutInfo layout = panel.getLayout();
    assertInstanceOf(ImplicitLayoutCreationSupport.class, layout.getCreationSupport());
    // materialize by asking for expression
    {
      NodeTarget target = getNodeBlockTarget(panel, false);
      String accessExpression = layout.getVariableSupport().getAccessExpression(target);
View Full Code Here

  /**
   * Test for parsing materialized implicit layout (with {@link CastExpression}).
   */
  public void test_implicitLayout_3() throws Exception {
    prepareRowPanel();
    ContainerInfo panel =
        parseJavaInfo(
            "import com.gwtext.client.widgets.layout.RowLayout;",
            "public class Test extends RowPanel {",
            "  public Test() {",
            "    RowLayout rowLayout = (RowLayout) getLayout();",
            "  }",
            "}");
    // initial state
    {
      LayoutInfo layout = panel.getLayout();
      {
        CreationSupport creationSupport = layout.getCreationSupport();
        assertInstanceOf(ImplicitLayoutCreationSupport.class, creationSupport);
        assertTrue(creationSupport.canDelete());
      }
      {
        VariableSupport variableSupport = layout.getVariableSupport();
        assertInstanceOf(LocalUniqueVariableSupport.class, variableSupport);
        assertEquals("rowLayout", variableSupport.getName());
      }
      assertInstanceOf(ImplicitObjectAssociation.class, layout.getAssociation());
    }
    // check for "de-materializing" implicit layout
    {
      panel.getLayout().delete();
      assertEditor(
          "import com.gwtext.client.widgets.layout.RowLayout;",
          "public class Test extends RowPanel {",
          "  public Test() {",
          "  }",
          "}");
      // still implicit layout
      LayoutInfo layout = panel.getLayout();
      assertInstanceOf(ImplicitLayoutCreationSupport.class, layout.getCreationSupport());
      assertInstanceOf(ImplicitLayoutVariableSupport.class, layout.getVariableSupport());
      assertInstanceOf(ImplicitObjectAssociation.class, layout.getAssociation());
      assertEquals(
          "implicit-layout: com.gwtext.client.widgets.layout.RowLayout",
View Full Code Here

  /**
   * Test for {@link ContainerInfo#setLayout(LayoutInfo)}.
   */
  public void test_setLayout() throws Exception {
    ContainerInfo panel =
        parseJavaInfo(
            "// filler filler filler",
            "public class Test extends Panel {",
            "  public Test() {",
            "  }",
            "}");
    panel.refresh();
    // initial state
    assertInstanceOf(DefaultLayoutInfo.class, panel.getLayout());
    assertHierarchy(
        "{this: com.gwtext.client.widgets.Panel} {this} {}",
        "  {implicit-layout: default} {implicit-layout} {}");
    // set RowLayout
    {
      LayoutInfo layout = createJavaInfo("com.gwtext.client.widgets.layout.RowLayout");
      panel.setLayout(layout);
      assertEditor(
          "// filler filler filler",
          "public class Test extends Panel {",
          "  public Test() {",
          "    setLayout(new RowLayout());",
          "  }",
          "}");
      assertHierarchy(
          "{this: com.gwtext.client.widgets.Panel} {this} {/setLayout(new RowLayout())/}",
          "  {new: com.gwtext.client.widgets.layout.RowLayout} {empty} {/setLayout(new RowLayout())/}");
      assertSame(layout, panel.getLayout());
    }
    // set ColumnLayout
    {
      LayoutInfo layout = createJavaInfo("com.gwtext.client.widgets.layout.ColumnLayout");
      panel.setLayout(layout);
      assertEditor(
          "// filler filler filler",
          "public class Test extends Panel {",
          "  public Test() {",
          "    setLayout(new ColumnLayout());",
          "  }",
          "}");
      assertHierarchy(
          "{this: com.gwtext.client.widgets.Panel} {this} {/setLayout(new ColumnLayout())/}",
          "  {new: com.gwtext.client.widgets.layout.ColumnLayout} {empty} {/setLayout(new ColumnLayout())/}");
      assertSame(layout, panel.getLayout());
    }
  }
View Full Code Here

  /**
   * Test for {@link ContainerInfo#setLayout(LayoutInfo)}.
   */
  public void test_setLayout_order() throws Exception {
    ContainerInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    add(new com.google.gwt.user.client.ui.Button());",
            "  }",
            "}");
    assertHierarchy(
        "{this: com.gwtext.client.widgets.Panel} {this} {/add(new com.google.gwt.user.client.ui.Button())/}",
        "  {implicit-layout: default} {implicit-layout} {}",
        "  {new: com.google.gwt.user.client.ui.Button} {empty} {/add(new com.google.gwt.user.client.ui.Button())/}");
    // set RowLayout
    LayoutInfo layout = createJavaInfo("com.gwtext.client.widgets.layout.RowLayout");
    assertSame(ComponentOrderFirst.INSTANCE, layout.getDescription().getOrder());
    panel.setLayout(layout);
    assertEditor(
        "public class Test extends Panel {",
        "  public Test() {",
        "    setLayout(new RowLayout());",
        "    add(new com.google.gwt.user.client.ui.Button());",
View Full Code Here

  /**
   * Test for deleting {@link LayoutInfo} and replacing with default one.
   */
  public void test_deleteLayout() throws Exception {
    ContainerInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new RowLayout());",
            "  }",
            "}");
    panel.refresh();
    // initial state
    assertHierarchy(
        "{this: com.gwtext.client.widgets.Panel} {this} {/setLayout(new RowLayout())/}",
        "  {new: com.gwtext.client.widgets.layout.RowLayout} {empty} {/setLayout(new RowLayout())/}");
    // delete layout
    panel.getLayout().delete();
    assertHierarchy(
        "{this: com.gwtext.client.widgets.Panel} {this} {}",
        "  {implicit-layout: default} {implicit-layout} {}");
    assertEditor("public class Test extends Panel {", "  public Test() {", "  }", "}");
  }
View Full Code Here

  /**
   * Test for {@link ContainerInfo#getID(WidgetInfo)} and
   * {@link ContainerInfo#getWidgetByID(String)}.
   */
  public void test_ID() throws Exception {
    ContainerInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    add(new com.gwtext.client.widgets.form.Label());",
            "    add(new com.google.gwt.user.client.ui.Button());",
            "  }",
            "}");
    panel.refresh();
    WidgetInfo label = panel.getChildrenWidgets().get(0);
    WidgetInfo button = panel.getChildrenWidgets().get(1);
    // getID()
    String labelID = ContainerInfo.getID(label);
    String buttonID = ContainerInfo.getID(button);
    assertThat(labelID).startsWith("ext-gen");
    assertThat(buttonID).startsWith("ext-gen");
    // getWidgetByID
    assertSame(null, panel.getWidgetByID("no such ID"));
    assertSame(label, panel.getWidgetByID(labelID));
    assertSame(button, panel.getWidgetByID(buttonID));
  }
View Full Code Here

            "    <parameter name='layout.has'>true</parameter>",
            "  </parameters>",
            "</component>"));
    waitForAutoBuild();
    //
    ContainerInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    add(new MyContainer());",
            "  }",
            "}");
    assertHierarchy(
        "{this: com.gwtext.client.widgets.Panel} {this} {/add(new MyContainer())/}",
        "  {implicit-layout: default} {implicit-layout} {}",
        "  {new: test.client.MyContainer} {empty} {/add(new MyContainer())/}");
    // no Layout for placeholder
    ContainerInfo placeholder = (ContainerInfo) panel.getChildrenWidgets().get(0);
    assertTrue(placeholder.isPlaceholder());
    assertFalse(placeholder.hasLayout());
    // only "actual" exception
    panel.refresh();
    assert_placeholderException();
  }
View Full Code Here

            "  }",
            "}"};
    setFileContentSrc("test/client/MyContainer.java", getTestSource(lines));
    waitForAutoBuild();
    //
    ContainerInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    add(new MyContainer());",
            "  }",
            "}");
    assertHierarchy(
        "{this: com.gwtext.client.widgets.Panel} {this} {/add(new MyContainer())/}",
        "  {implicit-layout: default} {implicit-layout} {}",
        "  {new: test.client.MyContainer} {empty} {/add(new MyContainer())/}");
    // no Layout for placeholder
    ContainerInfo placeholder = (ContainerInfo) panel.getChildrenWidgets().get(0);
    assertTrue(placeholder.isPlaceholder());
    assertFalse(placeholder.hasLayout());
    // only "actual" exception
    panel.refresh();
    assert_placeholderException();
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Test that {@link ContainerInfo} contributes "Set layout" sub-menu in context menu.
   */
  public void test_setLayoutMenu_1() throws Exception {
    ContainerInfo panel =
        parseJavaInfo(
            "import com.gwtext.client.widgets.Panel;",
            "public class Test extends Panel {",
            "  public Test() {",
            "  }",
            "}");
    panel.refresh();
    assertTrue(panel.hasLayout());
    // prepare "Set Layout" menu manager
    IMenuManager layoutManager;
    {
      IMenuManager menuManager = getContextMenu(panel);
      layoutManager = findChildMenuManager(menuManager, "Set layout");
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.gwtext.model.widgets.ContainerInfo

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.