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

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


  /**
   * Test for initializing {@link TableLayoutDataInfo}.
   */
  public void test_initializeTable_colSpan() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Label label_1 = new Label();",
            "      add(label_1, new TableLayoutData(2));",
            "    }",
            "    {",
            "      Label label_2 = new Label();",
            "      add(label_2);",
            "    }",
            "    {",
            "      Label label_3 = new Label();",
            "      add(label_3);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    assertCells(panel.getChildrenWidgets().get(0), 0, 0, 2, 1);
    assertCells(panel.getChildrenWidgets().get(1), 0, 1, 1, 1);
    assertCells(panel.getChildrenWidgets().get(2), 1, 1, 1, 1);
  }
View Full Code Here


  /**
   * Test for initializing {@link TableLayoutDataInfo}.
   */
  public void test_initializeTable_rowSpan() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Label label_1 = new Label();",
            "      TableLayoutData tableLayoutData = new TableLayoutData(1);",
            "      tableLayoutData.setRowspan(2);",
            "      add(label_1, tableLayoutData);",
            "    }",
            "    {",
            "      Label label_2 = new Label();",
            "      add(label_2);",
            "    }",
            "    {",
            "      Label label_3 = new Label();",
            "      add(label_3);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    assertCells(panel.getChildrenWidgets().get(0), 0, 0, 1, 2);
    assertCells(panel.getChildrenWidgets().get(1), 1, 0, 1, 1);
    assertCells(panel.getChildrenWidgets().get(2), 1, 1, 1, 1);
  }
View Full Code Here

  //
  // IGridInfo
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_IGridInfo_noSpans() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Label label_1 = new Label('A');",
            "      add(label_1);",
            "    }",
            "    {",
            "      Label label_2 = new Label('AA');",
            "      add(label_2);",
            "    }",
            "    {",
            "      Label label_3 = new Label('A');",
            "      add(label_3);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    IGridInfo gridInfo = layout.getGridInfo();
    //
    assertEquals(2, gridInfo.getColumnCount());
    assertEquals(2, gridInfo.getRowCount());
    // getColumnIntervals()
    {
      Interval[] intervals = gridInfo.getColumnIntervals();
      assertThat(intervals).hasSize(2);
      assertEquals(1, intervals[0].begin);
      assertEquals(A_WIDTH, intervals[0].length);
      assertEquals(1 + A_WIDTH, intervals[1].begin);
      assertEquals(A_WIDTH * 2, intervals[1].length);
    }
    // getRowIntervals()
    {
      Interval[] intervals = gridInfo.getRowIntervals();
      assertThat(intervals).hasSize(2);
      assertEquals(1, intervals[0].begin);
      assertEquals(A_HEIGHT, intervals[0].length);
      assertEquals(1 + A_HEIGHT, intervals[1].begin);
      assertEquals(A_HEIGHT, intervals[1].length);
    }
    // getCellsRectangle()
    {
      {
        Rectangle cells = new Rectangle(0, 0, 1, 1);
        Rectangle expected = new Rectangle(1, 1, A_WIDTH, A_HEIGHT);
        assertEquals(expected, gridInfo.getCellsRectangle(cells));
      }
      {
        Rectangle cells = new Rectangle(0, 0, 2, 1);
        Rectangle expected = new Rectangle(1, 1, A_WIDTH + 2 * A_WIDTH, A_HEIGHT);
        assertEquals(expected, gridInfo.getCellsRectangle(cells));
      }
      {
        Rectangle cells = new Rectangle(0, 0, 1, 2);
        Rectangle expected = new Rectangle(1, 1, A_WIDTH, A_HEIGHT + A_HEIGHT);
        assertEquals(expected, gridInfo.getCellsRectangle(cells));
      }
    }
    // getComponentCells()
    {
      assertEquals(
          new Rectangle(0, 0, 1, 1),
          gridInfo.getComponentCells(panel.getChildrenWidgets().get(0)));
      assertEquals(
          new Rectangle(1, 0, 1, 1),
          gridInfo.getComponentCells(panel.getChildrenWidgets().get(1)));
      assertEquals(
          new Rectangle(0, 1, 1, 1),
          gridInfo.getComponentCells(panel.getChildrenWidgets().get(2)));
    }
    // getOccupied()
    {
      assertSame(panel.getChildrenWidgets().get(0), gridInfo.getOccupied(0, 0));
      assertSame(panel.getChildrenWidgets().get(1), gridInfo.getOccupied(1, 0));
      assertSame(panel.getChildrenWidgets().get(2), gridInfo.getOccupied(0, 1));
      assertSame(null, gridInfo.getOccupied(1, 1));
    }
    // getInsets()
    {
      Insets insets = gridInfo.getInsets();
View Full Code Here

      assertEquals(25, gridInfo.getVirtualRowSize());
    }
  }

  public void test_IGridInfo_3columns_2rows() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(3));",
            "    {",
            "      Label label_1 = new Label('A');",
            "      add(label_1);",
            "    }",
            "    {",
            "      Label label_2 = new Label('AA');",
            "      add(label_2);",
            "    }",
            "    {",
            "      Label label_3 = new Label('A');",
            "      add(label_3);",
            "    }",
            "    {",
            "      Label label_4 = new Label('A');",
            "      add(label_4);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    IGridInfo gridInfo = layout.getGridInfo();
    //
    assertEquals(3, gridInfo.getColumnCount());
    assertEquals(2, gridInfo.getRowCount());
    // getColumnIntervals()
View Full Code Here

      assertThat(intervals).hasSize(2);
    }
  }

  public void test_IGridInfo_emptyCellIfFiller() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "import com.google.gwt.user.client.ui.Button;",
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Button button = new Button();",
            "      add(button);",
            "    }",
            "    add(new Label());",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    IGridInfo gridInfo = layout.getGridInfo();
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    //
    assertEquals(2, gridInfo.getColumnCount());
    assertEquals(1, gridInfo.getRowCount());
    assertSame(button, gridInfo.getOccupied(0, 0));
    assertSame(null, gridInfo.getOccupied(1, 0));
View Full Code Here

  /**
   * When some columns/rows are empty, we should force them to have some reasonable size, so that
   * user will able to drop component into these empty cells.
   */
  public void test_IGridInfo_emptyColumnsRows() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    add(new Label());",
            "    add(new Label());",
            "    add(new Label());",
            "    {",
            "      Label label = new Label('A');",
            "      add(label);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    IGridInfo gridInfo = layout.getGridInfo();
    //
    assertEquals(2, gridInfo.getColumnCount());
    assertEquals(2, gridInfo.getRowCount());
    // getColumnIntervals()
View Full Code Here

  //
  // setCells()
  //
  ////////////////////////////////////////////////////////////////////////////
  public void test_setCells_horizontalSpan() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "import com.google.gwt.user.client.ui.Button;",
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Button button = new Button('0');",
            "      add(button);",
            "    }",
            "    add(new Label());",
            "    add(new Label());",
            "    {",
            "      Button button = new Button('1');",
            "      add(button);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    TableLayoutDataInfo tableData = TableLayoutInfo.getTableData(button);
    // check initial TableLayoutData
    {
      assertEquals(0, getInt(tableData, "x"));
      assertEquals(0, getInt(tableData, "y"));
View Full Code Here

      assertEquals(1, getInt(tableData, "height"));
    }
  }

  public void test_setCells_horizontalSpan2() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "import com.google.gwt.user.client.ui.Button;",
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Button button = new Button('0');",
            "      add(button, new TableLayoutData(2));",
            "    }",
            "    add(new Label());",
            "    {",
            "      Button button = new Button('1');",
            "      add(button);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    TableLayoutDataInfo tableData = TableLayoutInfo.getTableData(button);
    // check initial TableLayoutData
    {
      assertEquals(0, getInt(tableData, "x"));
      assertEquals(0, getInt(tableData, "y"));
View Full Code Here

      assertEquals(1, getInt(tableData, "height"));
    }
  }

  public void test_setCells_verticalSpan() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "import com.google.gwt.user.client.ui.Button;",
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Button button = new Button('0');",
            "      add(button);",
            "    }",
            "    add(new Label());",
            "    add(new Label());",
            "    {",
            "      Button button = new Button('1');",
            "      add(button);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    TableLayoutDataInfo tableData = TableLayoutInfo.getTableData(button);
    // check initial TableLayoutData
    {
      assertEquals(0, getInt(tableData, "x"));
      assertEquals(0, getInt(tableData, "y"));
View Full Code Here

      assertEquals(2, getInt(tableData, "height"));
    }
  }

  public void test_setCells_verticalSpan2() throws Exception {
    PanelInfo panel =
        parseJavaInfo(
            "import com.google.gwt.user.client.ui.Button;",
            "public class Test extends Panel {",
            "  public Test() {",
            "    setLayout(new TableLayout(2));",
            "    {",
            "      Button button = new Button('0');",
            "      TableLayoutData tableLayoutData = new TableLayoutData(1);",
            "      tableLayoutData.setRowspan(2);",
            "      add(button, tableLayoutData);",
            "    }",
            "    add(new Label());",
            "    {",
            "      Button button = new Button('1');",
            "      add(button);",
            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    WidgetInfo button = panel.getChildrenWidgets().get(0);
    TableLayoutDataInfo tableData = TableLayoutInfo.getTableData(button);
    // check initial TableLayoutData
    {
      assertEquals(0, getInt(tableData, "x"));
      assertEquals(0, getInt(tableData, "y"));
View Full Code Here

TOP

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

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.