You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2013/05/28 15:45:06 UTC

beanmodel ques

Hi Folks,

I have a Player.class

public class Player extends Person implements Cloneable, Serializable {

    private Set<PlayerStats> playerStats = new HashSet<PlayerStats>();

He has a collection of stats. goals, assists, points etc...

I am rendering league leaders... so I have a bean model I am working on

        myModel = beanModelSource.createDisplayModel(Player.class, messages);
        myModel.add("action", null);
        myModel.include("id", "number", "photo", "lastName", "firstName");
        myModel.get("firstName").sortable(false);
        myModel.get("lastName").label("Surname");    

How do I get the stats into the bean model? They are of a different class PlayerStat.class

I want to include both player info and player stats in the same bean model.

Any tips are appreciated.

Ken


 		 	   		  

Re: beanmodel ques

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 28 May 2013 10:45:06 -0300, Ken in Nashua <kc...@live.com>  
wrote:

> Hi Folks,

Hi!

> I want to include both player info and player stats in the same bean  
> model.

Check the mailing list archives for that. You'll probably need to  
implement a PropertyConduit and use it in beanModel.add("stats, new  
YourPlayStatsPropertyConduit()); Or just use beanModel.add("stats", null)  
and use <p:stats> in the template to define how this will be rendered.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: beanmodel ques

Posted by Ken in Nashua <kc...@live.com>.
Sorry folks...

if I got this

@Entity
@ClassDescriptor(hasCyclicRelationships = true)
@BeanModels(
{ @BeanModel(pageType = PageType.LIST, 
        include = "player, gp, g, a, pts", 
        exclude="") })
public class PlayerStats implements Cloneable, Serializable {
    private static final Log log = LogFactory.getLog(PlayerStats.class);

    private Integer id = null;

    private Player player = null;

    private Year year = null;

can I do this ?

        myModel = beanModelSource.createDisplayModel(PlayerStats.class, messages);
        myModel.add("action", null);
        myModel.include("player.number", "player.lastName", "player.lastName", "gp", "g", "a", "pts");
        myModel.get("player.firstName").sortable(false);
        myModel.get("player.lastName").label("Surname");        


 		 	   		  

RE: beanmodel ques

Posted by Ken in Nashua <kc...@live.com>.
Maybe I should be doing the bean model on PlayerStats

public class PlayerStats implements Cloneable, Serializable {
    private static final Log log = LogFactory.getLog(PlayerStats.class);

    private Integer id = null;

    private Player player = null;

...can I refer to the player from there ?

player.playerNumber 

?
 		 	   		  

RE: beanmodel ques

Posted by Ken in Nashua <kc...@live.com>.
Players and stats are keyed by Season.class so there could be at any given time one Player instance and one PlayerStats instance to deal with.

Its not immediately apparent to me how to combine properties from both classes into the grid bveanmodel