/** Fetch the static editor instance shared among tables */ SheetCellEditor getEditor() { if (sheetCellEditor == null) { sheetCellEditor = new SheetCellEditor(getReusablePropertyEnv()); } return sheetCellEditor; }
setInplaceEditor(inplace = factory().getInplaceEditor(p, false)); setInplaceEditor(null); realEditor = inplaceEditor.getComponent(); ButtonPanel bp = buttonPanel();
cancelCellEditing(); stopCellEditing(); } else if (ae.getActionCommand() == InplaceEditor.COMMAND_FAILURE) { if (PropUtils.psCommitOnFocusLoss) { stopCellEditing(); } else { cancelCellEditing();
public void cancelCellEditing() { if (inplaceEditor != null) { try { if (PropUtils.isLoggable(SheetCellEditor.class)) { PropUtils.log (SheetCellEditor.class, " SheetCellEditor.cancelCellEditing ", true); //NOI18N } fireEditingCancelled(); } finally { setInplaceEditor (null); } } }
fireEditingStopped(); tryPostSetAction(mdl); setInplaceEditor(null);
@Override public void actionPerformed(ActionEvent e) { if (isEditing()) { SheetCellEditor cellEditor = getEditor(); InplaceEditor inplaceEditor = cellEditor.getInplaceEditor(); if (inplaceEditor instanceof IncrementPropertyValueSupport) { IncrementPropertyValueSupport incrementSupport = ( IncrementPropertyValueSupport ) inplaceEditor; boolean consume = isIncrement ? incrementSupport.incrementValue() : incrementSupport.decrementValue(); if( consume ) return; } } changeRowAction.actionPerformed(e); } }
/** If we have been editing and the user has typed something, fetch this * value to use in the custom editor */ public Object getPartialValue() { Object partialValue=null; if (isEditing() && (editingRow == getSelectedRow())) { InplaceEditor ine = getEditor().getInplaceEditor(); if (ine != null) { partialValue = ine.getValue(); //reset the inplace editor so the value is not taken when the editor //is closed ine.reset(); getEditor().cancelCellEditing(); } } else { partialValue = null; if (isEditing()) { removeEditor(); } } return partialValue; }
/** Toggle the expanded state of a property set. If editing, the edit is * cancelled. */ private void toggleExpanded (int index) { if (isEditing()) getEditor().cancelCellEditing(); PropertySetModel psm = getSheetModel().getPropertySetModel(); psm.toggleExpanded (index); }
/** Overridden to check if the edit failed, and if so, set a focus event * countdown for re-initiating editing */ public void editingStopped(ChangeEvent e) { super.editingStopped(e); //Po Ting's request for Rave - if commit on focus loss is on, all //edits look like failures and trigger a new call to editCellAt() if(!PropUtils.psCommitOnFocusLoss && !getEditor().isLastUpdateSuccessful()) { //The last update failed, we're two focus events away from really //having focus again - we'll get one, then the error dialog will //steal focus. On the second one we've got focus back. countDown = 2; } }
@Override public void removeEditor() { enterEditorRemoveRequest(); try { // synchronized(getTreeLock()) { super.removeEditor(); //Make the editor detach its listeners and clear values in the //inplace editor since we're done with it getEditor().setInplaceEditor(null); // } //Order of removal can cause the custom editor button to get focus even //though it's no longer onscreen, when the custom editor is removed // Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); } finally { exitEditorRemoveRequest(); } }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component result = null; //since you can't change the model, no worries SheetTable stb = (SheetTable) table; lastUpdateSuccess = true; //fetch the property from the set model Property p = (Property) stb.getSheetModel().getPropertySetModel().getFeatureDescriptor(row); result = getEditorComponent( p, this, table.getForeground(), table.getBackground(), table.getSelectionBackground(), table.getSelectionForeground() ); if (result instanceof ButtonPanel) { ((ButtonPanel) result).setButtonAction(stb.getCustomEditorAction()); } if (result != null) { result.setFont(stb.getFont()); } return result; }
PropUtils.log (SheetCellEditor.class, " SheetCellEditor Firing editing stopped"); //NOI18N fireEditingStopped(); tryPostSetAction(mdl); setInplaceEditor (null); reusableEnv.clear();
@Override public void run() { SheetCellEditor cellEditor = getEditor(); if( null != cellEditor ) { InplaceEditor inplace = cellEditor.getInplaceEditor(); if( null != inplace && null != inplace.getComponent() ) { inplace.getComponent().requestFocus(); } } } });
public void cancelCellEditing() { if (inplaceEditor != null) { try { if (PropUtils.isLoggable(SheetCellEditor.class)) { PropUtils.log(SheetCellEditor.class, " SheetCellEditor.cancelCellEditing ", true); //NOI18N } fireEditingCancelled(); } finally { setInplaceEditor(null); } } }
/** If we have been editing and the user has typed something, fetch this * value to use in the custom editor */ @Override public Object getPartialValue() { Object partialValue = null; if (isEditing() && (editingRow == getSelectedRow())) { InplaceEditor ine = getEditor().getInplaceEditor(); if (ine != null) { partialValue = ine.getValue(); //reset the inplace editor so the value is not taken when the editor //is closed ine.reset(); getEditor().cancelCellEditing(); } } else { partialValue = null; if (isEditing()) { removeEditor(); } } return partialValue; }
/** Toggle the expanded state of a property set. If editing, the edit is * cancelled. */ private void toggleExpanded(int index) { if (isEditing()) { getEditor().cancelCellEditing(); } PropertySetModel psm = getSheetModel().getPropertySetModel(); psm.toggleExpanded(index); }
/** Overridden to check if the edit failed, and if so, set a focus event * countdown for re-initiating editing */ public void editingStopped(ChangeEvent e) { super.editingStopped(e); //Po Ting's request for Rave - if commit on focus loss is on, all //edits look like failures and trigger a new call to editCellAt() if(!PropUtils.psCommitOnFocusLoss && !getEditor().isLastUpdateSuccessful()) { //The last update failed, we're two focus events away from really //having focus again - we'll get one, then the error dialog will //steal focus. On the second one we've got focus back. countDown = 2; } }
public void removeEditor() { enterEditorRemoveRequest(); try { // synchronized(getTreeLock()) { super.removeEditor(); //Make the editor detach its listeners and clear values in the //inplace editor since we're done with it getEditor().setInplaceEditor(null); // } //Order of removal can cause the custom editor button to get focus even //though it's no longer onscreen, when the custom editor is removed // Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); } finally { exitEditorRemoveRequest(); } }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { Component result = null; //since you can't change the model, no worries SheetTable stb = (SheetTable) table; lastUpdateSuccess=true; //fetch the property from the set model Property p = (Property) stb.getSheetModel() .getPropertySetModel().getFeatureDescriptor(row); result = getEditorComponent (p, this, table.getForeground(), table.getBackground(), table.getSelectionBackground(), table.getSelectionForeground()); if (result instanceof ButtonPanel) { ((ButtonPanel) result).setButtonAction (stb.getCustomEditorAction()); } if (result != null) { result.setFont(stb.getFont()); } return result; }
setInplaceEditor (inplace = factory().getInplaceEditor(p, false)); setInplaceEditor(null); return null; if (ped.supportsCustomEditor() && !propRequestsSuppressButton) { realEditor = inplaceEditor.getComponent(); ButtonPanel bp = buttonPanel();