[jboss-user] [JBoss Seam] - Re: how to conditionally render a row of dataTable

ellenzhao do-not-reply at jboss.com
Sun Aug 19 14:42:24 EDT 2007


Yes that's a good idea! Could you please point me to documentation on how to create an EL function? In my view code (.xhtml files), there is heck lot of rendering rules (occurence of the word "rendered = " > 100), some are repeated again and again and again for different fields/buttons. 

It would be really nice if I could say something like:


  | rendering rules: for view-id = "foo.xhtml"
  | 
  | rule: "rendering rule for the use case "create a foo"
  | when
  |    fooManager.useCases.peek() == "createAFoo",
  |    fooManager.foo.crudStatus.toString == "new", // "new" means the id has not been fetched from the DB yet.
  |    identity.hasRole('admin'),
  |    .....
  | then
  |   render fields: setter for (fooManager.foo.name, fooManager.foo.description, fooManager.foo......)
  |   render action button: button1, button2....
  |   not render: // some fields and/or buttons you do not want to render 
  | 
  | end
  | 
  | rule: "rendering rule for the use case "update a foo"
  | when
  |  ....
  | then
  | ...
  | end
  | 
  | 


This way composition will be really easy....Even better, the view can be mapped/annotated in the entity class to reduce the view code, for example:


  | @Column(name = "name"....)
  | @View(outputText)
  | public String getName(){...}
  | 
  | @View(inputText)
  | public void setName(String name){...}
  | 
  | .....
  | 

And in the fooManager class:

  | 
  | ...
  | 
  | @View(actionButton)
  | public void tryUpdateAFoo(){
  | }
  | 
  | ...
  | 



Regards,
Ellen

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075570#4075570

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075570



More information about the jboss-user mailing list