Package org.eclipse.wb.core.gef.policy.layout.grid

Examples of org.eclipse.wb.core.gef.policy.layout.grid.IGridInfo


      TableLayoutIntervalsSupport intervalsSupport = new TableLayoutIntervalsSupport(this);
      intervalsSupport.fetch();
      m_columnIntervals = intervalsSupport.getColumnIntervals();
      m_rowIntervals = intervalsSupport.getRowIntervals();
    }
    m_gridInfo = new IGridInfo() {
      ////////////////////////////////////////////////////////////////////////////
      //
      // Dimensions
      //
      ////////////////////////////////////////////////////////////////////////////
View Full Code Here


            "    }",
            "  }",
            "}");
    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();
      assertEquals(new Insets(), insets);
    }
    // virtual columns
    {
      assertTrue(gridInfo.hasVirtualColumns());
      assertEquals(5, gridInfo.getVirtualColumnGap());
      assertEquals(25, gridInfo.getVirtualColumnSize());
    }
    // virtual rows
    {
      assertTrue(gridInfo.hasVirtualRows());
      assertEquals(5, gridInfo.getVirtualRowGap());
      assertEquals(25, gridInfo.getVirtualRowSize());
    }
  }
View Full Code Here

            "    }",
            "  }",
            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    IGridInfo gridInfo = layout.getGridInfo();
    //
    assertEquals(3, gridInfo.getColumnCount());
    assertEquals(2, gridInfo.getRowCount());
    // getColumnIntervals()
    {
      Interval[] intervals = gridInfo.getColumnIntervals();
      assertThat(intervals).hasSize(3);
    }
    // getRowIntervals()
    {
      Interval[] intervals = gridInfo.getRowIntervals();
      assertThat(intervals).hasSize(2);
    }
  }
View Full Code Here

            "    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

            "    }",
            "  }",
            "}");
    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(25, intervals[0].length);
      assertEquals(1 + 25, intervals[1].begin);
      assertEquals(A_WIDTH, intervals[1].length);
    }
    // getRowIntervals()
    {
      Interval[] intervals = gridInfo.getRowIntervals();
      assertThat(intervals).hasSize(2);
      assertEquals(1, intervals[0].begin);
      assertThat(intervals[0].length).isGreaterThanOrEqualTo(25);
    }
  }
View Full Code Here

            "}");
    panel.refresh();
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    // initial state
    {
      IGridInfo gridInfo = layout.getGridInfo();
      assertEquals(1, gridInfo.getColumnCount());
      assertEquals(1, gridInfo.getRowCount());
      assertThat(layout.getColumns()).hasSize(1);
      assertThat(layout.getRows()).hasSize(1);
    }
    // create Button
    WidgetInfo newButton = createButton();
    layout.command_CREATE(newButton, 1, false, 1, false);
    assertEditor(
        "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();",
        "      add(button);",
        "    }",
        "  }",
        "}");
    // new state
    {
      IGridInfo gridInfo = layout.getGridInfo();
      assertEquals(2, gridInfo.getColumnCount());
      assertEquals(2, gridInfo.getRowCount());
      assertThat(layout.getColumns()).hasSize(2);
      assertThat(layout.getRows()).hasSize(2);
    }
  }
View Full Code Here

        "}");
    refresh();
    HTMLTableInfo grid = getJavaInfoByName("grid");
    CanvasInfo button = getJavaInfoByName("button");
    //
    IGridInfo gridInfo = grid.getGridInfo();
    assertEquals(new Rectangle(0, 0, 0, 0), gridInfo.getComponentCells(button));
  }
View Full Code Here

            "  }",
            "}");
    panel.refresh();
    //
    TableLayoutInfo layout = (TableLayoutInfo) panel.getLayout();
    IGridInfo gridInfo = layout.getGridInfo();
    assertThat(gridInfo.getRowCount()).isZero();
    assertThat(gridInfo.getRowIntervals()).isEmpty();
    assertThat(gridInfo.getColumnCount()).isZero();
    assertThat(gridInfo.getColumnIntervals()).isEmpty();
  }
View Full Code Here

          break;
        }
      }
    }
    // prepare grid information
    IGridInfo gridInfo = m_panel.getGridInfo();
    Interval[] columnIntervals = gridInfo.getColumnIntervals();
    Interval[] rowIntervals = gridInfo.getRowIntervals();
    int y1 = rowIntervals[0].begin - 5;
    int y2 = rowIntervals[rowIntervals.length - 1].end() + 5;
    // prepare index of target column and position for insert feedbacks
    final int targetIndex;
    int x;
View Full Code Here

          break;
        }
      }
    }
    // prepare grid information
    IGridInfo gridInfo = m_panel.getGridInfo();
    Interval[] columnIntervals = gridInfo.getColumnIntervals();
    Interval[] rowIntervals = gridInfo.getRowIntervals();
    int x1 = columnIntervals[0].begin - 5;
    int x2 = columnIntervals[columnIntervals.length - 1].end() + 5;
    // prepare index of target column and position for insert feedbacks
    final int targetIndex;
    int y;
View Full Code Here

TOP

Related Classes of org.eclipse.wb.core.gef.policy.layout.grid.IGridInfo

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.