Re: [Wicket-user] Using POJO as Model - is this right?

2005-12-27 Thread Joshua Lim
thanks ... should have thought of that! :) On 12/23/05, Maurice Marrink [EMAIL PROTECTED] wrote:
You could always use a different model (containing just the fileuploadobject) for the fileupload and the compoundmodel for the rest of theform. then in the onsubmit you could get both models set the blob onyour pojo and save it. this way you can keep your pojo clean.
Maurice2005/12/23, Joshua Lim [EMAIL PROTECTED]: Hi I have a question about using POJO as Models in wicket. BTW, love the framework ! I am using Hibernate 3 and Wicket 
1.1 I've got 2 POJO : Contestant -1:n- Design. I have a page which lets a Contestant uploads a bunch of images and each of these images are stored as Blobs in a database. Each image is a Design
 Here's the 'problem' I am setting Contestant object as the CompoundPropertyModel, which is ok. and everything is populated. I use a ListView to handle set of Designs within the form, and I have FileUploadField to handle image file uploads.
 The FileUploadField, however, will populate a FileUpload object which I had to add into my POJO, and onSubmit, I then populate my Bolb field... Question: Although it works, does this sound right in using my POJO as a
 Model? becuase I really don't like the idea of having to modify my POJO just to accommodate the wicket page, becasue I might have another page which may require a checkbox for e.g. for some other reasonand I have to modify my
 Pojo again? I would like to have a Pojo that is not dependant on the wicket page ... is this right? any advise? Am I using it correctly? Thanks Joshua
---This SF.net email is sponsored by: Splunk Inc. Do you grep through log filesfor problems?Stop!Download the new AJAX search engine that makes
searching your log files as easy as surfing theweb.DOWNLOAD SPLUNK!http://ads.osdn.com/?ad_idv37alloc_id865opclick___
Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user



Re: [Wicket-user] beginner: need clarification on use of anonymous inner classes

2005-12-27 Thread Martijn Dashorst
What you do here is quite harmless... The page is already in the
session (page map and all), so the extra reference to it doesn't hurt.
The problem comes when you attach a business object to your page:

/** Dont do this */
class MyPage extends WebPage {
 private MyVeryLargeObject subject;

 // 
 public MyPage() {
 // get my very large object from database
 subject = MyVeryLargeObjectDao.get();
 // ...
 form.add(new
TextField(name, new PropertyModel(MyPage.this,
some.very.large.navigational.structure.name));
 }
}

The 'subject' instance of the MyVeryLargeObjectDao class will be
serialized into the session with each page version. This can get out of
hand, because with some business object models, the attached object can
become very large. For this we introduced DetachableModels, which will
retrieve the data from the database when needed, and will clean up when
the data is not needed (at the end of the request for instance).

The other thing to be aware of is not anonymous subclasses of
component, but anonymous or nested instances of IModel. Usually you
share an instance of a model between two page instances. If you create
an anonymous or nested instance of IModel, then you automatically get a
'this' reference to the class that surrounds it. This will usually be
the page, but can also be the form or a listview. Anyway, because the
reference is /final/, you will copy that reference to the old page,
with the model to the new page, thus duplicating the component tree (it
gets versioned etc.). This will eventually lead to OutOfMemoryError.

Search in the mailinglist for outofmemoryerror for other descriptions
of this behaviour. I doubt that I have done the subject justice.

MartijnOn 12/26/05, karthik Guru [EMAIL PROTECTED] wrote:
Yesterday I ran into a wicket blog that does'nt recommend use of anonymous inner classes that refer to the contained page class?

I have my componentPropertyModelspointing to the contained page properties.

In the form onSubmit, i access the Page properties 

class LoginPage extends WebPage{

 LoginPage( ){
 add(new Form(form){
 onSubmit( ){
  System.out.println(LoginPage.this.name);
 }
}

So if my understand is correct, this programming pattern is not a wicket best practice?

thanks
karthik


-- Living a wicket life...Martijn Dashorst - http://www.jroller.com/page/dashorstWicket 1.1 is out: 
http://wicket.sourceforge.net/wicket-1.1


Re: [Wicket-user] Wiki update on 1.2 features?

2005-12-27 Thread Juergen Donnerstag
See http://www.wicket-wiki.org.uk/wiki/index.php/Migrate-1.2 and yes,
with the release of 1.2 we will provide a summary (bullet points) of
the changes.
Change log (always up to date):
http://cvs.sourceforge.net/viewcvs.py/wicket/wicket/xdocs/changes.xml?view=markup

Juergen


On 12/27/05, Gili [EMAIL PROTECTED] wrote:
 Hi,

 I haven't had time to scan the CVS changelogs in detail. Are there
 plans on post brief summaries of the new 1.2 features including path
 mount()ing and automatic component resolution (i.e. what changed, how to
 use them)?

 In the past, the team used to post brief summaries of new features to
 the wicket-user mailing list.

 Thank you,
 Gili
 --
 http://www.desktopbeautifier.com/


 ---
 This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
 for problems?  Stop!  Download the new AJAX search engine that makes
 searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
 http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] beginner: need clarification on use of anonymous inner classes

2005-12-27 Thread Alexandre Bairos
Added to the wiki at http://www.wicket-wiki.org.uk/wiki/index.php/Best_Practices_and_Gotchas#Wicket_Servlet_Mapping

regards
On 12/27/05, Martijn Dashorst [EMAIL PROTECTED] wrote:
What you do here is quite harmless... The page is already in the
session (page map and all), so the extra reference to it doesn't hurt.
The problem comes when you attach a business object to your page:

/** Dont do this */
class MyPage extends WebPage {
 private MyVeryLargeObject subject;

 // 
 public MyPage() {
 // get my very large object from database
 subject = MyVeryLargeObjectDao.get();
 // ...
 form.add(new
TextField(name, new PropertyModel(MyPage.this,
some.very.large.navigational.structure.name));
 }
}

The 'subject' instance of the MyVeryLargeObjectDao class will be
serialized into the session with each page version. This can get out of
hand, because with some business object models, the attached object can
become very large. For this we introduced DetachableModels, which will
retrieve the data from the database when needed, and will clean up when
the data is not needed (at the end of the request for instance).

The other thing to be aware of is not anonymous subclasses of
component, but anonymous or nested instances of IModel. Usually you
share an instance of a model between two page instances. If you create
an anonymous or nested instance of IModel, then you automatically get a
'this' reference to the class that surrounds it. This will usually be
the page, but can also be the form or a listview. Anyway, because the
reference is /final/, you will copy that reference to the old page,
with the model to the new page, thus duplicating the component tree (it
gets versioned etc.). This will eventually lead to OutOfMemoryError.

Search in the mailinglist for outofmemoryerror for other descriptions
of this behaviour. I doubt that I have done the subject justice.

MartijnOn 12/26/05, karthik Guru 
[EMAIL PROTECTED] wrote:
Yesterday I ran into a wicket blog that does'nt recommend use of anonymous inner classes that refer to the contained page class?

I have my componentPropertyModelspointing to the contained page properties.

In the form onSubmit, i access the Page properties 

class LoginPage extends WebPage{

 LoginPage( ){
 add(new Form(form){
 onSubmit( ){
  System.out.println(LoginPage.this.name);
 }
}

So if my understand is correct, this programming pattern is not a wicket best practice?

thanks
karthik


-- Living a wicket life...Martijn Dashorst - 
http://www.jroller.com/page/dashorstWicket 1.1 is out: 
http://wicket.sourceforge.net/wicket-1.1




Re: [Wicket-user] Component-Level AJAX Response

2005-12-27 Thread R.J. Lorimer
shh, of course. The response shouldn't just be the panel - it should be 
an entire Page! That makes sense.


Thanks for your help, I'll keep my progress posted here.

Emergence Dinterstage wrote:

On 12/28/05, R.J. Lorimer [EMAIL PROTECTED] wrote:
  

ComponentRequestTarget re-renders components which have already been
rendered during the full page render. We only recently fixed a bug to
allow Panel children to be re-rendered as well. Because you are
re-rendering a Panel that bug should not affect you, but because of
the change I'd still suggest to use cvs head.

  

This may be part of my problem - the component being passed in to the
handler has never been rendered before - part of the advantage of using
an additional click/AJAX is that I don't have to do the extra query
until the user asks for it. I was trying to achieve that by creating a
component that would be rendered for the first time when the AJAX
request was complete.



where is the components markup you try to render?

  

The core problem is that I have never rendered the component before, I
think. Is there a way to achieve this?



In order to render a Component it (the root component; not its
children) must know its associated markup. And the only way to achieve
it is to render the whole page first. To clarify it a little bit more.
You'll find a labels markup somewhere with a panel, border or page
markup file. To render this label the associated markup stream
position is required, which gets assigned during a page render phase.

  

Effectively, I want to send the
HTML result of my component render to the user on an AJAX bind call.



Ok, the response is XML and it has never been rendered before.
Actually it is like a page request which returns XML instead of HTML.
It is not a component re-render, it is whole new request.
Create a new Page, override MarkupContainer.getMarkupType() (see
src/test ... XmlPage) create whatever XML response is required.

  

Perhaps I am missing some of the puzzle for using deferred AJAX calls
using the AjaxHandler. I dug through the contrib-dojo stuff - and the
only one that handles a callback completely is the Validation stuff, and
it simply returns a valid/invalid plain text mime-type result.




---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



  



---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637alloc_id=16865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Error with ReuseIfModelsEqualStrategy and last version of wicket/wicket-extensions

2005-12-27 Thread Igor Vaynberg
this was due to a new check we introduced. basically it would throw an error if you try to add a component that already had a parent set. this would help users catch errors in certain situtations, but obviously caused problems in others.
i changed it so now the component is removed from its previous parent before it is added to its new one instead of throwing an error if a parent was already set.-Igor
On 12/27/05, Laurent PETIT [EMAIL PROTECTED] wrote:
Hello,While testing my strutsnested example before commiting it, I had thegood idea to do an update (had not done one for a while, may be a weekor more).My example now scratches.I investigated a little bit, and it appears that the wicket-example
related to the ReuseIfModelsEqualStrategy also fails (thehttp://localhost:8080/wicket-examples/repeater?bookmarkablePage=wicket.examples.repeater.OIRPage
link)Don't know where the problem lies.regards,--laurent---This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?Stop!Download the new AJAX search engine that makessearching your log files as easy as surfing theweb.DOWNLOAD SPLUNK!http://ads.osdn.com/?ad_idv37alloc_id865opclick
___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Error with ReuseIfModelsEqualStrategy and last version of wicket/wicket-extensions

2005-12-27 Thread Laurent PETIT
Thanks for the quick answer.

I've digged a little bit in the code, because now that I know what
you've done to suppress the bug, I think the initial idea was
interesting (throwing the exception).

I saw that the bug occurs because OrderedRepeatingView calls
super.removeAll() (i.e. MarkupContainer.removeAll()).

And the problem is that MarkupContainer.removeAll() does not at all
call remove() on each of its children == every children components
keeps the pointer to its parent component.

The clean solution would be to correct the
MarkupContainer.removeAll() method. But it has maybe been done this
way (just setting the children property to null) for performance
reasons ?




On 12/28/05, Igor Vaynberg [EMAIL PROTECTED] wrote:
 this was due to a new check we introduced. basically it would throw an error
 if you try to add a component that already had a parent set. this would help
 users catch errors in certain situtations, but obviously caused problems in
 others.

 i changed it so now the component is removed from its previous parent before
 it is added to its new one instead of throwing an error if a parent was
 already set.

 -Igor



  On 12/27/05, Laurent PETIT [EMAIL PROTECTED] wrote:
 
  Hello,
 
  While testing my strutsnested example before commiting it, I had the
  good idea to do an update (had not done one for a while, may be a week
  or more).
 
  My example now scratches.
 
  I investigated a little bit, and it appears that the wicket-example
  related to the ReuseIfModelsEqualStrategy also fails (the
 
 http://localhost:8080/wicket-examples/repeater?bookmarkablePage=wicket.examples.repeater.OIRPage
  link)
 
  Don't know where the problem lies.
 
  regards,
 
  --
  laurent
 
 
  ---
  This SF.net email is sponsored by: Splunk Inc. Do you grep through log
 files
  for problems?  Stop!  Download the new AJAX search engine that makes
  searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
  http://ads.osdn.com/?ad_idv37alloc_id865opclick
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 




---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37alloc_id865op=click
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user