You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Vladimir Nišević <vn...@gmail.com> on 2017/08/19 16:58:03 UTC
Specifying cssClass in runfime?
Hi, I have a requirement to present the background of specific property
based on its value or depending on other object properties. Currently I can
define cssClass as described
https://isis.apache.org/guides/ugfun/ugfun.html#_ugfun_ui-hints_action-icons-and-css
at development time.
It would be great if I could define a kind of specification class similar
to
https://isis.apache.org/guides/rgant/rgant.html#_rgant-Property_mustSatisfy
which returns cssClass in runtime.
It could look like this
public class Customer {
@Property(cssSpecification=MyCssClass.class)
public String getFirstName() { ... }
...
}
public class MyCssClass implements CssSpecification {
public String cssClass(Object obj) {
if (((Customer) getFirstName())==null)
return "x-test";
return "x-firstName-not-empty";
}
}
Make this requirement sense, and if so, any hints how I could implement
this?
Regards,Vladimir
Re: Specifying cssClass in runfime?
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Vladimir,
From memory, take a look at CssClassFacet and implement and register your
own facet factory implementation.
Can provide more details if nec (tomorrow).
Cheers,
Dan.
On Sat, 19 Aug 2017, 17:58 Vladimir Nišević <vn...@gmail.com> wrote:
> Hi, I have a requirement to present the background of specific property
> based on its value or depending on other object properties. Currently I can
> define cssClass as described
>
> https://isis.apache.org/guides/ugfun/ugfun.html#_ugfun_ui-hints_action-icons-and-css
> at development time.
>
> It would be great if I could define a kind of specification class similar
> to
> https://isis.apache.org/guides/rgant/rgant.html#_rgant-Property_mustSatisfy
> which returns cssClass in runtime.
>
> It could look like this
>
> public class Customer {
> @Property(cssSpecification=MyCssClass.class)
> public String getFirstName() { ... }
> ...
> }
>
>
>
> public class MyCssClass implements CssSpecification {
> public String cssClass(Object obj) {
> if (((Customer) getFirstName())==null)
> return "x-test";
> return "x-firstName-not-empty";
> }
> }
>
>
> Make this requirement sense, and if so, any hints how I could implement
> this?
>
> Regards,Vladimir
>