Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior

2013-07-24 Thread Martin Grigorov
On Tue, Jul 23, 2013 at 6:44 PM, Andrew Geery andrew.ge...@gmail.comwrote:

 Just to make sure I'm understanding this correctly, it should be enough to
 simply override updateAjaxAttributes on AjaxButton and specify a channel
 that does not have ACTIVE behavior, like this:

  @Override
 protected void updateAjaxAttributes(AjaxRequestAttributes
 attributes) {
 super.updateAjaxAttributes(attributes);
 attributes.setChannel(new AjaxChannel(MyChannel,
 AjaxChannel.Type.DROP));
 }


The default channel type is QUEUE, so it should work by default.
I cannot say why it doesn't in your case.



 Thanks
 Andrew


 On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

  HI,
 
  Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not
  experience this behavior.
  It should work exactly as you expect it.
  Try to put some debug statements with an AjaxCallListener - print to
  console in onBefore() and onBeforeSend(). Add this listener to both
  components - the field and the button.
 
 
  On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com
  wrote:
 
   I have a form that is submitted with an AjaxButton.  One of the fields
 in
   the form uses an AjaxFormComponentUpdatingBehavior to update the
   server-side state when a value in the field changes (i.e., it fires
   onchange).  If the user changes the field with
   the AjaxFormComponentUpdatingBehavior associated with it and then
 clicks
   the submit button, the behavior updates the field server side, but the
  ajax
   button doesn't submit the form.  The user has to click the submit
 button
  a
   second time to submit the form.  Is there a way to get the two ajax
   behaviors to fire consecutively, rather than forcing the user to click
   twice?
  
   Thanks
   Andrew
  
 



Re: Reading placeholder parameters in mounted resources

2013-07-24 Thread Martin Grigorov
Hi,


On Tue, Jul 23, 2013 at 10:57 PM, Andrew Schetinin ascheti...@gmail.comwrote:

 Hi Cedric,

 I'm not sure what you mean by a quick start, but here you may find the
 piece of code I'm using:

 This is how the shared resource is initialized with the application:

 @Override
 protected void init() {
 super.init();
 mountResource( /storage/${id},
 new MediaStorageResourceReference() );
 }

 This is how a URL is constructed:

 final PageParameters params = new PageParameters();
 params.add( id, 12345 );
 params.add( thumb, true );
 params.add( size, 25 );
 final CharSequence ret = component.urlFor( new
 MediaStorageResourceReference(), params );
 //  ./storage/12345?thumb=truesize=25

 And this is the code of the resource reference (the resource can do
 anything - it is irrelevant to the story):


It is relevant, actually.

IResource#respond() receives an argument of
type org.apache.wicket.request.resource.IResource.Attributes.
With attributes.getPageParameters().get(id) you can read the parsed path
parameter.



 public class MediaStorageResourceReference extends ResourceReference {
 private static final Key key = new Key(
 MediaStorageResourceReference.class.getName(),
 storage, Locale.ENGLISH, null, null );
 public MediaStorageResourceReference() {
 super( key );
 }
 @Override
 public IResource getResource() {
 final Request request = RequestCycle.get().getRequest();
 // Wicket uses the same singleton instance also for detecting
 // if the given resource can be cached by the server - we don't
 need that,
 // and the only way to skip that test is to check the URL,
 // because the check is done by Wicket during forUrl() call,
 // within the context of a different request.
 if( !request.getUrl().getPath().startsWith( storage ) ) {
 logger.debug( Fake resource request );
 return null;
 }

 final IRequestParameters params = request.getRequestParameters();

 Long id = params.getParameterValue( id ).toOptionalLong();
 if( id == null ) { // TODO: ask in Wicket forum why the ID is not
 extracted
 // request.getUrl().getPath() = storage/72147598477361153
 // fallback to extract the ID from path
 if( request.getUrl().getPath().startsWith( URL_PATH_PREFIX ) )
 {
 final String s = request.getUrl().getPath().substring(
 URL_PATH_PREFIX.length() );
 try {
 id = new Long( s );
 } catch( final NumberFormatException e ) {
 logger.error( Cannot extract ID from the path: {},
 request.getUrl().getPath() );
 }
 }
 if( id == null ) {
 throw new AbortWithHttpErrorCodeException(
 HttpStatus.SC_NOT_FOUND );
 }
 }
 .
 return new MyResource();


Since IRequestParameters knows nothing about path parameters, but just
normal request parameters (see HttpServletRequest#getParameters()) you can
move your logic for extracting the id parameter in the resource.

Wicket won't call MediaStorageResourceReference#getResource() if the
request url doesn't match the mount path.


}

 Note the workaround for retrieving the ID above - it is required because
 the list of parameters does not contain any id - only the optional
 arguments.

 Regards,

 Andrew

 --
 Andrew Schetinin


 On Tue, Jul 23, 2013 at 9:47 PM, Cedric Gatay gata...@gmail.com wrote:

  Hi,
  I think this is because you're mixing path parameters with query string
  one. It could be a bug, could you provide a quickstart with this to help
 us
  qualify and fix it if it is a bug.
 
  Regards,
 
  __
  Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay)
  http://code-troopers.com | http://www.bloggure.info |
  http://cedric.gatay.fr
 
 
  On Tue, Jul 23, 2013 at 7:31 PM, Francois Meillet 
  francois.meil...@gmail.com wrote:
 
   Try this pattern /storage/${id}/#{shape}
  
   Optional parameters are denoted by using a # instead of $
  
  
   François Meillet
   Formation Wicket - Développement Wicket
  
  
  
  
  
   Le 23 juil. 2013 à 19:14, Andrew Schetinin ascheti...@gmail.com a
  écrit
   :
  
Hi,
   
I have a shared resource mounted to a URL pattern /storage/${id}
So that the URL look like /storage/12345
and with optional additional parameters /storage/12345?shape=xyz
   
It works fine when I create a new URL - the id parameter is
 correctly
encoded in the URL.
   
But when I process the actual request, I only receive the optional
parameters like shape, while id parameter is not present in
RequestParameters. Therefore I need to parse the URL string and
 extract
   the
ID parameters manually.
   
The question is - why Wicket does not decode the parameters back?
Is it by design, or is it only a problem with 

Re: How to make an own panel work like an e.g. TextField / joining the model hierarchy of page/form

2013-07-24 Thread Patrick Davids
Hi Martin,
concerning the IComponentInheritedModel I did not not try anything in my 
panel since yet, because I suppose it should work from the scratch, when 
a manually wrap the ModelObject on form level into CompundPropertyModel.

As I can see CompoundPropertyModel is an IComponentInheritedModel, and I 
understand, why this works.

Form f = new Form(anyid, new CompoundPropertyModel(PersonObject));
f.add(new TextField(personName));



My question focused more on, what I should implement in 
MyOwnTextFieldPanel(personName) to act the same way like an usual 
textfield, not what I have to do on the parent component/form.
An ususal TextField joins the Form and its inner CompundPropertyModel 
(Handling) in a magic way, and I would like to have the same feature for 
MyOwnTextField.

regards
Patrick

Am 23.07.2013 15:21, schrieb Martin Grigorov:
 Hi,


 On Tue, Jul 23, 2013 at 4:17 PM, Patrick Davids 
 patrick.dav...@nuboit.dewrote:

 Hi all,
 I implemented a TextField-Panel.
 Its kind of FormComponentPanel, but not really... do not have a
 convertInput() situation.
 Just additional behaviors and some own l18n stuff...

 Its already working fine, but what I always have to to is, getting the
 modelobject manually and forward into my form (model object), where it
 is used.

 I would like to implement it in a way, behaving like CompundProperty
 modeled forms.

 I read about an IComponentInheritance marker interface, but I do not


 Do you mean org.apache.wicket.model.IComponentInheritedModel ?
 It has a demo code in its javadoc.
 Show us what you tried.


 know, how to use it.

 Can some one help?

 kind regards and thanx
 Patrick
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





access denied to Resource

2013-07-24 Thread Piratenvisier

I want to give access to a file *.xslt
I tried
 SecurePackageResourceGuard guard = new
 SecurePackageResourceGuard();
guard.addPattern(+*.xslt);
getResourceSettings().setPackageResourceGuard(guard);
   but no success
always the error
WARN - PackageResourceGuard.acceptAbsolutePath(176) | Access to root 
directory is by default disabled for shared resources: test4.xslt
org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException: 
Access denied to (static) package resource test4.xslt. See 
IPackageResourceGuard



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



Re: How to make an own panel work like an e.g. TextField / joining the model hierarchy of page/form

2013-07-24 Thread Martin Grigorov
Hi Patrick,


On Wed, Jul 24, 2013 at 10:36 AM, Patrick Davids
patrick.dav...@nuboit.dewrote:

 Hi Martin,
 concerning the IComponentInheritedModel I did not not try anything in my
 panel since yet, because I suppose it should work from the scratch, when
 a manually wrap the ModelObject on form level into CompundPropertyModel.

 As I can see CompoundPropertyModel is an IComponentInheritedModel, and I
 understand, why this works.

 Form f = new Form(anyid, new CompoundPropertyModel(PersonObject));
 f.add(new TextField(personName));



 My question focused more on, what I should implement in
 MyOwnTextFieldPanel(personName) to act the same way like an usual
 textfield, not what I have to do on the parent component/form.
 An ususal TextField joins the Form and its inner CompundPropertyModel
 (Handling) in a magic way, and I would like to have the same feature for
 MyOwnTextField.


It should work the same way.
Just make sure your panel participates in the component path.
For example:

Form f = new Form(anyid, new CompoundPropertyModel(personObject));
f.add(new YourPanel(namesObject));

class YourPanel extends Panel {
  public YourPanel(Sting id) {
 super(id);

 add(new TextField(first));
 add(new TextField(last));
  }
}


With this code the text field's model would be:
personObject.getNamesObject().getFirst()


 regards
 Patrick

 Am 23.07.2013 15:21, schrieb Martin Grigorov:
  Hi,
 
 
  On Tue, Jul 23, 2013 at 4:17 PM, Patrick Davids 
 patrick.dav...@nuboit.dewrote:
 
  Hi all,
  I implemented a TextField-Panel.
  Its kind of FormComponentPanel, but not really... do not have a
  convertInput() situation.
  Just additional behaviors and some own l18n stuff...
 
  Its already working fine, but what I always have to to is, getting the
  modelobject manually and forward into my form (model object), where it
  is used.
 
  I would like to implement it in a way, behaving like CompundProperty
  modeled forms.
 
  I read about an IComponentInheritance marker interface, but I do not
 
 
  Do you mean org.apache.wicket.model.IComponentInheritedModel ?
  It has a demo code in its javadoc.
  Show us what you tried.
 
 
  know, how to use it.
 
  Can some one help?
 
  kind regards and thanx
  Patrick
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 



Re: access denied to Resource

2013-07-24 Thread Martin Grigorov
On Wed, Jul 24, 2013 at 10:52 AM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:

 I want to give access to a file *.xslt
 I tried
  SecurePackageResourceGuard guard = new
  SecurePackageResourceGuard();
 guard.addPattern(+*.xslt);


Add
guard.setAllowAccessToRootResources(true);

getResourceSettings().**setPackageResourceGuard(guard)**;
but no success
 always the error
 WARN - PackageResourceGuard.**acceptAbsolutePath(176) | Access to root
 directory is by default disabled for shared resources: test4.xslt
 org.apache.wicket.request.**resource.PackageResource$**
 PackageResourceBlockedExceptio**n: Access denied to (static) package
 resource test4.xslt. See IPackageResourceGuard


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




NumberFormatException from Requests with invalid URIs

2013-07-24 Thread Mathias Binder
Hi,

we became aware of a problem caused by requests with invalid URIs on
our wicket-application. The URI contains strings like *://*:*, so
wicket tries to determine and parse a port number, that is not
present. This leads to NumberFormatExceptions with URIs like, e.g.
http://host/h@@p://h@@p://

java.lang.NumberFormatException: For input string: 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:470)
java.lang.Integer.parseInt(Integer.java:499)
org.apache.wicket.request.Url.parse(Url.java:197)
org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:222)
org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:126)
org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:83)
org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:413)
org.apache.wicket.protocol.http.WebApplication.createWebRequest(WebApplication.java:458)
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:183)
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)


Should this issue be fixed in the URL representation from wicket?
Something like a check if the string that represents the port-number
to be parsed is not emtpy?

Thanks

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



Re: Reading placeholder parameters in mounted resources

2013-07-24 Thread Andrew Schetinin
Hi Martin,

Thank you for the advise with attributes.getPageParameters()
.get(id) - I did not know about it.

You wrote:
*Wicket won't call MediaStorageResourceReference#*
*getResource() if the
request url doesn't match the mount path.*

Now, that's not quite correct - when I create a resource reference (in
order to associate it with Image or get the resource URL). every time
Wicket calls to ResourceReference#getResource() in attempt to receive an
instance of the resource.
The stack trace looks like (Wicket 6.9):

MediaStorageResourceReference.getResource() line: 149
== ResourceMapper.addCachingDecoration(Url, PageParameters) line: 218
== ResourceMapper.mapHandler(IRequestHandler) line: 199
== SystemMapper(CompoundRequestMapper).mapHandler(IRequestHandler) line:
215
== RequestCycle.mapUrlFor(IRequestHandler) line: 429
== RequestCycle.urlFor(IRequestHandler) line: 529
== RequestCycle.urlFor(ResourceReference, PageParameters) line: 492
FileActionPropertiesPanel(Component).urlFor(ResourceReference,
PageParameters) line: 3407
MediaStorageResourceReference.urlForMediaFile(Component, long, String)
line: 107
FileActionPropertiesPanel.init(String, ListFileActionProperty,
ThumbnailSize, int) line: 49

I highlighted here the Wicket code - this is how it arrives to the resource
instantiation. The logic there is quite obvious and straight-forward, and I
did not see any reasonable way to avoid that instantiation, even though I
don't need it at all - it's waste of computational time and resources :-)

Note that this getResource() call happens in the context of an absolutely
irrelevant request - I cannot even construct a correct resource (even if I
would wish to do so), because all request parameters belong to the
currently created panel, and not to the resource.

IMHO it is a design flaw, and I've seen earlier usergroup discussions on it.

So, because of the above, I need to keep the logic of extracting the ID
parameter, and that validation of the request path, in order to silently
prevent unnecessary instantiation of the resource.

Regards,

Andrew


On Wed, Jul 24, 2013 at 9:55 AM, Martin Grigorov mgrigo...@apache.orgwrote:



 Since IRequestParameters knows nothing about path parameters, but just
 normal request parameters (see HttpServletRequest#getParameters()) you can
 move your logic for extracting the id parameter in the resource.




--
Andrew Schetinin


Re: Reading placeholder parameters in mounted resources

2013-07-24 Thread Martin Grigorov
On Wed, Jul 24, 2013 at 11:31 AM, Andrew Schetinin ascheti...@gmail.comwrote:

 Hi Martin,

 Thank you for the advise with attributes.getPageParameters()
 .get(id) - I did not know about it.

 You wrote:
 *Wicket won't call MediaStorageResourceReference#*
 *getResource() if the
 request url doesn't match the mount path.*

 Now, that's not quite correct - when I create a resource reference (in
 order to associate it with Image or get the resource URL). every time
 Wicket calls to ResourceReference#getResource() in attempt to receive an
 instance of the resource.
 The stack trace looks like (Wicket 6.9):

 MediaStorageResourceReference.getResource() line: 149
 == ResourceMapper.addCachingDecoration(Url, PageParameters) line: 218
 == ResourceMapper.mapHandler(IRequestHandler) line: 199
 == SystemMapper(CompoundRequestMapper).mapHandler(IRequestHandler) line:
 215
 == RequestCycle.mapUrlFor(IRequestHandler) line: 429
 == RequestCycle.urlFor(IRequestHandler) line: 529
 == RequestCycle.urlFor(ResourceReference, PageParameters) line: 492
 FileActionPropertiesPanel(Component).urlFor(ResourceReference,
 PageParameters) line: 3407
 MediaStorageResourceReference.urlForMediaFile(Component, long, String)
 line: 107
 FileActionPropertiesPanel.init(String, ListFileActionProperty,
 ThumbnailSize, int) line: 49

 I highlighted here the Wicket code - this is how it arrives to the resource
 instantiation. The logic there is quite obvious and straight-forward, and I
 did not see any reasonable way to avoid that instantiation, even though I
 don't need it at all - it's waste of computational time and resources :-)

 Note that this getResource() call happens in the context of an absolutely
 irrelevant request - I cannot even construct a correct resource (even if I
 would wish to do so), because all request parameters belong to the
 currently created panel, and not to the resource.


You can return an empty resource, i.e. a resource without any state.
Move your logic for reading the request parameters in
IResource#respond(Attributes) or
AbstractResource#newResourceResponse(Attributes).



 IMHO it is a design flaw, and I've seen earlier usergroup discussions on
 it.

 So, because of the above, I need to keep the logic of extracting the ID
 parameter, and that validation of the request path, in order to silently
 prevent unnecessary instantiation of the resource.


 Regards,

 Andrew


 On Wed, Jul 24, 2013 at 9:55 AM, Martin Grigorov mgrigo...@apache.org
 wrote:

 
 
  Since IRequestParameters knows nothing about path parameters, but just
  normal request parameters (see HttpServletRequest#getParameters()) you
 can
  move your logic for extracting the id parameter in the resource.




 --
 Andrew Schetinin



Re: NumberFormatException from Requests with invalid URIs

2013-07-24 Thread Sven Meier

Hi,

which Wicket version? Url parsing has been improved on lately:

@Test
public void weirdUrl()
{
Url url = Url.parse(http://wicket.apache.org/h@@p://h@@p://;);

assertEquals(wicket.apache.org, url.getHost());
assertEquals(/h@@p://h@@p://, url.getPath());
}


Works fine with 6.10.0-SNAPSHOT.

Sven

On 07/24/2013 10:29 AM, Mathias Binder wrote:

Hi,

we became aware of a problem caused by requests with invalid URIs on
our wicket-application. The URI contains strings like *://*:*, so
wicket tries to determine and parse a port number, that is not
present. This leads to NumberFormatExceptions with URIs like, e.g.
http://host/h@@p://h@@p://

java.lang.NumberFormatException: For input string: 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Integer.parseInt(Integer.java:470)
java.lang.Integer.parseInt(Integer.java:499)
org.apache.wicket.request.Url.parse(Url.java:197)
org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:222)
org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:126)
org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:83)
org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:413)
org.apache.wicket.protocol.http.WebApplication.createWebRequest(WebApplication.java:458)
org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:183)
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)


Should this issue be fixed in the URL representation from wicket?
Something like a check if the string that represents the port-number
to be parsed is not emtpy?

Thanks

-
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



Re: NumberFormatException from Requests with invalid URIs

2013-07-24 Thread Mathias Binder
We work with Version 6.7.0

Mathias

2013/7/24 Sven Meier s...@meiers.net:
 Hi,

 which Wicket version? Url parsing has been improved on lately:

 @Test
 public void weirdUrl()
 {
 Url url = Url.parse(http://wicket.apache.org/h@@p://h@@p://;);

 assertEquals(wicket.apache.org, url.getHost());
 assertEquals(/h@@p://h@@p://, url.getPath());
 }


 Works fine with 6.10.0-SNAPSHOT.

 Sven


 On 07/24/2013 10:29 AM, Mathias Binder wrote:

 Hi,

 we became aware of a problem caused by requests with invalid URIs on
 our wicket-application. The URI contains strings like *://*:*, so
 wicket tries to determine and parse a port number, that is not
 present. This leads to NumberFormatExceptions with URIs like, e.g.
 http://host/h@@p://h@@p://

 java.lang.NumberFormatException: For input string: 

 java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
 java.lang.Integer.parseInt(Integer.java:470)
 java.lang.Integer.parseInt(Integer.java:499)
 org.apache.wicket.request.Url.parse(Url.java:197)

 org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:222)

 org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:126)

 org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:83)

 org.apache.wicket.protocol.http.WebApplication.newWebRequest(WebApplication.java:413)

 org.apache.wicket.protocol.http.WebApplication.createWebRequest(WebApplication.java:458)

 org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:183)

 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)


 Should this issue be fixed in the URL representation from wicket?
 Something like a check if the string that represents the port-number
 to be parsed is not emtpy?

 Thanks

 -
 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


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



DropDownChoice with Confirm Dialog

2013-07-24 Thread Marco Di Sabatino Di Diodoro
Hi all,

I like implement a DropDownChoice with an Confirm Dialog.
I used an AjaxFormComponentUpdatingBehavior(on change) to intercept the 
change in the DropDownChoice. 
In addition,  the user must first confirm the operation with a dialog before 
changing the value in the DropDownChoice. 

To do that I add an AjaxCallListeners:

@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes 
attributes) {
super.updateAjaxAttributes(attributes);
final AjaxCallListener ajaxCallListener = new 
AjaxCallListener() {
private static final long serialVersionUID = 
7160235486520935153L;

@Override
public CharSequence getPrecondition(final Component 
component) {
return if (confirm(' + getString(confirmDelete) + 
')) return false;;
}  
};
attributes.getAjaxCallListeners().add(ajaxCallListener);
}});

When I click cancel on the Confirm Dialog, the DropDownChoice changes and I can 
not restore the old value. 
How I understand that the user clicked on Cancel? Is the correct way to 
implement this functionality?

Best Regards
M

-- 
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/



Re: DropDownChoice with Confirm Dialog

2013-07-24 Thread Martin Grigorov
Hi,


On Wed, Jul 24, 2013 at 11:54 AM, Marco Di Sabatino Di Diodoro 
marco.disabat...@tirasa.net wrote:

 Hi all,

 I like implement a DropDownChoice with an Confirm Dialog.
 I used an AjaxFormComponentUpdatingBehavior(on change) to intercept the
 change in the DropDownChoice.
 In addition,  the user must first confirm the operation with a dialog
 before changing the value in the DropDownChoice.

 To do that I add an AjaxCallListeners:

 @Override
 protected void updateAjaxAttributes(final
 AjaxRequestAttributes attributes) {
 super.updateAjaxAttributes(attributes);
 final AjaxCallListener ajaxCallListener = new
 AjaxCallListener() {
 private static final long serialVersionUID =
 7160235486520935153L;

 @Override
 public CharSequence getPrecondition(final Component
 component) {
 return if (confirm(' +
 getString(confirmDelete) + ')) return false;;


Try with: return if (confirm(' + getString(confirmDelete) +
')) { attrs.event.preventDefault(); return false;};

The precondition just stops the Ajax call, but it has no logic to do
anything else.


 }
 };
 attributes.getAjaxCallListeners().add(ajaxCallListener);
 }});

 When I click cancel on the Confirm Dialog, the DropDownChoice changes and
 I can not restore the old value.
 How I understand that the user clicked on Cancel? Is the correct way to
 implement this functionality?

 Best Regards
 M

 --
 Dott. Marco Di Sabatino Di Diodoro
 Tel. +39 3939065570

 Tirasa S.r.l.
 Viale D'Annunzio 267 - 65127 Pescara
 Tel +39 0859116307 / FAX +39 085973
 http://www.tirasa.net

 Apache Syncope PMC Member
 http://people.apache.org/~mdisabatino/




Re: DropDownChoice with Confirm Dialog

2013-07-24 Thread Marco Di Sabatino Di Diodoro
Hi Martin,

attrs.event.preventDefault() not work. My DropDownChoice changes always.

M 

Il giorno 24/lug/2013, alle ore 10:59, Martin Grigorov mgrigo...@apache.org 
ha scritto:

 Hi,
 
 
 On Wed, Jul 24, 2013 at 11:54 AM, Marco Di Sabatino Di Diodoro 
 marco.disabat...@tirasa.net wrote:
 
 Hi all,
 
 I like implement a DropDownChoice with an Confirm Dialog.
 I used an AjaxFormComponentUpdatingBehavior(on change) to intercept the
 change in the DropDownChoice.
 In addition,  the user must first confirm the operation with a dialog
 before changing the value in the DropDownChoice.
 
 To do that I add an AjaxCallListeners:
 
@Override
protected void updateAjaxAttributes(final
 AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
final AjaxCallListener ajaxCallListener = new
 AjaxCallListener() {
private static final long serialVersionUID =
 7160235486520935153L;
 
@Override
public CharSequence getPrecondition(final Component
 component) {
return if (confirm(' +
 getString(confirmDelete) + ')) return false;;
 
 
 Try with: return if (confirm(' + getString(confirmDelete) +
 ')) { attrs.event.preventDefault(); return false;};
 
 The precondition just stops the Ajax call, but it has no logic to do
 anything else.
 
 
}
};
attributes.getAjaxCallListeners().add(ajaxCallListener);
}});
 
 When I click cancel on the Confirm Dialog, the DropDownChoice changes and
 I can not restore the old value.
 How I understand that the user clicked on Cancel? Is the correct way to
 implement this functionality?
 
 Best Regards
 M
 
 --
 Dott. Marco Di Sabatino Di Diodoro
 Tel. +39 3939065570
 
 Tirasa S.r.l.
 Viale D'Annunzio 267 - 65127 Pescara
 Tel +39 0859116307 / FAX +39 085973
 http://www.tirasa.net
 
 Apache Syncope PMC Member
 http://people.apache.org/~mdisabatino/
 
 

-- 
Dott. Marco Di Sabatino Di Diodoro
Tel. +39 3939065570

Tirasa S.r.l.
Viale D'Annunzio 267 - 65127 Pescara
Tel +39 0859116307 / FAX +39 085973
http://www.tirasa.net

Apache Syncope PMC Member
http://people.apache.org/~mdisabatino/



Re: DropDownChoice with Confirm Dialog

2013-07-24 Thread Martin Grigorov
This is purely JS problem.
I don't find anything in the web that can do this automatically for you.
Here is a possible solution:
store the previous selected value in a custom attribute, e.g.
data-prev-index=...
then in the precondition code replace attrs.event.preventDefault() with :
var $select = $('#'+attrs.c); $select[0].selectedIndex =
$select.data(prev-index);


On Wed, Jul 24, 2013 at 2:10 PM, Marco Di Sabatino Di Diodoro 
marco.disabat...@tirasa.net wrote:

 Hi Martin,

 attrs.event.preventDefault() not work. My DropDownChoice changes always.

 M

 Il giorno 24/lug/2013, alle ore 10:59, Martin Grigorov 
 mgrigo...@apache.org ha scritto:

  Hi,
 
 
  On Wed, Jul 24, 2013 at 11:54 AM, Marco Di Sabatino Di Diodoro 
  marco.disabat...@tirasa.net wrote:
 
  Hi all,
 
  I like implement a DropDownChoice with an Confirm Dialog.
  I used an AjaxFormComponentUpdatingBehavior(on change) to intercept
 the
  change in the DropDownChoice.
  In addition,  the user must first confirm the operation with a dialog
  before changing the value in the DropDownChoice.
 
  To do that I add an AjaxCallListeners:
 
 @Override
 protected void updateAjaxAttributes(final
  AjaxRequestAttributes attributes) {
 super.updateAjaxAttributes(attributes);
 final AjaxCallListener ajaxCallListener = new
  AjaxCallListener() {
 private static final long serialVersionUID =
  7160235486520935153L;
 
 @Override
 public CharSequence getPrecondition(final Component
  component) {
 return if (confirm(' +
  getString(confirmDelete) + ')) return false;;
 
 
  Try with: return if (confirm(' +
 getString(confirmDelete) +
  ')) { attrs.event.preventDefault(); return false;};
 
  The precondition just stops the Ajax call, but it has no logic to do
  anything else.
 
 
 }
 };
 attributes.getAjaxCallListeners().add(ajaxCallListener);
 }});
 
  When I click cancel on the Confirm Dialog, the DropDownChoice changes
 and
  I can not restore the old value.
  How I understand that the user clicked on Cancel? Is the correct way to
  implement this functionality?
 
  Best Regards
  M
 
  --
  Dott. Marco Di Sabatino Di Diodoro
  Tel. +39 3939065570
 
  Tirasa S.r.l.
  Viale D'Annunzio 267 - 65127 Pescara
  Tel +39 0859116307 / FAX +39 085973
  http://www.tirasa.net
 
  Apache Syncope PMC Member
  http://people.apache.org/~mdisabatino/
 
 

 --
 Dott. Marco Di Sabatino Di Diodoro
 Tel. +39 3939065570

 Tirasa S.r.l.
 Viale D'Annunzio 267 - 65127 Pescara
 Tel +39 0859116307 / FAX +39 085973
 http://www.tirasa.net

 Apache Syncope PMC Member
 http://people.apache.org/~mdisabatino/




cannot import org.apache.wicket.authroles.authorization.role.Roles in Wicket 6.9

2013-07-24 Thread daspegren
Hi all,

I am new to Wicket and am trying to build my first page with authorization.
But I cannot do:
Import org.apache.wicket.authroles.authorization.role.Roles;

It just says that it cannot resolve 'org.apache.wicket.authroles'.

Why is that?

If somebody has a good tutorial or example application with basic level
authorization in a web app based on Wicket, please share.
Thanks in advance!
David



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/cannot-import-org-apache-wicket-authroles-authorization-role-Roles-in-Wicket-6-9-tp4660429.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



Jquery tooltip for multiple fields in wicket

2013-07-24 Thread Murugan
AM Using wicket framework , I need jquery tooltip till the mouse focus on the
field.

There are multiple fields in the screen, whenever the user scroll the mouse
to the different fields tooltip should appear until the mouse take away from
the particular field.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Jquery-tooltip-for-multiple-fields-in-wicket-tp4660449.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: Jquery tooltip for multiple fields in wicket

2013-07-24 Thread Martin Grigorov
Hi,

If you use Twitter Bootstrap then you can check
http://wb.agilecoders.de/demo/js#tooltips
Otherwise for jQuery UI see: http://www.7thweb.net/wicket-jquery-ui/


On Wed, Jul 24, 2013 at 8:57 AM, Murugan murugan4...@gmail.com wrote:

 AM Using wicket framework , I need jquery tooltip till the mouse focus on
 the
 field.

 There are multiple fields in the screen, whenever the user scroll the mouse
 to the different fields tooltip should appear until the mouse take away
 from
 the particular field.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Jquery-tooltip-for-multiple-fields-in-wicket-tp4660449.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: cannot import org.apache.wicket.authroles.authorization.role.Roles in Wicket 6.9

2013-07-24 Thread Martin Grigorov
Hi,

You need to add dependency to wicket-auth-roles project (
http://search.maven.org/#artifactdetails%7Corg.apache.wicket%7Cwicket-auth-roles%7C6.9.1%7Cjar
)

See wicket-examples.war. It shows how to use it (
http://www.wicket-library.com/wicket-examples-6.0.x/index.html - three
authentication examples and one for authorization)


On Tue, Jul 23, 2013 at 6:38 PM, daspegren aspegren_da...@hotmail.comwrote:

 Hi all,

 I am new to Wicket and am trying to build my first page with authorization.
 But I cannot do:
 Import org.apache.wicket.authroles.authorization.role.Roles;

 It just says that it cannot resolve 'org.apache.wicket.authroles'.

 Why is that?

 If somebody has a good tutorial or example application with basic level
 authorization in a web app based on Wicket, please share.
 Thanks in advance!
 David



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/cannot-import-org-apache-wicket-authroles-authorization-role-Roles-in-Wicket-6-9-tp4660429.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: access denied to Resource

2013-07-24 Thread Piratenvisier

I now have
SecurePackageResourceGuard guard = new
 SecurePackageResourceGuard();
guard.addPattern(+*.xslt);
guard.setAllowAccessToRootResources(true);
getResourceSettings().setPackageResourceGuard(guard);

and I get the following results for
System.err.println(here.getClass());
System.err.println(here.getClass().getResource(/test4.xslt));
PackageResourceReference rs=new 
PackageResourceReference(here.getClass(),/test4.xslt);

System.err.println(rs);

class braunimmobilien.webapp.pages.AngebotForm
null
scope: braunimmobilien.webapp.pages.AngebotForm; name: /test4.xslt; 
locale: null; style: null; variation: null

java.lang.NullPointerException
at 
braunimmobilien.webapp.pages.AngebotForm$EditForm$6.onClick(AngebotForm.java:357)



Am 24.07.2013 09:55, schrieb Martin Grigorov:

On Wed, Jul 24, 2013 at 10:52 AM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:


I want to give access to a file *.xslt
I tried
  SecurePackageResourceGuard guard = new
  SecurePackageResourceGuard();
 guard.addPattern(+*.xslt);


Add
guard.setAllowAccessToRootResources(true);

 getResourceSettings().**setPackageResourceGuard(guard)**;

but no success
always the error
WARN - PackageResourceGuard.**acceptAbsolutePath(176) | Access to root
directory is by default disabled for shared resources: test4.xslt
org.apache.wicket.request.**resource.PackageResource$**
PackageResourceBlockedExceptio**n: Access denied to (static) package
resource test4.xslt. See IPackageResourceGuard


--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.orgusers-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



file upload in nested form with CPM needs dummy model

2013-07-24 Thread Tom Eicher

Hello,

I have an outer form, with a CPM for a business entity.

An inner form
FormVoid uploadImageForm = new Form(UploadImageForm);

has a
FileUploadField uploadImageField =
  new FileUploadField(UploadImageField);

and when I submit the inner form, wicket tries to find
getters/setters for UploadImageField in my business entity,
which obviously are not there:

WicketRuntimeException: No get method defined for class: class 
XXXBusinessEntity expression: UploadImageField


I tried many things to work around this problem, including
FormVoid uploadImageForm = new Form(UploadImageForm, null);
and
uploadImageField = new FileUploadField(UploadImageField, null);
and
setModel(null)
and some more, however the only way to really get rid of this
I found is:

FileUploadField uploadImageField = new 
FileUploadField(UploadImageField, new UploadFieldModel());


static class UploadFieldModel implements IModelListFileUpload {
ListFileUpload f;
@Override
public ListFileUpload getObject() {
return f;
}
@Override
public void setObject(ListFileUpload object) {
f=object;
}
@Override
public void detach() {
}
}

That doesn't sound too reasonable, does it ?
I do not need or want the value to be put to any model, is there any
more sensible way to do this ? (wicket 6.8.0 - will update soon)

Cheers, Tom.

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



Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior

2013-07-24 Thread Andrew Geery
The problem is the ajax-loader-mask.  As per this posting (
http://stackoverflow.com/questions/12403999/jquery-click-event-doesnt-work-after-change-event),
the click happens (but no js click event yet), the js change event is sent
for the modified form field, Wicket handles the change event, the
ajax-loader-mask is displayed, which causes focus to be lost on the
link/button and the js click event is never fired, so Wicket only gets one
event.  If I remove the IAjaxIndicatorAware.getAjaxIndicatorMarkupId(),
which is supplying the ajax-loader-mask, the two events do get queued
correctly.

The solution is to keep the ajax indicator on the button but to remove it
from the form fields.

Thanks
Andrew



On Wed, Jul 24, 2013 at 2:47 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Tue, Jul 23, 2013 at 6:44 PM, Andrew Geery andrew.ge...@gmail.com
 wrote:

  Just to make sure I'm understanding this correctly, it should be enough
 to
  simply override updateAjaxAttributes on AjaxButton and specify a channel
  that does not have ACTIVE behavior, like this:
 
   @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes
  attributes) {
  super.updateAjaxAttributes(attributes);
  attributes.setChannel(new AjaxChannel(MyChannel,
  AjaxChannel.Type.DROP));
  }
 

 The default channel type is QUEUE, so it should work by default.
 I cannot say why it doesn't in your case.


 
  Thanks
  Andrew
 
 
  On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.org
  wrote:
 
   HI,
  
   Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not
   experience this behavior.
   It should work exactly as you expect it.
   Try to put some debug statements with an AjaxCallListener - print to
   console in onBefore() and onBeforeSend(). Add this listener to both
   components - the field and the button.
  
  
   On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com
   wrote:
  
I have a form that is submitted with an AjaxButton.  One of the
 fields
  in
the form uses an AjaxFormComponentUpdatingBehavior to update the
server-side state when a value in the field changes (i.e., it fires
onchange).  If the user changes the field with
the AjaxFormComponentUpdatingBehavior associated with it and then
  clicks
the submit button, the behavior updates the field server side, but
 the
   ajax
button doesn't submit the form.  The user has to click the submit
  button
   a
second time to submit the form.  Is there a way to get the two ajax
behaviors to fire consecutively, rather than forcing the user to
 click
twice?
   
Thanks
Andrew
   
  
 



Re: NumberFormatException from Requests with invalid URIs

2013-07-24 Thread Martin Funk
Hi Sven,

we still can reproduce this on any version.

Maybe this git diff gives a clearer picture:

diff --git
a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
index f974a06..9ee3308 100644
---
a/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
+++
b/wicket-core/src/test/java/org/apache/wicket/protocol/http/servlet/ServletWebRequestTest.java
@@ -191,6 +191,16 @@
  assertEquals(any/source/of/error, errorClientUrl.toString());
  }

+ @Test
+ public void wicketFoo()
+ {
+ String filterPath = filterPath;
+ MockHttpServletRequest httpRequest = new MockHttpServletRequest(null,
null, null);
+ httpRequest.setURL(http://localhost; + '/' + filterPath +
/request/foo://:/);
+
+ ServletWebRequest webRequest = new ServletWebRequest(httpRequest,
filterPath);
+ }
+
  private static class CustomRequestPage extends WebPage implements
IMarkupResourceStreamProvider
  {
  private static final long serialVersionUID = 1L;

This tests leads to this exption

java.lang.NumberFormatException: For input string: 
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at org.apache.wicket.request.Url.parse(Url.java:277)
at
org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:208)
at
org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:112)
at
org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:82)
at
org.apache.wicket.protocol.http.servlet.ServletWebRequestTest.wicketFoo(ServletWebRequestTest.java:201)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

cheers,


Martin



2013/7/24 Mathias Binder mailto...@gmail.com

 We work with Version 6.7.0

 Mathias

 2013/7/24 Sven Meier s...@meiers.net:
  Hi,
 
  which Wicket version? Url parsing has been improved on lately:
 
  @Test
  public void weirdUrl()
  {
  Url url = Url.parse(http://wicket.apache.org/h@@p://h@@p://;);
 
  assertEquals(wicket.apache.org, url.getHost());
  assertEquals(/h@@p://h@@p://, url.getPath());
  }
 
 
  Works fine with 6.10.0-SNAPSHOT.
 
  Sven
 
 
  On 07/24/2013 10:29 AM, Mathias Binder wrote:
 
  Hi,
 
  we became aware of a problem caused by requests with invalid URIs on
  our wicket-application. The URI contains strings like *://*:*, so
  wicket tries to determine and parse a port number, that is not
  present. This leads to NumberFormatExceptions with URIs like, e.g.
  http://host/h@@p://h@@p://
 
  java.lang.NumberFormatException: For input string: 
 
 
 java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  java.lang.Integer.parseInt(Integer.java:470)
  java.lang.Integer.parseInt(Integer.java:499)
  org.apache.wicket.request.Url.parse(Url.java:197)
 
 
 org.apache.wicket.protocol.http.servlet.ServletWebRequest.getContextRelativeUrl(ServletWebRequest.java:222)
 
 
 org.apache.wicket.protocol.http.servlet.ServletWebRequest.init(ServletWebRequest.java:126)
 
 
 

RE: Form questions

2013-07-24 Thread Paul Bors
Is okay for your form to receive an IModel and is also okay not to receive
any models and use a LodableDetachableModel warpped in a
CompoundPropertyModel internally as per my precious e-mail.

Okay, let's stick with the form constructor having an IModel argument.

What's this model? DetachableCnavUrlModel?
Why not just a simple LoadableDetachableModelT?

LoadableDetachableModelCnavUrl cnavUrlLDM = new
LoadableDetachableModelCnavUrl() {
private static final long serialVersionUID = 1L;
@Override
protected CnavUrl load() {
return myDao.getCnavUrl(some id here);
}
};

Now wrap that in a CompoundPropertyModel like so:
Form form = new CnavForm(cnavForm, new
CompoundPropertyModelCnavUrl(cnavUrlLDM));

Your CnavForm would then use the property names of CnavUrl for its component
IDs.

Hope that makes more sense for you now, but you should really re-read
chapter 9 Wicket models and forms of the Wicket Free Guide at (it will
save you lots of time!):
http://wicket.apache.org/learn/books/freeguide.html

~ Thank you,
  Paul Bors

-Original Message-
From: Daniel Watrous [mailto:dwmaill...@gmail.com] 
Sent: Tuesday, July 23, 2013 4:39 PM
To: users@wicket.apache.org
Subject: Re: Form questions

I've had a difficult time following your recommendations. However I think
I'm getting closer.

Part of the disconnect is that right now, as I show above, the model object
I create is in the Form, not the Page. In my Page I create an instance of my
Form like this:

Form form = new CnavForm(cnavForm);
add(form);

So, the first step I've taken is to implement a constructor for my Form that
receives an IModel and, rather than create my CnavUrl, I get it from the
IModel:

CnavUrl cnavUrl = (CnavUrl) model.getObject();
setModel(new Model((Serializable) cnavUrl));

Now I create my Form object like this:

DetachableCnavUrlModel cnavUrlModel = new DetachableCnavUrlModel(new
MorphiaCnavUrl());
Form form = new CnavForm(cnavForm, cnavUrlModel);
add(form);

I'm now at the page level when I create my Model and I have a
DetachableCnavUrlModel, which I also use when displaying them.

if (cnavid != null) {
cnavUrlModel = new
DetachableCnavUrlModel(cnavUrlDAO.getCnavById(cnavid));
} else {
cnavUrlModel = new DetachableCnavUrlModel(new MorphiaCnavUrl());
}
Form form = new CnavForm(cnavForm, cnavUrlModel);
add(form);

This way on edit I have a prepopulated form.

To answer my other question about the link, I created a PageParameters
object and used setResponsePage like this

item.add(new Link(editlink) {
@Override
public void onClick() {
PageParameters editParameters = new
PageParameters();
editParameters.add(cnavid,
((MorphiaCnavUrl)cnavUrl).getId());

setResponsePage(CnavModify.class, editParameters);
}
});

I can then use the value in the parameters to set cnavid

if (parameters.get(cnavid).toString() != null) {
cnavid = new ObjectId(parameters.get(cnavid).toString());
}

Thanks for all the help.

Daniel


On Fri, Jul 19, 2013 at 9:38 AM, Paul Bors p...@bors.ws wrote:

 For stateless pages it would create a new one each time (add the 
 DebugBar to your pages and see if your page is stateless or not and 
 also see what the model is per component).

 For when Wicket serializes your page, you don't want a PropertyModel 
 alone, you want a detachable model (see section 9.6 of the Wicket Free 
 Guide or go over chapter 9 again Wicket models and forms). You need 
 to wrap a Detachable model inside a Property model like so:

 add(new TextField(url, new PropertyModelMorphiaCnavUrl(new 
 LoadableDetachableModelMorphiaCnavUrl(cnavUrl), URL))
  .setRequired(true)
  .add(new UrlValidator()));

 Is best to use a CompoundPropertyModel for the entire form and get to 
 your POJO that feeds the entire form (or panel) via a detachable model.

 The LoadableDetachableModel is desined to only serialize the record ID 
 for which you can later retrieve the entire object from your persistence
layer.

 ~ Thank you,
   Paul Bors

 -Original Message-
 From: Daniel Watrous [mailto:dwmaill...@gmail.com]
 Sent: Friday, July 19, 2013 11:24 AM
 To: users@wicket.apache.org
 Subject: Re: Form questions

 Paul,

 Thanks. I get that and understand how the Model happens. As you can 
 see, the instance of the model object is created in the constructor. 
 So the first question I had is whether a new instance is created for 
 every request or if there's one instance that's serialized. I suspect 
 it's the second, knowing how Wicket treats sessions. In that case, I 
 need some way on a per request basis to load the model from the 
 database.

 The other question I had is how to create a link that sends the ID to 

Re: access denied to Resource

2013-07-24 Thread Piratenvisier

Problem is solved!

Am 24.07.2013 14:32, schrieb Piratenvisier:

I now have
SecurePackageResourceGuard guard = new
 SecurePackageResourceGuard();
guard.addPattern(+*.xslt);
guard.setAllowAccessToRootResources(true);
getResourceSettings().setPackageResourceGuard(guard);

and I get the following results for
System.err.println(here.getClass());
System.err.println(here.getClass().getResource(/test4.xslt));
PackageResourceReference rs=new 
PackageResourceReference(here.getClass(),/test4.xslt);

System.err.println(rs);

class braunimmobilien.webapp.pages.AngebotForm
null
scope: braunimmobilien.webapp.pages.AngebotForm; name: /test4.xslt; 
locale: null; style: null; variation: null

java.lang.NullPointerException
at 
braunimmobilien.webapp.pages.AngebotForm$EditForm$6.onClick(AngebotForm.java:357)



Am 24.07.2013 09:55, schrieb Martin Grigorov:

On Wed, Jul 24, 2013 at 10:52 AM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:


I want to give access to a file *.xslt
I tried
  SecurePackageResourceGuard guard = new
  SecurePackageResourceGuard();
 guard.addPattern(+*.xslt);


Add
guard.setAllowAccessToRootResources(true);

getResourceSettings().**setPackageResourceGuard(guard)**;

but no success
always the error
WARN - PackageResourceGuard.**acceptAbsolutePath(176) | Access to root
directory is by default disabled for shared resources: test4.xslt
org.apache.wicket.request.**resource.PackageResource$**
PackageResourceBlockedExceptio**n: Access denied to (static) package
resource test4.xslt. See IPackageResourceGuard


--**--**- 

To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.orgusers-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




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



Re: TinyMCE Twitter Bootstrap Toggle

2013-07-24 Thread Alec Swan
I noticed that TinyMce plugin in WicketStuff 1.5.9.1 packages an old
version of TinyMce. Does anybody know what is the latest TinyMce Wicket
plugin release compatible with Wicket 1.5.9?

Thanks,

Alec


On Tue, Jul 23, 2013 at 2:13 PM, Alec Swan alecs...@gmail.com wrote:

 I am on Wicket 1.5.9 using WicketStuff 1.5.9.1.

 I ended up overriding TinyMceBehavior#beforeRender in order to inject
 class=collapse on the TinyMCE wrapper DIV. Can you think of a cleaner
 solution?

 @Override
 public void beforeRender(Component component)
 {
 // see super#beforeRender(Component)
 component.getResponse().write(String.format(div
 id=\%s\ class=\collapse\, getAjaxRegionMarkupId(component))); //
 collapse html editor by default
 }

 Thanks,

 Alec


 On Tue, Jul 23, 2013 at 9:52 AM, Andrea Del Bene an.delb...@gmail.comwrote:

 Which version of Wicket/WicketStuff are you using?
  Andrea, thank you for a good pointer. The thing I am struggling with is
  adding class=collapse to the xxx_wrapper_component which seems to be
  created by TinyMCE JavaScript after my Wicket code can add
  AttributeModifier or even invoke $('# + getAjaxRegionMarkupId() +
  ').css('class', 'collapse');.
 
  It seems like the class gets set by right after that is erased by
 TinyMCE.
 
  Any ideas how I can run my code that sets CSS class of mce wrapper div
  after tinyMce.init()?
 
  Thanks,
 
  Alec
 
 
  On Mon, Jul 22, 2013 at 1:30 AM, Andrea Del Bene an.delb...@gmail.com
 wrote:
 
  Hi,
 
  you can have a look at InPlaceEditComponent which is used in the
 example
  page InlineTinyMCEPage (see code at
 
 
 https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/tinymce-parent/tinymce-examples/src/main/java/wicket/contrib/examples/tinymce/InlineTinyMCEPage.java
  )
  Hello,
 
  I have a bootstrap toggle button which the user can use to open and
 close
  TinyMCE editor. When the page is rendered I would like the TinyMCE
 editor
  to be closed and when user clicks on the toggle button - open.
 
  Note that twitter bootstrap button needs to know
  TinyMCE#getAjaxRegionMarkupId(area) in order to use it in
  toggle-target='xxx' attribute to toggle it.
 
  Is there a way to configure TinyMceBehavior to render hidden by
 default?
  Any other ideas on how I can get this solved?
 
  Thanks,
 
  Alec
 
 
  -
  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





Re: Wicket Atmosphere - Encoding and MultiTab issues

2013-07-24 Thread fliptaboada
Ticket filed :)
https://issues.apache.org/jira/browse/WICKET-5285

 The browsers have a limit of max opened connections to a domain. 
 For Firefox and Chrome it is 6 connections. 
 For IE 7/8 (not sure about the newer versions) it is 2. 

Interesting, 
Is this diferent when using websocket?

We use JBoss EAP 6.1, so the Atmosphere version included in
wicket-atmosphere (1.0.13) don't support JBoss Websockets, it fallsback to
streaming and this issue happens, but I tried to implement a websocket based
on this https://github.com/Atmosphere/jboss-websockets using a servlet and
then this issue don't happens anymore, none of the tabs get blocked.
In this test I've not used the jquery.atmosphere javascript, only the
servlet implementation and basic Websocket javascript api.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Atmosphere-Encoding-and-MultiTab-issues-tp4660342p4660474.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: TinyMCE Twitter Bootstrap Toggle

2013-07-24 Thread Andrea Del Bene
ver 1.5.9.1 is the latest one. Look here: 
http://mvnrepository.com/artifact/org.wicketstuff/wicketstuff-tinymce

I noticed that TinyMce plugin in WicketStuff 1.5.9.1 packages an old
version of TinyMce. Does anybody know what is the latest TinyMce Wicket
plugin release compatible with Wicket 1.5.9?

Thanks,

Alec


On Tue, Jul 23, 2013 at 2:13 PM, Alec Swan alecs...@gmail.com wrote:


I am on Wicket 1.5.9 using WicketStuff 1.5.9.1.

I ended up overriding TinyMceBehavior#beforeRender in order to inject
class=collapse on the TinyMCE wrapper DIV. Can you think of a cleaner
solution?

@Override
 public void beforeRender(Component component)
 {
 // see super#beforeRender(Component)
 component.getResponse().write(String.format(div
id=\%s\ class=\collapse\, getAjaxRegionMarkupId(component))); //
collapse html editor by default
 }

Thanks,

Alec


On Tue, Jul 23, 2013 at 9:52 AM, Andrea Del Bene an.delb...@gmail.comwrote:


Which version of Wicket/WicketStuff are you using?

Andrea, thank you for a good pointer. The thing I am struggling with is
adding class=collapse to the xxx_wrapper_component which seems to be
created by TinyMCE JavaScript after my Wicket code can add
AttributeModifier or even invoke $('# + getAjaxRegionMarkupId() +
').css('class', 'collapse');.

It seems like the class gets set by right after that is erased by

TinyMCE.

Any ideas how I can run my code that sets CSS class of mce wrapper div
after tinyMce.init()?

Thanks,

Alec


On Mon, Jul 22, 2013 at 1:30 AM, Andrea Del Bene an.delb...@gmail.com
wrote:


Hi,

you can have a look at InPlaceEditComponent which is used in the

example

page InlineTinyMCEPage (see code at



https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/tinymce-parent/tinymce-examples/src/main/java/wicket/contrib/examples/tinymce/InlineTinyMCEPage.java

)

Hello,

I have a bootstrap toggle button which the user can use to open and

close

TinyMCE editor. When the page is rendered I would like the TinyMCE

editor

to be closed and when user clicks on the toggle button - open.

Note that twitter bootstrap button needs to know
TinyMCE#getAjaxRegionMarkupId(area) in order to use it in
toggle-target='xxx' attribute to toggle it.

Is there a way to configure TinyMceBehavior to render hidden by

default?

Any other ideas on how I can get this solved?

Thanks,

Alec


-
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





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