Is there an example project for wicket-spring-boot with gradle and webpack?

2019-12-08 Thread Per Newgro
Hello *,

i try to setup a spring boot project based on wicket-spring-boot-parent.
To built my frontend assets (sass, js, svg minify etc) i like to use webpack.

But if i start my project the assets are not loaded. So i hope to find an 
example project,
where i can find some inspirations how i could setup everything.

Btw. i built everything with gradle.

Thanks for your support
Per

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



Is there a SOAP resource?

2019-10-07 Thread Per Newgro
Hello every1,

i would like to migrate some features of an web app to my wicket app.

The web app is a spring boot app that provides access to data using SOAP.
The web service extracts the SOAP request and calls my wicket app by using rest 
resource.

But now i need to replace the additional web app by my wicket app.

So far i do everything using rest resource. So i ask myself if there is a 
similiar component for SOAP.

Thanks for your support
Regards
Per

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



Aw: Re: Wicket Spring boot - use spring devtools

2019-08-28 Thread Per Newgro
Hello Martin,

the problem is that i assign a model in request cycle metadata by using the key

public class IdentityInstance extends MetaDataKey> {

public static IdentityInstance KEY = new IdentityInstance();

private IdentityInstance() {
super();
}
}

Page:
getRequestCycle().setMetaData(IdentityInstance.KEY, identityModel);

Widget:
IModel identity = getRequestCycle().getMetaData(IdentityInstance.KEY);

But the model in Widget is always null. While debugging i found that object 
identity is used in Class#equals(Object o), what is ok for me.
But with different classloaders class is loaded multiple times.

I could provide a quickstart for this & create an issue, if you like. (?)

I would like to adapt my configuration so that devtools are still available.

(DCEVM i need to inspect :-).)

Thanks for your support.
Regards
Per

> Gesendet: Mittwoch, 28. August 2019 um 10:37 Uhr
> Von: "Martin Grigorov" 
> An: "users@wicket.apache.org" 
> Betreff: Re: Wicket Spring boot - use spring devtools
>
> Hi,
>
> This is how Spring Dev Tools work. When it detects a change it removes the
> old application class loader and creates a new one.
> Why this is a problem for you ?
>
> I personally prefer to use DCEVM (https://dcevm.github.io/). It is able to
> redefine a specific class in the current class loader.
> When I change a Spring @Configuration or Hibernate mapping I just restart
> the application manually.
>
> On Wed, Aug 28, 2019 at 11:25 AM Per Newgro  wrote:
>
> > Hello *,
> >
> > I migrate my current wicket app to spring boot version (
> > https://github.com/MarcGiffing/wicket-spring-boot).
> >
> > So far it was straightforward. But now i experience a problem with
> > inclusion of
> > 
> >
> > org.springframework.boot
> >
> > spring-boot-devtools
> > 
> >
> > It seems that the "restart / reload feature" of devtools loads my classes
> > multiple times, so that they are not equal anymore (x.class <> x.class).
> > I understand that this is happening. But i would like to know if there is
> > another option for me beside - removing spring-boot-devtools.
> >
> > Would be nice to here from you
> > Thanks
> > Per
> >
> > -
> > 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



Wicket Spring boot - use spring devtools

2019-08-28 Thread Per Newgro
Hello *,

I migrate my current wicket app to spring boot version 
(https://github.com/MarcGiffing/wicket-spring-boot).

So far it was straightforward. But now i experience a problem with inclusion of


org.springframework.boot

spring-boot-devtools


It seems that the "restart / reload feature" of devtools loads my classes 
multiple times, so that they are not equal anymore (x.class <> x.class).
I understand that this is happening. But i would like to know if there is 
another option for me beside - removing spring-boot-devtools.

Would be nice to here from you
Thanks
Per

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



Re: How to trace that a resource was requested?

2019-03-17 Thread Per Newgro

Thanks Martin, good guess.

Regards
Per


Hi,

You can use Link#onClick() to count and then throw
RedirectToUrlException(urlFor(yourResourceReference)) that will lead to a
redirect.

On Tue, Mar 12, 2019 at 3:11 PM Per Newgro  wrote:


Hello,

i like to log that a resource (PDF file), generated in backend, was
requested.

The resource is mounted by a resource reference. An external link is using
url to resource reference.
Download of file generated by resource is working.

But I like to avoid log of every request to resource. If the resource is
requested without clicking the link
i don't want to log the request. So i can not log the request while
resource is generated. I need an onClick.

I guess i can not use ExternalLink because it is not calling the server
after click.
Maybe i need to use ResourceLink, but with that component no one is
calling it's onClick method.

Is there any example on how to listen to downloads?

Thanks for your support
Per

-
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



How to trace that a resource was requested?

2019-03-12 Thread Per Newgro
Hello,

i like to log that a resource (PDF file), generated in backend, was requested.

The resource is mounted by a resource reference. An external link is using url 
to resource reference.
Download of file generated by resource is working.

But I like to avoid log of every request to resource. If the resource is 
requested without clicking the link
i don't want to log the request. So i can not log the request while resource is 
generated. I need an onClick.

I guess i can not use ExternalLink because it is not calling the server after 
click.
Maybe i need to use ResourceLink, but with that component no one is calling 
it's onClick method.

Is there any example on how to listen to downloads?

Thanks for your support
Per

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



Google Login with spring boot @WicketApp

2018-03-31 Thread Per Newgro

Hello,

i would like to replace my local (db-based) login with OAuth Provider 
Google.


But so far i could not implement a working solution. The app is 
registered at Google.


Client secret and ID are present. But i can not find an example how to 
integrate everything in my Wicket App.


Is some1 knowing an example which i can study?

Thanks for your support

Per


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



Re: Wicket Spring Boot open entity manager in view config

2018-03-31 Thread Per Newgro

Hi,

i can answer myself :-)

    public @Bean FilterRegistrationBean openEntityManagerInViewFilter() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new OpenEntityManagerInViewFilter());
        registration.setName("openEntityManagerInView");
        registration.addUrlPatterns("/*");
        return registration;
    }

If some1 else looks for this.

Cheers
Per

Am 23.03.2018 um 19:47 schrieb Per Newgro:

Hello,

we would like to use the open-entitymanager-in-view pattern. It was 
working in our "old fashioned" spring application by configuring 
filter in web.xml.


But we can not find the appropriate config for wicket spring boot. 
Enable spring.jpa.open-entitymanager-in-view=true seems not to be enough.


We still get LazyInitException - no session.

Can one of you please provide a short comment, what we can still check?


Thanks for your support.

Per


-
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



Wicket Spring Boot open entity manager in view config

2018-03-23 Thread Per Newgro

Hello,

we would like to use the open-entitymanager-in-view pattern. It was 
working in our "old fashioned" spring application by configuring filter 
in web.xml.


But we can not find the appropriate config for wicket spring boot. 
Enable spring.jpa.open-entitymanager-in-view=true seems not to be enough.


We still get LazyInitException - no session.

Can one of you please provide a short comment, what we can still check?


Thanks for your support.

Per


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



Can I use wicket to emend my markup?

2017-11-21 Thread Per Newgro
Hello,

i try to render HTML markup with flying saucer to PDF.
In case i render the page by wicket and use that result markup in my flying 
saucer wicket resource, everything is ok.

Because i need to generate some SVG by browser using javascript (d3.js) i would 
like to send the markup from browser to my FS wicket resource.

My main problem is that sending the html by using 
document.documentElement.outerHTML destroys the markup. It cuts of the end-tag 
from my
link element. So the flying saucer complains on a missing link end-tag.

Example

My original html looks like this

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>



Apache Wicket Quickstart






Apache Wicket




after sending result of document.documentElement.outerHTML as form-data to 
wicket resource i receive

 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>

Apache Wicket Quickstart
http://localhost:8080/style.css; 
type="text/css" media="screen" title="Stylesheet">





...

The meta and link end-tags have been removed (i suspect the browser doing that).

Flying saucer complains then with
1:36:41.764 [qtp2116908859-19] WARN  RequestCycleExtra - Handling the following 
exception
org.xhtmlrenderer.util.XRRuntimeException: Can't load the XML resource (using 
TrAX transformer). org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 
4; Elementtyp "link" muss mit dem entsprechenden Endtag "" beendet 
werden.
at 
org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.transform(XMLResource.java:222)
 ~[flying-saucer-core-9.1.6.jar:?]
at 
org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:181)
 ~[flying-saucer-core-9.1.6.jar:?]
at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:84) 
~[flying-saucer-core-9.1.6.jar:?]
at 
org.xhtmlrenderer.pdf.ITextRenderer.setDocumentFromString(ITextRenderer.java:161)
 ~[flying-saucer-pdf-itext5-9.1.6.jar:?]


What i would like to know is - can i send the markup to a "wicket class" and 
emend the corrupt tags?
I would like to avoid to handle every corrupt tag manually.

Thanks for your support
Per

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



Aw: Re: Re: Use Resource to transfer SVG to PNG

2017-07-18 Thread Per Newgro
I've added a quickstart. https://issues.apache.org/jira/browse/WICKET-6424

Per

> Gesendet: Dienstag, 18. Juli 2017 um 08:16 Uhr
> Von: "Per Newgro" <per.new...@gmx.ch>
> An: users@wicket.apache.org
> Betreff: Aw: Re: Re: Use Resource to transfer SVG to PNG
>
> My main problem is, that i can not send the svg text to the resource. Doing 
> so by request parameters is not an option because the firewall will deny that 
> long cryptic content.
> Therefor i would like to send the svg content through a form.
> 
> So far i have the following:
> 
> In my page-markup (containing the svg) i have
> 
> 
>   
>wicket:message="value:misc.chartExport" />
> 
> 
> 
>   var getSvg = function(element) {
>   var svgHtml = document.querySelector('#chart-container 
> .highcharts-container').innerHTML;
>   element.querySelector('input[name="data"]').value = svgHtml;
>   }
> 
> 
> 
> In my page i have
>   
> add(
>   new WebMarkupContainer("svgForm")
>   .add(AttributeModifier.replace("action", 
> PngResourceReference.url().toString(;
> 
> 
> I've registered a resource by reference
> 
> app.mountResource("/svg2png", new PngResourceReference());
> 
> ---
> 
> public class PngResourceReference extends ResourceReference {
> 
>   private static final Key KEY = new 
> Key(PngResourceReference.class.getName(), "svg-to-png", null, null, null);
>   
>   public PngResourceReference() {
>   super(KEY);
>   }
> 
>   @Override
>   public IResource getResource() {
>   return new PngResource();
>   }
> 
>   public static CharSequence url() {
>   PageParameters svgParameters = new PageParameters();
>   return 
> RequestCycle.get().urlFor(Application.get().getResourceReferenceRegistry().getResourceReference(KEY,
>  false, false), svgParameters);
>   }
> }
> 
> public class PngResource extends ByteArrayResource {
> 
>   public PngResource() {
>   super("image/png");
>   }
>   
>   @Override
>   protected void configureResponse(ResourceResponse response, Attributes 
> attributes) {
>   super.configureResponse(response, attributes);
>   response.setContentDisposition(ContentDisposition.ATTACHMENT);
>   response.setFileName("chart.png");
>   response.disableCaching();
>   }
> 
>   @Override
>   protected byte[] getData(Attributes attributes) {
>   ByteArrayOutputStream os;
>   try {
>   PNGTranscoder t = new PNGTranscoder();
>   
>   // Set the transcoder input and output.
>   String svg = "something";
>   TranscoderInput input = new TranscoderInput(new 
> StringReader(svg));
>   os = new ByteArrayOutputStream();
>   TranscoderOutput output = new TranscoderOutput(os);
> 
>   // Perform the transcoding.
>   t.transcode(input, output);
>   os.close();
>   } catch (TranscoderException | IOException e) {
>   throw new RuntimeException(e);
>   }
>   return os.toByteArray();
>   }
> }
> 
> > Gesendet: Montag, 17. Juli 2017 um 15:30 Uhr
> > Von: "Martin Grigorov" <mgrigo...@apache.org>
> > An: "users@wicket.apache.org" <users@wicket.apache.org>
> > Betreff: Re: Re: Use Resource to transfer SVG to PNG
> >
> > On Mon, Jul 17, 2017 at 3:13 PM, Per Newgro <per.new...@gmx.ch> wrote:
> > 
> > > Thanks for your response Martin.
> > >
> > > I tried to make it work the whole day now. But i can not get it to work
> > > with IE11.
> > > There is always a security error. This is a known problem for IE and
> > > canvas.
> > >
> > > I ended up:
> > >
> > > $("#chart-export").on("click", function() {
> > > var svg = document.querySelector( "svg" );
> > > var svgData = new XMLSerializer().serializeToString( svg );
> > >
> > > var canvas = document.createElement( "canvas" );
> > > document.body.appendChild(canvas);
> > > var svgSize = svg.getBoundingClientRect();
> > > canvas.width = svgSize.width;
> > > canvas.height = svgSize.height;
> > >
> > > var ctx = canvas.getContext( "2d" )

Aw: Re: Re: Use Resource to transfer SVG to PNG

2017-07-18 Thread Per Newgro
My main problem is, that i can not send the svg text to the resource. Doing so 
by request parameters is not an option because the firewall will deny that long 
cryptic content.
Therefor i would like to send the svg content through a form.

So far i have the following:

In my page-markup (containing the svg) i have


  
  



var getSvg = function(element) {
var svgHtml = document.querySelector('#chart-container 
.highcharts-container').innerHTML;
element.querySelector('input[name="data"]').value = svgHtml;
}



In my page i have

add(
  new WebMarkupContainer("svgForm")
  .add(AttributeModifier.replace("action", 
PngResourceReference.url().toString(;


I've registered a resource by reference

app.mountResource("/svg2png", new PngResourceReference());

---

public class PngResourceReference extends ResourceReference {

private static final Key KEY = new 
Key(PngResourceReference.class.getName(), "svg-to-png", null, null, null);

public PngResourceReference() {
super(KEY);
}

@Override
public IResource getResource() {
return new PngResource();
}

public static CharSequence url() {
PageParameters svgParameters = new PageParameters();
return 
RequestCycle.get().urlFor(Application.get().getResourceReferenceRegistry().getResourceReference(KEY,
 false, false), svgParameters);
}
}

public class PngResource extends ByteArrayResource {

public PngResource() {
super("image/png");
}

@Override
protected void configureResponse(ResourceResponse response, Attributes 
attributes) {
super.configureResponse(response, attributes);
response.setContentDisposition(ContentDisposition.ATTACHMENT);
response.setFileName("chart.png");
response.disableCaching();
}

@Override
protected byte[] getData(Attributes attributes) {
ByteArrayOutputStream os;
try {
PNGTranscoder t = new PNGTranscoder();

// Set the transcoder input and output.
String svg = "something";
TranscoderInput input = new TranscoderInput(new 
StringReader(svg));
os = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(os);

// Perform the transcoding.
t.transcode(input, output);
os.close();
} catch (TranscoderException | IOException e) {
throw new RuntimeException(e);
}
return os.toByteArray();
}
}

> Gesendet: Montag, 17. Juli 2017 um 15:30 Uhr
> Von: "Martin Grigorov" <mgrigo...@apache.org>
> An: "users@wicket.apache.org" <users@wicket.apache.org>
> Betreff: Re: Re: Use Resource to transfer SVG to PNG
>
> On Mon, Jul 17, 2017 at 3:13 PM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > Thanks for your response Martin.
> >
> > I tried to make it work the whole day now. But i can not get it to work
> > with IE11.
> > There is always a security error. This is a known problem for IE and
> > canvas.
> >
> > I ended up:
> >
> > $("#chart-export").on("click", function() {
> > var svg = document.querySelector( "svg" );
> > var svgData = new XMLSerializer().serializeToString( svg );
> >
> > var canvas = document.createElement( "canvas" );
> > document.body.appendChild(canvas);
> > var svgSize = svg.getBoundingClientRect();
> > canvas.width = svgSize.width;
> > canvas.height = svgSize.height;
> >
> > var ctx = canvas.getContext( "2d" );
> > ctx.clearRect(0, 0, canvas.width, canvas.height);
> >
> > var img = document.createElement("img");
> > img.setAttribute("crossOrigin", "anonymous");
> > img.onload = function() {
> > ctx.drawImage( img, 0, 0 );
> > var a = document.createElement("a");
> > a.download = "chart.png";
> > a.href = canvas.toDataURL( "image/png" );
> > document.body.appendChild(a);
> > a.click();
> > };
> > img.setAttribute("src", "data:image/svg+xml;base64," + 
> > btoa(unescape(encodeURIComponent(svgData)))
> > );
> > });
> >
> > So i need to go on the other way. But there my problems still occur.
> >
> 
> What 

Aw: Re: Use Resource to transfer SVG to PNG

2017-07-17 Thread Per Newgro
Thanks for your response Martin.

I tried to make it work the whole day now. But i can not get it to work with 
IE11.
There is always a security error. This is a known problem for IE and canvas.

I ended up:

$("#chart-export").on("click", function() {
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );

var canvas = document.createElement( "canvas" );
document.body.appendChild(canvas);
var svgSize = svg.getBoundingClientRect();
canvas.width = svgSize.width;
canvas.height = svgSize.height;

var ctx = canvas.getContext( "2d" );
ctx.clearRect(0, 0, canvas.width, canvas.height);

var img = document.createElement("img");
img.setAttribute("crossOrigin", "anonymous");
img.onload = function() {
ctx.drawImage( img, 0, 0 );
var a = document.createElement("a");
a.download = "chart.png";
a.href = canvas.toDataURL( "image/png" ); 
document.body.appendChild(a);
a.click();
};
img.setAttribute("src", "data:image/svg+xml;base64," + 
btoa(unescape(encodeURIComponent(svgData))) );
});

So i need to go on the other way. But there my problems still occur.

Regards
Per

> Gesendet: Montag, 17. Juli 2017 um 10:42 Uhr
> Von: "Martin Grigorov" <mgrigo...@apache.org>
> An: "users@wicket.apache.org" <users@wicket.apache.org>
> Betreff: Re: Use Resource to transfer SVG to PNG
>
> Hi,
> 
> Wouldn't HTML Canvas API be better solution?
> See https://stackoverflow.com/a/27232525/497381
> 
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
> On Mon, Jul 17, 2017 at 10:12 AM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > Hello *,
> >
> > I would like to generate a png from a svg. The transcoding is done by
> > using Batik.
> > So far it works as expected.
> >
> > But i'm not sure how to provide the resulting png (a byte[]) to my
> > frontend.
> >
> > The svg is generate in browser by using highcharts. I would like to
> > provide a button
> > that downloads the transcoded png by sending a request to the "transcoding
> > resource"
> > and using the svg-dom from browser.
> >
> > Is there someone who did that already once? Can you please give me a hint
> > how this could work?
> >
> > Thanks for your support
> > Per
> >
> > -
> > 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



Use Resource to transfer SVG to PNG

2017-07-17 Thread Per Newgro
Hello *,

I would like to generate a png from a svg. The transcoding is done by using 
Batik.
So far it works as expected.

But i'm not sure how to provide the resulting png (a byte[]) to my frontend.

The svg is generate in browser by using highcharts. I would like to provide a 
button
that downloads the transcoded png by sending a request to the "transcoding 
resource"
and using the svg-dom from browser.

Is there someone who did that already once? Can you please give me a hint how 
this could work?

Thanks for your support
Per

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



Aw: Re: Re: Re: ListItem and enclosure problem

2017-06-08 Thread Per Newgro
Thanks a lot Andrea,

that did work. Now i get only markup of visible items.

My Solution looks now:


ListViewEnclosurePage.html

http://wicket.apache.org;>
  


  
  

  

  
[Content]
  

  

  


ListViewEnclosurePage$MyListView.java
  public static class MyListView extends ListView {

public MyListView(
String id,
List list) {
  super(id, list);
}

@Override
protected void populateItem(ListItem item) {
  Label label = new Label("bar", item.getModel());
  item.add(label);
  if (item.getIndex() == 1) {
item.setVisible(false);
  }
}
  }


Thanks for your support
Per

> Gesendet: Donnerstag, 08. Juni 2017 um 12:30 Uhr
> Von: "Andrea Del Bene" <an.delb...@gmail.com>
> An: users@wicket.apache.org
> Betreff: Re: Re: Re: ListItem and enclosure problem
>
> Just use:
> 
> item.setVisible(false);
> 
> instead of:
> 
> label.setVisible(false);
> 
> On Thu, Jun 8, 2017 at 12:23 PM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > But wouldn't this only hide the complete listview when there is no item?
> > I want to remove markup only for an empty item.
> >
> > So something like
> > 
> >   1
> >   2
> >   3
> > 
> >
> > should become in case foo:1:bar is invisible
> >
> > 
> >   1
> >   3
> > 
> >
> > Thank you
> > Per
> >
> > > Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr
> > > Von: "Andrea Del Bene" <an.delb...@gmail.com>
> > > An: users@wicket.apache.org
> > > Betreff: Re: Re: ListItem and enclosure problem
> > >
> > > Sorry, in your case this HTML should work better:
> > >
> > > 
> > > 
> > >   
> > >        [Content]
> > >
> > > 
> > > 
> > >
> > > Then in your MyListView override onConfigure with something like this:
> > >
> > > void onConfigure() {
> > >super.onConfigure();
> > >setVisible(getModelObject().size() > 0);
> > > }
> > >
> > >
> > > On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro <per.new...@gmx.ch> wrote:
> > >
> > > > Sorry Ernesto for my bad english. But i can not see how i shall get
> > this
> > > > to work with a panel?
> > > > I use a listview because my item count is configurable. So i can not
> > > > generate a "template panel"
> > > > and put all items in that. But i admit that i didn't understand your
> > > > question completely.
> > > >
> > > > Thanks
> > > > Per
> > > >
> > > > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr
> > > > > Von: "Ernesto Reinaldo Barreiro" <reier...@gmail.com>
> > > > > An: "users@wicket.apache.org" <users@wicket.apache.org>
> > > > > Betreff: Re: ListItem and enclosure problem
> > > > >
> > > > > Why to not put the  thing in a panel?
> > > > >
> > > > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro <per.new...@gmx.ch>
> > wrote:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > i would like to enclose markup of a list item in wicket:enclosure.
> > The
> > > > > > enclosure is activated based on a child component on list item.
> > > > > > So for i could not find any marker that this is not working. So i
> > need
> > > > to
> > > > > > do something wrong. Any work around would be welcome.
> > > > > >
> > > > > > Thanks for your support
> > > > > > Per
> > > > > >
> > > > > > 
> > > > > > WicketApplication.java
> > > > > > public class WicketApplication extends WebApplication
> > > > > > {
> > > > > >   /**
> > > > > >* @see org.apache.wicket.Application#getHomePage()
> > > > > >*/
> > > > > >   @Override
> > > > > >   public Class getHomePage()
> > > > > >   {
> > > > > > return HomePage.class;
> > > > > >   }
> > > > > >
> > > > > >   /**
> > > > > >* @see org.apach

Aw: Re: Re: ListItem and enclosure problem

2017-06-08 Thread Per Newgro
But wouldn't this only hide the complete listview when there is no item?
I want to remove markup only for an empty item.

So something like

  1
  2
  3


should become in case foo:1:bar is invisible


  1
  3


Thank you
Per

> Gesendet: Donnerstag, 08. Juni 2017 um 11:40 Uhr
> Von: "Andrea Del Bene" <an.delb...@gmail.com>
> An: users@wicket.apache.org
> Betreff: Re: Re: ListItem and enclosure problem
>
> Sorry, in your case this HTML should work better:
> 
> 
> 
>   
>[Content]
>
> 
> 
> 
> Then in your MyListView override onConfigure with something like this:
> 
> void onConfigure() {
>super.onConfigure();
>setVisible(getModelObject().size() > 0);
> }
> 
> 
> On Thu, Jun 8, 2017 at 11:09 AM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > Sorry Ernesto for my bad english. But i can not see how i shall get this
> > to work with a panel?
> > I use a listview because my item count is configurable. So i can not
> > generate a "template panel"
> > and put all items in that. But i admit that i didn't understand your
> > question completely.
> >
> > Thanks
> > Per
> >
> > > Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr
> > > Von: "Ernesto Reinaldo Barreiro" <reier...@gmail.com>
> > > An: "users@wicket.apache.org" <users@wicket.apache.org>
> > > Betreff: Re: ListItem and enclosure problem
> > >
> > > Why to not put the  thing in a panel?
> > >
> > > On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro <per.new...@gmx.ch> wrote:
> > >
> > > > Hello,
> > > >
> > > > i would like to enclose markup of a list item in wicket:enclosure. The
> > > > enclosure is activated based on a child component on list item.
> > > > So for i could not find any marker that this is not working. So i need
> > to
> > > > do something wrong. Any work around would be welcome.
> > > >
> > > > Thanks for your support
> > > > Per
> > > >
> > > > 
> > > > WicketApplication.java
> > > > public class WicketApplication extends WebApplication
> > > > {
> > > >   /**
> > > >* @see org.apache.wicket.Application#getHomePage()
> > > >*/
> > > >   @Override
> > > >   public Class getHomePage()
> > > >   {
> > > > return HomePage.class;
> > > >   }
> > > >
> > > >   /**
> > > >* @see org.apache.wicket.Application#init()
> > > >*/
> > > >   @Override
> > > >   public void init()
> > > >   {
> > > > super.init();
> > > > mountPage("encloselistitem", ListViewEnclosurePage.class);
> > > >   }
> > > > }
> > > >
> > > > ListViewEnclosurePage.class
> > > > public class ListViewEnclosurePage extends WebPage {
> > > >
> > > >   public ListViewEnclosurePage() {
> > > > add(new MyListView("foo", Arrays.asList("1", "2", "3")));
> > > >   }
> > > >
> > > >   public static class MyListView extends ListView {
> > > >
> > > > public MyListView(
> > > > String id,
> > > > List list) {
> > > > super(id, list);
> > > > }
> > > >
> > > > @Override
> > > > protected void populateItem(ListItem item) {
> > > >   Label label = new Label("bar", item.getModel());
> > > >   item.add(label);
> > > >   if (item.getIndex() == 1) { // any condition
> > > > label.setVisible(false);
> > > >   }
> > > > }
> > > >   }
> > > > }
> > > >
> > > > ListViewEnclosurePage.html
> > > > 
> > > > http://wicket.apache.org;>
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >  > > > wicket:id="bar">[Content]
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > > > -
> > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > > For additional commands, e-mail: users-h...@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> > >
> >
> > -
> > 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



Aw: Re: ListItem and enclosure problem

2017-06-08 Thread Per Newgro
Sorry Ernesto for my bad english. But i can not see how i shall get this to 
work with a panel?
I use a listview because my item count is configurable. So i can not generate a 
"template panel"
and put all items in that. But i admit that i didn't understand your question 
completely.

Thanks
Per

> Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr
> Von: "Ernesto Reinaldo Barreiro" <reier...@gmail.com>
> An: "users@wicket.apache.org" <users@wicket.apache.org>
> Betreff: Re: ListItem and enclosure problem
>
> Why to not put the  thing in a panel?
> 
> On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > Hello,
> >
> > i would like to enclose markup of a list item in wicket:enclosure. The
> > enclosure is activated based on a child component on list item.
> > So for i could not find any marker that this is not working. So i need to
> > do something wrong. Any work around would be welcome.
> >
> > Thanks for your support
> > Per
> >
> > 
> > WicketApplication.java
> > public class WicketApplication extends WebApplication
> > {
> >   /**
> >* @see org.apache.wicket.Application#getHomePage()
> >*/
> >   @Override
> >   public Class getHomePage()
> >   {
> > return HomePage.class;
> >   }
> >
> >   /**
> >* @see org.apache.wicket.Application#init()
> >*/
> >   @Override
> >   public void init()
> >   {
> > super.init();
> > mountPage("encloselistitem", ListViewEnclosurePage.class);
> >   }
> > }
> >
> > ListViewEnclosurePage.class
> > public class ListViewEnclosurePage extends WebPage {
> >
> >   public ListViewEnclosurePage() {
> > add(new MyListView("foo", Arrays.asList("1", "2", "3")));
> >   }
> >
> >   public static class MyListView extends ListView {
> >
> > public MyListView(
> > String id,
> > List list) {
> > super(id, list);
> > }
> >
> > @Override
> > protected void populateItem(ListItem item) {
> >   Label label = new Label("bar", item.getModel());
> >   item.add(label);
> >   if (item.getIndex() == 1) { // any condition
> > label.setVisible(false);
> >   }
> > }
> >   }
> > }
> >
> > ListViewEnclosurePage.html
> > 
> > http://wicket.apache.org;>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  > wicket:id="bar">[Content]
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro
> 

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



Aw: Re: ListItem and enclosure problem

2017-06-08 Thread Per Newgro
Thanks for responding.

Maybe i should have stated my goal clearly. I would like to remove the space 
occupied by empty list items.
Basically i do it with wicket:enclosures. While not displaying the "empty 
element" markup the space is not occupied.

Do you mean that i need to change it that way?

http://wicket.apache.org;>
  


  
  

  

  
[Content]
  

  

  


This is not working to.
ERROR - DefaultExceptionMapper - Unexpected error occurred
org.apache.wicket.WicketRuntimeException: Could not find child with id: foo:bar 
in the wicket:enclosure
at 
org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enclosure.java:250)
at 
org.apache.wicket.markup.html.internal.Enclosure.getChildComponent(Enclosure.java:228)
at 
org.apache.wicket.markup.html.internal.Enclosure.onInitialize(Enclosure.java:132)
at org.apache.wicket.Component.fireInitialize(Component.java:877)
at 
org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:961)
at 
org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:938)

This works but with multiple ul in markup and the empty ul is still displayed.

http://wicket.apache.org;>
  


  
  

  

  
[Content]
  

  

  


Thanks for help
Per

> Gesendet: Donnerstag, 08. Juni 2017 um 10:17 Uhr
> Von: "Andrea Del Bene" <an.delb...@gmail.com>
> An: users@wicket.apache.org
> Betreff: Re: ListItem and enclosure problem
>
> Hi,
> 
> have a look at the answer here on StackOverflow:
> https://stackoverflow.com/questions/44270160/how-to-access-html-element-which-doesnt-have-a-wicketid
> Basically you should move your ListView to  tag an remove wicket:id
> from  tag.
> 
> On Thu, Jun 8, 2017 at 9:54 AM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > Hello,
> >
> > i would like to enclose markup of a list item in wicket:enclosure. The
> > enclosure is activated based on a child component on list item.
> > So for i could not find any marker that this is not working. So i need to
> > do something wrong. Any work around would be welcome.
> >
> > Thanks for your support
> > Per
> >
> > 
> > WicketApplication.java
> > public class WicketApplication extends WebApplication
> > {
> >   /**
> >* @see org.apache.wicket.Application#getHomePage()
> >*/
> >   @Override
> >   public Class getHomePage()
> >   {
> > return HomePage.class;
> >   }
> >
> >   /**
> >* @see org.apache.wicket.Application#init()
> >*/
> >   @Override
> >   public void init()
> >   {
> > super.init();
> > mountPage("encloselistitem", ListViewEnclosurePage.class);
> >   }
> > }
> >
> > ListViewEnclosurePage.class
> > public class ListViewEnclosurePage extends WebPage {
> >
> >   public ListViewEnclosurePage() {
> > add(new MyListView("foo", Arrays.asList("1", "2", "3")));
> >   }
> >
> >   public static class MyListView extends ListView {
> >
> > public MyListView(
> > String id,
> > List list) {
> > super(id, list);
> > }
> >
> > @Override
> > protected void populateItem(ListItem item) {
> >   Label label = new Label("bar", item.getModel());
> >   item.add(label);
> >   if (item.getIndex() == 1) { // any condition
> > label.setVisible(false);
> >   }
> > }
> >   }
> > }
> >
> > ListViewEnclosurePage.html
> > 
> > http://wicket.apache.org;>
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  > wicket:id="bar">[Content]
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> > -
> > 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



ListItem and enclosure problem

2017-06-08 Thread Per Newgro
Hello,

i would like to enclose markup of a list item in wicket:enclosure. The 
enclosure is activated based on a child component on list item.
So for i could not find any marker that this is not working. So i need to do 
something wrong. Any work around would be welcome.

Thanks for your support
Per


WicketApplication.java
public class WicketApplication extends WebApplication
{
  /**
   * @see org.apache.wicket.Application#getHomePage()
   */
  @Override
  public Class getHomePage()
  {
return HomePage.class;
  }

  /**
   * @see org.apache.wicket.Application#init()
   */
  @Override
  public void init()
  {
super.init();
mountPage("encloselistitem", ListViewEnclosurePage.class);
  }
}

ListViewEnclosurePage.class
public class ListViewEnclosurePage extends WebPage {

  public ListViewEnclosurePage() {
add(new MyListView("foo", Arrays.asList("1", "2", "3")));
  }

  public static class MyListView extends ListView {

public MyListView(
String id,
List list) {
super(id, list);
}

@Override
protected void populateItem(ListItem item) {
  Label label = new Label("bar", item.getModel());
  item.add(label);
  if (item.getIndex() == 1) { // any condition
label.setVisible(false);
  }
}
  }
}

ListViewEnclosurePage.html

http://wicket.apache.org;>









[Content]








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



How can i authorize a 'bot' to access my REST resource?

2017-02-09 Thread Per Newgro
Hi,

i've extended an org.wicketstuff.rest.resource.AbstractRestResource and mounted 
it in my WebApplication.
Everything works so far.

But i've annotated my Method with a role that shall be extracted from the 
session. I'm not quite sure how to
'login' my import command (CLI) as a user

Has someone maybe a working example for authorized resource access?

Thanks
Per


@AuthorizeResource
public class CRMDataImportResource extends 
AbstractRestResource {

  @SpringBean(name = "FullImport")
  private DataImport dataImport;

  public CRMDataImportResource() {
super(new JsonWebSerialDeserial(
new GsonObjectSerialDeserial()), new IRoleCheckingStrategy() {

@Override
public boolean hasAnyRole(Roles roles) {
  CDISession session = CDISession.get();
  return session.hasAnyRole(roles);
}
}
);
Injector.get().inject(this);
  }

  @MethodMapping(
value = "/full",
httpMethod = HttpMethod.POST)
  @AuthorizeInvocation("CRMDataImport")
  public String fullImport(@RequestBody DocumentBatch batch) throws Exception {
return dataImport.fullImport(batch);
  }
}


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



Re: DropDownChoice with ChoiceRenderer

2016-10-14 Thread Per Newgro

Hello ganea,

can you please investigate the method below?

Hope that helps
Per

Am 14.10.2016 um 14:52 schrieb ganea iulia:

@Override
public String getObject(String paramString, IModel> paramIModel) {
// TODO Auto-generated method stub
return null;
}




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



Re: Repeat every 2 rows in a table

2016-10-14 Thread Per Newgro

Hello ganea,

you can find many information about your problem at
http://examples7x.wicket.apache.org/index.html
espacially
http://examples7x.wicket.apache.org/repeater

The user guide can you find here
https://ci.apache.org/projects/wicket/guide/7.x/
Repeaters are explained here
https://ci.apache.org/projects/wicket/guide/7.x/guide/repeaters.html

You can add a markup container to a list view item and add the required 
row components to it.


Hope that helps
Per

Am 14.10.2016 um 09:16 schrieb ganea iulia:

Hello,

I have in the html file, a table where I need to repeat every two rows.
So, my table is backed by a bean, where the bean values fill 2 rows of the
table.
When new bean instance is created, I need to add new 2 rows to the table.

Thank you




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



Aw: Re: Find a component corresponding to entity

2016-09-28 Thread Per Newgro
Thank you both for your statement.
Per

> Gesendet: Mittwoch, 28. September 2016 um 08:34 Uhr
> Von: "Ernesto Reinaldo Barreiro" <reier...@gmail.com>
> An: "users@wicket.apache.org" <users@wicket.apache.org>
> Betreff: Re: Find a component corresponding to entity
>
> Per,
> 
> I normally do it the static factory way.. but Spring might give you the
> advantage for testing (e.g in some situation just pass something that
> creates an empty panels, or anything else). As Martin said, this is not
> something Wicket cares about.
> 
> On Wed, Sep 28, 2016 at 8:04 AM, Per Newgro <per.new...@gmx.ch> wrote:
> 
> > Hello *,
> >
> > I'm looking for an elegant solution to determine a component for an entity.
> >
> > Example:
> > There is a person and two sub-types of it - Manager and Sportsman.
> > The Manager can be listed in a listview by using a ManagerViewItem
> > and the Sportsman by using a SportsmanViewItem.
> >
> > Currently I'm using a factory producing the appropriate viewitems. But
> > this factory is injected by using spring.
> > I would like to reduce the coupling to spring within my component classes
> > (e.g. Page).
> >
> > So i'm looking for a "wicket way" to determine which component is required
> > to list all persons.
> >
> > Thanks for your ideas.
> > Per
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro
> 

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



Find a component corresponding to entity

2016-09-28 Thread Per Newgro
Hello *,

I'm looking for an elegant solution to determine a component for an entity.

Example:
There is a person and two sub-types of it - Manager and Sportsman.
The Manager can be listed in a listview by using a ManagerViewItem
and the Sportsman by using a SportsmanViewItem.

Currently I'm using a factory producing the appropriate viewitems. But this 
factory is injected by using spring.
I would like to reduce the coupling to spring within my component classes (e.g. 
Page).

So i'm looking for a "wicket way" to determine which component is required to 
list all persons.

Thanks for your ideas.
Per

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



Re: Tool for finding missing translations in properties.xml

2016-07-08 Thread Per Newgro
I wrote my own tool as my search wasn't successful. But it is simply a 
main method loading the files and compares keys.

Cheers
Per

Am 07.07.2016 um 16:48 schrieb Thorsten Schöning:

Hi all,

in my Wicket app I'm using properties.xml files for my i18n texts,
like described in the wiki[1]. The problem I have is that the files
are differently up to date, depending on the language and how
important it was for somebody to translate one exact key for one
special language etc. the only thing I really know is that English is
up to date...

So, does anyone knows a tool which expects translation files in a dir
structure and compares all found to their English base file? In the
end it should simply print which file in which dir is missing which
key compared to the English base.

Such a problem sounds common to me, but I couldn't find any good
software dealing with it yet.

Thanks!

[1]: https://ci.apache.org/projects/wicket/guide/6.x/guide/i18n.html#i18n_2

Mit freundlichen Grüßen,

Thorsten Schöning




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



Re: wicket 6.x / java.text.ParseException on multiple div's

2016-05-15 Thread Per Newgro

Did you try to remove the questionable markup to see what is happening?

Am 15.05.2016 um 11:39 schrieb Korbinian Bachl:

Hello,

I'm still on migrating a big wicket 1.4 app to wicket 6.23, and I now got a 
problem I dont know how to solve. A page throws following error:

java.text.ParseException: Same attribute found twice: div (line 163, column 52)
at 
org.apache.wicket.markup.parser.XmlPullParser.parseTagText(XmlPullParser.java:698)
 at 
org.apache.wicket.markup.parser.XmlPullParser.next(XmlPullParser.java:311)


so far I would expect this to happen on wrong/ malformed HTML - but my HTML is 
fine is indeed needed this way!

complained HTML:



   
content
 
 
 

   content
 


So what is going on here? Why does wicket complain about those poor div's? Is 
there any way I can disable this check for div's??? For me this behaviour seems 
as a bug as div following a div is perfectly fine HTML code?

Best,

Korbinian

-
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: Filtering capabilities in TH (Array Header) or for dataview.

2016-02-28 Thread Per Newgro

Maybe you can use
org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar

You need to provide your column definitions as IFilteredColumn in your 
DataTable.

The rest will be done by html markup.

It's in wicket-extension library.

Cheers
Per

Am 26.02.2016 um 23:34 schrieb andre seame:

Hello

The DataTableFilterToolbarPage demonstrates the capability of filtering dates 
for a Datatable. Great.

I would like to have an array of . Column 1 and 2 are 
sortable (ASC or DESC). Column 3 and 4 (the dates) are sortable and filterable.

I would like to have a different presentation as DataTableFilterToolbarPage 
does. Instead of having the forms for filtering outside the table, I would like 
to include it into the TH.

 int

 String

 date1  .. 

 date2  .. 

In this case the user will type the filtering condition in the header of the 
column Date1 or Date2.

So questions are:

   *   Is it possible to add filtering capabilities to a dataview? If Yes, I 
can access to the TH cell and had the form information.

   *   Is it possible to modify the content of the cell th Date1 to add the 
form information.

Thanks,

PHL





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



Reanimate project from wicketstuff sandbox

2016-01-10 Thread Per Newgro

Hello,

maybe someone has some experiences with the topic and can support me.

I would like to update wicketstuff/sandbox/wicket-contrib-jamon.
I already forked the sandbox and transfered code from 1.3 to 1.4 to 1.5 
to 6 and now to 7.
Almost all problems are solved. There are some strange tests which 
checks that something is NOT running for 1.3
Maybe the founder of that project can give me some hints on this. But 
anyway.


I would like to clearify the next steps to publish my work to the community.

So far i've read the wicketstuff-wiki - contribute a new project - while 
it is not new :-).


I firstly need to adapt the project structure and put it unter 
wicketstuff/core. Do i need to fork wicketstuff-core

or can i request write-access to orginal repo?

My current master contains the wicket-7 version do i need to support 
earlier versions to? It would be no big problem.
Do i need to create a branch for every version then or is it enough to 
manage branch 1.3.x, 1.4.x and so on?


Thanks for your support
Per

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



Re: Best Practice - Create component by entity type?

2015-07-04 Thread Per Newgro
This sounds good. I already have a registry where i can register services in a 
decoupled way. With spring and @PostConstruct no Problem :-). I would ASK then 
every factory if it is responsible for my entity type. But i still see a 
problem here. How to prioritize factory if i have more than one factory for a 
Person type. For instance if a boss is a manager. Then i can't use instanceof 
in the manager factory because boss entity would match twice.

Am 03.07.2015 3:14 nachm. schrieb Rob Audenaerde rob.audenae...@gmail.com:

 Hi Per, 

 You can do something like this: 

 Create a set of compontents that will be your panels to display specific 
 Persons. 

 Let's call them PersonPanels. 

 You can introduce a PersonPanelFactory, which might give you the 
 appropriate PersonPanel based on the class of the Person ( 
 person.getClass() ) . This is however not yet nicely extensible, but you 
 decoupled the logic for creating panels from your list-code. 

 Next step: you need to register the classes somehow so you can provide 
 panels for in the factory, so the factory can for example use a map to 
 provide the proper PersonPanel. You can use reflection to call the 
 constructors, which will need to have the same arguments for their 
 constructors. This is the biggest disadvantage I think in this approach. 

 Somewhat like this: 

 class PersonPanelFactory 
 { 
    public PersonPanel getPanelFor( ClassT extends personClass) ... 
   public registerPanelFor ( ClassT extends Person personClass, ClassT 
 extends PersonPanel personPanelClass ... 
 } 



 On Fri, Jul 3, 2015 at 2:32 PM, Per Newgro per.new...@gmx.ch wrote: 

  Hi, 
  
  i think about that problem for some time now. Maybe someone alrady has a 
  good solution. 
  
  Let's assume we have a Manager entity and a Tainee entity. Both are Person 
  entities. 
  In Model we ask for all persons. So we get a mix from Managers and 
  Trainees in a list. 
  
  Both concrete entity types shall be displayed in their own component (a 
  custom panel for every1). 
  
  I would ask for simple, decoupled (extendible) solution of this problem. 
  So far i've tried the obvious instance of approach. But this is not 
  extendible. 
  Maybe someone can send me some ideas. 
  
  Thanks for your support 
  Per 
  
  - 
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org 
  For additional commands, e-mail: users-h...@wicket.apache.org 
  
  


Best Practice - Create component by entity type?

2015-07-03 Thread Per Newgro
Hi,

i think about that problem for some time now. Maybe someone alrady has a good 
solution.

Let's assume we have a Manager entity and a Tainee entity. Both are Person 
entities.
In Model we ask for all persons. So we get a mix from Managers and Trainees in 
a list.

Both concrete entity types shall be displayed in their own component (a custom 
panel for every1).

I would ask for simple, decoupled (extendible) solution of this problem.
So far i've tried the obvious instance of approach. But this is not 
extendible.
Maybe someone can send me some ideas.

Thanks for your support
Per

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



Can i render content (css) of ContextRelativeResource to markup?

2015-02-06 Thread Per Newgro
Hi,

I like to render a PDF by my wicket page using flying-saucer. There i reference 
my css file by url (link). So far everything works.
But if i switch to SSL flying-saucer breaks. Hmm.

My solution to this issue would be to include content of my css file directly 
in the wicket-page used to render the pdf.

I tried to get the resource and render it in markup like this

code
MyPage.java

@Override
public void renderHead(IHeaderResponse response) {
  IResource s = new SharedResourceReference(report.css).getResource();
  Attributes a = new Attributes(getRequest(), getResponse());
  s.respond(a);
  super.renderHead(response);
}
/code

but i get
at 
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.UnsupportedOperationException
at 
org.apache.wicket.response.StringResponse.write(StringResponse.java:88)
at 
org.apache.wicket.request.Response$StreamAdapter.write(Response.java:148)
at org.apache.wicket.util.io.Streams.copy(Streams.java:109)
at org.apache.wicket.util.io.Streams.copy(Streams.java:76)
at 
org.apache.wicket.request.resource.ContextRelativeResource$1.writeData(ContextRelativeResource.java:110)
at 
org.apache.wicket.request.resource.AbstractResource.respond(AbstractResource.java:528)
at de.MyPage.renderHead(MyPage.java:88)
at org.apache.wicket.Component.renderHead(Component.java:4419)
at org.apache.wicket.Component.renderHead(Component.java:2679)
at 
org.apache.wicket.markup.renderStrategy.AbstractHeaderRenderStrategy.renderRootComponent(AbstractHeaderRenderStrategy.java:127)
at 
org.apache.wicket.markup.renderStrategy.ChildFirstHeaderRenderStrategy.renderHeader(ChildFirstHeaderRenderStrategy.java:60)
at 
org.apache.wicket.markup.html.internal.HtmlHeaderContainer.onComponentTagBody(HtmlHeaderContainer.java:170)
at 
org.apache.wicket.markup.html.panel.DefaultMarkupSourcingStrategy.onComponentTagBody(DefaultMarkupSourcingStrategy.java:71)
at 
org.apache.wicket.Component.internalRenderComponent(Component.java:2529)
... 51 more

It seems that my ContextRelativeResource only provides content as byte[] ans 
StringResponse not supporting this.
Maybe i be off the track.

Thanks for your support
Per

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



Submit Inputs on ListView by StatelessForm

2014-07-09 Thread Per Newgro
Hi,

i try to submit some (repeated) fields by a stateless form.

You can find the code here: http://pastebin.com/AQ6m0EKT

If i use a basic Form.class in my scenario everything works as expected.
But with a stateless form i can not make it.

The exact same configuration without any listview works by using the stateless 
form.
But that requires me to add all fields without an automatic repeating.

So my question is: How can i submit multiple (repeated) input fields by a 
stateless form?

Thanks for your support
Per

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



Aw: Re: Submit Inputs on ListView by StatelessForm

2014-07-09 Thread Per Newgro
Hi Martin,

thanks for your response. I've refactored the code to use a refreshing view. 
But there is still the same results.

Code can be found here: http://pastebin.com/dhqj8zHr

Do i need to use a special repeater?

Thanks
Per

 Gesendet: Mittwoch, 09. Juli 2014 um 10:13 Uhr
 Von: Martin Grigorov mgrigo...@apache.org
 An: users@wicket.apache.org users@wicket.apache.org
 Betreff: Re: Submit Inputs on ListView by StatelessForm

 Hi,
 
 ListView have special requirements when being used in a Form. See
 ListView#setReuseItems(boolean) javadoc.
 
 I guess it is better to use another repeater when you want to keep the page
 stateless.
 
 Martin Grigorov
 Wicket Training and Consulting
 https://twitter.com/mtgrigorov
 
 
 On Wed, Jul 9, 2014 at 11:08 AM, Per Newgro per.new...@gmx.ch wrote:
 
  Hi,
 
  i try to submit some (repeated) fields by a stateless form.
 
  You can find the code here: http://pastebin.com/AQ6m0EKT
 
  If i use a basic Form.class in my scenario everything works as expected.
  But with a stateless form i can not make it.
 
  The exact same configuration without any listview works by using the
  stateless form.
  But that requires me to add all fields without an automatic repeating.
 
  So my question is: How can i submit multiple (repeated) input fields by a
  stateless form?
 
  Thanks for your support
  Per
 
  -
  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



Exclude link from disabled hierarchy

2014-06-18 Thread Per Newgro
Hi,

I enable a Form by autorized role. Some users see the form enabled, some 
disabled. All works fine.

My problem is that i've added a goback-link which should be enabled always for 
all users. But because the
link is added to the form (within a button panel) it get's disabled to.

Is there a smart way to exclude the goback link form enabledInHierarchy 
processing?

Thanks for your support
Per

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



Aw: Re: Exclude link from disabled hierarchy

2014-06-18 Thread Per Newgro
Thanks for your respose Martin.

I maybe found another solution meanwhile. There is a method in AbstractLink


@Override
protected boolean isLinkEnabled() {
return isEnabledInHierarchy();
}

I've overwritten this by

@Override
protected boolean isLinkEnabled() {
return true;
}

Now it seems to work as expected.

Thanks for your support
Per

 Gesendet: Mittwoch, 18. Juni 2014 um 09:49 Uhr
 Von: Martin Grigorov mgrigo...@apache.org
 An: users@wicket.apache.org users@wicket.apache.org
 Betreff: Re: Exclude link from disabled hierarchy

 Hi,
 
 I believe there is a ticket for such requirement but JIRA is too slow today
 and I cannot find it.
 In general this is not possible.
 But it is possible for links - override
 org.apache.wicket.markup.html.link.AbstractLink#disableLink() for this
 special link.
 
 Martin Grigorov
 Wicket Training and Consulting
 
 
 On Wed, Jun 18, 2014 at 10:32 AM, Per Newgro per.new...@gmx.ch wrote:
 
  Hi,
 
  I enable a Form by autorized role. Some users see the form enabled, some
  disabled. All works fine.
 
  My problem is that i've added a goback-link which should be enabled always
  for all users. But because the
  link is added to the form (within a button panel) it get's disabled to.
 
  Is there a smart way to exclude the goback link form enabledInHierarchy
  processing?
 
  Thanks for your support
  Per
 
  -
  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



How can i avoid that urls in src attributes are handled by wicket?

2014-04-29 Thread Per Newgro
Hi *,

we have a page which contains markup like this

...
script type=text/x-handlebars id=template
img src={{ url }} alt={{ name }} /
/script
...

After rendering the page the markup looks like this
script type=text/x-handlebars id=template
img src=../{{ url }} alt={{ name }} /
/script

Please note the ../ before the {{ url }}

Until now i thought that wicket handles only markup within html tags containing 
a wicket:id.
But it seems that Wicket gone wild here :-).

So my question would be: How can i avoid that wicket handles the src attribute 
in non-wicket markup?

Thanks for your support
Per

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



Locale in NumberTextField

2014-04-07 Thread Per Newgro
Hello,

i have a question regarding the input conversion in NumberTextField (wicket 
6.14)

This is the code in question:

/**
 * Always use {@link Locale#ENGLISH} to parse the input.
 */
@Override
protected void convertInput()
{
IConverterN converter = getConverter(getNumberType());

try
{
setConvertedInput(converter.convertToObject(getInput(), 
Locale.ENGLISH));
}
catch (ConversionException e)
{
error(newValidationError(e));
}
}

Why is the used locale hardcoded here (Locale.ENGLISH). Shouldn't that be the 
session locale?
Is there any browser standard regarding this behavior (Couldn't find one so 
far)?

Thanks for your support
Per

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



NumberTextField eats my markup step attribute

2014-01-10 Thread Per Newgro
Hi,

i would like to enable float values in my form (without validation error).
But it's not possible for me.

If i add this input markup

input type=number step=any wicket:id=myNumber /

and assign a

new NumberTextFieldDouble(myNumber, numberModel);

the resulting markup is

input type=number id=myNumber1 /

So i'm not able to get a valid form submit with a value of 12.5 because 
step=any has been removed
(NumberTextField@190).

The NumberTextField.setStep is also unusable because it uses a Number parameter
which is any obviously not :-).

is there another workaround or is a ticket required?

Thanks for your support
Per

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



Aw: NumberTextField eats my markup step attribute

2014-01-10 Thread Per Newgro
Because the w3c-spec says

step = any or positive floating-point number NEW
Specifies the value granularity of the element’s value.

and

Positive floating-point number #
A non-negative floating-point number, with the following restriction:
must be greater than zero

http://dev.w3.org/html5/markup/input.number.html

it should be valid to use 0 or 0 as special constant in NumberTextField.

NumberTextField

public static final Number ANY = 0;

and


@Override
protected void onComponentTag(final ComponentTag tag)
{
...

if (step != null)
{
if (step.equals(ANY)
{
attributes.put(step, any);
}
else
{
attributes.put(step, 
Objects.stringValue(step));
}
}
else
{
attributes.remove(step);
}
...
}

This should do the trick without any change in current behavior.

Thanks
Per

Then i could do
 Gesendet: Freitag, 10. Januar 2014 um 09:01 Uhr
 Von: Per Newgro per.new...@gmx.ch
 An: wicket usergroup users@wicket.apache.org
 Betreff: NumberTextField eats my markup step attribute

 Hi,
 
 i would like to enable float values in my form (without validation error).
 But it's not possible for me.
 
 If i add this input markup
 
 input type=number step=any wicket:id=myNumber /
 
 and assign a
 
 new NumberTextFieldDouble(myNumber, numberModel);
 
 the resulting markup is
 
 input type=number id=myNumber1 /
 
 So i'm not able to get a valid form submit with a value of 12.5 because 
 step=any has been removed
 (NumberTextField@190).
 
 The NumberTextField.setStep is also unusable because it uses a Number 
 parameter
 which is any obviously not :-).
 
 is there another workaround or is a ticket required?
 
 Thanks for your support
 Per
 
 -
 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



Aw: Re: NumberTextField eats my markup step attribute

2014-01-10 Thread Per Newgro
Thank you Martin.
Done
https://issues.apache.org/jira/browse/WICKET-5467

 Gesendet: Freitag, 10. Januar 2014 um 09:09 Uhr
 Von: Martin Grigorov mgrigo...@apache.org
 An: users@wicket.apache.org users@wicket.apache.org
 Betreff: Re: NumberTextField eats my markup step attribute

 Hi,
 
 This is a bug.
 Please file a ticket.
 
 Martin Grigorov
 Wicket Training and Consulting
 
 
 On Fri, Jan 10, 2014 at 10:01 AM, Per Newgro per.new...@gmx.ch wrote:
 
  Hi,
 
  i would like to enable float values in my form (without validation error).
  But it's not possible for me.
 
  If i add this input markup
 
  input type=number step=any wicket:id=myNumber /
 
  and assign a
 
  new NumberTextFieldDouble(myNumber, numberModel);
 
  the resulting markup is
 
  input type=number id=myNumber1 /
 
  So i'm not able to get a valid form submit with a value of 12.5 because
  step=any has been removed
  (NumberTextField@190).
 
  The NumberTextField.setStep is also unusable because it uses a Number
  parameter
  which is any obviously not :-).
 
  is there another workaround or is a ticket required?
 
  Thanks for your support
  Per
 
  -
  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



Is Behavior.beforeRender useful for component configuration?

2014-01-02 Thread Per Newgro

Hi,

we have an admin menu in our menu bar. All items in admin menu are 
configured by @AuthorizeAction.
I would like to hide the admin item in main menu if no menu item is 
visible in the admin menu (e.g. user is not an admin).


To avoid repeating myself in every onBeforeRender method of the included 
components i've tried to use a behavior.
It tries to hide parent by checking if all items are invisible and 
configure the parent's visibility.


But this is not working (configure(component) and beforeRender(component)).
Configure is not usable because the render permission (setRenderAllowed) 
is determined after the Behavior.onConfigure was called.

So the action takes place before the child is authorized.

Then i thaught let's do it in beforeRender. But there we got a message

org.apache.wicket.WicketRuntimeException: Cannot modify component 
hierarchy after render phase has started (page version cant change then 
anymore)

at org.apache.wicket.Component.checkHierarchyChange(Component.java:3595)
at org.apache.wicket.Component.addStateChange(Component.java:3524)
at org.apache.wicket.Component.setVisible(Component.java:3213)

This is comprehensible for me so far. No change after rendering started. 
But how shall i hide the parent without repeating myself in
every Component.onBeforeRender method? This is working. But i have to 
duplicate my code for ListItem, ListView and AdminPanel.


We use wicket-6.11

Thanks for helping me out of the wood.
Per

Here some markup of my admin menu markup.
code
html xmlns:wicket
wicket:panel
a href=# data-dropdown-toggle=#admin-navigation 
wicket:message=title:navigation.fullHeading.administration

i class=icon-admin?/i
/a
div id=admin-navigation
ul
wicket:container wicket:id=items
wicket:enclosure child=menu-item
li
a wicket:id=menu-item
span
wicket:container 
wicket:id=short-titleShort title/wicket:container

/span
/a
/li
/wicket:enclosure
/wicket:container
wicket:enclosure child=reindexSearch
li
a wicket:id=reindexSearch 
onclick=alert('Rebuild initiated'); return true;
wicket:message 
key=navigation.fullHeading.reindexReindex Search Server/wicket:message

/a
/li
/wicket:enclosure
/ul
/div
/wicket:panel
/html
code

In page menu is included this way:
code
...
ul class=button-toolbar id=main-navigation
  wicket:container wicket:id=buttonMenu/wicket:container
  wicket:enclosure child=adminNavigation
li wicket:id=adminNavigation/li
  /wicket:enclosure
/ul
...
/code


---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz 
ist aktiv.
http://www.avast.com


Re: Is Behavior.beforeRender useful for component configuration?

2014-01-02 Thread Per Newgro

Hey Paul,

thanks for your reply.

Sadly i can not use Behavior.configure(Component). The code will be 
executed (see Component.configure)
before the render action is granted to the component by applying the 
isActionAuthorized(Render).

See Component.java line 1030 to 1039 for details.

Do i have another option?

Thanks
Per

Am 02.01.2014 16:55, schrieb Paul Bors:

Do you want the configuration code to run each time before the component
your behavior is attached to renders?
Then go ahead and place your code there, otherwise if you only want the
configuration code to run only once see the onConfigure() method:

/**
   * Called immediately after the onConfigure method in a component. Since
this is before the
   * rendering cycle has begun, the behavior can modify the configuration of
the component (i.e.
   * setVisible(false))
   *
   * @param component
   *the component being configured
   */
  public void onConfigure(Component component)
  {
  }


On Thu, Jan 2, 2014 at 4:00 AM, Per Newgro per.new...@gmx.ch wrote:


Hi,

we have an admin menu in our menu bar. All items in admin menu are
configured by @AuthorizeAction.
I would like to hide the admin item in main menu if no menu item is
visible in the admin menu (e.g. user is not an admin).

To avoid repeating myself in every onBeforeRender method of the included
components i've tried to use a behavior.
It tries to hide parent by checking if all items are invisible and
configure the parent's visibility.

But this is not working (configure(component) and beforeRender(component)).
Configure is not usable because the render permission (setRenderAllowed)
is determined after the Behavior.onConfigure was called.
So the action takes place before the child is authorized.

Then i thaught let's do it in beforeRender. But there we got a message

org.apache.wicket.WicketRuntimeException: Cannot modify component
hierarchy after render phase has started (page version cant change then
anymore)
at org.apache.wicket.Component.checkHierarchyChange(Component.java:3595)
at org.apache.wicket.Component.addStateChange(Component.java:3524)
at org.apache.wicket.Component.setVisible(Component.java:3213)

This is comprehensible for me so far. No change after rendering started.
But how shall i hide the parent without repeating myself in
every Component.onBeforeRender method? This is working. But i have to
duplicate my code for ListItem, ListView and AdminPanel.

We use wicket-6.11

Thanks for helping me out of the wood.
Per

Here some markup of my admin menu markup.
code
html xmlns:wicket
 wicket:panel
 a href=# data-dropdown-toggle=#admin-navigation
wicket:message=title:navigation.fullHeading.administration
 i class=icon-admin?/i
 /a
 div id=admin-navigation
 ul
 wicket:container wicket:id=items
 wicket:enclosure child=menu-item
 li
 a wicket:id=menu-item
 span
 wicket:container
wicket:id=short-titleShort title/wicket:container
 /span
 /a
 /li
 /wicket:enclosure
 /wicket:container
 wicket:enclosure child=reindexSearch
 li
 a wicket:id=reindexSearch
onclick=alert('Rebuild initiated'); return true;
 wicket:message 
key=navigation.fullHeading.reindexReindex
Search Server/wicket:message
 /a
 /li
 /wicket:enclosure
 /ul
 /div
 /wicket:panel
/html
code

In page menu is included this way:
code
...
ul class=button-toolbar id=main-navigation
   wicket:container wicket:id=buttonMenu/wicket:container
   wicket:enclosure child=adminNavigation
 li wicket:id=adminNavigation/li
   /wicket:enclosure
/ul
...
/code


---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus
Schutz ist aktiv.
http://www.avast.com




---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz 
ist aktiv.
http://www.avast.com


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



Re: Form submit without URL modification

2013-12-21 Thread Per Newgro

Hi Nick,

we do a setResponsePage(this.getPageClass(), this getPageParameters()) 
at the end of the submit.

Then the url is the same as before.

Hth
Per

Am 20.12.2013 20:08, schrieb Nick Pratt:

Is it possible to create a form submission that hits a specific URL and
doesn't modify the original URL displayed in the browser.

e.g. I have a single simple Page, that has a StatelessForm on it. I hit
this via http://localhost:8080/
When I hit the form submit button, the URL in the browser changes to:
http://localhost:8080//?-1.IFormSubmitListener-form

Im trying to create a button that can always be clicked regardless of
Wicket session expiration and that doesnt modify the URL - is this possible?

N




---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz 
ist aktiv.
http://www.avast.com


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



Re: How Does Checkbox Know To Store To My Data Object

2013-10-19 Thread Per Newgro

Hi david,

there is no code in your email.

Cheers
Per

Am 18.10.2013 22:39, schrieb dhongyt:

I have a Data Object called DownloadBagService which works as a place to hold
the checked files the a user selects.

I have a page that the user are able to select files from and add it to the
DownloadBagService.


When the user checks on files and hits submit. The files appear in the
DownloadBagService magically.
As you can see my onSubmit contains code that is commented out. How does
Wicket know to put those files in the DownloadBagService?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-Does-Checkbox-Know-To-Store-To-My-Data-Object-tp4661879.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





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



Re: [auth-roles] Design of x-RoleAuthorizationStartegy

2013-10-15 Thread Per Newgro
Thanks for your reply Sven. That makes sense. Ok then we can definitly 
build our own solution.


Cheers
Per

Am 15.10.2013 13:48, schrieb Sven Meier:

Hi,

wicket-auth-roles is 'mostly a technology demonstration':

   https://wicket.apache.org/learn/projects/authroles.html

It's a very simple starting point, thus it cannot serve all needs. 
Please use it as an inspiration for your own solution.


Regards
Sven



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



[auth-roles] Design of x-RoleAuthorizationStartegy

2013-10-11 Thread Per Newgro
Hi,

we had a simple usecase today leading us to confusion on 
AnnotationsRoleAuthorizationStrategy (ARAS).

We tried to protect a button by using two different permissions. So we had to 
use AuthorizeActions.
We did it this way
code
  @AuthorizeActions(actions = {
@AuthorizeAction(action = Action.RENDER, roles = { entity.create }),
@AuthorizeAction(action = Action.RENDER, roles = { document.fillout })
  })
  private static class NewDocumentForNewEntityLink extends 
BookmarkablePageLinkVoid {
public NewDocumentForNewEntityLink(String id, Class? extends WebPage 
pageClass) {
  super(id, pageClass);
}
  }
/code

Ok we don't use the roles as their name would suggest it. We use it more as 
permissions.
But that is not relevant here (IMHO).

In one of our test cases we've found out that only one permission is required 
to get
that link displayed. But we would like to include all permissions. And so the 
story begins.

The first maybe intuitive way to customize the annotation handling was to 
implement our own
IRoleCheckingStrategy. But the first issue we had was the name of the interface 
method we
had to implement (hasAny(Roles)) which suggests an or condition.

= Isn't this to thight for an interface? Shouldn't the name be accepts(Roles)?

With further checks we saw no chance to get an and condition check done by 
the current
ARAS implementation. The only possibility was to overwrite 
code
protected boolean isActionAuthorized(final Class? componentClass, final 
Action action)
/code
and do it by our own. Another problem could be the handling of the deny 
permissions.
If we would like to use an or condition check here this wouldn't be possible 
because
accept and deny checks use the same method (hasAny(Roles)).

= Shouldn't the role check a task of the RoleCheckingStartegy? Shouldn't it be 
a more
configurable implementation? 

I hope my problem got clear. I don't want to snub anybody. The intention of 
this is
only to have a discussion here before we create a ticket with a patch.

What do you think?

Thanks for your opinion
Per

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



Strange behavior on first page request with jetty from Start.class

2013-08-09 Thread Per Newgro

Hi,

has someone seen the following behavior and can give me a hint?

I do some changes on my project.
Then i use the Start class (provided by quickstart) to start the 
embedded jetty.

The i reload a page in the browser
And then page loading is really slow  2min
or
Page is rendered but there is no javascript (at least the scripts are 
not executed).


If i reload the page (by pressing F5 in FF) then everything is rendered 
fine and works as expected.

But not on the first request.

Is this only on my side?

Environment
eclipse 4.3.1 juno
wicket-6.9.1
jetty-8.1.11.v20130520
spring,
jpa
java7

Thanks for your support
Per

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



Re: header resources order in 1.5.x

2013-08-08 Thread Per Newgro

Hi Michal,

do you know this?
https://github.com/ivaynberg/wicket-select2

There are examples.
Maybe it can help

Cheers
Per

Am 08.08.2013 17:27, schrieb Michal Wegrzyn:

Dear,

I am trying to integrate select2, but ordering in head doesn't seem to be good.

What is the easiest way to order resource references in Wicket 1.5.x?
Header decorator? If so, how do I obtain collection with references?

Best regards,
Michal Wegrzyn





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



Re: How can i render json into markup?

2013-07-06 Thread Per Newgro

Hi Paul,

thanks for your reply. As i wrote we don't want to use the wicked-charts 
integration.

Reinventing the wheel is not our goal.

What i want to know was how i can render the script with the json 
content inside the div.
So far i've found a chart example in Igor's excelent Cookbook. But the 
problem of add a script

in a div is still open.

Thanks
Per

Am 06.07.2013 09:44, schrieb Paul Borș:

Your question is better addressed at http://wicked-charts.2319560.n4.nabble.com/

The mailing list for https://code.google.com/p/wicked-charts/

Tom H. did a super good job on integrating High Charts with Wicket so I'm not 
sure why you're reinventing the wheel.

Have a great day,
 Paul Bors

On Jul 5, 2013, at 3:04 PM, Per Newgro per.new...@gmx.ch wrote:


Hi,

i would like to include highcharts. I know there is a wicket module but we want 
to use the script.
So my requirement is it to render the div below with the json content in it.
Do i have to use a label and render body only? Or is there another way. I 
couldn't find any example
for this.

Thanks for your Support
Per

code
div class=row main-content
script type=application/json id=chart-data 
data-chart-generator=SingleBodyShopChartGenerator
{
title: ,
subtitle: ,
yTitle: Benchmark,
columns: [
{
label: Total,
colorClass: chart-platin,
value: 92
},
{
label: Cat 1,
colorClass: chart-platin,
value: 96
},
{
label: Cat 2,
colorClass: chart-platin,
value: 90
},
{
label: Cat 3,
colorClass: chart-platin,
value: 93
},
{
label: Cat 4,
colorClass: chart-platin,
value: 95
},
{
label: Cat 5,
colorClass: chart-gold,
value: 88
},
{
label: Cat 6,
colorClass: chart-platin,
value: 93
}
]
}
/script
div wicket:id=chart style=display: none/div
/div
/code

-
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



How can i render json into markup?

2013-07-05 Thread Per Newgro

Hi,

i would like to include highcharts. I know there is a wicket module but 
we want to use the script.

So my requirement is it to render the div below with the json content in it.
Do i have to use a label and render body only? Or is there another way. 
I couldn't find any example

for this.

Thanks for your Support
Per

code
div class=row main-content
script type=application/json id=chart-data 
data-chart-generator=SingleBodyShopChartGenerator

{
title: ,
subtitle: ,
yTitle: Benchmark,
columns: [
{
label: Total,
colorClass: chart-platin,
value: 92
},
{
label: Cat 1,
colorClass: chart-platin,
value: 96
},
{
label: Cat 2,
colorClass: chart-platin,
value: 90
},
{
label: Cat 3,
colorClass: chart-platin,
value: 93
},
{
label: Cat 4,
colorClass: chart-platin,
value: 95
},
{
label: Cat 5,
colorClass: chart-gold,
value: 88
},
{
label: Cat 6,
colorClass: chart-platin,
value: 93
}
]
}
/script
div wicket:id=chart style=display: none/div
/div
/code

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



Resource mounting: Why has a resource always a lower compatibility score than a page?

2013-06-18 Thread Per Newgro
Hi,

i would like to mount a resource with a name /mypath/${param1}/whatever.
I've already mounted a page with /mypath.

I was wondering why i was always redirected to the /mypath page.

In ResourceMapper i've found this:
code
  @Override
  public int getCompatibilityScore(Request request)
  {
return 0; // pages always have priority over resources
  }
/code

So i would like to know: Why is the resource not mapped by it's appropriate 
compatibility score
vs pages?

Thanks for your support
Per

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



Can i display a WepPage in a PDF (How to get the rendered markup)?

2013-06-07 Thread Per Newgro

Hi,

i would like to render a WebPage with flying saucer (PDF generator).
I've created a resource reference and a ByteArrayResource.

But now i need the rendered markup of the page (e.g. HomePage).

So my question is how can i render the markup in my Resource?

Thanks for your support
Per

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



Re: Can i display a WepPage in a PDF (How to get the rendered markup)?

2013-06-07 Thread Per Newgro

Found the solution already. I did it that way:

public class FlyingSaucerPdfResource extends ByteArrayResource {

public FlyingSaucerPdfResource() {
super(application/pdf);
}

@Override
protected byte[] getData(Attributes attributes) {
ByteArrayOutputStream os;
try {
CharSequence buf = renderPage(HomePage.class, 
attributes.getParameters());

ITextRenderer renderer = new ITextRenderer();
renderer.setDocumentFromString(buf.toString());
renderer.layout();
renderer.createPDF(os = new ByteArrayOutputStream());
os.close();
} catch (IOException | DocumentException e) {
throw new RuntimeException(e);
}
return os.toByteArray();
}

private CharSequence renderPage(final Class? extends Page pageClass,
PageParameters parameters) {

final RenderPageRequestHandler handler = new 
RenderPageRequestHandler(

new PageProvider(pageClass, parameters),
RedirectPolicy.NEVER_REDIRECT);

final PageRenderer pageRenderer = getApplication()
.getPageRendererProvider().get(handler);

RequestCycle originalRequestCycle = RequestCycle.get();

BufferedWebResponse tempResponse = new BufferedWebResponse(null);

RequestCycleContext requestCycleContext = new RequestCycleContext(
originalRequestCycle.getRequest(), tempResponse,
getApplication().getRootRequestMapper(), getApplication()
.getExceptionMapperProvider().get());
RequestCycle tempRequestCycle = new 
RequestCycle(requestCycleContext);


final Response oldResponse = originalRequestCycle.getResponse();

try {
originalRequestCycle.setResponse(tempResponse);
pageRenderer.respond(tempRequestCycle);
} finally {
originalRequestCycle.setResponse(oldResponse);
}

return tempResponse.getText();
}

private Application getApplication() {
return Application.get();
}

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



Problem loading dependency for wicket-6.8.0

2013-05-25 Thread Per Newgro

Hi,

is someone else having problems including wicket 6.8.0?

I get a Missing artifact org.apache.wicket:wicket:pom:6.8.0-SNAPSHOT
when i increase my version from 6.7.0 to 6.8.0

properties
 project.build.sourceEncodingUTF-8/project.build.sourceEncoding
 project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding

wicket.version6.8.0/wicket.version
wicketstuff.version6.8.0/wicketstuff.version
jetty.version8.1.10.v20130312/jetty.version
spring.version3.2.2.RELEASE/spring.version
cglib.version2.2.2/cglib.version
 hibernate.version4.2.0.Final/hibernate.version
h2database.version1.3.171/h2database.version
dbunit.version2.4.9/dbunit.version
log4j.version1.2.17/log4j.version
slf4j.version1.7.4/slf4j.version
hamcrest.version1.3/hamcrest.version
junit.version4.11/junit.version
mockito.version1.9.5/mockito.version
concordion.version1.4.3/concordion.version
/properties
dependencies
!-- WICKET DEPENDENCIES --
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-core/artifactId
/dependency
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-spring/artifactId
version${wicket.version}/version
/dependency
dependency
groupIdorg.wicketstuff/groupId
 artifactIdwicketstuff-annotation/artifactId
version${wicketstuff.version}/version
exclusions
exclusion
 groupIdorg.springframework/groupId
artifactIdspring-core/artifactId
/exclusion
/exclusions
/dependency
...
/dependencies

Thanks for your support
Per

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



Re: Problem loading dependency for wicket-6.8.0

2013-05-25 Thread Per Newgro
Ok, i've delete all wicket 8.8.x jars from m2. But the problem still 
appears. It seems that wicketstuff-annotations is referencing 
wickt-6.8.0-SNAPSHOT.

I will downgrade until this is fixed

Thanks
Per

Am 25.05.2013 10:39, schrieb Raul:

Make sure you have downloaded the dependency correctly, ie that is in your
local repository that can decompress, ever happened to me that have been
downloaded jar with corrupted data. If so removes the corrupt jar to
download them again.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problem-loading-dependency-for-wicket-6-8-0-tp4659026p4659027.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





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



Can i control event execution order?

2013-04-24 Thread Per Newgro
Hi,
 
i would like to add a bookmarkable page link to a clickable div.
But the event behavior of the div is always executed. Is there a
way to prioritize the event coming from the link?
 
Thanks
Per
 
code
Page.java
public class Page extends WebPage {
public Page(final PageParameters parameters) {
super(parameters);
   
final Label marker;
add(marker = new Label(marker, new ModelString()));
marker.setOutputMarkupId(true);

WebMarkupContainer outer;
add(outer = (WebMarkupContainer) new 
WebMarkupContainer(outer).add(new AjaxEventBehavior(onclick) {

@Override
protected void onEvent(AjaxRequestTarget target) {
marker.setDefaultModelObject(outer at  + 
System.currentTimeMillis());
target.add(marker);
}
}));

BookmarkablePageLinkVoid inner;
outer.add(inner = new BookmarkablePageLinkVoid(inner, 
OtherPage.class));
}
}
 
Page.html
div
span wicket:id=markerPresent the event/span
div wicket:id=outer
a wicket:id=innerClick/a
/div
/div
/code

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



Aw: Re: Can i control event execution order?

2013-04-24 Thread Per Newgro
Thank you so much Martin. Adding the script seems to be the soultion. At least 
it works now as i expect it :-).

I would say yes to your question. I don't know if it bubbles up. But in the 
requestcycle the requestedUri is always the event listener one.

I've added a test, but that is green :-(
code  
@Test
public void shouldPrioritizeBookmarkableLinkClickOverClickableDiv() {
tester.startPage(Page.class);
tester.clickLink(outer:inner);
tester.assertRenderedPage(OtherPage.class);
}
/code

Thanks
Per

 Gesendet: Mittwoch, 24. April 2013 um 09:19 Uhr
 Von: Martin Grigorov mgrigo...@apache.org
 An: users@wicket.apache.org users@wicket.apache.org
 Betreff: Re: Can i control event execution order?

 Hi,
 
 Are you saying that the event of clicking the bookmarkable link (the a)
 bubbles to the div ?
 I think it should not happen. Clicking the link changes the document
 location... But I may be wrong.
 
 A simple solution is to add onclick=Wicket.Event.stop(event); return
 true; to the a element.
 This calls event.stopPropagation().
 
 
 On Wed, Apr 24, 2013 at 10:03 AM, Per Newgro per.new...@gmx.ch wrote:
 
  Hi,
 
  i would like to add a bookmarkable page link to a clickable div.
  But the event behavior of the div is always executed. Is there a
  way to prioritize the event coming from the link?
 
  Thanks
  Per
 
  code
  Page.java
  public class Page extends WebPage {
  public Page(final PageParameters parameters) {
  super(parameters);
 
  final Label marker;
  add(marker = new Label(marker, new ModelString()));
  marker.setOutputMarkupId(true);
 
  WebMarkupContainer outer;
  add(outer = (WebMarkupContainer) new
  WebMarkupContainer(outer).add(new AjaxEventBehavior(onclick) {
 
  @Override
  protected void onEvent(AjaxRequestTarget target) {
  marker.setDefaultModelObject(outer at  +
  System.currentTimeMillis());
  target.add(marker);
  }
  }));
 
  BookmarkablePageLinkVoid inner;
  outer.add(inner = new BookmarkablePageLinkVoid(inner,
  OtherPage.class));
  }
  }
 
  Page.html
  div
  span wicket:id=markerPresent the event/span
  div wicket:id=outer
  a wicket:id=innerClick/a
  /div
  /div
  /code
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -- 
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/
 

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



Re: Model for dropdowns in a listview

2013-04-21 Thread Per Newgro

Hello Rodrigo,

sure i know that the null has to be replaced by a model. But my 
question was

targeted to the object behind the dropdown selected option model.

Let me create a more simple example:

code
MyComponent.java
- in constructor -
IModelReplyOptionsCollectingModel formModel = 
Model.ReplyOptionsCollectingModel of(new ReplyOptionsCollectingModel())

Form? form ...;
form.add(new DropDownChoice(replysForQuestion1, new 
PropertyModelReplyOption(formModel, answerForQuestion1), 
replyOptionsForQuestion1()));
form.add(new DropDownChoice(replysForQuestion2, new 
PropertyModelReplyOption(formModel, answerForQuestion2), 
replyOptionsForQuestion2()));


ReplyOptionsCollectingModel.java
public class ReplyOptionsCollectingModel implements Serializable {
  private ReplyOption answerForQuestion1;
  private ReplyOption answerForQuestion2;

  // ... getter and setter
}
/code

But because i don't know the count of questions i have to use a 
repeating view.


code
MyComponent.java
- in constructor -
IModelReplyOptionsCollectingModel formModel = 
Model.ReplyOptionsCollectingModel of(new ReplyOptionsCollectingModel())

Form? form ...;
ListViewQuestion questions = new ListView(...) {
   protected void populateItem(ListItemQuestion item) {
  item.add(new DropDownChoice(replysForQuestion, new 
PropertyModelReplyOption(formModel, I_dont_know_what_to_add_here), 
replyOptionsFor(item.getModelObject(;

   }
}
form.add(answers);

ReplyOptionsCollectingModel.java
public class ReplyOptionsCollectingModel implements Serializable {
  private MapQuestion, ReplyOption answerForQuestions;
}
/code

Or do you mean that CompoundPropertyModel has more features
handling the indexed-property stuff?

Thanks for your support
Per

Am 21.04.2013 00:31, schrieb Rodrigo Heffner:

Have you tried using CompoundPropertyModels? In that way you could bind a
property to the dropdown, instead of using null




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



Model for dropdowns in a listview

2013-04-20 Thread Per Newgro

Hi,

i have to implement a questionnaire but i'm not sure how to capture the 
selected values in a model.


My questionnaire has some questions. The questions have some reply options.
The selected reply options will be assigned to an answer. The answers 
are the data i try to capture.


So i put the questions in a listview and a dropdown for the reply 
options on it's item.
But i have no clue how to implement the business model containing the 
answers.

Every answer is related to one selected reply option.

Can some1 please give me some pointers. Thanks for your support.
Per

Here some code

code
public class QuestionListView extends ListViewQuestionBO {

public QuestionListView(String id, IModel? extends List? 
extends QuestionBO model) {

super(id, model);
}

@Override
protected void populateItem(ListItemQuestionBO item) {
item.add(new Label(questionText, new 
PropertyModelString(item.getModel(), QuestionBO.TEXT)));
// TODO the null has to be replaced by a smart model 
assigning the selected reply option to an answer in the business model
item.add(new DropDownChoiceReplyOptionBO(replyOptions, 
null, new LoadableDetachableReplyOptionsModel(item.getModel()), new 
ReplyOptionBORenderer()));

}
}

public class LoadableDetachableReplyOptionsModel extends 
LoadableDetachableModelList? extends ReplyOptionBO {


private final IModelQuestionBO question;

public LoadableDetachableReplyOptionsModel(IModelQuestionBO 
question) {

this.question = question;
}

@Override
protected List? extends QuestionBO load() {
return service.loadReplyOptionsFor(question.getObject());
}

@Override
public void detach() {
question.detach();
super.detach();
}
}
/code

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



Re: Wicket integration with Spring

2012-12-28 Thread Per Newgro
With the 2nd approach you couple the application (in the role as service 
mother) to all your calling components.
Coupling is a bad idea. It's hard to test in separation and almost 
always you end in a hell of small single methods.
But if you inject your beans into the target component you can define 
your required dependeny there were you use them.
Another cool approach in wicket is the event system in 1.5+. So you 
throw events in child components and provide the

services in high ranking components (page, app ...)

Just my 2 ct.

Per

Am 27.12.2012 11:11, schrieb Arun Chauhan:

I am making an application in which I want to integrate Wicket + Spring.
Application is a grocery store on which user comes and buy something. I know
there are two ways to do this.

1. Using the *annotation *aprroach. Wicket-Spring integration shows various
ways on how to inject Spring   Beans into Wicket pages.

public class FormPage extends WebPage
{
   @SpringBean
   private IContact icontact;
   ...
   Form form = new Form(contactForm,
  new CompoundPropertyModel(contact))
   {
 private static final long serialVersionUID = 1L;

 protected void onSubmit(Contact contact)
 {
   icontact.saveContact(contact);
 }
   };


2. The @SpringBean is of course valid and considered a best practice by
many. But there is also *another approach*, where your Wicket Application
has the services you need.

public class YourWicketApp extends WebApplication{
   public static YourWicketApp get(){
 return (YourWicketApp) Application.get();
   }
   private ServiceA serviceA;
   // getter and setter for serviceA here
}

Now in your component, call

YourWicketApp.get().getServiceA();



I want to know which is the best way to integrate spring with wicket.


/However as far as I remember Wicket pages and components aren't managed by
Spring container so you cannot use @Transactional annotation on them (which
is a bad idea anyway - transactions belong to deeper levels)./ *Is this
statement valid?*



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-integration-with-Spring-tp4655077.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





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



Re: CSS for subpanel tabs

2012-12-26 Thread Per Newgro

Hello John Doe,

did you try a css selector by class instead of id?

PS: Posting without any name is not very respectful.
Posting such commonly phrased questions (my xyz is not working - tell me 
why)
oftenly stay unanswered. Please provide some code (java, html, css) and 
i bet you

get good answers here.

Cheers
Per

Am 26.12.2012 18:13, schrieb appwicket:

Hi,
I'm using panels contains tabbed panels and each tab contains few
sub-tabbedpanels.
I load my css in my page and it works fine for the tabs and the sub tabs in
first tab.
However the CSS doesn't work for other subtabs in other tabs.
(I got CSS from   Wicket - jQuery UI
http://www.7thweb.net/wicket-jquery-ui/tabs/WidgetTabsPage?0  )
http://apache-wicket.1842946.n4.nabble.com/file/n4655061/1.jpg
anyone can tell me how can i make it work for subtabs?
Thanks!



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CSS-for-subpanel-tabs-tp4655061.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





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



Re: Howto display 404 cause of response on custom error page?

2012-11-27 Thread Per Newgro
Thanks you both for your suggestions. I will try it tomorrow and come 
back if i got more questions :-)


Thanks
Per

Am 26.11.2012 16:49, schrieb Stefan Renz:

Hi,

we had a similar requirement, so we did the following:

instead of throwing a AbortWithHttpErrorCodeException, we throw a
semantic exception. In your case, throw MissingSubsiteException( your
message ).

How to make Wicket aware of such an exception and implement a proper
reaction/response?

In your application's #init()-Method, add a RequestCycleListener (e.g.
extends org.apache.wicket.request.cycle.AbstractRequestCycleListener)
which implements #onException() to dispatch to a particular error page
depending on the exception passed in. AFAIK, this is regular Wicket
stuff and nothing terribly internal (right?).


We have a bunch of error pages which are regular WebPages with
#isErrorPage() returning true. Those are triggered via the mentioned
RequestCycleListener by means of a
org.apache.wicket.request.handler.PageProvider, which can be used to
initialize the page just as you may need it. For example, by passing the
exception's message, or the exception itself to also display the stack
trace.

Such an error page can also set a status code by using #getResponse() in
#onBeforeRender(), i.e. set a HttpResponseCode.SC_BAD_REQUEST for
missing parameters.

I hope this helps,
bye
 Stefan

Martin Grigorov wrote:

Hi,

See ErrorAttributes.java.
By Servlet spec several request attributes are available when the web
container does error dispatching.


On Mon, Nov 26, 2012 at 3:14 PM, Per Newgro per.new...@gmx.ch wrote:


Hi,

i'm looking for a way to display the cause of a 404 send by myself on my
custom error page.

In a behavior i do
code
throw new
AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND, Missing
subsite in behavior);
/code

It is displayed in my custom error page

code
@MountPath(404.html)
public class PageNotFound extends AbstractErrorPage {

 public PageNotFound() {
 super();
 }

 @Override
 protected void setHeaders(WebResponse response) {
 response.setStatus(HttpServletResponse.SC_NOT_FOUND);
 super.setHeaders(response);
 }
}
/code

But i wouuld like to display the cause of the 404 to. If i debug i can see
the cause deep inside the response. But i can't imagine that i have to
rebuild the path to the cause by myself.

Thanks for helping me
Per

-
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



Howto display 404 cause of response on custom error page?

2012-11-26 Thread Per Newgro
Hi,

i'm looking for a way to display the cause of a 404 send by myself on my custom 
error page.

In a behavior i do
code
throw new AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND, 
Missing subsite in behavior);
/code

It is displayed in my custom error page

code
@MountPath(404.html)
public class PageNotFound extends AbstractErrorPage {

public PageNotFound() {
super();
}

@Override
protected void setHeaders(WebResponse response) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
super.setHeaders(response);
}
}
/code

But i wouuld like to display the cause of the 404 to. If i debug i can see the 
cause deep inside the response. But i can't imagine that i have to rebuild the 
path to the cause by myself.

Thanks for helping me
Per

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



Re: Why can't CssUrlReferenceHeaderItem have dependencies?

2012-11-06 Thread Per Newgro
Hi Martin,

i use the UrlResRef like the normal ResRef. A specialiced css is depending
on a base css.
This base css should be guaranteed on special css usage.

public class PortalCssDependingResourceReference extends
UrlResourceReference {

private final String portalId;

public PortalCssDependingResourceReference(String resourceUrl, String
portalId) {
super(Url.parse(resourceUrl));
this.portalId = portalId;
}

protected final String getPortalId() {
return portalId;
}

@Override
public Iterable? extends HeaderItem getDependencies() {
ArrayListHeaderItem dependencies = new ArrayListHeaderItem();
for (HeaderItem headerItem : super.getDependencies()) {
dependencies.add(headerItem);
}
dependencies.add(CssHeaderItem.forReference(new
PortalCssResourceReference(this.portalId)));
return dependencies;
}

@Override
public boolean isContextRelative() {
return true;
}
}

It is included as expected with this (sample) code in my page. And this is
the cause why i'm wondering this is not implemented.

@Override
public void renderHead(IHeaderResponse response) {
final PortalCssDependingResourceReference reference = new
PortalCssDependingResourceReference(resources/special.css, getPortalId());
response.render(new
CssUrlReferenceHeaderItem(reference.getUrl().toString(), null, null) {

@Override
public Iterable? extends HeaderItem getDependencies()
{
return reference.getDependencies();
}
});
super.renderHead(response);
}

I hope this is answering your question.
Thanks
Per

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



Re: Why can't CssUrlReferenceHeaderItem have dependencies?

2012-11-06 Thread Per Newgro
code
response.render(CssHeaderItem.forReference(reference));
/code

created a css link like this:
link rel=stylesheet type=text/css 
href=../../resources/portal/css/portal.css /

What i've tried to get is this:
link rel=stylesheet type=text/css href=/resources/trauer/css/portal.css 
/

We have all our css in an external folder (apache DOC_ROOT static). So this url 
is required.

But now i'm in doubt that i've misused the ResRef and HeaderItem concepts.
It seems to be more natural to extend the CssUrlHeaderItem and provide the 
dependencies there instead of connecting this to the ResourceReference and 
delegate the call. Maybe that is cause of how this is implemented.

Thanks
Per

 Original-Nachricht 
 Datum: Tue, 6 Nov 2012 10:15:11 +0200
 Von: Martin Grigorov mgrigo...@apache.org
 An: users@wicket.apache.org
 Betreff: Re: Why can\'t CssUrlReferenceHeaderItem have dependencies?

 Hi,
 
 Why do you use  reference.getUrl() to create CssUrlReferenceHeaderItem ?
 Why not just : response.render(CssHeaderItem.forReference(reference));
 
 CssUrlReferenceHeaderItem by itself works with plain Url and there is no
 way how Wicket can know that it may depend on some other dependencies.
 
 
 
 On Tue, Nov 6, 2012 at 10:02 AM, Per Newgro per.new...@gmx.ch wrote:
 
  Hi Martin,
 
  i use the UrlResRef like the normal ResRef. A specialiced css is
  depending
  on a base css.
  This base css should be guaranteed on special css usage.
 
  public class PortalCssDependingResourceReference extends
  UrlResourceReference {
 
  private final String portalId;
 
  public PortalCssDependingResourceReference(String resourceUrl,
 String
  portalId) {
  super(Url.parse(resourceUrl));
  this.portalId = portalId;
  }
 
  protected final String getPortalId() {
  return portalId;
  }
 
  @Override
  public Iterable? extends HeaderItem getDependencies() {
  ArrayListHeaderItem dependencies = new
 ArrayListHeaderItem();
  for (HeaderItem headerItem : super.getDependencies()) {
  dependencies.add(headerItem);
  }
  dependencies.add(CssHeaderItem.forReference(new
  PortalCssResourceReference(this.portalId)));
  return dependencies;
  }
 
  @Override
  public boolean isContextRelative() {
  return true;
  }
  }
 
  It is included as expected with this (sample) code in my page. And this
 is
  the cause why i'm wondering this is not implemented.
 
  @Override
  public void renderHead(IHeaderResponse response) {
  final PortalCssDependingResourceReference reference = new
  PortalCssDependingResourceReference(resources/special.css,
  getPortalId());
  response.render(new
  CssUrlReferenceHeaderItem(reference.getUrl().toString(), null, null) {
 
  @Override
  public Iterable? extends HeaderItem getDependencies()
  {
  return reference.getDependencies();
  }
  });
  super.renderHead(response);
  }
 
  I hope this is answering your question.
  Thanks
  Per
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 -- 
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/

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



Why can't CssUrlReferenceHeaderItem have dependencies?

2012-11-05 Thread Per Newgro
Hi,

i was wondering why CssUrlReferenceHeaderItem (wicket 6.2.0) is implemented by 
HeaderItem#getDependencies() which returns an empty list.
The CssReferenceHeaderItem has a getDependencies implementation
which uses the dependencies provided by the resource reference.

If i extend CssUrlReferenceHeaderItem (for testing) and provide the 
dependencies of the resource reference (analogoues to CssReferenceHeaderItem) 
everything works fine.

But maybe i miss here something. So my question is: Is it required that 
CssUrlReferenceHeaderItem is not handling dependencies of the resource 
reference?

Thanks for explanation.
Per

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



Re: What is the way to test a behavior?

2012-11-03 Thread Per Newgro
Thanks, works like expected. You right. If i throw another exception 
(ex. IAE) the assertion on rendered page is working. So checking the 
last response status seems to be natural.


Per

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



What is the way to test a behavior?

2012-11-01 Thread Per Newgro

Hi,

i try to unit test a custom behavior. But i was wondering what's the 
right way to test it.


I provide some code to explain my mind mismatch. The behavior shall 
interrupt the rendering
of a component. I would like to answer this with a 404. Calling the 
behavior method directly
results in the expected exception. But if i render a using component 
it's not answered by the 404.


How can i get a 404 within the usage testcase (see below).

Thanks for helping me
Per

code
public class TestHomePage {

public static class MyBehavior extends Behavior {
@Override
public void beforeRender(Component component) {
if (true) {
throw new 
AbortWithHttpErrorCodeException(HttpServletResponse.SC_NOT_FOUND, This 
is for testing);

}
}
}

public static class MyTestHomePage extends WebPage implements 
IMarkupResourceStreamProvider {


public MyTestHomePage() {
add(new MyBehavior());
}

@Override
public IResourceStream getMarkupResourceStream(
MarkupContainer container, Class? containerClass) {
return Markup.of(html/html).getMarkupResourceStream();
}
}

private WicketTester tester;

@Before
public void setUp() {
tester = new WicketTester(new WicketApplication());
}

@Test
public void abortRenderingOnUsage() {
tester.startPage(MyTestHomePage.class);
tester.assertRenderedPage(InternalErrorPage.class);
}

@Test(expected = AbortWithHttpErrorCodeException.class)
public void abortRenderingOnUnitTesting() {
MyBehavior behavior = new MyBehavior();
behavior.beforeRender(null);
}
}
/code

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



Wicketstuff references Wicket-Snapshot

2012-09-18 Thread Per Newgro
Hi,

is it required that all the wicketstuff projects are related to the wicket 
snapshot releases?

Thanks for review
Per

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



Is there a MountedMapper respecting better matching path names?

2012-08-02 Thread Per Newgro
Hi,

before i do this myself i would like to ask the community if someone has done 
this already.

I want to mount pages at these urls:
mountPage(/pages/${color}/advertise, AdvertisePage.class);
mountPage(/pages/${color}/${niceColor}, ColoredPage.class);

But because they both have 3 matching url path segments the first after sorting 
all available mount mapper wins. But in this case the almost exact url 
/pages/red/advertise is referencing the ColoredPage but should the 
AdvertisePage. Only ordering the mounts is influencing the result. But this is 
not a good option.

So i would like to know if there is already a library providing my required 
behavior.

Thanks
Per

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



Re: I'm slighty mad

2012-06-22 Thread Per Newgro

I hope you're not working in a nuclear power plant :-)

Am 22.06.2012 19:01, schrieb Bruno Borges:

Crazy little bastard!!

Congratulations on your brave move! :D


*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Fri, Jun 22, 2012 at 5:23 AM, Martin Grigorovmgrigo...@apache.orgwrote:


+1! :-)

next step is to go with a -SNAPSHOT in production ;-)
Let us know if you face any problems

On Fri, Jun 22, 2012 at 11:18 AM, coincoinfouolivierandr...@gmail.com
wrote:

I've pushed Wicket beta2 in production

--
View this message in context:

http://apache-wicket.1842946.n4.nabble.com/I-m-slighty-mad-tp4650184.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




--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
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 dropdownchoice onselectionchanged must override or implement a supertype method

2012-04-24 Thread Per Newgro

it is because of the @override annotation on a non-existent method.
Check the signature of the

onSelectionChanged


Cheers
Per

Am 24.04.2012 20:04, schrieb kshitiz:

Hi,

I am trying to implement wicket drop down choice with on selection changed
feature. But as I write :

final DropDownChoiceSelectOption  postCategoriesDropDown = new
DropDownChoiceSelectOption(postCategories, iModel,
Arrays.asList(selectOption), choiceRenderer)
{
/**
 *
 */
private static final long serialVersionUID = 1L;

@Override
protected boolean wantOnSelectionChangedNotifications()
{
 return true;
 }

@Override
protected void onSelectionChanged(final Object 
newSelection)
{
SelectOption selectOption = (SelectOption) 
newSelection;

}

};

eclipse shows an error:

*The method onSelectionChanged(Object) of type new
DropDownChoiceSelectOption(){} must override or implement a supertype
method*

Can you please tell me what can be the reason?? I am following
https://cwiki.apache.org/WICKET/dropdownchoice-examples.html
https://cwiki.apache.org/WICKET/dropdownchoice-examples.html

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-dropdownchoice-onselectionchanged-must-override-or-implement-a-supertype-method-tp4584391p4584391.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





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



Re: WicketTester Spring

2012-03-04 Thread Per Newgro
Assign the app to the wicket tester instance you use. See code section 
below.

Per

Am 04.03.2012 10:11, schrieb Douglas Ferguson:

What does this mean? you have to set the app to wicket tester instance.

Douglas

On Mar 4, 2012, at 1:32 AM, Per Newgro wrote:


And the app should know the context in which way? No no you have to set the app 
to wicket tester instance.
code
tester = new WicketTester(new MyApp());
/code

Cheers
Per

Am 04.03.2012 06:17, schrieb Douglas Ferguson:

I'm trying to use wicket tester to test an app that is running with spring.

I'm getting this error:

 java.lang.IllegalStateException: No WebApplicationContext found: no 
ContextLoaderListener registered?

I thought perhaps I would be able to use SpringJunit4ClassRunning, but that 
didn't work. Any tips?

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { 
classpath:spring/mockApplicationContext.xml})


-
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



Re: WicketTester Spring

2012-03-04 Thread Per Newgro

So problem is solved?
Per

Am 04.03.2012 11:22, schrieb Douglas Ferguson:

I'm doing that.

The fix involved moving the injector initialization to a template method so I 
could override.

tester = new WicketTester(new MyApp(){

@Override
public SpringComponentInjector setupInjector() {
SpringComponentInjector injector = new 
SpringComponentInjector(this, applicationContext);

getComponentInstantiationListeners().add(injector);
injector.inject(this);
return injector;
}
});

On Mar 4, 2012, at 3:19 AM, Per Newgro wrote:


Assign the app to the wicket tester instance you use. Seecode  section below.
Per

Am 04.03.2012 10:11, schrieb Douglas Ferguson:

What does this mean? you have to set the app to wicket tester instance.

Douglas

On Mar 4, 2012, at 1:32 AM, Per Newgro wrote:


And the app should know the context in which way? No no you have to set the app 
to wicket tester instance.
code
tester = new WicketTester(new MyApp());
/code

Cheers
Per

Am 04.03.2012 06:17, schrieb Douglas Ferguson:

I'm trying to use wicket tester to test an app that is running with spring.

I'm getting this error:

 java.lang.IllegalStateException: No WebApplicationContext found: no 
ContextLoaderListener registered?

I thought perhaps I would be able to use SpringJunit4ClassRunning, but that 
didn't work. Any tips?

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { 
classpath:spring/mockApplicationContext.xml})

-
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



-
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: WicketTester Spring

2012-03-03 Thread Per Newgro
And the app should know the context in which way? No no you have to set 
the app to wicket tester instance.

code
tester = new WicketTester(new MyApp());
/code

Cheers
Per

Am 04.03.2012 06:17, schrieb Douglas Ferguson:

I'm trying to use wicket tester to test an app that is running with spring.

I'm getting this error:

 java.lang.IllegalStateException: No WebApplicationContext found: no 
ContextLoaderListener registered?

I thought perhaps I would be able to use SpringJunit4ClassRunning, but that 
didn't work. Any tips?

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { 
classpath:spring/mockApplicationContext.xml})



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



Re: reload model on render

2012-03-03 Thread Per Newgro

Any code please,

Per

Am 04.03.2012 03:16, schrieb nazeem:

Hi

I have a content area in which I am displaying say PanelA. In PanelA I have
a link to navigate to PanelB. When I click that I replace the content area
with PanelB. When I construct PanelB i pass the instance PanelA via
PanelA.this so that PanelB can show a link to go back to PanelA. When the go
back link in panelB is clicked I do a replace content area with the object
(instance of panelA) I recieved in the construtor.

This works perfectly fine and the to n fro navigation is quick. It does not
reload the whole stuff again. Done. But I need to reload some of the data
changed in backend when coming from PanelB back to PanelA. Right now the
PanelA shows the old data it does not re-load.  I tried using the
LoadableDetachableModel but that does not get triggered.

Any clue please..

-naz


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/reload-model-on-render-tp4442813p4442813.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





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



Re: help with drag and drop (wicket-dnd)

2012-02-26 Thread Per Newgro

Hi Dan,

only a shot in the dark - but is your markup valid? validate with w3c.

PS: Is it required to add the ending slash?

Cheers
Per

Thanks for answer.
Yes, in the first td is span but in this forum it was formatted and span
was not visible.
The first td should be:td  span wicket:id=aaa class=aaawww/td
--

But I make little modification and html is:
table
tr
td  span wicket:id=aaa class=aa/td
td  span wicket:id=bbb class=bb/td
td  span wicket:id=ccc class=cc/td
/tr
/table

And in java class was added:
Label bbb = new Label(bbb, bbb);
Label ccc = new Label(ccc, ccc);
bbb.setOutputMarkupId(true);
ccc.setOutputMarkupId(true);
container.add(bbb);
container.add(ccc);



But in the methods is transfer.getData() allways NULL. What should be in
transfer? The target element? Is there any way how to know what element was
targeted (drop)?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/help-with-drag-and-drop-wicket-dnd-tp4422338p4422742.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





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



Re: get key from resource model

2012-02-10 Thread Per Newgro
If you mean get the key from ResourceModel, or ... then the answer is 
no not directly.
An ugly solution could be - extend ResourceModel and memorize the key in 
a second attribute.

But that's realy ugly.

class MyResourceModel extends ResourceModel {
  private String key;

  public MyResourceModel(String key) {
super(key);
this.key = key;
  }

  public String getTheKeyOnUglyWay() {
return this.key;
  }
}

But i would do this only if no other solution is possible.

Cheers
Per

Am 10.02.2012 14:43, schrieb cosmindumy:

Hello,
My displayed texts are localized using ResourceModel('my.key').
Is it posible to get the key for ResourceModel, or an object from whom I can
extract the key?
Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/get-key-from-resource-model-tp4376269p4376269.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





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



Re: StatelessForm: Cannot login

2012-02-09 Thread Per Newgro
If i understood your usecase correctly you're app is still stateless if 
you logged in.
Afaik no session is created for stateless pages. So after you've logged 
in the session
is away for your next page. And then the user is away to. You could 
debug it by print the

hashcode of getSession() in the page.

Cheers
Per

Hello,

I have a strange problem with StatelessForms in combination with login in:
On my MainPage are two stateless forms. One for registration and one for the
login (registration isn't implemented yet). When I try to log in, Wicket
creates a new User() and saves it in the Session (I made this like it's
explained in Wicket in Action). A System.out.print(user created) in the
constructor of User confirms that. Everything seems to be ok. But when the
main page reloads, I am still logged out.
And: When I change from StatelessForm to Form, everything works perfectly.
Something else might be important: When I request a page that requries
authorization and I'm not logged in, i'm being redirected to /login. There
is the same LoginPanel (with StatelessForm) as on the main page - and the
login works! But when I directly open /login it's the same as on the main
page and I can't login.
I also noticed that the login works (with StatelessForm) when I open a page
that requires authorization, then press the back button (back to main page)
and there try to log in.

The question is now, what am I doing worng? I can't find the problem in my
code, I have been trying a lot to find out what's worng but everything seems
to be correct. I couldn't find anything in the mailing list / on the web, I
searched a lot.

At the end I attached code from LoginPanel.java, WiaSession.java and
WicketApplication.java.

Thank you very much for your help!
(And sorry if there are one or two missspelled words - I don't speak english
natively.)


René

LoginPanel.java:
public class LoginPanel extends Panel {

 public LoginPanel(String id) {
 super(id);
 add(new LoginForm(login));
 }

 private class LoginForm extends StatelessForm {

 private String username;
 private String password;

 public LoginForm(String id) {
 super(id);

 setModel(new CompoundPropertyModel(this));
 add(new TextField(username));
 add(new PasswordTextField(password));
 }

 @Override
 public final void onSubmit() {
 if (tryToLogIn()) {
 if (!continueToOriginalDestination()) {
 setResponsePage(getApplication().getHomePage());
 }
 }
 }

 private boolean tryToLogIn() {
 if (username != null  password != null) {
 User user = Database.findUser(username);
 if (user != null) {
 if (user.comparePasswords(password)) {
 WiaSession.get().setUser(user);
 return true;
 }
 }
 }
 return false;
 }
 }
}

WiaSession.java:
public final class WiaSession extends WebSession {

 private User user;

 public WiaSession(Request request) {
 super(request);
 }

 public static WiaSession get() {
 return (WiaSession) Session.get();
 }

 public static boolean isLoggedIn() {
 return WiaSession.get().isAuthenticated();
 }

 public boolean isAuthenticated() {
 return (user != null);
 }

 public final synchronized User getUser() {
 return user;
 }

 public final synchronized void setUser(User user) {
 this.user = user;
 }
}

WicketApplication.java, newSession overwritten:
 @Override
 public final Session newSession(Request request, Response response) {
 return new WiaSession(request);
 }

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/StatelessForm-Cannot-login-tp4373476p4373476.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





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



Re: StatelessForm: Cannot login

2012-02-09 Thread Per Newgro

And maybe this javadoc helps
Session#bind()
/**
 * Force binding this session to the application's {@link 
ISessionStore session store} if not

 * already done so.
 * p
 * A Wicket application can operate in a session-less mode as long 
as stateless pages are used.
 * Session objects will be then created for each request, but they 
will only live for that
 * request. You can recognize temporary sessions by calling {@link 
#isTemporary()} which
 * basically checks whether the session's id is null. Hence, 
temporary sessions have no session

 * id.
 * /p
 * p
 * By calling this method, the session will be bound (made 
not-temporary) if it was not bound
 * yet. It is useful for cases where you want to be absolutely sure 
this session object will be

 * available in next requests. If the session was already bound (
 * {@link ISessionStore#lookup(Request) returns a session}), this 
call will be a noop.

 * /p
 */

Am 09.02.2012 18:45, schrieb Per Newgro:
If i understood your usecase correctly you're app is still stateless 
if you logged in.
Afaik no session is created for stateless pages. So after you've 
logged in the session
is away for your next page. And then the user is away to. You could 
debug it by print the

hashcode of getSession() in the page.

Cheers
Per

Hello,

I have a strange problem with StatelessForms in combination with 
login in:
On my MainPage are two stateless forms. One for registration and one 
for the

login (registration isn't implemented yet). When I try to log in, Wicket
creates a new User() and saves it in the Session (I made this like it's
explained in Wicket in Action). A System.out.print(user created) in 
the
constructor of User confirms that. Everything seems to be ok. But 
when the

main page reloads, I am still logged out.
And: When I change from StatelessForm to Form, everything works 
perfectly.

Something else might be important: When I request a page that requries
authorization and I'm not logged in, i'm being redirected to /login. 
There
is the same LoginPanel (with StatelessForm) as on the main page - and 
the
login works! But when I directly open /login it's the same as on the 
main

page and I can't login.
I also noticed that the login works (with StatelessForm) when I open 
a page
that requires authorization, then press the back button (back to main 
page)

and there try to log in.

The question is now, what am I doing worng? I can't find the problem 
in my
code, I have been trying a lot to find out what's worng but 
everything seems
to be correct. I couldn't find anything in the mailing list / on the 
web, I

searched a lot.

At the end I attached code from LoginPanel.java, WiaSession.java and
WicketApplication.java.

Thank you very much for your help!
(And sorry if there are one or two missspelled words - I don't speak 
english

natively.)


René

LoginPanel.java:
public class LoginPanel extends Panel {

 public LoginPanel(String id) {
 super(id);
 add(new LoginForm(login));
 }

 private class LoginForm extends StatelessForm {

 private String username;
 private String password;

 public LoginForm(String id) {
 super(id);

 setModel(new CompoundPropertyModel(this));
 add(new TextField(username));
 add(new PasswordTextField(password));
 }

 @Override
 public final void onSubmit() {
 if (tryToLogIn()) {
 if (!continueToOriginalDestination()) {
 setResponsePage(getApplication().getHomePage());
 }
 }
 }

 private boolean tryToLogIn() {
 if (username != null  password != null) {
 User user = Database.findUser(username);
 if (user != null) {
 if (user.comparePasswords(password)) {
 WiaSession.get().setUser(user);
 return true;
 }
 }
 }
 return false;
 }
 }
}

WiaSession.java:
public final class WiaSession extends WebSession {

 private User user;

 public WiaSession(Request request) {
 super(request);
 }

 public static WiaSession get() {
 return (WiaSession) Session.get();
 }

 public static boolean isLoggedIn() {
 return WiaSession.get().isAuthenticated();
 }

 public boolean isAuthenticated() {
 return (user != null);
 }

 public final synchronized User getUser() {
 return user;
 }

 public final synchronized void setUser(User user) {
 this.user = user;
 }
}

WicketApplication.java, newSession overwritten:
 @Override
 public final Session newSession(Request request, Response 
response) {

 return new WiaSession(request);
 }

--
View this message in context: 
http://apache-wicket.1842946.n4

Re: StatelessForm: Cannot login

2012-02-09 Thread Per Newgro
lol. Next time ask the community earlier. I always try to solve my 
problems alone.
Sometimes it helps to build a quickstart and focus to the problem. But 
if i realy don't have an idea
and google is not helping to - then i ask here. Normally you get help in 
short time.


Btw: Thanks to all helping others out of their problems.

Cheers
Per


Am 09.02.2012 20:00, schrieb René Bernhardsgrütter:

Hi Per, thank you very much for your answers.
Yes, that was it. I added WiaSession.get().bind(); to my LoginPanel 
and now it works as it should :-)

Every time when the LoginPanel is showed, the session will be binded.

Phu, I was trying to fix that over three days ^^

Regards,
René

On 02/09/2012 06:53 PM, Per Newgro wrote:

And maybe this javadoc helps
Session#bind()
/**
 * Force binding this session to the application's {@link 
ISessionStore session store} if not

 * already done so.
 * p
 * A Wicket application can operate in a session-less mode as 
long as stateless pages are used.
 * Session objects will be then created for each request, but 
they will only live for that
 * request. You can recognize temporary sessions by calling 
{@link #isTemporary()} which
 * basically checks whether the session's id is null. Hence, 
temporary sessions have no session

 * id.
 * /p
 * p
 * By calling this method, the session will be bound (made 
not-temporary) if it was not bound
 * yet. It is useful for cases where you want to be absolutely 
sure this session object will be

 * available in next requests. If the session was already bound (
 * {@link ISessionStore#lookup(Request) returns a session}), this 
call will be a noop.

 * /p
 */

Am 09.02.2012 18:45, schrieb Per Newgro:
If i understood your usecase correctly you're app is still stateless 
if you logged in.
Afaik no session is created for stateless pages. So after you've 
logged in the session
is away for your next page. And then the user is away to. You could 
debug it by print the

hashcode of getSession() in the page.

Cheers
Per

Hello,

I have a strange problem with StatelessForms in combination with 
login in:
On my MainPage are two stateless forms. One for registration and 
one for the
login (registration isn't implemented yet). When I try to log in, 
Wicket
creates a new User() and saves it in the Session (I made this like 
it's
explained in Wicket in Action). A System.out.print(user created) 
in the
constructor of User confirms that. Everything seems to be ok. But 
when the

main page reloads, I am still logged out.
And: When I change from StatelessForm to Form, everything works 
perfectly.

Something else might be important: When I request a page that requries
authorization and I'm not logged in, i'm being redirected to 
/login. There
is the same LoginPanel (with StatelessForm) as on the main page - 
and the
login works! But when I directly open /login it's the same as on 
the main

page and I can't login.
I also noticed that the login works (with StatelessForm) when I 
open a page
that requires authorization, then press the back button (back to 
main page)

and there try to log in.

The question is now, what am I doing worng? I can't find the 
problem in my
code, I have been trying a lot to find out what's worng but 
everything seems
to be correct. I couldn't find anything in the mailing list / on 
the web, I

searched a lot.

At the end I attached code from LoginPanel.java, WiaSession.java and
WicketApplication.java.

Thank you very much for your help!
(And sorry if there are one or two missspelled words - I don't 
speak english

natively.)


René

LoginPanel.java:
public class LoginPanel extends Panel {

 public LoginPanel(String id) {
 super(id);
 add(new LoginForm(login));
 }

 private class LoginForm extends StatelessForm {

 private String username;
 private String password;

 public LoginForm(String id) {
 super(id);

 setModel(new CompoundPropertyModel(this));
 add(new TextField(username));
 add(new PasswordTextField(password));
 }

 @Override
 public final void onSubmit() {
 if (tryToLogIn()) {
 if (!continueToOriginalDestination()) {
 setResponsePage(getApplication().getHomePage());
 }
 }
 }

 private boolean tryToLogIn() {
 if (username != null  password != null) {
 User user = Database.findUser(username);
 if (user != null) {
 if (user.comparePasswords(password)) {
 WiaSession.get().setUser(user);
 return true;
 }
 }
 }
 return false;
 }
 }
}

WiaSession.java:
public final class WiaSession extends WebSession {

 private User user;

 public WiaSession(Request request

[1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Per Newgro

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in the 
available choices collection


logger.warn(
Detected inconsistency in choice component: {}/{}. 
Model returned object: {}, but this object is not available in the list 
of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that to work.

Is there another way of selecting the object?

Thanks
Per

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



Re: [1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Per Newgro

Maybe a usecase helps :-)

I load my choices in a LDM. The selected choice is located in the domain 
model.

So the objects are equal by semantic but not by instance.

Dropdown choices are d, Germany; dk, Danmark hashcodes are 1 and 2
selected value is d, Germany hashcode is 3

Cheers
Per

Am 24.01.2012 10:42, schrieb Per Newgro:

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in the 
available choices collection


logger.warn(
Detected inconsistency in choice component: 
{}/{}. Model returned object: {}, but this object is not available in 
the list of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that to 
work.

Is there another way of selecting the object?

Thanks
Per

-
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: [1.5.4] DropDownChoice is not presenting value if equals is not overwritten

2012-01-24 Thread Per Newgro

Thanks Sven,

https://issues.apache.org/jira/browse/WICKET-4353

Cheers
Per

Am 24.01.2012 11:31, schrieb Sven Meier:

Hi,

Igor's commit statements says improved inconsistency handling in 
choice components.
This change prevents IChoiceRenderer#getIdValue() being called with -1 
as the index argument.


I assume you are using a custom IChoiceRenderer which doesn't use the 
index but a custom identifier?


Try overriding #getModelValue():

@Override
public String getModelValue()
{
final Foo object = getModelObject();
if (object != null)
{
return  + object.getBar();
}
else
{
return ;
}
}

And create a jira issue please. We might have to revert this change.

Sven

Am 24.01.2012 10:52, schrieb Per Newgro:

Maybe a usecase helps :-)

I load my choices in a LDM. The selected choice is located in the 
domain model.

So the objects are equal by semantic but not by instance.

Dropdown choices are d, Germany; dk, Danmark hashcodes are 1 and 2
selected value is d, Germany hashcode is 3

Cheers
Per

Am 24.01.2012 10:42, schrieb Per Newgro:

Hi,

with 1.5.4 the implementation of 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.java

has changed from

code

/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
  final T object = getModelObject();
  if (object != null)
  {
int index = getChoices().indexOf(object);
return getChoiceRenderer().getIdValue(object, index);
  }
else
  {
return ;
  }
}

/code

to

code
/**
 * @see FormComponent#getModelValue()
 */
@Override
public String getModelValue()
{
final T object = getModelObject();
if (object != null)
{
int index = getChoices().indexOf(object);

if (index  0)
{
// the model is returning a choice that is not in 
the available choices collection


logger.warn(
Detected inconsistency in choice component: 
{}/{}. Model returned object: {}, but this object is not available 
in the list of selected objects.,
new Object[] { getPage().getClass(), 
getPageRelativePath(), object });


// pretend like nothing is selected

return ;
}

return getChoiceRenderer().getIdValue(object, index);
}
else
{
return ;
}
}
/code

I don't see why this changed. Release notes don't provide a task for 
that. But now i have to overwrite equals in my objects to get that 
to work.

Is there another way of selecting the object?

Thanks
Per

-
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





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



Re: Apache Wicket 1.5.4 is released

2012-01-23 Thread Per Newgro

Shouldn't it be announce to the other list?

Cheers
Per

Am 23.01.2012 09:41, schrieb Martin Grigorov:

This is the fourth maintenance release of the Wicket 1.5.x series. This
release brings over 60 bug fixes and improvements.

Git tag:
release/wicket-1.5.4

Changelog:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12319051

Maven:
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-core/artifactId
version1.5.4/version
/dependency


Download the full distribution (including source):
http://www.apache.org/dyn/closer.cgi/wicket/1.5.4

The Wicket team

-
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: Apache Wicket 1.5.4 is released

2012-01-23 Thread Per Newgro
Oops sorry. My fault. Mail filter is filtering dev before users list. So 
it's only seen in dev folder.

Sorry.
Per

Am 23.01.2012 10:51, schrieb Per Newgro:

Shouldn't it be announce to the other list?

Cheers
Per

Am 23.01.2012 09:41, schrieb Martin Grigorov:

This is the fourth maintenance release of the Wicket 1.5.x series. This
release brings over 60 bug fixes and improvements.

Git tag:
release/wicket-1.5.4

Changelog:
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12310561version=12319051 



Maven:
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-core/artifactId
version1.5.4/version
/dependency


Download the full distribution (including source):
http://www.apache.org/dyn/closer.cgi/wicket/1.5.4

The Wicket team

-
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



Re: What to add to pom.xml to use hibernate?

2012-01-21 Thread Per Newgro

Hmm. Firstly you ask the wrong list. Hibernate is off topic.
At second - did you do a search? With maven hibernate i
found this link quickly:
http://stackoverflow.com/questions/3345816/hibernate-projects-and-building-with-maven
See the answer with the green check at the side. I think that will 
anser you question.

You have to exhange the version numbers by 4.0.1...

Cheers
Per

Am 21.01.2012 08:53, schrieb Daniel Watrous:

I'm interested in using hibernate in my wicket application, but I
can't find any up to date examples combining the two.

Is there something other than hibernate that the wicket community uses for ORM?

If not, what can I add to the pom.xml file to include hibernate. I
tried adding this:

dependency
groupIdorg.hibernate/groupId
artifactIdhibernate/artifactId
version4.0.1-Final/version
/dependency

but it doesn't work. I an error that it Could not resolve dependencies
for project...

I also attempted to add this alongside the other repository that is there.

 repository
 idjboss/id
 urlhttp://repository.jboss.org/maven2//url
 /repository

I get the error about Could not resolve dependencies for project...
but now many other jar files are not found.

I started with the quickstart, if that helps.

-
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: Can't instantiate page using constructor

2012-01-21 Thread Per Newgro

The stack trace is what?

Am 21.01.2012 18:21, schrieb Daniel Watrous:

When I build my wicket project I'm getting the following error

Tests in error:
   homepageRendersSuccessfully(com.danielwatrous.movieratings.TestHomePage):
Can't instantiate page using constructor 'public
com.danielwatrous.movieratings.HomePage(org.apache.wicket.request.mapper.parameter.PageParameters)'
and argument ''. Might be it doesn't exist, may be it is not visible
(public).

I can't see any errors in my code. I am trying to use Hibernate and if
I comment out the hibernate code then the page compiles fine. I don't
see how the hibernate code causes an error with the class. Here's my
code.

package com.danielwatrous.movieratings;

import org.hibernate.Session;

import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.WebPage;

import com.danielwatrous.movieratings.domain.*;
import com.danielwatrous.movieratings.util.HibernateUtil;

public class HomePage extends WebPage {
private static final long serialVersionUID = 1L;

 public HomePage(final PageParameters parameters) {
add(new Label(version,
getApplication().getFrameworkSettings().getVersion()));
 // TODO Add your page's components here

 Session session = 
HibernateUtil.getSessionFactory().getCurrentSession();
 session.beginTransaction();

 Movie movie = new Movie();
 movie.setName(Ocean's Eleven);
 movie.setCategory(Category.COMEDY);
 movie.setRating(Rating.FOURSTARS);
 session.save(movie);

 session.getTransaction().commit();
 }

}

-
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: ListView not refreshed after a new row is inserted with EJB3 as its backend data

2012-01-19 Thread Per Newgro

Use a LoadableDetachableModelListUser in the ListView Constructor.
Put all the load loading into the load method and see what happens.

Cheers
Per

Am 19.01.2012 07:49, schrieb x.yang:

Hello, Everyone,

I am trying to build a web app with Wicket, EJB3, and MySQL. My IDE is
Netbeans 6.9.1 and the server is Glassfish 3.1.

I have created two entity beans 'Centre' and 'User', and one Centre has many
User(s). I also created two Facades for them.

The Wicket page used to list the Users is as below:


class ListUsers extends WebPage {

 @EJB(name = UserFacade)
 private UserFacade userFacade;

 public ListUsers(Centre c) {
 ListUser  users;
 if (c == null) {
 users = userFacade.findAll();
 } else {
 users = new ArrayListUser(c.getUserCollection());
 }
 final ListViewUser  list = new ListViewUser(eachUser, users) {

 @Override
 protected void populateItem(ListItem item) {
 final User user = (User) item.getModelObject();
 item.add(new Label(username, user.getUsername()));
 item.add(new Label(fullname, user.getFullname()));
 item.add(new Label(email, user.getEmail()));
 item.add(new Label(centreid, user.getCentre().getName()));
 }
 };
 add(list);
 }
}
-

The page to add a User is following:


 public AddUser(Centre c) {
 user = new User();
 user.setCentre(c);
 FormAddUser  form = new FormAddUser(AddUser) {

 @Override
 protected void onSubmit() {
 userFacade.create(user);
 }
 };

 form.add(new TextFieldString(username,
 new PropertyModel(user, username)).setRequired(true));

 PasswordTextField tf_password = new PasswordTextField(password,
 new PropertyModel(user, hashedPassword));
 form.add(tf_password);

 form.add(new TextFieldString(fullname,
 new PropertyModel(user, fullname)).setRequired(true));

 TextField tf_email = new TextFieldString(email,
 new PropertyModel(user, email));
 form.add(tf_email);

 LoadableDetachableModel centres = new LoadableDetachableModel() {

 @Override
 protected Object load() {
 return centreFacade.findAll();
 }
 };
 DropDownChoiceCentre  ddc = new DropDownChoiceCentre(centreid,
 new PropertyModelCentre(user, centre), centres,
 new ChoiceRendererCentre(name, name));

 form.add(ddc.setRequired(true));

 add(form);
 }
}



The problem is I can't see the newly added User in the list with
getUserCollection() method of Centre, but I do see the new User if I use
userFacade.findAll() method. Could you please help me and point me to the
right direction? I am quite new to Wicket and EJB3. Any comments are welcom.
Thanks a lot.

Yang



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ListView-not-refreshed-after-a-new-row-is-inserted-with-EJB3-as-its-backend-data-tp4309318p4309318.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





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



Re: how to get https port number in Wicket 1.5

2012-01-15 Thread Per Newgro

Thanks for testing this out. I wasn't aware of that.

I didn't understand the usecase exactly. You want to set the page / 
request secure

if you've added the login form? Or do you want to secure the form only.
For the later a possible answer is this
http://stackoverflow.com/questions/96164/partial-site-ssl-using-asp-net-login-control
It's a .net answer but the issue seems to be the same.

Per

Am 15.01.2012 01:41, schrieb armhold:

Hi Per,

The documentation for @RequireHttps implies that it only works for pages,
not components, and my (limited) testing shows that to be the case. Is there
a way to use it with components on otherwise insecure pages?

My use case is to secure a form on non-https pages, specifically to secure
that very nice username/password field at the top of Twitter Bootstrap
pages.

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4296003.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





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



Re: how to get https port number in Wicket 1.5

2012-01-14 Thread Per Newgro

Stupid question. Is @RequireHttps at Form class working?

Cheers
Per

Am 14.01.2012 17:44, schrieb armhold:

Assuming that the http/https port number have been set in WicketApplication
with the following:

 setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new
HttpsConfig(8080, 8443)));

... is there any way to get access to the port numbers from components?  One
obvious solution is something like:

 public class WicketApplication {
  public int getHttpPort() { return 8080; }
  public int getHttpsPort() { return 8443; }

  public void init () {
   // ...
   setRootRequestMapper(new
HttpsMapper(getRootRequestMapper(), new HttpsConfig(getHttpPort(),
getHttpsPort(;
  }
 }

And then in my components:

   ((WicketApplication) getApplication()).getHttpsPort();

But I am wondering if there is a cleaner way to get this information,
perhaps from the RequestCycle.

Why am I asking? I'd like to create a Form subclass that always uses https.

Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4295139.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





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



Re: how to get https port number in Wicket 1.5

2012-01-14 Thread Per Newgro

Stupid = my question not yours :-). Only for clearify it :-)

Am 14.01.2012 19:05, schrieb Per Newgro:

Stupid question. Is @RequireHttps at Form class working?

Cheers
Per

Am 14.01.2012 17:44, schrieb armhold:
Assuming that the http/https port number have been set in 
WicketApplication

with the following:

 setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), 
new

HttpsConfig(8080, 8443)));

... is there any way to get access to the port numbers from 
components?  One

obvious solution is something like:

 public class WicketApplication {
  public int getHttpPort() { return 8080; }
  public int getHttpsPort() { return 8443; }

  public void init () {
   // ...
   setRootRequestMapper(new
HttpsMapper(getRootRequestMapper(), new HttpsConfig(getHttpPort(),
getHttpsPort(;
  }
 }

And then in my components:

   ((WicketApplication) getApplication()).getHttpsPort();

But I am wondering if there is a cleaner way to get this information,
perhaps from the RequestCycle.

Why am I asking? I'd like to create a Form subclass that always uses 
https.


Thanks


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/how-to-get-https-port-number-in-Wicket-1-5-tp4295139p4295139.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





-
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



What is the cause for log entry ModificationWatcher - Cannot track modifications to resource

2012-01-02 Thread Per Newgro

Hi,

If i test my app by using Start.java i get the log entry
INFO  - ModificationWatcher- Cannot track modifications to 
resource 
file:/D:/Dokumente%20und%20Einstellungen/per.n/Eigene%20Dateien/workspaces/work/whataschranz/target/classes/ch/newgro/shop/whataschranz/welcome/HomePage.html

If i change the HP Markup it's not reloaded.

Google only pops up an answer by igor
not sure you can do anything about the message...just disable the 
logger for that class/package...


But disabling the log message is not solving the problem, that my markup 
modifications are not re-loaded :-).
As far as i investigated this issue is a problem with the encoded path 
string (%20) used to load the resource by
org.apache.wicket.util.resource.locator.ResourceStreamLocator#locateByResourceFinder. 

I'm not an expert but i think i've read a message that something changed 
here (URI class or servlet-api)

but maybe someone else already solved this.

My question is - Is this a bug or can i configure something to make 
resource modification watcher working?


Thanks
Per

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



Re: What is the cause for log entry ModificationWatcher - Cannot track modifications to resource

2012-01-02 Thread Per Newgro

Thanks Allen,

that's why i was asking in list first. So if you agree i will file a 
jira issue.


Per

Am 02.01.2012 18:14, schrieb Allen Gilbert:

Per,

I ran into this problem recently and solved it by removing spaces from
directory names in my project path.  I plan to file a Jira issue at some
point, as it seems that ModificationWatcher should be able to handle file
paths with spaces...

-Allen

On Mon, Jan 2, 2012 at 4:42 AM, Per Newgroper.new...@gmx.ch  wrote:


Hi,

If i test my app by using Start.java i get the log entry
INFO  - ModificationWatcher- Cannot track modifications to
resource file:/D:/Dokumente%20und%**20Einstellungen/per.n/Eigene%**
20Dateien/workspaces/work/**whataschranz/target/classes/**
ch/newgro/shop/whataschranz/**welcome/HomePage.html
If i change the HP Markup it's not reloaded.

Google only pops up an answer by igor
not sure you can do anything about the message...just disable the logger
for that class/package...

But disabling the log message is not solving the problem, that my markup
modifications are not re-loaded :-).
As far as i investigated this issue is a problem with the encoded path
string (%20) used to load the resource by
org.apache.wicket.util.**resource.locator.**ResourceStreamLocator#**locateByResourceFinder.

I'm not an expert but i think i've read a message that something changed
here (URI class or servlet-api)
but maybe someone else already solved this.

My question is - Is this a bug or can i configure something to make
resource modification watcher working?

Thanks
Per

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



Re: Wicket 1.5: The component(s) below failed to render

2011-12-21 Thread Per Newgro

Do you use a border? Because border component assignment changed

Cheers
Per
Am 21.12.2011 10:58, schrieb Adrian Wiesmann:

Hello list

We built a rendering engine in Wicket 1.4 which takes a UI description 
from an XML file and builds an HTML representation from that. 
Everything worked fine in Wicket 1.4.x.


Now I tried to switch to Wicket 1.5.3. Without changing anything from 
the rendering part, I now get this error:


 org.apache.wicket.WicketRuntimeException: The component(s) below
 failed to render. A common problem is that you have added a component
 in code but forgot to reference it in the markup (thus the component
 will never be rendered).

Below that message I get a list with all components.

We mostly use ListViews to build the UI:

ListViewObjectBase listView = new 
ListViewObjectBase(eachGuiElem, formRoot.getChildren())

{
@Override
protected void populateItem(ListItemObjectBase item)
{
ObjectBase ob = item.getModelObject();

item.add(new Panel(...));
}
};

So here is my question. What did change with Wicket 1.5? How can I 
make our renderer work again? Where should I look at to find out whats 
wrong?


Thanks,
Adrian

-
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: display artifact version in webpage

2011-12-15 Thread Per Newgro

But this causes a build / version control system issue.

Guess you use version control like svn or cvs. Once you checked in the 
html markup

and call a build the markup changed and you have to check in markup again.
So that becomes a chicken - egg - problem.

Just my 2$
Per

Am 15.12.2011 09:27, schrieb Sjoerd Schunselaar:

Thank you Chantal,

Thats a very easy solution. Didn't think about that.


Kind regards,

Sjoerd Schunselaar


On Wed, Dec 14, 2011 at 1:02 PM, Chantal Ackermann
chantal.ackerm...@btelligent.de  wrote:


Hi Sjoerd,

my way of doing this is directly from pom to html using filtering.

Add ${project.version} into the markup (for me, I add it into a top bar
shared by all pages). Change the pom.xml resources configuration to
filter either all html files or only that specific one. (I've simply
changed the original false to true as I am sure that there is no
other Dollar-notation in the html files.)

resource
filteringtrue/filtering
directorysrc/main/java/directory
includes
include**/include
/includes
excludes
exclude**/*.java/exclude
/excludes
/resource


Cheers,
Chantal



On Wed, 2011-12-14 at 11:33 +0100, Sjoerd Schunselaar wrote:

Hi all,

Is there a easy way to display the artifact version which can be set in

de

maven pom.xml file?
I would like to display that artifact version in the title bar.


met vriendelijke groet,

Sjoerd Schunselaar


-
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: display artifact version in webpage

2011-12-15 Thread Per Newgro

Ahh, ok. You're right. You don't check in the generated version. Sure.

Sorry. So no problem.
Per

Am 15.12.2011 10:26, schrieb Chantal Ackermann:

You shouldn't be checking in any automatically generated files!
What is checked in is the markup that contains the placeholder - and
that doesn't change with new builds, of course. That's the point of it,
isn't it?

Chantal



On Thu, 2011-12-15 at 09:46 +0100, Per Newgro wrote:

But this causes a build / version control system issue.

Guess you use version control like svn or cvs. Once you checked in the
html markup
and call a build the markup changed and you have to check in markup again.
So that becomes a chicken - egg - problem.

Just my 2$
Per

Am 15.12.2011 09:27, schrieb Sjoerd Schunselaar:

Thank you Chantal,

Thats a very easy solution. Didn't think about that.


Kind regards,

Sjoerd Schunselaar


On Wed, Dec 14, 2011 at 1:02 PM, Chantal Ackermann
chantal.ackerm...@btelligent.de   wrote:


Hi Sjoerd,

my way of doing this is directly from pom to html using filtering.

Add ${project.version} into the markup (for me, I add it into a top bar
shared by all pages). Change the pom.xml resources configuration to
filter either all html files or only that specific one. (I've simply
changed the original false to true as I am sure that there is no
other Dollar-notation in the html files.)

resource
 filteringtrue/filtering
 directorysrc/main/java/directory
 includes
 include**/include
 /includes
 excludes
 exclude**/*.java/exclude
 /excludes
/resource


Cheers,
Chantal



On Wed, 2011-12-14 at 11:33 +0100, Sjoerd Schunselaar wrote:

Hi all,

Is there a easy way to display the artifact version which can be set in

de

maven pom.xml file?
I would like to display that artifact version in the title bar.


met vriendelijke groet,

Sjoerd Schunselaar

-
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





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



Re: PagingNavigator container instead of link for previous and next

2011-12-13 Thread Per Newgro

Add an attributemodifier to component created in

newPagingNavigationLink


Cheers
Per

Am 13.12.2011 23:06, schrieb infiniter:

I extended Pagingavigator and the markup for the previous (and next) button
looks like this:

Enabled state (current page  0)

 li class=previous-on button
  # Prev
 /li

Disabled state (current page == 0)

 li class=previous-off button
  # Prev
 /li

PagingNavigator creates a link using newPagingNavigationLink and adds it on
onBeforeRender(). Since I need to vary the class name in the li element I
would have to place that link inside a container or a fragment; however I
cannot do that since the onBeforeRender() already adds the link to the
PagingNavigator panel, and trying to override onBeforeRender() to add the
link inside a container may not be a great idea because I still need to call
super.onBeforeRender(), and I know of no way to call
super.super.onBeforeRender()... To avoid calling super.OnBeforeRender() I
cannot just copy-paste the instructions in Component.onBeforeRender()
because onBeforeRenderChildren() is not accessible outside its package, so
there are some NASTY options:
-create my PagingNavigator subclass under the same package of Component and
use the just-mentioned approach
-Overriding onBeforeRender() and remove the just added previous and next
links
-create a whole new navigator and forget extending from PagingNavigator

But, is there a nice solution? (Wicket version: 1.4.15)


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/PagingNavigator-container-instead-of-link-for-previous-and-next-tp4192293p4192293.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





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



Re: URL with root parameters

2011-11-21 Thread Per Newgro
I don't understand the first part of your problem. How do you use the 
images. In other pages? Located in markup?

Some code could really be useful here.

On the second part: How do you call the page? Do you provide the page 
parameters of anchor to constructed page?

Some code could really be useful here to.

Cheers
Per

Am 20.11.2011 23:12, schrieb intmanch:

Hi,

I'm developing an application that uses a parameter on the root url like
this: /param under Wicket 1.5

I mount it like this: mountPage(/${a}, HomePage.class); but my problem
is that then all the resources, images, etc. that I use are not loaded
because I always arrive to the root HomePage code. So I'm force to place my
resources in an external server. Is there another way to do this? Second
point, when I go from my HomePage to other pages the parameters are
displayed, is there a way to hide them?

 Thanks!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/URL-with-root-parameters-tp4089764p4089764.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





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



Re: URL with root parameters

2011-11-21 Thread Per Newgro
For the first point: What is the goal? Load the css from external url or 
put it in the application?
The first should work with the link you've provided. If you want to load 
the css from within

the application you have to do some more.

First you have to introduce your css-resouce to the application:
YourApplication.java
  protected void init() {
super.init();
mountResource(acn/site/css/jquery.mobile-1.0a3.min.css, new 
PackageResourceReference(getClass(), res/js/jquery.mobile-1.0a3.min.css));

  }
/YourApplication.java

Hint: You can give the resource key a name not depending on version
(mountResource(acn/site/css/jquery.mobile.css, new 
PackageResourceReference(getClass(), 
res/js/jquery.mobile-1.0a3.min.css));)


Then you have to add the css to your page
YourPage.java
@Override
public void renderHead(IHeaderResponse response) {
super.renderHead(response);

response.renderCSSReference(acn/site/css/jquery.mobile-1.0a3.min.css, 
screen);

}
/YourPage.java

Hint: You don't need the stylesheet-link in markup anymore.

For the second point:
Hiding the parameters is not possible. You could set the parameters to 
the session or store them in a database.
So you could extract them on the other side. Would be interessting to 
get the cause of your requirement (Don't show the parameters)


Cheers
Per

Am 21.11.2011 10:44, schrieb intmanch:

This is the head of my HomePage.html:

html class=ui-mobile
  head
   titletagmagic.com/title
link rel=stylesheet
href=http://www.server.com/acn/site/css/jquery.mobile-1.0a3.min.css; /


  /head

As you can see I've to point the css and js to an external url as if I put
it as a resource in the java package is never loaded.

For the second part this is the code more or less:

HomePage.java

final PageParameters pp = new PageParameters();
pp.set(campaign, url, 0);
pp.set(box, b.getId(), 1);
Link link = new LinkVoid(linkbox) {
 @Override
  public void onClick() {
   setResponsePage(new FeedbackBoxPage(pp));
  }
};

In Application.java

  mountPage(/feedback/, FeedbackBoxPage.class);

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/URL-with-root-parameters-tp4089764p4091048.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





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



  1   2   3   4   >