Friday, March 3, 2006

Hidden Creator Feature #5: Power Inline Editing

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


Creator 2 supports inline editing of lots of components. This includes "non-textual" components like buttons, text fields and text areas. There are a couple of secret flags you can set to change the behavior of inline editing.



Inline editing is normally disabled for components that have are bound to value binding expressions (e.g. the value contains #{...}). Normally, at designtime, these components display "dummy data" - 123 for numeric expressions and abc for textual expressions. We can of course let you enter inline editing (by pressing F2 when the component is selected, or simply clicking on it when it's already selected, or using the context menu "Edit propertyname"). But there was a concern that people, especially novice users, would inadvertently edit their value binding expressions and get in trouble. So, it's normally disallowed. But if you run Creator with


-J-Drave.allow-vb-editing=true

(or add this to your creator.conf file), you can edit value binding expressions to your heart's content. When you enter inline editing mode, the value binding expression is shown in the designer page, and as soon as you commit, the normal dummy data is displayed again.



Inline editing also works on some components that aren't textual in the normal HTML sense - such as buttons, textfields and text areas. By default, Creator will allow inline editing of button labels by showing a textfield in place of the button when you are inline editing it. Early on I implemented inline editing of buttons with a textfield below the edited component instead. For buttons, this is still a decent behavior I think - especially when you initially drop a button, since it's a bit disconcerting to drop a button and see a text field... If you prefer that behavior, you can have it that way by running with this flag:


-J-Drave.edit-adjacent=true



Here's how this looks when you run with both flags and try to edit a value-bound button. Notice how the inline edited expression is a value binding expression, and notice how it's displayed in a textfield below the actual button:






(Text Fields and Text Areas are still inline edited in place. And note that to commit input in a text area, you press Shift+Enter since just Enter inserts a newline.)


No comments:

Post a Comment