Sunday, March 9, 2008

Bindings View

In the new Bindings View browser, keys and actions are grouped by type, in reverse order of inheritance tree depth. So, for instance, in your component, your custom components keys appear first, then your component's superclass, then WOComponent, etc. For model objects, your custom methods appear, then your _Class methods, then ERXGenericRecord, then EOGenericRecord, etc. This should help address the desire to show the mostly important bindings first (those being the ones that are directly on the class you're talking to), but also provide access to more specialized custom bindings.

The bindings inspector shows all the available bindings for a component, and turns red the ones that are currently invalid. Both the key and values are editable by double-clicking in the cell, or by dragging bindings from the browser onto the table view. You can also create new bindings with the "New Binding" button and remove existing bindings with the "Remove Binding" button (or by blanking out the value of a binding with the editor). Lastly, if you define a missing key or action as the binding, you can select it and click the "Add Key" button to go through the Add Key/Add Action dialog.

Here's an example of a binding name in editing mode.


And here is a snapshot of a binding being dragged to the inspector view. You can also drag onto HTML or WOD entries in the same way.




Here's dropping onto a binding in the HTML view.



And last, but not least, there are new Delete Tag and Unwrap Tag actions in the editor. Delete tag will remove the tag you're under, and all of its contents. If the tag is a WO tag, it will also remove the WOD entry if this is the last tag reference to it. Unwrap tag is the same, but only removes the tag and does not remove the tag's contents.

Note that all of these features are still Experimental (they are rewriting your WOD and HTML documents, which could mean they could decide to EAT your WOD and HTML documents). To try them out, grab the latest nightly and go to Window=>Show View=>Other... browse down to the "WOLips" category and select "Bindings (Experimental)".

One element that isn't quite there yet is undo ... Right now undo is handled separately in the WOD and HTML, so if you perform an operation that requires rewriting both, you will need to undo in each to undo the changes. I'm working on trying to figure out how to do a composite undo manager, but it's not there yet.

Check out the videos in the previous posts to see some of the slightly older versions of these features in action.

7 comments:

teehemkay said...

Mike, you rock!

This is incredibly cool and useful. Thanks a million!
I guess all those who keep bringing up WOBuilder are gonna LOVE this ;-).

= tmk =

GalenR67 said...

This is awesome Mike. Are you going to provide a preference so that, with inline bindings, you can specify to use the WOML brackets ("[binding]") instead of the Wonder dollar sign ("$binding")?

Mike Schrag said...

The particular line that constructs the final value to insert doesn't have a 5.4 check around it at the moment, but it will. Actually, I need to add per-project var prefix/suffix settings into WOL, because technically you can override those in 5.4 (so you could switch to $ syntax in 5.4 if you wanted).

Daniele Corti said...

Thank you, Mike, but I've notice one thing: when I change the Java file of one component, the bindings in the list don't refresh until I close and reopen the component. Is there something to change to make it automatic?

Mike Schrag said...

Are you using the latest nightly build? That was true of the earlier versions, but the latest updates immediately for me when I change the Java file.

Daniele Corti said...

Yeah, I use the stable version. I'll change to the nightly, thank you, Mike

Mike Schrag said...

I'm not encouraging you to switch to nightly. You should be on stable. This is not on stable for a reason ... So be aware of that before you just switch to nightly.