Re: [Wicket-user] Update ListView via AJAX

2007-01-02 Thread August Detlefsen
Thanks again Igor that was just the ticket. I've updated the wicket wiki 
with an example:


http://cwiki.apache.org/confluence/display/WICKET/How+to+repaint+a+ListView+via+Ajax

-August


Igor Vaynberg wrote:
the list did not refresh because you did not specify a model that can 
update itself across requests on the listview.


the listview should use a detachable model, try a LoadableDetachableModel

-igor


On 12/31/06, *August Detlefsen* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Actually, this approach did not work for me -The container updated
every
5 seconds, but the list of items generated from the database never
changed.

After some digging through the wicket sources, I solved this by
overriding the onAttach() method of WebMarkupContainer to remove the
list and regenerate it from the DB on each rendering:



public class AjaxContainer extends WebMarkupContainer {

protected void onAttach() {
removeAll();

ListView comments = new ListView(comments, commentList) {

protected void populateItem(final ListItem listItem) {

...


Do you forsee any problems with this approach?

Regards,
August


Igor Vaynberg wrote:

 before:

 add(new ListView(listview

 div wicket:id=listview/div

 after

 WebMarkupContainer container=new WebMarkupContainer(container);
 container.setOutputMarkupId (true);
 contianer.add(new ListView(listview

 ...
 div wicket:id=containerdiv wicket:id=listview/div/div

 -igor


 On 12/29/06, *August Detlefsen* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

 I've seen the Wiki entry that says:

 You can't, you need to put it into a WebMarkupContainer and
repaint
 that container instead.
 http://www.wicket-wiki.org.uk/wiki/index.php/ListView


 But does anyone have some example code illustrating this?

 Thanks,
 August


-


 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the
chance to
 share your
 opinions on IT  business topics through brief surveys - and
earn
 cash

http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
 mailto: Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
https://lists.sourceforge.net/lists/listinfo/wicket-user
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to
share your
opinions on IT  business topics through brief surveys - and earn
cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
https://lists.sourceforge.net/lists/listinfo/wicket-user




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Update ListView via AJAX

2006-12-31 Thread August Detlefsen
Actually, this approach did not work for me -The container updated every 
5 seconds, but the list of items generated from the database never changed.

After some digging through the wicket sources, I solved this by 
overriding the onAttach() method of WebMarkupContainer to remove the 
list and regenerate it from the DB on each rendering:



public class AjaxContainer extends WebMarkupContainer {

protected void onAttach() {
removeAll();

ListView comments = new ListView(comments, commentList) {

protected void populateItem(final ListItem listItem) {

...


Do you forsee any problems with this approach?

Regards,
August


Igor Vaynberg wrote:

 before:

 add(new ListView(listview

 div wicket:id=listview/div

 after

 WebMarkupContainer container=new WebMarkupContainer(container);
 container.setOutputMarkupId (true);
 contianer.add(new ListView(listview

 ...
 div wicket:id=containerdiv wicket:id=listview/div/div

 -igor


 On 12/29/06, *August Detlefsen* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 I've seen the Wiki entry that says:

 You can't, you need to put it into a WebMarkupContainer and repaint
 that container instead.
 http://www.wicket-wiki.org.uk/wiki/index.php/ListView


 But does anyone have some example code illustrating this?

 Thanks,
 August

 -

 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to
 share your
 opinions on IT  business topics through brief surveys - and earn
 cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Update ListView via AJAX

2006-12-29 Thread August Detlefsen
I've seen the Wiki entry that says:

You can't, you need to put it into a WebMarkupContainer and repaint 
that container instead.
http://www.wicket-wiki.org.uk/wiki/index.php/ListView


But does anyone have some example code illustrating this?

Thanks,
August

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] How do you load an external image?

2006-12-27 Thread August Detlefsen
How can I load an image directly from a url?

For example I want to display a picture of a user next to their profile, 
but all of the images are served by another machine for better 
performance. I tried something like this but it won't compile:

Image profileImg = new Image(profileimg);
profileImg.setImageResource( new UrlResourceStream( new 
URL(user.getPhotourl()) ) );


Thanks,
August

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] How do you load an external image?

2006-12-27 Thread August Detlefsen

Thank you Igor! You don't know how long I tried to do this.

I've added this fix to the Wiki:
http://cwiki.apache.org/confluence/display/WICKET/How+to+load+an+external+image

-August



Igor Vaynberg wrote:

class staticimage extends webcomponent {

 public staticimage(string id, imodel model) {
super(id, model);
  }

  protected void oncomponenttag(tag) {
  checkcomponenttag(tag, img);
  tag.put(src, getModelObjectAsString());
}
}

add(new staticimage(img, new Model(http://foo.com/bar.gif;));

-igor


On 12/27/06, *August Detlefsen* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


How can I load an image directly from a url?

For example I want to display a picture of a user next to their
profile,
but all of the images are served by another machine for better
performance. I tried something like this but it won't compile:

Image profileImg = new Image(profileimg);
profileImg.setImageResource( new UrlResourceStream( new
URL(user.getPhotourl()) ) );


Thanks,
August

-

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to
share your
opinions on IT  business topics through brief surveys - and earn
cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
https://lists.sourceforge.net/lists/listinfo/wicket-user




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unexpected RuntimeException

2006-12-26 Thread August Detlefsen
Latest version downloaded from the site: wicket-1.2.3.jar



Juergen Donnerstag wrote:
 I don't think it is the jar alone, I'm using jar as well and I don't
 get the exception. But I think you asked the right question: What is
 causing the xmlReader object to be null? Obviously iit happens while
 closeing the parser, which means that it started parsing (with a
 none-null parser object) and than ...

 Which version of Wicket are you using?

 Juergen


 On 12/23/06, August Detlefsen [EMAIL PROTECTED] wrote:

  I figured out how to setup logging it was easy. I was trying to load 
 the
 markup HTML from a jar file:

  12-22 12:18:32 [DEBUG] [UrlResourceStream] - cannot convert url:
 jar:file:/export/webapps/mycompany.com/web/ROOT/WEB-INF/lib/com.mycompany.newscomments.jar!/com/mycompany/newscomments/CommentHomePage.html
  

 to file (URI is not hierarchical), falling back to the inputstream for
 polling
  12-22 12:18:32 [DEBUG] [MarkupCache] - Loading markup from
 jar:file:/export/webapps/mycompany.com/web/ROOT/WEB-INF/lib/com.mycompany.newscomments.jar!/com/mycompany/newscomments/CommentHomePage.html
  

  12-22 12:18:33 [ERROR] [RequestCycle] -
  java.lang.NullPointerException
  at
 wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:390)
  at
 wicket.markup.MarkupParser.readAndParse(MarkupParser.java:196)
  at
 wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:279)
  at
 wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:354) 

  at
 wicket.markup.MarkupCache.getMarkup(MarkupCache.java:198)
  at
 wicket.markup.MarkupCache.getMarkupStream(MarkupCache.java:106)
  at
 wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:827) 

  at
 wicket.markup.html.WebPage.commonInit(WebPage.java:235)
  at wicket.markup.html.WebPage.init(WebPage.java:120)
  at
 com.mycompany.newscomments.CommentHomePage.init(CommentHomePage.java:27) 

  ...

  Once I moved the markup file out of the jar and into 
 WEB-INF/classes, the
 problem went away. Is there any way to keep them in the jar file without
 getting this error?

  -August




  Johan Compagner wrote:

 can you check for us why that is null in your case?
 All those exceptions are logged just make sure you have the right
 logging.properties

 johan



 On 12/22/06, August Detlefsen [EMAIL PROTECTED] wrote:
  I am getting a NullPointerException when I try to visit the home 
 page of
  my web application. Root cause:
 
  java.lang.NullPointerException
  at
 wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:390)
  at
 wicket.markup.MarkupParser.readAndParse(MarkupParser.java:196)
  at wicket.markup.MarkupCache.loadMarkup
 (MarkupCache.java:279)
  at
 
 wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:354) 

  at
 wicket.markup.MarkupCache.getMarkup(MarkupCache.java:198)
  at wicket.markup.MarkupCache.getMarkupStream(
 MarkupCache.java:106)
  at
 
 wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:827) 

  at
 wicket.markup.html.WebPage.commonInit(WebPage.java:235)
  at wicket.markup.html.WebPage.init(WebPage.java :120)
  at
 
 com.mycompany.newscomments.CommentHomePage.init(CommentHomePage.java:27) 

  ...
 
  I traced it back to the parse method in XmlPullParser, specifically
  where the xmlReader is closed in the finally block:
 
  finally
 {
 resource.close();
 this.xmlReader.close();
 }
 
  I think this exception can be avoided by changing:
 
 this.xmlReader.close ();
 
  to:
 
 if (this.xmlReader != null) this.xmlReader.close();
 
  However, what is causing the xmlReader object to be null?
 
  Is there a way to redirect these errors to a log file instead of
  displaying them on screen?
 
  Thanks,
  August
 
 
 
 - 

  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to 
 share
 your
  opinions on IT  business topics through brief surveys - and earn cash
 
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV 

  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


  --
 August Detlefsen
 CEO/Web Application Architect
 CodeMagi, Inc.
 510-368-4489 tel
 510-336-9434 fax
 http://www.codemagi.com

 - 

 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to 
 share your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV 


 ___
 Wicket-user mailing list
 Wicket-user

[Wicket-user] The component(s) below failed to render

2006-12-26 Thread August Detlefsen
WicketMessage: The component(s) below failed to render. A common problem 
is that you have added a component in code but forgot to reference it in 
the markup (thus the component will never be rendered).

Is there any way to have wicket simply ignore missing components in the 
markup? For example, if not every page will include every element.

Thanks,
August

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] The component(s) below failed to render

2006-12-26 Thread August Detlefsen
In my case I have an article that can have zero or more comments 
attached to it. I've been getting this error in the case where an 
article has no comments. What is the best practice for handling this?


-August



Igor Vaynberg wrote:
in myapplication.init() { 
getdebugsettings().setcomponentusecheck(false); }


but you really shouldnt do that, there should be no reason something 
is in java but not in markup. there are plenty of ways to handle these 
cases such as component visibility/panels/fragments/etc


-igor


On 12/26/06, *August Detlefsen* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


WicketMessage: The component(s) below failed to render. A common
problem
is that you have added a component in code but forgot to reference
it in
the markup (thus the component will never be rendered).

Is there any way to have wicket simply ignore missing components
in the
markup? For example, if not every page will include every element.

Thanks,
August

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to
share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




--
August Detlefsen
CEO/Web Application Architect
CodeMagi, Inc. 
510-368-4489 tel

510-336-9434 fax
http://www.codemagi.com

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Unexpected RuntimeException

2006-12-22 Thread August Detlefsen
I am getting a NullPointerException when I try to visit the home page of 
my web application. Root cause:

java.lang.NullPointerException
at wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:390)
at wicket.markup.MarkupParser.readAndParse(MarkupParser.java:196)
at wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:279)
at 
wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:354)
at wicket.markup.MarkupCache.getMarkup(MarkupCache.java:198)
at wicket.markup.MarkupCache.getMarkupStream(MarkupCache.java:106)
at 
wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:827)
at wicket.markup.html.WebPage.commonInit(WebPage.java:235)
at wicket.markup.html.WebPage.init(WebPage.java:120)
at 
com.mycompany.newscomments.CommentHomePage.init(CommentHomePage.java:27)
...

I traced it back to the parse method in XmlPullParser, specifically 
where the xmlReader is closed in the finally block:

finally
{
resource.close();
this.xmlReader.close();
}

I think this exception can be avoided by changing:

this.xmlReader.close();

to:

if (this.xmlReader != null) this.xmlReader.close();

However, what is causing the xmlReader object to be null?

Is there a way to redirect these errors to a log file instead of 
displaying them on screen?

Thanks,
August


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Unexpected RuntimeException

2006-12-22 Thread August Detlefsen
I figured out how to setup logging it was easy. I was trying to load the 
markup HTML from a jar file:


12-22 12:18:32 [DEBUG] [UrlResourceStream] - cannot convert url: 
jar:file:/export/webapps/mycompany.com/web/ROOT/WEB-INF/lib/com.mycompany.newscomments.jar!/com/mycompany/newscomments/CommentHomePage.html 
to file (URI is not hierarchical), falling back to the inputstream for 
polling
12-22 12:18:32 [DEBUG] [MarkupCache] - Loading markup from 
jar:file:/export/webapps/mycompany.com/web/ROOT/WEB-INF/lib/com.mycompany.newscomments.jar!/com/mycompany/newscomments/CommentHomePage.html

12-22 12:18:33 [ERROR] [RequestCycle] -
java.lang.NullPointerException
   at wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:390)
   at wicket.markup.MarkupParser.readAndParse(MarkupParser.java:196)
   at wicket.markup.MarkupCache.loadMarkup(MarkupCache.java:279)
   at 
wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:354)

   at wicket.markup.MarkupCache.getMarkup(MarkupCache.java:198)
   at wicket.markup.MarkupCache.getMarkupStream(MarkupCache.java:106)
   at 
wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:827)

   at wicket.markup.html.WebPage.commonInit(WebPage.java:235)
   at wicket.markup.html.WebPage.init(WebPage.java:120)
   at 
com.mycompany.newscomments.CommentHomePage.init(CommentHomePage.java:27)

...

Once I moved the markup file out of the jar and into WEB-INF/classes, 
the problem went away. Is there any way to keep them in the jar file 
without getting this error?


-August



Johan Compagner wrote:

can you check for us why that is null in your case?
All those exceptions are logged just make sure you have the right 
logging.properties
 
johan



 
On 12/22/06, *August Detlefsen* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


I am getting a NullPointerException when I try to visit the home
page of
my web application. Root cause:

java.lang.NullPointerException
at wicket.markup.parser.XmlPullParser.parse(XmlPullParser.java:390)
at wicket.markup.MarkupParser.readAndParse(MarkupParser.java:196)
at wicket.markup.MarkupCache.loadMarkup (MarkupCache.java:279)
at
wicket.markup.MarkupCache.loadMarkupAndWatchForChanges(MarkupCache.java:354)
at wicket.markup.MarkupCache.getMarkup(MarkupCache.java:198)
at wicket.markup.MarkupCache.getMarkupStream( MarkupCache.java:106)
at
wicket.MarkupContainer.getAssociatedMarkupStream(MarkupContainer.java:827)
at wicket.markup.html.WebPage.commonInit(WebPage.java:235)
at wicket.markup.html.WebPage.init(WebPage.java :120)
at
com.mycompany.newscomments.CommentHomePage.init(CommentHomePage.java:27)
...

I traced it back to the parse method in XmlPullParser, specifically
where the xmlReader is closed in the finally block:

finally
   {
   resource.close();
   this.xmlReader.close();
   }

I think this exception can be avoided by changing:

   this.xmlReader.close ();

to:

   if (this.xmlReader != null) this.xmlReader.close();

However, what is causing the xmlReader object to be null?

Is there a way to redirect these errors to a log file instead of
displaying them on screen?

Thanks,
August


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to
share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
mailto:Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




--
August Detlefsen
CEO/Web Application Architect
CodeMagi, Inc. 
510-368-4489 tel

510-336-9434 fax
http://www.codemagi.com

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user