Re: Scala DSL for Wicket

2011-07-28 Thread Bruno Borges
Just wanted to share my experience playing a little more with Scala and
Wicket A few minutes ago I got this excelent code:

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

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

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



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



On Wed, Jul 27, 2011 at 4:53 PM, Bruno Borges bruno.bor...@gmail.comwrote:

 Thanks Martin,

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

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

 The suggestions were updated on Gist.

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



 On Wed, Jul 27, 2011 at 3:55 PM, Martin Grigorov mgrigo...@apache.orgwrote:

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

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

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

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

 On Wed, Jul 27, 2011 at 9:11 PM, Martin Grigorov mgrigo...@apache.org
 wrote:
  Take a look at scala.swing.* sources.
 
  On Wed, Jul 27, 2011 at 8:34 PM, Bruno Borges bruno.bor...@gmail.com
 wrote:
  Can some Scala expert help me to make this DSL available as PML (pimp
 my
  library)?
 
  I've tried to code it that way but things didn't quite worked out the
 way
  they should.
 
  The reason is that for every Wicket object I create, I must extend the
 trait
  DSLWicket
 
 
 
  *Bruno Borges*
  www.brunoborges.com.br
  +55 21 76727099
 
 
 
  On Wed, Jul 27, 2011 at 2:30 PM, Bruno Borges bruno.bor...@gmail.com
 wrote:
 
  Not really.
 
  The method onSubmit() of button is void, as well onClick(), so there's
 no
  need for the function be passed as () = Unit or anything else.
 
  I made a few changes to it and updated on Gist.
 
  I've also uploaded a page that uses this DSL at
  https://gist.github.com/1109919
 
  Take a look
 
  *Bruno Borges*
  www.brunoborges.com.br
  +55 21 76727099
 
 
 
  On Wed, Jul 27, 2011 at 2:22 PM, Scott Swank scott.sw...@gmail.com
 wrote:
 
  I think you do want Unit, which as I understand it is closest
  equivalent to void in Scala.
 
  http://www.scala-lang.org/api/current/scala/Unit.html
 
  Scott
 
  On Wed, Jul 27, 2011 at 10:14 AM, Bruno Borges 
 bruno.bor...@gmail.com
  wrote:
   No, the function must return void, not another function (unit).
  
   But there's also the option of () = Nothing. Which one should I
 use for
   this case?
  
   *Bruno Borges*
   www.brunoborges.com.br
   +55 21 76727099
  
  
  
   On Wed, Jul 27, 2011 at 12:54 PM, Martin Grigorov 
 mgrigo...@apache.org
  wrote:
  
def button(id: String, submit: () = Void): Button = {
  
   it should be () = Unit, no ?
  
   On Wed, Jul 27, 2011 at 6:51 PM, Martin Grigorov 
 mgrigo...@apache.org
  
   wrote:
Adding some usage examples at the bottom will help us evaluate
 it.
   
Why not add type to
def textField(id: String): TextField[_] = { val field = new
TextField(id); add(field); field }
to become
def textField[T](id: String): TextField[T] = { val field = new
TextField[T](id); add(field); field }
   
usage: textField[Int](someId)
   
with using implicit Manifest for T you can also can
 automatically set
the type: field.setType(m.erasure)
   
On Wed, Jul 27, 2011 at 6:26 PM, Bruno Borges 
  bruno.bor...@gmail.com
   wrote:
I've been playing with Wicket and Scala and I thought this
 could be
   added to
the wicket-scala project at WicketStuff.
   
What do you guys think?
   
https://gist.github.com/1109603
   
   
*Bruno Borges*
www.brunoborges.com.br
+55 21 76727099
   
   
   
   
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
   
  
  
  
   --
   Martin Grigorov
   jWeekend
   Training, Consulting, Development
   http://jWeekend.com
  
  
 -
   To unsubscribe, e-mail: 

Problem while decouple page flow by using SpringBean

2011-07-28 Thread Mike Mander

Hi,

i would like to decouple the page dependencies. My page flow is 
implemented by using bookmarkable page links.

As we all know they take a page class as parameter. This couples both pages.

So i thought it's a good idea to give the page class a name in my Spring 
application context and reference it in

the caller page.

public StartPage extends WebPage {

  @SpringBean(name=nextPageClass)
  private Class? extends Page _nextPageClass;

  public StartPage() {
add(new BookmarkablePageLink(toNextPage, _nextPageClass);
  }
}

My application context defines:

bean id=nextPageClass class=java.lang.Class factory-method=forName
constructor-arg value=my.NextPage/
/bean

But it's not working while java.lang.Class is final. I get

Caused by: java.lang.IllegalArgumentException: Cannot subclass final 
class class java.lang.Class

at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
at 
net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at 
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)

at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at 
org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:174)
at 
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)

at org.apache.wicket.injection.Injector.inject(Injector.java:103)
... 47 more

Can i do this in another way?

Thanks
Mike

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



RE: Ten things every Wicket programmer must know?

2011-07-28 Thread Hielke Hoeve
* How models work and best practices for wicket/hibernate
* how ajax behaviors should be used
* how are resources defined and used
* how to make a multilingual site using resource models 
etc

Hielke

-Original Message-
From: Jeremy Thomerson [mailto:jer...@wickettraining.com] 
Sent: donderdag 28 juli 2011 0:29
To: users@wicket.apache.org
Subject: RFC: Ten things every Wicket programmer must know?

Hello all,

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

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

Best regards,

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

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



Re: Problem while decouple page flow by using SpringBean

2011-07-28 Thread Mike Mander
Found a solution, but would be great if i could get some tips about the 
consequences.
I was wrapping the beans in proxies by setting the flag in 
SpringComponentInjector to true.
Now it's set to false and it's working. But i'm a bit in doubt that i 
opened pandoras box

with this.

It was
addComponentInstantiationListener(new SpringComponentInjector(this, 
context(), true));

and is now
addComponentInstantiationListener(new SpringComponentInjector(this, 
context(), false));


Thanks
Mike

Hi,


i would like to decouple the page dependencies. My page flow is 
implemented by using bookmarkable page links.
As we all know they take a page class as parameter. This couples both 
pages.


So i thought it's a good idea to give the page class a name in my 
Spring application context and reference it in

the caller page.

public StartPage extends WebPage {

  @SpringBean(name=nextPageClass)
  private Class? extends Page _nextPageClass;

  public StartPage() {
add(new BookmarkablePageLink(toNextPage, _nextPageClass);
  }
}

My application context defines:

bean id=nextPageClass class=java.lang.Class 
factory-method=forName

constructor-arg value=my.NextPage/
/bean

But it's not working while java.lang.Class is final. I get

Caused by: java.lang.IllegalArgumentException: Cannot subclass final 
class class java.lang.Class

at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
at 
net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at 
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)

at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at 
org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:174)
at 
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)

at org.apache.wicket.injection.Injector.inject(Injector.java:103)
... 47 more

Can i do this in another way?

Thanks
Mike

-
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: Problem while decouple page flow by using SpringBean

2011-07-28 Thread Martin Grigorov
It is quite easy to extend SpringComponentInjector so that it will
look for another annotation, e.g. @SpringBean2 which wont be proxy-ed.
Yet another one is to create a ticket to add an additional attribute
to original @SpringBean (proxy = false).

On Thu, Jul 28, 2011 at 10:18 AM, Mike Mander wicket-m...@gmx.de wrote:
 Found a solution, but would be great if i could get some tips about the
 consequences.
 I was wrapping the beans in proxies by setting the flag in
 SpringComponentInjector to true.
 Now it's set to false and it's working. But i'm a bit in doubt that i opened
 pandoras box
 with this.

 It was
 addComponentInstantiationListener(new SpringComponentInjector(this,
 context(), true));
 and is now
 addComponentInstantiationListener(new SpringComponentInjector(this,
 context(), false));

 Thanks
 Mike

 Hi,

 i would like to decouple the page dependencies. My page flow is
 implemented by using bookmarkable page links.
 As we all know they take a page class as parameter. This couples both
 pages.

 So i thought it's a good idea to give the page class a name in my Spring
 application context and reference it in
 the caller page.

 public StartPage extends WebPage {

  @SpringBean(name=nextPageClass)
  private Class? extends Page _nextPageClass;

  public StartPage() {
    add(new BookmarkablePageLink(toNextPage, _nextPageClass);
  }
 }

 My application context defines:

 bean id=nextPageClass class=java.lang.Class factory-method=forName
 constructor-arg value=my.NextPage/
 /bean

 But it's not working while java.lang.Class is final. I get

 Caused by: java.lang.IllegalArgumentException: Cannot subclass final class
 class java.lang.Class
    at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
    at
 net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at
 net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
    at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
    at
 org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:174)
    at
 org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)
    at org.apache.wicket.injection.Injector.inject(Injector.java:103)
    ... 47 more

 Can i do this in another way?

 Thanks
 Mike

 -
 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





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

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



Re: Ten things every Wicket programmer must know?

2011-07-28 Thread vineet semwal
what hielke said +
how to
-- use images from database/filesystem
-- resources as already mentioned including shared resources..
-- show error alert next to formcomponent
-- reusability +good coding practises as already mentioned



On Thu, Jul 28, 2011 at 12:39 PM, Hielke Hoeve hielke.ho...@topicus.nl wrote:
 * How models work and best practices for wicket/hibernate
 * how ajax behaviors should be used
 * how are resources defined and used
 * how to make a multilingual site using resource models
 etc

 Hielke

 -Original Message-
 From: Jeremy Thomerson [mailto:jer...@wickettraining.com]
 Sent: donderdag 28 juli 2011 0:29
 To: users@wicket.apache.org
 Subject: RFC: Ten things every Wicket programmer must know?

 Hello all,

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

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

 Best regards,

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

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





-- 
thank you,

regards,
Vineet Semwal

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



Re: AjaxFormComponentUpdatingBehavior target.addComponent(component) causes to lose focus

2011-07-28 Thread Martin Grigorov
add target.focusComponent(null)
This way Wicket wont try to restore the focus

On Thu, Jul 28, 2011 at 9:26 AM, Erki Erki erki.pub...@gmail.com wrote:
 Hello,

 I have this problem with wicket.
 I have added onBlur AjaxFormComponentUpdatingBehavior to my textfield.

 After the user moves focus to something else, the style of the
 right/previous component is updated correctly, but the focus is taken away
 from the other/nonupdated selected component.

 I have added an eclipse project to display this behaviour. Just move the
 focus between textfields.


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




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

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



Re: How can i get inline styles of div in runtime?

2011-07-28 Thread accord
thanks. i found solution like this yesterday.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-can-i-get-inline-styles-of-div-in-runtime-tp3698773p3700702.html
Sent from the Users forum mailing list archive at Nabble.com.

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



RE: Ten things every Wicket programmer must know?

2011-07-28 Thread Wilhelmsen Tor Iver
Also:

* How to avoid excessive use of Labels and AttributeModifiers (with 
ResourceModels) just for l10n, by using wicket:message in the template instead
* compressing code by use of ids matching property names combined with 
CompoundPropertyModel and/or PropertyListView

- Tor Iver

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



Re: wicketstuff tinymce development

2011-07-28 Thread Pointbreak
 According to:
 http://tinymce.moxiecode.com/tryit/multiple_configs.php
 
   Mode should be switched to textareas our current implementation 
 provide exact only.

Why would you want to use textareas matching when using TinyMce in
Wicket? Attach a TinyMceBehavior to each Wicket component that needs a
TinyMce editor. That's it. Using textarea mode makes no sense in a
Wicket integration as it doesn't integrate anything.

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



Re: Ten things every Wicket programmer must know?

2011-07-28 Thread Martin Makundi
 * compressing code by use of ids matching property names combined with 
 CompoundPropertyModel and/or PropertyListView

Oh.. that will lead to fragility.

**
Martin


 - Tor Iver

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



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



Re: wicketstuff tinymce development

2011-07-28 Thread Michal Letynski


W dniu 2011-07-28 12:08, Pointbreak pisze:

According to:
http://tinymce.moxiecode.com/tryit/multiple_configs.php

   Mode should be switched to textareas our current implementation
provide exact only.

Why would you want to use textareas matching when using TinyMce in
Wicket? Attach a TinyMceBehavior to each Wicket component that needs a
TinyMce editor. That's it. Using textarea mode makes no sense in a
Wicket integration as it doesn't integrate anything.


Ok i solved the problem. I used wrong version (1.4.17.3 - its buggy). I 
get exceptions:


java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at 
wicket.contrib.tinymce.settings.TinyMCESettings.lazyLoadTinyMCEResource(TinyMCESettings.java:971)
at 
wicket.contrib.tinymce.TinyMceBehavior.renderHead(TinyMceBehavior.java:60)


And looking and java docs ( TODO: This has not been extensively 
tested.) it still under development.



-
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: RFC: Ten things every Wicket programmer must know?

2011-07-28 Thread Carl-Eric Menzel
On Wed, 27 Jul 2011 18:29:22 -0400
Jeremy Thomerson jer...@wickettraining.com wrote:

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

Not ten things, but a few anyway. This is what I really try to get
across in training classes:

- Understand how models work, that they are a shared reference to a
  domain object, and they connect your components. If you find yourself
  shoveling data around manually, have a second, third and fourth look
  at it, you're probably doing it wrong.

- Detach your models. There's a simple rule: Any model that you
  instantiate or that you get passed in from elsewhere you need to
  either
- detach yourself
- or pass it to another component, thus delegating the
  responsibility for detaching it.
  Detach it or pass it on.

- Try to use as few instance variables in your components as possible.
  Use instance variables only for handling state completely internal
  to your component. Use models for everything else - that is,
  everything that might be visible from outside your component. Internal
  state is stuff that never leaves your component, neither to whomever
  called you, nor to anything you call. The latter includes components
  that you aggregate in your panel.
  This rule greatly simplifies refactoring later on.

- Did I mention that models are important? :-)

Carl-Eric
www.wicketbuch.de


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



Re: Ten things every Wicket programmer must know?

2011-07-28 Thread Carl-Eric Menzel
On Thu, 28 Jul 2011 11:10:30 +0300
Martin Makundi martin.maku...@koodaripalvelut.com wrote:

  * compressing code by use of ids matching property names combined
  with CompoundPropertyModel and/or PropertyListView
 
 Oh.. that will lead to fragility.

It can, but in my experience it hasn't. Our domain objects rarely
change, and if they do, our unit tests catch that immediately. The page
doesn't even render if the property model doesn't work, so if you have
a simple tester.startPage(MyPage.class); you're safe enough in most
cases.

This is actually a good point to make for the list:

- Unit test everything you can using WicketTester. It doesn't do
  everything, but it's invaluable as a smoke test at the very least. If
  possible, try and check stuff like visibility and enabled state of
  your components too.

Carl-Eric
www.wicketbuch.de


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



Re: Ten things every Wicket programmer must know?

2011-07-28 Thread Martin Makundi
Hi!

  * compressing code by use of ids matching property names combined
  with CompoundPropertyModel and/or PropertyListView

 Oh.. that will lead to fragility.

 It can, but in my experience it hasn't. Our domain objects rarely
 change, and if they do, our unit tests catch that immediately.

It will bias towards not refactoring domain objects and it migh
require thorough coverage of junit tests (... which is good).

 The page doesn't even render if the property model doesn't work, so if you 
 have
 a simple tester.startPage(MyPage.class); you're safe enough in most
 cases.

That's a smoke test, but you might need to see the page in various
states (repeaters, popups, etc.).

 - Unit test everything you can using WicketTester. It doesn't do
  everything, but it's invaluable as a smoke test at the very least. If
  possible, try and check stuff like visibility and enabled state of
  your components too.

I agree. But the more thorough your tests are the more covered you
are, though the more costly it is and more costly to make changes.

For example we have lots of prototype/beta user interfaces and it
simply isn't practical to make thorough junit tests for all and we
refactor a lot so compounds are not an option.

**
Martin


 Carl-Eric
 www.wicketbuch.de


 -
 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: Ten things every Wicket programmer must know?

2011-07-28 Thread Ted Roeloffzen
In my humble opinion:

The most important thing that you should know are models en how powerfull
they can be used.
Models can be quite confusing, especially to programmers who've just started
using Wicket.
I remember how I struggled with the concept, when I started to use Wicket.

How and when to detach them, how to use them when using an ORM-framework,
etc.


Ted



2011/7/28 Carl-Eric Menzel cmen...@wicketbuch.de

 On Thu, 28 Jul 2011 11:10:30 +0300
 Martin Makundi martin.maku...@koodaripalvelut.com wrote:

   * compressing code by use of ids matching property names combined
   with CompoundPropertyModel and/or PropertyListView
 
  Oh.. that will lead to fragility.

 It can, but in my experience it hasn't. Our domain objects rarely
 change, and if they do, our unit tests catch that immediately. The page
 doesn't even render if the property model doesn't work, so if you have
 a simple tester.startPage(MyPage.class); you're safe enough in most
 cases.

 This is actually a good point to make for the list:

 - Unit test everything you can using WicketTester. It doesn't do
  everything, but it's invaluable as a smoke test at the very least. If
  possible, try and check stuff like visibility and enabled state of
  your components too.

 Carl-Eric
 www.wicketbuch.de


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




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

2011-07-28 Thread Arjun Dhar
From my experience, stuff where I screwed up or wasted time:

1. Wicket is a UI framework, delegate as much as possible to your own
neutral code base service and components. Data Models etc. Both Server and
Client Side. Client Side:: Don't wrestle with Grids etc in Wicket; if you
can get away with a cheap JavaScript/DHTML implementation instead.

2. Wicket Data Models should ideally wrap you native business objects.
Wicket wotks over the native business objects; your business objects POJOs
are not designed for wicket.

3. Use Detachable models effectively. (Am still learning the meaning of
*effectively*). Example: Everyone talks about using it, but it depends on
the underlying business objects in use. If they are poorly designed and load
in an in-effiient manner, then load() will mess with re-loading stuff each
time.

4. Do not try to instantiate Wicket Components via Spring. there is no sane
reason to do this; this was an area of special interest and very tempting.
One can rely on Spring for native objects and develop better mechanisms for
Components to instantiate over the Spring defined layer.

5. @SpringBean is bloody useful

6. Learn to hack Mount Paths. The default Markup Page classpath relating to
the component is Web non-intuitive. Its great if you can live with the
default setup but learn to mess around with mounting.

7. Learn to the differences between Markup Inheritance, Use of Panels and
Include when it comes to designing reusable templates and reducing
boilerplate markup code.

8. Mess around with Fragments; they are useful. Like Anonamous classes ; but
just in the markup world.

9. Learn atleast one other Web Framework like Struts, appreciate the beauty
of Wicket.

10. Learn to respect velocity templates and the co-existence of Wicket with
Velocity. Wicket-Velocity project.



-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/RFC-Ten-things-every-Wicket-programmer-must-know-tp3699989p3700814.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: DropDownChoice updates onchange event.

2011-07-28 Thread Andrea Del Bene

Hi,

I've looked at your code but is not clear to me how and when you read 
the selected value in savedReportsDropDown. Is trackingProfileVO an 
instance of SelectedTrackProfileVO?




Here is the code:

private DropDownChoiceSelectedTrackProfileVO  savedReportsDropDown;

savedReportsDropDown = new
DropDownChoiceSelectedTrackProfileVO(profileDropDown,savedReportsDropDownList);
savedReportsDropDown.setChoiceRenderer(new
ChoiceRendererSelectedTrackProfileVO(reportName, cstmReportId));
savedReportsDropDown.setOutputMarkupId(true);
savedReportsDropDown.setOutputMarkupPlaceholderTag(true);
savedReportsDropDown.add(new AjaxFormComponentUpdatingBehavior(onchange){


 private static final long serialVersionUID = 1L;

 @Override
 protected void onUpdate(AjaxRequestTarget target) {

 try {
  TrackingProfileVO trackingProfileVOFromDB = gets the value from
DB.


trackingProfileVO.setReportLabel(trackingProfileVOFromDB.getReportLabel());

trackingProfileVO.setProfileDesc(trackingProfileVOFromDB.getProfileDesc());

trackingProfileVO.setShipmentSearch(trackingProfileVOFromDB.getShipmentSearch());
  trackingProfileVO.getLstSelectedSHVReportColumn().clear();

trackingProfileVO.getLstSelectedSHVReportColumn().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());
  trackingProfileVO.getSortFirstColumnList().clear();
  trackingProfileVO.getSortSecondColumnList().clear();
  trackingProfileVO.getSortThirdColumnList().clear();

trackingProfileVO.getSortFirstColumnList().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());

trackingProfileVO.getSortSecondColumnList().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());

trackingProfileVO.getSortThirdColumnList().addAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());

trackingProfileVO.setShareFlag(trackingProfileVOFromDB.isShareFlag());
  shareFlag.setDefaultModel(new
ModelBoolean(trackingProfileVOFromDB.isShareFlag()));
  if(trackingProfileVOFromDB.getResultsPerPage() != null){

trackingProfileVO.setResultsPerPage(trackingProfileVOFromDB.getResultsPerPage());
  resultsPerPage.setModel(new
ModelDDChoice(trackingProfileVOFromDB.getResultsPerPage()));
  }

trackingProfileVO.getLstSHVReportColumn().removeAll(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());



displaySortingPanel.getSortFirst().setChoices(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());

displaySortingPanel.getSortSecond().setChoices(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());

displaySortingPanel.getSortThird().setChoices(trackingProfileVOFromDB.getLstSelectedSHVReportColumn());

trackingProfileVO.setSortFirst(trackingProfileVOFromDB.getSortFirst());

trackingProfileVO.setSortSecond(trackingProfileVOFromDB.getSortSecond());

trackingProfileVO.setSortThird(trackingProfileVOFromDB.getSortThird());
  displaySortingPanel.getSortFirst().setDefaultModel(new
ModelSHVReportColumnGridVO(trackingProfileVO.getSortFirst()));
  displaySortingPanel.getSortSecond().setDefaultModel(new
ModelSHVReportColumnGridVO(trackingProfileVO.getSortSecond()));
  displaySortingPanel.getSortThird().setDefaultModel(new
ModelSHVReportColumnGridVO(trackingProfileVO.getSortThird()));
  displaySortingPanel.setDefaultModel(new
ModelTrackingProfileVO(trackingProfileVO));
  target.appendJavascript(Ricola.init( '# +
displaySortingPanel.getMarkupId()+ ' ););

  target.appendJavascript(Ricola.init( '# +
displaySortingPanel.getSortFirst().getMarkupId()+ ' ););
  target.appendJavascript(Ricola.init( '# +
displaySortingPanel.getSortSecond().getMarkupId()+ ' ););
  target.appendJavascript(Ricola.init( '# +
displaySortingPanel.getSortThird().getMarkupId()+ ' ););

  target.addComponent(displaySortingPanel.getSortFirst());
  target.addComponent(displaySortingPanel.getSortSecond());
  target.addComponent(displaySortingPanel.getSortThird());

  target.addComponent(displaySortingPanel);
  target.addComponent(form);
 } catch (SHVServiceException e) {

 LOG.error(createSavedReportsDropDown() : Exception,e);
 }


 }

 @Override
 protected IAjaxCallDecorator getAjaxCallDecorator() {

 return new AjaxCallDecorator() {
 private static final long serialVersionUID = 1L;

 @Override
 public CharSequence decorateScript(CharSequence script) {

 final StringBuffer scriptBuffer = new StringBuffer();

scriptBuffer.append(Ricola.page.showPleaseWait('Processing'););
 scriptBuffer.append(script);
 return scriptBuffer.toString();

 }
 };

 }

});

-
Thanks  Regards,
Archana
--
View this message in context: 

Re: Problem while decouple page flow by using SpringBean

2011-07-28 Thread Mike Mander

Thanks Martin for the work-around.

Jira added: https://issues.apache.org/jira/browse/WICKET-3936

Thanks
Mike

Am 28.07.2011 09:26, schrieb Martin Grigorov:
i would like to decouple the page dependencies. My page flow is 
implemented by using bookmarkable page links.
As we all know they take a page class as parameter. This couples both 
pages.


So i thought it's a good idea to give the page class a name in my 
Spring application context and reference it in

the caller page.

public StartPage extends WebPage {

  @SpringBean(name=nextPageClass)
  private Class? extends Page _nextPageClass;

  public StartPage() {
add(new BookmarkablePageLink(toNextPage, _nextPageClass);
  }
}

My application context defines:

bean id=nextPageClass class=java.lang.Class 
factory-method=forName

constructor-arg value=my.NextPage/
/bean

But it's not working while java.lang.Class is final. I get

Caused by: java.lang.IllegalArgumentException: Cannot subclass final 
class class java.lang.Class

at net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)
at 
net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at 
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)

at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
at 
org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:174)
at 
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)

at org.apache.wicket.injection.Injector.inject(Injector.java:103)
... 47 more 



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



A safer way to build PropertyModels, version 1.2

2011-07-28 Thread Carl-Eric Menzel

https://github.com/duesenklipper/wicket-safemodel

As I wrote earlier on this list, SafeModel lets you turn the fragile
strings of this:

IModelString childNameModel = new PropertyModelString(
myBean, child.name);

...into this, gaining refactor-safety:

IModelString childNameModel =
model(from(myBean).getChild().getName());

I have just built SafeModel version 1.2, with the following
improvements:

- fixed an oversight in the initial version: You can now use a model as
  your root object for the from() method.

- Based on an idea from Matt Brictson, you can now quickly build
  LoadableDetachableModels using fromService instead of from:

  IModelUser userModel = model(fromService(userEJB.loadUser(42)));

  This is experimental. fromService may be refactored later to end up
  in a different class (but that would at worst force you to change
  imports, so no big deal really).

As always, feedback is greatly appreciated!

Carl-Eric
www.wicketbuch.de

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



Re: A safer way to build PropertyModels, version 1.2

2011-07-28 Thread Thomas Matthijs
On Thu, Jul 28, 2011 at 12:12 PM, Carl-Eric Menzel cmen...@wicketbuch.dewrote:


 https://github.com/duesenklipper/wicket-safemodel

 As I wrote earlier on this list, SafeModel lets you turn the fragile
 strings of this:

 IModelString childNameModel = new PropertyModelString(
myBean, child.name);

 ...into this, gaining refactor-safety:

 IModelString childNameModel =
 model(from(myBean).getChild().getName());



Does it require a default constructor?


Re: AjaxFormComponentUpdatingBehavior target.addComponent(component) causes to lose focus

2011-07-28 Thread Jack Berg
You are talking about the AjaxFeedbackUpdater.onBeforeRespond method?
It didn't work for me. It behaves the same. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-target-addComponent-component-causes-to-lose-focus-tp3700530p3701092.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxFormComponentUpdatingBehavior target.addComponent(component) causes to lose focus

2011-07-28 Thread Martin Grigorov
There is no class AjaxFeedbackUpdater in Wicket distro.
I'm talking about AjaxRequestTarget.focusComponent() method.

On Thu, Jul 28, 2011 at 2:36 PM, Jack Berg erki.pub...@gmail.com wrote:
 You are talking about the AjaxFeedbackUpdater.onBeforeRespond method?
 It didn't work for me. It behaves the same.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-target-addComponent-component-causes-to-lose-focus-tp3700530p3701092.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





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

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



Re: A safer way to build PropertyModels, version 1.2

2011-07-28 Thread Carl-Eric Menzel
On Thu, 28 Jul 2011 12:44:14 +0200
Thomas Matthijs li...@selckin.be wrote:

  ...into this, gaining refactor-safety:
 
  IModelString childNameModel =
  model(from(myBean).getChild().getName());
 
 
 
 Does it require a default constructor?

In the above example, myBean is any sort of regular Java bean. That
means: regular getters and setters. Default constructors may not be
needed, I did not test that. SafeModel does not instantiate your
objects. PropertyModel (which is what I'm using under the hood) may run
into issues, but I'd suggest just giving it a shot. It will fail
quickly if it doesn't work :)

Carl-Eric
www.wicketbuch.de

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



Re: AjaxFormComponentUpdatingBehavior target.addComponent(component) causes to lose focus

2011-07-28 Thread Jack Berg
Sorry, I should have been more clear. AjaxFeedbackUpdater is a class in my
sample project that implements AjaxRequestTarget.IListener . In its
onBeforeRespond method, I add components to the AjaxRequestTarget. I tried
adding focusComponent(null), but no luck.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxFormComponentUpdatingBehavior-target-addComponent-component-causes-to-lose-focus-tp3700530p3701266.html
Sent from the Users forum mailing list archive at Nabble.com.

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



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

2011-07-28 Thread Michael O'Cleirigh

Hi Jeremy,

I think the most important things a wicket programmer should know relate 
to building their own set of resuable components.Here are my top ten 
on that theme:


1. Build a reusable set of components tailored for your business domain.

2.  Solve a few problems then push up the common functionality into an 
AbstractBaseComponent class where the other uses are subclasses.


3. Or externalize the component setup choices through an interface and 
keep the class non-abstract.  Then the callers  setup an implementation 
of the interface for each case.  The interface would control things like 
show/hide on no results or enable/disable certain fields, basically any 
choice that is useful to externalize.


4. Understand how extending FormComponentPanelBusinessObject can hide 
complexity and provide improved form validation options.


e.g.  We have a query application and the form builds the Task to be 
executed.  We have a filter that contains ListVariableFilterfilters 
and each Variable Fitler is itself a ListStringoptionsList.


Creating a custom Form component at each layer we can be assured that 
the complicated elements at each level have been validated properly 
before the task is submitted.  Since the top level submit need only deal 
with the objects being assembled into the task, their internals are 
assured to be valid.


5. convertInput needs to setConvertedInput(new BusinessObject()) and 
this is what the validators run against.  Only when they pass does the 
modelObject = convertedInput.


6. Build separate class files for custom Models and Columns (no dynamic 
inner classes) since any IDE can easily handle the separation and 
because having them separate enables more reuse.


7. Know how repeaters like ListView and DataTable work and internalize 
them within your own panels to hide their complexity from the callers of 
your panel.


8.  Know how to emit javascript to the browser both as one off and in 
terms of a custom DOM object for your application.  Especially important 
is how to write this javascript so that it will scale.  i.e. the panel 
can be used more than once per page.


9.  Understand wicket serialization, typically with the experience of 
having your spring container with some big data store write out to disk 
on each page change.  A versioned page with ajax and this case is the 
most fun.  And how @SpringBean creates serializable proxies that prevent 
this.  But also how getting an inner object from the @SpringBean proxy 
will leave you open to the same cascading serialization issue.


10.  Understand how to layer models to traverse the BusinessObject graph 
to access certain fields.  Don't use PropertyModels in production 
instead layer models to access the fields of interest.


e.g. new BusinessAccountModel (IModelBusinessAccountbackingModel, 
Type.ACCT_NUMBER) to create the get/set pair for the account number from 
the backing model.  I can image the backing model being a 
LoadableDetachableModelBusinessAccount() that loads the account data 
from the database.


See: 
https://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-WrappedObjectModels


Regards,

Mike




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



NullPointerException and don't know why ...

2011-07-28 Thread armandoxxx
Hi guys got a problem with NPE 

I'm having using Kaptcha for drawing captcha ..  



public class CaptchaImage extends NonCachingImage {
 
private static final long serialVersionUID = 1667766853896645923L;

private transient DefaultKaptcha captchaProducer= new 
DefaultKaptcha();

// private DefaultKaptcha captchaProducer;
public CaptchaImage(String id) {
super(id);

captchaProducer.setConfig(new Config(new Properties()));

setImageResource(new DynamicImageResource() {

private static final long serialVersionUID = 
-3696927797622999885L;


public byte[] getImageData() {
ByteArrayOutputStream os = new 
ByteArrayOutputStream();

// write the data out
ImageIO.setUseCache(false);

try {
BufferedImage bi = 
getImageCaptchaService();
ImageIO.write(bi, jpg, os);
return os.toByteArray();
} catch (Exception e) {
throw new RuntimeException(e);
}
};


private BufferedImage getImageCaptchaService() {
Request request = 
RequestCycle.get().getRequest();
HttpServletRequest httpRequest = ((WebRequest)
request).getHttpServletRequest();
String capText = captchaProducer.createText();
// store the text in the session

httpRequest.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY,
capText);
// create the image with the text
BufferedImage bi = 
captchaProducer.createImage(capText);
return bi;
}
});
}
}



the problem is that I'm getting NPE on line: 

String capText = captchaProducer.createText();


and I can't figure out why ... 

can anybody help please ? 

Regards 

Armando


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/NullPointerException-and-don-t-know-why-tp3701404p3701404.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: NullPointerException and don't know why ...

2011-07-28 Thread Martin Grigorov
Because it is transient and after deserialization it will be null.

On Thu, Jul 28, 2011 at 5:07 PM, armandoxxx armando@dropchop.com wrote:
 Hi guys got a problem with NPE

 I'm having using Kaptcha for drawing captcha ..



 public class CaptchaImage extends NonCachingImage {

        private static final long serialVersionUID = 1667766853896645923L;

        private transient DefaultKaptcha captchaProducer        = new 
 DefaultKaptcha();

        // private DefaultKaptcha captchaProducer;
        public CaptchaImage(String id) {
                super(id);

                captchaProducer.setConfig(new Config(new Properties()));

                setImageResource(new DynamicImageResource() {

                        private static final long serialVersionUID = 
 -3696927797622999885L;


                        public byte[] getImageData() {
                                ByteArrayOutputStream os = new 
 ByteArrayOutputStream();

                                // write the data out
                                ImageIO.setUseCache(false);

                                try {
                                        BufferedImage bi = 
 getImageCaptchaService();
                                        ImageIO.write(bi, jpg, os);
                                        return os.toByteArray();
                                } catch (Exception e) {
                                        throw new RuntimeException(e);
                                }
                        };


                        private BufferedImage getImageCaptchaService() {
                                Request request = 
 RequestCycle.get().getRequest();
                                HttpServletRequest httpRequest = ((WebRequest)
 request).getHttpServletRequest();
                                String capText = captchaProducer.createText();
                                // store the text in the session
                                
 httpRequest.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY,
 capText);
                                // create the image with the text
                                BufferedImage bi = 
 captchaProducer.createImage(capText);
                                return bi;
                        }
                });
        }
 }



 the problem is that I'm getting NPE on line:

 String capText = captchaProducer.createText();


 and I can't figure out why ...

 can anybody help please ?

 Regards

 Armando


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/NullPointerException-and-don-t-know-why-tp3701404p3701404.html
 Sent from the Users forum mailing list archive at Nabble.com.

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





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


Re: NullPointerException and don't know why ...

2011-07-28 Thread armandoxxx
thank you ! 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/NullPointerException-and-don-t-know-why-tp3701404p3701481.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: A safer way to build PropertyModels, version 1.2

2011-07-28 Thread Matt Brictson
On Jul 28, 2011, at 3:12 AM, Carl-Eric Menzel wrote:

 IModelUser userModel = model(fromService(userEJB.loadUser(42)));

Not sure if this is a typo in your example, but wouldn't this mean that (the 
real, non-proxied) userEJB.loadUser is invoked when the model is constructed? 
Perhaps this syntax is correct:

model(fromService(userEJB).loadUser(42));


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



resource file handle issues on windows?

2011-07-28 Thread rush66
Greetings,  

We are in the process of migrating our project to 1.5 and have discovered an
issue with editing CSS and JS files with the app serve running. We're
curious if there is anyone else experiencing similar issues.   We are
working on Win7 with eclipse running Jboss 5 locally with wicket 1.5.  

The issue is that when the server is running and editing a JS or CSS file
that is referenced via the renderHead method saved changes are not copied by
eclipse to the output directory.  It logs a warning to the console  
WARN  [UrlResourceStream] getLastModified for file:/C:/path to project/path
to component or panel.html/  

It does so for every panel or component html file that was present on the
page that was open in the browser where you were editing the CSS or JS on
the page.  

It appears that there are still file handles open by wicket or jboss when
that happens. Eclipse is not able to build the project after this because if
can't delete the jar file that the opened files are in so it takes a project
clean and server restart to get things going again.  

Has anyone else who is developing on windows seen similar issues with
editing CSS or JS with the app server running or any other ideas as to what
might be the cause?







--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/resource-file-handle-issues-on-windows-tp3701938p3701938.html
Sent from the Users forum mailing list archive at Nabble.com.

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



What does this syntax say?

2011-07-28 Thread Niranjan Rao
Ok, I admit it - I don't understand this function at all defined in 
IComponentInheritedModel


public W IWrapModelW wrapOnInheritance(Component component)

I don't understand meaning of W and IWrapModelW. I know generics 
generally, but this syntax has been baffling me. Based on what eclipse 
is trying to do, it seems like it will return IWrapModelW, but then 
what does first W do? I tried some google searches, but could not find 
the answer.


Thanks,

Niranjan

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



Sometimes a long time to construct page with tabs

2011-07-28 Thread coincoinfou
Sometimes it takes a long time to construct my page

She looks like this :

LoadableDetachableModel myObject = new LoadableDetachableModel(String id)
{
String id;

LoadableDetachableModel(String id) {
this.id = id;
}

  protected Object load() {
 return getDao().getMyObject();
  }
};

public Page extends Papage {


  LoadableDetachableModel myObject = new LoadableDetachableModel(id);
  
   List tabs=new ArrayList();
tabs.add(new AbstractTab(new Model(panel1)) {
public Panel getPanel(String panelId) { return new MyPanel1((Child1)
myObject.getChild1(); }
});
tabs.add(new AbstractTab(new Model(panel2)) {
public Panel getPanel(String panelId) { return new MyPanel2(Child2)
myObject.getChild2(); }
});
tabs.add(new AbstractTab(new Model(panel3)) {
public Panel getPanel(String panelId) { return new MyPanel3(Child3)
myObject.getChild3(); }
});



add(new TabbedPanel(tabs, tabs)

}

and my panels x10

class MyPanel extends Panel
{

public MyPanel(Child1 child1)
{
super(id);
add(new Label(label, child1.getChild1Ofchild1)) { 
override
isvisible() {
return child1 != null  !child1.isEmpty) {
} 

add(new Label(label2, child1.getChild2Ofchild1)) {
override
isvisible() {
return child1 != null  !child1.isEmpty) {
} 




}
}

Sometimes it takes 20ms, somtimes 5s, sometimes 50s
What can explain this behaviour ?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Sometimes-a-long-time-to-construct-page-with-tabs-tp3701969p3701969.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: What does this syntax say?

2011-07-28 Thread Bas Gooren

This syntax is for use when you need a generic placeholder.

In this case, it means that W is determined by the call site:

IModelBusinessObject model = OtherModel.wrapOnInheritance( Component );

The above means that W is checked to be BusinessObject for all 
occurrences of W.


A better to understand example is to have a look at 
java.util.Collections, eg: addAll 
http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#addAll%28java.util.Collection,%20T...%29

It's signature is:

static T boolean addAll( Collection? super T c, T... elements);

Which means: you can only add elements of the generic type constraining 
the collection (e.g. only add String elements to a CollectionString).


Hope this helps!

Bas

Op 28-7-2011 19:48, schreef Niranjan Rao:
Ok, I admit it - I don't understand this function at all defined in 
IComponentInheritedModel


public W IWrapModelW wrapOnInheritance(Component component)

I don't understand meaning of W and IWrapModelW. I know generics 
generally, but this syntax has been baffling me. Based on what eclipse 
is trying to do, it seems like it will return IWrapModelW, but then 
what does first W do? I tried some google searches, but could not 
find the answer.


Thanks,

Niranjan

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



Re: What does this syntax say?

2011-07-28 Thread Dan Retzlaff
The first W let's the compiler know that the second W is a generic type
and not a reference to some class named W. It's just syntax.

On Thu, Jul 28, 2011 at 10:48 AM, Niranjan Rao nhr...@gmail.com wrote:

 Ok, I admit it - I don't understand this function at all defined in
 IComponentInheritedModel

 public W IWrapModelW wrapOnInheritance(Component component)

 I don't understand meaning of W and IWrapModelW. I know generics
 generally, but this syntax has been baffling me. Based on what eclipse is
 trying to do, it seems like it will return IWrapModelW, but then what does
 first W do? I tried some google searches, but could not find the answer.

 Thanks,

 Niranjan

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




Re: A safer way to build PropertyModels, version 1.2

2011-07-28 Thread Carl-Eric Menzel
On Thu, 28 Jul 2011 09:04:31 -0700
Matt Brictson m...@55minutes.com wrote:

 On Jul 28, 2011, at 3:12 AM, Carl-Eric Menzel wrote:
 
  IModelUser userModel = model(fromService(userEJB.loadUser(42)));
 
 Not sure if this is a typo in your example, but wouldn't this mean
 that (the real, non-proxied) userEJB.loadUser is invoked when the
 model is constructed? Perhaps this syntax is correct:
 
 model(fromService(userEJB).loadUser(42));

You are correct on both counts. That was a typo in my example. I fixed
it on the github page now.

Thanks
Carl-Eric
www.wicketbuch.de

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



Re: DropDownChoice updates onchange event.

2011-07-28 Thread Archana
The savedReportsDropDownList Arraylist contains a collection of
SelectedTrackProfileVO. trackingProfileVO is a type of TrackingProfileVO,
which contains the selected object which is of type SelectedTrackProfileVO.
profileDropDown is of type SelectedTrackProfileVO. TrackingProfileVO is
added to the form.

-
Thanks  Regards,
Archana
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-updates-onchange-event-tp3699271p3702308.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: What does this syntax say?

2011-07-28 Thread Ben Tilford
Without a Class argument how is it returning/casting correctly? Shouldn't it
be

public W IWrapModelW wrapOnInheritance(Component component,ClassW
type)

to make W available within the method?


On Thu, Jul 28, 2011 at 12:40 PM, Dan Retzlaff dretzl...@gmail.com wrote:

 The first W let's the compiler know that the second W is a generic type
 and not a reference to some class named W. It's just syntax.

 On Thu, Jul 28, 2011 at 10:48 AM, Niranjan Rao nhr...@gmail.com wrote:

  Ok, I admit it - I don't understand this function at all defined in
  IComponentInheritedModel
 
  public W IWrapModelW wrapOnInheritance(Component component)
 
  I don't understand meaning of W and IWrapModelW. I know generics
  generally, but this syntax has been baffling me. Based on what eclipse is
  trying to do, it seems like it will return IWrapModelW, but then what
 does
  first W do? I tried some google searches, but could not find the
 answer.
 
  Thanks,
 
  Niranjan
 
  --**--**-
  To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org
 users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 



Re: What does this syntax say?

2011-07-28 Thread Dan Retzlaff
Generic types are lost by the time the method is executed, so there's really
nothing the method implementation could check. Another fun example
is org.apache.wicket.model.Model#of(). The general subject is called type
erasure, and is one of the more confusing aspects of Java generics.

On Thu, Jul 28, 2011 at 4:45 PM, Ben Tilford b...@tilford.info wrote:

 Without a Class argument how is it returning/casting correctly? Shouldn't
 it
 be

 public W IWrapModelW wrapOnInheritance(Component component,ClassW
 type)

 to make W available within the method?


 On Thu, Jul 28, 2011 at 12:40 PM, Dan Retzlaff dretzl...@gmail.com
 wrote:

  The first W let's the compiler know that the second W is a generic
 type
  and not a reference to some class named W. It's just syntax.
 
  On Thu, Jul 28, 2011 at 10:48 AM, Niranjan Rao nhr...@gmail.com wrote:
 
   Ok, I admit it - I don't understand this function at all defined in
   IComponentInheritedModel
  
   public W IWrapModelW wrapOnInheritance(Component component)
  
   I don't understand meaning of W and IWrapModelW. I know generics
   generally, but this syntax has been baffling me. Based on what eclipse
 is
   trying to do, it seems like it will return IWrapModelW, but then what
  does
   first W do? I tried some google searches, but could not find the
  answer.
  
   Thanks,
  
   Niranjan
  
  
 --**--**-
   To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org
  users-unsubscr...@wicket.apache.org
   For additional commands, e-mail: users-h...@wicket.apache.org
  
  
 



getInput and getDefaultModelObject and validation

2011-07-28 Thread Brown, Berlin [GCG-PFS]
If I am using some form validator, I notice that getDefaultModelObject
does not have the value from the getInput.  I am assume this
intentional.  Is there a way to force wicket to update the modelObject?
How and when does the modelobject get updated.
 
 
myForm.add(new AbstractFormValidator() {
 
   public void validate() {
 
   String val = component.getInput();  --- has the correct value
from the request 
   String val2 = component.getModelObject();   does not have
value.
   }
 
});
...
 
In the case above, I could use the proper ajaxbehavior (like onBlur on a
textfield) and the modelObject gets updated.
 
But if I weren't using ajax, is there a way to force wicket to update
the modelObject.


Re: What does this syntax say?

2011-07-28 Thread Ben Tilford
Right but Model.of accepts an instance of the generic type so it's not lost
and is available at runtime.

static ModelT of(T instance)
vs.
public W IWrapModelW wrapOnInheritance(Component component)

On Thu, Jul 28, 2011 at 6:33 PM, Dan Retzlaff dretzl...@gmail.com wrote:

 Generic types are lost by the time the method is executed, so there's
 really
 nothing the method implementation could check. Another fun example
 is org.apache.wicket.model.Model#of(). The general subject is called type
 erasure, and is one of the more confusing aspects of Java generics.

 On Thu, Jul 28, 2011 at 4:45 PM, Ben Tilford b...@tilford.info wrote:

  Without a Class argument how is it returning/casting correctly? Shouldn't
  it
  be
 
  public W IWrapModelW wrapOnInheritance(Component component,ClassW
  type)
 
  to make W available within the method?
 
 
  On Thu, Jul 28, 2011 at 12:40 PM, Dan Retzlaff dretzl...@gmail.com
  wrote:
 
   The first W let's the compiler know that the second W is a generic
  type
   and not a reference to some class named W. It's just syntax.
  
   On Thu, Jul 28, 2011 at 10:48 AM, Niranjan Rao nhr...@gmail.com
 wrote:
  
Ok, I admit it - I don't understand this function at all defined in
IComponentInheritedModel
   
public W IWrapModelW wrapOnInheritance(Component component)
   
I don't understand meaning of W and IWrapModelW. I know generics
generally, but this syntax has been baffling me. Based on what
 eclipse
  is
trying to do, it seems like it will return IWrapModelW, but then
 what
   does
first W do? I tried some google searches, but could not find the
   answer.
   
Thanks,
   
Niranjan
   
   
  --**--**-
To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org
   users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
   
   
  
 



Ajax broken in IE 8

2011-07-28 Thread T P D
Wicket 1.4.9's Ajax doesn't work in Internet Explorer; in particular, 
AjaxFallbackButtons fall back to non-Ajax POSTs, and the Wicket Debug 
window is never seen.


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


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


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



Re: What does this syntax say?

2011-07-28 Thread Dan Retzlaff
I actually meant the no-argument version of of(). Since this is getting
off-topic, I suggest you search around under java type erasure. There are
people far more expert than I to describe what's going on. :)

On Thu, Jul 28, 2011 at 9:26 PM, Ben Tilford b...@tilford.info wrote:

 Right but Model.of accepts an instance of the generic type so it's not lost
 and is available at runtime.

 static ModelT of(T instance)
 vs.
 public W IWrapModelW wrapOnInheritance(Component component)

 On Thu, Jul 28, 2011 at 6:33 PM, Dan Retzlaff dretzl...@gmail.com wrote:

  Generic types are lost by the time the method is executed, so there's
  really
  nothing the method implementation could check. Another fun example
  is org.apache.wicket.model.Model#of(). The general subject is called type
  erasure, and is one of the more confusing aspects of Java generics.
 
  On Thu, Jul 28, 2011 at 4:45 PM, Ben Tilford b...@tilford.info wrote:
 
   Without a Class argument how is it returning/casting correctly?
 Shouldn't
   it
   be
  
   public W IWrapModelW wrapOnInheritance(Component component,ClassW
   type)
  
   to make W available within the method?
  
  
   On Thu, Jul 28, 2011 at 12:40 PM, Dan Retzlaff dretzl...@gmail.com
   wrote:
  
The first W let's the compiler know that the second W is a
 generic
   type
and not a reference to some class named W. It's just syntax.
   
On Thu, Jul 28, 2011 at 10:48 AM, Niranjan Rao nhr...@gmail.com
  wrote:
   
 Ok, I admit it - I don't understand this function at all defined in
 IComponentInheritedModel

 public W IWrapModelW wrapOnInheritance(Component component)

 I don't understand meaning of W and IWrapModelW. I know
 generics
 generally, but this syntax has been baffling me. Based on what
  eclipse
   is
 trying to do, it seems like it will return IWrapModelW, but then
  what
does
 first W do? I tried some google searches, but could not find the
answer.

 Thanks,

 Niranjan


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