Examples of FixedWidthGrid


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

    layout.setWidget(3, 0, highlightedRowLabel);
    layout.setWidget(2, 1, unhighlightedRowLabel);
    layout.setWidget(3, 1, unhighlightedCellLabel);

    // Add all of the listeners
    FixedWidthGrid dataTable = ScrollTableDemo.get().getDataTable();
    dataTable.addTableListener(new TableListener() {
      public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
        addLogEntry("cell clicked: (" + row + "," + cell + ")", "#ff00ff");
      }
    });
    dataTable.addColumnSortHandler(new ColumnSortHandler() {
      public void onColumnSorted(ColumnSortEvent event) {
        ColumnSortList sortList = event.getColumnSortList();
        int column = -1;
        boolean ascending = true;
        if (sortList != null) {
          column = sortList.getPrimaryColumn();
          ascending = sortList.isPrimaryAscending();
        }
        if (ascending) {
          addLogEntry("sorted column: " + column + " (ascending)", "black");
        } else {
          addLogEntry("sorted column: " + column, "black");
        }
      }
    });
    dataTable.addCellHighlightHandler(new CellHighlightHandler() {
      public void onCellHighlight(CellHighlightEvent event) {
        Cell cell = event.getValue();
        highlightedCellLabel.setText("Highlighted cell: (" + cell.getRowIndex()
            + "," + cell.getCellIndex() + ")");
      }
    });
    dataTable.addCellUnhighlightHandler(new CellUnhighlightHandler() {
      public void onCellUnhighlight(CellUnhighlightEvent event) {
        Cell cell = event.getValue();
        unhighlightedCellLabel.setText("Last unhighlighted cell: ("
            + cell.getRowIndex() + "," + cell.getCellIndex() + ")");
      }
    });
    dataTable.addRowHighlightHandler(new RowHighlightHandler() {
      public void onRowHighlight(RowHighlightEvent event) {
        Row cell = event.getValue();
        highlightedRowLabel.setText("Highlighted row: (" + cell.getRowIndex()
            + ")");
      }
    });
    dataTable.addRowUnhighlightHandler(new RowUnhighlightHandler() {
      public void onRowUnhighlight(RowUnhighlightEvent event) {
        Row cell = event.getValue();
        unhighlightedRowLabel.setText("Last unhighlighted row: ("
            + cell.getRowIndex() + ")");
      }
    });
    dataTable.addRowSelectionHandler(new RowSelectionHandler() {
      public void onRowSelection(RowSelectionEvent event) {
        // Show the previously selected rows
        Set<Row> deselectedRows = event.getDeselectedRows();
        String previous = "Previously selected rows: ";
        for (Row row : event.getOldValue()) {
View Full Code Here

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

   *
   * @param beforeRow the index to add the new row into
   */
  public void insertDataRow(int beforeRow) {
    // Insert the new row
    FixedWidthGrid dataTable = getDataTable();
    beforeRow = dataTable.insertRow(beforeRow);

    // Set the data in the new row
    Student student = STUDENT_DATA.generateStudent();
    dataTable.setText(beforeRow, 0, student.getFirstName());
    dataTable.setText(beforeRow, 1, student.getLastName());
    dataTable.setText(beforeRow, 2, student.getAge() + "");
    dataTable.setText(beforeRow, 3, student.isMale() ? "male" : "female");
    dataTable.setText(beforeRow, 4, student.getRace());
    String color = student.getFavoriteColor();
    String colorHtml = "<FONT color=\"" + color + "\">" + color + "</FONT>";
    dataTable.setHTML(beforeRow, 5, colorHtml);
    dataTable.setText(beforeRow, 6, student.getFavoriteSport());
    dataTable.setText(beforeRow, 7, student.getCollege());
    dataTable.setText(beforeRow, 8, student.getGraduationYear() + "");
    String gpa = student.getGpa() + "";
    if (gpa.length() > 4) {
      gpa = gpa.substring(0, 4);
    }
    dataTable.setText(beforeRow, 9, gpa);
    dataTable.setText(beforeRow, 10, student.getId() + "");
    dataTable.setText(beforeRow, 11, student.getPin() + "");
  }
View Full Code Here

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

   */
  protected AbstractScrollTable createScrollTable() {
    // Create the three component tables
    FixedWidthFlexTable headerTable = createHeaderTable();
    FixedWidthFlexTable footerTable = createFooterTable();
    FixedWidthGrid dataTable = createDataTable();

    // Create the scroll table
    ScrollTable theScrollTable = new ScrollTable(dataTable, headerTable);
    theScrollTable.setFooterTable(footerTable);

View Full Code Here

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

  /**
   * @return the newly created data table.
   */
  private FixedWidthGrid createDataTable() {
    FixedWidthGrid dataTable = new FixedWidthGrid();
    dataTable.setSelectionPolicy(SelectionPolicy.CHECKBOX);
    return dataTable;
  }
View Full Code Here

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

   * Handle click events from the buttons in this panel.
   *
   * @param sender
   */
  public void onClick(Widget sender) {
    FixedWidthGrid dataTable = ScrollTableDemo.getDataTable();
    if (sender == selectionPolicyButton) {
      // Set Selection Policy
      String selection = selectionPolicyBox.getValue(selectionPolicyBox.getSelectedIndex());
      if (selection.equals("Multi Row")) {
        dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.MULTI_ROW);
      } else if (selection.equals("Single Row")) {
        dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.ONE_ROW);
      } else {
        dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.DISABLED);
      }
    }
  }
View Full Code Here

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

    cachedTableModel.setPreCachedRowCount(20);
    cachedTableModel.setPostCachedRowCount(20);
    cachedTableModel.setRowCount(1000);

    // Setup the view
    dataTable = new FixedWidthGrid();

    // Create the scroll table
    scrollTable = new PagingScrollTable<Serializable>(cachedTableModel,
        dataTable, headerTable);
    getPagingScrollTable().setCellRenderer(new CustomCellRenderer());
View Full Code Here

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

   *
   * @return the data table.
   */
  public static FixedWidthGrid getDataTable() {
    if (dataTable == null) {
      dataTable = new FixedWidthGrid();
    }
    return dataTable;
  }
View Full Code Here

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

   *
   * @param sender
   */
  @Override
  public void onClick(Widget sender) {
    FixedWidthGrid gridView = ScrollTableDemo.getDataTable();
    TableModel<Serializable> tableModel = PagingScrollTableDemo.getCachedTableModel();
    try {
      if (sender == setHtmlButton) {
        // Set cell HTML
        int column = Integer.parseInt(columnIndexBox.getText());
        int row = Integer.parseInt(rowIndexBox.getText());
        tableModel.setData(row, column, textBox.getText());
      } else if (sender == add1RowButton) {
        // Insert 1 row
        int row = Integer.parseInt(rowIndexBox.getText());
        PagingScrollTableDemo.insertDataRow(row);
      } else if (sender == add10RowButton) {
        // Insert 10 rows
        int row = Integer.parseInt(rowIndexBox.getText());
        for (int i = row; i < row + 10; i++) {
          PagingScrollTableDemo.insertDataRow(i);
        }
      } else if (sender == add100RowButton) {
        // Insert 100 rows
        int row = Integer.parseInt(rowIndexBox.getText());
        for (int i = row; i < row + 100; i++) {
          PagingScrollTableDemo.insertDataRow(i);
        }
      } else if (sender == removeRowButton) {
        // Remove a row
        int row = Integer.parseInt(rowIndexBox.getText());
        tableModel.removeRow(row);
      } else if (sender == resizeColumnCountButton) {
        // Set column count
        int column = Integer.parseInt(columnIndexBox.getText());
        gridView.resizeColumns(column);
      }
    } catch (IndexOutOfBoundsException e) {
      Window.alert("The cell index you entered is out of bounds.");
    } catch (NumberFormatException e) {
      Window.alert("Please enter valid integers for the row and column.");
View Full Code Here

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

   * Handle click events from the buttons in this panel.
   *
   * @param sender
   */
  public void onClick(Widget sender) {
    FixedWidthGrid dataTable = ScrollTableDemo.getDataTable();
    try {
      if (sender == setTextButton) {
        // Set cell text
        int column = Integer.parseInt(columnIndexBox.getText());
        int row = Integer.parseInt(rowIndexBox.getText());
        dataTable.setText(row, column, textBox.getText());
      } else if (sender == setHtmlButton) {
        // Set cell HTML
        int column = Integer.parseInt(columnIndexBox.getText());
        int row = Integer.parseInt(rowIndexBox.getText());
        dataTable.setHTML(row, column, textBox.getText());
      } else if (sender == add1RowButton) {
        // Insert 1 row
        int row = Integer.parseInt(rowIndexBox.getText());
        ScrollTableDemo.insertDataRow(row);
      } else if (sender == add10RowButton) {
        // Insert 10 rows
        int row = Integer.parseInt(rowIndexBox.getText());
        for (int i = row; i < row + 10; i++) {
          ScrollTableDemo.insertDataRow(i);
        }
      } else if (sender == add100RowButton) {
        // Insert 100 rows
        int row = Integer.parseInt(rowIndexBox.getText());
        for (int i = row; i < row + 100; i++) {
          ScrollTableDemo.insertDataRow(i);
        }
      } else if (sender == removeRowButton) {
        // Remove a row
        int row = Integer.parseInt(rowIndexBox.getText());
        dataTable.removeRow(row);
      } else if (sender == resizeColumnCountButton) {
        // Set column count
        int column = Integer.parseInt(columnIndexBox.getText());
        dataTable.resizeColumns(column);
      }
    } catch (IndexOutOfBoundsException e) {
      Window.alert("The cell index you entered is out of bounds.");
    } catch (NumberFormatException e) {
      Window.alert("Please enter valid integers for the row and column.");
View Full Code Here

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

  public void onRowUnhover(SourceTableSelectionEvents sender, int row) {
  }

  @Override
  protected Widget onInitialize() {
    FixedWidthGrid dataTable = ScrollTableDemo.getDataTable();
    logLabel.setHeight("200px");
    scrollPanel.setWidth("95%");
    scrollPanel.setHeight("200px");
    DOM.setStyleAttribute(logLabel.getElement(), "font", "8pt/10pt courier");
    DOM.setStyleAttribute(scrollPanel.getElement(), "border", "1px solid black");
    dataTable.addTableSelectionListener(this);
    dataTable.addSortableColumnsListener(this);

    VerticalPanel panel = new VerticalPanel();
    panel.setWidth("100%");
    panel.add(scrollPanel);
    panel.add(clearButton);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.