Package com.google.gwt.gen2.table.client

Examples of com.google.gwt.gen2.table.client.FixedWidthGrid


    // Add button to change status
    {
      Button button = new Button("Set Resize Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          switch (policyBox.getSelectedIndex()) {
            case 0:
              scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.DISABLED);
              break;
            case 1:
              scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.SINGLE_CELL);
              break;
            case 2:
              scrollTable.setColumnResizePolicy(ScrollTable.ColumnResizePolicy.MULTI_CELL);
              break;
          }
        }
      });
      form.addButton(button);
    }

    // Add button to reset column widths
    {
      Button button = new Button("Reset Column Widths", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          scrollTable.resetColumnWidths();
        }
      });
      form.addButton(button);
    }
View Full Code Here


    // Add button to change status
    {
      Button button = new Button("Set Scroll Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          switch (scrollPolicyBox.getSelectedIndex()) {
            case 0:
              scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.BOTH);
              break;
            case 1:
              scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.HORIZONTAL);
              break;
            case 2:
              scrollTable.setScrollPolicy(ScrollTable.ScrollPolicy.DISABLED);
              break;
          }
        }
      });
      form.addButton(button);
View Full Code Here

    // Add button to change status
    {
      Button button = new Button("Set Resize Policy", new ClickHandler() {
        public void onClick(ClickEvent event) {
          AbstractScrollTable scrollTable = ScrollTableDemo.get().getScrollTable();
          switch (policyBox.getSelectedIndex()) {
            case 0:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.UNCONSTRAINED);
              break;
            case 1:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FLOW);
              break;
            case 2:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FIXED_WIDTH);
              break;
            case 3:
              scrollTable.setResizePolicy(ScrollTable.ResizePolicy.FILL_WIDTH);
              break;
          }
        }
      });
      form.addButton(button);
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

    // 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

      return;
    }

    // Forward the request to the cell editor
    final RowType rowValue = getRowValue(row);
    CellEditInfo editInfo = new CellEditInfo(getDataTable(), row, column);
    cellEditor.editCell(editInfo, colDef.getCellValue(rowValue),
        new CellEditor.Callback() {
          public void onCancel(CellEditInfo cellEditInfo) {
          }
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

TOP

Related Classes of com.google.gwt.gen2.table.client.FixedWidthGrid

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.