Re: igor's select2 script

2012-05-13 Thread Emmanouil Batsis (Manos)

On 05/13/2012 05:45 PM, Uwe Schäfer wrote:

On 05/09/2012 09:23 PM, Dan Retzlaff wrote:

Here you go, Uwe (and all): https://github.com/dretzlaff/wicket-select2



thanks a lot. i'll provide feedback as soon as i have tweaked it work
with 1.4.


pls share that when you do, wanted to have a go but haven't managed to 
get the time...


Manos

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



Lessons from Wicket Cookbook

2012-05-13 Thread Clint Checketts
While clearing out my drafts folder I found this.  While reading through
the Wicket cookbook by Igor (
http://www.packtpub.com/apache-wicket-cookbook/book) I noticed that I was
learning a ton of new interesting stuff about the Wicket way of doing
things, so I kept notes.

This draft is from over a year ago (Mar 2011), but the information is still
accurate for the book.* I highly recommend this book.*

-Clint


   - Form override onValidate input.getConvetedInput() gets value before
   its been stored in the input's model pg 11
   - Single validator displaying multiple messages: pg 16
   - Better way to set custom variables for error messages: pg 17
   (error.setVariable("max", max);)
   - FormComponents automatically know how to convert to the model object
   because the implement IObjectClassAwareModel, otherwise
   formField.setType(Class) is required pg 31
   - DropDownChoice wantOnSelectionChange (pg 38) makes a select box
   autosubmitting
   -  (pg 42)  is the same as adding a component to a
   div and calling setRenderBodyOnly(true)
   - getConvertedInput can return a new instance of an object, and in
   updateModel you would copy the values over into the existing object, if you
   wanted to update the existing object (pg 45), be sure not to call
   super.updateModel() though
   - We can use Wicket's metadata facility to store data in the Wicket
   session without forcing a specific sub-class of session (pg 52)
   - aTextField.clearInput() forces a value="" on a text field ensuring
   that it is blanked out even if the user had typed something before (pg 57)
   Validation failure would otherwise retain the value and keep displaying it.
   - The AttributeAppender behavior doesn't allow for the replace model to
   be set after the constructor, and getReplaceModel is final so the
   implementation as listed on pg 62 is the best way to update a
   FormComponent's class when checking isValid()
   - Page 64 - remember to add form.visitChildren calls after all children
   have been added to the form.  Making the call in onInitialize isn't wise
   since that call actually happens as part of the 'add()' call in it's parent!
   - Question: Would separate components in separate app sessions cause
   feedback messages in each other's pages? pg 71
   - IAjaxRegionMarkupIdProvider can be used with a behavior to clean up
   extra surrounding markup around components pg 74
   - Example using MicroMap (map that holds a single value and is populated
   in its constructor, and MiniMap) and the Model.ofMap() factory usage,
   finally using getString("keyInPropFile",mapmodel) for manually getting a
   property message and displaying it. pg82


Feedback panel inside form

2012-05-13 Thread Chris Colman
Every example of feedback panel I have seen places the feedback panel
outside the form element.
 
I have some markup from a client that has some Javascript doing client
side validation with a styled feedback panel (a div) inside the form
element itself.
 
Is it only convention that sees most Wicket samples having the feedback
panel outside the form? i.e. can Wicket use a feedback panel that is
actually inside the form? 
 
 
Yours sincerely,
 
Chris Colman
 
Pagebloom Team Leader,
Step Ahead Software

 
pagebloom - your business & your website growing together
 
Sydney: (+61 2) 9656 1278 Canberra: (+61 2) 6100 2120 
Email: chr...@stepahead.com.au  
Website:
http://www.pagebloom.com http://www.pagebloom.com/> 
http://develop.stepaheadsoftware.com
http://develop.stepaheadsoftware.com/> 
 
 


Re: Wicket architecture diagram?

2012-05-13 Thread infiniter
So, we are in 2012 now. Anyone has any diagram accurate enough to show in a
meeting? I'm looking for Wicket 1.4, but any other version can be useful
too.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-architecture-diagram-tp1884376p4631021.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread James Carman
Use the source, Luke!  The code is hosted at github currently.

https://github.com/jwcarman/Wicketopia
On May 13, 2012 1:07 PM, "Tom Eugelink"  wrote:

> Where? I get almost empty pages.
>
>
>   About Wicketopia Example Application
>
> A Rapid Application Development (RAD) library for the Apache Wicket
> framework
>
>
>
>
> On 2012-05-13 18:44, James Carman wrote:
>
>> There is a sample application by the way. It'll give you a good idea of
>> the
>> capabilities.
>> On May 13, 2012 12:18 PM, "James 
>> Carman"
>> >
>> wrote:
>>
>>  Patches and contributions are welcome.
>>> On May 13, 2012 10:55 AM, "Tom Eugelink"  wrote:
>>>
>>>  On 2012-05-13 13:49, James Carman wrote:

  If your application is that simple, check out Wicketopia.
>
>  Always interesting, but the information (http://wicketopia.**
 sourceforge.net/>)
 is, ah, lacking?
  :-)

 Tom


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



>


Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread Tom Eugelink

Where? I get almost empty pages.


   About Wicketopia Example Application

A Rapid Application Development (RAD) library for the Apache Wicket framework




On 2012-05-13 18:44, James Carman wrote:

There is a sample application by the way. It'll give you a good idea of the
capabilities.
On May 13, 2012 12:18 PM, "James Carman"
wrote:


Patches and contributions are welcome.
On May 13, 2012 10:55 AM, "Tom Eugelink"  wrote:


On 2012-05-13 13:49, James Carman wrote:


If your application is that simple, check out Wicketopia.


Always interesting, but the information (http://wicketopia.**
sourceforge.net/) is, ah, lacking?
  :-)

Tom


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






Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread James Carman
There is a sample application by the way. It'll give you a good idea of the
capabilities.
On May 13, 2012 12:18 PM, "James Carman" 
wrote:

> Patches and contributions are welcome.
> On May 13, 2012 10:55 AM, "Tom Eugelink"  wrote:
>
>>
>> On 2012-05-13 13:49, James Carman wrote:
>>
>>> If your application is that simple, check out Wicketopia.
>>>
>>
>> Always interesting, but the information (http://wicketopia.**
>> sourceforge.net/ ) is, ah, lacking?
>>  :-)
>>
>> Tom
>>
>>
>> --**--**-
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>


Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread James Carman
Patches and contributions are welcome.
On May 13, 2012 10:55 AM, "Tom Eugelink"  wrote:

>
> On 2012-05-13 13:49, James Carman wrote:
>
>> If your application is that simple, check out Wicketopia.
>>
>
> Always interesting, but the information (http://wicketopia.**
> sourceforge.net/ ) is, ah, lacking?
>  :-)
>
> Tom
>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread Tom Eugelink


On 2012-05-13 13:49, James Carman wrote:

If your application is that simple, check out Wicketopia.


Always interesting, but the information (http://wicketopia.sourceforge.net/) 
is, ah, lacking?  :-)

Tom


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



Re: igor's select2 script

2012-05-13 Thread Uwe Schäfer

On 05/09/2012 09:23 PM, Dan Retzlaff wrote:

Here you go, Uwe (and all): https://github.com/dretzlaff/wicket-select2



thanks a lot. i'll provide feedback as soon as i have tweaked it work 
with 1.4.

from the API it looks nice.

cu uwe


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



Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread James Carman
On Sun, May 13, 2012 at 7:19 AM, hfriederichs  wrote:
> Tom,
>
> I couldn't agree more, you hit the spot. Indeed it's all about balance,
> don't over- (nor under-)architecture things. My application will be used by
> maybe 5 people, and requires some very simple CRUD-implemetations on a
> database table with maybe 100 rows (eventually).

If your application is that simple, check out Wicketopia.  It might be
able to do a lot of what you need out of the box.

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



Re: Wicket and JPA: please a simple way to go

2012-05-13 Thread hfriederichs
Tom,

I couldn't agree more, you hit the spot. Indeed it's all about balance,
don't over- (nor under-)architecture things. My application will be used by
maybe 5 people, and requires some very simple CRUD-implemetations on a
database table with maybe 100 rows (eventually).

Here's what I will do: stick the EntityManagerFactory in the
WicketApplication's subclass as Igor suggested (OK, without injection, but
never use injection for injection's sake); same goes for UserTransactions
for the CUD-part; make a DatabaseFacadeThing with all the necessary actions;
that thing uses the WicketApplication's subclass and will be used by the
Wicket components when needed. As a matter of fact, I already did make it,
and it works fine. And there's only the JPA-obligatory persistence.xml, no
other configs, components, and whatsoever.

Igor, thanks again for your 'dry swum code sample'. Btw: em.close() is not
allowed in a container-managed entity manager (JPA 5.9.1).

For all the other suggestions (not JPA): thank you, I will look at them,
just out of curiosity, because my 
company is a big, fat, obese insurance company, and big, fat, obese
creatures don't move a lot and don't like to move.
So it is JPA, and it will be so for ever and ever, in line with the
company's daily definition of 'ever and ever'.

Regards, Hans

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630326.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



dropdown and values added with jquery

2012-05-13 Thread Michael Jaruska

Hi,

in my Page (not relevant code removed for simplicity) is dropdown:
public class MyPage extends WebBase{
//perie
private Model modelPerie;
//two values in dropdown:
private List perie = Arrays.asList(new Perie("start", "-Vyberte druh peří-"), new 
Perie("vsypek", "nové 806"));
private DropDownChoice vyberPeria;
private ChoiceRendererPerie rendererPerie;
public PageEshop(){
this.rendererPerie = new ChoiceRendererPerie();
this.modelPerie = new Model(this.perie.get(0));
this.vyberPeria = new DropDownChoice("vyberPeria", 
this.modelPerie, this.perie, this.rendererPerie);
MyForm form = new MyForm("inputForm");
form.add(vyberPeria);
this.add(form);
}

private class MyForm extends Form{
public MyForm(String id){
super(id);
}

@Override
protected void onSubmit(){
//with value added with jquery this produce error

System.out.println(PageEshop.this.modelPerie.getObject().getHodnota());
}
}
}

and in relevant markup I add new choice in this dropdown with jquery:


Typ peří:



jQuery(document).ready(
function()
{
//-->this add another value into dropdown, now there are three 
values:

$('#2').append($('').val('testkluc').html('testovaci text'));
})



Of course, when I select this added value ('testkluc') in dropdown and submit 
it, from onSubmit() I try to do something with this, I get error:
...
java.lang.reflect.InvocationTargetException
...PageEshop$MyForm.onSubmit(...

Yes, I know that this third value isn't in model so error is predictable. 
Question is: how to deal with situation when I need
add new value in HTML and this value isn't in my model in java?

Thanks,

MJ

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



Re: problem with ChoiceRenderer

2012-05-13 Thread Michael Jaruska



On 11.5.2012 12:21, Andrea Del Bene wrote:

Hi,

the type of the model and of the renderer must be the same chosen for the 
DropDownChoice (Vyrobok in your case). In the first version of your code this 
was not
true for your model because it pointed to a String field (named "kluc").
Your second version works fine because you don't provide a property expression 
to PropertyModel (is null) and doing so the property model considers as model
object the first parameter of its constructor (defaultChoice in your case), 
which is an instance of class Vyrobok.
But at this point it does not make much sense to use a PropertyModel, you could 
substitute it with a Model class, like this:

Model.of(defaultChoice)

just now I have elaborated that this works:
DropDownChoice vyberVyrobku = new DropDownChoice("vyberVyrobku", 
new PropertyModel(defaultChoice, null), vyrobky, renderer);
(note `null' in PropertyModel)

but strange is that I don't know why :-(

yes, now I see, mea culpa

thanks for pointing me this






On 11.5.2012 9:36, Sven Meier wrote:

Hi,

Vyrobok defaultChoice = vyrobky.get(0);
DropDownChoice vyberVyrobku =
new DropDownChoice(
"zoznam",
new PropertyModel(defaultChoice, "kluc"),
vyrobky,
renderer);

you're instructing the DropDownChoice to get its model object from your 
defaultChoice:

new PropertyModel(defaultChoice, "kluc")

This is probably not what you've intended as Kluc is a String. Something like 
the following would make more sense:

this.selectedChoice = vyrobky.get(0);

new PropertyModel(this, "selectedChoice")

Sven

On 05/11/2012 09:16 AM, Michael Jaruska wrote:

Hi folks,

after hours of elaborating, searching docu and trying I'm totaly lost. My 
ChoiceRenderer is not
working.

Here is my code (not relevant code has been removed):

markup:


page implementation:
public class PageEshop extends PageBase{
public PageEshop(){
ChoiceRendererVyrobok renderer = new ChoiceRendererVyrobok();
List vyrobky = Arrays.asList(new Vyrobok("start", "-Vyberte typ-"), new Vyrobok("polstar", 
"Polštář"), new Vyrobok("deka", "Deka"));
Vyrobok defaultChoice = vyrobky.get(0);
DropDownChoice vyberVyrobku = new DropDownChoice("zoznam", new 
PropertyModel(defaultChoice, "kluc"), vyrobky, renderer);
Form form = new Form("inputForm");
form.add(vyberVyrobku);
this.add(form);
}
}

pojo:
public class Vyrobok implements Serializable{
private String kluc;
private String hodnota;

public Vyrobok(String kluc, String hodnota){
this.kluc = kluc;
this.hodnota = hodnota;
}
//getters and setters for attributes
}

IChoiceRenderer implementation:
public class ChoiceRendererVyrobok implements IChoiceRenderer{
@Override
public Object getDisplayValue(Vyrobok vyrobok){
return vyrobok.getHodnota();
}

@Override
public String getIdValue(Vyrobok vyrobok, int index){
return vyrobok.getKluc();
}
}

When page is loaded, this error happens (not complete stack, not relevant 
removed):
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to 
cz.polstareadeky.utils.Vyrobok
at 
cz.polstareadeky.ChoiceRendererVyrobok.getIdValue(ChoiceRendererVyrobok.java:1)
at 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice.getModelValue(AbstractSingleSelectChoice.java:194)
at 
org.apache.wicket.markup.html.form.FormComponent.getValue(FormComponent.java:837)

Something is wrong in ChoiceRendererVyrobok but I can't find what..

Any help is apreciated,

thanks, Michal

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




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



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




-
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: Wicket and JPA: please a simple way to go

2012-05-13 Thread Tom Eugelink


Chiming in;

As it happens I'm currently working on a NoSQL (Cassandra) project and found a 
JPA implementation for Cassandra (http://code.google.com/p/kundera/). Currently 
JPA is the most used persistency API in Java, allowing for binding with RDBMS, 
XML, NoSQL. I decided not to use it, BTW, but that is because of other 
considerations.

To also have an quick opinion on the rest of the thread (as I understand it). Java 
projects have a tendency to over complicate and bloat. For example, wicket convention 
dictates that all labels should be put in property files. I decided not to do that. I 
fully understand the advantages, but for this project I'm simply not going to add an 
additional label component and a property file just to get "Name" on the 
screen. Yes, if it must be internationalized I have to rework my code, but as it stands 
the application probably won't have to be, and I would have added the abstraction for 
nothing.

Same goes for the 6 line JPA example a few posts back. If it works, great, just 
use it as is. Why make it more complex from the start? Refactor if you need to, 
not overarchitecture in advance.

I found that this pragmatic style (mind you; it's all a balance, you can't skip every corner), usually 
delivers results "PHP style" fast, but still has "Java quality" architecture in the 
overall setup. And even with all refactoring counted in, it stays well within budget; I'm currently aiming to 
complete my project in 75% of the "Java architecture" estimate. ;-)

Coming full circle; one of the corners you can't cut is clear separation of 
concern. So extracting the model (JPA) from the presentation (wicket) is very 
important.

My 2 euro cents. And thanks for a well though through framework, I'm warming up 
to it.

Tom


On 2012-05-13 09:51, dhar...@yahoo.com wrote:

Has your company heard of NOSQL?





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



Re: onComponentTag tag#setName() and checkComponentTag(tag, "input")

2012-05-13 Thread Martin Grigorov
Hi,

I'm not 100% sure but I think this check is even in 1.4.x.
TextField is quite simple. It provides code only for #onComponentTag() method.
You better extend AbstractTextComponent for your case. It is the
parent of TextField and TextArea components.

On Sat, May 12, 2012 at 4:38 PM, Arthur H.  wrote:
> Hi,
>
> I have a subclass if TextField which handles if the field should be
> rendered as textarea or simple input field:
>
> @Override
>        protected void onComponentTag(final ComponentTag tag) {
>                if ( multiline ) {
>                        tag.setName( "textarea" );
>                }
>                else {
>                        tag.put("value", getValue());
>                        tag.setName( "input" );
>                }
>                super.onComponentTag( tag );
>        }
>
> This doesn't work any more since the upgrade to wicket 1.5, because
> onComponentTag(tag) of TextField.java checks for hardcoded "input"
> tag: checkComponentTag(tag, "input");
>
> Is this behavior intended? Unfortunately this causes some headache in
> my application.
>
> Regards,
> Arthur
>
> -
> 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: Wicket and JPA: please a simple way to go

2012-05-13 Thread dhar_ar
Has your company heard of NOSQL?

JPA is a standard and I agree with most of it, but there are times when good ol 
iBatis is more straight forward.

Looking at the future there are non RDBMS related databases; JPA is the way to 
go depending on where you are going.

For a community building a framework, they have to consider the community and 
not just a single line of thought. 

If you still feel that a single stack of technologies that provides a 360 
degree coverage. Check out "PLAY" !

They have re invented the paridgm and are ready to even discard the servlet 
specification (or make it optional)

I don't like that aspect of Play, but looks like you may enjoy it more. Its 
nice for that I could critcize it.

Wicke ftw for the rest.
Good luck


Sent from BlackBerry® on Airtel

-Original Message-
From: hfriederichs 
Date: Sun, 13 May 2012 00:23:32 
To: 
Reply-To: users@wicket.apache.org
Subject: RE: Wicket and JPA: please a simple way to go

All standards are equal, but some (like JPA) are more equal than others,
that's what you mean?

Well, a short look at the history of computing shows that technologies with
obvious and proven qualities, 
unanimously supported by experts, sometimes still don't survive. Other
qualities are needed...

In my company, JPA is the way to go.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630088.html
Sent from the Users forum mailing list archive at Nabble.com.

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


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



RE: Wicket and JPA: please a simple way to go

2012-05-13 Thread hfriederichs
All standards are equal, but some (like JPA) are more equal than others,
that's what you mean?

Well, a short look at the history of computing shows that technologies with
obvious and proven qualities, 
unanimously supported by experts, sometimes still don't survive. Other
qualities are needed...

In my company, JPA is the way to go.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630088.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