Examples of TableColumnModel


Examples of com.extjs.gxt.ui.client.widget.table.TableColumnModel

    item.setTreeTableElement(DOM.createDiv());
    item.setStyleName("my-treeitem x-tree-item");
    DOM.insertChild(target, item.getElement(), index);

    TableColumnModel cm = getTreeTableItem().getTreeTable().getColumnModel();

    DOM.setInnerHTML(item.getElement(), Markup.TREETABLE_ITEM);
    tableItemEl = item.el().firstChild().dom;

    rowTableEl = DOM.getFirstChild(tableItemEl);
    rowTrEl = fly(rowTableEl).getSubChild(2);
    updateCellValues(0, DOM.getFirstChild(rowTrEl), cm.getColumn(0).getAlignment());
    itemEl = fly(rowTrEl).getSubChild(4);
    Element td = fly(itemEl).subChild(3).dom;
    indentEl = DOM.getFirstChild(td);
    jointEl = DOM.getNextSibling(td);
    jointDivEl = DOM.getFirstChild(jointEl);
    checkEl = DOM.getNextSibling(DOM.getNextSibling(jointEl));
    checkDivEl = DOM.getFirstChild(checkEl);
    iconEl = DOM.getNextSibling(checkEl);
    iconDivEl = DOM.getFirstChild(iconEl);
    textEl = DOM.getNextSibling(iconEl);
    textSpanEl = DOM.getFirstChild(textEl);
    Element tbl = DOM.getFirstChild(item.getElement());
    containerEl = new El(DOM.getNextSibling(tbl));

    int numColumns = cm.getColumnCount();
    cells = new Element[numColumns];

    for (int i = 1; i < numColumns; i++) {
      cells[i] = DOM.createTD();
      DOM.appendChild(rowTrEl, cells[i]);

      DOM.setElementProperty(cells[i], "className", "my-treetbl-cell");
      DOM.setElementAttribute(cells[i], "index", String.valueOf(i));

      Element overflowDiv = DOM.createDiv();
      DOM.setElementProperty(overflowDiv, "className", "my-treetbl-cell-overflow");
      DOM.appendChild(cells[i], overflowDiv);
      Element textDiv = DOM.createDiv();

      String textStyle = "my-treetbl-cell-text";
      if (((TreeTableItem) item).getCellStyle(i) != null) {
        textStyle += " " + ((TreeTableItem) item).getCellStyle(i);
      }
      DOM.setElementProperty(textDiv, "className", textStyle);
      DOM.appendChild(overflowDiv, textDiv);
      updateCellValues(i, cells[i], cm.getColumn(i).getAlignment());
    }

    boolean checkable = getTreeTableItem().getTreeTable().getCheckable();
    El.fly(checkEl).setVisible(checkable);
View Full Code Here

Examples of com.taobao.zeus.web.platform.client.module.tablemanager.model.TableColumnModel

   */
  private TableColumnModel convert(FieldSchema fs) {
    if (fs == null) {
      return null;
    }
    TableColumnModel cm = new TableColumnModel();
    cm.setName(fs.getName());
    cm.setType(fs.getType());
    cm.setDesc(fs.getComment());
    return cm;
  }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

  /**
   * Updates table columns width from the content of its cells.
   */
  private void updateTableColumnsWidth() {
    int intercellWidth = getIntercellSpacing().width;
    TableColumnModel columnModel = getColumnModel();
    TableModel tableModel = getModel();
    for (int columnIndex = 0, n = columnModel.getColumnCount(); columnIndex < n; columnIndex++) {
      TableColumn column = columnModel.getColumn(columnIndex);
      int modelColumnIndex = convertColumnIndexToModel(columnIndex);
      int preferredWidth = column.getPreferredWidth();
      preferredWidth = Math.max(preferredWidth, column.getHeaderRenderer().getTableCellRendererComponent(
          this, column.getHeaderValue(), false, false, -1, columnIndex).getPreferredSize().width);
      for (int rowIndex = 0, m = tableModel.getRowCount(); rowIndex < m; rowIndex++) {
View Full Code Here

Examples of javax.swing.table.TableColumnModel

        final TableSorter sorter = this;
        final JTable tableView = table;
        tableView.setColumnSelectionAllowed(false);
        MouseAdapter listMouseListener = new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                TableColumnModel columnModel = tableView.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = tableView.convertColumnIndexToModel(viewColumn);
                if(e.getClickCount() == 1 && column != -1) {
                    int shiftPressed = e.getModifiers()&InputEvent.SHIFT_MASK;
                    boolean ascending = (shiftPressed == 0);
                    sorter.sortByColumn(column, ascending);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

  }

  private class MouseHandler extends MouseAdapter {
    public void mouseClicked(MouseEvent e) {
      JTableHeader h = (JTableHeader) e.getSource();
      TableColumnModel columnModel = h.getColumnModel();
      int viewColumn = columnModel.getColumnIndexAtX(e.getX());
      int column = columnModel.getColumn(viewColumn).getModelIndex();
      if (column != -1) {
        int status = getSortingStatus(column);
        if (!e.isControlDown()) {
          cancelSorting();
        }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

      properties.setValueAt(entry.getKey(), i, 0);
      properties.setValueAt(entry.getValue(), i, 1);
    }

    final JTable table = new JTable(properties);
    final TableColumnModel model = table.getColumnModel();
    TableColumn column = model.getColumn(0);
    column.setPreferredWidth(200);
    column = model.getColumn(1);
    column.setPreferredWidth(350);

    table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
    return table;
View Full Code Here

Examples of javax.swing.table.TableColumnModel

    tableView.getTableHeader().setDefaultRenderer(unSortedRenderer);
   
    tableView.setColumnSelectionAllowed(false);
    MouseAdapter listMouseListener = new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
        TableColumnModel columnModel = tableView.getColumnModel();
        int viewColumn = columnModel.getColumnIndexAtX(e.getX());
        int column = tableView.convertColumnIndexToModel(viewColumn);
        if (e.getClickCount() == 1 && column != -1) {
          if (singleSortingColumn == column)
            ascending = !ascending;
          else
            ascending = true;
          sorter.sortByColumn(column);
          singleSortingColumn = column;
         
          // setting renderer
          for (int i = 0; i < columnModel.getColumnCount(); i++)
            columnModel.getColumn(i).setHeaderRenderer(unSortedRenderer);
          if (ascending)
            sortedRenderer.setIconType(SortedTableHeaderRenderer.ASCENDING);
          else
            sortedRenderer.setIconType(SortedTableHeaderRenderer.DESCENDING);
          columnModel.getColumn(column).setHeaderRenderer(sortedRenderer);
        }
      }
    };
    JTableHeader th = tableView.getTableHeader();
    th.addMouseListener(listMouseListener);
View Full Code Here

Examples of javax.swing.table.TableColumnModel

   *
   * @param user
   *            properties
   */
  public void setUserProperties(UserProperties up) {
    TableColumnModel tcm = table.getColumnModel();
    int nc = table.getModel().getColumnCount();
    TableColumn tl[] = new TableColumn[nc];
    int map[] = new int[nc];

    // get number of visible columns
    int ncv = up.getInt(propertiesPrefix+".logbookPanel.nbrColumn", nc);

    // remove all visible columns from the table
    for (int j = 0; j < nc; j++) {
      map[j] = -1;
      int l = table.convertColumnIndexToView(j);
      if (l >= 0) {
        tl[j] = tcm.getColumn(l);
        table.removeColumn(tl[j]);
      } else {
        tl[j] = null;
      }
    }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

   *
   * @param user
   *            properties
   */
  public void getUserProperties(UserProperties up) {
    TableColumnModel tcm = table.getColumnModel();
    int ncv = tcm.getColumnCount();
    up.setInt(propertiesPrefix+".logbookPanel.nbrColumn", ncv);
    for (int j = 0; j < ncv; j++) {
      up.setInt(propertiesPrefix+".logbookPanel.columnIndex" + j, table
          .convertColumnIndexToModel(j));
      up.setInt(propertiesPrefix+".logbookPanel.columnSize" + j, tcm.getColumn(j)
          .getWidth());
    }
    up.setInt(propertiesPrefix+".logbookPanel.size", getLogbookModel().getSize());
  }
View Full Code Here

Examples of javax.swing.table.TableColumnModel

     */
    private class MouseHandler extends MouseAdapter {
        public void mouseClicked(MouseEvent e) {
            if (e.getButton() == MouseEvent.BUTTON3) {
                JTableHeader h = (JTableHeader) e.getSource();
                TableColumnModel columnModel = h.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = columnModel.getColumn(viewColumn).getModelIndex();
                if (column != -1) {
                    //We know we have clicked on a column.
                    //Show up a dialog to enter the new filter.
                    String newFilter = JOptionPane.showInputDialog("Enter filter for column "
                            + tableModel.getColumnName(column), filter[column]);
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.