It worked...

//-------------------------------------
//As i had to override all, I created a generic class
//---------------------------------------
import org.apache.tapestry5.services.DataTypeAnalyzer;
import org.apache.tapestry5.ioc.services.PropertyAdapter;

public class GenericTypeAnalyzer implements DataTypeAnalyzer {
   private final String dataType;
   private final Class<?> dataClass;

   public GenericTypeAnalyzer(String dataType, Class<?> dataClass){
      this.dataType = dataType;
      this.dataClass = dataClass;
   }

   public String getType(){
      return dataType;
   }

   public Class<?> getDataClass(){
      return dataClass;
   }

   @Override
   public String identifyDataType(PropertyAdapter propertyAdapter){
      Class<?> propertyType = propertyAdapter.getType();
      if(dataClass.isAssignableFrom(propertyType)){
         return dataType;
      }
      return null;
   }
}


Then in AppModule I did this
    public static void
contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzer>
configuration){
       configuration.add(TypeConstants.TEXT_TYPE,
             new GenericTypeAnalyzer(TypeConstants.TEXT_TYPE, String.class),
"before:*");
       configuration.add(TypeConstants.NUMBER_TYPE,
             new GenericTypeAnalyzer(TypeConstants.NUMBER_TYPE,
Number.class), "before:*");
       configuration.add(TypeConstants.DATE_TYPE,
             new GenericTypeAnalyzer(TypeConstants.DATE_TYPE, String.class),
"before:*");
       configuration.add(TypeConstants.PASSWORD_TYPE,
             new GenericTypeAnalyzer(TypeConstants.PASSWORD_TYPE,
String.class), "before:*");
       configuration.add(TypeConstants.ENUM_TYPE,
             new GenericTypeAnalyzer(TypeConstants.ENUM_TYPE, Enum.class),
"before:*");
       configuration.add(TypeConstants.BOOLEAN_TYPE,
             new GenericTypeAnalyzer(TypeConstants.BOOLEAN_TYPE,
Boolean.class), "before:*");
       configuration.add(TypeConstants.CALENDAR_TYPE,
             new GenericTypeAnalyzer(TypeConstants.CALENDAR_TYPE,
Calendar.class), "before:*");
    }

    public static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration){
       addEditBlock(configuration, TypeConstants.TEXT_TYPE);
       addEditBlock(configuration, TypeConstants.NUMBER_TYPE);
       addEditBlock(configuration, TypeConstants.DATE_TYPE);
       addEditBlock(configuration, TypeConstants.ENUM_TYPE);
       addEditBlock(configuration, TypeConstants.BOOLEAN_TYPE);
       addEditBlock(configuration, TypeConstants.PASSWORD_TYPE);
       addEditBlock(configuration, TypeConstants.CALENDAR_TYPE);
       addEditBlock(configuration, TypeConstants.LONG_TEXT_TYPE);
    }

    private static void addEditBlock(Configuration<BeanBlockContribution>
configuration, String dataType){
       configuration.add(new BeanBlockContribution(dataType,
"PropertyEditBlocksWithoutLabel", dataType.substring(1), true));
   }


Thanks a lot
Taha


On Mon, Nov 1, 2010 at 4:22 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Mon, 01 Nov 2010 01:33:17 -0200, Taha Hafeez <tawus.tapes...@gmail.com>
> wrote:
>
>  I am trying to override default editing components as I want to remove the
>> labels.. but contributeBeanBlockSource() is called in a random order (at
>> times before and at times after the TapestryModules's
>> contributeBeanBlockSource()). . I used @Order("after:*") but it is still
>> random.
>>
>
> @Order is used to specify the order decorators and advised are apllied, not
> in which order the contributed objects are included. Just do what Juan
> suggested (adding a DataTypeAnalyzer before every other) and it will work.
> :)
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to