Re: how to connect elements - label and input (checkbox)

2014-10-01 Thread Martin Grigorov
Hi,

Please attach a quickstart that reproduce this in a ticket in JIRA.
Thanks!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 6:49 AM, miguel mig...@thedeanda.com wrote:

 wow this is the strangest thing. i searched for the same thing a year later
 (to the day almost) and again its a silly agree to terms checkbox and
 guess what... wicket 6.17.0 seems to have the same problem...

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/how-to-connect-elements-label-and-input-checkbox-tp4650304p4667770.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: AjaxFormChoiceComponentUpdatingBehavior CheckGroup and CheckGroupSelector

2014-10-01 Thread pureza
Nevermind, I think I got it.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormChoiceComponentUpdatingBehavior-CheckGroup-and-CheckGroupSelector-tp4641921p4667773.html
Sent from the Users forum mailing list archive at Nabble.com.

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



unable to find property UploadProgressBar.starting

2014-10-01 Thread Garret Wilson

Friends,

I have a Wicket page using the upload progress bar:

  span wicket:id=progress[[upload progress bar]]/span

  form.add(new UploadProgressBar(progress, form, fileUpload));

Dependencies are declared normally in Maven:

dependency
  groupIdorg.apache.wicket/groupId
  artifactIdwicket-core/artifactId
  version7.0.0-M3/version
/dependency
dependency
  groupIdorg.apache.wicket/groupId
  artifactIdwicket-auth-roles/artifactId
  version7.0.0-M3/version
/dependency
dependency
  groupIdorg.apache.wicket/groupId
  artifactIdwicket-extensions/artifactId
  version7.0.0-M3/version
/dependency

We're using embedded Jetty 9.1.0.v20131115. Running from my IDE 
(Eclipse) this works just fine. But when our team creates a jar file and 
distributes the application with an installer, just tried to browser to 
the page in question gives us a MissingResourceException: Unable to find 
property: 'UploadProgressBar.starting' (see below).


No doubt there's something simple I'm forgetting. Any suggestions? 
Here's the stack trace:


2014-09-22 07:40:49 ERROR (DefaultExceptionMapper) [2014-09-22 
07:40:49,433] - org.apache.wicket.DefaultExceptionMapper.

internalMap(DefaultExceptionMapper.java:128): Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Exception in rendering 
component: [HtmlHeaderContainer [Component id = _header

_0]]
at 
org.apache.wicket.Component.internalRenderComponent(Component.java:2566)
at 
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1550)

at org.apache.wicket.Component.internalRender(Component.java:2357)
at org.apache.wicket.Component.render(Component.java:2285)
at 
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1418)
at 
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1611)

at org.apache.wicket.Page.onRender(Page.java:879)
at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:142)
at org.apache.wicket.Component.internalRender(Component.java:2357)
at org.apache.wicket.Component.render(Component.java:2285)
at org.apache.wicket.Page.renderPage(Page.java:1018)
at 
org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:122)
at 
org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:247)
at 
org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
at 
org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:837)
at 
org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at 
org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
at 
org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
at 
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
at 
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1539)
at 
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:524)
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at 
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:544)
at 
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at 
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1110)
at 
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:453)
at 
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at 
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1044)
at 
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at 
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)

at org.eclipse.jetty.server.Server.handle(Server.java:459)
at 
org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:280)
at 
org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229)
at 
org.eclipse.jetty.io.AbstractConnection$1.run(AbstractConnection.java:505)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)

at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.MissingResourceException: Unable to find property: 
'UploadProgressBar.starting' for 

Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Martin Grigorov
Hi,

Do you by chance manipulate the list of IStringResourceLoader's in
DEPLOYMENT mode ?
See org.apache.wicket.settings.ResourceSettings#getStringResourceLoaders()

org.apache.wicket.resource.loader.InitializerStringResourceLoader is
responsible to load the resource bundle
wicket-extensions/src/main/java/org/apache/wicket/extensions/Initializer.properties

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 5:10 PM, Garret Wilson gar...@globalmentor.com
wrote:

 Friends,

 I have a Wicket page using the upload progress bar:

   span wicket:id=progress[[upload progress bar]]/span

   form.add(new UploadProgressBar(progress, form, fileUpload));

 Dependencies are declared normally in Maven:

 dependency
   groupIdorg.apache.wicket/groupId
   artifactIdwicket-core/artifactId
   version7.0.0-M3/version
 /dependency
 dependency
   groupIdorg.apache.wicket/groupId
   artifactIdwicket-auth-roles/artifactId
   version7.0.0-M3/version
 /dependency
 dependency
   groupIdorg.apache.wicket/groupId
   artifactIdwicket-extensions/artifactId
   version7.0.0-M3/version
 /dependency

 We're using embedded Jetty 9.1.0.v20131115. Running from my IDE (Eclipse)
 this works just fine. But when our team creates a jar file and distributes
 the application with an installer, just tried to browser to the page in
 question gives us a MissingResourceException: Unable to find property:
 'UploadProgressBar.starting' (see below).

 No doubt there's something simple I'm forgetting. Any suggestions? Here's
 the stack trace:

 2014-09-22 07:40:49 ERROR (DefaultExceptionMapper) [2014-09-22
 07:40:49,433] - org.apache.wicket.DefaultExceptionMapper.
 internalMap(DefaultExceptionMapper.java:128): Unexpected error occurred
 org.apache.wicket.WicketRuntimeException: Exception in rendering
 component: [HtmlHeaderContainer [Component id = _header
 _0]]
 at org.apache.wicket.Component.internalRenderComponent(
 Component.java:2566)
 at org.apache.wicket.MarkupContainer.onRender(
 MarkupContainer.java:1550)
 at org.apache.wicket.Component.internalRender(Component.java:2357)
 at org.apache.wicket.Component.render(Component.java:2285)
 at org.apache.wicket.MarkupContainer.renderNext(
 MarkupContainer.java:1418)
 at org.apache.wicket.MarkupContainer.renderAll(
 MarkupContainer.java:1611)
 at org.apache.wicket.Page.onRender(Page.java:879)
 at org.apache.wicket.markup.html.WebPage.onRender(WebPage.java:
 142)
 at org.apache.wicket.Component.internalRender(Component.java:2357)
 at org.apache.wicket.Component.render(Component.java:2285)
 at org.apache.wicket.Page.renderPage(Page.java:1018)
 at org.apache.wicket.request.handler.render.
 WebPageRenderer.renderPage(WebPageRenderer.java:122)
 at org.apache.wicket.request.handler.render.
 WebPageRenderer.respond(WebPageRenderer.java:247)
 at org.apache.wicket.core.request.handler.
 RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
 at org.apache.wicket.request.cycle.RequestCycle$
 HandlerExecutor.respond(RequestCycle.java:837)
 at org.apache.wicket.request.RequestHandlerStack.execute(
 RequestHandlerStack.java:64)
 at org.apache.wicket.request.cycle.RequestCycle.execute(
 RequestCycle.java:265)
 at org.apache.wicket.request.cycle.RequestCycle.
 processRequest(RequestCycle.java:222)
 at org.apache.wicket.request.cycle.RequestCycle.
 processRequestAndDetach(RequestCycle.java:293)
 at org.apache.wicket.protocol.http.WicketFilter.
 processRequestCycle(WicketFilter.java:261)
 at org.apache.wicket.protocol.http.WicketFilter.
 processRequest(WicketFilter.java:203)
 at org.apache.wicket.protocol.http.WicketFilter.doFilter(
 WicketFilter.java:284)
 at org.eclipse.jetty.servlet.ServletHandler$CachedChain.
 doFilter(ServletHandler.java:1539)
 at org.eclipse.jetty.servlet.ServletHandler.doHandle(
 ServletHandler.java:524)
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(
 ScopedHandler.java:143)
 at org.eclipse.jetty.security.SecurityHandler.handle(
 SecurityHandler.java:544)
 at org.eclipse.jetty.server.session.SessionHandler.
 doHandle(SessionHandler.java:221)
 at org.eclipse.jetty.server.handler.ContextHandler.
 doHandle(ContextHandler.java:1110)
 at org.eclipse.jetty.servlet.ServletHandler.doScope(
 ServletHandler.java:453)
 at org.eclipse.jetty.server.session.SessionHandler.
 doScope(SessionHandler.java:183)
 at org.eclipse.jetty.server.handler.ContextHandler.
 doScope(ContextHandler.java:1044)
 at org.eclipse.jetty.server.handler.ScopedHandler.handle(
 ScopedHandler.java:141)
 at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
 HandlerWrapper.java:97)
 at 

Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Garret Wilson

On 10/1/2014 12:33 PM, Martin Grigorov wrote:

Hi,

Do you by chance manipulate the list of IStringResourceLoader's in
DEPLOYMENT mode ?


I don't think I touched anything related to IStringResourceLoader. The 
only thing I've done relating to modes is this:


  //turn on Wicket development mode if in debug mode
  final String wicketConfiguration = Debug.isDebug() ? 
development : deployment;

  filterHolder.setInitParameter(configuration, wicketConfiguration);

In other words, in embedded Jetty, if we've started up specifying a 
debug mode (using a system variable), then I set the Wicket 
configuration to development; otherwise, I set it to deployment.


Garret

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



Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Andrew Geery
As a sanity check, is the property file with the property
UploadProgressBar.starting
in the jar file?  Perhaps it didn't get copied over by the Maven build
process into the jar but the IDE was properly copying it over...

Andrew

On Wed, Oct 1, 2014 at 11:38 AM, Garret Wilson gar...@globalmentor.com
wrote:

 On 10/1/2014 12:33 PM, Martin Grigorov wrote:

 Hi,

 Do you by chance manipulate the list of IStringResourceLoader's in
 DEPLOYMENT mode ?


 I don't think I touched anything related to IStringResourceLoader. The
 only thing I've done relating to modes is this:

   //turn on Wicket development mode if in debug mode
   final String wicketConfiguration = Debug.isDebug() ? development :
 deployment;
   filterHolder.setInitParameter(configuration, wicketConfiguration);

 In other words, in embedded Jetty, if we've started up specifying a debug
 mode (using a system variable), then I set the Wicket configuration to
 development; otherwise, I set it to deployment.


 Garret

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




Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Martin Grigorov
The .properties file is packed inside wicket-extensions.jar, not in his
application.

I have no other ideas but to attach a remote debugger
to 
org.apache.wicket.resource.loader.InitializerStringResourceLoader#loadStringResource(java.lang.Class?,
java.lang.String, java.util.Locale, java.lang.String, java.lang.String) and
set condition on the key parameter to be equal to the missing resource
key.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 5:55 PM, Andrew Geery andrew.ge...@gmail.com wrote:

 As a sanity check, is the property file with the property
 UploadProgressBar.starting
 in the jar file?  Perhaps it didn't get copied over by the Maven build
 process into the jar but the IDE was properly copying it over...

 Andrew

 On Wed, Oct 1, 2014 at 11:38 AM, Garret Wilson gar...@globalmentor.com
 wrote:

  On 10/1/2014 12:33 PM, Martin Grigorov wrote:
 
  Hi,
 
  Do you by chance manipulate the list of IStringResourceLoader's in
  DEPLOYMENT mode ?
 
 
  I don't think I touched anything related to IStringResourceLoader. The
  only thing I've done relating to modes is this:
 
//turn on Wicket development mode if in debug mode
final String wicketConfiguration = Debug.isDebug() ? development
 :
  deployment;
filterHolder.setInitParameter(configuration,
 wicketConfiguration);
 
  In other words, in embedded Jetty, if we've started up specifying a debug
  mode (using a system variable), then I set the Wicket configuration to
  development; otherwise, I set it to deployment.
 
 
  Garret
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: FormValidators and messages property file

2014-10-01 Thread msalman
Hi Martin,

Thanks for your help.  That worked but I had to do a few extra things such
as setting the values for '${label0}', etc.  What I don't get is why do we
need to do this extra thing for Form validation classes (extending
AbstractFormValidator) but not for component validation classes
(implementing IValidator).



For others who may face the same problem, this is how got it working:


@Override
public void validate(Form? form) 
{
Date fromDate = fromDateFormComponent.getConvertedInput();
Date toDate = toDateFormComponent.getConvertedInput();

if (fromDate != null
  toDate != null
  fromDate.after(toDate))
{ 
ClassStringResourceLoader loader = new
ClassStringResourceLoader(FromDateBeforeToDate.class);

Application.get().getResourceSettings().getStringResourceLoaders().add(loader);

ValidationError error = new ValidationError();
error.addMessageKey(getClass().getSimpleName() + . +
fromDateAfterToDate);
error.setVariable(label0,
fromDateFormComponent.getLabel().getObject());
error.setVariable(label1, 
toDateFormComponent.getLabel().getObject());

fromDateFormComponent.newValidatable().error(error);

}   
}



 FromDateBeforeToDate.properties 

FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date
is after the '${label}' date


I thank you again for teh quick and helpful response.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667783.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Garret Wilson
I think I've found the source of the problem (even though I don't 
understand the internal details). Our installer creates an uber-JAR that 
has all the dependencies exploded and then placed inside a single JAR 
file. I looked inside wicket-extensions-7.0.0-M3.jar, and it has a file 
wicket.properties /in the root of the JAR file!/ Unfortunately, 
wicket-core-7.0.0-M3.jar (and likely other Wicket JARs) also have a 
wicket.properties file in their root as well. As you might guess, these 
have conflicting values:


initializer=org.apache.wicket.extensions.Initializer

initializer=org.apache.wicket.Initializer

So when we create our uber-JAR only one of these wicket.properties files 
wins and gets placed in the uber-JAR. The one we happen to have now 
contains initializer=org.apache.wicket.Initializer.


I will check with the installer team to see if we can distribute the 
application with all its dependencies as separate JARs rather than an 
uber-JAR. But on Wicket's side, is it really a good practice to stick 
some file in the root directory of a JAR, outside of any package, with a 
name you expect to be identical across JARs but with different contents? 
I naively would imagine that some better approach exists.


Garret

On 10/1/2014 1:22 PM, Martin Grigorov wrote:

The .properties file is packed inside wicket-extensions.jar, not in his
application.

I have no other ideas but to attach a remote debugger
to 
org.apache.wicket.resource.loader.InitializerStringResourceLoader#loadStringResource(java.lang.Class?,
java.lang.String, java.util.Locale, java.lang.String, java.lang.String) and
set condition on the key parameter to be equal to the missing resource
key.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 5:55 PM, Andrew Geery andrew.ge...@gmail.com wrote:


As a sanity check, is the property file with the property
UploadProgressBar.starting
in the jar file?  Perhaps it didn't get copied over by the Maven build
process into the jar but the IDE was properly copying it over...

Andrew

On Wed, Oct 1, 2014 at 11:38 AM, Garret Wilson gar...@globalmentor.com
wrote:


On 10/1/2014 12:33 PM, Martin Grigorov wrote:


Hi,

Do you by chance manipulate the list of IStringResourceLoader's in
DEPLOYMENT mode ?


I don't think I touched anything related to IStringResourceLoader. The
only thing I've done relating to modes is this:

   //turn on Wicket development mode if in debug mode
   final String wicketConfiguration = Debug.isDebug() ? development

:

deployment;
   filterHolder.setInitParameter(configuration,

wicketConfiguration);

In other words, in embedded Jetty, if we've started up specifying a debug
mode (using a system variable), then I set the Wicket configuration to
development; otherwise, I set it to deployment.


Garret

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






Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Martin Grigorov
Apache Isis uses
http://simplericity.org/jetty-console/jetty-console-maven-plugin/ to
generate an executable .jar that contains all dependencies in WEB-INF/lib/
folder inside. Exactly as you need it.

About IIinitializer:
this is the simple plugin system Wicket uses. It loads all
/wicket.properties from the root of the classpath and executes the
IInitializer implementations.
If wicket.properties is not in the root (or another predefined location)
then Wicket should do full scan of the classpath to find it. This may be
expensive!
Although https://github.com/ronmamo/reflections does exactly this and it is
quite fast! But we try to keep Wicket as light as possible and not depend
on other libraries.
I don't know what you use to merge the making the uberjar but
maven-shade-plugin provides hooks to merge such files.
A workaround is to register and call the initializer in your code...

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 8:04 PM, Garret Wilson gar...@globalmentor.com
wrote:

 I think I've found the source of the problem (even though I don't
 understand the internal details). Our installer creates an uber-JAR that
 has all the dependencies exploded and then placed inside a single JAR file.
 I looked inside wicket-extensions-7.0.0-M3.jar, and it has a file
 wicket.properties /in the root of the JAR file!/ Unfortunately,
 wicket-core-7.0.0-M3.jar (and likely other Wicket JARs) also have a
 wicket.properties file in their root as well. As you might guess, these
 have conflicting values:

 initializer=org.apache.wicket.extensions.Initializer

 initializer=org.apache.wicket.Initializer

 So when we create our uber-JAR only one of these wicket.properties files
 wins and gets placed in the uber-JAR. The one we happen to have now
 contains initializer=org.apache.wicket.Initializer.

 I will check with the installer team to see if we can distribute the
 application with all its dependencies as separate JARs rather than an
 uber-JAR. But on Wicket's side, is it really a good practice to stick some
 file in the root directory of a JAR, outside of any package, with a name
 you expect to be identical across JARs but with different contents? I
 naively would imagine that some better approach exists.

 Garret


 On 10/1/2014 1:22 PM, Martin Grigorov wrote:

 The .properties file is packed inside wicket-extensions.jar, not in his
 application.

 I have no other ideas but to attach a remote debugger
 to org.apache.wicket.resource.loader.InitializerStringResourceLoade
 r#loadStringResource(java.lang.Class?,
 java.lang.String, java.util.Locale, java.lang.String, java.lang.String)
 and
 set condition on the key parameter to be equal to the missing resource
 key.

 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov

 On Wed, Oct 1, 2014 at 5:55 PM, Andrew Geery andrew.ge...@gmail.com
 wrote:

  As a sanity check, is the property file with the property
 UploadProgressBar.starting
 in the jar file?  Perhaps it didn't get copied over by the Maven build
 process into the jar but the IDE was properly copying it over...

 Andrew

 On Wed, Oct 1, 2014 at 11:38 AM, Garret Wilson gar...@globalmentor.com
 wrote:

  On 10/1/2014 12:33 PM, Martin Grigorov wrote:

  Hi,

 Do you by chance manipulate the list of IStringResourceLoader's in
 DEPLOYMENT mode ?

  I don't think I touched anything related to IStringResourceLoader. The
 only thing I've done relating to modes is this:

//turn on Wicket development mode if in debug mode
final String wicketConfiguration = Debug.isDebug() ?
 development

 :

 deployment;
filterHolder.setInitParameter(configuration,

 wicketConfiguration);

 In other words, in embedded Jetty, if we've started up specifying a
 debug
 mode (using a system variable), then I set the Wicket configuration to
 development; otherwise, I set it to deployment.


 Garret

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






Re: FormValidators and messages property file

2014-10-01 Thread Martin Grigorov
Hi,

I see what happens.
form.getString() would work because of
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java#L100
But using ValidationError has no reference to the form, and thus its form
validators, and it fails.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Oct 1, 2014 at 7:04 PM, msalman mohammad_sal...@yahoo.com wrote:

 Hi Martin,

 Thanks for your help.  That worked but I had to do a few extra things such
 as setting the values for '${label0}', etc.  What I don't get is why do we
 need to do this extra thing for Form validation classes (extending
 AbstractFormValidator) but not for component validation classes
 (implementing IValidator).



 For others who may face the same problem, this is how got it working:


 @Override
 public void validate(Form? form)
 {
 Date fromDate = fromDateFormComponent.getConvertedInput();
 Date toDate = toDateFormComponent.getConvertedInput();

 if (fromDate != null
   toDate != null
   fromDate.after(toDate))
 {
 ClassStringResourceLoader loader = new
 ClassStringResourceLoader(FromDateBeforeToDate.class);


 Application.get().getResourceSettings().getStringResourceLoaders().add(loader);


I hope this is not your real code for production.
This will add the loader to the list of loaders on every validation.



 ValidationError error = new ValidationError();
 error.addMessageKey(getClass().getSimpleName() +
 . +
 fromDateAfterToDate);
 error.setVariable(label0,
 fromDateFormComponent.getLabel().getObject());
 error.setVariable(label1,
 toDateFormComponent.getLabel().getObject());


 fromDateFormComponent.newValidatable().error(error);
 }
 }



  FromDateBeforeToDate.properties

 FromDateBeforeToDate.fromDateAfterToDate=Invalid input: The '${label}' date
 is after the '${label}' date


 I thank you again for teh quick and helpful response.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667783.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Garret Wilson

On 10/1/2014 3:31 PM, Martin Grigorov wrote:

Apache Isis uses
http://simplericity.org/jetty-console/jetty-console-maven-plugin/ to
generate an executable .jar that contains all dependencies in WEB-INF/lib/
folder inside. Exactly as you need it.


Yeah, in another subproject I had already created a .zip with all the 
dependency JARs. I have instructed to the person creating the product 
installer to do the same for the subproject that uses Wicket, so that 
should probably be taken care of shortly.


I was just wanted to give feedback, though, that perhaps there is a 
better way to  do this IIinitializer thing.




About IIinitializer:
this is the simple plugin system Wicket uses. It loads all
/wicket.properties from the root of the classpath and executes the
IInitializer implementations.
If wicket.properties is not in the root (or another predefined location)
then Wicket should do full scan of the classpath to find it. This may be
expensive!



 * Maybe a better place for these files would be inside
   /META-INF/wicket or something.
 * Maybe rather than using the same filename, you could name it based
   upon the package+class, e.g.
   org.apache.wicket.extensions.Initializer.properties.


Then the plugin system could simply look for all the 
/META-INF/wicket/*.properties files. That wouldn't be expensive at all, 
and it would cause no conflicts. Plus it wouldn't clutter the root 
classpath with clashing filenames.


I don't claim to know anything about this IIinitializer system, other 
than it causes a problem under a certain use case. I'm just offering 
brainstorming suggestions for improvement.





...
I don't know what you use to merge the making the uberjar but
maven-shade-plugin provides hooks to merge such files.


Yeah, there are several options. I think we have that covered, now that 
we know what the problem was. I hope some of my feedback was helpful.




A workaround is to register and call the initializer in your code...



I'll keep that in mind as a last resort, thanks.

Garret


Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Martin Grigorov
On Wed, Oct 1, 2014 at 9:49 PM, Garret Wilson gar...@globalmentor.com
wrote:

 On 10/1/2014 3:31 PM, Martin Grigorov wrote:

 Apache Isis uses
 http://simplericity.org/jetty-console/jetty-console-maven-plugin/ to
 generate an executable .jar that contains all dependencies in WEB-INF/lib/
 folder inside. Exactly as you need it.


 Yeah, in another subproject I had already created a .zip with all the
 dependency JARs. I have instructed to the person creating the product
 installer to do the same for the subproject that uses Wicket, so that
 should probably be taken care of shortly.

 I was just wanted to give feedback, though, that perhaps there is a better
 way to  do this IIinitializer thing.


  About IIinitializer:
 this is the simple plugin system Wicket uses. It loads all
 /wicket.properties from the root of the classpath and executes the
 IInitializer implementations.
 If wicket.properties is not in the root (or another predefined location)
 then Wicket should do full scan of the classpath to find it. This may be
 expensive!



  * Maybe a better place for these files would be inside
/META-INF/wicket or something.
  * Maybe rather than using the same filename, you could name it based
upon the package+class, e.g.
org.apache.wicket.extensions.Initializer.properties.


 Then the plugin system could simply look for all the
 /META-INF/wicket/*.properties files. That wouldn't be expensive at all, and
 it would cause no conflicts. Plus it wouldn't clutter the root classpath
 with clashing filenames.


Are you aware of JDK APIs (e.g. ClassLoader) or Servlet APIs (e.g.
SevletContext) that make it simple to find the list of resources in a
folder in the classpath ?
E.g. give me a list of all files with extension '.properties' in
/META-INF/wicket/ ?



 I don't claim to know anything about this IIinitializer system, other than
 it causes a problem under a certain use case. I'm just offering
 brainstorming suggestions for improvement.


Suggestions and feedback (especially negative!) are always welcome!
Now let's find a technical solution that doesn't cost much!




  ...
 I don't know what you use to merge the making the uberjar but
 maven-shade-plugin provides hooks to merge such files.


 Yeah, there are several options. I think we have that covered, now that we
 know what the problem was. I hope some of my feedback was helpful.


  A workaround is to register and call the initializer in your code...



 I'll keep that in mind as a last resort, thanks.

 Garret



Re: unable to find property UploadProgressBar.starting

2014-10-01 Thread Garret Wilson

On 10/1/2014 5:17 PM, Martin Grigorov wrote:

...
Are you aware of JDK APIs (e.g. ClassLoader) or Servlet APIs (e.g.
SevletContext) that make it simple to find the list of resources in a
folder in the classpath ?
E.g. give me a list of all files with extension '.properties' in
/META-INF/wicket/ ?


Hmmm... not offhand. That was the brainstorming part. ;)


I don't claim to know anything about this IIinitializer system, other than
it causes a problem under a certain use case. I'm just offering
brainstorming suggestions for improvement.


Suggestions and feedback (especially negative!) are always welcome!
Now let's find a technical solution that doesn't cost much!



Assign me a JIRA item and I'll look into it more, I promise. :D

OK, I imagine once my team gets the installer code to use separate 
dependency JARs all will be OK even under the current system. I'm back 
to my project now. Thanks for the tips.


Garret

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



Re: FormValidators and messages property file

2014-10-01 Thread msalman
Well, I wanted these to be independent validation classes.  But now it seems
like a bad idea.  I will make them part of the form.

Martin, your comments and help are much appreciated.

Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/FormValidators-and-messages-property-file-tp4667767p4667790.html
Sent from the Users forum mailing list archive at Nabble.com.

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