Package javax.swing.table

Examples of javax.swing.table.TableCellEditor


  }

  private class DeleteRowAction implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      if (paramTable.isEditing()) {
        TableCellEditor cellEditor =
          paramTable.getCellEditor(
            paramTable.getEditingRow(),
            paramTable.getEditingColumn());
        cellEditor.cancelCellEditing();
      }

      int rowSelected = paramTable.getSelectedRow();
      if (rowSelected >= 0) {
        tableModel.removeRow(rowSelected);
View Full Code Here


  }

  private class DeleteColumnAction implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      if (paramTable.isEditing()) {
        TableCellEditor cellEditor =
          paramTable.getCellEditor(
            paramTable.getEditingRow(),
            paramTable.getEditingColumn());
        cellEditor.cancelCellEditing();
      }

      int colSelected = paramTable.getSelectedColumn();
      if(colSelected == 0 || colSelected == 1)
      {
View Full Code Here

      {
        // If a table cell is being edited, we must cancel the editing before
        // deleting the row
        if(authTable.isEditing())
        {
          TableCellEditor cellEditor = authTable.getCellEditor(authTable.getEditingRow(), authTable.getEditingColumn());
          cellEditor.cancelCellEditing();
        }

        int rowSelected = authTable.getSelectedRow();

        if(rowSelected != -1)
        {
          tableModel.removeRow(rowSelected);
          tableModel.fireTableDataChanged();

          // Disable the DELETE and SAVE buttons if no rows remaining after delete
          if(tableModel.getRowCount() == 0)
          {
            deleteButton.setEnabled(false);
            saveButton.setEnabled(false);
          }

          // Table still contains one or more rows, so highlight (select)
          // the appropriate one.
          else
          {
            int rowToSelect = rowSelected;

            if(rowSelected >= tableModel.getRowCount())
            {
              rowToSelect = rowSelected - 1;
            }

            authTable.setRowSelectionInterval(rowToSelect, rowToSelect);
          }
        }
      }
    }
    else if(action.equals("Add"))
    {
      // If a table cell is being edited, we should accept the current value
      // and stop the editing before adding a new row.
      if(authTable.isEditing())
      {
        TableCellEditor cellEditor = authTable.getCellEditor(authTable.getEditingRow(), authTable.getEditingColumn());
        cellEditor.stopCellEditing();
      }

      tableModel.addNewRow();
      tableModel.fireTableDataChanged();
View Full Code Here

          return taggedPropertyEditorCellEditor;
        }
      }

      final TableColumn tableColumn = getColumnModel().getColumn(column);
      final TableCellEditor renderer = tableColumn.getCellEditor();
      if (renderer != null)
      {
        return renderer;
      }

      if (columnClass.isArray())
      {
        return arrayCellEditor;
      }

      final TableCellEditor editor = getDefaultEditor(columnClass);
      if (editor != null && logger.isTraceEnabled())
      {
        logger.trace("Using preconfigured default editor for column class " + columnClass + ": " + editor); // NON-NLS
      }
      return editor;
View Full Code Here

    return super.getCellEditor(row, viewColumn);
  }

  public void stopEditing()
  {
    final TableCellEditor cellEditor = getCellEditor();
    if (cellEditor != null)
    {
      cellEditor.stopCellEditing();
    }
  }
View Full Code Here

        return taggedPropertyEditorCellEditor;
      }
    }

    final TableColumn tableColumn = getColumnModel().getColumn(column);
    final TableCellEditor renderer = tableColumn.getCellEditor();
    if (renderer != null)
    {
      return renderer;
    }

    if (columnClass.isArray())
    {
      return arrayCellEditor;
    }

    final TableCellEditor editor = getDefaultEditor(columnClass);
    if (editor != null && logger.isTraceEnabled())
    {
      logger.trace("Using preconfigured default editor for column class " + columnClass + ": " + editor); // NON-NLS
    }
    return editor;
View Full Code Here

    stringValueCellEditor.setFormulaFragment(formulaFragment);
  }

  public void stopEditing()
  {
    final TableCellEditor cellEditor = getCellEditor();
    if (cellEditor != null)
    {
      cellEditor.stopCellEditing();
    }
  }
View Full Code Here

    dataModel.setData(elements);
  }

  public void stopEditing()
  {
    final TableCellEditor tableCellEditor = table.getCellEditor();
    if (tableCellEditor != null)
    {
      tableCellEditor.stopCellEditing();
    }
  }
View Full Code Here

    dataModel.setData(dataModel.getData());
  }

  public void setData(final Element[] elements)
  {
    final TableCellEditor tableCellEditor = table.getCellEditor();
    if (tableCellEditor != null)
    {
      tableCellEditor.stopCellEditing();
    }

    dataModel.setData(elements);
  }
View Full Code Here

    editor.setShowVerticalLines(false);
  }

  public Object getValue()
  {
    final TableCellEditor editor1 = editor.getCellEditor();
    if (editor1 != null)
    {
      editor1.stopCellEditing();
    }
    return singleValueMetaTableModel.getValue();
  }
View Full Code Here

TOP

Related Classes of javax.swing.table.TableCellEditor

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.