can you please open a jira issue so we can track this? thanks. -igor
On Fri, Nov 5, 2010 at 2:26 PM, richard emberson <richard.ember...@gmail.com> wrote: > In org/apache/wicket/markup/html/form/Form the method getMaxSize > always returns a Bytes instance. > > > public Bytes getMaxSize() { > Bytes maxSize = this.maxSize; > if (maxSize == null) { > maxSize = visitChildren(Form.class, new IVisitor<Form<?>, Bytes>() { > public void component(Form<?> component, IVisit<Bytes> visit) { > Bytes maxSize = component.getMaxSize(); > if (maxSize != null) { > visit.stop(maxSize); > } > } > }); > } > if (maxSize == null) { > return > getApplication().getApplicationSettings().getDefaultMaximumUploadSize(); > } > return maxSize; > } > > Because during the visit traversal, the VERY FIRST Form visited returns > a non-null getMaxSize value. Even it its this.maxSize is null, it > will then return getDefaultMaximumUploadSize. > > I suspect what is needed is a isMaxSizeSet method. > The inner visit method would then be: > > > if (component.isMaxSizeSet()) { > Bytes maxSize = component.getMaxSize(); > visit.stop(maxSize); > } > > With this, then it is only the Form creating and calling the Visitor > that returns the getDefaultMaximumUploadSize value, and only if > none of its sub Forms have an explicit value. > > Also, should the Visitor actually look for the maximum size value > of the children and return it rather than returning the first > value (which may not be the maximum)??? > > Richard > -- > Quis custodiet ipsos custodes > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org