Package com.google.gwt.gen2.complexpanel.client

Examples of com.google.gwt.gen2.complexpanel.client.FastTree


    // Initialize the cell editor
    InlineCellEditor<String> editor = createCellEditor();

    // Create the edit info
    Grid grid = new Grid(1, 1);
    CellEditInfo cellEditInfo = new CellEditInfo(grid, 0, 0);

    // Create the callback
    TestCallback<String> callback = new TestCallback<String>(cellEditInfo);

    // Edit the cell
View Full Code Here


    // Initialize the cell editor
    InlineCellEditor<String> editor = createCellEditor();

    // Create the edit info
    Grid grid = new Grid(1, 1);
    CellEditInfo cellEditInfo = new CellEditInfo(grid, 0, 0);

    // Create the callback
    TestCallback<String> callback = new TestCallback<String>(cellEditInfo);

    // Edit the cell
View Full Code Here

  /**
   * Test the {@link CellEditInfo} inner class.
   */
  public void testCellEditInfo() {
    Grid grid = new Grid(1, 1);
    CellEditInfo info = new CellEditInfo(grid, 1, 2);
    assertEquals(grid, info.getTable());
    assertEquals(1, info.getRowIndex());
    assertEquals(2, info.getCellIndex());
  }
View Full Code Here

   * Test the column width info.
   */
  public void testCurrentColumnWidthInfo() {
    // getPercentageDifference
    {
      ColumnWidthInfo info = new ColumnWidthInfo(100, 300, 200, 150);

      // getters
      assertEquals(150, info.getCurrentWidth());
      assertEquals(100, info.getMinimumWidth());
      assertEquals(300, info.getMaximumWidth());
      assertEquals(200, info.getPreferredWidth());

      // percentage difference
      info.setNewWidth(150);
      assertEquals(-0.25, info.getPercentageDifference(), 0.001);

      // required width
      info.setRequiredWidth(40);
      assertEquals(40, info.getRequiredWidth());

      // new width
      info.setNewWidth(190);
      assertEquals(190, info.getNewWidth());
    }
  }
View Full Code Here

  public void testCurrentWidthOutOfRange() {
    // Current width below minimum width
    {
      // Create some column info
      List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
      columns.add(new ColumnWidthInfo(200, 300, 250, 0));
      columns.add(new ColumnWidthInfo(200, 300, 50, 50));
      columns.add(new ColumnWidthInfo(200, 300, 350, 199));

      // Distribute some width
      ColumnResizer resizer = new ColumnResizer();
      int remaining = resizer.distributeWidth(columns, 0);
      assertEquals(-351, remaining);

      // Check outputs
      assertEquals(200, columns.get(0).getNewWidth());
      assertEquals(200, columns.get(1).getNewWidth());
      assertEquals(200, columns.get(2).getNewWidth());
    }

    // Current width above maximum width
    {
      // Create some column info
      List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
      columns.add(new ColumnWidthInfo(200, 300, 250, 350));
      columns.add(new ColumnWidthInfo(200, 300, 50, 1000));
      columns.add(new ColumnWidthInfo(200, 300, 350, 301));

      // Distribute some width
      ColumnResizer resizer = new ColumnResizer();
      int remaining = resizer.distributeWidth(columns, 0);
      assertEquals(751, remaining);
View Full Code Here

   */
  public void testDistributeNegativeWidth() {
    // Create some column info
    ColumnResizer resizer = new ColumnResizer();
    List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
    columns.add(new ColumnWidthInfo(100, 300, 200, 150));
    columns.add(new ColumnWidthInfo(0, 100, 50, 50));
    columns.add(new ColumnWidthInfo(0, 500, 300, 151));

    // Only the first column gets any width, goes to -10%
    {
      assertEquals(0, resizer.distributeWidth(columns, -5));
      assertEquals(150, columns.get(0).getNewWidth());
View Full Code Here

   */
  public void testDistributePositiveWidth() {
    // Create some column info
    ColumnResizer resizer = new ColumnResizer();
    List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
    columns.add(new ColumnWidthInfo(100, 300, 200, 150));
    columns.add(new ColumnWidthInfo(0, 100, 50, 50));
    columns.add(new ColumnWidthInfo(0, 500, 300, 100));

    // Only the first column gets any width, goes to -50%
    {
      assertEquals(0, resizer.distributeWidth(columns, 50));
      assertEquals(150, columns.get(0).getNewWidth());
View Full Code Here

   * Verify that we can distribute a zero width.
   */
  public void testDistributeZeroWidth() {
    // Create some column info
    List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
    columns.add(new ColumnWidthInfo(100, 300, 200, 150));
    columns.add(new ColumnWidthInfo(0, 100, 50, 50));
    columns.add(new ColumnWidthInfo(0, 500, 300, 200));

    // Distribute some width
    ColumnResizer resizer = new ColumnResizer();
    resizer.distributeWidth(columns, 0);

View Full Code Here

   * @param width the width in pixels
   * @return the new column width
   */
  public int setColumnWidth(int column, int width) {
    // Constrain the size of the column
    ColumnWidthInfo info = getColumnWidthInfo(column);
    if (info.hasMaximumWidth()) {
      width = Math.min(width, info.getMaximumWidth());
    }
    if (info.hasMinimumWidth()) {
      width = Math.max(width, info.getMinimumWidth());
    }

    // Try to constrain the size of the grid
    if (resizePolicy.isSacrificial()) {
      // Get the sacrifice columns
View Full Code Here

  private void applyNewColumnWidths(int startIndex,
      List<ColumnWidthInfo> infos, boolean forced) {
    int offset = getHeaderOffset();
    int numColumns = infos.size();
    for (int i = 0; i < numColumns; i++) {
      ColumnWidthInfo info = infos.get(i);
      int newWidth = info.getNewWidth();
      if (forced || info.getCurrentWidth() != newWidth) {
        dataTable.setColumnWidth(startIndex + i, newWidth);
        headerTable.setColumnWidth(startIndex + i + offset, newWidth);
        if (footerTable != null) {
          footerTable.setColumnWidth(startIndex + i + offset, newWidth);
        }
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.complexpanel.client.FastTree

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.