branaway / Japid

A Java-based statically-typed fast template engine that can be used in any Java code. It has special adapter for use with the Play! Framework.
113 stars 18 forks source link

[feature request] - add shortcut for String.format("...", Object... args) #20

Closed tunggad closed 13 years ago

tunggad commented 13 years ago

I have to so often call String.format in my Japid templates, so it would be nice, if we had a shortcut method for that, may be 'public static String f(String template, Object... args)' in JapidTemplateBaseWithoutPlay. For the meantime i put this method in my own JapidWebUtil.

branaway commented 13 years ago

Easy one, but I'm curious about your use case. I hardly find myself needing do this level of string manipulation in the view layer. What kind of content are you dealing with may I ask?

tunggad commented 13 years ago

Im a fan of reusing UI logic codes in form of tags/templates as components. They are ajax:, ajaxForm, paginator (configurable: full-load or ajax), overlay (static + ajax), uploadify, tabbedPanel (configurable, mixable usage: static, full-load, ajax) etc. They all contain much UI dispatching logic + javascript, what i dont want i to copy&paste everytime i need them. Coding of such things requires maximum concentration.

And you know why i need/love named paramater passing that much? For example the ajaxForm tag, ultilizes the jQuery form-plugin underneath, has this long args declaration line:

`args String id, String action, String target, String reRender, String dataType, String beforeSubmit, String success, Boolean clearForm, String cssClass, Boolean onOverlay

PS: My background, im from component-based web development (Echo2, JSF). But, more and more, i realize and love action-based frameworks (Spring MVC, Grails and now Play!).

tunggad commented 13 years ago

Powerful static importing of all Classes defined under japidviews/_javatags implemeted. See changes log of version 0.8.7