Component.fatal(String message) doesnt work in wicket 6

2014-03-05 Thread chathuraka.waas
Hi,

i'm trying to migration my application from wicket 1.4 to 6.13 and it seems
previously worked messages are no longer working. 

my code uses somehting like this to add messages,

fatal(message);

can anyone describe what fatal() does since api documentation doesnt
describe it much. and also if there's anyway to fix this in wicket 6. 

thanks in advance.


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-fatal-String-message-doesnt-work-in-wicket-6-tp4664785.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Component.fatal(String message) doesnt work in wicket 6

2014-03-05 Thread Martin Grigorov
Hi,

It is not clear what is broken from your description.
Is there a compilation error or the functionality doesn't work ?

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 10:47 AM, chathuraka.waas
chathuraka.w...@gmail.comwrote:

 Hi,

 i'm trying to migration my application from wicket 1.4 to 6.13 and it seems
 previously worked messages are no longer working.

 my code uses somehting like this to add messages,

 fatal(message);

 can anyone describe what fatal() does since api documentation doesnt
 describe it much. and also if there's anyway to fix this in wicket 6.

 thanks in advance.


 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Component-fatal-String-message-doesnt-work-in-wicket-6-tp4664785.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: Component.fatal(String message) doesnt work in wicket 6

2014-03-05 Thread chathuraka.waas
Hi,

thanks for the reply. there are no compilation errors. the functionality
doesnt work as it used to be. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Component-fatal-String-message-doesnt-work-in-wicket-6-tp4664785p4664787.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Handling with Feedback Messages / setMaxMessages(1)-Problem / best practise

2014-03-05 Thread Patrick Davids
Hi François,
unfortunately this does not have any affect.

Still have all messages in sequence on reloading.

kind regards
Patrick

Am 04.03.2014 17:03, schrieb francois meillet:
 Session.get().getFeedbackMessages().clear();

 François


 On Tue, Mar 4, 2014 at 10:07 AM, Patrick Davids 
 patrick.dav...@nubologic.com wrote:

 Hi all,
 I would like to have a FeedbackPanel always showing only one error message.

 As seen in FeedbackPanel code setMaxMessages() does this.
 But it seems it does not clear the rest of messages after doing its job.

 When I have put 3 error messages on a page, only the first one is shown.
 This is what I want, but reloading the page, all other messages are
 shown in sequence as long as I reload the page and until all are processed.

 Is setMaxMessage() not the recommended way for what I want to do?
 How can I force a clear?

 thanx in advance :-)
 Patrick
 -
 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: Handling with Feedback Messages / setMaxMessages(1)-Problem / best practise

2014-03-05 Thread Martin Grigorov
Hi,

I don't know what is the idea behind #setMaxMessages(). I hoped someone
else would explain ...
To clear the messages you set to mark them as rendered:

fc = new FeedbackCollector(page);
fc.collect().foreach(fm - fm.markRendered())  // Java 8 syntax

You can put this code in some #onDetach() method.

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 11:14 AM, Patrick Davids 
patrick.dav...@nubologic.com wrote:

 Hi François,
 unfortunately this does not have any affect.

 Still have all messages in sequence on reloading.

 kind regards
 Patrick

 Am 04.03.2014 17:03, schrieb francois meillet:
  Session.get().getFeedbackMessages().clear();
 
  François
 
 
  On Tue, Mar 4, 2014 at 10:07 AM, Patrick Davids 
  patrick.dav...@nubologic.com wrote:
 
  Hi all,
  I would like to have a FeedbackPanel always showing only one error
 message.
 
  As seen in FeedbackPanel code setMaxMessages() does this.
  But it seems it does not clear the rest of messages after doing its job.
 
  When I have put 3 error messages on a page, only the first one is shown.
  This is what I want, but reloading the page, all other messages are
  shown in sequence as long as I reload the page and until all are
 processed.
 
  Is setMaxMessage() not the recommended way for what I want to do?
  How can I force a clear?
 
  thanx in advance :-)
  Patrick
  -
  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




Best practice for updating JPA object without persisting changes

2014-03-05 Thread Chris Snyder
I'm dealing with an issue that I'm sure has been solved by many people on
this list, but I'm struggling to ascertain the best way to solve it.

I'm working on implementing in-place-edit functionality for some of our
site content. The content is stored in a database and mapped via JPA. The
edit form has the JPA entity as the backing model object.

One of the features I'm implementing is the ability to preview what's been
entered in the form without the updates being committed to the database
(until the user explicitly clicks on the Save button). I can think of a
few ways to accomplish this:

1. Rollback the transaction when not saving - This would require me to
manage the transaction manually (right now, they're being managed
automatically by Guice's PersistFilter).

2. Detach the object from the persistence context, merge it to save - This
seems like the most elegant solution, but I can see how there could be
issues (not intractable) with lazy loading.

3. Prevent the form from updating the model until save - This would break
my preview panel, and seems to be contrary to how forms normally behave.

4. Copy the data into a non-managed DTO, copying it back to the JPA object
on save - Would require a lot of clone/copy code.

This seems like such a common problem to solve - I think my relative
unfamiliarity with JPA is the main stumbling block here. How have others
implemented it? Is there a best-practice pattern that my Googling didn't
discover?

Thanks in advance for the help. I hope that it isn't too off-topic since it
is mainly JPA-related.

Best,
Chris


Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread haiko

Hi Chris,

I would go for option 4. This is how I implement such cases. It has an  
explicit distinction between states 'previewMode' and 'commited Mode'.  
Looks like more coding, but actually is clear about distinction  
between preview and saved. And that would help the programmer that  
picks this code up a half year from now.


My 2 cents.

Best,

Haiko

Chris Snyder chris.sny...@biologos.org schreef:


I'm dealing with an issue that I'm sure has been solved by many people on
this list, but I'm struggling to ascertain the best way to solve it.

I'm working on implementing in-place-edit functionality for some of our
site content. The content is stored in a database and mapped via JPA. The
edit form has the JPA entity as the backing model object.

One of the features I'm implementing is the ability to preview what's been
entered in the form without the updates being committed to the database
(until the user explicitly clicks on the Save button). I can think of a
few ways to accomplish this:

1. Rollback the transaction when not saving - This would require me to
manage the transaction manually (right now, they're being managed
automatically by Guice's PersistFilter).

2. Detach the object from the persistence context, merge it to save - This
seems like the most elegant solution, but I can see how there could be
issues (not intractable) with lazy loading.

3. Prevent the form from updating the model until save - This would break
my preview panel, and seems to be contrary to how forms normally behave.

4. Copy the data into a non-managed DTO, copying it back to the JPA object
on save - Would require a lot of clone/copy code.

This seems like such a common problem to solve - I think my relative
unfamiliarity with JPA is the main stumbling block here. How have others
implemented it? Is there a best-practice pattern that my Googling didn't
discover?

Thanks in advance for the help. I hope that it isn't too off-topic since it
is mainly JPA-related.

Best,
Chris






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



Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread Patrick Davids
Hi Chris,
does the Guice's PersistFilter really automatically find and re-attach 
the backed object in the request while leaving the in-place-edit situation?

I thought... as long as nothing/nobody finds and re-attach the backed 
object, your changes are naturally temporary and only stored on page 
cache.

I would expect, it should already work out-of-the-box... But I did not 
work with Guice's PersistFilter, yet. May I miss something...

kind regards
Patrick

Am 05.03.2014 12:47, schrieb Chris Snyder:
 I'm dealing with an issue that I'm sure has been solved by many people on
 this list, but I'm struggling to ascertain the best way to solve it.

 I'm working on implementing in-place-edit functionality for some of our
 site content. The content is stored in a database and mapped via JPA. The
 edit form has the JPA entity as the backing model object.

 One of the features I'm implementing is the ability to preview what's been
 entered in the form without the updates being committed to the database
 (until the user explicitly clicks on the Save button). I can think of a
 few ways to accomplish this:

 1. Rollback the transaction when not saving - This would require me to
 manage the transaction manually (right now, they're being managed
 automatically by Guice's PersistFilter).

 2. Detach the object from the persistence context, merge it to save - This
 seems like the most elegant solution, but I can see how there could be
 issues (not intractable) with lazy loading.

 3. Prevent the form from updating the model until save - This would break
 my preview panel, and seems to be contrary to how forms normally behave.

 4. Copy the data into a non-managed DTO, copying it back to the JPA object
 on save - Would require a lot of clone/copy code.

 This seems like such a common problem to solve - I think my relative
 unfamiliarity with JPA is the main stumbling block here. How have others
 implemented it? Is there a best-practice pattern that my Googling didn't
 discover?

 Thanks in advance for the help. I hope that it isn't too off-topic since it
 is mainly JPA-related.

 Best,
 Chris


Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread Chris Snyder
Hi Patrick,

Thanks for the response.

does the Guice's PersistFilter really automatically find and re-attach
 the backed object in the request while leaving the in-place-edit situation?


Guice doesn't do anything with whether the objects are attached - I'm
simply never detaching them (unless I implement option #2), so any changes
made to the object are automatically persisted by the JPA engine. Guice's
role here is with transactions - the PersistFilter starts a transaction at
the beginning of the request, and commits it at the end.

Thanks,
Chris


On Wed, Mar 5, 2014 at 8:29 AM, Patrick Davids patrick.dav...@nubologic.com
 wrote:

 Hi Chris,

 I thought... as long as nothing/nobody finds and re-attach the backed
 object, your changes are naturally temporary and only stored on page
 cache.

 I would expect, it should already work out-of-the-box... But I did not
 work with Guice's PersistFilter, yet. May I miss something...

 kind regards
 Patrick

 Am 05.03.2014 12:47, schrieb Chris Snyder:
  I'm dealing with an issue that I'm sure has been solved by many people on
  this list, but I'm struggling to ascertain the best way to solve it.
 
  I'm working on implementing in-place-edit functionality for some of our
  site content. The content is stored in a database and mapped via JPA. The
  edit form has the JPA entity as the backing model object.
 
  One of the features I'm implementing is the ability to preview what's
 been
  entered in the form without the updates being committed to the database
  (until the user explicitly clicks on the Save button). I can think of a
  few ways to accomplish this:
 
  1. Rollback the transaction when not saving - This would require me to
  manage the transaction manually (right now, they're being managed
  automatically by Guice's PersistFilter).
 
  2. Detach the object from the persistence context, merge it to save -
 This
  seems like the most elegant solution, but I can see how there could be
  issues (not intractable) with lazy loading.
 
  3. Prevent the form from updating the model until save - This would break
  my preview panel, and seems to be contrary to how forms normally behave.
 
  4. Copy the data into a non-managed DTO, copying it back to the JPA
 object
  on save - Would require a lot of clone/copy code.
 
  This seems like such a common problem to solve - I think my relative
  unfamiliarity with JPA is the main stumbling block here. How have others
  implemented it? Is there a best-practice pattern that my Googling didn't
  discover?
 
  Thanks in advance for the help. I hope that it isn't too off-topic since
 it
  is mainly JPA-related.
 
  Best,
  Chris
 



Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread Chris Snyder
Hi Haiko,

Thanks for the response. You raise some good points - it certainly would be
cleaner and easier to understand. It also could be better for my layout,
given the way I've organized the code: The data layer is abstracted behind
a service API, so we could plug in a different storage engine (Cassandra
instead of JPA, for example) without needing to modify the other layers.
The editor code currently has no knowledge of JPA, so I'd have to expose
some of the business layer to implement either of my first two options.

Do you use any tools to make the copying easier, or do you code it by hand?

Thanks,
Chris

On Wed, Mar 5, 2014 at 8:07 AM, ha...@dds.nl wrote:

 Hi Chris,

 I would go for option 4. This is how I implement such cases. It has an
 explicit distinction between states 'previewMode' and 'commited Mode'.
 Looks like more coding, but actually is clear about distinction between
 preview and saved. And that would help the programmer that picks this code
 up a half year from now.

 My 2 cents.

 Best,

 Haiko

 Chris Snyder chris.sny...@biologos.org schreef:


  I'm dealing with an issue that I'm sure has been solved by many people on
 this list, but I'm struggling to ascertain the best way to solve it.

 I'm working on implementing in-place-edit functionality for some of our
 site content. The content is stored in a database and mapped via JPA. The
 edit form has the JPA entity as the backing model object.

 One of the features I'm implementing is the ability to preview what's been
 entered in the form without the updates being committed to the database
 (until the user explicitly clicks on the Save button). I can think of a
 few ways to accomplish this:

 1. Rollback the transaction when not saving - This would require me to
 manage the transaction manually (right now, they're being managed
 automatically by Guice's PersistFilter).

 2. Detach the object from the persistence context, merge it to save - This
 seems like the most elegant solution, but I can see how there could be
 issues (not intractable) with lazy loading.

 3. Prevent the form from updating the model until save - This would break
 my preview panel, and seems to be contrary to how forms normally behave.

 4. Copy the data into a non-managed DTO, copying it back to the JPA object
 on save - Would require a lot of clone/copy code.

 This seems like such a common problem to solve - I think my relative
 unfamiliarity with JPA is the main stumbling block here. How have others
 implemented it? Is there a best-practice pattern that my Googling didn't
 discover?

 Thanks in advance for the help. I hope that it isn't too off-topic since
 it
 is mainly JPA-related.

 Best,
 Chris






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




Unable to open resource stream (status=500)

2014-03-05 Thread Vit Rozkovec

Hi,
I came across interesting problem:

I have one project which is packaged as .jar file along with all 
required assets. The behavior inside this project is defined like this:


public class NprogressBehavior extends Behavior
{

 @Override
public void renderHead(Component component, IHeaderResponse response)
{
super.renderHead(component, response);

response.render(JavaScriptHeaderItem.forReference(new 
JavaScriptResourceReference(

NprogressBehavior.class, nprogress.js)));
response.render(JavaScriptHeaderItem.forReference(new 
JavaScriptResourceReference(

NprogressBehavior.class, nprogress-init.js)));
response.render(CssHeaderItem.forReference(new 
CssResourceReference(

NprogressBehavior.class, nprogress.css)));
}
}


Other project has defined the first project as dependency and in one 
page I simply add the NprogressBehavior behavior in onInitialize() method.


However this does not work and when using on my server throws following 
error:




WARN  - PackageResource- resource [path = 
cz/newforms/wicket/behaviors/nprogress.js, style = null, variation = 
null, locale = null]: Unable to open resource stream (status=500)



Is this intended behavior, eg. I cannot use resources like this - 
packaging behaviors with their according js and css files into one 
project, referencing this project in another project and using this 
behavior there?


Does all resources have to reside in the actual project where there are 
used? Seems strange to me. What am I doing wrong?


Thanks for any advice.
Vit


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



Re: Unable to open resource stream (status=500)

2014-03-05 Thread Martin Grigorov
Hi,

This should work fine.
Check that the .js file is properly packed in the .jar file next to
NprogressBehavior.class.


On Wed, Mar 5, 2014 at 5:41 PM, Vit Rozkovec rozkovec...@email.cz wrote:

 Hi,
 I came across interesting problem:

 I have one project which is packaged as .jar file along with all required
 assets. The behavior inside this project is defined like this:

 public class NprogressBehavior extends Behavior
 {

  @Override
 public void renderHead(Component component, IHeaderResponse response)
 {
 super.renderHead(component, response);

 response.render(JavaScriptHeaderItem.forReference(new
 JavaScriptResourceReference(
 NprogressBehavior.class, nprogress.js)));
 response.render(JavaScriptHeaderItem.forReference(new
 JavaScriptResourceReference(
 NprogressBehavior.class, nprogress-init.js)));
 response.render(CssHeaderItem.forReference(new
 CssResourceReference(
 NprogressBehavior.class, nprogress.css)));
 }
 }


 Other project has defined the first project as dependency and in one page
 I simply add the NprogressBehavior behavior in onInitialize() method.

 However this does not work and when using on my server throws following
 error:



 WARN  - PackageResource- resource [path =
 cz/newforms/wicket/behaviors/nprogress.js, style = null, variation =
 null, locale = null]: Unable to open resource

stream (status=500)


 Is this intended behavior, eg. I cannot use resources like this -
 packaging behaviors with their according js and css files into one project,
 referencing this project in another project and using this behavior there?

 Does all resources have to reside in the actual project where there are
 used? Seems strange to me. What am I doing wrong?

 Thanks for any advice.
 Vit


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




Re: css and js files in subproject

2014-03-05 Thread infiniter
Sorry, I forgot to mention that there are no Java classes inside that
project, so is it even possible to reference those assets?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/css-and-js-files-in-subproject-tp4664775p4664799.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to set meta tags prroperty for facebook and Open Graph?

2014-03-05 Thread -
On Wednesday 05 March 2014 08:54:44 Martin Grigorov wrote:

 
  BUT IT IS STILL STATIC, HOW I CAN MODIFY IT DINAMICALLY INTO THE JAVA CODE?
  I am sorry but I am new in wicket and it results so difficult for me. In
  PHP I can do it so quickly.
 
 
 New in Wicket: http://markmail.org/message/efxl7bgzfd3sy2ga
 For 3 years experience with Wicket you should have heart of Label component
 and models.
Yes, ok. But I use wicket for hobby, it is not my daily work.
I already use Label, but for write text into the page.
The Models in wicket is still a misterius for me, I read books, docs, but I 
still
not undenstand models, so I use it just as I see on docs, but I don't know how 
it works exatly.
If you can help me, I will appreciate a lot.

 The Hello World example shows how to use Label -
 http://wicket.apache.org/guide/guide/helloWorld.html#helloWorld_3
 Use a Label for each meta and use .setVisible(false) if any of them
 should be hidden when there is novalue for it.

I try to use Label with one item but it doesn't change meta tags, but simply 
write text on rendered webpage as first line.

html code:

...
meta property=og:type content=website static /
meta property=og:title content=title wicket:id=ogTitle /
...

java code:
...
public class Facebook extends Panel implements Serializable
{   private static final long serialVersionUID = 1L;

public Facebook(String id, String query, String in)
{
super(id);  
add(new Label(ogTitle,Title for facebook));
} 
} 


And this is the soucecode of the rendered webpage:
...
meta property=og:type content=website static /
meta property=og:title content=title wicket:id=ogTitleTitle for 
facebook/meta

meta ...



If I remove content=title it is almost the same:
...
meta property=og:type content=website static /
meta property=og:title wicket:id=ogTitleTitle for facebook/meta
meta ...


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



Re: css and js files in subproject

2014-03-05 Thread Martin Grigorov
It should be possible.
See how PackageResourceReference looks up the asset by using the 'scope'
class to load it as a resource.
You can roll your own resource reference that loads from the class path:
AnyClass.class.getClassLoader().getResource(/some/absolute/path/my.css)

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 5:55 PM, infiniter infini...@gmail.com wrote:

 Sorry, I forgot to mention that there are no Java classes inside that
 project, so is it even possible to reference those assets?

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/css-and-js-files-in-subproject-tp4664775p4664799.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread Igor Vaynberg
have a look here:

https://www.42lines.net/2011/12/01/simplifying-non-trivial-user-workflows-with-conversations/

-igor

On Wed, Mar 5, 2014 at 3:47 AM, Chris Snyder chris.sny...@biologos.org wrote:
 I'm dealing with an issue that I'm sure has been solved by many people on
 this list, but I'm struggling to ascertain the best way to solve it.

 I'm working on implementing in-place-edit functionality for some of our
 site content. The content is stored in a database and mapped via JPA. The
 edit form has the JPA entity as the backing model object.

 One of the features I'm implementing is the ability to preview what's been
 entered in the form without the updates being committed to the database
 (until the user explicitly clicks on the Save button). I can think of a
 few ways to accomplish this:

 1. Rollback the transaction when not saving - This would require me to
 manage the transaction manually (right now, they're being managed
 automatically by Guice's PersistFilter).

 2. Detach the object from the persistence context, merge it to save - This
 seems like the most elegant solution, but I can see how there could be
 issues (not intractable) with lazy loading.

 3. Prevent the form from updating the model until save - This would break
 my preview panel, and seems to be contrary to how forms normally behave.

 4. Copy the data into a non-managed DTO, copying it back to the JPA object
 on save - Would require a lot of clone/copy code.

 This seems like such a common problem to solve - I think my relative
 unfamiliarity with JPA is the main stumbling block here. How have others
 implemented it? Is there a best-practice pattern that my Googling didn't
 discover?

 Thanks in advance for the help. I hope that it isn't too off-topic since it
 is mainly JPA-related.

 Best,
 Chris

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



Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread Chris Snyder
Thanks, Igor - that's very helpful. Not sure how I missed that article
while I was searching.

It would be a bit tricky to implement in my situation (as I described in
another response, the JPA implementation of the data storage is abstracted
behind a service API), but I could make it work - perhaps by adding detach
and merge methods to the API; that would perhaps expose a little too much
of the implementation, but I think that other (hypothetical)
implementations could also need to expose similar functionality.

Of course, I might be over-engineering this whole abstraction anyways. I
have no intention of implementing a non-JPA version - perhaps I should
embrace a hard dependency on JPA and simplify everything. JPA is itself an
abstraction layer, after all...

Thanks,
Chris


On Wed, Mar 5, 2014 at 11:44 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 have a look here:


 https://www.42lines.net/2011/12/01/simplifying-non-trivial-user-workflows-with-conversations/

 -igor

 On Wed, Mar 5, 2014 at 3:47 AM, Chris Snyder chris.sny...@biologos.org
 wrote:
  I'm dealing with an issue that I'm sure has been solved by many people on
  this list, but I'm struggling to ascertain the best way to solve it.
 
  I'm working on implementing in-place-edit functionality for some of our
  site content. The content is stored in a database and mapped via JPA. The
  edit form has the JPA entity as the backing model object.
 
  One of the features I'm implementing is the ability to preview what's
 been
  entered in the form without the updates being committed to the database
  (until the user explicitly clicks on the Save button). I can think of a
  few ways to accomplish this:
 
  1. Rollback the transaction when not saving - This would require me to
  manage the transaction manually (right now, they're being managed
  automatically by Guice's PersistFilter).
 
  2. Detach the object from the persistence context, merge it to save -
 This
  seems like the most elegant solution, but I can see how there could be
  issues (not intractable) with lazy loading.
 
  3. Prevent the form from updating the model until save - This would break
  my preview panel, and seems to be contrary to how forms normally behave.
 
  4. Copy the data into a non-managed DTO, copying it back to the JPA
 object
  on save - Would require a lot of clone/copy code.
 
  This seems like such a common problem to solve - I think my relative
  unfamiliarity with JPA is the main stumbling block here. How have others
  implemented it? Is there a best-practice pattern that my Googling didn't
  discover?
 
  Thanks in advance for the help. I hope that it isn't too off-topic since
 it
  is mainly JPA-related.
 
  Best,
  Chris

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




-- 
Chris Snyder
Web Developer, BioLogos
616.328.5218 x203
biologos.org


Re: Problems with Page Expiration

2014-03-05 Thread Brad Grier
Martin Grigorov-4 wrote
 If the login page is really stateless then it will never throw
 PageExpiredException.
 It seems some component/behavior in the login page is stateful.
 
 Use org.apache.wicket.devutils.stateless.StatelessChecker
 (wicket-devutils)
 or debug org.apache.wicket.Page#isPageStateless() to find why the page is
 stateful

Thanks for the response. I suspected as much but when I put a breakpoint in
isPageStateless(), it always returns true for each call made when I refresh
the login page. Again, with setRecreateMountedPagesAfterExpiry set to false,
pressing the login button always takes me to the timout page set by
setPageExpiredErrorPage.

I don't get it. Initially I thought it was something in our templating
mechanism. Our platform allows an advanced user to design the login screen.
I skipped that and reduced my test to just a StatelessForm on a page. Same
result. The page is a subclass and makes use of wicket:extend but the
parent class doesn't do anything but set the page title. I've checked my
authorization strategy and I don't see anything problematic.

No doubt it will be something silly but at the moment I'm perplexed.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problems-with-Page-Expiration-tp4664774p4664807.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Unable to open resource stream (status=500)

2014-03-05 Thread Vit Rozkovec

Yes it is.

The file is in the package, checked the war and also the dir where war 
contents are unpacked. Running on linux with Jetty webserver and Apache 
as a proxy.


Also when inspecting page with firebug, it does not have altered name 
with version number included as other resources have, such as

../wicket/resource/name.berries.projects.kaplickyprize.references.KaplickyCssResourceReference/file-upload-ver-ECB4619F0CA76E0EE037BD81A9515B42.css

the address is
../wicket/resource/cz.newforms.wicket.behaviors.NprogressBehavior/nprogress.js

but I guess it is because it could not be found.



On 5.3.2014 16:48, Martin Grigorov wrote:

Hi,

This should work fine.
Check that the .js file is properly packed in the .jar file next to
NprogressBehavior.class.


On Wed, Mar 5, 2014 at 5:41 PM, Vit Rozkovec rozkovec...@email.cz wrote:


Hi,
I came across interesting problem:

I have one project which is packaged as .jar file along with all required
assets. The behavior inside this project is defined like this:

public class NprogressBehavior extends Behavior
{

  @Override
 public void renderHead(Component component, IHeaderResponse response)
 {
 super.renderHead(component, response);

 response.render(JavaScriptHeaderItem.forReference(new
JavaScriptResourceReference(
 NprogressBehavior.class, nprogress.js)));
 response.render(JavaScriptHeaderItem.forReference(new
JavaScriptResourceReference(
 NprogressBehavior.class, nprogress-init.js)));
 response.render(CssHeaderItem.forReference(new
CssResourceReference(
 NprogressBehavior.class, nprogress.css)));
 }
}


Other project has defined the first project as dependency and in one page
I simply add the NprogressBehavior behavior in onInitialize() method.

However this does not work and when using on my server throws following
error:



WARN  - PackageResource- resource [path =
cz/newforms/wicket/behaviors/nprogress.js, style = null, variation =
null, locale = null]: Unable to open resource

stream (status=500)


Is this intended behavior, eg. I cannot use resources like this -
packaging behaviors with their according js and css files into one project,
referencing this project in another project and using this behavior there?

Does all resources have to reside in the actual project where there are
used? Seems strange to me. What am I doing wrong?

Thanks for any advice.
Vit


-
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: Confirm Navigation pop up dialog box

2014-03-05 Thread msalman
Thanks you very much.  That worked very nicely.  Good to not see the page
refreshing any more and the jerk that goes with it.

I always wondering what is the difference between 'setOutputMarkupId' and
'setOutputMarkupPlaceholderTag'. So this issue explains it.  Can I always
use 'setOutputMarkupPlaceholderTag' or are there instances where I can only
use 'setOutputMarkupId'??

Thanks again.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Confirm-Navigation-pop-up-dialog-box-tp4664778p4664809.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Best practice for updating JPA object without persisting changes

2014-03-05 Thread Igor Vaynberg
you simple need to change where the entitymanager instance lives, and
control it via cdi conversation api. no need to expose any more of the
jpa stuff.

-igor

On Wed, Mar 5, 2014 at 9:06 AM, Chris Snyder chris.sny...@biologos.org wrote:
 Thanks, Igor - that's very helpful. Not sure how I missed that article
 while I was searching.

 It would be a bit tricky to implement in my situation (as I described in
 another response, the JPA implementation of the data storage is abstracted
 behind a service API), but I could make it work - perhaps by adding detach
 and merge methods to the API; that would perhaps expose a little too much
 of the implementation, but I think that other (hypothetical)
 implementations could also need to expose similar functionality.

 Of course, I might be over-engineering this whole abstraction anyways. I
 have no intention of implementing a non-JPA version - perhaps I should
 embrace a hard dependency on JPA and simplify everything. JPA is itself an
 abstraction layer, after all...

 Thanks,
 Chris


 On Wed, Mar 5, 2014 at 11:44 AM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 have a look here:


 https://www.42lines.net/2011/12/01/simplifying-non-trivial-user-workflows-with-conversations/

 -igor

 On Wed, Mar 5, 2014 at 3:47 AM, Chris Snyder chris.sny...@biologos.org
 wrote:
  I'm dealing with an issue that I'm sure has been solved by many people on
  this list, but I'm struggling to ascertain the best way to solve it.
 
  I'm working on implementing in-place-edit functionality for some of our
  site content. The content is stored in a database and mapped via JPA. The
  edit form has the JPA entity as the backing model object.
 
  One of the features I'm implementing is the ability to preview what's
 been
  entered in the form without the updates being committed to the database
  (until the user explicitly clicks on the Save button). I can think of a
  few ways to accomplish this:
 
  1. Rollback the transaction when not saving - This would require me to
  manage the transaction manually (right now, they're being managed
  automatically by Guice's PersistFilter).
 
  2. Detach the object from the persistence context, merge it to save -
 This
  seems like the most elegant solution, but I can see how there could be
  issues (not intractable) with lazy loading.
 
  3. Prevent the form from updating the model until save - This would break
  my preview panel, and seems to be contrary to how forms normally behave.
 
  4. Copy the data into a non-managed DTO, copying it back to the JPA
 object
  on save - Would require a lot of clone/copy code.
 
  This seems like such a common problem to solve - I think my relative
  unfamiliarity with JPA is the main stumbling block here. How have others
  implemented it? Is there a best-practice pattern that my Googling didn't
  discover?
 
  Thanks in advance for the help. I hope that it isn't too off-topic since
 it
  is mainly JPA-related.
 
  Best,
  Chris

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




 --
 Chris Snyder
 Web Developer, BioLogos
 616.328.5218 x203
 biologos.org

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



Re: Unable to open resource stream (status=500)

2014-03-05 Thread Martin Grigorov
Try to reproduce it in a quickstart and attach it to Jira.

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 7:13 PM, Vit Rozkovec rozkovec...@email.cz wrote:

 Yes it is.

 The file is in the package, checked the war and also the dir where war
 contents are unpacked. Running on linux with Jetty webserver and Apache as
 a proxy.

 Also when inspecting page with firebug, it does not have altered name with
 version number included as other resources have, such as
 ../wicket/resource/name.berries.projects.kaplickyprize.references.
 KaplickyCssResourceReference/file-upload-ver-
 ECB4619F0CA76E0EE037BD81A9515B42.css

 the address is
 ../wicket/resource/cz.newforms.wicket.behaviors.
 NprogressBehavior/nprogress.js

 but I guess it is because it could not be found.




 On 5.3.2014 16:48, Martin Grigorov wrote:

 Hi,

 This should work fine.
 Check that the .js file is properly packed in the .jar file next to
 NprogressBehavior.class.


 On Wed, Mar 5, 2014 at 5:41 PM, Vit Rozkovec rozkovec...@email.cz
 wrote:

  Hi,
 I came across interesting problem:

 I have one project which is packaged as .jar file along with all required
 assets. The behavior inside this project is defined like this:

 public class NprogressBehavior extends Behavior
 {

   @Override
  public void renderHead(Component component, IHeaderResponse
 response)
  {
  super.renderHead(component, response);

  response.render(JavaScriptHeaderItem.forReference(new
 JavaScriptResourceReference(
  NprogressBehavior.class, nprogress.js)));
  response.render(JavaScriptHeaderItem.forReference(new
 JavaScriptResourceReference(
  NprogressBehavior.class, nprogress-init.js)));
  response.render(CssHeaderItem.forReference(new
 CssResourceReference(
  NprogressBehavior.class, nprogress.css)));
  }
 }


 Other project has defined the first project as dependency and in one page
 I simply add the NprogressBehavior behavior in onInitialize() method.

 However this does not work and when using on my server throws following
 error:



 WARN  - PackageResource- resource [path =
 cz/newforms/wicket/behaviors/nprogress.js, style = null, variation =
 null, locale = null]: Unable to open resource

 stream (status=500)


 Is this intended behavior, eg. I cannot use resources like this -
 packaging behaviors with their according js and css files into one
 project,
 referencing this project in another project and using this behavior
 there?

 Does all resources have to reside in the actual project where there are
 used? Seems strange to me. What am I doing wrong?

 Thanks for any advice.
 Vit


 -
 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: Problems with Page Expiration

2014-03-05 Thread Martin Grigorov
Try to reproduce it in a quickstart and attach it to Jira.

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 7:14 PM, Brad Grier brad.gr...@salusnovus.comwrote:

 Martin Grigorov-4 wrote
  If the login page is really stateless then it will never throw
  PageExpiredException.
  It seems some component/behavior in the login page is stateful.
 
  Use org.apache.wicket.devutils.stateless.StatelessChecker
  (wicket-devutils)
  or debug org.apache.wicket.Page#isPageStateless() to find why the page is
  stateful

 Thanks for the response. I suspected as much but when I put a breakpoint in
 isPageStateless(), it always returns true for each call made when I refresh
 the login page. Again, with setRecreateMountedPagesAfterExpiry set to
 false,
 pressing the login button always takes me to the timout page set by
 setPageExpiredErrorPage.

 I don't get it. Initially I thought it was something in our templating
 mechanism. Our platform allows an advanced user to design the login screen.
 I skipped that and reduced my test to just a StatelessForm on a page. Same
 result. The page is a subclass and makes use of wicket:extend but the
 parent class doesn't do anything but set the page title. I've checked my
 authorization strategy and I don't see anything problematic.

 No doubt it will be something silly but at the moment I'm perplexed.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Problems-with-Page-Expiration-tp4664774p4664807.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: Confirm Navigation pop up dialog box

2014-03-05 Thread Martin Grigorov
If you make a component invisible and want to make it visible later with
Ajax then you need setOutputMarkupPlaceholderTag

Martin Grigorov
Wicket Training and Consulting


On Wed, Mar 5, 2014 at 8:06 PM, msalman mohammad_sal...@yahoo.com wrote:

 Thanks you very much.  That worked very nicely.  Good to not see the page
 refreshing any more and the jerk that goes with it.

 I always wondering what is the difference between 'setOutputMarkupId' and
 'setOutputMarkupPlaceholderTag'. So this issue explains it.  Can I always
 use 'setOutputMarkupPlaceholderTag' or are there instances where I can only
 use 'setOutputMarkupId'??

 Thanks again.

 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Confirm-Navigation-pop-up-dialog-box-tp4664778p4664809.html
 Sent from the Users forum mailing list archive at Nabble.com.

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




Re: How to set meta tags prroperty for facebook and Open Graph?

2014-03-05 Thread Andrea Del Bene

Hi,

what you miss now are attribute modifiers to change the value of meta 
tag attributes. For example if you want to change the content of 
attribute 'content' you can use the following label and attribute modifier:


new Label(ogTitle).add(AttributeModifier.replace(content, Title for 
facebook))


The final markup will be:

meta property=og:title content=Title for facebook 
wicket:id=ogTitle //meta


.
I try to use Label with one item but it doesn't change meta tags, but simply 
write text on rendered webpage as first line.

html code:

...
meta property=og:type content=website static /
meta property=og:title content=title wicket:id=ogTitle /
...

java code:
...
public class Facebook extends Panel implements Serializable
{   private static final long serialVersionUID = 1L;

public Facebook(String id, String query, String in)
{
super(id);  
add(new Label(ogTitle,Title for facebook));
}
}


And this is the soucecode of the rendered webpage:
...
meta property=og:type content=website static /
meta property=og:title content=title wicket:id=ogTitleTitle for 
facebook/meta

meta ...



If I remove content=title it is almost the same:
...
meta property=og:type content=website static /
meta property=og:title wicket:id=ogTitleTitle for facebook/meta
meta ...


-
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 set meta tags prroperty for facebook and Open Graph?

2014-03-05 Thread Martin Grigorov
On Wed, Mar 5, 2014 at 8:44 PM, Andrea Del Bene an.delb...@gmail.comwrote:

 Hi,

 what you miss now are attribute modifiers to change the value of meta tag
 attributes. For example if you want to change the content of attribute
 'content' you can use the following label and attribute modifier:

 new Label(ogTitle).add(AttributeModifier.replace(content, Title for
 facebook))


Better create custom component by extending WebComponent and overriding
#onComponentTag() to add the attributes.
It is much lighter than adding behavior.
But maybe this is too advanced for now...



 The final markup will be:

 meta property=og:title content=Title for facebook wicket:id=ogTitle
 //meta


 .
 I try to use Label with one item but it doesn't change meta tags, but
 simply write text on rendered webpage as first line.

 html code:

 ...
 meta property=og:type content=website static /
 meta property=og:title content=title wicket:id=ogTitle /
 ...

 java code:
 ...
 public class Facebook extends Panel implements Serializable
 {   private static final long serialVersionUID = 1L;

 public Facebook(String id, String query, String in)
 {
 super(id);
 add(new Label(ogTitle,Title for facebook));
 }
 }


 And this is the soucecode of the rendered webpage:
 ...
 meta property=og:type content=website static /
 meta property=og:title content=title wicket:id=ogTitleTitle for
 facebook/meta

 meta ...



 If I remove content=title it is almost the same:
 ...
 meta property=og:type content=website static /
 meta property=og:title wicket:id=ogTitleTitle for facebook/meta
 meta ...


 -
 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




Fw: Frameworks Track at ApacheCon Denver

2014-03-05 Thread Melissa Warnkin
For the Frameworks Track Enthusiasts, 


As you are no doubt aware, ApacheCon North America will be held in Denver, 
Colorado starting on April 7th.  Frameworks has 9 talks; check it out here:  
http://apacheconnorthamerica2014.sched.org/overview/type/frameworks#.UxcbgYV9JUE

We would love to see you in Denver next month.  Register soon, as prices go up 
on March 14th. http://na.apachecon.com/.

Best regards,

Melissa
ApacheCon Planning Team

Re: Problems with Page Expiration

2014-03-05 Thread Brad Grier
Martin Grigorov-4 wrote
 Try to reproduce it in a quickstart and attach it to Jira.
 
 Martin Grigorov
 Wicket Training and Consulting

I created a quickstart using the Wicket Examples statelessform page as the
home page. If setRecreateMountedPagesAfterExpiry is false, the page expires
on form submit. 

I'll submit the quickstart but I still find it hard to believe it's a bug.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Problems-with-Page-Expiration-tp4664774p4664820.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



Pure in-memory IPageStore implementation?

2014-03-05 Thread Tom Götz
Hi there,

I have an application that doesn’t need back-button support and also has 
several domain objects that are not meant to be serialized. I thought it could 
be a good idea to implement an IPageStore that skips serialization and simply 
keeps the last n pages in memory (where n might be 5-10 e.g.). Does this sound 
like a reasonable plan or do you see any pitfalls with that approach?

What about ajax requests (I’m using a lot of them)? Let’s say n=5, i.e. I’m 
storing (only) the last 5 pages in memory, without serialization to disk. I 
start a page, pageId==1, then I’m doing 10 ajax requests on the page. Now when 
the user does a page reload, will he run into a PageExpiredException because 
the requested page with id=1 is not available any more in my pageStore?

Cheers,
   -Tom



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



Re: Pure in-memory IPageStore implementation?

2014-03-05 Thread Martin Grigorov
Hi,


On Thu, Mar 6, 2014 at 9:29 AM, Tom Götz t...@decoded.de wrote:

 Hi there,

 I have an application that doesn’t need back-button support and also has
 several domain objects that are not meant to be serialized. I thought it
 could be a good idea to implement an IPageStore that skips serialization
 and simply keeps the last n pages in memory (where n might be 5-10 e.g.).
 Does this sound like a reasonable plan or do you see any pitfalls with that
 approach?


Where you will store the pages ?
I guess you will put them in the Session. Be aware that the Wicket Session
is stored as an attribute in the Http session. You will need custom
ISessionStore if you want to avoid this. If you put non-Serializable
objects in the http session then you have to make sure the http session is
not replicated by your web container.



 What about ajax requests (I’m using a lot of them)? Let’s say n=5, i.e.
 I’m storing (only) the last 5 pages in memory, without serialization to
 disk. I start a page, pageId==1, then I’m doing 10 ajax requests on the
 page. Now when the user does a page reload, will he run into a
 PageExpiredException because the requested page with id=1 is not available
 any more in my pageStore?


This is not how it works!
Initially you store page with id X. In Ajax requests the pageId is not
incremented, so after Ajax request the old page instance will be overridden
by the new one (the one with the modifications done in the ajax request)
because it has the same pageId.
So in your example when the user does page reload (s)he will see the last
version of the page, i.e. the state after the last Ajax request. All
previous states will be gone.

All this is valid only if you use the same composite key for the page store
- sessionId+pageId.



 Cheers,
-Tom



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




Re: Pure in-memory IPageStore implementation?

2014-03-05 Thread Ernesto Reinaldo Barreiro
Hi,

Why not simply use LDMs to avoid entities serializations... Al my entities
are non-serializable. This way I ensure I never serialize one, which might
be dangerous as far as I can see.


On Thu, Mar 6, 2014 at 8:29 AM, Tom Götz t...@decoded.de wrote:

 Hi there,

 I have an application that doesn't need back-button support and also has
 several domain objects that are not meant to be serialized. I thought it
 could be a good idea to implement an IPageStore that skips serialization
 and simply keeps the last n pages in memory (where n might be 5-10 e.g.).
 Does this sound like a reasonable plan or do you see any pitfalls with that
 approach?

 What about ajax requests (I'm using a lot of them)? Let's say n=5, i.e.
 I'm storing (only) the last 5 pages in memory, without serialization to
 disk. I start a page, pageId==1, then I'm doing 10 ajax requests on the
 page. Now when the user does a page reload, will he run into a
 PageExpiredException because the requested page with id=1 is not available
 any more in my pageStore?

 Cheers,
-Tom



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




-- 
Regards - Ernesto Reinaldo Barreiro