CFBuilder Contest: Gilt

Today’s CFBuilder Contest entry is our last - Gilt by Justin Carter. It covers something I haven’t used myself, Balsamic Mockups, but from what I can see, this is a pretty powerful little extension and could become something - well incredible - for CFBuilder.

Gilt takes BBML (which is a text-based export from Balsamic) and converts into HTML. Currently it only works with forms. But the result is pretty interesting. Take for example this Balsamic Mockup UI:

From that you can create the BBML export. I've never seen it before, but here is a sample. (And the complete file is in the zip attached to this entry.)

<mockup version="1.0" skin="sketch" measuredW="681" measuredH="554" mockupW="616" mockupH="534"> <controls> <control controlID="0" controlTypeID="com.balsamiq.mockups::TextInput" x="201" y="149" w="-1" h="-1" measuredW="177" measuredH="29" zOrder="1" locked="false" isInGroup="-1"> <controlProperties> <text>justin.w.carter@gmail.com</text> <customID>email</customID> <customData/> </controlProperties> </control> <control controlID="2" controlTypeID="com.balsamiq.mockups::TextInput" x="201" y="108" w="-1" h="-1" measuredW="98" measuredH="29" zOrder="2" locked="false" isInGroup="-1"> <controlProperties> <text>Justin%20Carter</text> <customID>name</customID> <customData>required</customData> </controlProperties> </control>

You take this BBML, paste it into a file, and here is the critical part - select all. Once you've done that, you can right click and select Gilt-Convert to HTML. If you forget to select all, you will get an error. And yep - I keep harping on this. One of the issues I'm seeing in all the extensions lately (and I include mine) is that they don't always properly support the ways they can be run. In this case, his extension is passed the file name, and when it detected no selection, it should have (imho) switched to using the entire source of file. As I said - everyone seems to mess this up. It's just a new way of thinking. Things are rough now. But as time goes on, I think we (those of us who develop CFBuilder extensions) will get the hang of it.

Anyway, after converting the BBML, you end up with:

<label class="label" for="name">Name</label> <input id="name" name="name" value="Justin Carter" /> <input id="email" name="email" value="justin.w.carter@gmail.com" /> <label class="label" for="email">Email</label> <label class="label" for="">Product</label> <input type="radio" id="product-cfbuilder" name="product" value="Adobe ColdFusion Builder" /> <label for="product-cfbuilder">Adobe ColdFusion Builder</label> <input type="radio" id="product-flashbuilder" name="product" value="Adobe Flash Builder" /> <label for="product-flashbuilder">Adobe Flash Builder</label> <input type="checkbox" id="notify" name="notify" value="Please notify me of product updates by email" /> <label for="notify">Please notify me of product updates by email</label> <label class="label" for="enquiry">Enquiry</label> <select id="enquiry" name="enquiry"> <option value="Sales">Sales</option> </select> <textarea id="comment" name="comment">Tell us about your enquiry...</textarea> <input type="submit" value="Save" />

Pretty dang cool! As I said, his extension only supports forms now. But you can imagine this getting more and more powerful as time goes on.

Another interesting aspect of this is his ideEvent.cfc component. He uses it just for one method, but he wrapped a simple method to handle the correct output for telling CFBuilder to insert text into the editor.

function insertText(text) { savecontent variable="xml" { writeOutput(' <response> <ide> <commands> <command type="inserttext"> <params> <param key="text"><![CDATA[#text#]]></param> </params> </command> </commands> </ide> </response> '); } return xml; }

It's really just a glorified snippet, but does make the handler code much simpler:

<cfheader name="Content-Type" value="text/xml"> <cfoutput>#ide.insertText(renderer.output())#</cfoutput>

I really like this idea and I hope to see more of it. Anyway, all in all, a great start. Thanks Justin!

p.s. I'll be posting a wrap up later this week. Thank you to everyone who participated and all the comments from my readers.

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate looking for his next gig. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments