Where is ModalWindow in wicket-10 ?

2023-05-28 Thread smallufo
I found that all my ModalWindow cannot compile because ModalWindow is
removed.
Is there any reason for this?
And it seems there is a modelDialog ( to replace ModalWindow ?) ,
but it doesn't accept model object.
Any migration guide ? thanks.
[image: 截圖 2023-05-28 17.22.43.png]


Re: Plans for Wicket 10 Release

2023-05-27 Thread smallufo
Hi
Where can I get wicket-10 snapshot ?
I cannot find it in mvnrepository.com ...
I've upgrade all subsystems from javax to jakarta , and spring 5 to spring 6
But a lot of incompatibility issues are in wicket 9
Since it has no major issues , how about releasing it ASAP ?
Thanks.


János Cserép  於 2023年5月25日 週四 下午3:51寫道:

> Just a thought...
>
> I've been using Wicket 10 snapshot builds in production for over a year now
> with latest Spring and Jakarta libs without any major issues, so if that is
> an option for you, go ahead. You can mitigate risks by creating release
> from a known git rev yourself if your release process does not like
> SNAPSHOT dependencies.
>
> j
>
>
> On Thu, 25 May 2023 at 09:15, Tony Tkacik  .invalid>
> wrote:
>
> > Hi,
> > I would like to ask about your timeline / plans regarding release of
> > Wicket 10?
> >
> > We are in process of upgrading our open-source project midPoint to latest
> > Spring releases and that requires Wicket to be updated to version 10
> > in order to support Spring 6.
> >
> > Thanks,
> > Anton Tkacik
> >
>


Re: Compoment.setVisible(IModel) ?

2022-03-10 Thread smallufo
Wow , TIL there are already VisibleModelBehavior and EnabledModelBehavior
in the minis package for this.

Thanks


Sven Meier  於 2022年3月10日 週四 下午3:22寫道:

> Hi,
>
> Models are not support for visible/enabled state.
>
> The recommended pattern is overriding onConfigure()
>
> onConfigure() {
>setVisible(/*... lazy evaluated ...*/)
> }
>
> Regards
> Sven
>
>
> On 10.03.22 00:31, smallufo wrote:
> > Currently , component visible is defined by a eager evaluated boolean
> value
> >
> > public final Component setVisible(final boolean visible)
> >
> > Is it able to make it accept IModel ?
> > (so that we can lazy evaluated the value)
> >
> > Thanks.
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Compoment.setVisible(IModel) ?

2022-03-09 Thread smallufo
Currently , component visible is defined by a eager evaluated boolean value

public final Component setVisible(final boolean visible)

Is it able to make it accept IModel ?
(so that we can lazy evaluated the value)

Thanks.


Re: Kotlin 1.5.0 : NotSerializableException: Non-serializable lambda

2021-05-03 Thread smallufo
follow this workaround solves the problem (temporarily)
Workaround: use -Xsam-conversions=class

https://youtrack.jetbrains.com/issue/KT-46359#focus=Comments-27-4862857.0-0


  
org.jetbrains.kotlin
kotlin-maven-plugin
${kotlin.version}

  
-Xsam-conversions=class
  

  



Bas Gooren  於 2021年5月3日 週一 下午4:22寫道:

> Hi!
>
> Probably related to this:
>
> https://youtrack.jetbrains.com/issue/KT-46373
>
> "Since 1.5, SAM-converted lambdas are generated using invokedynamic with
> bootstrap method from java.lang.invoke.LambdaMetafactory.
> Resulting proxy classes are not Serializable by default.”
>
> So your lambda’s in WizardPage are no longer serializable by default due
> to your upgrade to kotlin 1.5.0.
>
> So I’d recommend downgrading your Kotlin for now.
>
> (I’m not an active user of kotlin, so I found this information with 10
> minutes of Googling)
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 30 april 2021 bij 07:06:45, smallufo (small...@gmail.com) schreef:
>
> more detail log :
>
> 2021-04-30 12:43:44.076 [http-nio-8080-exec-2] WARN
> o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
> to writeObject : Non-serializable lambda, path: /children/[write:1]/data
> 2021-04-30 12:43:44.078 [http-nio-8080-exec-2] WARN
> o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
> to writeObject : Non-serializable lambda, path: /children/[write:2]
> 2021-04-30 12:43:44.079 [http-nio-8080-exec-2] WARN
> o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
> to writeObject : Non-serializable lambda, path: /children
> 2021-04-30 12:43:44.099 [http-nio-8080-exec-2] ERROR
> o.a.w.s.j.JavaSerializer.serialize - Error serializing object class
> destiny.WizardPage [object=[Page class = destiny.WizardPage, id = 1,
> render
> count = 1]]
> org.apache.wicket.WicketRuntimeException: A problem occurred while trying
> to collect debug information about not serializable object
> at
> org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:390)
>
> at
> java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
>
> at
> org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:82)
>
> at
> org.apache.wicket.pageStore.AbstractPageStore.serializePage(AbstractPageStore.java:133)
>
> at
> org.apache.wicket.pageStore.DefaultPageStore.createSerializedPage(DefaultPageStore.java:281)
>
> at
> org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:61)
>
> at
> org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:482)
>
> at
> org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:214)
>
>
> smallufo  於 2021年4月30日 週五 下午12:52寫道:
>
> > I was using Kotlin 1.4.32 with wicket 8.11
> > but after upgrading to Kotlin 1.5.0 , it throws :
> >
> > Caused by: java.io.NotSerializableException: Non-serializable lambda
> > at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at
> >
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
>
> > at
> >
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> > at java.base/java.lang.reflect.Method.invoke(Method.java:564)
> > at
> >
> java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1196)
>
> > at
> >
> java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1523)
>
> > at
> >
> java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1444)
>
> > at
> >
> java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1187)
>
> > at
> >
> java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1579)
>
> >
> >
> > what may go wrong here ?
> >
> > The wicket mode is DEPLOYMENT
> >
> > 
> > wicket
> >
> org.apache.wicket.protocol.http.WicketFilter
> > 
> > applicationClassName
> > foo.bar.MyApplication
> > 
> > 
> > configuration
> > DEPLOYMENT
> > 
> > 
> > 
> > wicket
> > /app/*
> > 
> >
> >
> > @MacMiniM1  ~  java -version
> > openjdk version "15.0.2" 2021-01-19
> > OpenJDK Runtime Environment Zulu15.29+15-CA (build 15.0.2+7)
> > OpenJDK 64-Bit Server VM Zulu15.29+15-CA (build 15.0.2+7, mixed mode)
> >
> >
> >
> > Thanks
> >
> >
>
>


Re: Kotlin 1.5.0 : NotSerializableException: Non-serializable lambda

2021-04-29 Thread smallufo
more detail log :

2021-04-30 12:43:44.076 [http-nio-8080-exec-2] WARN
 o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
to writeObject : Non-serializable lambda, path: /children/[write:1]/data
2021-04-30 12:43:44.078 [http-nio-8080-exec-2] WARN
 o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
to writeObject : Non-serializable lambda, path: /children/[write:2]
2021-04-30 12:43:44.079 [http-nio-8080-exec-2] WARN
 o.a.w.c.u.o.c.CheckingObjectOutputStream.internalCheck - error delegating
to writeObject : Non-serializable lambda, path: /children
2021-04-30 12:43:44.099 [http-nio-8080-exec-2] ERROR
o.a.w.s.j.JavaSerializer.serialize - Error serializing object class
destiny.WizardPage [object=[Page class = destiny.WizardPage, id = 1, render
count = 1]]
org.apache.wicket.WicketRuntimeException: A problem occurred while trying
to collect debug information about not serializable object
at
org.apache.wicket.serialize.java.JavaSerializer$SerializationCheckerObjectOutputStream.writeObjectOverride(JavaSerializer.java:390)
at
java.base/java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
at
org.apache.wicket.serialize.java.JavaSerializer.serialize(JavaSerializer.java:82)
at
org.apache.wicket.pageStore.AbstractPageStore.serializePage(AbstractPageStore.java:133)
at
org.apache.wicket.pageStore.DefaultPageStore.createSerializedPage(DefaultPageStore.java:281)
at
org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:61)
at
org.apache.wicket.page.PageStoreManager$PersistentRequestAdapter.storeTouchedPages(PageStoreManager.java:482)
at
org.apache.wicket.page.RequestAdapter.commitRequest(RequestAdapter.java:214)

smallufo  於 2021年4月30日 週五 下午12:52寫道:

> I was using Kotlin 1.4.32 with wicket 8.11
> but after upgrading to Kotlin 1.5.0 , it throws :
>
> Caused by: java.io.NotSerializableException: Non-serializable lambda
> at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> at
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.base/java.lang.reflect.Method.invoke(Method.java:564)
> at
> java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1196)
> at
> java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1523)
> at
> java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1444)
> at
> java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1187)
> at
> java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1579)
>
>
> what may go wrong here ?
>
> The wicket mode is DEPLOYMENT
>
> 
>   wicket
>   org.apache.wicket.protocol.http.WicketFilter
>   
> applicationClassName
> foo.bar.MyApplication
>   
>   
> configuration
> DEPLOYMENT
>   
> 
> 
>   wicket
>   /app/*
> 
>
>
> @MacMiniM1  ~  java -version
> openjdk version "15.0.2" 2021-01-19
> OpenJDK Runtime Environment Zulu15.29+15-CA (build 15.0.2+7)
> OpenJDK 64-Bit Server VM Zulu15.29+15-CA (build 15.0.2+7, mixed mode)
>
>
>
> Thanks
>
>


Kotlin 1.5.0 : NotSerializableException: Non-serializable lambda

2021-04-29 Thread smallufo
I was using Kotlin 1.4.32 with wicket 8.11
but after upgrading to Kotlin 1.5.0 , it throws :

Caused by: java.io.NotSerializableException: Non-serializable lambda
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at
java.base/java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1196)
at
java.base/java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1523)
at
java.base/java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1444)
at
java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1187)
at
java.base/java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1579)


what may go wrong here ?

The wicket mode is DEPLOYMENT


  wicket
  org.apache.wicket.protocol.http.WicketFilter
  
applicationClassName
foo.bar.MyApplication
  
  
configuration
DEPLOYMENT
  


  wicket
  /app/*



@MacMiniM1  ~  java -version
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment Zulu15.29+15-CA (build 15.0.2+7)
OpenJDK 64-Bit Server VM Zulu15.29+15-CA (build 15.0.2+7, mixed mode)



Thanks


Re: Locatable UnsupportedOperationException

2020-05-30 Thread smallufo
Is it possible to try { setObjectObject(value) } catch { e }
and pinpoint which class/model causes this problem ?
Or is it too costly ?


Francois Meillet  於 2020年5月30日 週六 下午11:02寫道:

> Hope that help
>
> During the process of throwing an exception, the Java Virtual Machine
> abruptly completes, one by one, any expressions, statements, method and
> constructor invocations, initializers, and field initialization expressions
> that have begun but not completed execution in the current thread. This
> process continues until a handler is found that indicates that it handles
> that particular exception by naming the class of the exception or a
> superclass of the class of the exception (§11.2 <
> https://docs.oracle.com/javase/specs/jls/se11/html/jls-11.html#jls-11.2>).
> If no such handler is found, then the exception may be handled by one of a
> hierarchy of uncaught exception handlers (§11.3 <
> https://docs.oracle.com/javase/specs/jls/se11/html/jls-11.html#jls-11.3>)
> - thus every effort is made to avoid letting an exception go unhandled.
>
> https://docs.oracle.com/javase/specs/jls/se11/html/jls-11.html <
> https://docs.oracle.com/javase/specs/jls/se11/html/jls-11.html>
>
>
> François
>
>
>
> > Le 30 mai 2020 à 16:52, smallufo  a écrit :
> >
> > Francois Meillet  於 2020年5月30日 週六 下午10:48寫道:
> >
> >> sompage?67-1.-border-content-border_body-form is the path to your model
> >>
> >
> > Yes , but it may contains deep-nested model
> >
> > The form contains FormComponentPanel and contains another
> > FormComponentPanels and widgets , very deep ...
> > The error may lay under very deep model , which is very hard to debug.
> > And the error message should be able to pinpoint which model causes the
> > problem
>
>


Re: Locatable UnsupportedOperationException

2020-05-30 Thread smallufo
Francois Meillet  於 2020年5月30日 週六 下午10:48寫道:

> sompage?67-1.-border-content-border_body-form is the path to your model
>

Yes , but it may contains deep-nested model

The form contains FormComponentPanel and contains another
FormComponentPanels and widgets , very deep ...
The error may lay under very deep model , which is very hard to debug.
And the error message should be able to pinpoint which model causes the
problem


Re: Locatable UnsupportedOperationException

2020-05-30 Thread smallufo
(AbstractAccessLogValve.java:678)

at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:609)

at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)

at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1506)

at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.base/java.lang.Thread.run(Thread.java:834)

Francois Meillet  於 2020年5月30日 週六 下午10:29寫道:

> In your stacktrace, look at the line just below
> org.apache.wicket.model.IModel.setObject(IModel.java:84)
> You will find the cuprit
>
> Exception in thread "main" java.lang.UnsupportedOperationException:
> Override this method to support setObject(Object)
> at org.apache.wicket.model.IModel.setObject(IModel.java:84)
> at
> xxx..zzz.YourClassUsingThisModel.theMethod(YourClassUsingThisModel.java:12)
>
> François
>
>
>
> > Le 30 mai 2020 à 16:13, smallufo  a écrit :
> >
> > Yes , I know...
> > But I hope it will be more informative.
> > Because in practice , there may be lots of models , nested panels , forms
> > , even in one page...
> > Informative error message can make us quickly understand which model
> needs
> > to implement setObject.
> > (just like the un-serializable field error message)
> >
> > Thanks.
> >
> >
> > Francois Meillet  francois.meil...@gmail.com>> 於 2020年5月30日 週六 下午9:58寫道:
> >
> >> Hi,
> >>
> >> Depending on the model you use, you may need to ovveride the setObject()
> >> method.
> >>
> >> from the API docs
> >>
> >> default void setObject​(T object)
> >>
> >> Throws:
> >> UnsupportedOperationException - unless overridden
> >>
> >>
> >>
> >>
> https://ci.apache.org/projects/wicket/apidocs/9.x/org/apache/wicket/model/IModel.html#setObject(T)
> >> <
> >>
> https://ci.apache.org/projects/wicket/apidocs/9.x/org/apache/wicket/model/IModel.html#setObject(T)
> <
> https://ci.apache.org/projects/wicket/apidocs/9.x/org/apache/wicket/model/IModel.html#setObject(T)
> >
> >>>
> >>
> >>
> >> François
> >>
> >>
> >>
> >>> Le 30 mai 2020 à 15:46, smallufo  a écrit :
> >>>
> >>> Hi
> >>> I am building an app with complicated forms , nested models ...
> >>> Some times it obsesses me is the UnsupportedOperationException :
> >>>
> >>> java.lang.UnsupportedOperationException: Override this method to
> support
> >>> setObject(Object)
> >>>
> >>> at org.apache.wicket.model.IModel.setObject(IModel.java:84)
> >>> It doesn't pinpoint me which model , which form , which panel...
> >>> very hard to debug...
> >>> For non-serializable exception , it can provide meaning information ,
> >> even
> >>> pinpoint which field causes the problem.
> >>> I hope some day , this UnsupportedOperationException can also be so
> >>> informative.
> >>>
> >>> Thanks.
>
>


Re: Locatable UnsupportedOperationException

2020-05-30 Thread smallufo
Yes , I know...
But I hope it will be more informative.
Because in practice , there may be lots of models , nested panels , forms
, even in one page...
Informative error message can make us quickly understand which model needs
to implement setObject.
(just like the un-serializable field error message)

Thanks.


Francois Meillet  於 2020年5月30日 週六 下午9:58寫道:

> Hi,
>
> Depending on the model you use, you may need to ovveride the setObject()
> method.
>
> from the API docs
>
> default void setObject​(T object)
>
> Throws:
> UnsupportedOperationException - unless overridden
>
>
>
> https://ci.apache.org/projects/wicket/apidocs/9.x/org/apache/wicket/model/IModel.html#setObject(T)
> <
> https://ci.apache.org/projects/wicket/apidocs/9.x/org/apache/wicket/model/IModel.html#setObject(T)
> >
>
>
> François
>
>
>
> > Le 30 mai 2020 à 15:46, smallufo  a écrit :
> >
> > Hi
> > I am building an app with complicated forms , nested models ...
> > Some times it obsesses me is the UnsupportedOperationException :
> >
> > java.lang.UnsupportedOperationException: Override this method to support
> > setObject(Object)
> >
> > at org.apache.wicket.model.IModel.setObject(IModel.java:84)
> > It doesn't pinpoint me which model , which form , which panel...
> > very hard to debug...
> > For non-serializable exception , it can provide meaning information ,
> even
> > pinpoint which field causes the problem.
> > I hope some day , this UnsupportedOperationException can also be so
> > informative.
> >
> > Thanks.
>
>


Locatable UnsupportedOperationException

2020-05-30 Thread smallufo
Hi
I am building an app with complicated forms , nested models ...
Some times it obsesses me is the UnsupportedOperationException :

java.lang.UnsupportedOperationException: Override this method to support
setObject(Object)

at org.apache.wicket.model.IModel.setObject(IModel.java:84)
It doesn't pinpoint me which model , which form , which panel...
very hard to debug...
For non-serializable exception , it can provide meaning information , even
pinpoint which field causes the problem.
I hope some day , this UnsupportedOperationException can also be so
informative.

Thanks.


renderFullUrl for apache internal redirected page

2018-08-04 Thread smallufo
My server is apache frontend , redirecting all port 80 to 443
and with '/app' prefix , proxyPass to internal tomcat , listening to port
8080

I use the following line to get full url
val absUrl =

requestCycle.urlRenderer.renderFullUrl(Url.parse(urlFor(MyPage::class.java,
pps).toString()))


The browser url shows https
but the absUrl is http

I trace the code , down to
UrlRenderer.resolveProtocol() and choose()

find my
request.getClientUrl().getPort() = 80

so it chooses http , not https

Any way to fix this ?

wicket-8.0.0


Re: [8.0] TextField with LambdaModel forced to use String

2018-06-16 Thread smallufo
Thanks .
It works (but seems a little duplication)

Andrew Geery  於 2018年6月16日 週六 下午5:32寫道:

> You have to use the TextField constructor that specifies the type of the
> model:
>
> https://ci.apache.org/projects/wicket/apidocs/8.x/org/apache/wicket/markup/html/form/TextField.html#TextField-java.lang.String-org.apache.wicket.model.IModel-java.lang.Class-
>
> It should be:
>
>  add(new TextField<>("year", LambdaModel.of(obj::getYear, obj::setYear),
> Integer.class));
>
> That one always gets me too...
>
> Thanks
> Andrew
>
> On Sat, Jun 16, 2018 at 3:30 AM smallufo  wrote:
>
> > After upgrading to 8.0 , I tried the exciting LambdaModel , try to
> replace
> > the non-TypeSafety PropertyModel
> > But I found it cannot handle type intelligently.
> > For a TextField , for example :
> >
> > form.add(new TextField("year", LambdaModel.of(obj::getYear,
> > obj::setYear )));
> >
> > At runtime , it reports Cannot cast from String to Integer.
> >
> > I have to rewrite getter / setter to String type (and do conversion  in
> > setter ) , but the backing field is Integer type. (And change
> > TextField to TextField , or <> )
> >
> > This is pity ...
> > Did I miss anything ?
> >
> > Thanks.
> >
>


[8.0] TextField with LambdaModel forced to use String

2018-06-16 Thread smallufo
After upgrading to 8.0 , I tried the exciting LambdaModel , try to replace
the non-TypeSafety PropertyModel
But I found it cannot handle type intelligently.
For a TextField , for example :

form.add(new TextField("year", LambdaModel.of(obj::getYear,
obj::setYear )));

At runtime , it reports Cannot cast from String to Integer.

I have to rewrite getter / setter to String type (and do conversion  in
setter ) , but the backing field is Integer type. (And change
TextField to TextField , or <> )

This is pity ...
Did I miss anything ?

Thanks.


PropertyModel cannot work with Kotlin's private field with get()

2018-01-15 Thread smallufo
If a kotlin's model has a field :

class MyModel {
  private val theValue: Double
get()  { return 1.0 }
}

and in the wicket page :
new PropertyModel(model , "theValue")

It will fail :

*WicketRuntimeException: Property could not be resolved for class: class
MyModel expression: theValue*

The solution : remove the private modifier :

class MyModel {
  val theValue: Double
get()  { return 1.0 }
}

Is there any way to get around this (keep the private modifier) ?

(wicket 7.9.0 , Kotlin 1.2)


Re: Border code works in 6.21 but failed in 6.22

2016-09-01 Thread smallufo
I finally pinpoint where goes wrong.

In my page's renderHead() method , I remove this line , and everything is
fine again.

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

  
response.render(CssHeaderItem.forReference(FixBootstrapStylesCssResourceReference.INSTANCE));
  //response.render(new
FilteredHeaderItem(JavaScriptHeaderItem.forReference(ApplicationJavaScript.INSTANCE),
"footer-container"));

  if ("google".equalsIgnoreCase(activeTheme().name())) {

response.render(CssHeaderItem.forReference(DocsCssResourceReference.GOOGLE));
  }
}


I already forgot why I added this *FilteredHeaderItem* to my renderHead() ,
but it seems it is the culprit that causes the problem.
After comment out this line , it works well in 6.22 , and 6.24

The referenced ApplicationJavaScript.java content  :

public class ApplicationJavaScript extends JavaScriptResourceReference {

  public static final ApplicationJavaScript INSTANCE = new
ApplicationJavaScript();

  private ApplicationJavaScript() {
super(ApplicationJavaScript.class, "application.js");
  }

  @Override
  public Iterable getDependencies() {
final List dependencies =
Lists.newArrayList(super.getDependencies());

dependencies.add(JavaScriptHeaderItem.forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()));

dependencies.add(JavaScriptHeaderItem.forReference(Bootstrap.getSettings().getJsResourceReference()));

return dependencies;
  }
}

It seems this file is safe to delete too.



2016-09-02 1:52 GMT+08:00 Martin Grigorov :

> Please create a demo app and attach it to a ticket at JIRA.
> Thanks!
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Sep 1, 2016 at 6:38 PM, smallufo  wrote:
>
> > no.
> >
> >
> >
> >
> >
> >
> >
> > */*** 6.19 ok* 6.21 ok* 6.22 failed* 6.23 failed* 6.24 failed*/*
> >
> >
> > 2016-09-01 22:06 GMT+08:00 Martin Grigorov :
> >
> > > Hi,
> > >
> > > Does it work in 6.24.0 ?
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > > On Thu, Sep 1, 2016 at 1:53 PM, smallufo  wrote:
> > >
> > > > Hi
> > > > This border code works in 6.21 but failed in 6.22
> > > >
> > > > It is a traditional 'portlet-like' border , with a 'title' and an
> ajax
> > > link
> > > > ( which will collapse/expand when clicked )
> > > >
> > > > I lookup up the change log
> > > > http://archive.apache.org/dist/wicket/6.24.0/CHANGELOG-6.x
> > > > but didn't find anything related to Border.
> > > >
> > > >
> > > >
> > > > import org.apache.wicket.MarkupContainer;
> > > > import org.apache.wicket.ajax.AjaxRequestTarget;
> > > > import org.apache.wicket.ajax.markup.html.AjaxLink;
> > > > import org.apache.wicket.markup.html.WebMarkupContainer;
> > > > import org.apache.wicket.markup.html.basic.Label;
> > > > import org.apache.wicket.markup.html.border.Border;
> > > > import org.apache.wicket.model.StringResourceModel;
> > > >
> > > > public class PulldownBorder extends Border {
> > > >
> > > >   private final WebMarkupContainer content;
> > > >
> > > >   /** is content expanded ? */
> > > >   private boolean expanded;
> > > >
> > > >   /** is content visible ? */
> > > >   public boolean contentVisible() {
> > > > return content.isVisible();
> > > >   }
> > > >
> > > >   public PulldownBorder(String id, String title, boolean
> > > defaultExpanded) {
> > > > super(id);
> > > >
> > > > setOutputMarkupPlaceholderTag(true);
> > > > setRenderBodyOnly(false);
> > > >
> > > > Label titleLabel = new Label("title", title);
> > > > expanded = defaultExpanded;
> > > >
> > > > content = new WebMarkupContainer("content");
> > > >
> > > > content.setOutputMarkupPlaceholderTag(true);
> > > > content.setVisible(defaultExpanded);
> > > > content.setRenderBodyOnly(false);
> > > > add(content);
> > > > //content.add(getBodyContainer());
> > > > addToBorder(content);
> > > >
> > > > //collapse / expand , text
> > > > final Label c

Re: Border code works in 6.21 but failed in 6.22

2016-09-01 Thread smallufo
no.







*/*** 6.19 ok* 6.21 ok* 6.22 failed* 6.23 failed* 6.24 failed*/*


2016-09-01 22:06 GMT+08:00 Martin Grigorov :

> Hi,
>
> Does it work in 6.24.0 ?
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Sep 1, 2016 at 1:53 PM, smallufo  wrote:
>
> > Hi
> > This border code works in 6.21 but failed in 6.22
> >
> > It is a traditional 'portlet-like' border , with a 'title' and an ajax
> link
> > ( which will collapse/expand when clicked )
> >
> > I lookup up the change log
> > http://archive.apache.org/dist/wicket/6.24.0/CHANGELOG-6.x
> > but didn't find anything related to Border.
> >
> >
> >
> > import org.apache.wicket.MarkupContainer;
> > import org.apache.wicket.ajax.AjaxRequestTarget;
> > import org.apache.wicket.ajax.markup.html.AjaxLink;
> > import org.apache.wicket.markup.html.WebMarkupContainer;
> > import org.apache.wicket.markup.html.basic.Label;
> > import org.apache.wicket.markup.html.border.Border;
> > import org.apache.wicket.model.StringResourceModel;
> >
> > public class PulldownBorder extends Border {
> >
> >   private final WebMarkupContainer content;
> >
> >   /** is content expanded ? */
> >   private boolean expanded;
> >
> >   /** is content visible ? */
> >   public boolean contentVisible() {
> > return content.isVisible();
> >   }
> >
> >   public PulldownBorder(String id, String title, boolean
> defaultExpanded) {
> > super(id);
> >
> > setOutputMarkupPlaceholderTag(true);
> > setRenderBodyOnly(false);
> >
> > Label titleLabel = new Label("title", title);
> > expanded = defaultExpanded;
> >
> > content = new WebMarkupContainer("content");
> >
> > content.setOutputMarkupPlaceholderTag(true);
> > content.setVisible(defaultExpanded);
> > content.setRenderBodyOnly(false);
> > add(content);
> > //content.add(getBodyContainer());
> > addToBorder(content);
> >
> > //collapse / expand , text
> > final Label collapseExpandText = new Label("collapseExpandText");
> > collapseExpandText.setOutputMarkupPlaceholderTag(true);
> > if (content.isVisible())
> >   collapseExpandText.setDefaultModel(new
> > StringResourceModel("collapse", this, null));
> > else
> >   collapseExpandText.setDefaultModel(new
> > StringResourceModel("expand", this, null));
> >
> >
> > //this link failed in 6.22
> > AjaxLink collapseExpandLink = new
> > AjaxLink("collapseExpandLink") {
> >   @Override
> >   public void onClick(AjaxRequestTarget target) {
> > expanded = !expanded;
> > content.setVisible(expanded);
> > target.add(content);
> >
> > MarkupContainer mc = (MarkupContainer)
> > findParent(ExpandCollapseListener.class);
> > if (mc != null) {
> > if (mc instanceof ExpandCollapseListener) {
> > ExpandCollapseListener listener = (ExpandCollapseListener)
> mc;
> > listener.setExpanded(expanded);
> >   }
> > }
> >
> > if (!expanded) {
> > target.add(collapseExpandText.setDefaultModel(new
> > StringResourceModel("expand", this, null)));
> > }
> > else {
> > target.add(collapseExpandText.setDefaultModel(new
> > StringResourceModel("collapse", this, null)));
> > }
> >   }
> > };
> > addToBorder(collapseExpandLink);
> > collapseExpandLink.add(collapseExpandText);
> > collapseExpandLink.add(titleLabel);
> >   }
> > }
> >
> >
> > public interface ExpandCollapseListener {
> >
> >   void setExpanded(boolean value);
> > }
> >
> >
> > The problem comes from *collapseExpandLink* , which works in 6.21 , but
> > failed in 6.22
> >
> > I cannot find where goes wrong.
> > Can somebody give me some hint ?
> >
> > Thanks.
> >
>


Border code works in 6.21 but failed in 6.22

2016-09-01 Thread smallufo
Hi
This border code works in 6.21 but failed in 6.22

It is a traditional 'portlet-like' border , with a 'title' and an ajax link
( which will collapse/expand when clicked )

I lookup up the change log
http://archive.apache.org/dist/wicket/6.24.0/CHANGELOG-6.x
but didn't find anything related to Border.



import org.apache.wicket.MarkupContainer;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.border.Border;
import org.apache.wicket.model.StringResourceModel;

public class PulldownBorder extends Border {

  private final WebMarkupContainer content;

  /** is content expanded ? */
  private boolean expanded;

  /** is content visible ? */
  public boolean contentVisible() {
return content.isVisible();
  }

  public PulldownBorder(String id, String title, boolean defaultExpanded) {
super(id);

setOutputMarkupPlaceholderTag(true);
setRenderBodyOnly(false);

Label titleLabel = new Label("title", title);
expanded = defaultExpanded;

content = new WebMarkupContainer("content");

content.setOutputMarkupPlaceholderTag(true);
content.setVisible(defaultExpanded);
content.setRenderBodyOnly(false);
add(content);
//content.add(getBodyContainer());
addToBorder(content);

//collapse / expand , text
final Label collapseExpandText = new Label("collapseExpandText");
collapseExpandText.setOutputMarkupPlaceholderTag(true);
if (content.isVisible())
  collapseExpandText.setDefaultModel(new
StringResourceModel("collapse", this, null));
else
  collapseExpandText.setDefaultModel(new
StringResourceModel("expand", this, null));


//this link failed in 6.22
AjaxLink collapseExpandLink = new
AjaxLink("collapseExpandLink") {
  @Override
  public void onClick(AjaxRequestTarget target) {
expanded = !expanded;
content.setVisible(expanded);
target.add(content);

MarkupContainer mc = (MarkupContainer)
findParent(ExpandCollapseListener.class);
if (mc != null) {
if (mc instanceof ExpandCollapseListener) {
ExpandCollapseListener listener = (ExpandCollapseListener) mc;
listener.setExpanded(expanded);
  }
}

if (!expanded) {
target.add(collapseExpandText.setDefaultModel(new
StringResourceModel("expand", this, null)));
}
else {
target.add(collapseExpandText.setDefaultModel(new
StringResourceModel("collapse", this, null)));
}
  }
};
addToBorder(collapseExpandLink);
collapseExpandLink.add(collapseExpandText);
collapseExpandLink.add(titleLabel);
  }
}


public interface ExpandCollapseListener {

  void setExpanded(boolean value);
}


The problem comes from *collapseExpandLink* , which works in 6.21 , but
failed in 6.22

I cannot find where goes wrong.
Can somebody give me some hint ?

Thanks.


Re: Immutable Object for FormComponentPanel ?

2015-06-08 Thread smallufo
OK . It seems I figure it out ...

add(yangDayChoice = new DropDownChoice<>(
  "day",
  new PropertyModel(localDate, "dayOfMonth") {
@Override
public void setObject(Integer value) {
  LocalDate ld = getModelObject();
  LocalDate ld2 = LocalDate.of(ld.getYear() , ld.getMonthValue() ,
value);
  DatePanel.this.setModelObject(ld2);
}
  },
  IntStream.range(1, 32).boxed().collect(Collectors.toList()))
);



2015-06-08 15:38 GMT+08:00 smallufo :

>
> 2015-06-08 14:36 GMT+08:00 Martin Grigorov :
>
>>
>> MyFormComponentPanel.this.setModelObject(getModelObject().withDayOfMonth(DayOfMonth));
>>
>
> Excuse me
> Where should I put this code to ?
>
> DatePanel's constructor ?
> or override DropDownChoice's some method ?
> or DatePanel's convertInput() ?
> or somewhere ?
>
>
> Thanks.
>
>


Re: Immutable Object for FormComponentPanel ?

2015-06-08 Thread smallufo
2015-06-08 14:36 GMT+08:00 Martin Grigorov :

>
> MyFormComponentPanel.this.setModelObject(getModelObject().withDayOfMonth(DayOfMonth));
>

Excuse me
Where should I put this code to ?

DatePanel's constructor ?
or override DropDownChoice's some method ?
or DatePanel's convertInput() ?
or somewhere ?


Thanks.


Immutable Object for FormComponentPanel ?

2015-06-07 Thread smallufo
Hi :
I have a question about immutable object in FormComponentPanel .
If the object doesn't have setters , how to correctly handle it ?
for example : Java8's LocalDate , it only has getYear() , getMonthValue() ,
getDayOfMonth()
no setters.

And in my code :


public class DatePanel extends FormComponentPanel {

  private Logger logger = LoggerFactory.getLogger(getClass());

  // year / month DropDownChoice skipped
  private DropDownChoice dayChoice;

  public DatePanel(String id, LocalDate localDate) {
super(id, Model.of(localDate));

// year / month skipped
add(dayChoice = new DropDownChoice<>(
  "day",
  new PropertyModel<>(localDate , "dayOfMonth")  ,
  IntStream.range(1, 32).boxed().collect(Collectors.toList()))
);
  }

  @Override
  protected void convertInput() {
// year / month skipped
int day = dayChoice.getConvertedInput();

logger.info("year = {} , month = {} , day = {}" , year , month , day);
setConvertedInput(LocalDate.of(year, month, day));
  }
}

It will throw "*WicketRuntimeException: no set method defined*" exception.

Well , I can wrap LocalDate in a mutable wrapper (with setYear / setMonth /
setDay methods) ,
and pass this LocalDateWrapper as the Model of FormComponentPanel.
But is it the only solution ?
Any other solution without a wrapper ?

Thanks.


Re: ClientProperties.getBrowserWidth() always returns -1

2015-05-20 Thread smallufo
2015-05-20 23:27 GMT+08:00 Martin Grigorov :

> You can use AjaxBrowserInfoBehavior.
>


I think you mean AjaxClientInfoBehavior
http://www.wicket-library.com/wicket-examples-6.0.x/ajaxhellobrowser/?0

Thanks . it's working well !

But I have another question.

Is there any way to get the containing element's width ?

for example :


*  *

It will have different proportion in different width
for XS (extreme small) screen , it will be 100% width
and for SM (small) or larger  screen , it will cover 1/3 width
Is it possible to dynamically get the width of the containing element ?
(so that I can generate correct width image )

Thanks.


Re: ClientProperties.getBrowserWidth() always returns -1

2015-05-20 Thread smallufo
It seems the ClientProperties is cached in session.
Even if I resize the window , it will show the first result.

Is it possible to get the latest browser width/height ?
Thanks.

2015-04-18 20:23 GMT+08:00 Martin Grigorov :

> Hi,
>
> Check wicket-examples. There are demos of (Ajax)BrowserInfo
> On Apr 17, 2015 10:56 PM, "smallufo"  wrote:
>
> > 2015-04-18 9:53 GMT+08:00 smallufo :
> >
> > > getApplicationSettings().setUploadProgressUpdatesEnabled(true);
> > >
> >
> > typo
> > It is
> > *getRequestCycleSettings().setGatherExtendedBrowserInfo(true);*
> >
> > width is still -1
> >
>


Re: ClientProperties.getBrowserWidth() always returns -1

2015-04-17 Thread smallufo
2015-04-18 9:53 GMT+08:00 smallufo :

> getApplicationSettings().setUploadProgressUpdatesEnabled(true);
>

typo
It is
*getRequestCycleSettings().setGatherExtendedBrowserInfo(true);*

width is still -1


ClientProperties.getBrowserWidth() always returns -1

2015-04-17 Thread smallufo
I want to get width of the browser.

in Application.init() , I add :
getApplicationSettings().setUploadProgressUpdatesEnabled(true);

And in a WebPage , I add :
logger.info("init . width = {}", new
WebClientInfo(getRequestCycle()).getProperties().getBrowserWidth());

but it always return -1


I found no usage for *WebClientInfo.setBrowserWidth()* in the whole wicket
6.19.0

Is it a bug ?


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-08 Thread smallufo
Sorry , because the server receives no event.
There is no debug output.

I think it is easy to replicate the error.
just fork bootstrap-samples :

https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-samples

and add
LoginModal code :
http://pastebin.com/0qGUFvXP


And the LoginPage code :
http://pastebin.com/aDDxuZmx

The server will receive no event (fired in the LoginPage) .



2014-07-08 18:45 GMT+08:00 Martin Grigorov :

> Then you will have to debug what happens ...
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Tue, Jul 8, 2014 at 1:28 PM, smallufo  wrote:
>
> > Yes , I am using 6.16.0
> >
> >   
> > 6.16.0
> > 0.9.4
> > 2.4.7
> >   
> >
> >
> > 2014-07-08 14:56 GMT+08:00 Martin Grigorov :
> >
> > > I believe https://issues.apache.org/jira/browse/WICKET-5585 is
> related.
> > > Do you use Wicket 6.16.0 ?
> > >
> > > Martin Grigorov
> > > Wicket Training and Consulting
> > > https://twitter.com/mtgrigorov
> > >
> > >
> > > On Tue, Jul 8, 2014 at 4:00 AM, smallufo  wrote:
> > >
> > > > sorry , There is no stack trace.
> > > > Because it triggers nothing , the server doesn't receive anything.
> > > >
> > > >
> > > >
> > > > 2014-07-07 14:21 GMT+08:00 Michael Haitz :
> > > >
> > > > > please provide the full stacktrace.
> > > > >
> > > > > cheers,
> > > > > Michael
> > > > >
> > > > > Am 06.07.2014 um 05:44 schrieb smallufo :
> > > > >
> > > > > > It seems working now.
> > > > > > But such removal also make theme-switching not working :
> > > > > >
> > > > > > If I enable the ThemeProvider :
> > > > > >
> > > > > >final ThemeProvider themeProvider = new
> > > > > > BootswatchThemeProvider(BootswatchTheme.Flatly);
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> settings.setJsResourceFilterName("footer-container").setThemeProvider(themeProvider);
> > > > > >
> > > > > > without "footer-container" in the BasePage
> > > > > >
> > > > > > wicket-bootstrap will throw
> > > > > >
> > > > > > WicketRuntimeException: theme does not exists: bootstrap
> > > > > >
> > > > > > at
> > > > > >
> > > > >
> > > >
> > >
> >
> de.agilecoders.wicket.themes.settings.BootswatchThemeProvider.byName(BootswatchThemeProvider.java:49)
> > > > > >
> > > > > >
> > > > > > So I could only use the native bootstrap theme now.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2014-07-06 11:30 GMT+08:00 smallufo :
> > > > > >
> > > > > >> I found where goes wrong ,
> > > > > >> it's RenderJavaScriptToFooterHeaderResponseDecorator that causes
> > the
> > > > > >> problem.
> > > > > >>
> > > > > >> I am not familiar with wicket-bootstrap , so I mimicked
> > > > wicket-bootstrap
> > > > > >> sample's architecture :
> > > > > >>
> > > > > >>
> > > > >
> > > >
> > >
> >
> https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples
> > > > > >>
> > > > > >> This is my 'not' working architecture :
> > > > > >> http://pastebin.com/vB3Ek2t9
> > > > > >>
> > > > > >> After removing RenderJavaScriptToFooterHeaderResponseDecorator ,
> > > > > >> footer-container , it works fine.
> > > > > >>
> > > > > >> http://pastebin.com/kAehvaRr
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >> 2014-07-05 21:10 GMT+08:00 Francois Meillet <
> > > > francois.meil...@gmail.com
> > > > > >:
> > > > > >>
> > > > > >> R

Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-08 Thread smallufo
Yes , I am using 6.16.0

  
6.16.0
0.9.4
2.4.7
  


2014-07-08 14:56 GMT+08:00 Martin Grigorov :

> I believe https://issues.apache.org/jira/browse/WICKET-5585 is related.
> Do you use Wicket 6.16.0 ?
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
>
> On Tue, Jul 8, 2014 at 4:00 AM, smallufo  wrote:
>
> > sorry , There is no stack trace.
> > Because it triggers nothing , the server doesn't receive anything.
> >
> >
> >
> > 2014-07-07 14:21 GMT+08:00 Michael Haitz :
> >
> > > please provide the full stacktrace.
> > >
> > > cheers,
> > > Michael
> > >
> > > Am 06.07.2014 um 05:44 schrieb smallufo :
> > >
> > > > It seems working now.
> > > > But such removal also make theme-switching not working :
> > > >
> > > > If I enable the ThemeProvider :
> > > >
> > > >final ThemeProvider themeProvider = new
> > > > BootswatchThemeProvider(BootswatchTheme.Flatly);
> > > >
> > > >
> > >
> >
> settings.setJsResourceFilterName("footer-container").setThemeProvider(themeProvider);
> > > >
> > > > without "footer-container" in the BasePage
> > > >
> > > > wicket-bootstrap will throw
> > > >
> > > > WicketRuntimeException: theme does not exists: bootstrap
> > > >
> > > > at
> > > >
> > >
> >
> de.agilecoders.wicket.themes.settings.BootswatchThemeProvider.byName(BootswatchThemeProvider.java:49)
> > > >
> > > >
> > > > So I could only use the native bootstrap theme now.
> > > >
> > > >
> > > >
> > > >
> > > > 2014-07-06 11:30 GMT+08:00 smallufo :
> > > >
> > > >> I found where goes wrong ,
> > > >> it's RenderJavaScriptToFooterHeaderResponseDecorator that causes the
> > > >> problem.
> > > >>
> > > >> I am not familiar with wicket-bootstrap , so I mimicked
> > wicket-bootstrap
> > > >> sample's architecture :
> > > >>
> > > >>
> > >
> >
> https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples
> > > >>
> > > >> This is my 'not' working architecture :
> > > >> http://pastebin.com/vB3Ek2t9
> > > >>
> > > >> After removing RenderJavaScriptToFooterHeaderResponseDecorator ,
> > > >> footer-container , it works fine.
> > > >>
> > > >> http://pastebin.com/kAehvaRr
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >> 2014-07-05 21:10 GMT+08:00 Francois Meillet <
> > francois.meil...@gmail.com
> > > >:
> > > >>
> > > >> Run your app in debug mode and set some breakpoint.
> > > >>>
> > > >>> eclipse
> > > >>>
> > > >>>
> > >
> >
> http://www.eclipse.org/jetty/documentation/current/debugging-with-intellij.html
> > > >>> http://www.vogella.com/tutorials/EclipseDebugging/article.html
> > > >>>
> > > >>>
> > >
> >
> http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Frun-debug%2Fref-run_debug.htm
> > > >>>
> > > >>> intellij
> > > >>>
> http://www.jetbrains.com/idea/webhelp/run-debug-configurations.html
> > > >>>
> > > >>>
> > >
> >
> http://www.jetbrains.com/idea/webhelp/creating-and-editing-run-debug-configurations.html
> > > >>>
> > > >>> François Meillet
> > > >>> Formation Wicket - Développement Wicket
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>>
> > > >>> Le 5 juil. 2014 à 14:56, smallufo  a écrit :
> > > >>>
> > > >>>> 2014-07-05 20:55 GMT+08:00 smallufo :
> > > >>>>
> > > >>>>>
> > > >>>>> But i still find another "id6c" or "id6d"  in the source code.
> > > >>>>>
> > > >>>>
> > > >>>> sorry typo :
> > > >>>>
> > > >>>> But i still *cannot* find another "id6c" or "id6d"  in the source
> > > code.
> > > >>>
> > > >>>
> > > >>
> > >
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > > For additional commands, e-mail: users-h...@wicket.apache.org
> > >
> > >
> >
>


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-07 Thread smallufo
sorry , There is no stack trace.
Because it triggers nothing , the server doesn't receive anything.



2014-07-07 14:21 GMT+08:00 Michael Haitz :

> please provide the full stacktrace.
>
> cheers,
> Michael
>
> Am 06.07.2014 um 05:44 schrieb smallufo :
>
> > It seems working now.
> > But such removal also make theme-switching not working :
> >
> > If I enable the ThemeProvider :
> >
> >final ThemeProvider themeProvider = new
> > BootswatchThemeProvider(BootswatchTheme.Flatly);
> >
> >
> settings.setJsResourceFilterName("footer-container").setThemeProvider(themeProvider);
> >
> > without "footer-container" in the BasePage
> >
> > wicket-bootstrap will throw
> >
> > WicketRuntimeException: theme does not exists: bootstrap
> >
> > at
> >
> de.agilecoders.wicket.themes.settings.BootswatchThemeProvider.byName(BootswatchThemeProvider.java:49)
> >
> >
> > So I could only use the native bootstrap theme now.
> >
> >
> >
> >
> > 2014-07-06 11:30 GMT+08:00 smallufo :
> >
> >> I found where goes wrong ,
> >> it's RenderJavaScriptToFooterHeaderResponseDecorator that causes the
> >> problem.
> >>
> >> I am not familiar with wicket-bootstrap , so I mimicked wicket-bootstrap
> >> sample's architecture :
> >>
> >>
> https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples
> >>
> >> This is my 'not' working architecture :
> >> http://pastebin.com/vB3Ek2t9
> >>
> >> After removing RenderJavaScriptToFooterHeaderResponseDecorator ,
> >> footer-container , it works fine.
> >>
> >> http://pastebin.com/kAehvaRr
> >>
> >>
> >>
> >>
> >>
> >> 2014-07-05 21:10 GMT+08:00 Francois Meillet  >:
> >>
> >> Run your app in debug mode and set some breakpoint.
> >>>
> >>> eclipse
> >>>
> >>>
> http://www.eclipse.org/jetty/documentation/current/debugging-with-intellij.html
> >>> http://www.vogella.com/tutorials/EclipseDebugging/article.html
> >>>
> >>>
> http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Frun-debug%2Fref-run_debug.htm
> >>>
> >>> intellij
> >>> http://www.jetbrains.com/idea/webhelp/run-debug-configurations.html
> >>>
> >>>
> http://www.jetbrains.com/idea/webhelp/creating-and-editing-run-debug-configurations.html
> >>>
> >>> François Meillet
> >>> Formation Wicket - Développement Wicket
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> Le 5 juil. 2014 à 14:56, smallufo  a écrit :
> >>>
> >>>> 2014-07-05 20:55 GMT+08:00 smallufo :
> >>>>
> >>>>>
> >>>>> But i still find another "id6c" or "id6d"  in the source code.
> >>>>>
> >>>>
> >>>> sorry typo :
> >>>>
> >>>> But i still *cannot* find another "id6c" or "id6d"  in the source
> code.
> >>>
> >>>
> >>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-05 Thread smallufo
It seems working now.
But such removal also make theme-switching not working :

If I enable the ThemeProvider :

final ThemeProvider themeProvider = new
BootswatchThemeProvider(BootswatchTheme.Flatly);

settings.setJsResourceFilterName("footer-container").setThemeProvider(themeProvider);

without "footer-container" in the BasePage

wicket-bootstrap will throw

WicketRuntimeException: theme does not exists: bootstrap

at
de.agilecoders.wicket.themes.settings.BootswatchThemeProvider.byName(BootswatchThemeProvider.java:49)


So I could only use the native bootstrap theme now.




2014-07-06 11:30 GMT+08:00 smallufo :

> I found where goes wrong ,
> it's RenderJavaScriptToFooterHeaderResponseDecorator that causes the
> problem.
>
> I am not familiar with wicket-bootstrap , so I mimicked wicket-bootstrap
> sample's architecture :
>
> https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples
>
> This is my 'not' working architecture :
> http://pastebin.com/vB3Ek2t9
>
> After removing RenderJavaScriptToFooterHeaderResponseDecorator ,
> footer-container , it works fine.
>
> http://pastebin.com/kAehvaRr
>
>
>
>
>
> 2014-07-05 21:10 GMT+08:00 Francois Meillet :
>
> Run your app in debug mode and set some breakpoint.
>>
>> eclipse
>>
>> http://www.eclipse.org/jetty/documentation/current/debugging-with-intellij.html
>> http://www.vogella.com/tutorials/EclipseDebugging/article.html
>>
>> http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Frun-debug%2Fref-run_debug.htm
>>
>> intellij
>> http://www.jetbrains.com/idea/webhelp/run-debug-configurations.html
>>
>> http://www.jetbrains.com/idea/webhelp/creating-and-editing-run-debug-configurations.html
>>
>> François Meillet
>> Formation Wicket - Développement Wicket
>>
>>
>>
>>
>>
>> Le 5 juil. 2014 à 14:56, smallufo  a écrit :
>>
>> > 2014-07-05 20:55 GMT+08:00 smallufo :
>> >
>> >>
>> >> But i still find another "id6c" or "id6d"  in the source code.
>> >>
>> >
>> > sorry typo :
>> >
>> > But i still *cannot* find another "id6c" or "id6d"  in the source code.
>>
>>
>


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-05 Thread smallufo
I found where goes wrong ,
it's RenderJavaScriptToFooterHeaderResponseDecorator that causes the
problem.

I am not familiar with wicket-bootstrap , so I mimicked wicket-bootstrap
sample's architecture :
https://github.com/l0rdn1kk0n/wicket-bootstrap/tree/master/bootstrap-samples/src/main/java/de/agilecoders/wicket/samples

This is my 'not' working architecture :
http://pastebin.com/vB3Ek2t9

After removing RenderJavaScriptToFooterHeaderResponseDecorator ,
footer-container , it works fine.

http://pastebin.com/kAehvaRr





2014-07-05 21:10 GMT+08:00 Francois Meillet :

> Run your app in debug mode and set some breakpoint.
>
> eclipse
>
> http://www.eclipse.org/jetty/documentation/current/debugging-with-intellij.html
> http://www.vogella.com/tutorials/EclipseDebugging/article.html
>
> http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Frun-debug%2Fref-run_debug.htm
>
> intellij
> http://www.jetbrains.com/idea/webhelp/run-debug-configurations.html
>
> http://www.jetbrains.com/idea/webhelp/creating-and-editing-run-debug-configurations.html
>
> François Meillet
> Formation Wicket - Développement Wicket
>
>
>
>
>
> Le 5 juil. 2014 à 14:56, smallufo  a écrit :
>
> > 2014-07-05 20:55 GMT+08:00 smallufo :
> >
> >>
> >> But i still find another "id6c" or "id6d"  in the source code.
> >>
> >
> > sorry typo :
> >
> > But i still *cannot* find another "id6c" or "id6d"  in the source code.
>
>


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-05 Thread smallufo
2014-07-05 20:55 GMT+08:00 smallufo :

>
> But i still find another "id6c" or "id6d"  in the source code.
>

sorry typo :

But i still *cannot* find another "id6c" or "id6d"  in the source code.


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-05 Thread smallufo
2014-07-05 20:43 GMT+08:00 Martin Grigorov :

>
> The code above is again Wicket 6.x/7.x but in DEVELOPMENT mode.
> It should generate also the Wicket.Ajax.*** stuff. I cannot say why it is
> missing for you.



Oops
I must got it wrong.
The two servers are wicket 6.
One is without wicket-bootstrap , and the modal works like a charm.

Another dev server , I incorporated  wicket-bootstrap , it seems not
working.
After I change "DEVELOPMENT" to "DEPLOYMENT",
It generates :



But i still find another "id6c" or "id6d"  in the source code.

I don't know if it is wicket-bootstrap that affects modal ...


The  setCloseButtonCallback() , and setWindowClosedCallback() events are
correctly triggered.


Re: [6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-05 Thread smallufo
2014-07-05 18:53 GMT+08:00 Francois Meillet :

>
> Have you set a breakpoint in the onSubmit method of your ajax submit
> button ?
>
> François
>

No  , I didn't set any breakpoints (in fact , I don't know such feature).
The code is just like that.
The two onSubmit()s are not hooked /  triggered.


[6.16] AjaxButton.onSubmit not working after upgrading to wicket 6

2014-07-05 Thread smallufo
I have a LoginModal which pops up a modal with username / password for user
to login.
It works before wicket 6.
After upgrading to wicket 6 , it's not working anymore.

Can someone check where goes wrong ?

Here is the LoginModal code :
http://pastebin.com/hNTMs3A7

And here is the LoginPage code :
http://pastebin.com/aDDxuZmx

In wicket 1.5 , it generate the following code :


And I search "id98" , "id99" , I can see them 'hooked' into wicket by

Wicket.Event.add(window, "domready", function(event) {
Wicket.Ajax.ajax({"sc":":submit","c":"id98","u":"./page?19-1.IBehaviorListener.0-form-submit","e":"click","f":"id97","m":"POST"});;
Wicket.Ajax.ajax({"sc":"cancel","c":"id99","u":"./page?19-1.IBehaviorListener.0-form-cancel","e":"click","f":"id97","m":"POST"});;

But after upgrading to wicket 6 (well , with wicket-bootstrap ) , it
generates :



But I cannot find another "submitdc" or  "canceldd" string in the source
code.

So , no matter 'submit' or 'cancel' , the console prints nothing ( I put
some logging in the onSubmit , .
Wicket AJAX Debug console didn't show anything.

What may go wrong here ?
Thanks.


Re: Deserialization InvalidClassException : no valid constructor

2013-05-27 Thread smallufo
I solve this problem by making the BufferedImage transient.



2013/5/27 Jonas 

> Well, you can't serialize the BufferedImage, but maybe you can serialize
> whatever data you've used to render BufferedImage's contents,
> i.e. instead of saving the image, save whatever is necessary to recreate
> the image?
> Or, you could store the BufferedImage's content to an actual image file
> (using ImageIO)?
>
>
> On Wed, May 22, 2013 at 5:39 AM, smallufo  wrote:
>
> > Thanks.
> > But in my example , I cannot modify BufferedImage (to add a no-arg
> > constructor)
> > What should I do if I want to output a BufferedImage (and make back
> button
> > work) ?
> >
> >
> >
> > 2013/5/14 Jonas 
> >
> > > This could only work if BufferedImage itself had a no-arg constructor.
> > > It is it the first non-serializable class in the hierarchy that needs
> to
> > > have it,
> > > not the first serializable one, like in your example.
> > > Besides, you would still lose all data stored in the BufferedImage's
> > fields
> > > (i.e.
> > > the image stored in it).
> > >
> > >
> > > On Mon, May 13, 2013 at 7:15 PM, smallufo  wrote:
> > >
> > > > Today I encountered one famous deserialization problem :
> > > > InvalidClassException : no valid constructor
> > > >
> > > > I googled and found some solution , but all are in-vain.
> > > > The solution says the first non-serializable super class should
> define
> > a
> > > > no-arg constructor.
> > > >
> > > > But I try to define a no-arg constructor to EACH class of the
> > HIERARCHY ,
> > > > and EACH class implements Serializable... (which is not necessary ,
> > but I
> > > > want to make it simple , to pinpoint the problem)
> > > >
> > > > My base class is an abstract class extends BufferedImage (java 2D)
> > > > while BufferedImage is not Serializable
> > > > So I make my abstract class implements Serializable and define a
> no-arg
> > > > default constructor.
> > > >
> > > > The total hierarchy is :
> > > > public abstract class AbstractChart extends BufferedImage implements
> > > > Serializable {
> > > >   public AbstractChart()  {// I try to remove this
> constructor
> > ,
> > > > but in vain
> > > > super(0 , 0, TYPE_INT_ARGB);
> > > >   }
> > > > }
> > > >
> > > > and first child class :
> > > >
> > > > public class ChildChart extends AbstractChart implements
> Serializable {
> > > >   public ChildChart() {
> > > > super(); // or not calling super()
> > > >   }
> > > > }
> > > >
> > > > and the grandson class :
> > > >
> > > > public class GrandsonChart extends ChildChart implements
> Serializable {
> > > >   public GrandsonChart() {
> > > > super(); // or not calling super()
> > > >   }
> > > > }
> > > >
> > > > No matter I calls super() in ChildChart or GrandsonChart ,
> > > >
> > > > Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no
> > valid
> > > > constructor
> > > >
> > > > It happens when I click a button ,use ajax to paint this
> GrandsonChart
> > ,
> > > > and click another page , and use browser back .
> > > > The browser will be redirected to /context/wicket/page?xxx (The error
> > > page)
> > > > The screen shows :
> > > > Could not deserialize object using:
> > > > class
> > > >
> > > >
> > >
> >
> org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream
> > > >
> > > > and in the console log , I can see this InvalidClassException is
> > thrown.
> > > >
> > > > Any way to solve this problem ?
> > > > (I've already added default no-arg constructor , and make each class
> > > > implements Serializable , but still not working )
> > > >
> > > > environment :
> > > > Wicket version : 6.7
> > > > Resin 4.0.25
> > > > Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple
> > Inc
> > > > (It happens on Linux JDK too)
> > > >
> > >
> >
>


Re: Deserialization InvalidClassException : no valid constructor

2013-05-21 Thread smallufo
Thanks.
But in my example , I cannot modify BufferedImage (to add a no-arg
constructor)
What should I do if I want to output a BufferedImage (and make back button
work) ?



2013/5/14 Jonas 

> This could only work if BufferedImage itself had a no-arg constructor.
> It is it the first non-serializable class in the hierarchy that needs to
> have it,
> not the first serializable one, like in your example.
> Besides, you would still lose all data stored in the BufferedImage's fields
> (i.e.
> the image stored in it).
>
>
> On Mon, May 13, 2013 at 7:15 PM, smallufo  wrote:
>
> > Today I encountered one famous deserialization problem :
> > InvalidClassException : no valid constructor
> >
> > I googled and found some solution , but all are in-vain.
> > The solution says the first non-serializable super class should define a
> > no-arg constructor.
> >
> > But I try to define a no-arg constructor to EACH class of the HIERARCHY ,
> > and EACH class implements Serializable... (which is not necessary , but I
> > want to make it simple , to pinpoint the problem)
> >
> > My base class is an abstract class extends BufferedImage (java 2D)
> > while BufferedImage is not Serializable
> > So I make my abstract class implements Serializable and define a no-arg
> > default constructor.
> >
> > The total hierarchy is :
> > public abstract class AbstractChart extends BufferedImage implements
> > Serializable {
> >   public AbstractChart()  {// I try to remove this constructor ,
> > but in vain
> > super(0 , 0, TYPE_INT_ARGB);
> >   }
> > }
> >
> > and first child class :
> >
> > public class ChildChart extends AbstractChart implements Serializable {
> >   public ChildChart() {
> > super(); // or not calling super()
> >   }
> > }
> >
> > and the grandson class :
> >
> > public class GrandsonChart extends ChildChart implements Serializable {
> >   public GrandsonChart() {
> > super(); // or not calling super()
> >   }
> > }
> >
> > No matter I calls super() in ChildChart or GrandsonChart ,
> >
> > Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no valid
> > constructor
> >
> > It happens when I click a button ,use ajax to paint this GrandsonChart ,
> > and click another page , and use browser back .
> > The browser will be redirected to /context/wicket/page?xxx (The error
> page)
> > The screen shows :
> > Could not deserialize object using:
> > class
> >
> >
> org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream
> >
> > and in the console log , I can see this InvalidClassException is thrown.
> >
> > Any way to solve this problem ?
> > (I've already added default no-arg constructor , and make each class
> > implements Serializable , but still not working )
> >
> > environment :
> > Wicket version : 6.7
> > Resin 4.0.25
> > Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple Inc
> > (It happens on Linux JDK too)
> >
>


Deserialization InvalidClassException : no valid constructor

2013-05-13 Thread smallufo
Today I encountered one famous deserialization problem :
InvalidClassException : no valid constructor

I googled and found some solution , but all are in-vain.
The solution says the first non-serializable super class should define a
no-arg constructor.

But I try to define a no-arg constructor to EACH class of the HIERARCHY ,
and EACH class implements Serializable... (which is not necessary , but I
want to make it simple , to pinpoint the problem)

My base class is an abstract class extends BufferedImage (java 2D)
while BufferedImage is not Serializable
So I make my abstract class implements Serializable and define a no-arg
default constructor.

The total hierarchy is :
public abstract class AbstractChart extends BufferedImage implements
Serializable {
  public AbstractChart()  {// I try to remove this constructor ,
but in vain
super(0 , 0, TYPE_INT_ARGB);
  }
}

and first child class :

public class ChildChart extends AbstractChart implements Serializable {
  public ChildChart() {
super(); // or not calling super()
  }
}

and the grandson class :

public class GrandsonChart extends ChildChart implements Serializable {
  public GrandsonChart() {
super(); // or not calling super()
  }
}

No matter I calls super() in ChildChart or GrandsonChart ,

Caused by: java.io.InvalidClassException: foobar.GrandsonChart; no valid
constructor

It happens when I click a button ,use ajax to paint this GrandsonChart ,
and click another page , and use browser back .
The browser will be redirected to /context/wicket/page?xxx (The error page)
The screen shows :
Could not deserialize object using:
class
org.apache.wicket.serialize.java.JavaSerializer$ClassResolverObjectInputStream

and in the console log , I can see this InvalidClassException is thrown.

Any way to solve this problem ?
(I've already added default no-arg constructor , and make each class
implements Serializable , but still not working )

environment :
Wicket version : 6.7
Resin 4.0.25
Java HotSpot(TM) 64-Bit Server VM 20.4-b02-402, 64, mixed mode, Apple Inc
(It happens on Linux JDK too)


Re: [wicket 6] Create/Register Spring Bean in wicket ?

2013-05-13 Thread smallufo
I solve this problem by introducing another spring's xml inside wicket's
repository, which I didn't want to do this at first.
(I was looking for a programmatic way , but it seems not so easy... )



2013/5/11 smallufo 

>
>
>
> 2013/5/11 Marco Springer 
>
>> Maybe this is too simple but:
>>
>> Did you define this bean in the applicationContext.xml?:
>>   {possible properties}
>>
>>
>
> No this is not what I want.
>
> The whole story is ...
> I have two maven repositories :
>
> One is *business-layer* , which defines whole business objects , service
> layers , and make use of SpringConfig and package scan to build a lot of
> beans .
> Another is *wicket-layer* , which depends on business-layer , and makes
> use of beans scanned in the business-layer and serve the web.
>
> The problem is :
> All the beans are defined ( package scanned ) in the business-layer.
> There is no spring's xml or spring's @Repository class or SpringConfig
> settings in the wicket-layer.
>
> But I have some idea of implementing some interface which depends on
> wicket's library.
> Such as getting absolute url of a DynamicImageReference or a
> PackageResourceReference
>  , which depends on RequestCycle and wicket's components.
>
> I wonder how to programmatically generate such bean and inject to the
> spring ?
>
> class MyApplication extends WebApplication {
>   @SpringBean dao;  // defined in business-layer , and injected
> successfully.
>
>   public init () {
> getComponentInstantiationListeners().add(new
> SpringComponentInjector(this));
> Injector.get().inject(this);
>
> *URLGetter urlGetter = new URLGetterDynImgRefImpl(dao);*
> // How to inject this "urlGetter" to spring ?
>   }
> }
>
> In the above code , how to inject the "urlGetter" object to Spring ? so
> that other wicket WebPage or Panel can use @SpringBean(name="urlGetter") to
> get the object ?
>
> Thanks.
>
>


Re: [wicket 6] Create/Register Spring Bean in wicket ?

2013-05-11 Thread smallufo
2013/5/11 Marco Springer 

> Maybe this is too simple but:
>
> Did you define this bean in the applicationContext.xml?:
>   {possible properties}
>
>

No this is not what I want.

The whole story is ...
I have two maven repositories :

One is *business-layer* , which defines whole business objects , service
layers , and make use of SpringConfig and package scan to build a lot of
beans .
Another is *wicket-layer* , which depends on business-layer , and makes use
of beans scanned in the business-layer and serve the web.

The problem is :
All the beans are defined ( package scanned ) in the business-layer.
There is no spring's xml or spring's @Repository class or SpringConfig
settings in the wicket-layer.

But I have some idea of implementing some interface which depends on
wicket's library.
Such as getting absolute url of a DynamicImageReference or a
PackageResourceReference
 , which depends on RequestCycle and wicket's components.

I wonder how to programmatically generate such bean and inject to the
spring ?

class MyApplication extends WebApplication {
  @SpringBean dao;  // defined in business-layer , and injected
successfully.

  public init () {
getComponentInstantiationListeners().add(new
SpringComponentInjector(this));
Injector.get().inject(this);

*URLGetter urlGetter = new URLGetterDynImgRefImpl(dao);*
// How to inject this "urlGetter" to spring ?
  }
}

In the above code , how to inject the "urlGetter" object to Spring ? so
that other wicket WebPage or Panel can use @SpringBean(name="urlGetter") to
get the object ?

Thanks.


Re: [wicket 6] Create/Register Spring Bean in wicket ?

2013-05-10 Thread smallufo
I try to do this in init() :

ctx.getAutowireCapableBeanFactory().configureBean(obj, "myobj");
or
ctx.getAutowireCapableBeanFactory().applyBeanPostProcessorsAfterInitialization(obj,
"myobj");
or
ctx.getAutowireCapableBeanFactory().applyBeanPostProcessorsBeforeInitialization(obj,
"myobj");

But in a WebPage with a @SpringBean(name="myobj") private IMyObj myobj;
I still get NoSuchBeanDefinitionException error ...



2013/5/11 smallufo 

> Hi
> Is there any code example to create beans and register to spring ?
> I can get ApplicationContext
> by 
> WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
> but there is no setter or register or createBean methods within...
>
> Or use of factory bean ?
> I searched FactoryBean , got the idea behind it . But I still don't know
> how to do it in wicket ?
>
> Thanks.
>
>
> 2013/5/11 Igor Vaynberg 
>
>> see spring's FactoryBean, its an indirect way to create beans.
>>
>> -igor
>>
>> On Fri, May 10, 2013 at 12:33 PM, smallufo  wrote:
>> > Hi , I wonder if it possible to programmatically create / register a
>> spring
>> > bean in wicket?
>> > maybe in Application.init() ...
>> >
>> > Most documents about spring are "making use of existent beans" , and
>> inject
>> > to WebPage or Panel via @SpringBean , and it indeed works well.
>> >
>> > But my interface implementations are depend on wicket-component ,
>> > such as getting absolute URL of a page or a DynamicImageResource
>> >
>> > So these beans should be initialized and register to Spring in init()
>> > (correct me if I am wrong)
>> >
>> > Any way to achieve this ?
>> >
>> > Thanks.
>> >
>> > (I am using wicket 6.7 )
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>


Re: [wicket 6] Create/Register Spring Bean in wicket ?

2013-05-10 Thread smallufo
Hi
Is there any code example to create beans and register to spring ?
I can get ApplicationContext
by 
WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
but there is no setter or register or createBean methods within...

Or use of factory bean ?
I searched FactoryBean , got the idea behind it . But I still don't know
how to do it in wicket ?

Thanks.


2013/5/11 Igor Vaynberg 

> see spring's FactoryBean, its an indirect way to create beans.
>
> -igor
>
> On Fri, May 10, 2013 at 12:33 PM, smallufo  wrote:
> > Hi , I wonder if it possible to programmatically create / register a
> spring
> > bean in wicket?
> > maybe in Application.init() ...
> >
> > Most documents about spring are "making use of existent beans" , and
> inject
> > to WebPage or Panel via @SpringBean , and it indeed works well.
> >
> > But my interface implementations are depend on wicket-component ,
> > such as getting absolute URL of a page or a DynamicImageResource
> >
> > So these beans should be initialized and register to Spring in init()
> > (correct me if I am wrong)
> >
> > Any way to achieve this ?
> >
> > Thanks.
> >
> > (I am using wicket 6.7 )
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


[wicket 6] Create/Register Spring Bean in wicket ?

2013-05-10 Thread smallufo
Hi , I wonder if it possible to programmatically create / register a spring
bean in wicket?
maybe in Application.init() ...

Most documents about spring are "making use of existent beans" , and inject
to WebPage or Panel via @SpringBean , and it indeed works well.

But my interface implementations are depend on wicket-component ,
such as getting absolute URL of a page or a DynamicImageResource

So these beans should be initialized and register to Spring in init()
(correct me if I am wrong)

Any way to achieve this ?

Thanks.

(I am using wicket 6.7 )


[wicket 6] javascript confirmation via onPrecondition failed.

2013-05-07 Thread smallufo
I want to add a warning dialog when user clicks an ajax "deleteLink"
I saw the following solution:

Link deleteLink = new AjaxFallbackLink("deleteLink")
{
  @Override
  public void onClick(AjaxRequestTarget target)
  {
commentService.deleteComment(user, comment, ip);
setResponsePage(CommentsPage.class , pps);
  }

  @Override
  protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
  {
super.updateAjaxAttributes(attributes);

AjaxCallListener ajaxCallListener = new AjaxCallListener();
ajaxCallListener.onPrecondition("return confirm('Are you sure?');");
attributes.getAjaxCallListeners().add(ajaxCallListener);
  }
};
add(deleteLink);

It did popup a warning box , display "Are you sure?"
But no matter user clicks OK or Cancel
The comment get deleted !

What's wrong here ?

Thanks.

(wicket 6.7)


Re: [wicket 6] Modal unable to see page's properties anymore ?

2013-05-07 Thread smallufo
Hi , I found no "IPageReference" class .
If you mean PageReference , I finally found the solution:
http://pastebin.com/bes3H9w3

Though the solution seems not so intuitional compared to wicket 1.4




2013/5/7 Martin Grigorov 

> Hi,
>
> You should not keep references to other page instances.
> Instead pass IPageReference: page.getPageReference().
> Later you can do:
> MyPage page = (MyPage) pageRef.getPage();
> page.setXyz();
>
>
> But in your case I think you should use the Session. If the login is
> successful then bind a session and set the flag. Then redirect to LoginPage
> and in its constructor check whether there is a session, and whether the
> flag is set and  redirect to the post-login page.
>
>
>
> On Tue, May 7, 2013 at 4:03 AM, smallufo  wrote:
>
> > I have a LoginModal which binds a LoginPage .
> >
> > In LoginModal.setWindowClosedCallback() method , I use
> > LoginPage.isSuccessful() to judge if the user login successful.
> > If login successful , I refresh the page , or do nothing.
> >
> > LoginModal code : http://pastebin.com/nLU2akzV
> > LoginPage code : http://pastebin.com/PqfLwsNg
> >
> > It works in wicket 1.4 , but failed in wicket 6
> >
> > In LoginPage , I can see user correctly login , and the "successful =
> true"
> > is set.
> > But LoginModal can only see the old successful value (which is FALSE).
> > No matter I read the property (isSuccessful() ) or through reflection
> > PropertyModel :
> > boolean successful = (new PropertyModel(loginPage,
> "successful")).
> > getObject().booleanValue();
> >
> > It just returns FALSE.
> >
> > I notice it may be page serialization problem introduced in wicket 1.5 .
> > My page has an integer attached , such as /app/?1 , no matter how I
> refresh
> > the page , I just see the LoginPage's isSuccessful is FALSE.
> > But if I manually browse /app/ (no trailing integer) , the user is logged
> > in. (I set something in the httpSession in LoginPage)
> >
> > I searched the maillist , try to override *isVersioned() and return
> false*,
> > but everything is the same
> >
> > How to solve the problem , making LoginModal able to see LoginPage's
> latest
> > property ?
> >
> > Thanks !
> >
>
>
>
> --
> Martin Grigorov
> Wicket Training & Consulting
> http://jWeekend.com <http://jweekend.com/>
>


[wicket 6] Modal unable to see page's properties anymore ?

2013-05-06 Thread smallufo
I have a LoginModal which binds a LoginPage .

In LoginModal.setWindowClosedCallback() method , I use
LoginPage.isSuccessful() to judge if the user login successful.
If login successful , I refresh the page , or do nothing.

LoginModal code : http://pastebin.com/nLU2akzV
LoginPage code : http://pastebin.com/PqfLwsNg

It works in wicket 1.4 , but failed in wicket 6

In LoginPage , I can see user correctly login , and the "successful = true"
is set.
But LoginModal can only see the old successful value (which is FALSE).
No matter I read the property (isSuccessful() ) or through reflection
PropertyModel :
boolean successful = (new PropertyModel(loginPage, "successful")).
getObject().booleanValue();

It just returns FALSE.

I notice it may be page serialization problem introduced in wicket 1.5 .
My page has an integer attached , such as /app/?1 , no matter how I refresh
the page , I just see the LoginPage's isSuccessful is FALSE.
But if I manually browse /app/ (no trailing integer) , the user is logged
in. (I set something in the httpSession in LoginPage)

I searched the maillist , try to override *isVersioned() and return false*,
but everything is the same

How to solve the problem , making LoginModal able to see LoginPage's latest
property ?

Thanks !


Re: [wicket 6] How to get InputStream from ResourceReference ?

2013-05-02 Thread smallufo
2013/5/2 Martin Grigorov 

> PackageResourceStream


Wow , thanks for your rapid response !


[wicket 6] How to get InputStream from ResourceReference ?

2013-05-02 Thread smallufo
In wicket 1.4
I can get InputStream from a ResourceReference :

ResourceReference resRef = new ResourceReference(Page.class , "xxx.png");
InputStream is = resRef.getResource().getResourceStream().getInputStream();

But it seems invalid in wicket 6

I need to build a DynamicImageResource , which returns byte[] in
getImageData()
ResourceReference resRef = new PackageResourceReference(Page.class ,
"xxx.png");
(in fact , the true resRef depends on the attributes parameter)

but I am stuck here.
I find no way to get InputStream of resRef , so I cannot transform
InputStream to byte[].

Any solutions ?

Thanks !


Re: How to get rid of -ver-blah-blah-blah.gif versioning ?

2013-05-01 Thread smallufo
Hi
thanks.
But it doesn't mention how to turn off the -ver-blah-blah-blah string.
I just want a general "xxx.png" , not
"xxx-ver-7E49549BCE322EACE0C8F26B4CD553C5.png"




2013/5/2 Martin Grigorov 

> Hi,
>
> Check https://cwiki.apache.org/WICKET/caching-in-wicket-15.html
>
>
> On Wed, May 1, 2013 at 6:36 PM, smallufo  wrote:
>
> > I am upgrading from 1.4 to 6.7
> > Is the random string appended used for anti-caching or object versioning
> ?
> > I try to redeploy and the appended string is identical !?
> >
> > Now I am stuck by how to get rid of image/resource versioning , and
> enable
> > caching ...
> > I use general Image ,
> > or override shouldAddAntiCacheParameter (return false)
> > But I still cannot get rid of the versioning string...
> >
> > Anyway to disable that ?
> >
> > One more question
> > 
> > How to enable caching and disable versioning string for this img ?
> > (there is no wicket:id assigned)
> >
>
>
>
> --
> Martin Grigorov
> Wicket Training & Consulting
> http://jWeekend.com <http://jweekend.com/>
>


How to get rid of -ver-blah-blah-blah.gif versioning ?

2013-05-01 Thread smallufo
I am upgrading from 1.4 to 6.7
Is the random string appended used for anti-caching or object versioning ?
I try to redeploy and the appended string is identical !?

Now I am stuck by how to get rid of image/resource versioning , and enable
caching ...
I use general Image ,
or override shouldAddAntiCacheParameter (return false)
But I still cannot get rid of the versioning string...

Anyway to disable that ?

One more question

How to enable caching and disable versioning string for this img ?
(there is no wicket:id assigned)


Re: [6.7] How to set header of DynamicImageResource ?

2013-04-24 Thread smallufo
Hi
I just take "Cache-Control":"no-cache" for example.
What if I want to add additional header information, which is correct ?

data.getHeaders().addHeader("key", "value");  ?
or
((WebResponse) attributes.getResponse()).addHeader("key" , "value"); ?

Thanks.


[6.7] How to set header of DynamicImageResource ?

2013-04-24 Thread smallufo
Hi :
I wonder how to set header of DynamicImageResource ?
In 1.4 , it just override setHeaders(WebResponse response)
{
  response.setHeader("Cache-Control" , "no-cache");
}

But , how to do this in 6.7 ?

If I override setResponseHeaders(ResourceResponse data , Attributes
attributes) ,
It seems there are two ways to setHeader :

data.getHeaders().addHeader("Cache-Control", "no-cache");
and
((WebResponse) attributes.getResponse()).addHeader("Cache-Control" ,
"no-cache");

Which is correct ?

And...
in 1.4 , there is an "isCacheable()" method , where is it in 6.7 ?

Thanks .


Re: changes behavior from 1.4.15 to 1.4.19 ?

2012-02-12 Thread smallufo
sorry for disturbance

after adding the 2 lines in Application , it's solved.

getResourceSettings().setParentFolderPlaceholder("$up$");
  getResourceSettings().addResourceFolder(getServletContext().getContextPath
());


2012/2/12 smallufo 

> 
> 
>
> This code works fine in wicket 1.4.15 , and will generate a url like this :
>
>
> http://foobar.com/app/resources/foobar.login.LoginPanel/null/icons/facebookLogin_300_35.png
>
> The "null" in URL seems represents ".." in the resource path.
>
> But when I upgrade to 1.4.19 , the URL becomes :
>
> http://foobar.com/app/resources/icons/facebookLogin_300_35.png
>
>
> It is broken !!!
>
> Why ? And ... how to fix it ? (without hardcode the path in java code)
>
>
>


changes behavior from 1.4.15 to 1.4.19 ?

2012-02-11 Thread smallufo



This code works fine in wicket 1.4.15 , and will generate a url like this :

http://foobar.com/app/resources/foobar.login.LoginPanel/null/icons/facebookLogin_300_35.png

The "null" in URL seems represents ".." in the resource path.

But when I upgrade to 1.4.19 , the URL becomes :

http://foobar.com/app/resources/icons/facebookLogin_300_35.png


It is broken !!!

Why ? And ... how to fix it ? (without hardcode the path in java code)


ResourceReference.getResource() returns NULL ?

2011-02-22 Thread smallufo
I want to build a DynamicImageResource which can scale internal (packaged)
images (with name : {index}.gif ) .
In getImageData() , I try to load a truly existing image , but cannot
getResource() , it returns null !

Here is my code :

public class ScaledImageResource extends DynamicImageResource
{
  private ThreadLocal index = new ThreadLocal();
  private ThreadLocal width = new ThreadLocal();
  private ThreadLocal height = new ThreadLocal();

  @Override
  public IResourceStream getResourceStream()
  {
ValueMap map = getParameters();
index .set(map.getAsInteger("index" ,  1));
width .set(map.getAsInteger("width" , 50));
height.set(map.getAsInteger("height", 50));
return super.getResourceStream();
  }

  @Override
  protected byte[] getImageData()
  {
ResourceReference imageResource = new ResourceReference(MyPage.class ,
"icons/byIndex/"+index.get()+".gif");
http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gif does
exist !

try
{
  System.out.println("imageResource.getResource() = " +
imageResource.getResource()); // returns NULL
  InputStream is =
imageResource.getResource().getResourceStream().getInputStream();
  BufferedImage bufferedImage = ImageIO.read(is);
  BufferedImage scaledImage = BufferedImageTools.getImage(bufferedImage,
width.get() , height.get());

  byte[] bytes = null;
  //scale image , build bytes  , skipped here.
  return bytes;
}
catch (Exception e)
{
}
return null;
  }
}

And in Application's init():
getSharedResources().add(IMG_KEY, new ScaledImageResource());
mountSharedResource("/scaledImage", new
ResourceReference(IMG_KEY).getSharedResourceKey());

Note , the image file does exist there ,
and http://foobar.com/app/resources/foo.bar.MyPage/icons/byIndex/1.gif does
browsable !

But why cannot I getResource() of the imageResource ?


Re: How to programmatically get PlatformTransactionManager of a DAO ?

2010-12-18 Thread smallufo
Thanks.
but declarative txManagement add a lot of complexity to XMLs
Is there any other option ?


2010/12/19 James Carman 

> declarative transaction management


How to programmatically get PlatformTransactionManager of a DAO ?

2010-12-18 Thread smallufo
I am developing a generic CRUD app , that can edit any Spring/JPA entities
with a AbstractDao pattern's implementation , such as UserDaoImpl ,
ForumDaoImpl ...etc

In my wicket page : I have to use @SpringBean to identify which
PlatformTransactionManager to use , such as :

@SpringBean(name="transactionManagerUser")
private PlatformTransactionManager transactionManagerUser;
private TransactionTemplate txTemplate;

public CrudPage(final PageParameters pps , final AbstractDao dao)
{

  super(pps);

  txTemplate= new TransactionTemplate(transactionManagerUser);
}

 The problem is , these DAOs are using different transaction managers , such
astransactionManagerUser , transactionManagerForum ...etc.

I cannot hard-code these txManager's name in my code. I have to
programmatically get the dao's txManager . How to achieve that ?

Thanks a lot !

Environments : Spring 3.0.5 , Hibernate-3.6 , JPA2


Re: How to I get an un-proxied Spring Bean ?

2010-12-14 Thread smallufo
Hi ,
I tried :
dao.getClass() = class org.apache.wicket.proxy.$Proxy101
dao.getClass().getGenericSuperclass() = class java.lang.reflect.Proxy
dao.getClass().getSuperclass() = class java.lang.reflect.Proxy

But still unable to get the dao class

2010/12/14 Pedro Santos 

> proxyClass.getSuperclass() gives you the dao type
>
>


How to I get an un-proxied Spring Bean ?

2010-12-14 Thread smallufo
I have a page with such definition :

public class CrudPage extends WebPage
{
  public CrudPage(PageParameters pps , AbstractDao dao)
  {...}
}

and here is how I initialize the page :
CrudPage page = new CrudPage(pps , userDao);

the userDao is a Spring injected DAO :
@SpringBean private UserDao userDao;

And in fact , UserDao extends Abstract Dao Pattern :
public interface UserDao extends AbstractDao {...}

Here comes the problem :
I want to know which type is passed to CrudPage , I use the code :

ParameterizedType genericSuperclass = (ParameterizedType)
dao.getClass().getGenericSuperclass();
this.clazz = (Class) genericSuperclass.getActualTypeArguments()[0];

But it throws exception :
java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType

I then print the type :
System.out.println("dao.getClass() = " + dao.getClass());
System.out.println("dao.getClass().getGenericSuperclass() = " +
dao.getClass().getGenericSuperclass());

and found the dao is proxied :
dao.getClass() = class org.apache.wicket.proxy.$Proxy101
dao.getClass().getGenericSuperclass() = class java.lang.reflect.Proxy

Maybe that's why I cannot get the type ...

And ... how to solve the problem ?

Thanks a lot !


Re: implicit key in PageParameter ?

2010-12-01 Thread smallufo
Hi
I found the solution , it is MixedParamUrlCodingStrategy
Thanks.

2010/12/1 smallufo 

> Hi , thanks .
> But it seems that IndexedParamUrlCodingStrategy only accepts integer
> parameters.
> I need String value ...
>
>
> 2010/12/1 Martin Grigorov 
>
> See Indexed** UrlCodingStrategies
>>
>> On Wed, Dec 1, 2010 at 11:52 AM, smallufo  wrote:
>>
>> > Hi , I wonder how to build an implicit key when a Page is
>> > mountBookmarkablePage() ?
>> >
>> > Suppose I have a TagPage , that accepts a parameter : "name"  , and if
>> the
>> > TagPage is mounted to "/tag" prefix
>> > The url will look like :
>> > http://foobar.com/app/tag/name/abc
>> >
>> > I feel the "name" is redundant
>> >
>> > I hope I can achieve shorter url like this :
>> > http://foobar.com/app/tag/abc
>> > http://foobar.com/app/tag/other
>> >
>> > Is is possible ?
>> >
>>
>
>


Re: implicit key in PageParameter ?

2010-12-01 Thread smallufo
Hi , thanks .
But it seems that IndexedParamUrlCodingStrategy only accepts integer
parameters.
I need String value ...


2010/12/1 Martin Grigorov 

> See Indexed** UrlCodingStrategies
>
> On Wed, Dec 1, 2010 at 11:52 AM, smallufo  wrote:
>
> > Hi , I wonder how to build an implicit key when a Page is
> > mountBookmarkablePage() ?
> >
> > Suppose I have a TagPage , that accepts a parameter : "name"  , and if
> the
> > TagPage is mounted to "/tag" prefix
> > The url will look like :
> > http://foobar.com/app/tag/name/abc
> >
> > I feel the "name" is redundant
> >
> > I hope I can achieve shorter url like this :
> > http://foobar.com/app/tag/abc
> > http://foobar.com/app/tag/other
> >
> > Is is possible ?
> >
>


implicit key in PageParameter ?

2010-12-01 Thread smallufo
Hi , I wonder how to build an implicit key when a Page is
mountBookmarkablePage() ?

Suppose I have a TagPage , that accepts a parameter : "name"  , and if the
TagPage is mounted to "/tag" prefix
The url will look like :
http://foobar.com/app/tag/name/abc

I feel the "name" is redundant

I hope I can achieve shorter url like this :
http://foobar.com/app/tag/abc
http://foobar.com/app/tag/other

Is is possible ?


AjaxLink overridden by SimpleAttributeModifier("onclick")

2010-11-23 Thread smallufo
If I want to add a simple 'onclick warning' to an AjaxLink , the ajax's
behavior will be overridden by :

ajaxLink.add( new SimpleAttributeModifier("onclick", "return confirm('sure
?');"));

How to avoid this ?


Re: Use AjaxButton without attaching to a form ?

2010-11-21 Thread smallufo
Hi , thanks.
Ajax Link works , but I want it to be displayed as a button.



2010/11/21 Ernesto Reinaldo Barreiro 

> Why not simply use an AJAX link?
>
> Ernesto
>
> On Sun, Nov 21, 2010 at 7:43 AM, smallufo  wrote:
> > Hi , I wonder if it possible to use AjaxButton without attaching to a
> form ?
> >
> > Sometimes , I just want a simple show/hide ajax effect in onSubmit() ,
> and
> > there is no need to build another form and add the ajaxButton into it.
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Use AjaxButton without attaching to a form ?

2010-11-20 Thread smallufo
Hi , I wonder if it possible to use AjaxButton without attaching to a form ?

Sometimes , I just want a simple show/hide ajax effect in onSubmit() , and
there is no need to build another form and add the ajaxButton into it.


Is it possible to disable feeding cookies in resources ?

2010-11-18 Thread smallufo
Most resource files don't need cookies .
I wonder if it possible to disable feeding cookies when serving resources ?
It will make request size smaller.


Re: NPE when the underlaying model changed and ajax re-appear.

2010-11-14 Thread smallufo
Hi Igor :

Please re-verify WICKET-3162
(and run the quickstart)

It's not solved.


2010/11/12 Igor Vaynberg 

> jira+quickstart
>
> -igor
>
> On Thu, Nov 11, 2010 at 5:48 PM, smallufo  wrote:
> > Hi , thanks
> > I tried , but NPE is still thrown , with the same stacktrace...
> > Is there anything I missed ?
> >
> > Here is my border's HTML :
> >
> > 
> >  
> > 
> >
> > border's java code :
> >
> >content = new WebMarkupContainer("content");
> >
> >content.setOutputMarkupPlaceholderTag(true);
> >content.setVisible(defaultExpanded);
> >content.setRenderBodyOnly(false);
> >add(content);
> >content.add(getBodyContainer());
> >
> > and the ajax link's onClick() :
> >
> > Link collapseExpandLink = new
> > AjaxFallbackLink("collapseExpandLink")
> > {
> >  @Override
> >  public void onClick(AjaxRequestTarget target)
> >  {
> >expanded=!expanded;
> >content.setVisible(expanded);
> >target.addComponent(content);
> >  }
> > };
> > add(collapseExpandLink);
> >
> >
> >
> >
> > 2010/11/12 Igor Vaynberg 
> >
> >>
> s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/
> >>
> >> On Thu, Nov 11, 2010 at 1:42 PM, smallufo  wrote:
> >> > Hi , I have a simple panel , with a border and a listView :
> >> >
> >> > 
> >> >  
> >> >
> >> >  //comment layout
> >> >
> >> >  
> >> > 
> >> >
> >> > And the code :
> >> >
> >> > add(border);
> >> > ListView commentsView = new ListView("commentsView"
> ,
> >> new
> >> > LoadableDetachableModel>()
> >> > {
> >> >  @Override
> >> >  protected List load() {
> >> >return commentDao.getComments(0 , 10);
> >> >  }
> >> > })
> >> > {
> >> >  @Override
> >> >  protected void populateItem(ListItem item) {
> >> >//comment layout
> >> >  }
> >> > };
> >> > border.add(commentsView);
> >> > commentsView.setReuseItems(false);
> >> >
> >> > The Panel has a border , with a clickable button , can be used to
> >> > collapse/expand the content of the border with AJAX.
> >> > Here is my steps :
> >> >
> >> > 1. I first collapse the panel .
> >> > 2. Then open another browser panel , add a comment. (the underlaying
> data
> >> > model is changed)
> >> > 3. Back to the original panel , expand the panel ...
> >> >
> >> > And I got a NPE :
> >> >
> >> > 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in
> >> rendering
> >> > component: [MarkupContainer [Component id = _body]]
> >> > org.apache.wicket.WicketRuntimeException: Exception in rendering
> >> component:
> >> > [MarkupContainer [Component id = _body]]
> >> >at
> >> org.apache.wicket.Component.renderComponent(Component.java:2725)
> >> >at
> >> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >> >at org.apache.wicket.Component.render(Component.java:2517)
> >> >at
> >> >
> org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
> >> >at
> >> >
> >>
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
> >> >at
> >> >
> >>
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
> >> >at
> >> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >> >at
> >> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >> >
> >> > ...
> >> >
> >> > Caused by: java.lang.NullPointerException
> >> >at
> >> >
> >>
> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
> >> >at
> >> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >> >... 45 more
> >> >
> >> > Can anybody tell me where goes wrong ? Thanks.
> >> > Wicket 1.4.13
> >> >
> >>
> >> -
> >> 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: NPE when the underlaying model changed and ajax re-appear.

2010-11-11 Thread smallufo
Hi , thanks
I tried , but NPE is still thrown , with the same stacktrace...
Is there anything I missed ?

Here is my border's HTML :


  


border's java code :

content = new WebMarkupContainer("content");

content.setOutputMarkupPlaceholderTag(true);
content.setVisible(defaultExpanded);
content.setRenderBodyOnly(false);
add(content);
content.add(getBodyContainer());

and the ajax link's onClick() :

Link collapseExpandLink = new
AjaxFallbackLink("collapseExpandLink")
{
  @Override
  public void onClick(AjaxRequestTarget target)
  {
expanded=!expanded;
content.setVisible(expanded);
target.addComponent(content);
  }
};
add(collapseExpandLink);




2010/11/12 Igor Vaynberg 

> s/border.add(commentsView);/border.getbodycontainer().add(commentsView);/
>
> On Thu, Nov 11, 2010 at 1:42 PM, smallufo  wrote:
> > Hi , I have a simple panel , with a border and a listView :
> >
> > 
> >  
> >
> >  //comment layout
> >
> >  
> > 
> >
> > And the code :
> >
> > add(border);
> > ListView commentsView = new ListView("commentsView" ,
> new
> > LoadableDetachableModel>()
> > {
> >  @Override
> >  protected List load() {
> >return commentDao.getComments(0 , 10);
> >  }
> > })
> > {
> >  @Override
> >  protected void populateItem(ListItem item) {
> >//comment layout
> >  }
> > };
> > border.add(commentsView);
> > commentsView.setReuseItems(false);
> >
> > The Panel has a border , with a clickable button , can be used to
> > collapse/expand the content of the border with AJAX.
> > Here is my steps :
> >
> > 1. I first collapse the panel .
> > 2. Then open another browser panel , add a comment. (the underlaying data
> > model is changed)
> > 3. Back to the original panel , expand the panel ...
> >
> > And I got a NPE :
> >
> > 2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in
> rendering
> > component: [MarkupContainer [Component id = _body]]
> > org.apache.wicket.WicketRuntimeException: Exception in rendering
> component:
> > [MarkupContainer [Component id = _body]]
> >at
> org.apache.wicket.Component.renderComponent(Component.java:2725)
> >at
> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >at org.apache.wicket.Component.render(Component.java:2517)
> >at
> > org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
> >at
> >
> org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
> >at
> >
> org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
> >at
> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >at
> > org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
> >
> > ...
> >
> > Caused by: java.lang.NullPointerException
> >at
> >
> org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
> >at
> org.apache.wicket.Component.renderComponent(Component.java:2686)
> >... 45 more
> >
> > Can anybody tell me where goes wrong ? Thanks.
> > Wicket 1.4.13
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


NPE when the underlaying model changed and ajax re-appear.

2010-11-11 Thread smallufo
Hi , I have a simple panel , with a border and a listView :


  

  //comment layout

  


And the code :

add(border);
ListView commentsView = new ListView("commentsView" , new
LoadableDetachableModel>()
{
  @Override
  protected List load() {
return commentDao.getComments(0 , 10);
  }
})
{
  @Override
  protected void populateItem(ListItem item) {
//comment layout
  }
};
border.add(commentsView);
commentsView.setReuseItems(false);

The Panel has a border , with a clickable button , can be used to
collapse/expand the content of the border with AJAX.
Here is my steps :

1. I first collapse the panel .
2. Then open another browser panel , add a comment. (the underlaying data
model is changed)
3. Back to the original panel , expand the panel ...

And I got a NPE :

2010-11-12 05:19:12,661 ERROR wicket.RequestCycle - Exception in rendering
component: [MarkupContainer [Component id = _body]]
org.apache.wicket.WicketRuntimeException: Exception in rendering component:
[MarkupContainer [Component id = _body]]
at org.apache.wicket.Component.renderComponent(Component.java:2725)
at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)
at org.apache.wicket.Component.render(Component.java:2517)
at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1440)
at
org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1603)
at
org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1527)
at org.apache.wicket.Component.renderComponent(Component.java:2686)
at
org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1538)

...

Caused by: java.lang.NullPointerException
at
org.apache.wicket.markup.html.border.Border$BorderBodyContainer.onComponentTagBody(Border.java:375)
at org.apache.wicket.Component.renderComponent(Component.java:2686)
... 45 more

Can anybody tell me where goes wrong ? Thanks.
Wicket 1.4.13


How to get other page's localized messages ?

2010-11-03 Thread smallufo
If I have two WebPages :
Page1.java
Page1.properties , which stores default value
Page1_zh.properties , which stores Chinese translations

And Page2.java

How do I get Page1's specific localized message in Page2 ?

I noticed the StringResourceModel , but it seems not what I want.
StringResourceModel's constructor must pass a Component object , but I
cannot new Page1 in Page2

Is there anything like :
SomeModel("key" , Page1.class) , so that I can get "key" bound to Page1 ?

Thanks.


Is it a good practice to use intern() in all ids ?

2010-09-25 Thread smallufo
I am using a profiler to analyze an OOM heap-dump file , and find tons of
duplicated Strings .
These strings are mostly IDs of wicket components or PropertyModel's
expression ...
I wonder if it a good practice to "intern()" all these Strings ?

such as :

private final static String TIME_STR = "time".intern();
add(new Label(TIME_STR , foobar));


Re: [1.4.9] Ajax displayed label not compatible with IE6/7/8 if the label contains tag !

2010-07-25 Thread smallufo
I have created a JIRA issue with quickstart file here :
https://issues.apache.org/jira/browse/WICKET-2965
<https://issues.apache.org/jira/browse/WICKET-2965>

2010/7/26 smallufo 

> HTML
> 
> 
> 
> 
>
> Java Code :
> public class MainPage extends WebPage {
>   private MultiLineLabel failLabel = new MultiLineLabel("failLabel");
>
>   public MainPage()   {
> failLabel.setVisible(false);
> failLabel.setOutputMarkupPlaceholderTag(true);
>
> Form form = new Form("form");
> add(form);
> form.add(failLabel);
>
> AjaxButton failButton = new AjaxButton("failButton") {
>   @Override
>   protected void onSubmit(AjaxRequestTarget target, Form form)
>  {
> failLabel.setDefaultModel(new PropertyModel(MainPage.this ,
> "failResult"));
> failLabel.setEscapeModelStrings(false);
> failLabel.setVisible(true);
> target.addComponent(failLabel);
>   }
> };
> form.add(failButton);
>   }
>
>   /**
>* Success in Firefox/Chrome , but fail in IE 6/8 (I don't have IE7)
>*/
>   public String getFailResult()  {
> return "R";
>   }
> }
>
> In the code above , if I take away "" and "" in getFailResult()
> , it works like a charm!
> I think it is a bug...
>


[1.4.9] Ajax displayed label not compatible with IE6/7/8 if the label contains tag !

2010-07-25 Thread smallufo
If a label is default invisible and is setVisible(true) in an
AjaxButton.onSubmit() , and if that label containing xxx string,
it will fail to render in IE 6/8 .
IE6/8 report wicket-ajax.js has something wrong ...

I don't have IE7 , but I think the result is the same :


HTML





Java Code :
public class MainPage extends WebPage {
  private MultiLineLabel failLabel = new MultiLineLabel("failLabel");

  public MainPage()   {
failLabel.setVisible(false);
failLabel.setOutputMarkupPlaceholderTag(true);

Form form = new Form("form");
add(form);
form.add(failLabel);

AjaxButton failButton = new AjaxButton("failButton") {
  @Override
  protected void onSubmit(AjaxRequestTarget target, Form form)
 {
failLabel.setDefaultModel(new PropertyModel(MainPage.this ,
"failResult"));
failLabel.setEscapeModelStrings(false);
failLabel.setVisible(true);
target.addComponent(failLabel);
  }
};
form.add(failButton);
  }

  /**
   * Success in Firefox/Chrome , but fail in IE 6/8 (I don't have IE7)
   */
  public String getFailResult()  {
return "R";
  }
}

In the code above , if I take away "" and "" in getFailResult() ,
it works like a charm!
I think it is a bug...


[wicketstuff-push] NPE when CometdService.initBayeux()

2010-07-21 Thread smallufo
Hi , I am trying Wicketstuff-push with a small chat program , but encounter
this problem :

org.apache.wicket.WicketRuntimeException: Method onFormSubmitted of
interface org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
component [MarkupContainer [Component id = sayForm]] 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:479)
at
org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:160)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:158)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:96)
at
com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)
at
destiny.webapp.filters.FilterUserAgent.doFilter(FilterUserAgent.java:29)
at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88)
at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88)
at
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88)
at
org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:88)
at
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183)
at
com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:103)
at
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:789)
at
com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:660)
at
com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:624)
at
com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:575)
at
com.caucho.network.listen.TcpSocketLink$AcceptTask.doTask(TcpSocketLink.java:1183)
at
com.caucho.network.listen.TcpSocketLink$ConnectionReadTask.runThread(TcpSocketLink.java:1118)
at
com.caucho.network.listen.TcpSocketLink$AcceptTask.run(TcpSocketLink.java:1150)
at
com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:901)
at com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:866)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:182)
... 34 more
Caused by: java.lang.NullPointerException
at
org.wicketstuff.push.cometd.CometdService.initBayeux(CometdService.java:184)
at
org.wicketstuff.push.cometd.CometdService.getBayeux(CometdService.java:161)
at
org.wicketstuff.push.cometd.CometdService.publish(CometdService.java:155)
at
destiny.wicket.chatroom.ChatPanel$SayForm.onSubmit(ChatPanel.java:603)
at
org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1538)
at org.apache.wicket.markup.html.form.Form.process(Form.java:934)
at
org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:896)
... 39 more

After tracing some code , it seems _bayeux cannot be initialized in
 CometdService.initBayeux() ,
and that's because it cannot find an attribute "org.cometd.bayeux" in
ServletContext.
But I didn't find any code that setAttribute("org.cometd.bayeux" ,
something) 

Re: Inject Dao ( with JPA impl) into Wicket without Spring ?

2010-03-23 Thread smallufo
2010/3/24 smallufo 

> Thank you , I tried it , and it can successfully
> inject EntityManagerFactory into a WebPage ,
> But it seems unable to inject EntityManager , is it because of some
> thread-safe limitation here ?
>
>
Sorry , I meant wicket-contrib-javaee here.



>  2010/3/23 Major Péter 
>
>> I think yes, Wicket is already depending on cglib, so you could create
>>
>> something like this:
>>
>> http://fisheye6.atlassian.com/browse/wicket/branches/wicket-1.4.x/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java?r=HEAD
>> or for non-spring code check out the wicketstuff javaee-inject project.
>>
>> Best Regards,
>> Peter
>>
>


Re: Inject Dao ( with JPA impl) into Wicket without Spring ?

2010-03-23 Thread smallufo
Thank you , I tried it , and it can successfully inject EntityManagerFactory
into a WebPage ,
But it seems unable to inject EntityManager , is it because of some
thread-safe limitation here ?

2010/3/23 Major Péter 

> I think yes, Wicket is already depending on cglib, so you could create
> something like this:
>
> http://fisheye6.atlassian.com/browse/wicket/branches/wicket-1.4.x/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java?r=HEAD
> or for non-spring code check out the wicketstuff javaee-inject project.
>
> Best Regards,
> Peter
>


Re: Inject Dao ( with JPA impl) into Wicket without Spring ?

2010-03-23 Thread smallufo
I am just curious :
I am trying  Resin 4.0.4 , which natively supports JSR 330's
@javax.inject.Inject .
And I am able to inject the Dao to one Servlet without any problem :

public class HelloServlet extends HttpServlet {
  @Inject
  private PersonDao personDao; // it will automatically create PersonDaoImpl
(and inject PersistenceContext ) and inject to here.
...
}

Since WicketServlet is essentially a HttpServlet , there should be a way to
intercept the injection when in a JSR-330-enabled container (like Resin 4 ,
JBoss , Glassfish v3)  ... But I don't know how ...
I think it will greatly reduce the webapp size (and memory footprint ,
probably) without spring.



2010/3/23 Major Péter 

> I think yes, Wicket is already depending on cglib, so you could create
> something like this:
>
> http://fisheye6.atlassian.com/browse/wicket/branches/wicket-1.4.x/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java?r=HEAD
> or for non-spring code check out the wicketstuff javaee-inject project.
>
> Best Regards,
> Peter
>
> 2010-03-23 16:52 keltezéssel, smallufo írta:
> > Is it possible to 'not' introduce any 3rd library / annotation to enable
> > this feature ?
> > Will a custom IComponentInstantiationListener be able to do this ?
> >
> >
> > 2010/3/23 Igor Vaynberg 
> >
> >> something has to do the injection, if not spring you can try
> >> salve.googlecode.com or aspectj, etc
> >>
> >> -igor
> >>
> >> On Tue, Mar 23, 2010 at 8:20 AM, smallufo  wrote:
> >>> Hi
> >>> Is there any way to inject a DAO into Wicket without Spring ?
> >>> ex :
> >>>
> >>> public interface PersonDao { some methods... }
> >>>
> >>> public class PersonDaoImpl implements PersonDao , Serializable {
> >>>  @PersistenceContext(unitName = "data", type =
> >>> PersistenceContextType.TRANSACTION)
> >>>  EntityManager entityManager;
> >>>
> >>>  .. other method implementations ...
> >>> }
> >>>
> >>> public class CurrentPage extends WebPage {
> >>>  @javax.inject.Inject PersonDao personDao;
> >>> }
> >>>
> >>> It's not working , anybody know how to achieve this ?
> >>>
> >>> server :
> >>> Resin 4.0.4
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Inject Dao ( with JPA impl) into Wicket without Spring ?

2010-03-23 Thread smallufo
Is it possible to 'not' introduce any 3rd library / annotation to enable
this feature ?
Will a custom IComponentInstantiationListener be able to do this ?


2010/3/23 Igor Vaynberg 

> something has to do the injection, if not spring you can try
> salve.googlecode.com or aspectj, etc
>
> -igor
>
> On Tue, Mar 23, 2010 at 8:20 AM, smallufo  wrote:
> > Hi
> > Is there any way to inject a DAO into Wicket without Spring ?
> > ex :
> >
> > public interface PersonDao { some methods... }
> >
> > public class PersonDaoImpl implements PersonDao , Serializable {
> >  @PersistenceContext(unitName = "data", type =
> > PersistenceContextType.TRANSACTION)
> >  EntityManager entityManager;
> >
> >  .. other method implementations ...
> > }
> >
> > public class CurrentPage extends WebPage {
> >  @javax.inject.Inject PersonDao personDao;
> > }
> >
> > It's not working , anybody know how to achieve this ?
> >
> > server :
> > Resin 4.0.4
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Inject Dao ( with JPA impl) into Wicket without Spring ?

2010-03-23 Thread smallufo
Hi
Is there any way to inject a DAO into Wicket without Spring ?
ex :

public interface PersonDao { some methods... }

public class PersonDaoImpl implements PersonDao , Serializable {
  @PersistenceContext(unitName = "data", type =
PersistenceContextType.TRANSACTION)
  EntityManager entityManager;

  .. other method implementations ...
}

public class CurrentPage extends WebPage {
  @javax.inject.Inject PersonDao personDao;
}

It's not working , anybody know how to achieve this ?

server :
Resin 4.0.4


[1.4.6] NotSerializableException: java.nio.HeapCharBuffer

2010-02-18 Thread smallufo
Hi
I found a lot of NotSerializableException: java.nio.HeapCharBuffer when I
try Wicket 1.4.6 + Resin 4.0.3
I've never seen this exception , is it the problem from Wicket ?

Stacktrace :

java.io.NotSerializableException: java.nio.HeapCharBuffer
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.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.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.defaultWriteObject(ObjectOutputStream.java:416)
at org.apache.wicket.Component.writeObject(Component.java:4439)
at sun.reflect.GeneratedMethodAccessor5608.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
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

Re: [1.4.6] inconsistent setResponsePage behavior in AjaxButton , with 1.4.5

2010-02-09 Thread smallufo
I've submitted it to JIRA
https://issues.apache.org/jira/browse/WICKET-2735
<https://issues.apache.org/jira/browse/WICKET-2735>

2010/2/10 smallufo 

> Suppose inside a BookmarkablePage which is mounted to "CurrentPage" ,
> there is an AjaxButton , when clicked , it will
> setResponsePage(CurrentPage.class , pps)
>
> If a user is browsing http://foo.bar/app/CurrentPage/key/value , and
> submit the AjaxButton ,
> In 1.4.5 , he will be redirect to http://foo.bar/app/CurrentPage/key/value
> , it is correct
> But in 1.4.6 , he will be redirect to 
> http://foo.bar/app/CurrentPage/key/CurrentPage/key/value
> , it is WRONG
>
> I think it is related to wicket2312 patch.
>


[1.4.6] inconsistent setResponsePage behavior in AjaxButton , with 1.4.5

2010-02-09 Thread smallufo
Suppose inside a BookmarkablePage which is mounted to "CurrentPage" ,
there is an AjaxButton , when clicked , it will
setResponsePage(CurrentPage.class , pps)

If a user is browsing http://foo.bar/app/CurrentPage/key/value , and submit
the AjaxButton ,
In 1.4.5 , he will be redirect to http://foo.bar/app/CurrentPage/key/value
, it is correct
But in 1.4.6 , he will be redirect to
http://foo.bar/app/CurrentPage/key/CurrentPage/key/value
, it is WRONG

I think it is related to wicket2312 patch.


Re: [1.4.6] WicketURLDecoder - No current Application found - defaulting encoding to UTF-8

2010-02-05 Thread smallufo
2010/2/5 Igor Vaynberg 

> disable it in your logging configuration
>
> -igor
>
>
I tried a lot of configurations , but http.WicketURLDecoder's warning still
pops up...

log4j.rootLogger=INFO, console

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %-5p %C{2} - %m%n

Then , I tried the following three configurations , but are all invalid ,
WicketURLDecoder's warning still pops up :
log4j.logger.org.apache.wicket.protocol.http.WicketURLDecoder=OFF
log4j.org.apache.wicket.protocol.http.WicketURLDecoder=OFF
log4j.logger.org.apache.wicket.protocol.http.WicketURLDecoder=ERROR ,
console


[1.4.6] WicketURLDecoder - No current Application found - defaulting encoding to UTF-8

2010-02-04 Thread smallufo
After upgrading to 1.4.6 , it always pops up this warning :

WARN  http.WicketURLDecoder - No current Application found - defaulting
encoding to UTF-8

It is ok in 1.4.5 , but I don't know why it has such warning in 1.4.6 .
How to get rid of it ?

Thanks ...


Re: Cannot get default invisible TextField's ModelObject ?

2010-01-21 Thread smallufo
I think it is a bug , and already submitted to JIRA
https://issues.apache.org/jira/browse/WICKET-2694
<https://issues.apache.org/jira/browse/WICKET-2694>

2010/1/21 Chuck Brinkman 

> I looked some more and found the following:
>
> When it works, with my modification, FormComponent.getInputAsArray tries to
> get parameters for the TextField named "more:moreForm:textfield".  I looked
> in the parameter map or the RequestFacade object and found these:
> wicket:interface, wicket:ignoreIfNotActive, random,
> more:moreForm:textfield,
> radioGroup and more:moreForm:submit.  And it finds the TextField.
>
> The version that fails is looking for TextField named "more:textfield".
>  The
> RequestFacade object has: wicket:interface, wicket:ignoreIfNotActive,
> random, forma_hf_0, radioGroup and more:submit.  Is there a problem with
> "forma_hf_0?
>
>
>
> On Thu, Jan 21, 2010 at 7:35 AM, smallufo  wrote:
>
> > Yes , indeed , if the form is in the second row (default invisible) , it
> > works , But I cannot get the first row's data (such as radioGroup's model
> > object will become null ).
> > Moreover ,  Form with multiple row , with something visible and something
> > extensible (default invisible), it is not so rare.
> > If the form is not inside a ListView , it will work.
> > But it just fails if it is inside a  ListView.
>


Re: Cannot get default invisible TextField's ModelObject ?

2010-01-21 Thread smallufo
Yes , indeed , if the form is in the second row (default invisible) , it
works , But I cannot get the first row's data (such as radioGroup's model
object will become null ).
Moreover ,  Form with multiple row , with something visible and something
extensible (default invisible), it is not so rare.
If the form is not inside a ListView , it will work.
But it just fails if it is inside a  ListView.

2010/1/21 Chuck Brinkman 

> I stepped through the code and found that the convertedInput is null when
> processing submit.  I didn't see anything that looked like an error message
> from wicket.I look forward to seeing what the wicket developers have to
> say.
>
> I'm just a new wicket user but was interested in this issue.  I also found
> that if you make the following changes it will work.
>
>
> **
> wicket:id="textfield" />
> wicket:id="submit" />
>* *
>
>
>
>
>*Form moreForm = new Form("moreForm");
>more.add(moreForm);*
> final TextField textfield = new TextField(
>"textfield", new Model());
> *moreForm*.add(textfield);
> AjaxButton button = new AjaxButton("submit") {
>@Override
>protected void onSubmit(AjaxRequestTarget arg0, Form
> form) {
>System.out.println("radioGroup = "
>+ radioGroup.getModelObject()
>+ " , textfield.getModelObject() = "
>    + textfield.getModelObject());
>}
>};
> *moreForm*.add(button);
>
>
> On Wed, Jan 20, 2010 at 10:47 PM, smallufo  wrote:
>
> > This is a full functional Page  :
> >
> > I found this problem only occurs when the form is in the listView :
> > If I move the form out of the listView , it works like a charm.
> > Bug ? I am not sure...
> >
> > The link is the screen capture :
> > http://xs.to/image-B859_4B57CDD0.gif
> >
> >
> > MyPage.html
> >
> > 
> >  
> >name
> >more ?
> >  
> >  
> >
> >  
> >[name]
> >
> >  
> >yes
> >no
> >  
> >
> >  
> >  
> >
> >   > wicket:id="textfield"/>
> >  
> >
> >  
> >
> >  
> > 
> >
> >
> > MyPage.java
> >
> > package quickstart.ajax;
> >
> > import java.util.ArrayList;
> > import java.util.List;
> >
> > import org.apache.wicket.ajax.AjaxEventBehavior;
> > import org.apache.wicket.ajax.AjaxRequestTarget;
> > import org.apache.wicket.ajax.markup.html.form.AjaxButton;
> > import org.apache.wicket.markup.html.WebMarkupContainer;
> > import org.apache.wicket.markup.html.WebPage;
> > import org.apache.wicket.markup.html.basic.Label;
> > import org.apache.wicket.markup.html.form.Form;
> > import org.apache.wicket.markup.html.form.Radio;
> > import org.apache.wicket.markup.html.form.RadioGroup;
> > import org.apache.wicket.markup.html.form.TextField;
> > import org.apache.wicket.markup.html.list.ListItem;
> > import org.apache.wicket.markup.html.list.ListView;
> > import org.apache.wicket.model.Model;
> >
> > public class MyPage extends WebPage
> > {
> >  private final static List names = new ArrayList();
> >  static
> >  {
> >names.add("Andy");
> >names.add("Brian");
> >names.add("Carol");
> >  }
> >
> >  public MyPage()
> >  {
> >ListView listView = new ListView("listView" , names)
> >{
> >  @Override
> >  protected void populateItem(ListItem item)
> >  {
> >
> >Form form = new Form("form");
> >item.add(form);
> >
> >String name = item.getModelObject();
> >
> >form.add(new Label("name" , name));
> >
> >final WebMarkupContainer more = new WebMarkupContainer("more");
> >more.setVisible(false);
> >more.setOutputMarkupPlaceholderTag(true);
> >form.add(more);
>

Re: Cannot get default invisible TextField's ModelObject ?

2010-01-20 Thread smallufo
This is a full functional Page  :

I found this problem only occurs when the form is in the listView :
If I move the form out of the listView , it works like a charm.
Bug ? I am not sure...

The link is the screen capture :
http://xs.to/image-B859_4B57CDD0.gif


MyPage.html


  
name
more ?
  
  

  
[name]

  
yes
no
  

  
  

  
  

  

  



MyPage.java

package quickstart.ajax;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.Radio;
import org.apache.wicket.markup.html.form.RadioGroup;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.Model;

public class MyPage extends WebPage
{
  private final static List names = new ArrayList();
  static
  {
names.add("Andy");
names.add("Brian");
names.add("Carol");
  }

  public MyPage()
  {
ListView listView = new ListView("listView" , names)
{
  @Override
  protected void populateItem(ListItem item)
  {

Form form = new Form("form");
item.add(form);

String name = item.getModelObject();

form.add(new Label("name" , name));

final WebMarkupContainer more = new WebMarkupContainer("more");
more.setVisible(false);
more.setOutputMarkupPlaceholderTag(true);
form.add(more);


final RadioGroup radioGroup = new
RadioGroup("radioGroup" , Model.of(Boolean.FALSE));
form.add(radioGroup);

Radio yes = new Radio("yes" ,
Model.of(Boolean.TRUE));
Radio no = new Radio("no" ,
Model.of(Boolean.FALSE));
radioGroup.add(yes);
radioGroup.add(no);

yes.add(new AjaxEventBehavior("onClick")
{
  @Override
  protected void onEvent(AjaxRequestTarget target)
  {
more.setVisible(true);
target.addComponent(more);
  }
});

no.add(new AjaxEventBehavior("onClick")
{
  @Override
  protected void onEvent(AjaxRequestTarget target)
  {
more.setVisible(false);
target.addComponent(more);
  }
});

final TextField textfield = new
TextField("textfield" , new Model());
more.add(textfield);
AjaxButton button = new AjaxButton("submit")
{
  @Override
  protected void onSubmit(AjaxRequestTarget arg0, Form form)
  {
System.out.println("radioGroup = " + radioGroup.getModelObject()
+ " , textfield.getModelObject() = " + textfield.getModelObject());
  }
};
more.add(button);
  }
};
add(listView);
  }
}


Re: Cannot get default invisible TextField's ModelObject ?

2010-01-20 Thread smallufo
To make it more clear :
When the radio button is clicked , by implement AjaxEventBehavior("onClick")

, a default-invisible WebMarkupContainer is set visible ,
The WebMarkupContainer  contains other TextFields , which I cannot get their
values at all 
I've stuck with this problems for half day , searching but found no anwser
...
I need help

Wicket 1.4.5


2010/1/21 smallufo 

> I have a form , which contains a radio button.
> When user clicks the radio button , a default-invisible textfield is set
> visible.
> But I cannot get the textfield's Model Object , it is null 
>
> What's the problem ? Did I miss anything ?
>


Cannot get default invisible TextField's ModelObject ?

2010-01-20 Thread smallufo
I have a form , which contains a radio button.
When user clicks the radio button , a default-invisible textfield is set
visible.
But I cannot get the textfield's Model Object , it is null 

What's the problem ? Did I miss anything ?


Re: Any servlet filter- like WebRequest interceptor or filter ?

2010-01-11 Thread smallufo
Wow , thanks replying so soon.
I am just trying :

public RequestCycle newRequestCycle(Request request, Response response)
{
ServletWebRequest servletWebRequest = (ServletWebRequest) request;
HttpServletRequest hreq = servletWebRequest.getHttpServletRequest();
ServletContext context = hreq.getSession().getServletContext();
WebApplicationContext wac =
WebApplicationContextUtils.getWebApplicationContext(context);
final UserDao userDao = (UserDao) wac.getBean("userDao");

It works too , but it is much ugly...

2010/1/12 Stijn Maller 

> InjectorHolder.getInjector().inject(this);
>


Re: Any servlet filter- like WebRequest interceptor or filter ?

2010-01-11 Thread smallufo
Hi

Do you mean override newRequestCycle() in WebApplication , and in the
returning WebRequestCycle, override onBeginRequest() ?

If so , how do I inject spring beans into Application ?
The SpringComponentInjector is injected into Application in init() , but
Spring beans is not available in this class.


2010/1/12 Igor Vaynberg 

> requestcycle.onbeginrequest
>
> -igor
>
> On Mon, Jan 11, 2010 at 2:40 AM, smallufo  wrote:
> > For example :
> > A Wicket application may have many WebPages or Wizards which are
> > inter-connected ...
> > The interceptor(or filter , whatever called) can monitor the user's
> cookie ,
> > when some situation matches , he will be redirected to a specified page,
> > after filling some forms , he will be redirect back to the original
> target
> > page or wizard step...
> >
> > Is it possible in wicket ?
> >
> > 2010/1/11 smallufo 
> >
> >> Hi :
> >>
> >> I wonder if wicket has any servletFilter-like WebRequest interceptor or
> >> filter ?
> >> That the interceptor can intercept WebRequest or HttpSession and
> >> pre-processing , and maybe redirect to some specified WebPage ...
> >>
> >> Thanks a lot.
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Any servlet filter- like WebRequest interceptor or filter ?

2010-01-11 Thread smallufo
For example :
A Wicket application may have many WebPages or Wizards which are
inter-connected ...
The interceptor(or filter , whatever called) can monitor the user's cookie ,
when some situation matches , he will be redirected to a specified page,
after filling some forms , he will be redirect back to the original target
page or wizard step...

Is it possible in wicket ?

2010/1/11 smallufo 

> Hi :
>
> I wonder if wicket has any servletFilter-like WebRequest interceptor or
> filter ?
> That the interceptor can intercept WebRequest or HttpSession and
> pre-processing , and maybe redirect to some specified WebPage ...
>
> Thanks a lot.
>


Any servlet filter- like WebRequest interceptor or filter ?

2010-01-11 Thread smallufo
Hi :

I wonder if wicket has any servletFilter-like WebRequest interceptor or
filter ?
That the interceptor can intercept WebRequest or HttpSession and
pre-processing , and maybe redirect to some specified WebPage ...

Thanks a lot.


Re: How to create Wicket's session and inject to Wicket's life cycle using Servlet Filter ?

2010-01-09 Thread smallufo
Thank you , I've found the answer :
httpSession =
((ServletWebRequest)request).getHttpServletRequest().getSession();

This is a better way ...
thanks a lot.


2010/1/10 smallufo 

>
>
> 2010/1/10 Igor Vaynberg 
>
> why not simply put whatever it is into the httpsession, and then write
>> a getter in wicket's session that retrieves it from there? seems
>> simpler.
>>
>> -igor
>
>
> Thank you .
> But how to get HttpSession inside Wicket's Session ?
> thanks ...
>
>


Re: How to create Wicket's session and inject to Wicket's life cycle using Servlet Filter ?

2010-01-09 Thread smallufo
2010/1/10 Igor Vaynberg 

> why not simply put whatever it is into the httpsession, and then write
> a getter in wicket's session that retrieves it from there? seems
> simpler.
>
> -igor


Thank you .
But how to get HttpSession inside Wicket's Session ?
thanks ...


How to create Wicket's session and inject to Wicket's life cycle using Servlet Filter ?

2010-01-09 Thread smallufo
2010/1/9 smallufo 

> Hi all :
>
> I'm trying to inject something to the Wicket Session by a Generic Servlet
> Filter :
>
> public class UserFilter implements Filter
> {
>   private UserDao UserDao;
>
>   @Override
>   public void init(FilterConfig config) throws ServletException
>   {
> WebApplicationContext wac =
> WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
> UserDao = (UserDao) wac.getBean("userDao");
>   }
>
>   @Override
>   public void doFilter(ServletRequest req, ServletResponse res, FilterChain
> chain) throws IOException, ServletException
>   {
>
> System.out.println(getClass().getName() + " : UserDao = " + UserDao);
> // ... blah...
> // do something , get user from cookie , authenticate cookie , and set
> it to Session
> // ... blah...
> MySession s = MySession.get(); // error occurs !
> chain.doFilter(req, res);
>   }
>
>
> It seems I cannot get Wicket's session outside wicket's request cycle.
> I searched and found WicketSessionFilter , but it seems it is for
> "Retrieving" objects from wicket's session , not for Filter to inject
> something to wicket's session...
>
>
>
I've almost solve this problem by looking into
 org.apache.wicket.protocol.http.servlet.WicketSessionFilter , and
implements my Filter :


public class UserFilter implements Filter
{
  private String sessionKey;
  private UserDao userDao;

  @Override
  public void init(FilterConfig config) throws ServletException
  {
WebApplicationContext wac =
WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
userDao = (UserDao) wac.getBean("userDao");
  }

  @Override
  public void doFilter(ServletRequest req, ServletResponse res, FilterChain
chain) throws IOException, ServletException
  {
HttpServletRequest httpServletRequest = ((HttpServletRequest)req);
// create a httpSession if there is no session
HttpSession httpSession = httpServletRequest.getSession(true);
WebApplication application = (WebApplication)Application.get("MyApp");

if (application != null)
{
  sessionKey = application.getSessionAttributePrefix(null, "MyApp") +
Session.SESSION_ATTRIBUTE_NAME;

  //MySession extends WebSession
  MySession mySession = (MySession)httpSession.getAttribute(sessionKey);

  if (mySession != null)
mySession.setUser(getUserFromCookies(httpServletRequest));
  else
  {
//No mySession , need to create a MySession and inject to
httpSession

MySession newSession = new MySession(application , ); //
<- How to get Request ?
newSession.setUser(getUserFromCookies(httpServletRequest));
httpSession.setAttribute(sessionKey, newSession);
  }
}
chain.doFilter(req, res);
  }
}


The problem is : when there is no Wicket's session , how do I create a
Wicket's session outside wicket's request cycle ?
WebSession needs a "org.apache.wicket.Request" to  construct  , how do I get
this Request in the filter  ?

Thanks a lot.


Inject object to Wicket session by Servlet Filter , but : you can only locate or create sessions in the context of a request cycle

2010-01-08 Thread smallufo
Hi all :

I'm trying to inject something to the Wicket Session by a Generic Servlet
Filter :

public class UserFilter implements Filter
{
  private UserDao UserDao;

  @Override
  public void init(FilterConfig config) throws ServletException
  {
WebApplicationContext wac =
WebApplicationContextUtils.getWebApplicationContext(config.getServletContext());
UserDao = (UserDao) wac.getBean("userDao");
  }

  @Override
  public void doFilter(ServletRequest req, ServletResponse res, FilterChain
chain) throws IOException, ServletException
  {

System.out.println(getClass().getName() + " : UserDao = " + UserDao);
// ... blah...
// do something , get user from cookie , authenticate cookie , and set
it to Session
// ... blah...
MySession s = MySession.get(); // error occurs !
chain.doFilter(req, res);
  }


It seems I cannot get Wicket's session outside wicket's request cycle.
I searched and found WicketSessionFilter , but it seems it is for
"Retrieving" objects from wicket's session , not for Filter to inject
something to wicket's session...

How to solve this problem ?


Re: How to replace Strings in JavaScript ?

2009-12-16 Thread smallufo
Hi ,
Thanks
But where is class TextTemplateContributor ? I cannot grep that class ...
I could only find wicket/util/template/TextTemplate ...

2009/12/17 Igor Vaynberg 

> you can use something like TextTemplateContibutor
>
> -igor
>
> On Wed, Dec 16, 2009 at 11:21 AM, smallufo  wrote:
> > Hello , I am using wicket 1.4.3
> > I wonder how to replace Strings in JavaScript ?
> >
> > such as :
> >
> > 
> >   >onclick="window.open('http://www.facebook.com/login.php?
> >
> >
>  
> api_key=278f76da30a86d0b5a2526a25c310166&display=popup&extern=1&fbconnect=1&req_perms=publish_stream&return_session=1&v=1.0&
> >next=http%3A%2F%2Fwww.example.com
> > %2Fconnect%2Fsuccess.html&fb_connect=1&
> >cancel_url=http%3A%2F%2Fwww.example.com%2Fconnect%2Fcancel.html',
> >'_blank', 'top=442,width=480,height=460,resizable=yes', true)"  />
> > 
> >
> > Is it possible to replace api_key , next , and cancel_url in this script
> ?
> >
> > Thanks a lot .
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


How to replace Strings in JavaScript ?

2009-12-16 Thread smallufo
Hello , I am using wicket 1.4.3
I wonder how to replace Strings in JavaScript ?

such as :


  http://www.facebook.com/login.php?

 
api_key=278f76da30a86d0b5a2526a25c310166&display=popup&extern=1&fbconnect=1&req_perms=publish_stream&return_session=1&v=1.0&
next=http%3A%2F%2Fwww.example.com
%2Fconnect%2Fsuccess.html&fb_connect=1&
cancel_url=http%3A%2F%2Fwww.example.com%2Fconnect%2Fcancel.html',
'_blank', 'top=442,width=480,height=460,resizable=yes', true)"  />


Is it possible to replace api_key , next , and cancel_url in this script ?

Thanks a lot .


Re: How to tackle Ajax "Flooding"

2009-12-09 Thread smallufo
Wow , thanks for this great tip ...

But I have problem applying to Gmap2 :
I hope when user clicks the map , the map won't be able to receive any
requests until the onClick() finishes...
But it seems this doesn't work...
Is there anything I missed ?

gmap2.add(new ClickListener()
{
  @Override
  protected void onClick(AjaxRequestTarget target, GLatLng latLng, GOverlay
overlay)
  {
// high computation ...
  }

  @Override
  protected IAjaxCallDecorator getAjaxCallDecorator()
  {
return new IAjaxCallDecorator()
{
  @Override
  public CharSequence decorateScript(CharSequence script)
  { return "this.enabled=false;"+script; }

  @Override
  public CharSequence decorateOnSuccessScript(CharSequence script)
  { return script+";this.enabled=true;"; }

  @Override
  public CharSequence decorateOnFailureScript(CharSequence script)
  { return script+";this.enabled=true;"; }
};
  }
});



2009/8/31 Igor Vaynberg 

> add(new ajaxbutton("button") {
>  getajaxcalldecorator() {
> return new iajaxcalldecorator() {
> decoratescript(script) { "return this.enabled=false;"+script; }
> decorateonfailurescript(script) { return
> script+";this.enabled=true;";}
> decorateonsuccessscript(script) { return
> script+";this.enabled=true;";}
> }
>  }
> }
>
> doesnt look like a lot of javascript to me. further you can factor it
> out into a separate class and reuse it all over the place.
>
> -igor
>
>
> On Mon, Aug 31, 2009 at 5:40 AM, Tom Wollert
> wrote:
> > The only idea I can come up with is to keep state of my model on client
> > side, but that would require alot of javascript :/
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


  1   2   >