javax.swing.table.TableCellEditor#stopCellEditing ( )源码实例Demo

下面列出了javax.swing.table.TableCellEditor#stopCellEditing ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pentaho-reporting   文件: EditGroupsDialog.java
public void actionPerformed( final ActionEvent e ) {
  final TableCellEditor cellEditor = table.getCellEditor();
  if ( cellEditor != null ) {
    cellEditor.stopCellEditing();
  }
  final int maxIdx = selectionModel.getMaxSelectionIndex();
  final ArrayList<GroupDataEntry> list = new ArrayList<GroupDataEntry>();
  for ( int i = selectionModel.getMinSelectionIndex(); i <= maxIdx; i++ ) {
    if ( selectionModel.isSelectedIndex( i ) ) {
      list.add( tableModel.get( i ) );
    }
  }

  for ( int i = 0; i < list.size(); i++ ) {
    final GroupDataEntry dataEntry = list.get( i );
    tableModel.remove( dataEntry );
  }
}
 
源代码2 项目: PolyGlot   文件: PDeclensionGridPanel.java
/**
 * Gets map of all declined word forms. Key = combined ID, value = word form
 * @return 
 */
@Override
public Map<String, String> getAllDecValues() {
    Map<String, String> ret = new HashMap<>();
    
    TableCellEditor editor = table.getCellEditor();
    if (editor != null) {
        editor.stopCellEditing();
    }
    
    decIdsToGridLocation.entrySet().forEach((entry) -> {
        Object val = table.getModel().getValueAt(entry.getValue().height, entry.getValue().width);
        ret.put(entry.getKey(), val == null ? "" : (String)val);
    });
    
    return ret;
}
 
源代码3 项目: pentaho-reporting   文件: RemoveBulkAction.java
/**
 * Invoked when an action occurs.
 */
public void actionPerformed( final ActionEvent e ) {
  if ( listSelectionModel.isSelectionEmpty() ) {
    return;
  }

  if ( editorTable != null ) {
    final TableCellEditor cellEditor = editorTable.getCellEditor();
    if ( cellEditor != null ) {
      cellEditor.stopCellEditing();
    }
  }


  final Object[] data = tableModel.getBulkData();
  final ArrayList<Object> result = new ArrayList<Object>( data.length );
  for ( int i = 0; i < data.length; i++ ) {
    if ( listSelectionModel.isSelectedIndex( i ) == false ) {
      result.add( data[ i ] );
    }
  }

  tableModel.setBulkData( result.toArray() );
}
 
源代码4 项目: jmeter-plugins   文件: AddRowAction.java
public void actionPerformed(ActionEvent e) {
    if (grid.isEditing()) {
        TableCellEditor cellEditor = grid.getCellEditor(grid.getEditingRow(), grid.getEditingColumn());
        cellEditor.stopCellEditing();
    }

    tableModel.addRow(defaultValues);
    tableModel.fireTableDataChanged();

    // Enable DELETE (which may already be enabled, but it won't hurt)
    deleteRowButton.setEnabled(true);

    // Highlight (select) the appropriate row.
    int rowToSelect = tableModel.getRowCount() - 1;
    if (rowToSelect < grid.getRowCount()) {
        grid.setRowSelectionInterval(rowToSelect, rowToSelect);
    }
    sender.updateUI();
}
 
源代码5 项目: beast-mcmc   文件: TableEditorStopper.java
public void focusLost(FocusEvent e)
{
    if (focused!=null)
    {
        focused.removeFocusListener(this);
        focused = e.getOppositeComponent();
        if (table==focused || table.isAncestorOf(focused))
        {
            focused.addFocusListener(this);
        }
        else
        {
            focused=null;
            TableCellEditor editor = table.getCellEditor();
            if (editor!=null)
            {
                editor.stopCellEditing();
            }
        }
    }
}
 
源代码6 项目: dragonwell8_jdk   文件: XMBeanAttributes.java
public void stopCellEditing() {
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("Stop Editing Row: "+getEditingRow());
    }
    final TableCellEditor tableCellEditor = getCellEditor();
    if (tableCellEditor != null) {
        tableCellEditor.stopCellEditing();
    }
}
 
源代码7 项目: jdk8u-jdk   文件: XMBeanAttributes.java
public void stopCellEditing() {
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("Stop Editing Row: "+getEditingRow());
    }
    final TableCellEditor tableCellEditor = getCellEditor();
    if (tableCellEditor != null) {
        tableCellEditor.stopCellEditing();
    }
}
 
源代码8 项目: hottub   文件: XMBeanAttributes.java
public void stopCellEditing() {
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("Stop Editing Row: "+getEditingRow());
    }
    final TableCellEditor tableCellEditor = getCellEditor();
    if (tableCellEditor != null) {
        tableCellEditor.stopCellEditing();
    }
}
 
源代码9 项目: pentaho-reporting   文件: SortBulkDownAction.java
/**
 * Invoked when an action occurs.
 */
public void actionPerformed( final ActionEvent e ) {
  if ( listSelectionModel.isSelectionEmpty() ) {
    return;
  }
  final Object[] data = tableModel.getBulkData();
  if ( listSelectionModel.getMaxSelectionIndex() == ( data.length - 1 ) ) {
    // already the first entry ...
    return;
  }

  if ( editorTable != null ) {
    final TableCellEditor cellEditor = editorTable.getCellEditor();
    if ( cellEditor != null ) {
      cellEditor.stopCellEditing();
    }
  }

  final Object[] result = (Object[]) data.clone();
  final boolean[] selections = new boolean[ result.length ];
  for ( int i = listSelectionModel.getMinSelectionIndex(); i <= listSelectionModel.getMaxSelectionIndex(); i++ ) {
    selections[ i ] = listSelectionModel.isSelectedIndex( i );
  }

  BulkDataUtility.pushDown( result, selections );

  tableModel.setBulkData( result );

  listSelectionModel.setValueIsAdjusting( true );
  listSelectionModel.removeSelectionInterval( 0, selections.length );
  for ( int i = 0; i < selections.length; i++ ) {
    final boolean selection = selections[ i ];
    if ( selection ) {
      listSelectionModel.addSelectionInterval( i, i );
    }
  }
  listSelectionModel.setValueIsAdjusting( false );
}
 
源代码10 项目: pentaho-reporting   文件: ParameterEditorDialog.java
/**
 * Invoked when an action occurs.
 */
public void actionPerformed(final ActionEvent e)
{
  final TableCellEditor tableCellEditor = parameterMappingTable.getCellEditor();
  if (tableCellEditor != null)
  {
    tableCellEditor.stopCellEditing();
  }
  final ParameterMappingTableModel tableModel = (ParameterMappingTableModel) parameterMappingTable.getModel();
  tableModel.addRow();
}
 
源代码11 项目: bigtable-sql   文件: SchemaPropertiesController.java
public void applyChanges()
{

   TableCellEditor cellEditor = _pnl.tblSchemas.getCellEditor();
   if(null != cellEditor)
   {
      cellEditor.stopCellEditing();
   }


   if(_pnl.radLoadAllAndCacheNone.isSelected())
   {
      _alias.getSchemaProperties().setGlobalState(SQLAliasSchemaProperties.GLOBAL_STATE_LOAD_ALL_CACHE_NONE);
   }
   else if(_pnl.radLoadAndCacheAll.isSelected())
   {
      _alias.getSchemaProperties().setGlobalState(SQLAliasSchemaProperties.GLOBAL_STATE_LOAD_AND_CACHE_ALL);
   }
   else if(_pnl.radSpecifySchemas.isSelected())
   {
      _alias.getSchemaProperties().setGlobalState(SQLAliasSchemaProperties.GLOBAL_STATE_SPECIFY_SCHEMAS);
   }

   _alias.getSchemaProperties().setSchemaDetails(_schemaTableModel.getData());

   _alias.getSchemaProperties().setCacheSchemaIndependentMetaData(_pnl.chkCacheSchemaIndepndentMetaData.isSelected());

}
 
源代码12 项目: pentaho-reporting   文件: StyleEditorPanel.java
public void setData( final Element[] elements ) {
  final TableCellEditor tableCellEditor = table.getCellEditor();
  if ( tableCellEditor != null ) {
    tableCellEditor.stopCellEditing();
  }

  dataModel.setData( elements );
}
 
源代码13 项目: orbit-image-analysis   文件: PropertySheetTable.java
/**
 * Commits on-going cell editing 
 */
public void commitEditing() {
  TableCellEditor editor = getCellEditor();
  if (editor != null) {
    editor.stopCellEditing();
  }    
}
 
源代码14 项目: pentaho-reporting   文件: EditGroupsDialog.java
public void actionPerformed( final ActionEvent e ) {
  final TableCellEditor cellEditor = table.getCellEditor();
  if ( cellEditor != null ) {
    cellEditor.stopCellEditing();
  }

  final EditGroupDetailsDialog dialog = new EditGroupDetailsDialog( EditGroupsDialog.this );
  final RelationalGroup group = new RelationalGroup();
  final EditGroupUndoEntry groupUndoEntry = dialog.editGroup( group, getReportRenderContext(), true );
  if ( groupUndoEntry != null ) {
    tableModel.add( new GroupDataEntry( null, groupUndoEntry.getNewName(), groupUndoEntry.getNewFields() ) );
  }
}
 
源代码15 项目: openjdk-8-source   文件: XMBeanAttributes.java
public void stopCellEditing() {
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("Stop Editing Row: "+getEditingRow());
    }
    final TableCellEditor tableCellEditor = getCellEditor();
    if (tableCellEditor != null) {
        tableCellEditor.stopCellEditing();
    }
}
 
源代码16 项目: openjdk-8   文件: XMBeanAttributes.java
public void stopCellEditing() {
    if (LOGGER.isLoggable(Level.FINER)) {
        LOGGER.finer("Stop Editing Row: "+getEditingRow());
    }
    final TableCellEditor tableCellEditor = getCellEditor();
    if (tableCellEditor != null) {
        tableCellEditor.stopCellEditing();
    }
}
 
源代码17 项目: nosql4idea   文件: NoSqlConfigurable.java
private void stopEditing() {
    if (table.isEditing()) {
        TableCellEditor editor = table.getCellEditor();
        if (editor != null) {
            editor.stopCellEditing();
        }
    }
}
 
源代码18 项目: pentaho-reporting   文件: SortBulkUpAction.java
/**
 * Invoked when an action occurs.
 */
public void actionPerformed( final ActionEvent e ) {
  if ( listSelectionModel.isSelectionEmpty() ) {
    return;
  }
  if ( listSelectionModel.getMinSelectionIndex() == 0 ) {
    // already the first entry ...
    return;
  }

  if ( editorTable != null ) {
    final TableCellEditor cellEditor = editorTable.getCellEditor();
    if ( cellEditor != null ) {
      cellEditor.stopCellEditing();
    }
  }


  final Object[] data = tableModel.getBulkData();
  final Object[] result = (Object[]) data.clone();
  final boolean[] selections = new boolean[ result.length ];
  for ( int i = listSelectionModel.getMinSelectionIndex(); i <= listSelectionModel.getMaxSelectionIndex(); i++ ) {
    selections[ i ] = listSelectionModel.isSelectedIndex( i );
  }

  BulkDataUtility.pushUp( result, selections );
  tableModel.setBulkData( result );

  listSelectionModel.setValueIsAdjusting( true );
  listSelectionModel.removeSelectionInterval( 0, selections.length );
  for ( int i = 0; i < selections.length; i++ ) {
    final boolean selection = selections[ i ];
    if ( selection ) {
      listSelectionModel.addSelectionInterval( i, i );
    }
  }
  listSelectionModel.setValueIsAdjusting( false );
}
 
源代码19 项目: openjdk-jdk9   文件: XMBeanAttributes.java
public void stopCellEditing() {
    if (LOGGER.isLoggable(Level.TRACE)) {
        LOGGER.log(Level.TRACE, "Stop Editing Row: "+getEditingRow());
    }
    final TableCellEditor tableCellEditor = getCellEditor();
    if (tableCellEditor != null) {
        tableCellEditor.stopCellEditing();
    }
}
 
源代码20 项目: neembuu-uploader   文件: AccountsManager.java
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
    //The user may type into the field and while the cursor is still inside, 
    //he may click save button.
    //It will not set the value into that field and will cause error.
    //So when the user clicks save button, we have to stop that cellediting process
    //and set the value to the field.

    //Get the currently edited cell's celleditor
    TableCellEditor cellEditor = accountsTable.getCellEditor();

    //Call stopCellEditing() to stop the editing process
    //But if the selected cell is in first column which is non editable, then
    //calling stopCellEditing will throw nullpointer exception because there's
    //no editor there.. So check for null, before calling stopCellEditing().
    if (cellEditor != null) {
        cellEditor.stopCellEditing();
    }

    //Iterate through each row..
    //int row = 0;
    for (Account account : amw.getAccounts().values()) {
        //Declare local variables to store the username and password
        //If none present, empty "" is stored.
        
        String username = "", password = "";
        for (int i = 0; i < accountsTable.getModel().getRowCount(); i++) {
            if(accountsTable.getValueAt(i, HOSTNAME).toString().equals(account.getHOSTNAME())){
                username = accountsTable.getValueAt(i, USERNAME).toString();
                password = accountsTable.getValueAt(i, PASSWORD).toString();
            }
        }
        
        

        //The username and password field must be both filled or both empty
        //Only one field should not be filled.
        if (username.isEmpty() ^ password.isEmpty()) {
            NULogger.getLogger().info("The username and password field must be both filled or both empty");
            ThemeCheck.apply(null);
            JOptionPane.showMessageDialog(this,
                    account.getHOSTNAME() + " " + Translation.T().dialogerror(),
                    account.getHOSTNAME(),
                    JOptionPane.WARNING_MESSAGE);
            return;
        }

        //Username and Password (encrypted) must be stored in the .nuproperties file in the user's home folder.
        NULogger.getLogger().info("Setting username and password(encrypted) to the .nuproperties file in user home folder.");
        NeembuuUploaderProperties.setProperty(account.getKeyUsername(), username);
        NeembuuUploaderProperties.setEncryptedProperty(account.getKeyPassword(), password);

       // row++;
    }

    //Separate thread to start the login process
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                loginEnabledAccounts();
            } catch (Exception ex) {
                System.err.println("Exception while logging in.." + ex);
                NULogger.getLogger().severe(ex.toString());
            }
        }
    });

    //Disposing the window
    NULogger.getLogger().info("Closing Accounts Manager..");
    
    try{
        if(isVisible())
            dispose();
    }catch(Exception a){
        System.err.println("Following error may be ignored");
        a.printStackTrace();
    }
}