private Action getWrapped() { Node.Property p = getProperty(); EditablePropertyDisplayer pd = (getPropertyDisplayer() instanceof EditablePropertyDisplayer) ? (EditablePropertyDisplayer) getPropertyDisplayer() : new EditablePropertyDisplayer(p); return pd.getCustomEditorAction(); }
public boolean commit() throws IllegalArgumentException { boolean result; try { result =_commit(); } catch (IllegalArgumentException iae) { result = false; if (getUpdatePolicy() != UPDATE_ON_EXPLICIT_REQUEST) { PropertyDialogManager.notify(iae); } else { throw iae; } } return result; }
protected void setPropertyEnv(PropertyEnv env) { if (getPropertyEnv() != null) { detachFromEnv(getPropertyEnv()); } super.setPropertyEnv(env); if (env != null) { env.setChangeImmediate(getUpdatePolicy() != UPDATE_ON_EXPLICIT_REQUEST); attachToEnv(getPropertyEnv()); } }
protected void setInplaceEditor(InplaceEditor ed) { if (getInplaceEditor() != null) { detachFromInplaceEditor(getInplaceEditor()); } super.setInplaceEditor(ed); if ((ed == null) && (getPropertyEnv() != null)) { detachFromEnv(getPropertyEnv()); } if (getInplaceEditor() != null) { attachToInplaceEditor(getInplaceEditor()); } }
InplaceEditor ine = getInplaceEditor(); PropertyEditor editor = (ine == null) ? PropUtils.getPropertyEditor(getProperty()) : ine.getPropertyEditor(); PropertyEnv env = getPropertyEnv(); detachFromEnv(env); tempEnv.setFeatureDescriptor(findFeatureDescriptor(this)); Object result = PropUtils.updatePropertyEditor(getPropertyEditor(), getEnteredValue()); String msg = tempEnv.silentlySetState(env.STATE_VALID, getEnteredValue()); String msg = PropUtils.findLocalizedMessage(e, getEnteredValue(), getProperty().getDisplayName()); Exceptions.attachMessage(iae, "Cannot set value to " + getEnteredValue()); //NOI18N Exceptions.attachLocalizedMessage(iae, msg); editor.setValue(getProperty().getValue()); } catch (Exception ex) { fireStateChanged(); } else { InplaceEditor ed = getInplaceEditor(); getInplaceEditor().reset(); attachToEnv(env);
public String isModifiedValueLegal() { PropertyEditor editor = getPropertyEditor(); Object newValue = getEnteredValue(); PropertyEnv myEnv = getPropertyEnv(); detachFromEnv(myEnv); env.setFeatureDescriptor(findFeatureDescriptor(this)); ((ExPropertyEditor) editor).attachEnv(env); editor.setValue(getProperty().getValue()); } catch (Exception e) { attachToEnv(myEnv); result = PropUtils.findLocalizedMessage(exception, getEnteredValue(), getProperty().getDisplayName()); } else if (PropertyEnv.STATE_INVALID.equals(envState)) { EditablePropertyDisplayer.class, "FMT_CannotUpdateProperty", newValue,getProperty().getDisplayName()); //NOI18N
public void focusLost(java.awt.event.FocusEvent e) { //don't let spurious focus changes while replacing the inner component //trigger additional work if (shouldIgnoreFocusEvents()) { return; } if ( !e.isTemporary() && (getUpdatePolicy() == UPDATE_ON_FOCUS_LOST) && !getInplaceEditor().isKnownComponent(e.getOppositeComponent()) && isValueModified() ) { commit(); } } }
private void attachToInplaceEditor(InplaceEditor ed) { Object o = fetchCachedInitialValue(); if (o != NO_VALUE) { ed.setValue(o); } ed.addActionListener(getInplaceEditorListener()); ed.getComponent().addFocusListener(getInplaceEditorListener()); }
private void attachToEnv(PropertyEnv env) { if (attachedEnv == env) { return; } // System.err.println(" attachToEnv - " + env); env.addVetoableChangeListener(getEnvListener()); env.addPropertyChangeListener(getEnvListener()); env.setBeans(findBeans(this)); }
public void actionPerformed(ActionEvent e) { // System.err.println("\n\nGot action from inplace editor for " + getProperty().getDisplayName() + " - " + e.getActionCommand()); //See if it was enter or escape boolean isSuccess = InplaceEditor.COMMAND_SUCCESS.equals(e.getActionCommand()) || "comboBoxEdited".equals(e.getActionCommand()); //NOI18N //if the value should get updated, do something if (isSuccess) { if ((getUpdatePolicy() == UPDATE_ON_CONFIRMATION) || (getUpdatePolicy() == UPDATE_ON_FOCUS_LOST)) { //XXX needed by property panel, but breaks API def. Fine while this is not API. commit(); } //JTextField style behavior - fire a change unless there are //action listeners attached if (hasActionListeners()) { fireActionPerformed(); } else { //Try to close the dialog, if any on enter - this method //will make sure we're really processing an enter-key event trySendEnterToDialog(); } } else if (!hasActionListeners()) { //Try to close the dialog, if any, and if we're really processing //an escape key event trySendEscToDialog(); } }
result = new EditablePropertyDisplayer(prop, model); result = new EditablePropertyDisplayer(prop, model);
InplaceEditor ine = getInplaceEditor(); PropertyEditor editor = ine == null ? PropUtils.getPropertyEditor(getProperty()) : ine.getPropertyEditor(); PropertyEnv env = getPropertyEnv(); detachFromEnv(env); tempEnv.setFeatureDescriptor(findFeatureDescriptor(this)); if (editor instanceof ExPropertyEditor) { Object result = PropUtils.updatePropertyEditor (getPropertyEditor(), getEnteredValue()); String msg = tempEnv.silentlySetState(env.STATE_VALID, getEnteredValue()); String msg =PropUtils.findLocalizedMessage(e, getEnteredValue(), getProperty().getDisplayName()); "Cannot set value to " + getEnteredValue(), msg, e, null); //NOI18N editor.setValue(getProperty().getValue()); } catch (Exception ex) { fireStateChanged(); } else { InplaceEditor ed = getInplaceEditor();
public String isModifiedValueLegal() { PropertyEditor editor = getPropertyEditor(); Object newValue = getEnteredValue(); PropertyEnv myEnv = getPropertyEnv(); detachFromEnv(myEnv); env.setFeatureDescriptor(findFeatureDescriptor(this)); ((ExPropertyEditor)editor).attachEnv(env); editor.setValue (getProperty().getValue()); } catch (Exception e) { attachToEnv(myEnv); result = PropUtils.findLocalizedMessage(exception, getEnteredValue(), getProperty().getDisplayName()); EditablePropertyDisplayer.class, "FMT_CannotUpdateProperty"), new Object[] {newValue, getProperty().getDisplayName()}); //NOI18N
protected void setInplaceEditor(InplaceEditor ed) { if (getInplaceEditor() != null) { detachFromInplaceEditor(getInplaceEditor()); } super.setInplaceEditor(ed); if (ed == null && getPropertyEnv() != null) { detachFromEnv(getPropertyEnv()); } if (getInplaceEditor() != null) { attachToInplaceEditor(getInplaceEditor()); } }
public void focusLost(java.awt.event.FocusEvent e) { //don't let spurious focus changes while replacing the inner component //trigger additional work if (shouldIgnoreFocusEvents()) { return; } if( !e.isTemporary() && getUpdatePolicy() == UPDATE_ON_FOCUS_LOST && !getInplaceEditor().isKnownComponent(e.getOppositeComponent()) && isValueModified() ) { commit(); } } }
private void attachToInplaceEditor (InplaceEditor ed) { Object o = fetchCachedInitialValue(); if (o != NO_VALUE) { ed.setValue(o); } ed.addActionListener(getInplaceEditorListener()); ed.getComponent().addFocusListener(getInplaceEditorListener()); }
private void attachToEnv(PropertyEnv env) { if (attachedEnv == env) { return; } // System.err.println(" attachToEnv - " + env); env.addVetoableChangeListener(getEnvListener()); env.addPropertyChangeListener(getEnvListener()); env.setBeans(findBeans(this)); }
if (getUpdatePolicy() == UPDATE_ON_CONFIRMATION || getUpdatePolicy() == UPDATE_ON_FOCUS_LOST) { //XXX needed by property panel, but breaks API def. Fine while this is not API. commit();
case 12: case 4 : //PREF_INPUT_STATE result = new EditablePropertyDisplayer(prop, model); break; case 13: case 8 : default : result = new EditablePropertyDisplayer(prop, model); break;
InplaceEditor ine = getInplaceEditor(); PropertyEditor editor = ine == null ? PropUtils.getPropertyEditor(getProperty()) : ine.getPropertyEditor(); PropertyEnv env = getPropertyEnv(); detachFromEnv(env); tempEnv.setFeatureDescriptor(findFeatureDescriptor(this)); if (editor instanceof ExPropertyEditor) { Object result = PropUtils.updatePropertyEditor (getPropertyEditor(), getEnteredValue()); String msg = tempEnv.silentlySetState(env.STATE_VALID, getEnteredValue()); String msg =PropUtils.findLocalizedMessage(e, getEnteredValue(), getProperty().getDisplayName()); "Cannot set value to " + getEnteredValue(), msg, e, null); //NOI18N editor.setValue(getProperty().getValue()); } catch (Exception ex) { fireStateChanged(); } else { InplaceEditor ed = getInplaceEditor();