As I said, I see from the backwards compatibility why it was done.

On Jan 15, 2008 7:02 AM, Manfred Geiler <[EMAIL PROTECTED]> wrote:
> Why not use the last "if" alone?

because this all is already done in JSF ...

>
> if (component instanceof EditableValueHolder)
> {
>    EditableValueHolder holder = (EditableValueHolder)component;
>    holder.setValue(null);
>    holder.setSubmittedValue(null);
>    holder.setLocalValueSet(false);
>    holder.setValid(true);
> }
>
> Every UIInput is an EditableValueHolder and the UIXEditable as well, right?
>
> This code fragement could also be candidate for a
> "EditableValueHolderUtils" class in the MyFaces Commons.

jup, good idea. That would be more leverage able;

>
> --Manfred
>
>
>
>
> On Jan 15, 2008 3:47 PM, Simon Lessard <[EMAIL PROTECTED]> wrote:
> > Although I'm -1 also because of backward compatibility, I also felt that it
> > should have been added to the interface to start with as it simplifies many
> > loops used for reseting EditableValueHolder of the whole tree. You cannot
> > use instanceof UIInput for those as Trinidad input components, for example,
> > does not extends UIInput, but do implement EditableValueHolder so the loop's
> > body has to look like:
> >
> > if (component instanceof UIXEditable)
> >  {
> >   ((UIXEditable)component).resetValue();
> >  }
> > else if (component instanceof UIInput)
> >  {
> >   ((UIInput)component).resetValue();
> >  }
> > else if (component instanceof EditableValueHolder)
> >  {
> >   EditableValueHolder holder = (EditableValueHolder)component;
> >   holder.setValue(null);
> >   holder.setSubmittedValue(null);
> >    holder.setLocalValueSet(false);
> >   holder.setValid(true);
> >  }
> >
> >
> > Maybe a good compromise would be to alter UIViewRoot to add a
> > resetAllEditableValueHolderValues method.
> >
> >
> > Regards,
> >
> > ~ Simon
> >
> >
> >
> > On Jan 15, 2008 3:19 AM, Manfred Geiler <[EMAIL PROTECTED]> wrote:
> > > -1
> > > Sorry, I cannot agree.
> > >
> > > The API doc of resetValue() tells you why:
> > > "Convenience method to reset [..]"
> > >
> > > A "utility like" method for convenience like this one does not belong
> > > to an interface. It does not add any behavioural function.
> > > UIInput is not an interface but a (base) class, so it is ok to have
> > > such a method there.
> > >
> > > Matze, do you have any concrete use case that could confirm your POV?
> > >
> > > --Manfred
> > >
> > >
> > >
> > >
> > >
> > > On Jan 15, 2008 7:22 AM, Matthias Wessendorf <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > >
> > > > the resetValue() method was added directly to UIinput, instead to a
> > > > proper interface (EditableValueHolder).
> > > > I guess this was done, to not break impls of that interface.
> > > > IMO this is wrong and should (at least in JSF2) be part of the
> > > > EditableValueHolder interface.
> > > >
> > > > Since JSF2 will bring much more new bits, such an "enhancement" on the
> > > > interface might be valueable.
> > > >
> > > > What is your take on that ?
> > > >
> > > > -Matthias
> > > >
> > > > --
> > > > Matthias Wessendorf
> > > >
> > > > further stuff:
> > > > blog: http://matthiaswessendorf.wordpress.com/
> > > > sessions: http://www.slideshare.net/mwessendorf
> > > > mail: matzew-at-apache-dot-org
> > > >
> > >
>



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Reply via email to