/** Find the current index of the last edited FeatureDescriptor, to * figure out in which cell to restore the editing state */ private int indexOfLastSelected() { if (storedFd == null) { return -1; } PropertySetModel mdl = getPropertySetModel(); int idx = mdl.indexOf(storedFd); storedFd = null; return idx; }
/** Find the current index of the last edited FeatureDescriptor, to * figure out in which cell to restore the editing state */ private int indexOfLastSelected () { if (storedFd == null) return -1; PropertySetModel mdl = getPropertySetModel(); int idx = mdl.indexOf(storedFd); storedFd = null; return idx; }
/** Find the current index of the last edited FeatureDescriptor, to * figure out in which cell to restore the editing state */ private int indexOfLastSelected () { if (storedFd == null) return -1; PropertySetModel mdl = getPropertySetModel(); int idx = mdl.indexOf(storedFd); storedFd = null; return idx; }
/** * Expand or collapse the PropertySet the given property belongs to. * @param fd * @since 6.47 */ protected final void toggleExpanded( FeatureDescriptor fd ) { int index = table.getPropertySetModel().indexOf( fd ); if( index >= 0 ) { table.getPropertySetModel().toggleExpanded( index ); } }
/** Called when a property value changes, in order to update * the UI with the new value. */ public void propertyChange(PropertyChangeEvent evt) { int index = getPropertySetModel().indexOf ((FeatureDescriptor) evt.getSource()); if (index == -1) { //We don't know what happened, do a generic change event fireTableChanged( new TableModelEvent(this) ); } else { TableModelEvent tme = new TableModelEvent (this, index); fireTableChanged(tme); } }
/** Called when a property value changes, in order to update * the UI with the new value. */ public void propertyChange(PropertyChangeEvent evt) { int index = getPropertySetModel().indexOf ((FeatureDescriptor) evt.getSource()); if (index == -1) { //We don't know what happened, do a generic change event fireTableChanged( new TableModelEvent(this) ); } else { TableModelEvent tme = new TableModelEvent (this, index); fireTableChanged(tme); } }
/** * Select (and start editing) the given property. * @param fd * @param startEditing */ public void select( FeatureDescriptor fd, boolean startEditing ) { PropertySetModel psm = getPropertySetModel(); final int index = psm.indexOf( fd ); if( index < 0 ) { return; //not in our list } getSelectionModel().setSelectionInterval( index, index ); if( startEditing && psm.isProperty( index ) ) { editCellAt( index, 1, new MouseEvent( SheetTable.this, 0, System.currentTimeMillis(), 0, 0, 0, 1, false) ); SwingUtilities.invokeLater( new Runnable() { @Override public void run() { SheetCellEditor cellEditor = getEditor(); if( null != cellEditor ) { InplaceEditor inplace = cellEditor.getInplaceEditor(); if( null != inplace && null != inplace.getComponent() ) { inplace.getComponent().requestFocus(); } } } }); } }