Loading ...
Sorry, an error occurred while loading the content.

Re: [pcgen_developers] [JIRA] (CODE-1212) Save XP progression selection with character

Expand Messages
  • Tom Parker
    1) Accessing one facet from another: Probably one of the easier examples is to look at HandsFacet, which depends on (accesses) RaceFacet and TemplateFacet. 
    Message 1 of 6 , Feb 7 8:37 AM
    • 0 Attachment
      1) Accessing one facet from another:

      Probably one of the easier examples is to look at HandsFacet, which "depends on" (accesses) RaceFacet and TemplateFacet.  It takes (A) a private field, (B) a setter, and (C) indication to Spring to make the connection. 

      (A) In the case of the LevelTableFacet you'd need a field:
          private XPTableFacet xpTableFacet;

      (B) You'd need the appropriate setter (very boring)
      public void setXpTableFacet(XPTableFacet xpTableFacet) { this.xpTableFacet = xpTableFacet;}
       
      (C) Make the attachment in applicationContext.xml within the LevelTableFacet bean so that the field is initialized when the bean is created:
              <property name="xpTableFacet" ref="xpTableFacet"/>


      The main reason this is done is that you can operate entirely with the CharID as opposed to the PlayerCharacter object.  The intent is to get away (as much as we can anyway) from handing around PlayerCharacter, since it creates a HUGE tangle of objects with everyone knowing about PlayerCharacter and PlayerCharacter knowing about everything.

      2) Do you need a Facade?

      James will need to chime in on how exactly it will work for selecting that in the UI.  I have to admit I'm not up to speed yet on exactly the scope of the Facades (although it seems pretty complete, I haven't dug into gory detail to know if a preference like this would trigger a facade)

      TP.


      From: Stefan Radermacher <radermacher@...>
      To: pcgen_developers@yahoogroups.com
      Sent: Tuesday, February 7, 2012 8:43 AM
      Subject: Re: [pcgen_developers] [JIRA] (CODE-1212) Save XP progression selection with character

      Hi Tom,

      thanks for these tips. There's a few things I'm not yet getting behind:

      > (2) All references to the game mode getLevelInfo(int) are converted
      > to xpTableFacet.getLevelInfo(int). getLevelInfo(int) is removed from
      > the GameMode. A few new delegation methods in PlayerCharacter are
      > probably required (though LevelTableFacet should access the
      > XPTableFacet directly not through PC, the calls in skillUtilities
      > should use the delegation methods in PC)

      I don't see how I can access the XPTableFacet from inside
      LevelTabelFacet. I guess there's something I've missed on the whole
      facet thing - which I don't think I fully understand yet.

      Also: do I need an XPTableFacade?

      > Make sense?

      The rest is more or less was what I was thinking of, although
      I think I envisioned something more complex. :)

      Regards,
      Stefan.


      ------------------------------------

      Yahoo! Groups Links

      <*> To visit your group on the web, go to:
          http://groups.yahoo.com/group/pcgen_developers/

      <*> Your email settings:
          Individual Email | Traditional

      <*> To change settings online go to:
          http://groups.yahoo.com/group/pcgen_developers/join
          (Yahoo! ID required)

      <*> To change settings via email:
          pcgen_developers-digest@yahoogroups.com
          pcgen_developers-fullfeatured@yahoogroups.com

      <*> To unsubscribe from this group, send an email to:
          pcgen_developers-unsubscribe@yahoogroups.com

      <*> Your use of Yahoo! Groups is subject to:
          http://docs.yahoo.com/info/terms/



    Your message has been successfully submitted and would be delivered to recipients shortly.