Hehehe, I think I'm going to abuse the poor workers. They're awesome. Expect some questions in the list as I overload the Tapestry engine.

j/k, but I think that if the solution is more transparent, it's better. Try the workers solution, I think it's easier that extending an interface, and it seems to be working. The main issue here is that I don't want to touch my abstract page classes, or make them extend any base class.

(besides, I'm starting to think of other applications for these workers. Nice!)

--
Ing. Leonardo Quijano Vincenzi
DTQ Software


[EMAIL PROTECTED] wrote:
Nice!
And i see you really like EnhancmentWorkers  :)

Regarding the initial question, i think there's a very nice solution
for (2).
Define an interface, ValidationDelegateAware or something like this:
{
  @Bean
  ValidationDelegate getValidationDelegate();

  void setValidationDelegate(ValidationDelegate vd);
}

and have your (abstract) page classes implement that interface.
No more code repetition.


From Leonardo Quijano Vincenzi <[EMAIL PROTECTED]>:

Yes.

For now, I used an EnhacementWorker, like this:

  <contribution configuration-id="tapestry.enhance.EnhancementWorkers">
    <command id="inject-formdelegate-worker"
             object="service:ValidationDelegateEnhancementWorker"
             before="tapestry.enhance.page-detach-listener" />
  </contribution>

  <service-point id="ValidationDelegateEnhancementWorker"
                 interface="org.apache.tapestry.enhance.EnhancementWorker">
      <invoke-factory>
<construct class="com.dtqsoftware.utils.web.enhance.FormDelegateEnhancementWorker">
          </construct>
      </invoke-factory>
  </service-point>

And in FormDelegateEnhancementWorker:

        if (AjaxForm.class.isAssignableFrom(op.getBaseClass())) {
            if(spec.getBeanSpecification("dtqValidationDelegate") == null) {
                IBeanSpecification beanSpec = new BeanSpecification();
                beanSpec.setLifecycle(BeanLifecycle.RENDER);
beanSpec.setClassName(DtqValidationDelegate.class.getName());
                beanSpec.setLocation(spec.getLocation());
                beanSpec.setDescription("Dtq Validation Delegate");
spec.addBeanSpecification("dtqValidationDelegate", beanSpec);
            }

IParameterSpecification paramSpec = spec.getParameter("delegate");
            paramSpec.setDefaultValue("bean:dtqValidationDelegate");
        }

Probably an overkill, though ;). But very transparent for the forms themselves.

--
Ing. Leonardo Quijano Vincenzi
DTQ Software


Jesse Kuhnert wrote:
Ok ....This is an incredibly simple problem to solve. Can you outline
exactly what type of requirements you have?

Ie do you just want to be able to globally set a default
ValidationDelegate?
Is that all?


---------------------------------------------------------------------
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