The JIRA is interesting and I agree it does seem like a lot of
plumbing to do this. I suspect this could also be solved with an
@CompositeField annotation and a worker. Your example is similar to
what I came up with except I need to do validation so I have to create
a Runable.

private static class Submit implements ComponentAction<DateRange> {
                  private static final long serialVersionUID = 
-7984673040135949374L;
        
                  private final String controlName;
        
                  Submit(String controlName) {
                      this.controlName = controlName;
                  }
        
                  public void execute(DateRange component) {
                      component.submit(controlName);
                  }
        
                  @Override
                  public String toString() {
                      return String.format("DateRange.Setup[%s]", controlName);
                  }
              }
        
        void setupRender() {
                formSupport.store(this,new
Submit(formSupport.allocateControlName(getClientId())));
                if ( range == null ) {
                        range = new Range();
                }
        }
        
        public void submit(String controlName) {
                if ( range == null ) {
                        range = new Range();
                }
                formSupport.defer( new Runnable() {                     
                        @Override
                        public void run() {
                                if ( range.getStartDate().after( 
range.getEndDate()) ){
                                        tracker.recordError("start must be 
before end");
                                }
                        }
                });
        }

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to