oeps loop has to be something like this ofcourse
Component parent = component;
while ( (parent = parent.getParent()) != null &&
!(parent.getModel() instanceof IComponentInheritedModel))
{
return parent.getModelObject();
}
return null;
On Fri, Jul 11, 2008 at 9:28 AM, Johan Compagner <[EMAIL PROTECTED]>
wrote:
> and that sub component must have the complete object?
> or does the panel only have to have a property of that object?
>
> If it has to have the complete object you can always make your own model
> give the panel this kind of model:
>
> public class SuperObjectModel implements IModel, IComponentAssignedModel
> {
> public Object getObject() {
> return null;
> }
> public void setObject(Object object) { }
> public void detach() { }
>
> public IWrapModel wrapOnAssignment(final Component component)
> {
> return new IWrapModel()
> {
> public void detach(){ }
> public void setObject(Object object){
> }
>
> public Object getObject() {
> MarkupContainer parent = component.getParent();
> while (parent != null && !(parent.getModel() instanceof
> IComponentInheritedModel))
> {
> return parent.getModelObject();
> }
> return null;
> }
>
> public IModel getWrappedModel() {
> return SuperObjectModel.this;
> }
>
> };
>
> }
> }
>
> On Fri, Jul 11, 2008 at 9:17 AM, Joseph P. <[EMAIL PROTECTED]>
> wrote:
>
>>
>>
>>
>> Newgro wrote:
>> >
>> > Did you check
>> > http://cwiki.apache.org/WICKET/working-with-wicket-models.html
>> > already? It's explained realy well.
>> >
>>
>> I did already. My issue is more about model sharing with sub components
>> and
>> especially how to access it easily in a sub component (like for example in
>> a
>> panel whose representation depends on the data in the model attached to
>> some
>> form way above in the hierarchy).
>>
>> Thanks nonetheless for your help
>>
>> ++
>> zedros
>> --
>> View this message in context:
>> http://www.nabble.com/Direclty-using-parent%27s-compoundpropertymodel-not-possible---tp18356056p18398127.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>