You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Seema Mani <Se...@ust-global.com> on 2010/04/06 13:19:06 UTC

Missing/changed methods after migrating to MyFaces 1.2.8

hi,

I'm facing a few issues after migrating to MyFaces 1.2.8 from MyFaces 1.1.7

1. In my custom tag handler class, extending HtmlMessageTag, there were
calls to setStringProperty method in the superclass. But these methods are
not existing now
2. In my custom tag handler class, extending HtmlCommandButtonTag, there
were calls to the setDisabled method, which had String argument. This method
now takes ValueExpression as the argument. But the values to be passed are
static like "true" and "false"

Please advise on how these can be resolved.

Thanks,
Seema
-- 
View this message in context: http://old.nabble.com/Missing-changed-methods-after-migrating-to-MyFaces-1.2.8-tp28150278p28150278.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Re: Missing/changed methods after migrating to MyFaces 1.2.8

Posted by Werner Punz <we...@gmail.com>.
Am 06.04.10 13:19, schrieb Seema Mani:
>
> hi,
>
> I'm facing a few issues after migrating to MyFaces 1.2.8 from MyFaces 1.1.7
>
> 1. In my custom tag handler class, extending HtmlMessageTag, there were
> calls to setStringProperty method in the superclass. But these methods are
> not existing now
> 2. In my custom tag handler class, extending HtmlCommandButtonTag, there
> were calls to the setDisabled method, which had String argument. This method
> now takes ValueExpression as the argument. But the values to be passed are
> static like "true" and "false"
>
> Please advise on how these can be resolved.
>
> Thanks,
> Seema
My guess is,this is due to the change to the unified el and a later JSP 
version, the taglib tld file defines the type of the attribute.
(see the corresponding tld file in the sources for the example to the 
HtmlMessageTag)

The entire direct conversion aspect via setStringProperty etc... is not 
needed anymore



from the tld
  <attribute>
          <description><![CDATA[Specifies whether the detailed 
information from the message should be shown.
Default to true.]]></description>
          <name>showDetail</name>
          <deferred-value>
              <type>boolean</type>
          </deferred-value>
       </attribute>


from the tag handler

  private ValueExpression _showDetail;

     public void setShowDetail(ValueExpression showDetail)
     {
         _showDetail = showDetail;
     }

   protected void setProperties(UIComponent component)
     {
         if (!(component instanceof 
javax.faces.component.html.HtmlMessage ))
         {
             throw new IllegalArgumentException("Component "+
                 component.getClass().getName() +" is no 
javax.faces.component.html.HtmlMessage");
         }

         javax.faces.component.html.HtmlMessage comp = 
(javax.faces.component.html.HtmlMessage) component;

         super.setProperties(component);


          if (_showDetail != null)
         {
             comp.setValueExpression("showDetail", _showDetail);
         }

due to the incoming parameters being of type value expression and having 
the type information already inside.

Not quite the area of my expertise but I hope I got it right.
Problem with setStringValue etc... generally is that this are methods 
which were implementation specific (part of myfaces not the jsf api), 
and bound to change if the el system itself was moved over to a more 
global scope which happened between 1.1 and 1.2.


Werner





Re: Missing/changed methods after migrating to MyFaces 1.2.8

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

All tag class hierarchy was changed from 1.1 to 1.2, with the inclusion of
jsp EL expressions.

Right now, all tag hierarchy are generated by myfaces builder plugin. But
anyway, in tomahawk we have cases like this one:

http://svn.apache.org/repos/asf/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree/taglib/AbstractTreeTag.java
http://svn.apache.org/repos/asf/myfaces/tomahawk/trunk/core12/src/main/java/org/apache/myfaces/custom/tree/taglib/AbstractTreeTag.java

You can create a custom jsf tag class with all properties from your base
component, and override/add the additional properties you need.

regards,

Leonardo Uribe

2010/4/6 Mike Kienenberger <mk...@gmail.com>

> Not sure about
>
> 1. setStringProperty.
>
> But for
>
> 2. create a ValueExpression containing "#{true}" or "#{false}"
>
> I haven't tested this, but....
>
> You could either ask JSF to create it for you:
>
> import javax.el.ValueExpression;
>
> FacesContext context = FacesContext.getCurrentInstance();
> ValueExpression vex = context.getApplication().
> getExpressionFactory().createValueExpression(context.getELContext(),
> "#{false}", Boolean.class);
>
> Or you could implement your own, something along the lines
> of this:
>
>                new ValueExpression() {
>
>                        @Override
>                        public boolean isLiteralText() {
>                                return false;
>                        }
>
>                        @Override
>                        public int hashCode() {
>                                return 0;
>                        }
>
>                        @Override
>                        public String getExpressionString() {
>                                return "#{false}";
>                        }
>
>                        @Override
>                        public boolean equals(Object obj) {
>                                return obj == this;
>                        }
>
>                        @Override
>                        public void setValue(ELContext context, Object
> value) {
>                                // TODO Auto-generated method stub
>                        }
>
>                        @Override
>                        public boolean isReadOnly(ELContext context) {
>                                return true;
>                        }
>
>                        @Override
>                        public Object getValue(ELContext context) {
>                                return Boolean.FALSE;
>                        }
>
>                        @Override
>                        public Class<?> getType(ELContext context) {
>                                return Boolean.class;
>                        }
>
>                        @Override
>                        public Class<?> getExpectedType() {
>                                return Boolean.class;
>                        }
>                };
>
>
> On Tue, Apr 6, 2010 at 7:19 AM, Seema Mani <Se...@ust-global.com>
> wrote:
> >
> > hi,
> >
> > I'm facing a few issues after migrating to MyFaces 1.2.8 from MyFaces
> 1.1.7
> >
> > 1. In my custom tag handler class, extending HtmlMessageTag, there were
> > calls to setStringProperty method in the superclass. But these methods
> are
> > not existing now
> > 2. In my custom tag handler class, extending HtmlCommandButtonTag, there
> > were calls to the setDisabled method, which had String argument. This
> method
> > now takes ValueExpression as the argument. But the values to be passed
> are
> > static like "true" and "false"
> >
> > Please advise on how these can be resolved.
> >
> > Thanks,
> > Seema
> > --
> > View this message in context:
> http://old.nabble.com/Missing-changed-methods-after-migrating-to-MyFaces-1.2.8-tp28150278p28150278.html
> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
>

Re: Missing/changed methods after migrating to MyFaces 1.2.8

Posted by Mike Kienenberger <mk...@gmail.com>.
Not sure about

1. setStringProperty.

But for

2. create a ValueExpression containing "#{true}" or "#{false}"

I haven't tested this, but....

You could either ask JSF to create it for you:

import javax.el.ValueExpression;

FacesContext context = FacesContext.getCurrentInstance();
ValueExpression vex = context.getApplication().
getExpressionFactory().createValueExpression(context.getELContext(),
"#{false}", Boolean.class);

Or you could implement your own, something along the lines
of this:

		new ValueExpression() {
		
			@Override
			public boolean isLiteralText() {
				return false;
			}
		
			@Override
			public int hashCode() {
				return 0;
			}
		
			@Override
			public String getExpressionString() {
				return "#{false}";
			}
		
			@Override
			public boolean equals(Object obj) {
				return obj == this;
			}
		
			@Override
			public void setValue(ELContext context, Object value) {
				// TODO Auto-generated method stub
			}
		
			@Override
			public boolean isReadOnly(ELContext context) {
				return true;
			}
		
			@Override
			public Object getValue(ELContext context) {
				return Boolean.FALSE;
			}
		
			@Override
			public Class<?> getType(ELContext context) {
				return Boolean.class;
			}
		
			@Override
			public Class<?> getExpectedType() {
				return Boolean.class;
			}
		};
		

On Tue, Apr 6, 2010 at 7:19 AM, Seema Mani <Se...@ust-global.com> wrote:
>
> hi,
>
> I'm facing a few issues after migrating to MyFaces 1.2.8 from MyFaces 1.1.7
>
> 1. In my custom tag handler class, extending HtmlMessageTag, there were
> calls to setStringProperty method in the superclass. But these methods are
> not existing now
> 2. In my custom tag handler class, extending HtmlCommandButtonTag, there
> were calls to the setDisabled method, which had String argument. This method
> now takes ValueExpression as the argument. But the values to be passed are
> static like "true" and "false"
>
> Please advise on how these can be resolved.
>
> Thanks,
> Seema
> --
> View this message in context: http://old.nabble.com/Missing-changed-methods-after-migrating-to-MyFaces-1.2.8-tp28150278p28150278.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>