catch jquery event at AjaxEventBehavior

2011-07-31 Thread Lurtz Nazgul
Hi; 

I used jquery dialog. I can open and close jquery dialog box. I represent 
jquery 
dialog as a panel at wicket side.

My question is how can i catch jquery close event ? 

I tested like below but it doesn't work

dialogConfirmation.add(new AjaxEventBehavior("close") {
  @Override
  protected void onEvent(AjaxRequestTarget target) {
  System.out.println(" closed" );
  }
}) ;

Thanks.

Re: Scala DSL for Wicket

2011-07-31 Thread Gary Thomas


I've written some Scala utilities as well, but instead of a DSL I'm 
using implicit conversions via traits, which I've found to be a really 
nice fit with Wicket.


An example:

import org.apache.wicket.model.IModel
import org.apache.wicket.model.LoadableDetachableModel
import org.apache.wicket.model.PropertyModel

trait WicketConversions {
   // transparent PropertyModel conversion
implicit def tuple2model[T](tuple: (AnyRef, String)): 
PropertyModel[T] = {

new PropertyModel[T](tuple._1, tuple._2)
}

// transparent function/closure to LoadableDetachableModel conversion
implicit def function2model[T](f: => T): IModel[T] = {
new LoadableDetachableModel[T] {
def load: T = f
}
}
}

Usage:

class MyPanel extends Panel("id") with WicketConversions {

// transparent PropertyModel conversion using article.rating):
add(new RatingPanel("rating", article -> "rating") // so pretty

// transparent LoadableDetachableModel conversion (expects 
IModel[Boolean]):

add(new AjaxCheckBox("selected", { dao.get(id).isAdmin }) {
def onUpdate(target: AjaxRequestTarget) { ... }
})
}


I have more code as well for Spring integration, etc.
If anyone is interested, I could add mine to this or to a new GitHub 
project.



Thanks,
Gary


On 7/29/11 5:22 PM, Ben Tilford wrote:

For LDM

class Ldm[T](provider:()=>  T) extends LoadableDetachable... {
   def load():T {
 provider()
   }
}

object Ldm {
   def apply(provider:()=>T) = new Ldm[T](provider)
}

could be used as

...
val id = 1
val model = Ldm(()=>{dao.get(id)})

or

val id = 1
def provider = dao.get(id)
val model = Ldm(provider)


On Fri, Jul 29, 2011 at 6:44 AM, Martin Grigorovwrote:


Bruno,

Yet another idea for the dsl:

def ldm[R, ID](id: ID = null, f: (ID) =>  R) = {new
LoadableDetachableModel(id) { override def load() : R = { f(id); } } }

P.S. Not tested.

On Thu, Jul 28, 2011 at 9:07 AM, Bruno Borges
wrote:

Just wanted to share my experience playing a little more with Scala and
Wicket>  A few minutes ago I got this excelent code:

I know it is too simple, and it can be accomplished as well in Java with
static imports. But still, for my project it's being great (and cool) to

do

such things.

 object btnEditar extends Button("btnEditar") {
   override def onSubmit() = {
-/* show fields */
-camposForm.setVisibilityAllowed(true)
-btnSalvar.setVisibilityAllowed(true)
-cancelar.setVisibilityAllowed(true)
-
-/* hide them */
-camposTela.setVisibilityAllowed(false)
-btnEditar.setVisibilityAllowed(false)
+show(camposForm, btnSalvar, cancelar)
+hide(camposTela, btnEditar)
   }
 }
 add(btnEditar)

Methods show/hide are imported as "import code.DSLWicket._"



*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Wed, Jul 27, 2011 at 4:53 PM, Bruno Borges
Thanks Martin,

There was only a small little problem in your code. The correct syntax

is:


def label[T](id: String, model: IModel[T] = null): Label = { val label
= new Label(id, model); add(label); label }

The suggestions were updated on Gist.

*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Wed, Jul 27, 2011 at 3:55 PM, Martin Grigorov
wrote:



Idea for simplification: use named parameters.
For example
def label[T](id: String, model: IModel[T]): Label = { val label = new
Label(id, model); add(label); label }
would become
def label[T](id: String, model = _ : IModel[T]): Label = { val label =
new Label(id, model); add(label); label }

this way you'll have just one declaration of label function which will
handle the current three

additionally you may add a pimp:
implicit def ser2model[S :<  Serializable](ser: S): IModel[S] =
Model.of(ser)

now even when you pass String as second param to label() it will be
converted to IModel

On Wed, Jul 27, 2011 at 9:11 PM, Martin Grigorov


wrote:

Take a look at scala.swing.* sources.

On Wed, Jul 27, 2011 at 8:34 PM, Bruno Borges<

bruno.bor...@gmail.com>

wrote:

Can some Scala expert help me to make this DSL available as PML

(pimp

my

library)?

I've tried to code it that way but things didn't quite worked out

the

way

they should.

The reason is that for every Wicket object I create, I must extend

the

trait

DSLWicket



*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Wed, Jul 27, 2011 at 2:30 PM, Bruno Borges<

bruno.bor...@gmail.com

wrote:



Not really.

The method onSubmit() of button is void, as well onClick(), so

there's

no

need for the function be passed as () =>  Unit or anything else.

I made a few changes to it and updated on Gist.

I've also uploaded a page that uses this DSL at
https://gist.github.com/1109919

Take a look

*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Wed, Jul 27, 2011 at 2:22 PM, Scott Swank<

scott.sw...@gmail.com

wrote:



I think you do want Unit, which as I understand it is closest
equivalent to "void" in Scala.

htt

Re: serialization problem with spring

2011-07-31 Thread Joe Fawzy
Hi

actually for testing , i tried using the new kryo-serializer from wicket
stuff
IT DOES NOT WORK, actually it has many more errors than the default one,
actuallly it cannot serialize a JdkDynamicProxy which is the basis for
injection
If someone have a solution or workaround , please help
Thanks
Joe

On Mon, Aug 1, 2011 at 8:10 AM, Joe Fawzy  wrote:

> Hi
>
> i am living on the edge ,using wicket 1.5RC5.1 (the latest)
> and also using the newly released Spring data-jpa project for data access
>
> i do not use or reference PersistenceExceptionTranslationInterceptor
> directly, actually i never know it is there  till i saw that error
>
> based on its name it is an interceptor which translate the jpa or jdbc
> exception to spring's counterpart
>
> in AccountManager there is an instance of AccountDAO which use this
> persistence technology
>
> i thought it might be a solution to use kryo serialization as it does not
> require the object to be serializable, but the site does not recommend using
> it in production as it is in its early stages and not yet stable
>
> Any help please?
>
> Thanks
>
> Joe
>
> On Mon, Aug 1, 2011 at 4:35 AM, Dan Retzlaff  wrote:
>
>> Hi Joe,
>>
>> Based on the depth of that serialization stack, I doubt it's your
>> AccountManager proxy that's giving you problems. I usually just breakpoint
>> NotSerializableException and walk up the stack to find the culprit. Any
>> change your CreatePage uses a method on AccountManager that returns an
>> object with PersistenceExceptionTranslationInterceptor, then holds a
>> reference to it? If so, that'll be a problem since Wicket doesn't know to
>> proxy that one.
>>
>> Dan
>>
>> On Sun, Jul 31, 2011 at 5:08 PM, Joe Fawzy  wrote:
>>
>> > Hi
>> > i have a serialization problem with spring
>> > My CreatePage class looks like:-
>> >
>> > public class CreatePage extends WebPage{
>> >@SpringBean
>> >AccountManager accountManager;
>> > }
>> >
>> > as i am using @SpringBean , it should handle creating a serializable
>> proxy
>> > for me BUT
>> >
>> > i got the following exception
>> >
>> >
>> >
>> > ERROR - JavaSerializer - Error serializing object class
>> > com.app.view.account.CreatePage [object=[Page class =
>> > com.app.view.account.CreatePage, id = 1, render count = 1]]
>> > java.io.NotSerializableException:
>> >
>> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>> > at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>> > at
>> >
>> >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> > at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>> > at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>> > at
>> >
>> >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>> > at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>> > at
>> >
>> >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>> > at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>> > at
>> >
>> >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>> > at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>> > at
>> >
>> >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>> > at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>> > at
>> >
>> >
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>> > at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
>> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
>> > at
>> >
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)

Re: serialization problem with spring

2011-07-31 Thread Joe Fawzy
Hi

i am living on the edge ,using wicket 1.5RC5.1 (the latest)
and also using the newly released Spring data-jpa project for data access

i do not use or reference PersistenceExceptionTranslationInterceptor
directly, actually i never know it is there  till i saw that error

based on its name it is an interceptor which translate the jpa or jdbc
exception to spring's counterpart

in AccountManager there is an instance of AccountDAO which use this
persistence technology

i thought it might be a solution to use kryo serialization as it does not
require the object to be serializable, but the site does not recommend using
it in production as it is in its early stages and not yet stable

Any help please?

Thanks

Joe

On Mon, Aug 1, 2011 at 4:35 AM, Dan Retzlaff  wrote:

> Hi Joe,
>
> Based on the depth of that serialization stack, I doubt it's your
> AccountManager proxy that's giving you problems. I usually just breakpoint
> NotSerializableException and walk up the stack to find the culprit. Any
> change your CreatePage uses a method on AccountManager that returns an
> object with PersistenceExceptionTranslationInterceptor, then holds a
> reference to it? If so, that'll be a problem since Wicket doesn't know to
> proxy that one.
>
> Dan
>
> On Sun, Jul 31, 2011 at 5:08 PM, Joe Fawzy  wrote:
>
> > Hi
> > i have a serialization problem with spring
> > My CreatePage class looks like:-
> >
> > public class CreatePage extends WebPage{
> >@SpringBean
> >AccountManager accountManager;
> > }
> >
> > as i am using @SpringBean , it should handle creating a serializable
> proxy
> > for me BUT
> >
> > i got the following exception
> >
> >
> >
> > ERROR - JavaSerializer - Error serializing object class
> > com.app.view.account.CreatePage [object=[Page class =
> > com.app.view.account.CreatePage, id = 1, render count = 1]]
> > java.io.NotSerializableException:
> >
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> > at
> >
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> > at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> > at
> >
> >
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputS

Re: Manually Rendering a DataGridView

2011-07-31 Thread Pedro Santos
The char sequence is returned by mockResponse.getText()
Sure, there are no public methods and would be a good idea to
refectory the code and move the mock response logic to other place.
You can use an IVisitor to visit cells in you component tree,  create
a mock response to render them and use its text, i.e.
mockResponse.getText(), to fit your needs

On Sun, Jul 31, 2011 at 10:33 AM, Matt Schmidt  wrote:
> So after calling tableParser.parse(myDataGridView), how do I get the the
> char sequence? Or iterate over each row to get the char sequence for each
> cell? I don't see any public methods for that.
>
> On Sunday, July 31, 2011, Pedro Santos  wrote:
>> Hi, I had a similar need and used the code at TableParser[1] to render
>> the component tree to a mock response and later get its char sequence.
>>
>> 1 -
> https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
>>
>> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt 
> wrote:
>>> Is there any way to access the HTML of each cell that would be rendered
> in a
>>> DataGridView without adding it to the page and actually rendering it?
>>>
>>> Ultimately, I am trying to add all of the inner HTML of the cells of the
>>> DataGridView to a JavaScript array.
>>>
>>
>>
>>
>> --
>> Pedro Henrique Oliveira dos Santos
>>
>> -
>> 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: serialization problem with spring

2011-07-31 Thread Dan Retzlaff
Hi Joe,

Based on the depth of that serialization stack, I doubt it's your
AccountManager proxy that's giving you problems. I usually just breakpoint
NotSerializableException and walk up the stack to find the culprit. Any
change your CreatePage uses a method on AccountManager that returns an
object with PersistenceExceptionTranslationInterceptor, then holds a
reference to it? If so, that'll be a problem since Wicket doesn't know to
proxy that one.

Dan

On Sun, Jul 31, 2011 at 5:08 PM, Joe Fawzy  wrote:

> Hi
> i have a serialization problem with spring
> My CreatePage class looks like:-
>
> public class CreatePage extends WebPage{
>@SpringBean
>AccountManager accountManager;
> }
>
> as i am using @SpringBean , it should handle creating a serializable proxy
> for me BUT
>
> i got the following exception
>
>
>
> ERROR - JavaSerializer - Error serializing object class
> com.app.view.account.CreatePage [object=[Page class =
> com.app.view.account.CreatePage, id = 1, render count = 1]]
> java.io.NotSerializableException:
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> at
>
> org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:77)
> at
>
> org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:356)
> at
>
> org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:142)
> at
>
> org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:377)
> at
>
> org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:171)
> at
>
> org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:94)
> at
>
> org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:68)
> at
>
> org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:213)
> at org.apache.wicket.Application$2.onDetach(Application.java:1548)
> 

Re: Scala DSL for Wicket

2011-07-31 Thread Bruno Borges
This is an excellent piece of code.

What I had was similar, but in a trait as a method:

def ldm( loadF() => T ): IModel[T] = {
   ...
}

I guess breaking the DSL will make it easier to maintain. :-) And your
approach is much better


*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Fri, Jul 29, 2011 at 9:22 PM, Ben Tilford  wrote:

> For LDM
>
> class Ldm[T](provider:()=> T) extends LoadableDetachable... {
>  def load():T {
>provider()
>  }
> }
>
> object Ldm {
>  def apply(provider:()=>T) = new Ldm[T](provider)
> }
>
> could be used as
>
> ...
> val id = 1
> val model = Ldm(()=>{dao.get(id)})
>
> or
>
> val id = 1
> def provider = dao.get(id)
> val model = Ldm(provider)
>
>
> On Fri, Jul 29, 2011 at 6:44 AM, Martin Grigorov  >wrote:
>
> > Bruno,
> >
> > Yet another idea for the dsl:
> >
> > def ldm[R, ID](id: ID = null, f: (ID) => R) = {new
> > LoadableDetachableModel(id) { override def load() : R = { f(id); } } }
> >
> > P.S. Not tested.
> >
> > On Thu, Jul 28, 2011 at 9:07 AM, Bruno Borges 
> > wrote:
> > > Just wanted to share my experience playing a little more with Scala and
> > > Wicket> A few minutes ago I got this excelent code:
> > >
> > > I know it is too simple, and it can be accomplished as well in Java
> with
> > > static imports. But still, for my project it's being great (and cool)
> to
> > do
> > > such things.
> > >
> > > object btnEditar extends Button("btnEditar") {
> > >   override def onSubmit() = {
> > > -/* show fields */
> > > -camposForm.setVisibilityAllowed(true)
> > > -btnSalvar.setVisibilityAllowed(true)
> > > -cancelar.setVisibilityAllowed(true)
> > > -
> > > -/* hide them */
> > > -camposTela.setVisibilityAllowed(false)
> > > -btnEditar.setVisibilityAllowed(false)
> > > +show(camposForm, btnSalvar, cancelar)
> > > +hide(camposTela, btnEditar)
> > >   }
> > > }
> > > add(btnEditar)
> > >
> > > Methods show/hide are imported as "import code.DSLWicket._"
> > >
> > >
> > >
> > > *Bruno Borges*
> > > www.brunoborges.com.br
> > > +55 21 76727099
> > >
> > >
> > >
> > > On Wed, Jul 27, 2011 at 4:53 PM, Bruno Borges  > >wrote:
> > >
> > >> Thanks Martin,
> > >>
> > >> There was only a small little problem in your code. The correct syntax
> > is:
> > >>
> > >> def label[T](id: String, model: IModel[T] = null): Label = { val label
> > >> = new Label(id, model); add(label); label }
> > >>
> > >> The suggestions were updated on Gist.
> > >>
> > >> *Bruno Borges*
> > >> www.brunoborges.com.br
> > >> +55 21 76727099
> > >>
> > >>
> > >>
> > >> On Wed, Jul 27, 2011 at 3:55 PM, Martin Grigorov <
> mgrigo...@apache.org
> > >wrote:
> > >>
> > >>> Idea for simplification: use named parameters.
> > >>> For example
> > >>> def label[T](id: String, model: IModel[T]): Label = { val label = new
> > >>> Label(id, model); add(label); label }
> > >>> would become
> > >>> def label[T](id: String, model = _ : IModel[T]): Label = { val label
> =
> > >>> new Label(id, model); add(label); label }
> > >>>
> > >>> this way you'll have just one declaration of label function which
> will
> > >>> handle the current three
> > >>>
> > >>> additionally you may add a pimp:
> > >>> implicit def ser2model[S :< Serializable](ser: S): IModel[S] =
> > >>> Model.of(ser)
> > >>>
> > >>> now even when you pass String as second param to label() it will be
> > >>> converted to IModel
> > >>>
> > >>> On Wed, Jul 27, 2011 at 9:11 PM, Martin Grigorov <
> mgrigo...@apache.org
> > >
> > >>> wrote:
> > >>> > Take a look at scala.swing.* sources.
> > >>> >
> > >>> > On Wed, Jul 27, 2011 at 8:34 PM, Bruno Borges <
> > bruno.bor...@gmail.com>
> > >>> wrote:
> > >>> >> Can some Scala expert help me to make this DSL available as PML
> > (pimp
> > >>> my
> > >>> >> library)?
> > >>> >>
> > >>> >> I've tried to code it that way but things didn't quite worked out
> > the
> > >>> way
> > >>> >> they should.
> > >>> >>
> > >>> >> The reason is that for every Wicket object I create, I must extend
> > the
> > >>> trait
> > >>> >> DSLWicket
> > >>> >>
> > >>> >>
> > >>> >>
> > >>> >> *Bruno Borges*
> > >>> >> www.brunoborges.com.br
> > >>> >> +55 21 76727099
> > >>> >>
> > >>> >>
> > >>> >>
> > >>> >> On Wed, Jul 27, 2011 at 2:30 PM, Bruno Borges <
> > bruno.bor...@gmail.com
> > >>> >wrote:
> > >>> >>
> > >>> >>> Not really.
> > >>> >>>
> > >>> >>> The method onSubmit() of button is void, as well onClick(), so
> > there's
> > >>> no
> > >>> >>> need for the function be passed as () => Unit or anything else.
> > >>> >>>
> > >>> >>> I made a few changes to it and updated on Gist.
> > >>> >>>
> > >>> >>> I've also uploaded a page that uses this DSL at
> > >>> >>> https://gist.github.com/1109919
> > >>> >>>
> > >>> >>> Take a look
> > >>> >>>
> > >>> >>> *Bruno Borges*
> > >>> >>> www.brunoborges.com.br
> > >>> >>> +55 21 76727099
> > >>> >>>
> > >>> >>>
> > >>> >>>
> > >>> >>> On Wed, Jul 27, 2011 at 2:22 PM, Scott Swank <
> > scott.sw...@g

Re: serialization problem with spring

2011-07-31 Thread Bruno Borges
What version of Wicket are you using?

On older versions you must declare your field as transient.

Newer versions don't required this anymore.

*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099



On Sun, Jul 31, 2011 at 9:08 PM, Joe Fawzy  wrote:

> Hi
> i have a serialization problem with spring
> My CreatePage class looks like:-
>
> public class CreatePage extends WebPage{
>@SpringBean
>AccountManager accountManager;
> }
>
> as i am using @SpringBean , it should handle creating a serializable proxy
> for me BUT
>
> i got the following exception
>
>
>
> ERROR - JavaSerializer - Error serializing object class
> com.app.view.account.CreatePage [object=[Page class =
> com.app.view.account.CreatePage, id = 1, render count = 1]]
> java.io.NotSerializableException:
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
> at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
> at
>
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
> at
>
> org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:77)
> at
>
> org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:356)
> at
>
> org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:142)
> at
>
> org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:377)
> at
>
> org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:171)
> at
>
> org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:94)
> at
>
> org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:68)
> at
>
> org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:213)
> at org.apache.wicket.Application$2.onDetach(Application.java:1548)
> at
>
> org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:100)
> at
>
> org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:96)
> at
>
> org.ap

serialization problem with spring

2011-07-31 Thread Joe Fawzy
Hi
i have a serialization problem with spring
My CreatePage class looks like:-

public class CreatePage extends WebPage{
@SpringBean
AccountManager accountManager;
}

as i am using @SpringBean , it should handle creating a serializable proxy
for me BUT

i got the following exception



ERROR - JavaSerializer - Error serializing object class
com.app.view.account.CreatePage [object=[Page class =
com.app.view.account.CreatePage, id = 1, render count = 1]]
java.io.NotSerializableException:
org.springframework.dao.support.PersistenceExceptionTranslationInterceptor
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at
org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:77)
at
org.apache.wicket.pageStore.DefaultPageStore.serializePage(DefaultPageStore.java:356)
at
org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:142)
at
org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:377)
at
org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:171)
at
org.apache.wicket.page.AbstractPageManager.commitRequest(AbstractPageManager.java:94)
at
org.apache.wicket.page.PageManagerDecorator.commitRequest(PageManagerDecorator.java:68)
at
org.apache.wicket.page.PageAccessSynchronizer$2.commitRequest(PageAccessSynchronizer.java:213)
at org.apache.wicket.Application$2.onDetach(Application.java:1548)
at
org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:100)
at
org.apache.wicket.request.cycle.RequestCycleListenerCollection$3.notify(RequestCycleListenerCollection.java:96)
at
org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:121)
at
org.apache.wicket.util.listener.ListenerCollection.reversedNotify(ListenerCollection.java:112)
at
org.apache.wicket.request.cycle.RequestCycleListenerCollection.onDetach(RequestCycleListenerCollection.java:94)
at
org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:540)
at
org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:479)
at
org.apache.wicket

Re: on the fly components

2011-07-31 Thread ramazan pekin
Thanks a lot :)

On Mon, Aug 1, 2011 at 12:36 AM, ramazan pekin  wrote:
> I removed "item.remove(listChoice);" from code and I just changed
> ListView definition, I used PropertyModel, and every thing working
> well...
>
> listView = new ListView("categoryList", categories) {
> -> I changed this line as below
>  => listView = new ListView("categoryList", new
> PropertyModel>(this, "categories")) {
>
> On Mon, Aug 1, 2011 at 12:09 AM, ramazan pekin  wrote:
>> And this is CatogoryModel class:
>>
>> public class CategoryModel implements Serializable {
>>
>>        private static final long serialVersionUID = 1L;
>>
>>        private List omCategories;
>>
>>        private OmCategory selectedCategory;
>>
>>        public CategoryModel(List omCategories) {
>>                this.omCategories = omCategories;
>>        }
>>
>>    public List getOmCategories() {
>>                return omCategories;
>>        }
>>
>>    public void setOmCategories(List omCategories) {
>>                this.omCategories = omCategories;
>>        }
>>
>>        public OmCategory getSelectedCategory() {
>>                return selectedCategory;
>>        }
>>
>>        public void setSelectedCategory(OmCategory selectedCategory) {
>>                this.selectedCategory = selectedCategory;
>>        }
>>
>> }
>>
>>
>> On Mon, Aug 1, 2011 at 12:05 AM, ramazan pekin  wrote:
>>> Actually, as you said, when I add new bounded object to the collection
>>> new listChoice has been added to page, but whenever I tried to remove
>>> object from collection, related listChoice is not being removed from
>>> page. I have added wrapping container and I specified as target
>>> component to listChoice's onchange action. As result, I have added
>>> "item.remove(listChoice);" to code but this time, exception raised.
>>>
>>> I think I am using ListView wrongly, main problem looks like ListView
>>> related model object. This is my current markup file content.
>>>
>>> 
>>>  
>>>    
>>>      
>>>        
>>>          
>>>        
>>>      
>>>    
>>>    
>>>  
>>> 
>>>
>>> On Sun, Jul 31, 2011 at 11:02 PM, Christian Huber  
>>> wrote:
 Hi,

 this is just a wild guess but in your code you have line that calls
 "item.remove(listChoice);" under certain conditions and the listChoice
 instance is bound to the category identifier which does not seem right to
 me.

 As far as I understand ListViews the associated markup block is created for
 each item. If you remove the listChoice from an item then Wicket has no
 object to associate the markup with. So I think you cannot remove the 
 choice
 that way.

 I have a similar use case where I also add and remove objects to and from
 ListViews via Ajax and it was sufficient to just remove the object from the
 collection that the ListView relies on and add the wrappign container to 
 the
 ajax target.

 Since the listChoice is the only thing you add to an item I figure that
 could also be feasible for your case but as said before this is just a
 hunch.

 HTH, Chris

 --
 The Sanity Resort 

 Am 31.07.2011 21:06, schrieb ramazan pekin:
>
> Hi to everyone,
>
> I am trying to generate dynamic form elements. I need to add and
> remove some components dynamically. I have added listChoice component
> succesfuly whenever user select a listChoice item, but when I tried to
> remove listChoice component, I received an error like that:
>
>
> org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
> - Unexpected error occurred
> org.apache.wicket.markup.MarkupException: Unable to find component
> with id 'category' in [ListItem [Component id = 1]]. This means that
> you declared wicket:id=category in your markup, but that you either
> did not add the component to your page at all, or that the hierarchy
> does not match.
> .Page.html
> 
>
>        
>        , index = 2, current =  ' wicket:id="category">' (line 16, column 18)]
>        at
> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)
>
>
> This is form code:
>
> public class DynamicForm extends Form {
>
>   private static final long serialVersionUID = 1L;
>
>   final ListView  listView;
>
>   private List  categories;
>
>   public DynamicForm(String id) {
>     super(id);
>
>     categories = new ArrayList();
>     categories.add(new CategoryModel(masterCategories));
>
>     final WebMarkupContainer listContainer = new
> WebMarkupContainer("categoryContainer");
>     listView = new ListView("categoryList", categories) {
>
>       private static final long serialVersionUID = 1L;
>
>       @Override
>       protected void populateItem(final ListItem  item) {
>   

Re: on the fly components

2011-07-31 Thread ramazan pekin
I removed "item.remove(listChoice);" from code and I just changed
ListView definition, I used PropertyModel, and every thing working
well...

listView = new ListView("categoryList", categories) {
-> I changed this line as below
 => listView = new ListView("categoryList", new
PropertyModel>(this, "categories")) {

On Mon, Aug 1, 2011 at 12:09 AM, ramazan pekin  wrote:
> And this is CatogoryModel class:
>
> public class CategoryModel implements Serializable {
>
>        private static final long serialVersionUID = 1L;
>
>        private List omCategories;
>
>        private OmCategory selectedCategory;
>
>        public CategoryModel(List omCategories) {
>                this.omCategories = omCategories;
>        }
>
>    public List getOmCategories() {
>                return omCategories;
>        }
>
>    public void setOmCategories(List omCategories) {
>                this.omCategories = omCategories;
>        }
>
>        public OmCategory getSelectedCategory() {
>                return selectedCategory;
>        }
>
>        public void setSelectedCategory(OmCategory selectedCategory) {
>                this.selectedCategory = selectedCategory;
>        }
>
> }
>
>
> On Mon, Aug 1, 2011 at 12:05 AM, ramazan pekin  wrote:
>> Actually, as you said, when I add new bounded object to the collection
>> new listChoice has been added to page, but whenever I tried to remove
>> object from collection, related listChoice is not being removed from
>> page. I have added wrapping container and I specified as target
>> component to listChoice's onchange action. As result, I have added
>> "item.remove(listChoice);" to code but this time, exception raised.
>>
>> I think I am using ListView wrongly, main problem looks like ListView
>> related model object. This is my current markup file content.
>>
>> 
>>  
>>    
>>      
>>        
>>          
>>        
>>      
>>    
>>    
>>  
>> 
>>
>> On Sun, Jul 31, 2011 at 11:02 PM, Christian Huber  
>> wrote:
>>> Hi,
>>>
>>> this is just a wild guess but in your code you have line that calls
>>> "item.remove(listChoice);" under certain conditions and the listChoice
>>> instance is bound to the category identifier which does not seem right to
>>> me.
>>>
>>> As far as I understand ListViews the associated markup block is created for
>>> each item. If you remove the listChoice from an item then Wicket has no
>>> object to associate the markup with. So I think you cannot remove the choice
>>> that way.
>>>
>>> I have a similar use case where I also add and remove objects to and from
>>> ListViews via Ajax and it was sufficient to just remove the object from the
>>> collection that the ListView relies on and add the wrappign container to the
>>> ajax target.
>>>
>>> Since the listChoice is the only thing you add to an item I figure that
>>> could also be feasible for your case but as said before this is just a
>>> hunch.
>>>
>>> HTH, Chris
>>>
>>> --
>>> The Sanity Resort 
>>>
>>> Am 31.07.2011 21:06, schrieb ramazan pekin:

 Hi to everyone,

 I am trying to generate dynamic form elements. I need to add and
 remove some components dynamically. I have added listChoice component
 succesfuly whenever user select a listChoice item, but when I tried to
 remove listChoice component, I received an error like that:


 org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
 - Unexpected error occurred
 org.apache.wicket.markup.MarkupException: Unable to find component
 with id 'category' in [ListItem [Component id = 1]]. This means that
 you declared wicket:id=category in your markup, but that you either
 did not add the component to your page at all, or that the hierarchy
 does not match.
 .Page.html
 

        
        , index = 2, current =  '>>> wicket:id="category">' (line 16, column 18)]
        at
 org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)


 This is form code:

 public class DynamicForm extends Form {

   private static final long serialVersionUID = 1L;

   final ListView  listView;

   private List  categories;

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

     categories = new ArrayList();
     categories.add(new CategoryModel(masterCategories));

     final WebMarkupContainer listContainer = new
 WebMarkupContainer("categoryContainer");
     listView = new ListView("categoryList", categories) {

       private static final long serialVersionUID = 1L;

       @Override
       protected void populateItem(final ListItem  item) {
         final CategoryModel category = item.getModelObject();
         ListChoice  listChoice = new ListChoice(
             "category",
             new PropertyModel(category, "selectedCategory"),
             masterCategor

Re: Updating a Component from anywhere

2011-07-31 Thread Martijn Dashorst
You're thinking about it the wrong way: you should ask how do I let
this label (or panel) know about an ajax event happening?

Queue wicket 1.5's event mechanism:
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Intercomponentevents

Martijn

On Sun, Jul 31, 2011 at 2:54 PM, eugenebalt  wrote:
> Essentially what I'm asking is, is there an easy way to find a component,
> among the entire current tree of all components included or cross-included
> in the final page, from anywhere in the code.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Updating-a-Component-from-anywhere-tp3708349p3708386.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
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

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



Re: on the fly components

2011-07-31 Thread ramazan pekin
And this is CatogoryModel class:

public class CategoryModel implements Serializable {

private static final long serialVersionUID = 1L;

private List omCategories;

private OmCategory selectedCategory;

public CategoryModel(List omCategories) {
this.omCategories = omCategories;
}

public List getOmCategories() {
return omCategories;
}

public void setOmCategories(List omCategories) {
this.omCategories = omCategories;
}

public OmCategory getSelectedCategory() {
return selectedCategory;
}

public void setSelectedCategory(OmCategory selectedCategory) {
this.selectedCategory = selectedCategory;
}

}


On Mon, Aug 1, 2011 at 12:05 AM, ramazan pekin  wrote:
> Actually, as you said, when I add new bounded object to the collection
> new listChoice has been added to page, but whenever I tried to remove
> object from collection, related listChoice is not being removed from
> page. I have added wrapping container and I specified as target
> component to listChoice's onchange action. As result, I have added
> "item.remove(listChoice);" to code but this time, exception raised.
>
> I think I am using ListView wrongly, main problem looks like ListView
> related model object. This is my current markup file content.
>
> 
>  
>    
>      
>        
>          
>        
>      
>    
>    
>  
> 
>
> On Sun, Jul 31, 2011 at 11:02 PM, Christian Huber  
> wrote:
>> Hi,
>>
>> this is just a wild guess but in your code you have line that calls
>> "item.remove(listChoice);" under certain conditions and the listChoice
>> instance is bound to the category identifier which does not seem right to
>> me.
>>
>> As far as I understand ListViews the associated markup block is created for
>> each item. If you remove the listChoice from an item then Wicket has no
>> object to associate the markup with. So I think you cannot remove the choice
>> that way.
>>
>> I have a similar use case where I also add and remove objects to and from
>> ListViews via Ajax and it was sufficient to just remove the object from the
>> collection that the ListView relies on and add the wrappign container to the
>> ajax target.
>>
>> Since the listChoice is the only thing you add to an item I figure that
>> could also be feasible for your case but as said before this is just a
>> hunch.
>>
>> HTH, Chris
>>
>> --
>> The Sanity Resort 
>>
>> Am 31.07.2011 21:06, schrieb ramazan pekin:
>>>
>>> Hi to everyone,
>>>
>>> I am trying to generate dynamic form elements. I need to add and
>>> remove some components dynamically. I have added listChoice component
>>> succesfuly whenever user select a listChoice item, but when I tried to
>>> remove listChoice component, I received an error like that:
>>>
>>>
>>> org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
>>> - Unexpected error occurred
>>> org.apache.wicket.markup.MarkupException: Unable to find component
>>> with id 'category' in [ListItem [Component id = 1]]. This means that
>>> you declared wicket:id=category in your markup, but that you either
>>> did not add the component to your page at all, or that the hierarchy
>>> does not match.
>>> .Page.html
>>> 
>>>
>>>        
>>>        , index = 2, current =  '>> wicket:id="category">' (line 16, column 18)]
>>>        at
>>> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)
>>>
>>>
>>> This is form code:
>>>
>>> public class DynamicForm extends Form {
>>>
>>>   private static final long serialVersionUID = 1L;
>>>
>>>   final ListView  listView;
>>>
>>>   private List  categories;
>>>
>>>   public DynamicForm(String id) {
>>>     super(id);
>>>
>>>     categories = new ArrayList();
>>>     categories.add(new CategoryModel(masterCategories));
>>>
>>>     final WebMarkupContainer listContainer = new
>>> WebMarkupContainer("categoryContainer");
>>>     listView = new ListView("categoryList", categories) {
>>>
>>>       private static final long serialVersionUID = 1L;
>>>
>>>       @Override
>>>       protected void populateItem(final ListItem  item) {
>>>         final CategoryModel category = item.getModelObject();
>>>         ListChoice  listChoice = new ListChoice(
>>>             "category",
>>>             new PropertyModel(category, "selectedCategory"),
>>>             masterCategories,
>>>             new IChoiceRenderer() {
>>>               private static final long serialVersionUID = 1L;
>>>
>>>               public Object getDisplayValue(OmCategory omCategory) {
>>>                 return omCategory.getCategoryCode().getLocalized();
>>>               }
>>>
>>>               public String getIdValue(OmCategory omCategory, int index) {
>>>                 return omCategory.getRowId();
>>>               }
>>>             }
>>>         );
>>>         list

Re: on the fly components

2011-07-31 Thread ramazan pekin
Actually, as you said, when I add new bounded object to the collection
new listChoice has been added to page, but whenever I tried to remove
object from collection, related listChoice is not being removed from
page. I have added wrapping container and I specified as target
component to listChoice's onchange action. As result, I have added
"item.remove(listChoice);" to code but this time, exception raised.

I think I am using ListView wrongly, main problem looks like ListView
related model object. This is my current markup file content.


  

  

  

  


  


On Sun, Jul 31, 2011 at 11:02 PM, Christian Huber  wrote:
> Hi,
>
> this is just a wild guess but in your code you have line that calls
> "item.remove(listChoice);" under certain conditions and the listChoice
> instance is bound to the category identifier which does not seem right to
> me.
>
> As far as I understand ListViews the associated markup block is created for
> each item. If you remove the listChoice from an item then Wicket has no
> object to associate the markup with. So I think you cannot remove the choice
> that way.
>
> I have a similar use case where I also add and remove objects to and from
> ListViews via Ajax and it was sufficient to just remove the object from the
> collection that the ListView relies on and add the wrappign container to the
> ajax target.
>
> Since the listChoice is the only thing you add to an item I figure that
> could also be feasible for your case but as said before this is just a
> hunch.
>
> HTH, Chris
>
> --
> The Sanity Resort 
>
> Am 31.07.2011 21:06, schrieb ramazan pekin:
>>
>> Hi to everyone,
>>
>> I am trying to generate dynamic form elements. I need to add and
>> remove some components dynamically. I have added listChoice component
>> succesfuly whenever user select a listChoice item, but when I tried to
>> remove listChoice component, I received an error like that:
>>
>>
>> org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
>> - Unexpected error occurred
>> org.apache.wicket.markup.MarkupException: Unable to find component
>> with id 'category' in [ListItem [Component id = 1]]. This means that
>> you declared wicket:id=category in your markup, but that you either
>> did not add the component to your page at all, or that the hierarchy
>> does not match.
>> .Page.html
>> 
>>
>>        
>>        , index = 2, current =  '> wicket:id="category">' (line 16, column 18)]
>>        at
>> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)
>>
>>
>> This is form code:
>>
>> public class DynamicForm extends Form {
>>
>>   private static final long serialVersionUID = 1L;
>>
>>   final ListView  listView;
>>
>>   private List  categories;
>>
>>   public DynamicForm(String id) {
>>     super(id);
>>
>>     categories = new ArrayList();
>>     categories.add(new CategoryModel(masterCategories));
>>
>>     final WebMarkupContainer listContainer = new
>> WebMarkupContainer("categoryContainer");
>>     listView = new ListView("categoryList", categories) {
>>
>>       private static final long serialVersionUID = 1L;
>>
>>       @Override
>>       protected void populateItem(final ListItem  item) {
>>         final CategoryModel category = item.getModelObject();
>>         ListChoice  listChoice = new ListChoice(
>>             "category",
>>             new PropertyModel(category, "selectedCategory"),
>>             masterCategories,
>>             new IChoiceRenderer() {
>>               private static final long serialVersionUID = 1L;
>>
>>               public Object getDisplayValue(OmCategory omCategory) {
>>                 return omCategory.getCategoryCode().getLocalized();
>>               }
>>
>>               public String getIdValue(OmCategory omCategory, int index) {
>>                 return omCategory.getRowId();
>>               }
>>             }
>>         );
>>         listChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
>>           private static final long serialVersionUID =
>> 5417882427051940952L;
>>
>>           @Override
>>           protected void onUpdate(AjaxRequestTarget target) {
>>             if(categories.size()>  1&&  (categories.indexOf(category)
>> + 1) != categories.size()) {
>>               categories = new
>> ArrayList(categories.subList(0,
>> (categories.indexOf(category) + 1)));
>>             }
>>             categories.add(new CategoryModel(masterCategories));
>>             target.add(listContainer);
>>           }
>>         });
>>         if(categories.indexOf(item.getModelObject()) != -1) {
>>           item.add(listChoice);
>>         } else {
>>           item.remove(listChoice);
>>         }
>>       }
>>     };
>>     listView.setOutputMarkupId(true);
>>     listContainer.add(listView);
>>     listContainer.setOutputMarkupId(true);
>>     add(listContainer);
>>   }
>> }
>>
>>
>> First time I am developing with

Re: Updating a Component from anywhere

2011-07-31 Thread eugenebalt
Essentially what I'm asking is, is there an easy way to find a component,
among the entire current tree of all components included or cross-included
in the final page, from anywhere in the code.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Updating-a-Component-from-anywhere-tp3708349p3708386.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



Updating a Component from anywhere

2011-07-31 Thread eugenebalt
I have a Panel containing a Label that shows how many items are in the
shopping cart right now.

The Label should be updated (via Ajax) from within any number of pages,
forms, and panels throughout the application. Various sub- and
sub-panels/forms/etc. may have the "Add To Cart" link that should update
this Label, so the Ajax update can come from various points.

The Panel with this Label is always displayed at the top of every page.

My question is, is there an easy way to save as a "global variable" this
Label component (or, the containing Panel) so it's available to everybody
all the time? Thanks.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Updating-a-Component-from-anywhere-tp3708349p3708349.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: Form Model Not Available for AjaxFallbackLink

2011-07-31 Thread vineet semwal
second suggestion is good too ,you will have to specify the js event
say onchange/onblur for ajaxformcomponentupdatingbehavior
when that even will be fired,your model will be updated with the new
value,you dont have to use ajaxsubmitlink in that case..

 it depends on which way you want to do..


On Mon, Aug 1, 2011 at 1:45 AM, eugenebalt  wrote:
> The first suggestion worked. Thanks.
>
> Regarding AjaxUpdatingBehavior, yes my component was Ajax, but the data was
> not binding to the model at the time of the click because we weren't
> submitting the form. I needed to read the value entered for one of the
> components and it wasn't available at that time.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Form-Model-Not-Available-for-AjaxFallbackLink-tp3707795p3708330.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
>
>



-- 
thank you,

regards,
Vineet Semwal

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



Re: Form Model Not Available for AjaxFallbackLink

2011-07-31 Thread eugenebalt
The first suggestion worked. Thanks. 

Regarding AjaxUpdatingBehavior, yes my component was Ajax, but the data was
not binding to the model at the time of the click because we weren't
submitting the form. I needed to read the value entered for one of the
components and it wasn't available at that time.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-Model-Not-Available-for-AjaxFallbackLink-tp3707795p3708330.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: on the fly components

2011-07-31 Thread Christian Huber

Hi,

this is just a wild guess but in your code you have line that calls 
"item.remove(listChoice);" under certain conditions and the listChoice 
instance is bound to the category identifier which does not seem right 
to me.


As far as I understand ListViews the associated markup block is created 
for each item. If you remove the listChoice from an item then Wicket has 
no object to associate the markup with. So I think you cannot remove the 
choice that way.


I have a similar use case where I also add and remove objects to and 
from ListViews via Ajax and it was sufficient to just remove the object 
from the collection that the ListView relies on and add the wrappign 
container to the ajax target.


Since the listChoice is the only thing you add to an item I figure that 
could also be feasible for your case but as said before this is just a 
hunch.


HTH, Chris

--
The Sanity Resort 

Am 31.07.2011 21:06, schrieb ramazan pekin:

Hi to everyone,

I am trying to generate dynamic form elements. I need to add and
remove some components dynamically. I have added listChoice component
succesfuly whenever user select a listChoice item, but when I tried to
remove listChoice component, I received an error like that:

org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
- Unexpected error occurred
org.apache.wicket.markup.MarkupException: Unable to find component
with id 'category' in [ListItem [Component id = 1]]. This means that
you declared wicket:id=category in your markup, but that you either
did not add the component to your page at all, or that the hierarchy
does not match.
.Page.html



, index = 2, current =  '' (line 16, column 18)]
at 
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)


This is form code:

public class DynamicForm extends Form {

   private static final long serialVersionUID = 1L;

   final ListView  listView;

   private List  categories;

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

 categories = new ArrayList();
 categories.add(new CategoryModel(masterCategories));

 final WebMarkupContainer listContainer = new
WebMarkupContainer("categoryContainer");
 listView = new ListView("categoryList", categories) {

   private static final long serialVersionUID = 1L;

   @Override
   protected void populateItem(final ListItem  item) {
 final CategoryModel category = item.getModelObject();
 ListChoice  listChoice = new ListChoice(
 "category",
 new PropertyModel(category, "selectedCategory"),
 masterCategories,
 new IChoiceRenderer() {
   private static final long serialVersionUID = 1L;

   public Object getDisplayValue(OmCategory omCategory) {
 return omCategory.getCategoryCode().getLocalized();
   }

   public String getIdValue(OmCategory omCategory, int index) {
 return omCategory.getRowId();
   }
 }
 );
 listChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
   private static final long serialVersionUID = 5417882427051940952L;

   @Override
   protected void onUpdate(AjaxRequestTarget target) {
 if(categories.size()>  1&&  (categories.indexOf(category)
+ 1) != categories.size()) {
   categories = new
ArrayList(categories.subList(0,
(categories.indexOf(category) + 1)));
 }
 categories.add(new CategoryModel(masterCategories));
 target.add(listContainer);
   }
 });
 if(categories.indexOf(item.getModelObject()) != -1) {
   item.add(listChoice);
 } else {
   item.remove(listChoice);
 }
   }
 };
 listView.setOutputMarkupId(true);
 listContainer.add(listView);
 listContainer.setOutputMarkupId(true);
 add(listContainer);
   }
}


First time I am developing with wicket, and maybe I use wrongly. I'm
new and any feedback is appreciated... Sorry for my english :)

Br.
Ramazan

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



Re: on the fly components

2011-07-31 Thread Rodrigo Heffner
Hi Ramazan,

I'm also very new to wicket, and I've came across a similar situation too.

I solved my situation by using different panels with the same markup
id. Something like (inside the populateItem method):

if (condition == true) {
item.add(new SomePanel("sameId"));
} else {
item.add(new AnotherPanel("sameId"));
}

In this way, in your markup you'd have something like



and you could have completely different panels.

Let me know if this helps or if you find a better way



> did not add the component to your page at all, or that the hierarchy
> does not match.
> .Page.html
> 
>
>                        
>                    , index = 2, current =  ' wicket:id="category">' (line 16, column 18)]
>        at 
> org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)
>
>
> This is form code:
>
> public class DynamicForm extends Form {
>
>  private static final long serialVersionUID = 1L;
>
>  final ListView listView;
>
>  private List categories;
>
>  public DynamicForm(String id) {
>    super(id);
>
>    categories = new ArrayList();
>    categories.add(new CategoryModel(masterCategories));
>
>    final WebMarkupContainer listContainer = new
> WebMarkupContainer("categoryContainer");
>    listView = new ListView("categoryList", categories) {
>
>      private static final long serialVersionUID = 1L;
>
>      @Override
>      protected void populateItem(final ListItem item) {
>        final CategoryModel category = item.getModelObject();
>        ListChoice listChoice = new ListChoice(
>            "category",
>            new PropertyModel(category, "selectedCategory"),
>            masterCategories,
>            new IChoiceRenderer() {
>              private static final long serialVersionUID = 1L;
>
>              public Object getDisplayValue(OmCategory omCategory) {
>                return omCategory.getCategoryCode().getLocalized();
>              }
>
>              public String getIdValue(OmCategory omCategory, int index) {
>                return omCategory.getRowId();
>              }
>            }
>        );
>        listChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
>          private static final long serialVersionUID = 5417882427051940952L;
>
>          @Override
>          protected void onUpdate(AjaxRequestTarget target) {
>            if(categories.size() > 1 && (categories.indexOf(category)
> + 1) != categories.size()) {
>              categories = new
> ArrayList(categories.subList(0,
> (categories.indexOf(category) + 1)));
>            }
>            categories.add(new CategoryModel(masterCategories));
>            target.add(listContainer);
>          }
>        });
>        if(categories.indexOf(item.getModelObject()) != -1) {
>          item.add(listChoice);
>        } else {
>          item.remove(listChoice);
>        }
>      }
>    };
>    listView.setOutputMarkupId(true);
>    listContainer.add(listView);
>    listContainer.setOutputMarkupId(true);
>    add(listContainer);
>  }
> }
>
>
> First time I am developing with wicket, and maybe I use wrongly. I'm
> new and any feedback is appreciated... Sorry for my english :)
>
> Br.
> Ramazan
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>



-- 
Rodrigo H M Bezerra

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



on the fly components

2011-07-31 Thread ramazan pekin
Hi to everyone,

I am trying to generate dynamic form elements. I need to add and
remove some components dynamically. I have added listChoice component
succesfuly whenever user select a listChoice item, but when I tried to
remove listChoice component, I received an error like that:

org.apache.wicket.DefaultExceptionMapper.internalMap(DefaultExceptionMapper.java:102)
- Unexpected error occurred
org.apache.wicket.markup.MarkupException: Unable to find component
with id 'category' in [ListItem [Component id = 1]]. This means that
you declared wicket:id=category in your markup, but that you either
did not add the component to your page at all, or that the hierarchy
does not match.
.Page.html



, index = 2, current =  '' (line 16, column 18)]
at 
org.apache.wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:536)


This is form code:

public class DynamicForm extends Form {

  private static final long serialVersionUID = 1L;

  final ListView listView;

  private List categories;

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

categories = new ArrayList();
categories.add(new CategoryModel(masterCategories));

final WebMarkupContainer listContainer = new
WebMarkupContainer("categoryContainer");
listView = new ListView("categoryList", categories) {

  private static final long serialVersionUID = 1L;

  @Override
  protected void populateItem(final ListItem item) {
final CategoryModel category = item.getModelObject();
ListChoice listChoice = new ListChoice(
"category",
new PropertyModel(category, "selectedCategory"),
masterCategories,
new IChoiceRenderer() {
  private static final long serialVersionUID = 1L;

  public Object getDisplayValue(OmCategory omCategory) {
return omCategory.getCategoryCode().getLocalized();
  }

  public String getIdValue(OmCategory omCategory, int index) {
return omCategory.getRowId();
  }
}
);
listChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
  private static final long serialVersionUID = 5417882427051940952L;

  @Override
  protected void onUpdate(AjaxRequestTarget target) {
if(categories.size() > 1 && (categories.indexOf(category)
+ 1) != categories.size()) {
  categories = new
ArrayList(categories.subList(0,
(categories.indexOf(category) + 1)));
}
categories.add(new CategoryModel(masterCategories));
target.add(listContainer);
  }
});
if(categories.indexOf(item.getModelObject()) != -1) {
  item.add(listChoice);
} else {
  item.remove(listChoice);
}
  }
};
listView.setOutputMarkupId(true);
listContainer.add(listView);
listContainer.setOutputMarkupId(true);
add(listContainer);
  }
}


First time I am developing with wicket, and maybe I use wrongly. I'm
new and any feedback is appreciated... Sorry for my english :)

Br.
Ramazan

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



Re: Ajax broken in IE 8

2011-07-31 Thread T P D

Yes,

I was wrong. It wasn't working on my machine (because I have Fiddler 
installed?) but is working in general.


Sorry to have muddied the waters.

On 7/29/2011 12:20 PM, Dan Retzlaff wrote:

I'll help you test it if you boil it down to a quickstart application you
can share.

On Fri, Jul 29, 2011 at 8:12 AM, T P D  wrote:


OK, so since I'm having this problem and no one else is -- what am I doing
wrong?

And why is it working in Firefox? In Firefox, with javascript disabled, I
get a normal POST; with javascript enabled, I get ajax.

In IE 8, using Wicket 1.4.9, even with javascript enabled, I get a POST
(the "fallback" part of the AjaxFallbackButton), but with Wicket 1.4.17, I
have broken ajax (because of the transport), but I also don't get a fallback
POST.

I'm thrilled if the fault lies with me, because that's presumably easier to
fix. But what am I (not) doing that breaks this?


On 7/29/2011 6:11 AM, Martin Grigorov wrote:


1.4.17 is in use by many people and you're the only one having this
problem.

1.5.x and 1.4.x are the same related to WICKET-3887.

AjaxLink/AjaxFallbackLink cannot do POST request unless you override
parts of them.

On Fri, Jul 29, 2011 at 7:54 AM, T P D   wrote:


Wicket 1.4.9's Ajax doesn't work in Internet Explorer; in particular,
AjaxFallbackButtons fall back to non-Ajax POSTs, and the Wicket Debug
"window" is never seen.

In 1.4.17, Ajax is still broken, but the fallback never happens, because
Ajax sort-of works: the the Wicket Debug "window" doe show up, and when
the
AjaxFallbackButton is clicked, a attempt is made to to XMLHTTP, but fails
with "Automation server can't create object".

This looks like the same bug as reported in
https://issues.apache.org/**jira/browse/WICKET-3887and
https://issues.apache.org/**jira/browse/WICKET-1432.
It's apparently fixed in
1.5, but while bug 3887 is claimed to be fixed in 1.4.18, the latest
snapshot exhibits the same behavior as 1.4.17.

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








--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@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: Form Model Not Available for AjaxFallbackLink

2011-07-31 Thread Rodrigo Heffner
I had the same question last week. This is probably what you want:
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.html
.

Add this to your component and it's model will be updated without submitting
the form.
On 31 Jul 2011 15:05, "vineet semwal"  wrote:
> use ajaxsubmitlink and it will submit the form the textfield is in ..
>
>
>
> On Sun, Jul 31, 2011 at 7:25 PM, eugenebalt  wrote:
>> I have a TextField and an AjaxFallbackLink. The AjaxFallbackLink, when
>> clicked, must read the value of the TextField. But that value isn't
>> available yet, because there has been no form submit and no model binding
>> yet.
>>
>> Both getInput() and getModelObject() return NULL at the time of the
>> AjaxFallbackLink's click. Any ideas how to solve that?
>>
>> Thanks
>>
>> --
>> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Form-Model-Not-Available-for-AjaxFallbackLink-tp3707795p3707795.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
>>
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>


Re: Form Model Not Available for AjaxFallbackLink

2011-07-31 Thread vineet semwal
 use ajaxsubmitlink and it will submit the form the textfield is in ..



On Sun, Jul 31, 2011 at 7:25 PM, eugenebalt  wrote:
> I have a TextField and an AjaxFallbackLink. The AjaxFallbackLink, when
> clicked, must read the value of the TextField. But that value isn't
> available yet, because there has been no form submit and no model binding
> yet.
>
> Both getInput() and getModelObject() return NULL at the time of the
> AjaxFallbackLink's click. Any ideas how to solve that?
>
> Thanks
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Form-Model-Not-Available-for-AjaxFallbackLink-tp3707795p3707795.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
>
>



-- 
thank you,

regards,
Vineet Semwal

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



Form Model Not Available for AjaxFallbackLink

2011-07-31 Thread eugenebalt
I have a TextField and an AjaxFallbackLink. The AjaxFallbackLink, when
clicked, must read the value of the TextField. But that value isn't
available yet, because there has been no form submit and no model binding
yet.

Both getInput() and getModelObject() return NULL at the time of the
AjaxFallbackLink's click. Any ideas how to solve that?

Thanks

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Form-Model-Not-Available-for-AjaxFallbackLink-tp3707795p3707795.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: Manually Rendering a DataGridView

2011-07-31 Thread Matt Schmidt
So after calling tableParser.parse(myDataGridView), how do I get the the
char sequence? Or iterate over each row to get the char sequence for each
cell? I don't see any public methods for that.

On Sunday, July 31, 2011, Pedro Santos  wrote:
> Hi, I had a similar need and used the code at TableParser[1] to render
> the component tree to a mock response and later get its char sequence.
>
> 1 -
https://github.com/wicketstuff/core/blob/master/jdk-1.5-parent/wicket-poi-parent/wicket-poi/src/main/java/org/wicketstuff/poi/excel/TableParser.java
>
> On Fri, Jul 29, 2011 at 6:01 PM, Matt Schmidt 
wrote:
>> Is there any way to access the HTML of each cell that would be rendered
in a
>> DataGridView without adding it to the page and actually rendering it?
>>
>> Ultimately, I am trying to add all of the inner HTML of the cells of the
>> DataGridView to a JavaScript array.
>>
>
>
>
> --
> 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: Wicket modal window example not working in IE8 on wicket-library.com

2011-07-31 Thread Chris Colman

My IE version is: 8.0.6001.18702IS

I'll take a look at the plugins.

Chris

>I just tested 8.0.7601.17514 and it worked. Maybe you have a local IE
>plugin
>that's interfering?
>
>On Sat, Jul 30, 2011 at 6:31 PM, Chris Colman
>wrote:
>
>> Does anyone else have a problem in IE8 with this page. The links do
not
>> open up a modal window for me but under FF both links work fine.
>>
>> http://www.wicket-library.com/wicket-examples/ajax/modal-window
>>
>> I do have Javascript enabled :) on IE8 !
>>

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



Re: RFC: Ten things every Wicket programmer must know?

2011-07-31 Thread samket
Knowing what my co-workers are like, these are the most important things that I 
say to them. So this list is directed towards them in particular.

1. When receiving parameters in a constructor or method, a model (an instance 
of IModel) is almost always the right choice instead of a raw model object. 
Almost everyone here has mentioned this rule in different words (probably most 
better than mine).

2. Apply your generic object-oriented programming skills to web page 
programming. When dealing with pages and panels, know when to use inheritance 
and when not to. Inheritance is something you should usually try to avoid and 
use composition instead. Inheritance might save you a couple lines of code but 
it tends to make the code crazy difficult to understand. Having said that, it 
must be mentioned that there are plenty of situations where using inheritance 
is justified. I just think the cost of using inheritance in the wrong place is 
so high that it deserves to be feared.

3. A page's markup must be kept very clean. It should never be no more than 50 
lines, or so. Use panels to separate parts of the page. A (positive) result of 
this is that the page's java file is probably clean too. The main reason for 
this rule is that it should always be easy for everyone to get an idea of the 
general structure of a page.

4. When a markup contains a wicket:id, the corresponding java file should 
probably contain a corresponding add-method invocation. I.e. the corresponding 
add-method invocation shouldn't be located in some other (unrelated) java file. 
For understandability's sakes.

5. Don't be afraid to refactor source codes. Even those that were originally 
made by someone else. There are plenty of reasons why this is important. One of 
them is that nobody makes perfect code the first time. You shouldn't even try 
to make perfect code the first time. It's usually fine if you make monolithic 
panels (not pages), use plenty of inner classes and make inefficient code. They 
will be refactored later if they are modified often and if people adhere to 
this rule.

6. With Wicket as the web application framework you rarely if ever need to 
create servlets. File downloading is possible with resources and it's possible 
to create bootstraps too. Okay, this rule doesn't deserve to be in the top 10, 
but I seriously don't want to see more servlets being made - EVER! :)

7. It's pretty important to learn about all the different types of models. They 
may be a little more difficult concept to understand than components.

8. WebMarkupContainer is a simple yet useful component that does nothing unless 
you program it do something. WebComponent is equally simple but less often 
useful because it can't be a parent to other components.


 
  - Original Message -
  From: Jeremy Thomerson
  Sent: 07/28/11 01:29 AM
  To: users@wicket.apache.org
  Subject: RFC: Ten things every Wicket programmer must know?
 
   
Hello all,

 I'm writing an article for a Java magazine and would like to include in it
a list of "ten things every Wicket programmer must know". Of course, I have
my list, but I'd be very curious to see what you think should be on that
list from your own experience. Or, put another way, maybe the question
would be "what I wished I knew when I started Wicket" - what tripped you up
or what made you kick yourself later?

 Please reply back if you have input. Please note that by replying, you
are granting me full permission to use your response as part of my article
without any attribution or payment. If you disagree with those terms,
please respond anyway but in your response mention your own terms.

Best regards,

-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket? Use Brix! http://brixcms.org*   

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