Thanks for your reply!
Actually, I want to know how to implement nested components. I will show you
my scenario:

1. Requirment: A wizard that include some step to guide users complete a
task, e.g. a sale order
2. Current Implementation: I implemented two components Wizard and
WizardStep, and use them like this:
<t:wizard steps="[step1,step2,step3]">
  <t:wizardStep name="step1">
    step1 content
  </t:wizardStep>
  <t:wizardStep name="step2">
    step2 content
  </t:wizardStep>
  <t:wizardStep name="step3">
    step3 content
  </t:wizardStep>
</t:wizard>

// wizard class
@Property
private WizardStep[] steps;

in this way, I need to pass WizardSteps as Property. But I want to use them
as follows:
<t:wizard>
  <t:wizardStep name="step1">
    step1 content
  </t:wizardStep>
  <t:wizardStep name="step2">
    step2 content
  </t:wizardStep>
  <t:wizardStep name="step3">
    step3 content
  </t:wizardStep>
</t:wizard>

//wizard class
@Inject
private ComponentResources resources;
private WizardStep[] steps;
@SetupRender
private viod setupRender(){
  //initialize steps by iterate child components
  steps = initSteps();
}
//I want to use ComponentResources to get WizardSteps ids then use
getEmbeddedComponent() to get WizardStep instance.
private void initSteps() {
  List<String> stepIds =
resources.getComponentModel().getEmbeddedComponentIds();
  //Why stepIds is empy! so the follows codes will never execute!
  steps = new WizardStep[stepIds.size())];
  int i = 0;
  for (String stepId: stepIds){
    steps[i++] = resources.getEmbeddedComponent(stepId);
  }
}

I am really confused, what's wrong with my second implementing?
Any suggestion? Thanks!

On Wed, Mar 23, 2011 at 8:17 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Tue, 22 Mar 2011 22:56:28 -0300, leon <mail....@gmail.com> wrote:
>
>  Sorry, My question is :are there some documentations about nested
>> components?
>>
>
> All components are nested, so I don't know what you're asking. A non-page
> component instance doesn't exist outside a page, which is almost the same as
> a component, so all components are nested.
>
>
>  I tried to inspect the component in debug model, but they're all null
>> objects, I'm using IDEA 10, I don't know if is caused by IDE or Tapestry
>> IoC.
>>
>
> This is not caused by the IDE or Tapestry-IoC, but by Tapestry(-core)
> itself. It was already solved for 5.3-SNAPSHOT.
>
>
>  So how could i trace a component's lifecycle?
>>
>
> See this: http://tapestry.apache.org/component-rendering.html.
>
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>



-- 
Best Regards
Li Guoqiang

Reply via email to