Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Change bean child values based on parent ? #3728

benprim ·

I'm working on a polymorphic bean and I'd like to change the display based on a user choice made in the parent Bean.
For instance i'm trying to display different information on a repository
So the choice of the repository is in the parent Bean and there's a ChildBeans listing information based on the
chosen repository.
I thought I could use a PropertyChangedListener but it doesn't look like we're going through the setter each time the user change his choice.
Also I'm using ChoiceProvider and the fact that it needs a static method is not helping me...
Am I missing something obvious to do this easily ??


  • replies 3
  • views 2531
  • stars 0
robinshen ADMIN ·

The polymorphic bean allows you to use different implementations for different choices automatically. And different information can put into different implementations. Or am I missing something here?

benprim ·

The thing is I need to get information from the parent class to dynamically construct choices in the child bean.
To give you what i'm trying to achieve :
So the parent bean has a control to select a Perforce repository from the configuration repository list.
Then based on the chosen repository I would like to display the list of users from that repository.
To do this I'm using @ChoiceProvider to build the list of user.
But I have 2 issues :

  • @ChoiceProvider expect a static function
  • When if the user chooses a different repository in the list i'm not notified of the change
robinshen ADMIN ·

You do not need to use custom bean in this case. Just define two variables, one is repository, and another is user, the user choices uses some script like below:
def repoName = vars.getValue("repoName");
// now construct the user list using the repoName.

Also here is a tutorial demonstrating the idea: