Re: Upgrading of Wicket application on server without losing state

2011-11-02 Thread Robert Dahlström
Well, IF you're really keen on non-intrusive upgrades you can always put 
in a version in the db and make the code handle both old  new version.


But that's admittedly a lot of extra work. Downtime is way easier when 
schemas change and for web-apps the downtime should be easy to keep short.


Regards
Robert

On 11/02/2011 12:38 AM, Igor Vaynberg wrote:

assuming you have no breaking changes to your db schema having no
downtime is relatively easy. while the process sounds involved it can
be easily automated - ie you write it once and from then one deploys
are easy.

* suppose you have two servers SA and SB in a load balancer pool PA
* create a new load balancer pool PB and put into it a server running
the upgraded version of your app SC
* instruct your load balancer to only send new sessions to PB
* wait until any server in pool PA is starved of its sessions and take
it out of the pool, upgrade, and put it into pool PB.
* once PA is empty drop it

this is not so easy if you have breaking schema changes (or changes to
other shared resources like webserivces) because once you upgrade the
schema you cant have any old code accessing it. for such breaking
changes you have to schedule a maintenance window.

-igor


On Tue, Nov 1, 2011 at 3:41 PM, taitaitai...@coderwerk.com  wrote:

Hi guys,
I was wondering about the following standard scenario:

- application v0.1 deployed to your favorite servlet container
- you want to deploy version v0.2 with minimal downtime and without losing
any session state (because it's a web shop application for example)

Is there a convenient way to shut down a wicket application so that it saves
its complete state to e.g. the filesystem and the next wicket app that boots
up initially reads the state from those files? anyone else handling server
upgrades differently and in a better way?

Thanks!





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Upgrading-of-Wicket-application-on-server-without-losing-state-tp3965762p3965762.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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




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



Re: Is it possible to turn off page serialization in 1.5?

2011-10-05 Thread Robert Dahlström
Why not simply wrap your objects in a LoadableDetachableModel? That way 
you don't need to force serializable objects in your code.


/Rob

On 10/05/2011 08:52 AM, Chris Colman wrote:

In 1.4 we had used:

getPageSettings().setAutomaticMultiWindowSupport(false);

and everything worked perfectly without making any of our model objects
serializable.

With 1.5 that method is no longer available and it's causing us to make
the model object serializable but that's causing a few problems of it's
own ;)

Is there a way to turn of page serialization in 1.5?

Regards,
Chris



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



Re: Replacing the contents of a table with ajax

2011-09-07 Thread Robert Dahlström
Usually, put a container around the table and update the container 
through ajax and not the table directly.


/Robert

On 09/07/2011 04:22 PM, Werner Riegel wrote:


Hello,

im trying to update the contents of a table, but it doesn't really work. I hope 
you guys can help me with that.

My page looks like the following:
It has a Form, consisting of a drop down list + an ajaxbutton, and below the 
form is a table.
After choosing an element from the list and pressing the ajaxbutton,
a serverside function will be executed that returns a list of items/objects. 
These items should then be displayed in the table.
That means, that all existing content in the table should be replaced by the 
new items (one item per row)
Actually all i want is to switch the old table contents with the new ones.

Since i couldnt replace the table itself, i put it in a Panel, which i am now 
replacing when the button is pressed.



The panel looks like this:

TablePanel.java: 
-
public TablePanel(String id, ListMyObject  objectList) {
 super(id);

 DataViewMyObject  dataView = new DataViewMyObject(objects, new 
ListDataProviderMyObject(objectList)) {

 @Override
 protected void populateItem(ItemMyObject  item) {
 MyObject obj = item.getModelObject();
 // populate
 }
 };

 dataView.setOutputMarkupId(true);
 add(dataView);
}
//TablePanel.java: 
---



The corresponding html file:

TablePanel.html: 
-
wicket:panel
table id=table-horizontal

   thead
 // header-content
   /thead

   tfoot
   /tfoot

   tbody
 tr wicket:id=objects
 tdspan wicket:id=itemValueX[id]/span  /td
// etc
 /tr
   /tbody
/table
/wicket:panel
//TablePanel.html: 
---



In the onSubmit function i build a new TablePanel object with the id from the 
old tablePanel and with the new list of items that i want to display, then add 
it to the target.
It looks like this:

AjaxButton: 
--
@Override
protected void onSubmit(AjaxRequestTarget target, Form?  form) {

 TablePanel tp = new TablePanel(tablePanel.getId(), 
getItemList(selectedFromDropDown));
 tp.setOutputMarkupId(true);
 target.add(tp);
}
//AjaxButton: 




The page.html in which the TablePanel is inserted contains this markup:

ItemPage.html: 
---
wicket:extend

form wicket:id=selectionForm
   select wicket:id=dropDown
 option[some option]/option
   /select
   input type=submit wicket:id=selectButton value=Show Items /
/form

span wicket:id=TablePanel[table content]/span

/wicket:extend
//ItemPage.html: 
-



After i press the button, the list of items gets generated and the new 
tablePanel is added to the target, but in the webbrowser i dont see any change.
The populateItem method in the TablePanel's DataView does not get executed 
either.

If i hardcode it, so that the TablePanel just uses a the getItems method - 
ignoring the ajaxbutton + dropbown - the items get displayed in the table just 
fine.
So that part seems to work OK, i guess it's just something with the ajax.
But i really don't know what i'm missing.


Regards,
Werner  


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



Re: On Label/Div or some other component, how to use setMarkupId and dynamic id

2011-09-02 Thread Robert Dahlström
If all you need is to scrape for them just give them a specific class. 
No need to use custom attributes.


Regards
Robert

On 09/01/2011 10:38 PM, Brown, Berlin [GCG-PFS] wrote:

Well setMarkId is already there.
And I have seen it done before, I think with the render Header?

I think I got what I needed.

-Original Message-
From: jcgarciam [mailto:jcgarc...@gmail.com]
Sent: Thursday, September 01, 2011 4:34 PM
To: users@wicket.apache.org
Subject: Re: On Label/Div or some other component, how to use
setMarkupId and dynamic id

I meant some specific custom attribute.

On Thu, Sep 1, 2011 at 5:33 PM, Juan Carlos Garcia
jcgarc...@gmail.comwrote:


Why not adding a behavior that output some specific custom tag using
the onComponentTag method? Will that work for you?



On Thu, Sep 1, 2011 at 4:54 PM, Brown, Berlin [GCG-PFS] [via Apache
Wicket]ml-node+3784600-559914674-65...@n4.nabble.com  wrote:


Strange but I may scrape the page and search for those particular
elements.  I want the prefix but I also want to keep uniqueness.



-Original Message-
From: Igor Vaynberg [mailto:[hidden
email]http://user/SendEmail.jtp?type=nodenode=3784600i=0]

Sent: Thursday, September 01, 2011 2:19 PM
To: [hidden email]
http://user/SendEmail.jtp?type=nodenode=3784600i=1
Subject: Re: On Label/Div or some other component, how to use
setMarkupId and dynamic id

i guess the question would be: why?

-igor

On Thu, Sep 1, 2011 at 10:57 AM, Brown, Berlin [GCG-PFS][hidden
email]http://user/SendEmail.jtp?type=nodenode=3784600i=2
wrote:


Is there a way to prefix a component with using setMarkupid but
also have the dynamic id.

I want my end output to have:

With Code:

x = new WebMarkupContainer(myId)
x.setMarkupId(myId);

div id=myId_id2323 /



-
To unsubscribe, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=3784600i=3
For additional commands, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=3784600i=4




-
To unsubscribe, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=3784600i=5
For additional commands, e-mail: [hidden
email]http://user/SendEmail.jtp?type=nodenode=3784600i=6



--
  If you reply to this email, your message will be added to the
discussion
below:

http://apache-wicket.1842946.n4.nabble.com/On-Label-Div-or-some-other
-component-how-to-use-setMarkupId-and-dynamic-id-tp3784344p3784600.ht
ml  To start a new topic under Apache Wicket, email
ml-node+1842946-398011874-65...@n4.nabble.com
To unsubscribe from Apache Wicket, click

herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp
?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXw
xODQyOTQ2fDEyNTYxMzc3ODY=.







--

JC








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



Re: Page Is Not Found In Page Map After Some Time.

2011-07-06 Thread Robert Dahlström
Not a complete reply but I think the default limit is 99 versions. This 
can be configured.


Regards
/Robert

On 07/06/2011 08:44 AM, Horacio Natyural wrote:

Hi,

we ofen get this error after performing back several times in an application.
It happens occassionally, does wicket's page map store have a
limitation on the number of times you can store the page?


here's the code in our back button.
we store the page id and version  and use that to track the pages.
after a lot of backs in an application, the page disappears from the
page map causing a nullpointerexception.

Is there anything that I could do to prevent this? what is the limit
on the number of pages that a pagemap could store?

@Override
public void onClick() {
if(clazz != null) {
setResponsePage(clazz);
}else if(pageIDVersion != null  webPage == null) {
setResponsePage(getPage().getPageMap().get(pageIDVersion.getId(),
pageIDVersion.getVersion()));  //SXIBackButton.java:67

} else if(webPage != null  pageIDVersion == null) {
setResponsePage(webPage);
}
}

org.apache.wicket.WicketRuntimeException: Method onLinkClicked of
interface org.apache.wicket.markup.html.link.ILinkListener targeted at
component [MarkupContainer [Component id = backButton]] threw an
exception
at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:193)
at 
org.apache.wicket.request.target.component.listener.ListenerInterfaceRequestTarget.processEvents(ListenerInterfaceRequestTarget.java:73)
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at 
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:468)
at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:138)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1098)
at 
com.hello.world.web.filters.TranslatorFilter.doFilter(TranslatorFilter.java:30)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
at 
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at 
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:295)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor415.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at 
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
... 31 more
Caused by: java.lang.IllegalArgumentException: Argument page must be not null
at 
org.apache.wicket.request.target.component.PageRequestTarget.init(PageRequestTarget.java:43)
at org.apache.wicket.RequestCycle.setResponsePage(RequestCycle.java:768)
at org.apache.wicket.Component.setResponsePage(Component.java:3166)
at 
com.hello.world..base.web.components.form.button.HelloBackButton.onClick(HelloBackButton.java:67)
at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:224)
... 35 more

Thanks
Horacio

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




-
To unsubscribe, e-mail: 

Locating StackOverflowErrors

2011-06-20 Thread Robert Dahlström
Hi, I've been trying for some time now to localize a somewhat random 
stackoverflow error. I've done an overhaul of the code and am now 
convinced we no longer have any reference to the session object but we 
still get StackOverflowErrors during page serialization.


This has probably been covered before (I seem to remember a link to some 
of the most common errors but could not find it again).


Any pointers would be greatly appreciated.

I guess this could be rephrased to: What are the do not's of Wicket?

Regards
Robert

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



Re: Locating StackOverflowErrors

2011-06-20 Thread Robert Dahlström

No, we should not have any references to the session in models.

Thanks
Robert

On 06/20/2011 11:43 AM, Serban.Balamaci wrote:

Hello,
Are you perhaps using your WebSession in a PropertyModel?
like new PropertyModel(getSession(), username) for example?

This way the web session might get serialized.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Locating-StackOverflowErrors-tp3610868p3610903.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: Locating StackOverflowErrors

2011-06-20 Thread Robert Dahlström
Besides me not being able to figure where we have done the wrong thing I 
don't have a problem with the serialization in Wicket 1.4 :)


Regards
Robert

On 06/20/2011 11:40 AM, Martin Grigorov wrote:

Hi,

Wicket uses Java Serialization to do this. So the question is: What
are the do not's of Java Serialization ?

In Wicket 1.5 this is plugable so you can use something else than Java
Serialization (still the default impl).

Schema-less serialization frameworks like Kryo and XStream is quite easy.
Schema ones like Apache Avro, Thrift, Protobuf, etc. are harder but
not impossible.

At 
https://github.com/wicketstuff/core/tree/master/jdk-1.5-parent/serializer-kryo
you can see such implementation based on
http://code.google.com/p/kryo/ . It is a new project so maybe there
are bugs and places for improvement.

2011/6/20 Robert Dahlströmrobert.dahlst...@ongame.com:

Hi, I've been trying for some time now to localize a somewhat random
stackoverflow error. I've done an overhaul of the code and am now convinced
we no longer have any reference to the session object but we still get
StackOverflowErrors during page serialization.

This has probably been covered before (I seem to remember a link to some of
the most common errors but could not find it again).

Any pointers would be greatly appreciated.

I guess this could be rephrased to: What are the do not's of Wicket?

Regards
Robert

-
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: Locating StackOverflowErrors

2011-06-20 Thread Robert Dahlström
Interesting idea, but I'm pretty sure we get a cyclic reference 
somewhere. (I'm basing that on the stacktrace below) which has been 
somewhat edited for brevity:


[org.apache.wicket.Session] - Exception when detaching/serializing page
java.lang.StackOverflowError
...
at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
...

org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)
at java.io.ObjectOutputStream.writeObject(Unknown Source)
at 
org.apache.wicket.util.lang.Objects.objectToByteArray(Objects.java:1124)
	at 
org.apache.wicket.protocol.http.pagestore.AbstractPageStore.serializePage(AbstractPageStore.java:203)
	at 
org.apache.wicket.protocol.http.pagestore.DiskPageStore.prepareForSerialization(DiskPageStore.java:1190)
	at 
org.apache.wicket.protocol.http.SecondLevelCacheSessionStore$SecondLevelCachePageMap.writeObject(SecondLevelCacheSessionStore.java:390)

...
	at 
org.apache.wicket.util.io.IObjectStreamFactory$DefaultObjectStreamFactory$2.writeObjectOverride(IObjectStreamFactory.java:121)

...
rince  repeat, until Wicket has had enough.

/Robert

On 06/20/2011 01:01 PM, Martijn Dashorst wrote:

Note that you can increase the max stack size, which sometimes too low
for given component structures. We run with the default for 64 bit
machines on our production boxes (-Xss1024k), but that is specific to
and sufficient for our application. Your application might just push
that boundary.

You might want to try to double the size and see how that works out.
If you still see those errors, then you might have an infinite loop
somewhere...


From  http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#threads_oom:


My application has a lot of threads and is running out of memory, why?

You may be running into a problem with the default stack size for
threads. In Java SE 6, the default on Sparc is 512k in the 32-bit VM,
and 1024k in the 64-bit VM. On x86 Solaris/Linux it is 320k in the
32-bit VM and 1024k in the 64-bit VM.

On Windows, the default thread stack size is read from the binary
(java.exe). As of Java SE 6, this value is 320k in the 32-bit VM and
1024k in the 64-bit VM.

You can reduce your stack size by running with the -Xss option. For example:

java -server -Xss64k

Note that on some versions of Windows, the OS may round up thread
stack sizes using very coarse granularity. If the requested size is
less than the default size by 1K or more, the stack size is rounded up
to the default; otherwise, the stack size is rounded up to a multiple
of 1 MB.

64k is the least amount of stack space allowed per thread.

Martijn


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



Re: [WICKET-3552] Is adding another parameter to the constructor required?

2011-06-08 Thread Robert Dahlström
+1 on skipping a boolean flag in the constructor. Igors suggestion to 
provide a mode parameter feels like a good one.


/Robert

On 06/08/2011 10:18 AM, Martin Grigorov wrote:

Hi Per,

I see your point.
It is just my opinion (and ticket's reporter) that this additional
boolean parameter to the constructor is adds much less noise than
adding additional 2 classes.
If the name of AttributeAppender is changed to AtrributeAdder (because
we are used that add(obj) appends and add(0, obj) prepends) then it
will be much cleaner.

Igor's suggestion also sounds OK to me. Then we can either deprecate
AttributeAppender or add AttributePrepender and both of them will just
have constructors that pass the proper mode to AttributeModifier.

Create a ticket.

On Wed, Jun 8, 2011 at 10:04 AM, Per Newgroper.new...@gmx.ch  wrote:

Hi Martin Grigorov,

But i made naming proposals:
AbstractAttributeRegister
| |
AttributeAppender  AttributePrepender

My pain in the ... is only that we have now 2 more constructors. This (in my
opinion)
really important class should be clear in design and responsibility.
Another pain could become important if we decide to exchange the default
values
for prepend. Wicket did that already in history and it lead to confusion and
required
app changes.

The sense in the one common parent would be to provide the abstract method
for value registering. The subclasses would have to implement that.

package org.apache.wicket.behavior;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.model.IModel;
import org.apache.wicket.util.string.AppendingStringBuffer;
import org.apache.wicket.util.string.Strings;

public class AbstractAttributeRegister extends AttributeModifier
{
private static final long serialVersionUID = 1L;

private final String separator;

public AbstractAttributeRegister(String attribute, boolean
addAttributeIfNotPresent,
IModel?  appendModel, String separator)
{
this(attribute, addAttributeIfNotPresent, appendModel, separator);
}

public AbstractAttributeRegister(String attribute, IModel?  appendModel,
String separator)
{
this(attribute, true, appendModel, separator);
}


/**
 * @see org.apache.wicket.AttributeModifier#newValue(java.lang.String,
java.lang.String)
 */
@Override
protected String newValue(String currentValue, String appendValue)
{
// Shortcut for empty values
if (Strings.isEmpty(currentValue))
{
return appendValue != null ? appendValue : ;
}
else if (Strings.isEmpty(appendValue))
{
return currentValue;
}

final AppendingStringBuffer sb = new
AppendingStringBuffer(currentValue.length() +
appendValue.length() + separator.length());

return registerValue(sb, currentValue, appendValue);
}

protected abstract String registerValue(AppendingStringBuffer target,
String currentValue, String appendValue);
}

public class AttributeAppender extends AbstractAttributeRegister
{
private static final long serialVersionUID = 1L;

public AttributeAppender(String attribute, boolean
addAttributeIfNotPresent,
IModel?  appendModel, String separator)
{
super(attribute, addAttributeIfNotPresent, appendModel, separator);
}

public AttributeAppender(String attribute, IModel?  appendModel, String
separator)
{
super(attribute, appendModel, separator);
}

@Override
protected String registerValue(AppendingStringBuffer target, String
currentValue, String value, String separator)
{
sb.append(currentValue);
sb.append(separator);
sb.append(value);
return sb.toString();
}
}

public class AttributePrepender extends AbstractAttributeRegister
{
private static final long serialVersionUID = 1L;

public AttributePrepender(String attribute, boolean
addAttributeIfNotPresent,
IModel?  appendModel, String separator)
{
super(attribute, addAttributeIfNotPresent, appendModel, separator);
}

public AttributePrepender(String attribute, IModel?  appendModel, String
separator)
{
super(attribute, appendModel, separator);
}

@Override
protected String registerValue(AppendingStringBuffer target, String
currentValue, String value, String separator)
{
sb.append(value);
sb.append(separator);
sb.append(currentValue);
return sb.toString();
}
}




Hi,

I also had the same thoughts when I added the flag (as the patch
suggested) but AttributeAppender is a class with just constructor
overrides and one method override (#newValue()). If we introduce yet
another class for prepend then there is no sense in the one common
parent because they have nothing to share. Both of them will have the
same number of constructors and this override of #newValue().

I agree that now the 

Re: warn on exit from browser

2011-05-19 Thread Robert Dahlström

With just a quick look:
setRedirect(true)

may help and not just setResponsePage()

Regards
Robert

On 05/19/2011 08:53 AM, rebecca wrote:

Thank you all for replying

It does sound like I'm trying to do something impossible, but I would like
to post my code here in case i did not explain the problem correctly:

I add onbeforeunload event to the body of my page, which calls a JS
function. The JS does submit to my form. In my form onSubmit() I do a
setResponsePage.

I see that it get's into the onSubmit() (and even to the destination page's
constructor), but after exit from onSubmit(), it returns to the original
page (refereshing the entered data).

Here's the code:

on page

body.add(new SimpleAttributeModifier(onload, isSubmit=false;));
StringBuilder js = new StringBuilder();
js.append(if(!isSubmit){checkLeaving( ');
js.append(getString(leaveWizardMessage));
js.append(', ');
js.append(newAccountWizard.getForm().getMarkupId());
js.append(', ');
js.append(newAccountWizard.getConfirmationModal().getMarkupId());
js.append(')};);

body.add(new SimpleAttributeModifier(onbeforeunload, js.toString()));
add(body);

js file

function checkLeaving(message, formId, modalId, linkId){

//alert(formId =  + formId);
var answer = confirm(message);
if(answer == true){
var form = document.getElementById(formId);
//var modal = document.getElementById(modalId);
//var submitLink = document.getElementById(linkId);
alert(before submit);
form.submit();
//submitLink.onclick();
//return false;
}
}

wizard panel
-
@Override
protected Form newForm(String id) {

form = new Form(id){

@Override
protected void onSubmit() {
System.out.println(in form submit1);

setResponsePage(NewAccountRegistrationPage.class);
System.out.println(in form submit2);
}

protected void onError() {
System.out.println(in form error);
};
};



Can someone please tell me if it's possible?

Rebbaca


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/warn-on-exit-from-browser-tp3516569p3534945.html
Sent from the Users forum mailing list archive at Nabble.com.

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




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



Re: 1.5 RC4

2011-05-05 Thread Robert Dahlström

DataTable component

Cheers
Robert

On 05/05/2011 11:04 AM, Madan Mohan wrote:

Hi,

Can anybody give me the best solution in the below case,

In database there are two fields say A, B
In UI i want to display a column which shows the value which is equal to A/B
and this column should be sortable and the table should support pagination.


we can load all the records from database and sort according to the (A/B)
and present in UI as per the pagination(manually).
This process will repeat for each pagination click and sort click. I feel
this is not a perfect solution.

Wicket has anything in these type of situations??



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



Re: AttibuteModifier question

2011-04-06 Thread Robert Dahlström

If you're outside of the onComponentTag you can do:
String cssClass = component.getMarkupAttributes().getString(class);

Regards
Robert

On 04/06/2011 08:36 AM, Wilhelmsen Tor Iver wrote:

1. get the existing class value,


Only when parsing the markup in onComponentTag().

- Tor Iver

-
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



Nested forms and conditional validation

2011-03-30 Thread Robert Dahlström
Hi, I'm currently trying to work out how to do conditional validation 
with nested forms. Googling a bit gave me the following suggestion on 
how to disable a nested form:


(From https://cwiki.apache.org/WICKET/conditional-validation.html)
Form nestedForm = new Form(nestedForm) {
 @Override
  public boolean isEnabled() {
   if (getRootForm().findSubmittingButton() != null) {
return getRootForm().findSubmittingButton().getForm() == this;
   } else {
return true;
   }
}

But when I try this with Wicket 1.4.16 I noticed that 
findSubmittingButton internally calls isEnabledInHierarchy which ends up 
calling isEnabled so I get stuck in a loop that eventually throws an 
exception.


So how should one go about working with nested forms if I don't want the 
nested form to be submitted when the outer form is submitted?


Appreciative of any help,

Regards
Robert

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



Re: Nested forms and conditional validation

2011-03-30 Thread Robert Dahlström
I did manage to get this working using the other pattern from the 
conditional-validation page (i.e. using the FormVisitorParticipant) but 
I'm still curious if the isEnabled solution should work or not?


Regards
Robert

On 03/30/2011 02:45 PM, Robert Dahlström wrote:

Hi, I'm currently trying to work out how to do conditional validation
with nested forms. Googling a bit gave me the following suggestion on
how to disable a nested form:

(From https://cwiki.apache.org/WICKET/conditional-validation.html)
Form nestedForm = new Form(nestedForm) {
   @Override
public boolean isEnabled() {
 if (getRootForm().findSubmittingButton() != null) {
  return getRootForm().findSubmittingButton().getForm() == this;
 } else {
  return true;
 }
}

But when I try this with Wicket 1.4.16 I noticed that
findSubmittingButton internally calls isEnabledInHierarchy which ends up
calling isEnabled so I get stuck in a loop that eventually throws an
exception.

So how should one go about working with nested forms if I don't want the
nested form to be submitted when the outer form is submitted?

Appreciative of any help,

Regards
Robert

-
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: preferred php framework by wicketeers...

2011-03-08 Thread Robert Dahlström
+1 for Symfony, probably as good as you can get for PHP. But no, it 
won't work like wicket. Afaik there are no stateful PHP frameworks out 
there (but I could be wrong).


/Robert

On 03/08/2011 01:30 PM, Martin Makundi wrote:

Sorry..not close but far...maybe I meant keep enemies closer ;)

**
Martin

2011/3/8 Martin Makundimartin.maku...@koodaripalvelut.com:

Hmm.. I would personally stay as close as possible from non statically
typed languages ;)

Ofcourse it depends on what you are making, if it is worth making and
so forth ;)

**
Martin

2011/3/8 Antoine van Welantoine.van@gmail.com:

Since you can't always have what you want..

Is there any PHP framework out there which comes even close to Wicket;
component based, strict separation between HTML and programming,
stateful, out-of-the-box Ajax support, event handling, URL mapping,
excellent testing features, and great community support?


regards
Antoine

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






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




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



Re: DataTable and toolbar

2011-02-11 Thread Robert Dahlström

In the addToolbar() method you have:
WebMarkupContainer item = new ToolbarContainer(container.newChildId());

That's where the magic happens :)

Regards
Robert

On 02/11/2011 02:26 PM, Alex Shubert wrote:

Sure thing, but how exactly does it works if there are no such ID in
html markup for DataTable? =) This was the question.

On 11 February 2011 16:18, Pedro Santospedros...@gmail.com  wrote:

Hi, u use this id to create an AbstractToolbar to be add to DataTable using
one of its method like:
DataTable#addTopToolbar
DataTable#addBottomToolbar

On Fri, Feb 11, 2011 at 11:08 AM, Alex Shubertalex.shub...@gmail.comwrote:


Hello

Recently I found public static final String TOOLBAR_COMPONENT_ID =
toolbar;
in DataTable sources but can't find such ID in markups. How exactly
does it works?

Thanks

--
Best regards
Alex

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





--
Pedro Henrique Oliveira dos Santos







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



Re: DataTable and toolbar

2011-02-11 Thread Robert Dahlström
As far as I can tell yes. But maybe someone with better knowledge can 
enlighten us?


/Robert

On 02/11/2011 02:38 PM, Alex Shubert wrote:

So, the toolbar id just droppped out? It is used only as a marker?


2011/2/11 Robert Dahlströmrobert.dahlst...@bwin.org:

In the addToolbar() method you have:
WebMarkupContainer item = new ToolbarContainer(container.newChildId());

That's where the magic happens :)

Regards
Robert






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



Re: ListChoice move up and down

2011-02-02 Thread Robert Dahlström

Not sure if this is what you want but maybe it can work as a starting point:

ListView.moveDownLink
ListView.moveUpLink

Regards
Robert

On 02/02/2011 10:16 AM, Altuğ Bilgin Altıntaş wrote:

Hi;

Any example about how to move up and down via Javascript ListChoice items.

Thanks.



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



Re: Wickettester, cookies and redirects in Wicket 1.4.15

2011-02-02 Thread Robert Dahlström

Thanks for the tip but I'd prefer to stick with WicketTester for the moment.

Regards
Robert

On 02/02/2011 10:36 AM, Kent Tong wrote:

Hi, I currently have an application reading a cookie in my session. All
of my unit tests where the pattern is: Create page -  submit form -
redirect to new page fails to read this cookie after the redirect to new
page.


Have you tried http://wicketpagetest.sourceforge.net which supports
this case automatically.


-
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



Wickettester, cookies and redirects in Wicket 1.4.15

2011-02-01 Thread Robert Dahlström
Hi, I currently have an application reading a cookie in my session. All 
of my unit tests where the pattern is: Create page - submit form - 
redirect to new page fails to read this cookie after the redirect to new 
page.


The cookie is added both to the response and request before each new 
test (WicketTester gets recreated):

tester.getWicketResponse().addCookie(cookie);
tester.getServletRequest().setCookies(new Cookie[]{cookie});

This works fine during first page rendering and form submission. But 
after the form has been submitted and the redirect to new page takes 
place the cookie does not exist in the new request.


Since I'm a bit unsure if this is the wanted behavior for WicketTester 
or not I'm posting this to all users out there.


In my particular use case I would like the cookie to be persisted 
between original request and new request since that's how it is working 
in the real application.


Codewise (with Wicket 1.4.15):
In MockWebApplication.postProcessRequestCycle:
if (httpResponse.isRedirect())
{
  lastRenderedPage = generateLastRenderedPage(cycle);

  MockHttpServletRequest newHttpRequest = new 
MockHttpServletRequest(application, servletSession, 
application.getServletContext());


...
}

The call to new MockHttpServletRequest will clear all cookies set during 
initialize() and thus my cookie will not be set in the redirect request.


Any ideas on how to tackle this? For me I'd like the WicketTester to 
copy any existing cookies from the original request to the redirect 
request. I'd also be happy if there's another place in the code where I 
can set the cookie to have it available during the redirect request 
phase as well.


I also found an old bug (WICKET-1886) that felt like the same issue when 
I read it.


Regards
Robert

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



Re: Wickettester, cookies and redirects in Wicket 1.4.15

2011-02-01 Thread Robert Dahlström

Thanks, I'll add the info I have to the bug.

Regards
Robert

On 02/01/2011 01:02 PM, Pedro Santos wrote:

Hi Hobert, I reopened the WICKET-1886

2011/2/1 Robert Dahlströmrobert.dahlst...@bwin.org


Hi, I currently have an application reading a cookie in my session. All of
my unit tests where the pattern is: Create page -  submit form -  redirect
to new page fails to read this cookie after the redirect to new page.

The cookie is added both to the response and request before each new test
(WicketTester gets recreated):
tester.getWicketResponse().addCookie(cookie);
tester.getServletRequest().setCookies(new Cookie[]{cookie});

This works fine during first page rendering and form submission. But after
the form has been submitted and the redirect to new page takes place the
cookie does not exist in the new request.

Since I'm a bit unsure if this is the wanted behavior for WicketTester or
not I'm posting this to all users out there.

In my particular use case I would like the cookie to be persisted between
original request and new request since that's how it is working in the real
application.

Codewise (with Wicket 1.4.15):
In MockWebApplication.postProcessRequestCycle:
if (httpResponse.isRedirect())
{
  lastRenderedPage = generateLastRenderedPage(cycle);

  MockHttpServletRequest newHttpRequest = new
MockHttpServletRequest(application, servletSession,
application.getServletContext());

...
}

The call to new MockHttpServletRequest will clear all cookies set during
initialize() and thus my cookie will not be set in the redirect request.

Any ideas on how to tackle this? For me I'd like the WicketTester to copy
any existing cookies from the original request to the redirect request. I'd
also be happy if there's another place in the code where I can set the
cookie to have it available during the redirect request phase as well.

I also found an old bug (WICKET-1886) that felt like the same issue when I
read it.

Regards
Robert

-
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