Hello Guys,
I am having a problem when implementing a Custom Property Editor and  I
feel like the tutorial at
https://platform.netbeans.org/tutorials/nbm-property-editors.html#customEditor
should be edited.

The Problem is for my usecase I don't want an InplaceEditor. So far so
good, everything works as expected except from the behavior when I press
"ok".

I haven't found a way to propagate the UI Elements content back to the
property:
1. I tried using PropertyEditorSupport#getValue() in conjunction with
the reference to the return of #getCustomEditor() -> This fails because
there are plenty(!) instances of My Editor Class but for some reason the
one holding the customEditorComponent is exactly the one _not_ getting
the getValue() calls.

2. I tried using editor.setValue(obj); FROM the Swing Component in the
Swing Thread (every time any UI Component changes it's value), but this
fails with java.lang.IllegalStateException: Attempt to mutate in
notification, because my Swing Components also react to
editor.setValue() calls.

I tried digging into
https://github.com/apache/incubator-netbeans/blob/master/platform/openide.explorer/src/org/openide/explorer/propertysheet/PropertyDialogManager.java#L493
and related lines, but I could not find out how to set
"lastValueFromEditor", or say: My calls to
env.setState(PropertyEnv.STATE_VALID); should actually trigger the
lastValueFromEditor to be updated, but there we'd be at issue 1 again.

I guess the solution is very simple but it'd be nice if this could be
clarified because more complex properties just don't work with an
inplace editor.  It would be nice if these steps could also be shown in
the related tutorial (instead of a JLabel, one could use a simple
JInputField maybe?)

The only other possibility I see is instead of passing a JPanel is
passing something extending Window and handle the OK/Cancel myself, but
that's just hacking around the way it was intended.

Kind Regards,
Marc Streckfuß



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to