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

Examples of com.google.gdt.eclipse.designer.model.widgets.panels.DockLayoutPanelInfo


  /**
   * Test for decorating {@link WidgetInfo} presentation text.
   */
  public void test_decorateWidgetText() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.CM);",
            "    {",
            "      Button button_1 = new Button();",
            "      addWest(button_1, 1.0);",
            "    }",
            "    {",
            "      Button button_2 = new Button();",
            "      addNorth(button_2, 1.0);",
            "    }",
            "    {",
            "      Button button_3 = new Button();",
            "      addEast(button_3, 1.0);",
            "    }",
            "    {",
            "      Button button_4 = new Button();",
            "      addSouth(button_4, 1.0);",
            "    }",
            "    {",
            "      Button button_5 = new Button();",
            "      add(button_5);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    {
      WidgetInfo button_1 = getJavaInfoByName("button_1");
      String text = ObjectsLabelProvider.INSTANCE.getText(button_1);
      assertThat(text).startsWith("WEST - ");
    }
View Full Code Here


  ////////////////////////////////////////////////////////////////////////////
  /**
   * Test for "Edge" property, contributed to child {@link WidgetInfo}.
   */
  public void test_propertyEdge() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.CM);",
            "    {",
            "      Button button = new Button();",
            "      addWest(button, 1.0);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    assertNoErrors(panel);
    WidgetInfo button = getJavaInfoByName("button");
    // prepare "Edge" property
    Property property = button.getPropertyByTitle("Edge");
    assertNotNull(property);
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Test for {@link DockLayoutPanelInfo#getSize(WidgetInfo)}.
   */
  public void test_getSize() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.MM);",
            "    {",
            "      Button button_1 = new Button();",
            "      addWest(button_1, 1.0);",
            "    }",
            "    {",
            "      Button button_2 = new Button();",
            "      addNorth(button_2, 2.0);",
            "    }",
            "    {",
            "      Button button_3 = new Button();",
            "      addEast(button_3, 3.0);",
            "    }",
            "    {",
            "      Button button_4 = new Button();",
            "      addSouth(button_4, 4.0);",
            "    }",
            "    {",
            "      Button button_5 = new Button();",
            "      add(button_5);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    {
      WidgetInfo button_1 = getJavaInfoByName("button_1");
      assertEquals(1.0, getSize(button_1), 0.001);
    }
    {
View Full Code Here

   * Test for {@link DockLayoutPanelInfo#getSize(WidgetInfo)}.
   * <p>
   * http://fogbugz.instantiations.com/fogbugz/default.php?45071
   */
  public void test_getSize_integer() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.MM);",
            "    {",
            "      Button button = new Button();",
            "      addWest(button, 20);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    //
    WidgetInfo button = getJavaInfoByName("button");
    assertEquals(20.0, getSize(button), 0.001);
  }
View Full Code Here

  /**
   * Test for {@link DockLayoutPanelInfo#setSize(WidgetInfo, double)}.
   */
  public void test_setSize() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.CM);",
            "    {",
            "      Button button = new Button();",
            "      addWest(button, 1.0);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    //
    setSize(button, 2.52);
    assertEditor(
        "public class Test extends DockLayoutPanel {",
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Test for {@link DockLayoutPanelInfo#getSizeInUnits(int, boolean)}.
   */
  public void test_getSizeInUnits_PX() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.PX);",
            "  }",
            "}");
    panel.refresh();
    //
    double units = panel.getSizeInUnits(100, false);
    assertThat(units).isEqualTo(100.0, Delta.delta(0.001));
  }
View Full Code Here

  /**
   * Test for {@link DockLayoutPanelInfo#getSizeInUnits(int, boolean)}.
   */
  public void test_getSizeInUnits_CM() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.CM);",
            "  }",
            "}");
    panel.refresh();
    //
    double units = panel.getSizeInUnits(100, false);
    assertThat(units).isGreaterThan(2.0).isLessThan(3.0);
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Test for {@link DockLayoutPanelInfo#getUnitSizeTooltip(double)}.
   */
  public void test_getUnitSizeTooltip_PX() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.PX);",
            "  }",
            "}");
    panel.refresh();
    //
    assertEquals("100.0px", panel.getUnitSizeTooltip(100.0));
  }
View Full Code Here

  /**
   * Test for {@link DockLayoutPanelInfo#getUnitSizeTooltip(double)}.
   */
  public void test_getUnitSizeTooltip_CM() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.CM);",
            "  }",
            "}");
    panel.refresh();
    //
    assertEquals("3.5cm", panel.getUnitSizeTooltip(3.512));
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * Test for {@link DockLayoutPanelInfo#setReasonableSize(WidgetInfo)}.
   */
  public void test_setReasonableSize_PX() throws Exception {
    DockLayoutPanelInfo panel =
        parseJavaInfo(
            "public class Test extends DockLayoutPanel {",
            "  public Test() {",
            "    super(Unit.PX);",
            "    {",
            "      Button button = new Button();",
            "      addWest(button, 0.0);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    WidgetInfo button = getJavaInfoByName("button");
    //
    panel.setReasonableSize(button);
    assertEditor(
        "public class Test extends DockLayoutPanel {",
        "  public Test() {",
        "    super(Unit.PX);",
        "    {",
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.model.widgets.panels.DockLayoutPanelInfo

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.