Re: Compound Property Model, sharing for children

2011-01-27 Thread Pedro Santos
No because the MyTextField will not be able to init its model based on the
parent CompoundPropertyModel since it don't know him yet. Only after exit
the form.add call MyTextField.getModel will work as expected.
If MyTextField invokes getModel inside the onInitialize it will work fine,
since at this point since an path exists from this component to the page.


On Thu, Jan 27, 2011 at 10:59 AM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 How does the compound property model work in these instances:

 If I do (pseudo code):

 Form form = new Form ( new CompoundPropertyModel(someObject))

 form.add (new MyTextField(someFieldFromObject);

 ...

 public class MyTextField {

   public MyTextField() {
  super(id);
  getModel()   - will this return an object?
  getModelObject()  -- will this return an object?
   }
 }

 Basically, when is the model object and model bound to a component that
 uses the compound property model.

 Berlin Brown




-- 
Pedro Henrique Oliveira dos Santos


RE: Compound Property Model, sharing for children

2011-01-27 Thread Brown, Berlin [GCG-PFS]
Also, I am assuming a call to compoundPropertyModel.bind(expression) is
called, does this return a property model?  Or is more involved?


New
TextField().setDefaultModel(compoundPropertyModel.bind(obj.fieldName))
; -- return a propertymodel.

If I change the instance of modelobject obj in the case above, how
does the compound property model use the new instance.  E.g:

public class SomeObject {
  public class Inner {
 fieldName
  }
  private SomeObject.Inner obj;

  getObj() { }
  setObj() { }
}

SomeObject someObjectMain = new SomeObject()
Form form = new Form ( new CompoundPropertyModel(new SomeObject()));
form.add (new MyTextField(obj.fieldName);

someObjectMain.setObj(new SomeObject.Inner());  --- In this case, will
the model object for the text field be updated and how??

...

-Original Message-
From: Pedro Santos [mailto:pedros...@gmail.com] 
Sent: Thursday, January 27, 2011 8:07 AM
To: users@wicket.apache.org
Subject: Re: Compound Property Model, sharing for children

No because the MyTextField will not be able to init its model based on
the parent CompoundPropertyModel since it don't know him yet. Only after
exit the form.add call MyTextField.getModel will work as expected.
If MyTextField invokes getModel inside the onInitialize it will work
fine, since at this point since an path exists from this component to
the page.


On Thu, Jan 27, 2011 at 10:59 AM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 How does the compound property model work in these instances:

 If I do (pseudo code):

 Form form = new Form ( new CompoundPropertyModel(someObject))

 form.add (new MyTextField(someFieldFromObject);

 ...

 public class MyTextField {

   public MyTextField() {
  super(id);
  getModel()   - will this return an object?
  getModelObject()  -- will this return an object?
   }
 }

 Basically, when is the model object and model bound to a component 
 that uses the compound property model.

 Berlin Brown




--
Pedro Henrique Oliveira dos Santos


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Compound Property Model, sharing for children

2011-01-27 Thread Pedro Santos
On Thu, Jan 27, 2011 at 11:18 AM, Brown, Berlin [GCG-PFS] 
berlin.br...@primerica.com wrote:

 Also, I am assuming a call to compoundPropertyModel.bind(expression) is
 called, does this return a property model?  Or is more involved?


 New
 TextField().setDefaultModel(compoundPropertyModel.bind(obj.fieldName))
 ; -- return a propertymodel.

 If I change the instance of modelobject obj in the case above, how
 does the compound property model use the new instance.  E.g:

 public class SomeObject {
  public class Inner {
 fieldName
  }
  private SomeObject.Inner obj;

  getObj() { }
  setObj() { }
 }

 SomeObject someObjectMain = new SomeObject()
 Form form = new Form ( new CompoundPropertyModel(new SomeObject()));
 form.add (new MyTextField(obj.fieldName);

 someObjectMain.setObj(new SomeObject.Inner());  --- In this case, will
 the model object for the text field be updated and how??

 in this case no, because the model object is untouched, in the last line
you set a new object at someObjectMain, but this variable is not pointing to
the SomeObject instance in the model.

to update the model object you can call:
form.getDefaultModelObject().setObj(new SomeObject.Inner())
or create the form as: new Form ( new CompoundPropertyModel(someObjectMain
 /*instead of create another SomeObject here*/  ));

...

 -Original Message-
 From: Pedro Santos [mailto:pedros...@gmail.com]
 Sent: Thursday, January 27, 2011 8:07 AM
 To: users@wicket.apache.org
 Subject: Re: Compound Property Model, sharing for children

 No because the MyTextField will not be able to init its model based on
 the parent CompoundPropertyModel since it don't know him yet. Only after
 exit the form.add call MyTextField.getModel will work as expected.
 If MyTextField invokes getModel inside the onInitialize it will work
 fine, since at this point since an path exists from this component to
 the page.


 On Thu, Jan 27, 2011 at 10:59 AM, Brown, Berlin [GCG-PFS] 
 berlin.br...@primerica.com wrote:

  How does the compound property model work in these instances:
 
  If I do (pseudo code):
 
  Form form = new Form ( new CompoundPropertyModel(someObject))
 
  form.add (new MyTextField(someFieldFromObject);
 
  ...
 
  public class MyTextField {
 
public MyTextField() {
   super(id);
   getModel()   - will this return an object?
   getModelObject()  -- will this return an object?
}
  }
 
  Basically, when is the model object and model bound to a component
  that uses the compound property model.
 
  Berlin Brown
 



 --
 Pedro Henrique Oliveira dos Santos


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
Pedro Henrique Oliveira dos Santos