handling Wicket response

2010-04-04 Thread Alex Zeit
Dear All,
How to insert Wicket response into div tag on the page served outside of
Wickets.
This static page looks as follows:

script type='text/javascript'
var request;
function doSomeRequest(servletName){
var servlet = servletName;//the name (URI) of your
servlet
var req = servlet;   //compiling the request
addrequest(req);  //calls the addrequest
function
//request.onreadystatechange = function(){  //this is used to listen for
changes in the request's status
//document.getElementById('test').innerHTML = req.responseText;
//}
if (req.readyState == 4) {
document.getElementById('test').innerHTML = req.responseText;
}
else
alert(loading +req.statusText);

}

function addrequest(req) {
try {  //create a request for
netscape, mozilla, opera, etc.
request = new XMLHttpRequest();
}catch (e) {

try {  //create a request for
internet explorer
request = new ActiveXObject(Microsoft.XMLHTTP);
}catch (e) {   //do some error-handling
alert(XMLHttpRequest error:  + e);
}
}
request.open(GET, req, true); //prepare the request
request.send(null);   //send it
return request;   //return the request
}
/script

form name=TestForm action=
input type=button value=Call wicket page onclick=doSomeRequest('
http://localhost:8080/?wicket:bookmarkablePage=:wicketqs.Page1username=John'
)
/form

div id=test
/div

Page1.java:
public class Page1 extends WebPage {
public Page1(final PageParameters parameters) {
add(new Label(message1, User name is
+parameters.getString(username)));
}

}

Page1.html:
html xmlns:wicket=
http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; 
head
titleHomepage/title
/head
body
span wicket:id=message1message will be here/span
/body
/html

Thank you very much in advance
Alex


Re: Click link

2010-04-04 Thread Mathias Nilsson

I solved it. I needed to set return false; in the javascript to get it to
work in all browsers.


-- 
View this message in context: 
http://old.nabble.com/Click-link-tp28127635p28132265.html
Sent from the Wicket - User 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: DynamicWizards and Forms

2010-04-04 Thread Sumit Raja
Yes but they don't cover the scenario where the new wizard step is submitted 
even before it is displayed.

Investigated this a bit further and it seems that the delegation by the model 
to the actual wizard step does not happen in the correct order.  I'll try and 
recreate this with a very simple dynamic wizard and work from there.


On 2 Apr 2010, at 18:36, Jeremy Thomerson wrote:

 have you looked at the wizard examples in the wicket-examples package?
 http://www.wicket-library.com/wicket-examples/
 
 --
 Jeremy Thomerson
 http://www.wickettraining.com
 
 
 
 On Thu, Apr 1, 2010 at 8:49 AM, Sumit Raja sumitr...@gmail.com wrote:
 
 Hello,
 I am trying to get a dynamic wizard to work with a series of forms. I
 have the following flow:
 (1) Select document type - (2) if document type has embedded audio
 provide an upload form otherwise skip - (3) Document editing form.
 
 In next() of step 1 I am creating a new Panel with a form of either
 upload or of document editing based on doc type. The odd thing is that
 the submit on the form for step 2/3 seems to get called when next is
 clicked on (1) but before the step (2 or 3) is displayed.
 
 Looking through the code the if appears that the next() method gets
 called before the actual form processing is performed meaning that the
 form on the next step gets processed as well as the last step. In
 delegateSubmit(), formToProcess.visitChildren seems to be the actual
 place that the next step from gets submitted, before the previous step
 processing is complete.
 
 What is the correct way to structure a Dynamic wizard when each step
 has nested forms to prevent the visitor submitting the form on the
 next step as well?
 
 Thanks
 
 Sumit
 
 -
 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: Click link

2010-04-04 Thread James Carman
For this, why are you having to write your own JavaScript?

On Sun, Apr 4, 2010 at 6:00 AM, Mathias Nilsson
wicket.program...@gmail.com wrote:

 I solved it. I needed to set return false; in the javascript to get it to
 work in all browsers.


 --
 View this message in context: 
 http://old.nabble.com/Click-link-tp28127635p28132265.html
 Sent from the Wicket - User 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



Wicket GAE performance

2010-04-04 Thread Ian Marshall

I have a static initialisation method and two static data members as follows:

  public class DataExchange
  {
private static final Object objLockPMF = new Object();
private static volatile PersistenceManagerFactory g_pmf = null;
  
/**
 * If this class's static singleton
codePersistenceManagerFactory/code
 * is codenull/code, then construct it in a synchronised block of
code.
 * @return
 *   This class's static singleton
codePersistenceManagerFactory/code.
 */
public static PersistenceManagerFactory getPersistenceManagerFactory()
{
  if (g_pmf == null)
synchronized(objLockPMF)
{
  if (g_pmf == null)
  {
loadProperties();// My method which loads the string
g_sDatabaseMode
g_pmf = JDOHelper.getPersistenceManagerFactory(g_sDatabaseMode);
  }
}
  
  return g_pmf;
}
  }


I then call the above static method when my Wicket application initiates by
creating a queued task which calls this method fairly immediately but
asynchronously. I ensure that my home page performs no data exchange, so
creating the PMF does not delay the showing of the first page.

I also call the above static method at the start of every data exchange.
There will be nothing to construct unless the queued task has not yet
finished or GAE has shut the relevant Wicket application instance down. For
example (which will not be a surprise) when using a transaction:

  PersistenceManager pm =
   DataExchange.getPersistenceManagerFactory().getPersistenceManager();
  Transaction tx = pm.currentTransaction();

  try
  {
tx.begin();

//
// Persistence code
//

tx.commit();
  }
  finally
  {
try
{
  if (tx.isActive())// Because of an exception, say
tx.rollback();
}
finally
{
  pm.close();
}
  }


Enjoy,

Ian



intmanch wrote:
 
 Hi Ian,
 
 Thanks a lot for your response. I use as you PMF, not JPA, that's quite
 simple and easy to use. Can you give me more details (code snippet) about
 the initialization of the PMF? Is there any other point to take into
 consideration for the performance?
 
-- 
View this message in context: 
http://old.nabble.com/Wicket-GAE-performance-tp28118591p28133464.html
Sent from the Wicket - User 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: Image Upload Using TinyMCE Within Wicket Framework

2010-04-04 Thread Andreas Petersson

Looks very helpful on first sight.
maybe it would make sense to release the used code in the form of a 
wicketstuff project, for better accessability for developers.



I wrote an article for following topic:
Image upload using TinyMce within Wicket Framework
Article is based on functionality which i wrote to my project. I wrote it
since during investigation i saw high demand for such fuctionality.
I hope it will be helpful :) Any comments are welcome :)

http://java.dzone.com/articles/image-upload-using-tinymce



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



Re: DynamicWizards and Forms

2010-04-04 Thread Jeremy Thomerson
If you can recreate it in a quickstart, you can send it to the list and we
can get a better idea of what you mean.

--
Jeremy Thomerson
http://www.wickettraining.com



On Sun, Apr 4, 2010 at 5:41 AM, Sumit Raja sumitr...@gmail.com wrote:

 Yes but they don't cover the scenario where the new wizard step is
 submitted even before it is displayed.

 Investigated this a bit further and it seems that the delegation by the
 model to the actual wizard step does not happen in the correct order.  I'll
 try and recreate this with a very simple dynamic wizard and work from there.


 On 2 Apr 2010, at 18:36, Jeremy Thomerson wrote:

  have you looked at the wizard examples in the wicket-examples package?
  http://www.wicket-library.com/wicket-examples/
 
  --
  Jeremy Thomerson
  http://www.wickettraining.com
 
 
 
  On Thu, Apr 1, 2010 at 8:49 AM, Sumit Raja sumitr...@gmail.com wrote:
 
  Hello,
  I am trying to get a dynamic wizard to work with a series of forms. I
  have the following flow:
  (1) Select document type - (2) if document type has embedded audio
  provide an upload form otherwise skip - (3) Document editing form.
 
  In next() of step 1 I am creating a new Panel with a form of either
  upload or of document editing based on doc type. The odd thing is that
  the submit on the form for step 2/3 seems to get called when next is
  clicked on (1) but before the step (2 or 3) is displayed.
 
  Looking through the code the if appears that the next() method gets
  called before the actual form processing is performed meaning that the
  form on the next step gets processed as well as the last step. In
  delegateSubmit(), formToProcess.visitChildren seems to be the actual
  place that the next step from gets submitted, before the previous step
  processing is complete.
 
  What is the correct way to structure a Dynamic wizard when each step
  has nested forms to prevent the visitor submitting the form on the
  next step as well?
 
  Thanks
 
  Sumit
 
  -
  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: Click link

2010-04-04 Thread Mathias Nilsson

What is your suggestion?
-- 
View this message in context: 
http://old.nabble.com/Click-link-tp28127635p28133755.html
Sent from the Wicket - User 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: Click link

2010-04-04 Thread James Carman
Sorry, I didn't notice the part where you're looking for the enter key
to be pressed.  I thought you were just looking to do the callback on
any key press.  You might want to override getPreconditionScript() to
check for that key code, though.  That might be a bit cleaner and a
bit less brittle.

On Sun, Apr 4, 2010 at 8:11 PM, Mathias Nilsson
wicket.program...@gmail.com wrote:

 What is your suggestion?
 --
 View this message in context: 
 http://old.nabble.com/Click-link-tp28127635p28133755.html
 Sent from the Wicket - User 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: Any mature work on integrating Hibernate Validator with Wicket?

2010-04-04 Thread David Chang
Found another related work.

http://42lines.net/content/integrating-hibernate-validator-and-wicket

Any comment or pointers regarding relatively mature work in this regard?

Regards.


--- On Sat, 4/3/10, David Chang david_q_zh...@yahoo.com wrote:

 From: David Chang david_q_zh...@yahoo.com
 Subject: Any mature work on integrating Hibernate Validator with Wicket?
 To: users@wicket.apache.org
 Date: Saturday, April 3, 2010, 1:45 PM
 
 Is there any mature work on integrating Hibernate
 Validator with Wicket?
 
 I am unable to find any at wicketstuff. Googled and found
 this work is interesting.
 
 http://carinae.net/tag/hibernate-validator/
 
 Any pointers?
 
 Any comment?
 
 Thanks and Happy Easter!
 
 
       
 
 -
 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



SOLVED: handling Wicket response

2010-04-04 Thread Alex Zeit
It was silly error in JavaScript. Wicket page embeds into div like a charm
this way.
The correct JS:
function doSomeRequest(servletName){
var servlet =
servletName+document.attributeform.username.value;//the name
(URI) of your servlet
var req = servlet;
   //compiling the request
var request =
addrequest(req);
//calls the addrequest function
request.onreadystatechange =
function(){//this is
used to listen for changes in the request's status
 if (request.readyState == 4) {
if (request.status == 200) {
   document.getElementById('test').innerHTML =
request.responseText;
}
 }
}
}

function addrequest(req) {
var request;
try { //create a request for
netscape, mozilla, opera, etc.
request = new XMLHttpRequest();
}catch (e) {

try { //create a request for
internet explorer
request = new ActiveXObject(Microsoft.XMLHTTP);
}catch (e) {   //do some error-handling
alert(XMLHttpRequest error:  + e);
}
}

request.open(GET, req, true);   //prepare the request
request.send(null);   //send it
return request;   //return the request
}
/script


Re: Wicket GAE performance

2010-04-04 Thread Anton Veretennikov
Hello, i'm working with GAE too, may i clarify something?

Transaction tx = pm.currentTransaction();

This is a transaction of every session?
If no, how may i handle this situation:

When one user is accessing a page i must return data from one entity from
the datastore, then close it from returning to any other users. What can be
done here?

-- Tony.



On Mon, Apr 5, 2010 at 12:08 AM, Ian Marshall ianmarshall...@gmail.comwrote:


 I have a static initialisation method and two static data members as
 follows:

  public class DataExchange
  {
private static final Object objLockPMF = new Object();
private static volatile PersistenceManagerFactory g_pmf = null;

/**
 * If this class's static singleton
 codePersistenceManagerFactory/code
 * is codenull/code, then construct it in a synchronised block of
 code.
 * @return
 *   This class's static singleton
 codePersistenceManagerFactory/code.
 */
public static PersistenceManagerFactory getPersistenceManagerFactory()
{
  if (g_pmf == null)
synchronized(objLockPMF)
{
  if (g_pmf == null)
  {
loadProperties();// My method which loads the string
 g_sDatabaseMode
g_pmf = JDOHelper.getPersistenceManagerFactory(g_sDatabaseMode);
  }
}

  return g_pmf;
}
  }


 I then call the above static method when my Wicket application initiates by
 creating a queued task which calls this method fairly immediately but
 asynchronously. I ensure that my home page performs no data exchange, so
 creating the PMF does not delay the showing of the first page.

 I also call the above static method at the start of every data exchange.
 There will be nothing to construct unless the queued task has not yet
 finished or GAE has shut the relevant Wicket application instance down. For
 example (which will not be a surprise) when using a transaction:

  PersistenceManager pm =
   DataExchange.getPersistenceManagerFactory().getPersistenceManager();
  Transaction tx = pm.currentTransaction();

  try
  {
tx.begin();

//
// Persistence code
//

tx.commit();
  }
  finally
  {
try
{
  if (tx.isActive())// Because of an exception, say
tx.rollback();
}
finally
{
  pm.close();
}
  }


 Enjoy,

 Ian



 intmanch wrote:
 
  Hi Ian,
 
  Thanks a lot for your response. I use as you PMF, not JPA, that's quite
  simple and easy to use. Can you give me more details (code snippet) about
  the initialization of the PMF? Is there any other point to take into
  consideration for the performance?
 
 --
 View this message in context:
 http://old.nabble.com/Wicket-GAE-performance-tp28118591p28133464.html
 Sent from the Wicket - User 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