It seems that initial-value is assigned is piece of generated code...
Because:
<property name="itemClass" initial-value="literal:research.model.SomeObject"/>
=== PageLoader.constructComponent(...) ===
...
//NOT initialized at this point
container.finishLoad(cycle, this, containerSpec);
//INITIALIZED!!!
container.enterActiveState();
...
==========================================
But in our overidden methods:
class FormPage extend PasePage {
@Override
public void enterActiveState() {
//INITIALIZED
super.enterActiveState();
}
@Override
protected void finishLoad() {
super.finishLoad();
//NOT INITIALIZED EVEN AFTER SUPER CALL, WHY???
}
{
Or did I miss something?
AK> Hello All,
AK> I have persistent property which I want to initialize using
AK> another property value.
AK> Page spec:
AK> <property name="itemClass"
AK> initial-value="literal:research.model.SomeObject"/>
AK> Page class:
AK> /**
AK> * Item which is initialized using value of #getItemClass
AK> */
AK> @Persist
AK> public abstract IPersistable getItem();
AK> public abstract void setItem(IPersistable item);
AK> In beta-4 I tried to do it in finishLoad:
AK> /**
AK> * @see org.apache.tapestry.AbstractComponent#finishLoad()
AK> */
AK> @Override
AK> protected void finishLoad() {
AK> super.finishLoad();
AK> //itemClass is NOT initialized at this point!
AK> setItem(getNewFormItemInstance());
AK> }
AK> But for some reason after super.finishLoad() call "itemClass" property
AK> still WAS NOT initialized with intial-value. (Is it OK?)
AK> I examined sources and found another place for it, which worked:
AK> /**
AK> * @see
AK> org.apache.tapestry.AbstractComponent#enterActiveState()
AK> */
AK> @Override
AK> public void enterActiveState() {
AK> super.enterActiveState();
AK> //worked in beta-4
AK> setItem(getNewFormItemInstance());
AK> }
AK> But in beta-5 changes to propeties which are made in
AK> enterActiveState() are reset in some magic way... I'm trying to find
AK> where for a few hours. I set item in enterActiveState() and it is back
AK> to NULL in pageBeginRender(). Is it normal behaviour?
AK> Thank you,
AK> aku
AK> ---------------------------------------------------------------------
AK> To unsubscribe, e-mail:
AK> tapestry-user-unsubscribe@jakarta.apache.org
AK> For additional commands, e-mail:
AK> tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
|