Hi Andy,

I do not agree, it's not just a documentation problem I've opened a
bug for the specific Dialog problem:

https://issues.apache.org/jira/browse/TAPESTRY-1699

I think default use just doesn't behave the way you expect it to
behave (that is a bug, even though a minor one).

But I think there's also a generic enhancement to parameters that
could be made that I describe in

https://issues.apache.org/jira/browse/TAPESTRY-1700

I think this could provide a new interesting feature and many
misunderstanding like the one me and Andrea (I guess) had.

If you think it's useful I could provide some code


On 8/9/07, andyhot <[EMAIL PROTECTED]> wrote:
> Well, it looks like the hidden parameter is an in-out one,
> and it's probably that way by design I guess. The 'value' and 'index'
> parameters of @For
> work similarly but that's more straightforward after reading the docs.
>
> Anyway, I think we should just document this.
>
> Martino Piccinato wrote:
> > Finally I think we were both wrong and that I opened two useless tickets:
> >
> > in fact, as stated in the documentation default-value attribute now
> > accept any kind of binding and actually CREATES the binding if no
> > other binding is present.
> >
> > In your case:
> >
> > org.apache.tapestry.binding.AbstractBinding.createReadOnlyBindingException(
> > AbstractBinding.java:115)) when I call into my rewindFormComponent method
> > this code:
> >
> > setStartRow(sliderValue);
> >
> > and I set into jwc file:
> > <parameter name="startRow" required="no" cache="true"
> > default-value="ognl:0"/>
> >
> > means that at some point, during rewind, some of your code/components
> > is calling a "setStartRow" to update the binding but the binding is
> > invariant (ognl:0 is a costant!) so it's a read only binding (you
> > can't "change the value" of a constant) so the
> > ReadOnlyBindingException is correctly throwned.
> >
> > What you should do (if you really need to change the bound value) is
> > bind to a containing component method (e.g. value="ognl:currentRow")
> > that will contain the logic of when to return the default value and
> > when not to.
> >
> > It's also possible NOT TO BIND the parameter by default, initializing
> > the parameter method after the component finishLoad() phase, in your
> > case it would be:
> >
> > In jwc:
> > <parameter name="startRow"/>
> >
> > In component:
> >
> >     public void finishLoad() {
> >       super.finishLoad();
> >       setStartRow(0);
> >     }
> >
> >
> > The fact is that default-value with invariant values (literal,
> > ognl:<constant>, ecc.) make sense just if it's a read only binding, At
> > the same time default-value with ognl expressions referring to
> > containing component methods would break component encapsulation
> > making assumptions on the exact method signature the containing
> > component should implement (also its optional/default status would be
> > questionable...).
> >
> > As for my specific Dialog component problem I think there's still a
> > bug because the component IS actually trying to "write" the invariant
> > default-value binding in hide/show methods so after 2 invalid ticket I
> > hope I'm goig to open a valid one now.
> >
> >
> >
> > On 7/30/07, Martino Piccinato <[EMAIL PROTECTED]> wrote:
> >
> >> Posted one for the parameter issue
> >>
> >> https://issues.apache.org/jira/browse/TAPESTRY-1682
> >>
> >> and another one for the Dialog component:
> >>
> >> https://issues.apache.org/jira/browse/TAPESTRY-1683
> >>
> >> I didn't do it first because I was trying to investigate myself but I
> >> really have no time to do this now.
> >>
> >> Ciao
> >>
> >> Martino
> >>
> >> On 7/30/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> >>
> >>> Well, I try to investigate into this, meanwhile if you could be so kind to
> >>> post a jira...
> >>>
> >>> ciao,
> >>> kiuma
> >>>
> >>> On 7/30/07, Martino Piccinato <[EMAIL PROTECTED]> wrote:
> >>>
> >>>> Well, I'm having a very similar behaviour with Dialog component that
> >>>> by default has a true parameter for optional parameter "hidden".
> >>>>
> >>>>     <parameter name="hidden" default-value="true" />
> >>>>
> >>>> It seems that if you set a constant value ("ognl:0" or "true") to a
> >>>> parameter then the parameter itself is regarded as "Invariant" by
> >>>> AbstractBinding that will refuse you to use any setter on it (it does
> >>>> not have a reference to a method but to a... constant) and throw the
> >>>> exception.
> >>>> I don't have the exception if I just "override" the constant default
> >>>> value with an ognl reference to a couple of setters/getters method
> >>>> (returning the default value in case the property is not initialized).
> >>>>
> >>>> In my opinion this is a bug with "parameter" but I haven't been able
> >>>> to investigate more and I'm quite surprised nobody stepped into this
> >>>> problem before, see my neglected Dialog mails  of some days ago :-)
> >>>>
> >>>>
> >>>>
> >>>> On 7/30/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> >>>>
> >>>>> this is the stack trace
> >>>>>
> >>>>>
> >>>>>
> >>>> org.apache.tapestry.binding.AbstractBinding.createReadOnlyBindingException
> >>>> (
> >>>>
> >>>>> AbstractBinding.java:115)
> >>>>> org.apache.tapestry.binding.ExpressionBinding.setObject(
> >>>>> ExpressionBinding.java:196)
> >>>>> $EditTable_16.setStartRow($EditTable_16.java)
> >>>>> org.jfly.web.components.edittable.EditTable.rewindFormComponent(
> >>>>> EditTable.java:541)
> >>>>>
> >>>>> On 7/30/07, Andrea Chiumenti <[EMAIL PROTECTED]> wrote:
> >>>>>
> >>>>>> Hello!
> >>>>>> I'm having this exception (
> >>>>>>
> >>>>>>
> >>>> org.apache.tapestry.binding.AbstractBinding.createReadOnlyBindingException
> >>>>
> >>>>>> (AbstractBinding.java:115)) when I call into my rewindFormComponent
> >>>>>>
> >>>> method
> >>>>
> >>>>>> this code:
> >>>>>>
> >>>>>> setStartRow(sliderValue);
> >>>>>>
> >>>>>> and I set into jwc file:
> >>>>>> <parameter name="startRow" required="no" cache="true"
> >>>>>> default-value="ognl:0"/>
> >>>>>>
> >>>>>>
> >>>>>> Who can help me please ?
> >>>>>>
> >>>>>> Thx, kiuma
> >>>>>>
> >>>>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>
> >>>>
> >>>>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to