Re: Serialization of DAO

2013-03-14 Thread Martin Grigorov
Hi,

I don't see how you initialize blogDAO. If you don't use wicket-ioc module
then you will need to lookup the DAO from the application whenever you need
it:

public void onSubmit() {

  BlogDAO blogDao = MyApplication.get().getBlogDAO();
  blogDao.save(blog);
}
This way you wont keep reference to it in the page/component and it wont be
serialized.

If you use wicket-guice module then you can do:

@Inject
private  BlogDAO blogDao;

and use it anywhere.
Wicket will use Guice to lookup the bean at component creation but the bean
will be wrapped in a serializable proxy. That is a lightweight proxy will
be (de)serialized with the page.
This is the recommended way.
wicket-string works the same way.
wicket-cdi leaves the proxy creation to the CDI implementation.



On Thu, Mar 14, 2013 at 5:19 AM, Stephen Walsh 
step...@connectwithawalsh.com wrote:

 I'm attempting to implement Guice for my DAO connections as my JBoss server
 keeps running out of memory.  Not entirely sure why that is, but I'm hoping
 this is at least part of it.  I read through
 http://markmail.org/message/sz64l4eytzc3ctkh and understand why the DAO
 needs to be serialized, and I also followed

 https://cwiki.apache.org/confluence/display/WICKET/Wicket%2C+Guice+and+Ibatis+exampleto
 try and figure out where and how exactly to inject my DAO.

 My DAO already extends a basic DAO class that has all of the basics for
 getting stuff from the database.  Neither of these are interfaces (not sure
 if this is a problem or not).  My DAO works just fine in panels, but as
 soon as it's on a page, it throws the not seralizable exception.
  Regardless it doesn't really solve the problem of really only needing one
 DAO for the whole application instead of creating one whenever it's needed
 in every place that it's needed.  If I understand dependency injection,
 then this is the whole point.

 Here's my class.  Hopefully someone can point me in the right direction for
 this page and my application class:

 public class EditBlogEntry extends BasePage {

 private Logger logger = LoggerFactory.getLogger(EditBlogEntry.class);

 private Mongo mongo;
 private Morphia morphia;
 private BlogDAO blogDAO;

 public EditBlogEntry(final Blog blogEntry) {
  // Add edit blogPost form to page
 Form? form = new Form(form);
 form.add(new Button(postIt) {
 @Override
 public void onSubmit() {
 // This merely gets a new mongo instance that has my blog
 entry mapped by morphia for saving the whole POJO to mongo
 setUpMongo();
 blogDAO.save(blogEntry);
 BlogEntryDetails details = new BlogEntryDetails(new
 PageParameters().add(id, blogEntry.getObjectId().toString()));
 setResponsePage(details);
 }
 });

 LoadableDetachableModel ldm = new LoadableDetachableModel() {
 @Override
 protected Object load() {
 //TODO need to set athr only on new blogEntry
 blogEntry.setAthr(CampingAwaitsSession.get().getUser());
 return blogEntry;
 }
 };

 form.add(new BlogEntryPanel(blogEntry, new
 CompoundPropertyModelBlog(ldm)));
 add(form);

 }

 Any thoughts?  I feel like I understand the concept but the implementation
 is throwing me.

 ___
 Stephen Walsh | http://connectwithawalsh.com




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


Re: Re: how to setup call context for every request

2013-03-14 Thread Martin Grigorov
Hi Tom,

Please post to the mailing lists. The chance to get an answer is bigger ;-)

Check Igor's series about Wicket-CDI at
https://www.42lines.net/category/blog/software-engineering/
You may need the conversation scope.


On Wed, Mar 13, 2013 at 11:59 PM, Tom Eicher t...@teicher.net wrote:

 Hey Martin,

  [...about seeting up stuff to propagate user/session/JAAS
  info from the wicket web layer to a JBoss AS7 EJB...]
 

 You can use IRequestCycleListener#**onBeginRequest().


 Thanks for the suggestion - but I just put the whole JAAS idea in
 the bin, it's just too much crappy and proprietary code for what
 it's worth.

 Now, I just built my own @SessionScoped call context in the
 web layer (Wicket WebPage constructor), and check it with a standard
 default EJB interceptor at the ejb layer (which @Inject's the call
 context).

 Since I used SessionScoped, not RequestScoped, all calls in-between
 the page class (which sets the call context) like AJAX, onClick()s
 etc still have the instance from the previous full page request
 available.

 Is there anything fundamentally wrong with my approach ?
 Any security issues, race conditions, threadsafety, ... ?

 There is not too much current info about using Wicket with the
 lesser known CDI/Weld scope stuff around ...
 ...@RequestScoped is supposed to work for
 Wicket6/wicket-cdi-6.4/**Tomcat7, right ?

 (And looks ok, but not heavily concurrently tested of course...)

 Cheers, Tom.





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


Re: wicket:for behavior

2013-03-14 Thread Martin Grigorov
Hi,

Try with : textField.setOutputMarkupId(true).
If this helps please file a ticket - 'wicket:for' should do this for you.


On Thu, Mar 14, 2013 at 5:01 AM, Maxim Solodovnik solomax...@gmail.comwrote:

 Hello,

 I'm trying to use wicket:for as follows:
 input wicket:id=rememberMe type=checkbox /label
 wicket:for=rememberMewicket:ommessage key=288 //label

 https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html

 the resulting HTML is:
 tdinput type=checkbox name=rememberMelabel for=id3Remember
 login/label/td
 http://demo.dataved.ru/openmeetings/html

 and label for is not working :(

 Am I using this feature improperly?
 Wicket 6.6.0 is used

 Thanks in advance

 --
 WBR
 Maxim aka solomax




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


Re: wicket:for behavior

2013-03-14 Thread Bas Gooren
We're still on wicket 1.5, so I don't know if this still applies in 6.x, 
but the reason for this is that the wicket:for handler is executed in 
the same order as your html.


That means that, since your wicket:for is after the input itself, 
calling setOutputMarkupId() on it no longer has any effect during that 
render.


The solution is quite simple: wrap the input in the label:

label wicket:for=id3
input wicket:id=id3 ...
wicket:message .../
/label

In this scenario the wicket:for is always handled before the input.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14-3-2013 5:01, schreef Maxim Solodovnik:

Hello,

I'm trying to use wicket:for as follows:
input wicket:id=rememberMe type=checkbox /label
wicket:for=rememberMewicket:ommessage key=288 //label
https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html

the resulting HTML is:
tdinput type=checkbox name=rememberMelabel for=id3Remember
login/label/td
http://demo.dataved.ru/openmeetings/html

and label for is not working :(

Am I using this feature improperly?
Wicket 6.6.0 is used

Thanks in advance





Image.initModel() returns null and forbids attaching an image to a form CompoundPropertyModel - why?

2013-03-14 Thread Marios Skounakis
Hi all,

I have created a component that extends NonCachingImage which overrides
getImageResource(). The intent was to include this in a form, and retrieve
the image data from a property of the form object.

However this does not work because Image.initModel() returns null and as a
result my component does not get an AttachedPropertyModel.

If I override initModel in my component and replicate the code from
Component.initModel it work perfectly. But this is ugly (duplicate code,
etc).

So, any suggestions?

Thanks in advance,
Marios


Re: wicket:for behavior

2013-03-14 Thread Martin Grigorov
On Thu, Mar 14, 2013 at 9:42 AM, Bas Gooren b...@iswd.nl wrote:

 We're still on wicket 1.5, so I don't know if this still applies in 6.x,
 but the reason for this is that the wicket:for handler is executed in the
 same order as your html.

 That means that, since your wicket:for is after the input itself, calling
 setOutputMarkupId() on it no longer has any effect during that render.


You are probably correct.


 The solution is quite simple: wrap the input in the label:

 label wicket:for=id3
 input wicket:id=id3 ...
 wicket:message .../
 /label


With such markup there is no need of wicket:for at all.



 In this scenario the wicket:for is always handled before the input.

 Met vriendelijke groet,
 Kind regards,

 Bas Gooren

 Op 14-3-2013 5:01, schreef Maxim Solodovnik:

  Hello,

 I'm trying to use wicket:for as follows:
 input wicket:id=rememberMe type=checkbox /label
 wicket:for=rememberMe**wicket:ommessage key=288 //label
 https://svn.apache.org/repos/**asf/openmeetings/trunk/**
 singlewebapp/src/org/apache/**openmeetings/web/pages/auth/**
 SignInPage.htmlhttps://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html

 the resulting HTML is:
 tdinput type=checkbox name=rememberMelabel for=id3Remember
 login/label/td
 http://demo.dataved.ru/**openmeetings/htmlhttp://demo.dataved.ru/openmeetings/html

 and label for is not working :(

 Am I using this feature improperly?
 Wicket 6.6.0 is used

 Thanks in advance





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


Re: how to setup call context for every request

2013-03-14 Thread Tom Eicher

Reposting to the list (sorry Martin ;-) in hope for
feedback on @RequestScoped Wicket-CDI vs EJB... :


[...about seeting up stuff to propagate user/session/JAAS
info from the wicket web layer to a JBoss AS7 EJB...]

You can use IRequestCycleListener#onBeginRequest().


Thanks for the suggestion - but I just put the whole JAAS idea in
the bin, it's just too much crappy and proprietary code for what
it's worth.

Now, I just built my own @SessionScoped call context in the
web layer (Wicket WebPage constructor), and check it with a standard
default EJB interceptor at the ejb layer (which @Inject's the call
context).

Since I used SessionScoped, not RequestScoped, all calls in-between
the page class (which sets the call context) like AJAX, onClick()s
etc still have the instance from the previous full page request
available.

Is there anything fundamentally wrong with my approach ?
Any security issues, race conditions, threadsafety, ... ?

There is not too much current info about using Wicket with the
lesser known CDI/Weld scope stuff around ...
...@RequestScoped is supposed to work for
Wicket6/wicket-cdi-6.4/Tomcat7, right ?

(And looks ok, but not heavily concurrently tested of course...)

Cheers, Tom.



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



Wicket Guide (Was: RSS)

2013-03-14 Thread Martin Grigorov
Thanks for sharing, Andrea!

In what format will be your guide ?
I see you have many demo applications but is there any kind of
documentation explaining what they actually show ?

I'm a bit slow lately on the Reference Guide initiative :-/

On Wed, Mar 13, 2013 at 11:06 PM, Andrea Del Bene an.delb...@gmail.comwrote:

 I've published an article on JavaLobby about it...

 http://java.dzone.com/**articles/how-implement-rss-**feeds-customhttp://java.dzone.com/articles/how-implement-rss-feeds-custom

  Both very helpful.  Thank you!

 __**_
 Stephen Walsh | http://connectwithawalsh.com


 On Tue, Mar 12, 2013 at 5:06 AM, Andrea Del Bene an.delb...@gmail.com
 wrote:

  You can take a look at the very basic RSS feeds producer that I've
 implemented for my Wicket guide:
 https://github.com/bitstorm/Wicket-tutorial-examples/blob/https://github.com/bitstorm/**Wicket-tutorial-examples/blob/**
 master/CustomResourceMounting/src/main/java/org/
 wicketTutorial/**
 RSSProducerResource.javahttps**://github.com/bitstorm/Wicket-**
 tutorial-examples/blob/master/**CustomResourceMounting/src/**
 main/java/org/wicketTutorial/**RSSProducerResource.javahttps://github.com/bitstorm/Wicket-tutorial-examples/blob/master/CustomResourceMounting/src/main/java/org/wicketTutorial/RSSProducerResource.java
 

 I've used directly Rome framework to produce RSS, without the related
 wicketstuff module. In the application class of the project you can see
 how
 I used this custom resource mounting it to a fixed URL.

   Anyone have a working solution for producing RSS feeds from content
 stored

 in a DB on a Wicket 6.5+ page?  I've been reading through all of the old
 docs on wicketstuff-rome, but it seems it's not supported with the
 changes
 made to 6.5+.

 I can generate my xml file, but not really sure how to go about actually
 publishing it and having Wicket recognize it as a resource once it's on
 the
 file system.  Hope that makes sense...

 ___
 Stephen Walsh | http://connectwithawalsh.com


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




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


Re: Wicket Atmosphere with CryptoMapper gives exception.

2013-03-14 Thread Martin Grigorov
Hi,

I think you should ask in Atmosphere mailing list.
The servlet mapping is on /* so I'm not sure why Atmosphere rejects the
request to /A7-TzylrsD0NeLU_GE2Phg/A7-56.
IMO it should accept and pass it to WicketFilter where the request path
will be decrypted and processed.


On Wed, Mar 13, 2013 at 11:01 PM, chrome1235 kemal.m...@gmail.com wrote:

 Hi,

 When I use the Atmosphere with CryptoMapper it gives
 org.atmosphere.cpr.AtmosphereMappingException
 How can I solve this problem?
 Thanks .
 Kemal


 Application Initilization Method:
 @Override
 protected void init() {
 super.init();
 initAtmosphere();
 IRequestMapper cryptoMapper = new
 CryptoMapper(getRootRequestMapper(),
 this);
 setRootRequestMapper(cryptoMapper);
 }

 web.xml

 servlet
 servlet-nameAtmosphereApplication/servlet-name
 servlet-classorg.atmosphere.cpr.AtmosphereServlet/servlet-class
 init-param
 param-nameapplicationClassName/param-name

 param-valuecom.chrome.wicket.ext.atm.AtmosphereApplication/param-value
 /init-param
 init-param
 param-nameorg.atmosphere.useWebSocket/param-name
 param-valuetrue/param-value
 /init-param
 init-param
 param-nameorg.atmosphere.useNative/param-name
 param-valuetrue/param-value
 /init-param
 init-param
 param-nameorg.atmosphere.cpr.sessionSupport/param-name
 param-valuetrue/param-value
 /init-param
 init-param


 param-nameorg.atmosphere.cpr.CometSupport.maxInactiveActivity/param-name
 param-value3/param-value
 /init-param
 init-param
 param-namefilterMappingUrlPattern/param-name
 param-value/*/param-value
 /init-param
 init-param

 param-nameorg.atmosphere.websocket.WebSocketProtocol/param-name

 param-valueorg.atmosphere.websocket.protocol.EchoProtocol/param-value
 /init-param
 init-param

 param-nameorg.atmosphere.cpr.broadcastFilterClasses/param-name


 param-valueorg.apache.wicket.atmosphere.TrackMessageSizeFilter/param-value
 /init-param
 load-on-startup1/load-on-startup
 /servlet

 servlet-mapping
 servlet-nameAtmosphereApplication/servlet-name
 url-pattern/*/url-pattern
 /servlet-mapping



 Exception:
 org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps
 request for /A7-TzylrsD0NeLU_GE2Phg/A7-56 at

 org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:370)
 at

 org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:206)
 at

 org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:166)
 at

 org.atmosphere.container.Jetty7CometSupport.service(Jetty7CometSupport.java:96)
 at

 org.atmosphere.container.JettyAsyncSupportWithWebSocket.service(JettyAsyncSupportWithWebSocket.java:70)
 at

 org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1307)
 at org.atmosphere.cpr.AtmosphereServlet.doPost(AtmosphereServlet.java:293)
 at org.atmosphere.cpr.AtmosphereServlet.doGet(AtmosphereServlet.java:279)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:735) at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at
 org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at
 org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
 at

 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
 at
 org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
 at

 org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
 at

 org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
 at
 org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413)
 at

 org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
 at

 org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
 at

 org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
 at

 org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
 at

 org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
 at

 org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
 at org.eclipse.jetty.server.Server.handle(Server.java:350) at

 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
 at

 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
 at

 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
 at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630) at
 

Wicket 6: LinkResource with a dynamic resource

2013-03-14 Thread dpmihai
Hi.

I want to have a table with a Link PropertyColumn which contains a
LinkResource. When user clicks on the link I want to be able to pass the row
model to resource first and then have the resource loaded.

I created a ResourceLinkPropertyColumn class like:


public class ResourceLinkPropertyColumnT extends PropertyColumnT, String
{

private IModel labelModel;
private ByteArrayResource resource;

public ResourceLinkPropertyColumn(IModel displayModel, IModel
labelModel, ByteArrayResource resource) {
super(displayModel, null);
this.labelModel = labelModel;
this.resource = resource;
}

 @Override
 public void populateItem(Item item, String componentId, IModel model) {
item.add(new LinkPanel(item, componentId, model));
 }

 protected void onDone(IModelT rowModel) {
 }

 public ByteArrayResource getResource() {
return resource;
 }

 public class LinkPanel extends Panel { 

public LinkPanel(final Item item, final String componentId, 
final IModel
model) {
super(componentId);

ResourceLink link = new ResourceLink(link, resource) {

@Override
public void onClick() {
onDone(model);
super.onClick();
}

protected void onComponentTag(ComponentTag 
componentTag) {
 super.onComponentTag(componentTag);
 componentTag.put(target, _blank);
}


};
add(link);

IModel tmpLabelModel = labelModel;
if (labelModel == null) {
tmpLabelModel = getDataModel(model);
}

link.add(new Label(label, tmpLabelModel));
}
}
}

When I create my data table I add my column like:

columns.add(new ResourceLinkPropertyColumnUser(new
ModelString(Generate), new ModelString(Generate),new
MyByteArrayResource()) {
protected void onDone(IModelUser rowModel) {  
final MyObject object = rowModel.getObject();   

((MyByteArrayResource)getResource()).setMyObject(object);
}
});   

The problem is that when I click the link the resource is loaded first and
then my onDone method is called.
Is there any possibility to pass the model to the resource before it is
loaded?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-LinkResource-with-a-dynamic-resource-tp4657238.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: Wicket 6: LinkResource with a dynamic resource

2013-03-14 Thread dpmihai
The only solution I have is to create my own class ResourceLink with a
method:

public void beforeResourceRequested() {}  (here I will set rowModel to
my resource)


and use it inside onResourceRequested:

/**
 * @see org.apache.wicket.IResourceListener#onResourceRequested()
 */
@Override
public final void onResourceRequested()
{
beforeResourceRequested();
Attributes a = new Attributes(RequestCycle.get().getRequest(),
RequestCycle.get()
.getResponse(), null);
resource.respond(a);
onLinkClicked();
}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-6-LinkResource-with-a-dynamic-resource-tp4657238p4657239.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: wicket:for behavior

2013-03-14 Thread Maxim Solodovnik
Thanks a lot! *.setOutputMarkupId(**true)* helps!


On Thu, Mar 14, 2013 at 3:47 PM, Martin Grigorov mgrigo...@apache.orgwrote:

 On Thu, Mar 14, 2013 at 9:42 AM, Bas Gooren b...@iswd.nl wrote:

  We're still on wicket 1.5, so I don't know if this still applies in 6.x,
  but the reason for this is that the wicket:for handler is executed in the
  same order as your html.
 
  That means that, since your wicket:for is after the input itself, calling
  setOutputMarkupId() on it no longer has any effect during that render.
 
 
 You are probably correct.


  The solution is quite simple: wrap the input in the label:
 
  label wicket:for=id3
  input wicket:id=id3 ...
  wicket:message .../
  /label
 

 With such markup there is no need of wicket:for at all.


 
  In this scenario the wicket:for is always handled before the input.
 
  Met vriendelijke groet,
  Kind regards,
 
  Bas Gooren
 
  Op 14-3-2013 5:01, schreef Maxim Solodovnik:
 
   Hello,
 
  I'm trying to use wicket:for as follows:
  input wicket:id=rememberMe type=checkbox /label
  wicket:for=rememberMe**wicket:ommessage key=288 //label
  https://svn.apache.org/repos/**asf/openmeetings/trunk/**
  singlewebapp/src/org/apache/**openmeetings/web/pages/auth/**
  SignInPage.html
 https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html
 
 
  the resulting HTML is:
  tdinput type=checkbox name=rememberMelabel for=id3Remember
  login/label/td
  http://demo.dataved.ru/**openmeetings/html
 http://demo.dataved.ru/openmeetings/html
 
  and label for is not working :(
 
  Am I using this feature improperly?
  Wicket 6.6.0 is used
 
  Thanks in advance
 
 
 


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




-- 
WBR
Maxim aka solomax


Some Validators Not Kicking In

2013-03-14 Thread eugenebalt
We're having an issue where some of our validators aren't kicking in.

A bunch of Component- and Form-level validators are added in the page
constructor. We have output statements in each. The output shows that in
some situations some of the validators are short-circuited and don't get
executed even though we've added them. Any ideas?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Some-Validators-Not-Kicking-In-tp4657242.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: Some Validators Not Kicking In

2013-03-14 Thread Martin Grigorov
Hi,

Looking at org.apache.wicket.markup.html.form.Form#validateFormValidator I
see that form validator will be skipped if any of its
org.apache.wicket.markup.html.form.validation.IFormValidator#getDependentFormComponents
is already invalid.


On Thu, Mar 14, 2013 at 3:35 PM, eugenebalt eugeneb...@yahoo.com wrote:

 We're having an issue where some of our validators aren't kicking in.

 A bunch of Component- and Form-level validators are added in the page
 constructor. We have output statements in each. The output shows that in
 some situations some of the validators are short-circuited and don't get
 executed even though we've added them. Any ideas?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Some-Validators-Not-Kicking-In-tp4657242.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 http://jweekend.com/


Re: Serialization of DAO

2013-03-14 Thread Stephen Walsh
Thanks, Martin.  I intialize here, (which I just realized is not the best
spot):

private void setUpMongo() {
mongo = MongoUtil.getMongo();
morphia = new Morphia().map(Blog.class).map(Person.class);
blogDAO = new BlogDAO(mongo, morphia);
}

I am using the Wicket Guice module, and I think your second point is what I
was getting at.  From learning about Guice (
http://www.youtube.com/watch?feature=player_embeddedv=hBVJbzAagfs), I
thought the point was to initialize once and then reuse wherever needed.  I
figured initialization would happen in the application class.  Maybe I'm
misunderstanding.  If it's supposed to happen in the application class,
then I don't really have need for a module because I don't have an
interface in this case, right?

Thanks for the help on this.

___
Stephen Walsh | http://connectwithawalsh.com


On Thu, Mar 14, 2013 at 3:20 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 I don't see how you initialize blogDAO. If you don't use wicket-ioc module
 then you will need to lookup the DAO from the application whenever you need
 it:

 public void onSubmit() {

   BlogDAO blogDao = MyApplication.get().getBlogDAO();
   blogDao.save(blog);
 }
 This way you wont keep reference to it in the page/component and it wont be
 serialized.

 If you use wicket-guice module then you can do:

 @Inject
 private  BlogDAO blogDao;

 and use it anywhere.
 Wicket will use Guice to lookup the bean at component creation but the bean
 will be wrapped in a serializable proxy. That is a lightweight proxy will
 be (de)serialized with the page.
 This is the recommended way.
 wicket-string works the same way.
 wicket-cdi leaves the proxy creation to the CDI implementation.



 On Thu, Mar 14, 2013 at 5:19 AM, Stephen Walsh 
 step...@connectwithawalsh.com wrote:

  I'm attempting to implement Guice for my DAO connections as my JBoss
 server
  keeps running out of memory.  Not entirely sure why that is, but I'm
 hoping
  this is at least part of it.  I read through
  http://markmail.org/message/sz64l4eytzc3ctkh and understand why the DAO
  needs to be serialized, and I also followed
 
 
 https://cwiki.apache.org/confluence/display/WICKET/Wicket%2C+Guice+and+Ibatis+exampleto
  try and figure out where and how exactly to inject my DAO.
 
  My DAO already extends a basic DAO class that has all of the basics for
  getting stuff from the database.  Neither of these are interfaces (not
 sure
  if this is a problem or not).  My DAO works just fine in panels, but as
  soon as it's on a page, it throws the not seralizable exception.
   Regardless it doesn't really solve the problem of really only needing
 one
  DAO for the whole application instead of creating one whenever it's
 needed
  in every place that it's needed.  If I understand dependency injection,
  then this is the whole point.
 
  Here's my class.  Hopefully someone can point me in the right direction
 for
  this page and my application class:
 
  public class EditBlogEntry extends BasePage {
 
  private Logger logger = LoggerFactory.getLogger(EditBlogEntry.class);
 
  private Mongo mongo;
  private Morphia morphia;
  private BlogDAO blogDAO;
 
  public EditBlogEntry(final Blog blogEntry) {
   // Add edit blogPost form to page
  Form? form = new Form(form);
  form.add(new Button(postIt) {
  @Override
  public void onSubmit() {
  // This merely gets a new mongo instance that has my blog
  entry mapped by morphia for saving the whole POJO to mongo
  setUpMongo();
  blogDAO.save(blogEntry);
  BlogEntryDetails details = new BlogEntryDetails(new
  PageParameters().add(id, blogEntry.getObjectId().toString()));
  setResponsePage(details);
  }
  });
 
  LoadableDetachableModel ldm = new LoadableDetachableModel() {
  @Override
  protected Object load() {
  //TODO need to set athr only on new blogEntry
  blogEntry.setAthr(CampingAwaitsSession.get().getUser());
  return blogEntry;
  }
  };
 
  form.add(new BlogEntryPanel(blogEntry, new
  CompoundPropertyModelBlog(ldm)));
  add(form);
 
  }
 
  Any thoughts?  I feel like I understand the concept but the
 implementation
  is throwing me.
 
  ___
  Stephen Walsh | http://connectwithawalsh.com
 



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



Re: wicket:for behavior

2013-03-14 Thread Igor Vaynberg
wicket:for cant set output markup id because it comes after the form
component in markup and so the form component has already been
rendered. it already sets the output of markup, but it only helps if
the label is before the component in markup.

-igor

On Thu, Mar 14, 2013 at 1:35 AM, Martin Grigorov mgrigo...@apache.org wrote:
 Hi,

 Try with : textField.setOutputMarkupId(true).
 If this helps please file a ticket - 'wicket:for' should do this for you.


 On Thu, Mar 14, 2013 at 5:01 AM, Maxim Solodovnik solomax...@gmail.comwrote:

 Hello,

 I'm trying to use wicket:for as follows:
 input wicket:id=rememberMe type=checkbox /label
 wicket:for=rememberMewicket:ommessage key=288 //label

 https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html

 the resulting HTML is:
 tdinput type=checkbox name=rememberMelabel for=id3Remember
 login/label/td
 http://demo.dataved.ru/openmeetings/html

 and label for is not working :(

 Am I using this feature improperly?
 Wicket 6.6.0 is used

 Thanks in advance

 --
 WBR
 Maxim aka solomax




 --
 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: Image not shown html

2013-03-14 Thread Martin Grigorov
Hi,

Please take a look at your question as someone who is here to help you.
Here is the url:
http://apache-wicket.1842946.n4.nabble.com/Image-not-shown-html-tp4657245.html

Can you understand the question ?

By the way there are google groups in Spanish (
https://groups.google.com/forum/?fromgroups#!forum/wicket-es) and Portugese
(https://groups.google.com/forum/?fromgroups#!forum/wicket-ptbr) if this
will make it easier for you.

P.S. http://www.catb.org/esr/faqs/smart-questions.html might be useful to
read.



On Thu, Mar 14, 2013 at 4:18 PM, anton antoniovalenciasp...@hotmail.comwrote:


 Hi.

 if I open the html manually if it appears, but since the application does
 not
 /home/pc/1.jpg
 ¿?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Image-not-shown-html-tp4657245.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 http://jweekend.com/


Re: Some Validators Not Kicking In

2013-03-14 Thread eugenebalt
That may be it. The Form-level ones are the ones not executing sometimes.

So to check if it's invalid, I just see if getDependentComponents() returns
NULL? And what could cause it to be NULL, if I'm specifying the right valid
components that exist on the form?

Thanks again



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Some-Validators-Not-Kicking-In-tp4657242p4657249.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: Some Validators Not Kicking In

2013-03-14 Thread eugenebalt
So if I have something wrong with my field (by itself), than any Form
validators that involve it as well, won't kick in?

From the documentation:
These validators are added to the form and only executed if all form
components returned by getDependentFormComponents() have been successfully
validated before this validator runs. 

What if I need to show all messages, both solo and Form-level?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Some-Validators-Not-Kicking-In-tp4657242p4657250.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: Some Validators Not Kicking In

2013-03-14 Thread eugenebalt
Sorry to keep posting, but does order matter? We're adding the validators in
all kinds of order.

Sometimes, we have a field that shows messages associated with itself, AND
its Form-level validator. But that doesn't work for other fields, which
don't show the Form-associated validator.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Some-Validators-Not-Kicking-In-tp4657242p4657251.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



Draft-mode validation

2013-03-14 Thread pureza
Hi,

I have a very big form with two buttons: Save and Submit. If the user hits
the Save button, I want to bypass *some* of the validation, but not all of
it. For example, I want to notify the user of any conversion errors (such as
text in a field where a number is expected), but I want to ignore required
fields.

This article
(http://www.richardnichols.net/2010/10/implementing-a-draft-mode-with-apache-wicket-forms/)
suggests a way of doing this, but my problem is that my form is really big
and includes many sub-forms. How can a sub-form know if we are in draft-mode
validation? Is there a nice way of defining application-wide validation
settings?

Thanks,

Luis Pureza



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Draft-mode-validation-tp4657252.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: Draft-mode validation

2013-03-14 Thread pureza
I just found out about Form.findSubmittingButton(). That should do it, but if
you know of any better way, please let me know :-)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Draft-mode-validation-tp4657252p4657253.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



Ajax Behavior not working after 1 time

2013-03-14 Thread eugenebalt
We have a DropDown whose selection affects the 2nd DropDown (hide+disable).

This is done in Ajax onchange on the 1st DropDown, very simple. In the
Ajax behavior, we specify

if (condition)
{
   choice2.setEnabled(false); choice2.setEnabled(false);
target.addComponent(choice2);
}
else
{
   choice2.setEnabled(true); choice2.setEnabled(true);
target.addComponent(choice2);
}

We verified that our condition works, and Ajax kicks in correctly on every
change in DropDown #1, and the hide/show works the *first* time.

Afterwards, after switching back and trying again, we are no longer able to
show Choice2. It always stays hidden, and the correct condition is
activated, but the dropdown isn't updated for some reason.

Any ideas? We're doing target.addComponent() in both cases.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Behavior-not-working-after-1-time-tp4657254.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: Ajax Behavior not working after 1 time

2013-03-14 Thread eugenebalt
Martin, we're already doing setOutputMarkupId(true) on both dropdowns. Is
that one different from OutputMarkupId?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-Behavior-not-working-after-1-time-tp4657254p4657257.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: Ajax Behavior not working after 1 time

2013-03-14 Thread Marios Skounakis
Yes it is. What Martin says will fix your problem.


On Thu, Mar 14, 2013 at 9:35 PM, eugenebalt eugeneb...@yahoo.com wrote:

 Martin, we're already doing setOutputMarkupId(true) on both dropdowns. Is
 that one different from OutputMarkupId?



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Ajax-Behavior-not-working-after-1-time-tp4657254p4657257.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: Ajax Behavior not working after 1 time

2013-03-14 Thread Martin Grigorov
On Thu, Mar 14, 2013 at 8:35 PM, eugenebalt eugeneb...@yahoo.com wrote:

 Martin, we're already doing setOutputMarkupId(true) on both dropdowns. Is
 that one different from OutputMarkupId?


re-read what I wrote and what you answered.
and read the related javadoc





 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Ajax-Behavior-not-working-after-1-time-tp4657254p4657257.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 http://jweekend.com/


Re: Custom FormComponentPanel and validation

2013-03-14 Thread Paul Bors
Have you tried this:
https://cwiki.apache.org/WICKET/creating-custom-formcomponentpanels-to-build-valid-objects-using-wickets-form-validation-logic.html

~ Thank you,
   Paul Bors

On Thu, Mar 14, 2013 at 9:39 AM, Jeremy Levy jel...@gmail.com wrote:

 I have a FormComponentPanel with 3 TextFields.  I'd like it so that when
 validating, it's the FormComponentPanel that reports the errors rather then
 each individual TextField.

 Can someone point me in the right direction?  This is Wicket 6.x.

 Thanks

 --
 Jeremy



Re: Proper models approach

2013-03-14 Thread Paul Bors
Why not use the existing Wicket Wizard already?
See the live examples at:
http://www.wicket-library.com/wicket-examples/wizard/;jsessionid=25DD01023009791E13E212292E4150D1?0

I think I used a combination of models depending on the panel shown. In the
end they all updated a single model.

~ Thank you,
   Paul Bors
On Wed, Mar 13, 2013 at 10:15 AM, mac gmaci...@gmail.com wrote:

 Hi,
 I have a wizard-like panel for gathering user input data. Panel is built
 with base panel and replaceable steps panels (every step panel gathers
 different data, last step stores it to DB).
 What is best approach for using Wicket models? Should I create big wrapper
 object containig all data, set it as default model (LDM) in base panel and
 pass it to steps panels?

 Thanks,
 mac



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Proper-models-approach-tp4657211.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: send message from modal window to parent

2013-03-14 Thread Paul Bors
If I understand you right you want to close your parent window from inside
the modal pop-up window.
I take it you want them both closed.

Won't it be simpler to send the window JS object to your pop-up and call
the window.close() from inside your pop-up?
~ Thank you,
   Paul Bors
On Tue, Mar 12, 2013 at 12:01 PM, cosmindumy cosmind...@yahoo.com wrote:

 Hello,
 Is it possible to send a flag from modal window to the parent page in order
 to make additional operations?
 ModalWindow.WindowClosedCallback doesn't help.
 I want to send that message if the modal window was closed after pressing
 the submit button( that calls modal.close()), and not from modal close
 button.
 Which is the recommended method?
 Thanks



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/send-message-from-modal-window-to-parent-tp4657185.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




check load

2013-03-14 Thread fachhoch
I use aws load balancer  to load balance my app running in aws cloud ,the
load balancer is configured to launch a new server instance if   request is
taking more than the specified time .

I need advice on  how to check  the load on the server, should it be like
number of session ?  total sessions size ?
please advice can wicket any how tell me whats the load ?




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/check-load-tp4657265.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: check load

2013-03-14 Thread Martin Grigorov
No, Wicket cannot tell you such information.
Consult AWS documentation.


On Thu, Mar 14, 2013 at 10:36 PM, fachhoch fachh...@gmail.com wrote:

 I use aws load balancer  to load balance my app running in aws cloud ,the
 load balancer is configured to launch a new server instance if   request is
 taking more than the specified time .

 I need advice on  how to check  the load on the server, should it be like
 number of session ?  total sessions size ?
 please advice can wicket any how tell me whats the load ?




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/check-load-tp4657265.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 http://jweekend.com/


Re: Serialization of DAO

2013-03-14 Thread Stephen Walsh
Any other thoughts on this?

___
Stephen Walsh | http://connectwithawalsh.com


On Thu, Mar 14, 2013 at 10:30 AM, Stephen Walsh 
step...@connectwithawalsh.com wrote:

 Thanks, Martin.  I intialize here, (which I just realized is not the best
 spot):

 private void setUpMongo() {
 mongo = MongoUtil.getMongo();
 morphia = new Morphia().map(Blog.class).map(Person.class);
 blogDAO = new BlogDAO(mongo, morphia);
 }

 I am using the Wicket Guice module, and I think your second point is what
 I was getting at.  From learning about Guice (
 http://www.youtube.com/watch?feature=player_embeddedv=hBVJbzAagfs), I
 thought the point was to initialize once and then reuse wherever needed.  I
 figured initialization would happen in the application class.  Maybe I'm
 misunderstanding.  If it's supposed to happen in the application class,
 then I don't really have need for a module because I don't have an
 interface in this case, right?

 Thanks for the help on this.

 ___
 Stephen Walsh | http://connectwithawalsh.com


 On Thu, Mar 14, 2013 at 3:20 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Hi,

 I don't see how you initialize blogDAO. If you don't use wicket-ioc module
 then you will need to lookup the DAO from the application whenever you
 need
 it:

 public void onSubmit() {

   BlogDAO blogDao = MyApplication.get().getBlogDAO();
   blogDao.save(blog);
 }
 This way you wont keep reference to it in the page/component and it wont
 be
 serialized.

 If you use wicket-guice module then you can do:

 @Inject
 private  BlogDAO blogDao;

 and use it anywhere.
 Wicket will use Guice to lookup the bean at component creation but the
 bean
 will be wrapped in a serializable proxy. That is a lightweight proxy will
 be (de)serialized with the page.
 This is the recommended way.
 wicket-string works the same way.
 wicket-cdi leaves the proxy creation to the CDI implementation.



 On Thu, Mar 14, 2013 at 5:19 AM, Stephen Walsh 
 step...@connectwithawalsh.com wrote:

  I'm attempting to implement Guice for my DAO connections as my JBoss
 server
  keeps running out of memory.  Not entirely sure why that is, but I'm
 hoping
  this is at least part of it.  I read through
  http://markmail.org/message/sz64l4eytzc3ctkh and understand why the DAO
  needs to be serialized, and I also followed
 
 
 https://cwiki.apache.org/confluence/display/WICKET/Wicket%2C+Guice+and+Ibatis+exampleto
  try and figure out where and how exactly to inject my DAO.
 
  My DAO already extends a basic DAO class that has all of the basics for
  getting stuff from the database.  Neither of these are interfaces (not
 sure
  if this is a problem or not).  My DAO works just fine in panels, but as
  soon as it's on a page, it throws the not seralizable exception.
   Regardless it doesn't really solve the problem of really only needing
 one
  DAO for the whole application instead of creating one whenever it's
 needed
  in every place that it's needed.  If I understand dependency injection,
  then this is the whole point.
 
  Here's my class.  Hopefully someone can point me in the right direction
 for
  this page and my application class:
 
  public class EditBlogEntry extends BasePage {
 
  private Logger logger =
 LoggerFactory.getLogger(EditBlogEntry.class);
 
  private Mongo mongo;
  private Morphia morphia;
  private BlogDAO blogDAO;
 
  public EditBlogEntry(final Blog blogEntry) {
   // Add edit blogPost form to page
  Form? form = new Form(form);
  form.add(new Button(postIt) {
  @Override
  public void onSubmit() {
  // This merely gets a new mongo instance that has my
 blog
  entry mapped by morphia for saving the whole POJO to mongo
  setUpMongo();
  blogDAO.save(blogEntry);
  BlogEntryDetails details = new BlogEntryDetails(new
  PageParameters().add(id, blogEntry.getObjectId().toString()));
  setResponsePage(details);
  }
  });
 
  LoadableDetachableModel ldm = new LoadableDetachableModel() {
  @Override
  protected Object load() {
  //TODO need to set athr only on new blogEntry
  blogEntry.setAthr(CampingAwaitsSession.get().getUser());
  return blogEntry;
  }
  };
 
  form.add(new BlogEntryPanel(blogEntry, new
  CompoundPropertyModelBlog(ldm)));
  add(form);
 
  }
 
  Any thoughts?  I feel like I understand the concept but the
 implementation
  is throwing me.
 
  ___
  Stephen Walsh | http://connectwithawalsh.com
 



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





AbstractAjaxTimerBehavior and setInterval and clearInterval

2013-03-14 Thread infiniter
I created a very similar class to AbstractAjaxTimerBehavior, with the
difference that I'm using setInterval instead of setTimeOut in
#getJsTimeoutCall and I'm assigning a variable name to it, so that I can use
the clearInterval in #getFailureScript , the problem I got is that in the
response envelope I'm getting the script in #getJsTimeoutCall back, which is
inside the evaluate block, and I don't want that because when the
setInterval is set again the value in the variable changes therefore I
cannot clear the interval and also it makes the response heavier.

So basically I just want the script in #getJsTimeoutCall executed only once
just to start the interval. I tried to make the response not return the
evaluate block,  but I was unsuccessful.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AbstractAjaxTimerBehavior-and-setInterval-and-clearInterval-tp4657268.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: Serialization of DAO

2013-03-14 Thread Martin Grigorov
Take a look at wicket-examples and the unit tests in wicket-guice module.


On Thu, Mar 14, 2013 at 10:53 PM, Stephen Walsh 
step...@connectwithawalsh.com wrote:

 Any other thoughts on this?

 ___
 Stephen Walsh | http://connectwithawalsh.com


 On Thu, Mar 14, 2013 at 10:30 AM, Stephen Walsh 
 step...@connectwithawalsh.com wrote:

  Thanks, Martin.  I intialize here, (which I just realized is not the best
  spot):
 
  private void setUpMongo() {
  mongo = MongoUtil.getMongo();
  morphia = new Morphia().map(Blog.class).map(Person.class);
  blogDAO = new BlogDAO(mongo, morphia);
  }
 
  I am using the Wicket Guice module, and I think your second point is what
  I was getting at.  From learning about Guice (
  http://www.youtube.com/watch?feature=player_embeddedv=hBVJbzAagfs), I
  thought the point was to initialize once and then reuse wherever needed.
  I
  figured initialization would happen in the application class.  Maybe I'm
  misunderstanding.  If it's supposed to happen in the application class,
  then I don't really have need for a module because I don't have an
  interface in this case, right?
 
  Thanks for the help on this.
 
  ___
  Stephen Walsh | http://connectwithawalsh.com
 
 
  On Thu, Mar 14, 2013 at 3:20 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
  Hi,
 
  I don't see how you initialize blogDAO. If you don't use wicket-ioc
 module
  then you will need to lookup the DAO from the application whenever you
  need
  it:
 
  public void onSubmit() {
 
BlogDAO blogDao = MyApplication.get().getBlogDAO();
blogDao.save(blog);
  }
  This way you wont keep reference to it in the page/component and it wont
  be
  serialized.
 
  If you use wicket-guice module then you can do:
 
  @Inject
  private  BlogDAO blogDao;
 
  and use it anywhere.
  Wicket will use Guice to lookup the bean at component creation but the
  bean
  will be wrapped in a serializable proxy. That is a lightweight proxy
 will
  be (de)serialized with the page.
  This is the recommended way.
  wicket-string works the same way.
  wicket-cdi leaves the proxy creation to the CDI implementation.
 
 
 
  On Thu, Mar 14, 2013 at 5:19 AM, Stephen Walsh 
  step...@connectwithawalsh.com wrote:
 
   I'm attempting to implement Guice for my DAO connections as my JBoss
  server
   keeps running out of memory.  Not entirely sure why that is, but I'm
  hoping
   this is at least part of it.  I read through
   http://markmail.org/message/sz64l4eytzc3ctkh and understand why the
 DAO
   needs to be serialized, and I also followed
  
  
 
 https://cwiki.apache.org/confluence/display/WICKET/Wicket%2C+Guice+and+Ibatis+exampleto
   try and figure out where and how exactly to inject my DAO.
  
   My DAO already extends a basic DAO class that has all of the basics
 for
   getting stuff from the database.  Neither of these are interfaces (not
  sure
   if this is a problem or not).  My DAO works just fine in panels, but
 as
   soon as it's on a page, it throws the not seralizable exception.
Regardless it doesn't really solve the problem of really only needing
  one
   DAO for the whole application instead of creating one whenever it's
  needed
   in every place that it's needed.  If I understand dependency
 injection,
   then this is the whole point.
  
   Here's my class.  Hopefully someone can point me in the right
 direction
  for
   this page and my application class:
  
   public class EditBlogEntry extends BasePage {
  
   private Logger logger =
  LoggerFactory.getLogger(EditBlogEntry.class);
  
   private Mongo mongo;
   private Morphia morphia;
   private BlogDAO blogDAO;
  
   public EditBlogEntry(final Blog blogEntry) {
// Add edit blogPost form to page
   Form? form = new Form(form);
   form.add(new Button(postIt) {
   @Override
   public void onSubmit() {
   // This merely gets a new mongo instance that has my
  blog
   entry mapped by morphia for saving the whole POJO to mongo
   setUpMongo();
   blogDAO.save(blogEntry);
   BlogEntryDetails details = new BlogEntryDetails(new
   PageParameters().add(id, blogEntry.getObjectId().toString()));
   setResponsePage(details);
   }
   });
  
   LoadableDetachableModel ldm = new LoadableDetachableModel() {
   @Override
   protected Object load() {
   //TODO need to set athr only on new blogEntry
  
 blogEntry.setAthr(CampingAwaitsSession.get().getUser());
   return blogEntry;
   }
   };
  
   form.add(new BlogEntryPanel(blogEntry, new
   CompoundPropertyModelBlog(ldm)));
   add(form);
  
   }
  
   Any thoughts?  I feel like I understand the concept but the
  implementation
   is throwing me.
  
   

Wicket 1.4.x - AjaxSubmitLink doesn't work

2013-03-14 Thread anotherUser
Hi this my first post here, let's see my problem:
i am adding a AjaxSubmitLink in a Listview like this:

AjaxSubmitLink lnkAgregar = new AjaxSubmitLink(lnkDetalle, form) {

 @Override
 protected void onSubmit(AjaxRequestTarget art, Form? form) {

 }
   };
lnkAgregar.setMarkupId(LNKDETALLE_A_ + fDetalle.getId());

when i tried to click this link 
Wicket Ajax Debug Windows show me:
NFO: Ajax POST stopped because of precondition check,
url:?wicket:interface=:3:templateCircuitoFirmasForm:containerLW:lwTemplateFirmasDetalle:1:lnkAgregarDetalle::IActivePageBehaviorListener:0:-1wicket:ignoreIfNotActive=true

This was because, fDetalle.getId() was null, i comment this line and resolve
the problem
lnkAgregar.setMarkupId(LNKDETALLE_A_ + fDetalle.getId());



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-x-AjaxSubmitLink-doesn-t-work-tp4657243.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: Wicket 1.4.x - AjaxSubmitLink doesn't work

2013-03-14 Thread Martin Grigorov
Hi,


On Thu, Mar 14, 2013 at 3:56 PM, anotherUser 
juan.dellagn...@theiaconsulting.com wrote:

 Hi this my first post here, let's see my problem:


Welcome !


 i am adding a AjaxSubmitLink in a Listview like this:

 AjaxSubmitLink lnkAgregar = new AjaxSubmitLink(lnkDetalle, form) {

  @Override
  protected void onSubmit(AjaxRequestTarget art, Form? form) {
 
  }
};
 lnkAgregar.setMarkupId(LNKDETALLE_A_ + fDetalle.getId());

 when i tried to click this link
 Wicket Ajax Debug Windows show me:
 NFO: Ajax POST stopped because of precondition check,

 url:?wicket:interface=:3:templateCircuitoFirmasForm:containerLW:lwTemplateFirmasDetalle:1:lnkAgregarDetalle::IActivePageBehaviorListener:0:-1wicket:ignoreIfNotActive=true

 This was because, fDetalle.getId() was null, i comment this line and
 resolve
 the problem
 lnkAgregar.setMarkupId(LNKDETALLE_A_ + fDetalle.getId());


And the question is, I guess, why ?
A: Because Wicket makes a check that the HTML element that triggers the JS
event and the form to be submitted are in the DOM document. I suppose there
are several links with the same markup id - LNKDETALLE_A_null.



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-x-AjaxSubmitLink-doesn-t-work-tp4657243.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 http://jweekend.com/