Re: extra 'onclick' is generated for an image wrapped by a link

2008-12-28 Thread Doug Donohoe

This behavior is in 1.4-m3 and is new.  I was running 1.4-m2 and a
wicket:link around an a/img combo did the expected thing (see the current
http://online.ddpoker.com/ for an example - the rss image links).

I agree that this is wrong.

-Doug


Trent Larson wrote:
 
 I have the following plain HTML where I want an image to be a link to
 another Wicket-managed page:
 
 wicket:link ProductPage.html  ../images/products_welcome.jpg 
 /wicket:link
 
 
 The link for that page is generated fine, but then Wicket adds an
 'onclick'
 event to the 'img' tag that takes the user directly to the image:
 
 wicket:link ?wicket:bookmarkablePage=:com.max.web.page.ProductPage 
 ../images/products_welcome.jpg  /wicket:link
 
 This seems absolutely wrong.  The result is that a click on the image will
 take users to directly to that image; sometimes it will then continue on
 to
 the right (ProductPage) page, so users see the image by itself before
 going
 to the right page, but often it just stops at the image.
 
 There is no Java code associated with this.  I get it in 1.4-rc1 (as well
 as
 1.4-m3).
 
 What is happening, and how can I stop it from generating the 'onclick'
 javascript?  Thanks!
 
 Trent
 
 

-- 
View this message in context: 
http://www.nabble.com/extra-%27onclick%27-is-generated-for-an-image-wrapped-by-a-link-tp20980894p21195414.html
Sent from the Wicket - User 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



new wicket site live: online.ddpoker.com (+1 for generics)

2008-06-02 Thread Doug Donohoe

Hi All:

We launched the new http://online.ddpoker.com/ yesterday.  It replaces an
old JSP/JDBC site with wicket/spring/jpa/hibernate.

The site is 100% bookmarkable.  The site also uses the
wicketstuff-annotations project that we contributed.   One cool thing we did
with the annotations/bookmarkable pages was map the old legacy jsp pages to
the new wicket counterparts, including mapping the old query parameters. 
Wicket made this trivial to do. 

Other useful things we did in wicket:  a bookmarkable paging navigator
(which is used across the site), components to show negative percent/dollars
in red, and a highlighting widget used to show matching search results.

We are using Wicket 1.4-trunk (as of yesterday due to a fix we submitted). 
We migrated from 1.3.x to 1.4 mid-project.  Getting used to generics took
about 1 1/2 days, but was well worth the effort.  Consider this a
two-thumbs-up success story for generics.

Thanks to the people on this list who answered my questions.  I hope to add
more lessons learned to my wiki page this week
(http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=Wicket%20Notes).

-Doug Donohoe
-- 
View this message in context: 
http://www.nabble.com/new-wicket-site-live%3A--online.ddpoker.com-%28%2B1-for-generics%29-tp17612580p17612580.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: users, please give us your opinion: what is your take on generics with Wicket

2008-06-02 Thread Doug Donohoe


1) Generifying* Wicket
   [X] Can best be done like currently in the 1.4 branch, where models
and components are both generified. I care most about the improved
static type checking generified models and components give Wicket.

2) How strongly do you feel about your choice above?
   [X*] Whatever choice ultimately made, I'll happily convert/ start
using 1.4 and up.

* Note that we just went live with http://online.ddpoker.com/ on 1.4 trunk
using generics.  I'd prefer not to backtrack, but will if that's what the
developers decide.

Having gone through a conversion of a brand new project about 1/2 way
through, I can tell you that (a) it is not that hard, (b) it is ultimately
worth it, (c) my knowledge of java is better due to having to learn generics
better, (d) we feel we created cleaner/more maintainable code because of
generics.

I think wicket is great and seriously doubt, with good documentation, that
using generics will turn people away.
-- 
View this message in context: 
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17612641.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: users, please give us your opinion: what is your take on generics with Wicket

2008-06-02 Thread Doug Donohoe

Stefan makes a good point.  I have raised this as an example before.  

My site (online.ddpoker.com, just went live) is a mix of A and B.  To make
my code cleaner, I created several simple subclasses for cases where I don't
use models.  VoidPanel, VoidContainer (only a handful, really).  

Also, since all my pages subclass my BasePage, all I had to do was change
*that* page to subclass PageVoid and voila, all my pages were proper.

I also created the following models to simply my life:  DateModel,
IntegerModel, DoubleModel, etc.  I did some fancier stuff with Generics,
including a decent drop-down list thing.

In the end, it was totally worth it.  Not only do I understand how wicket
works much better with Generics (because the code helps document it), but my
code is cleaner and easier to understand.

I also agree with Bill that developers should take the time to learn the
feature.  It can be quite powerful.

-Doug


Stefan Lindner wrote:
 
 Brill Pappin wrote
I don't know, I think the discussion is going *toward* generics.
Frankly I can't even see why its an issue at all, the language has
 evolved and uses them... Why would Wicket not also use them its inline
 with the current state of the language?

There is no reason that people who can't get their heads around
 Generics can't use the older releases that don't include it, but IMO any
 java developer who doesn't get generics yet better make some time to
 learn, because like it or not, they *will* be dealing with them.
 
 I agree totally with you. My expericence with Generics over the last two
 years was that any project that was adopted to generics had much less
 errors afterwards.
 
 But the main problem in this discussion seems to be that there are two
 very different sorts of Web Applications that are developed with wicket
 and both may have predecessors that are non generic.
 
 Type A: A Web applicatons that make heavy use of Models, like classic
 desktop allications that are ported to the web. I think the programmers
 of such applications like Generics becaus they help them to avoid erros
 and the current wicket generic implementation leads to a strong typed
 application that needs a good object model (and a good database design).
 If you port an exisitng wicket application with no generic to wicket 1.4
 you might discover some unclear object model problems in your exisitng
 code. And it's always easier to point to wicket's generics than to blame
 your own code :-)
 
 Type B: A Web Application with more static content, only some date (like
 user logins, user profile data). In this case it's clear that some
 people say why should I always tyle 'LinkVoid', none of my links has
 a Model, just about 10% of my Components have a Model. But why dont't
 they write their own wrapper e.g. MyVoidLink extends LinkVoid? I
 remember a dicsusson about such Components some weeks ago.
 
 
 What do you think about it? Would it help users of Type B to have
 VoidComponents?
 
 Stefan
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17612786.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [ANNOUNCE] Apache Wicket 1.4 Milestone 2 is released

2008-06-02 Thread Doug Donohoe

The 1.4-m2 java doc is posted at http://www.ddpoker.com/javadoc/index.html

-Doug


Frank Bille wrote:
 
 Help the Apache Wicket team to determine the future of your Wicket based
 web
 application development. We have released our second milestone release of
 our Java 5 based web framework and are anxious to receive feedback on our
 use of generics. Download Wicket 1.4-m2 now and help us decide whether to
 tone down, remove or increase the application of Java 5 generics to our
 API.
 We have started the discussion on the user mailing list:
 
 http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-td17589984.html
 
 Eager people click here to download the distribution, others can read
 further:
 
 http://www.apache.org/dyn/closer.cgi/wicket/1.4-m2
 
 We thank you for your patience and support.
 
 The Wicket Team
 
 === Apache Wicket ===
 
 Apache Wicket is a component oriented Java web application framework. With
 proper mark-up/logic separation, a POJO data model, and a refreshing lack
 of
 XML, Apache Wicket makes developing web-apps simple and enjoyable again.
 Swap the boilerplate, complex debugging and brittle code for powerful,
 reusable components written with plain Java and HTML.
 
 You can find out more about Apache Wicket on our website:
 
 http://wicket.apache.org
 
 === This release ===
 
 The Apache Wicket team is proud to announce the availability of the first
 milestone release of our first java 1.5 Wicket version: Apache Wicket
 1.4-m2. This is the first release with java 1.5 as a minimum. Not
 everything
 has been converted to java 1.5 yet but we are getting there.
 
 === Migrating from 1.3 ===
 
 If you are coming from Wicket 1.3, you really want to read our migration
 guide, found on the wiki:
 
 http://cwiki.apache.org/WICKET/migrate-14.html
 
 === Downloading the release ===
 
 You can download the release from the official Apache mirror system, and
 you
 can find it through the following link:
 
 http://www.apache.org/dyn/closer.cgi/wicket/1.4-m2/
 
 For the Maven and Ivy fans out there: update your pom's to the following,
 and everything will be downloaded automatically:
 
dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket/artifactId
version1.4-m2/version
/dependency
 
 Substitute the artifact ID with the projects of your liking to get the
 other
 projects.
 
 Please note that we don't prescribe a Logging implementation for SLF4J.
 You
 need to specify yourself which one you prefer. Read more about SLF4J here:
 http://slf4j.org
 
 === Validating the release ===
 
 The release has been signed by Frank Bille, your release manager for
 today.
 The public key can be found in the KEYS file in the download area.
 Download
 the KEYS file only from the Apache website.
 
 http://www.apache.org/dist/wicket/1.4-m2/KEYS
 
 Instructions on how to validate the release can be found here:
 
 http://www.apache.org/dev/release-signing.html#check-integrity
 
 === Reporting bugs ===
 
 In case you do encounter a bug, we would appreciate a report in our JIRA:
 
 http://issues.apache.org/jira/browse/WICKET
 
 === The distribution ===
 
 In the distribution you will find a README. The README contains
 instructions
 on how to build from source yourself. You also find a CHANEGELOG-1.4 which
 contains a list of all things that have been fixed, added and/or removed
 since the first release in the 1.4 branch.
 
 

-- 
View this message in context: 
http://www.nabble.com/-ANNOUNCE--Apache-Wicket-1.4-Milestone-2-is-released-tp17601655p17614063.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Default Focus Behavior?

2008-05-29 Thread Doug Donohoe

This helped me.  Thanks, jwcarman!

-Doug


jwcarman wrote:
 
 On 3/11/08, Martijn Dashorst [EMAIL PROTECTED] wrote:
 I suggest wiki.

 
 Done:
 
 http://cwiki.apache.org/confluence/display/WICKET/Request+Focus+on+a+Specific+Form+Component
 
 I'm happy now.  My work (no matter how trivial) may help someone
 someday! :)  I don't have time to do so now, but I might add in some
 examples on how to do focus on errors, etc.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Default-Focus-Behavior--tp15934889p17547678.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



how to do something after each page is rendered

2008-05-27 Thread Doug Donohoe

I want to do something at the end of each request (basically save some
information into a cookie so I can more gracefully handle session
expiration).

I created my own WebRequestCycle subclass (see below) and want to use
onEndRequest(), but getPage() always returns null.

First, why is it null?  Second, is there a better way to do end-of-request
processing?

Thanks,

-Doug

public class BaseRequestCycle extends WebRequestCycle
{
@Override
protected void onEndRequest()
{
logger.debug(End of request:  + request.getPage());
}
}


-- 
View this message in context: 
http://www.nabble.com/how-to-do-something-after-each-page-is-rendered-tp17497493p17497493.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: (Class? extends Page?) casting troubles

2008-05-22 Thread Doug Donohoe

I'll chime in again.  I really like generics.   When I first upgraded to 1.4,
I did a bit of grumbling, but I came to realize some great benefits,
especially with components.  I'd hate to lose that (almost as much as I'd
hate to go through my whole code base and remove that work).

I did a couple of things that made things easier.  First, all my pages
subclassed from a common ancestor which I just changed to 'extends
WebPageVoid'.  Second, I created some utility classes such as

   VoidContainer extends WebMarkupContainerVoid
   StringLabel extends LabelString

and so on.  I don't feel that having to create these utility classes is a
hassle or is a mark against the API.  Rather, it helps me understand how and
where I use certain types of components.  It also helps with refactoring.  

There is one place that it is ugly, but it is an edge case in a logout link. 
I just used @SuppressWarnings to deal with it.

@SuppressWarnings({unchecked})
@Override
public void onClick()
{
getSession().invalidate();
// need to use class so page is created new
setResponsePage((Classlt;? extends Pagelt;?)
getPage().getClass()));
}

The bottom line was that the work didn't take that long and in the end I
feel my code is more readable and type-safe.

-Doug


Jeremy Thomerson-5 wrote:
 
 I haven't said anything up to this point, but we really don't seem to be
 getting anywhere with what is turning into a religious war.  I, for one,
 have already started using 1.4, and love the generics, despite the extra
 verbosity.  It gives me extra type safety and code self-documentation.  I
 would be very against having the framework do a cast as has been suggested
 on here, because that is a hack, and not useful for anything - I lose the
 value of generics because the compiler is no longer checking my type
 safety
 throughout the application.  If I came to a framework without previous
 experience with it, and discovered that ugly hack, I would be worried
 about
 the quality of all of the code.
 
 I think that we should:
  - continue with 1.4-M2
  - create a wiki page where we can get one master list of  things we like
 and don't like
  - see what we can do to address those
 
 We're really not getting anywhere with this conversation until we have a
 finite list, and some options for each con on the list.  Then we can
 either
 choose the best options or say forget it.
 
 -- 
 Jeremy Thomerson
 http://www.wickettraining.com
 
 On Thu, May 22, 2008 at 6:23 AM, Jan Kriesten [EMAIL PROTECTED]
 wrote:
 

 hi sebastiaan,

  I'm very much against using generics to do something other from what
 generics where meant to do (i.e., type safety).


 i'm all in when you're talking about type safety. having compile-time
 checks on the types is a time-saver during development.

 with wicket generics it's just that the time-saver get's in it's own way,
 i.e. bringing in so much boilerplate, that coding is getting harder to do
 right (besides from source readability).


 regards, --- jan.

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 

-- 
View this message in context: 
http://www.nabble.com/%28Class%3C--extends-Page%3C-%3E%3E%29--casting-troubles-tp17355847p17406422.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: (Class? extends Page?) casting troubles

2008-05-21 Thread Doug Donohoe

Having moved my wicket project to the 1.4 trunk, I have to say that I like
generics quite a bit.  Yes, there is a bit of a learning curve with them,
but in general I like not having to cast my getModelObject() calls.  It is
especially nice inside of DataView and DropDownChoice.  Learning curve
problems can be overcome with good examples.

Generics add a lot in type safety and, once you get used to them,
convenience.

I strongly vote against backing out this work.

-Doug



Johan Compagner wrote:
 
 as i said. any generified use of CompoundPropertyModel is gone
 
 Also if you make getModel() return a normal IModel that is of raw type i
 think you get warnings everywhere again...
 and i think only suppresswarnings will help those
 Because if yo do
 
 IModelString stringModel = (IModelString)component.getModel();
 
 that will generate a warning as far as i know.
 and i guess if you dont cast:
 
 IModel stringModel = component.getModel();
 
 will also generate a warning? i am not sure because i see so many. But
 there
 you use IModel that is a generic type as a raw type..
 
 i still think dropping it from component we could drop it also from model
 Because the only thing we gain that is that for a few classes the Api is
 more clear (DropDown and ListView)
 But for the rest it doesnt bring almost anything. No type safety pretty
 much
 anywhere.
 
 johan
 
 
 
 
 
 On Wed, May 21, 2008 at 11:53 AM, Martijn Dashorst 
 [EMAIL PROTECTED] wrote:
 
 That is not my problem. The problem is that ComponentT is confusing
 as hell and opens up the box of pandorra wrt generics. I *like*
 IModelT but I fail to see how setResponsePage(? extends ? extends
 ?) is necessary for this. The only reason iirc to generify
 component is to remove the casts for these two methods:

 IModel getModel()
 Object getModelObject()

 I can live with having these methods not being generified.

 Martijn

 On Wed, May 21, 2008 at 11:36 AM, Peter Ertl [EMAIL PROTECTED] wrote:
  Maybe this can help a little:
  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6384510
  (verified with java 1.5 on mac os x leopard)
 
 
  Am 21.05.2008 um 11:13 schrieb Martijn Dashorst:
 
  On Wed, May 21, 2008 at 11:03 AM, Johan Compagner
 [EMAIL PROTECTED]
 
  wrote:
 
  if we drop that then we can pretty much drop also model
 
  Not sure. I think having Component(String id, IModelT model) is a
  good thing. However, generifying Component further to get rid of the
  cast when doing getModelObject() or getModel() turns out not to be
  great.
 
  Because the model goes into the Component and gone is the generified
  model.
 
  I don't have a direct problem with that. The generics of Component are
  really hard on the eye and the brain. We are trying to make things
  simpler and clearer. Having Component(String id, IModelT model)
  makes things clearer.
 
  For example the DropDownChoice that is generified now makes sure that
 i
  have
  a lot less explaining to on this list..
 
  Yes, I am not in favor of dropping DDC(String, IModelT,
  IModelList? extends T). I am in favor of dropping the generics
  from the Component class definition.
 
 
  Martijn
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 



 --
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.3 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 

-- 
View this message in context: 
http://www.nabble.com/%28Class%3C--extends-Page%3C-%3E%3E%29--casting-troubles-tp17355847p17364199.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using generics with some non-generic classes in Wicket

2008-05-14 Thread Doug Donohoe

Somewhat related to this thread, when I moved to generics win Wicket 1.4,  I
created some utility classes such as:

public class VoidContainer extends WebMarkupContainerlt;Void
public class VoidPanel extends Panellt;Void
public class StringLabel extends Labellt;String

public class IntegerModel extends Modellt;Integer
public class StringModel extends Modellt;String
public class DateModel extends Modellt;Date
public class DoubleModel extends Modellt;Double

And so on.  This made my wicket code cleaner and easier to use.  I think the
Wicket 1.4 generics implementation is headed in the right direction.  It was
a pain at first because I had to parameterize everything, but creating
convenience classes like this made it easier.

I'm thinking about creating a patch with a suite of these types of classes
because I think users will want something like this.

-Doug


Johan Compagner wrote:
 
 The problem is that wicket needs an annotation
 
 genericsOptional
 
 so that all the warnings about raw types are gone.
 
 A component only has to be generic if you use the IModel constructor or
 call
 getModel(), getModelObject() methods..
 for the rest it is not really needed
 
 johan
 
 On Wed, May 14, 2008 at 9:28 AM, Sebastiaan van Erk [EMAIL PROTECTED]
 wrote:
 
 My post kind of missed the point, I shouldn't post when I'm already half
 asleep. :-)

 Obviously MarkupContainer satisfies the MarkupContainer? in a
 method argument, so it accepts the raw type. However, it generates a
 warning
 because the method says it's generified, so you should be using the
 generic
 type.

 Johan Compagner wrote:

  I dont care, because i cant do any thing with the ? The only thing it
  enforces is that it must now be a generic class which is annoying. Not
  to mention that in that area eclipse and javac accept different
  things
 

 The reason it warns you to use generics when generics are wanted is
 because Sun wants to be able to make it *required* (in a future release)
 to
 use generics where generics are wanted; at least, so I read... I think in
 the real world they wouldn't dare to do this because it would piss off so
 many users and break so much stuff. :-)

 But the idea is that if something is generified you should be using a
 type
 parameter, and using a raw type is *purely* for backwards compatibility
 with
 legacy code.

 Regards,
 Sebastiaan

  So or we in wicket dont use ? any where and have supress warning
  everywhere for that or we do use it and then suddenly it is in my eyes
  restricted to much.
 

 I don't understand


  On 5/14/08, Sebastiaan van Erk [EMAIL PROTECTED] wrote:
 
   Johan Compagner wrote:
  
yes thats the reason
   
you are calling the method add with a generified component but that
container itself is not generified
   
i dont like this about generics expecially the onces like this:
   
add(MarkupContainer? container)
   
then suddenly a none generified component cant be added...
thats really stupid ? should mean anything.. including none
generics
   
   No, that's not correct. For example, List? is much more restrictive
   than a raw List (which is a List). To a raw list you can add
   an
   instance of any type whatever, i.e., list.add(new Object()). But in
   List? the ? is a wildcard which says it could be any type there,
   i.e.,
   it could be a ListInteger. But you can't add a new Object() to a
   ListInteger!
  
   Thus MarkupContainer? means MarkupContainer parameterized by some
   unknown type, and *not* MarkupContainer parameterized by Object,
   which
   is what the raw type means.
  
   Regards,
   Sebastiaan
  
johan
   
   
On Tue, May 13, 2008 at 5:55 PM, Stefan Simik 
[EMAIL PROTECTED]
wrote:
   
 I have one idea,

 the reason of the warnigs is, that parent of AjaxPagingNavigator
 is
 PagingNavigator,
 which has parent Panel --- that is not parameterized.

 The same problem is with LoopItem, which extends the
 WebMarkupContainer --- that is not parameterized.

 ? could this be the reason ?






 Stefan Simik wrote:

  Mhmm, it is meaningful ;) I will know in future, thx
 
  One of the last occuring warning is, when working with
  MarkupContainer#add(...)  or  #addOrReplace(...)  method.
 
  Example:  I have a simple AjaxPagingNavigator, to which I add a
  simple
  ListView
 
 
 ---
  ListViewInteger menu = new ListViewInteger(id, numbers){
 //populate metods
  }
  add(menu);//warning here
 
  The warning says:
  Type safety: The method add(Component...) belongs to the raw
  type
  MarkupContainer.
  References to generic type MarkupContainerT should be
  parameterized
 
  I cannot find out, what's the warning reason, because ListView
  self is
  parameterized.
 
 
  

RE: Using generics with some non-generic classes in Wicket

2008-05-14 Thread Doug Donohoe

Let me outline what I believe the benefits are.  For example:

add(new LabelString(tournamentName, tournament.getName()));
add(new LabelString(hostName, game.getHostPlayer()));
row.add(new AttributeModifier(class, true, new
ModelString(row.getIndex() % 2 == 0 ? odd : even)));

add(new StringLabel(tournamentName, tournament.getName()));
add(new StringLabel(hostName, game.getHostPlayer()));
row.add(new AttributeModifier(class, true, new StringModel(row.getIndex()
% 2 == 0 ? odd : even)));

Sure, it seems like a small difference and a saving of two characters, but
here is what I believe are the benefits of doing this:

1) I can more easily use the features of my IDE such as auto-completion

2) Find Usages is more accurate (at least in IntelliJ, where I'm not aware
of a find-usages that scopes to a particular generic type)

3) Let's face it, Generics clutters up your code and makes it harder to
read.  This simplifies things a bit.

In answer to Martijn's assumption (in a separate post) that I was going to
iterate over all java types and all wicket types:  that is an incorrect
assumption.  Obviously, I would want to pick the most common use cases and
seek feedback from the community.  Let us not dismiss it outright.  I
believe this is a valid topic of conversation.  Generics are new to Wicket
and still unused by many Java APIs and likely new to many programmers.  I
can tell you that using classes such as this made it much quicker and easier
to remove all the warnings that showed up in my code when I migrated to 1.4. 
It seems easier to replace common usage from before (new Label(...)) with 
new StringLabel(...)  rather than new LabelString (even typing that now
was more difficult).  In any case, there may be some complaining about the
extensive use of Generics in 1.4 once it is released.  This may make it
easier to transition.  Maybe not.  At least let's be open to discussing it.

Finally, in answer to the point about negating the point of generics, I
respectfully disagree.  One major point of generics is to avoid code
duplication of boilerplate code.   It it weren't for the need to create
constructors, there wouldn't be any duplicated code.  I agree that it is a
fine balance to strike, but there are competing needs of readability and
maintainability.

-Doug


Hoover, William wrote:
 
 imho, that seems like that adds a lot of unnecessary code. One of the
 nice things about Wicket is that it keeps the bloat to a minimum.
 
 -Original Message-
 From: Doug Donohoe [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 14, 2008 8:21 AM
 To: users@wicket.apache.org
 Subject: Re: Using generics with some non-generic classes in Wicket
 
 
 Somewhat related to this thread, when I moved to generics win Wicket
 1.4,  I created some utility classes such as:
 
 public class VoidContainer extends WebMarkupContainerlt;Void public
 class VoidPanel extends Panellt;Void public class StringLabel extends
 Labellt;String
 
 public class IntegerModel extends Modellt;Integer public class
 StringModel extends Modellt;String public class DateModel extends
 Modellt;Date public class DoubleModel extends Modellt;Double
 
 And so on.  This made my wicket code cleaner and easier to use.  I think
 the Wicket 1.4 generics implementation is headed in the right direction.
 It was a pain at first because I had to parameterize everything, but
 creating convenience classes like this made it easier.
 
 I'm thinking about creating a patch with a suite of these types of
 classes because I think users will want something like this.
 
 -Doug
 
 
 Johan Compagner wrote:
 
 The problem is that wicket needs an annotation
 
 genericsOptional
 
 so that all the warnings about raw types are gone.
 
 A component only has to be generic if you use the IModel constructor 
 or call getModel(), getModelObject() methods..
 for the rest it is not really needed
 
 johan
 
 On Wed, May 14, 2008 at 9:28 AM, Sebastiaan van Erk 
 [EMAIL PROTECTED]
 wrote:
 
 My post kind of missed the point, I shouldn't post when I'm already 
 half asleep. :-)

 Obviously MarkupContainer satisfies the MarkupContainer? in a 
 method argument, so it accepts the raw type. However, it generates a 
 warning because the method says it's generified, so you should be 
 using the generic type.

 Johan Compagner wrote:

  I dont care, because i cant do any thing with the ? The only thing 
  it enforces is that it must now be a generic class which is 
  annoying. Not to mention that in that area eclipse and javac accept
 
  different things
 

 The reason it warns you to use generics when generics are wanted is 
 because Sun wants to be able to make it *required* (in a future 
 release) to use generics where generics are wanted; at least, so I 
 read... I think in the real world they wouldn't dare to do this 
 because it would piss off so many users and break so much stuff. :-)

 But the idea is that if something is generified you should be using a
 
 type parameter, and using a raw type

Re: Using generics with some non-generic classes in Wicket

2008-05-14 Thread Doug Donohoe

From my original post on this topic:

public class StringModel extends ModelString 

-Doug


Peter Ertl wrote:
 
   StringModel looks ambigious to me, will it extend
 
 - LoadableDetachableModel
 - IModel
 - Model
 - AbstractReadOnlyModel
 - 
 
 ???
 
 
 
 
 Am 14.05.2008 um 15:47 schrieb Doug Donohoe:
 

 Let me outline what I believe the benefits are.  For example:

 add(new LabelString(tournamentName, tournament.getName()));
 add(new LabelString(hostName, game.getHostPlayer()));
 row.add(new AttributeModifier(class, true, new
 ModelString(row.getIndex() % 2 == 0 ? odd : even)));

 add(new StringLabel(tournamentName, tournament.getName()));
 add(new StringLabel(hostName, game.getHostPlayer()));
 row.add(new AttributeModifier(class, true, new  
 StringModel(row.getIndex()
 % 2 == 0 ? odd : even)));

 Sure, it seems like a small difference and a saving of two  
 characters, but
 here is what I believe are the benefits of doing this:

 1) I can more easily use the features of my IDE such as auto- 
 completion

 2) Find Usages is more accurate (at least in IntelliJ, where I'm not  
 aware
 of a find-usages that scopes to a particular generic type)

 3) Let's face it, Generics clutters up your code and makes it harder  
 to
 read.  This simplifies things a bit.

 In answer to Martijn's assumption (in a separate post) that I was  
 going to
 iterate over all java types and all wicket types:  that is an  
 incorrect
 assumption.  Obviously, I would want to pick the most common use  
 cases and
 seek feedback from the community.  Let us not dismiss it outright.  I
 believe this is a valid topic of conversation.  Generics are new to  
 Wicket
 and still unused by many Java APIs and likely new to many  
 programmers.  I
 can tell you that using classes such as this made it much quicker  
 and easier
 to remove all the warnings that showed up in my code when I migrated  
 to 1.4.
 It seems easier to replace common usage from before (new Label(...))  
 with
 new StringLabel(...)  rather than new LabelString (even typing  
 that now
 was more difficult).  In any case, there may be some complaining  
 about the
 extensive use of Generics in 1.4 once it is released.  This may make  
 it
 easier to transition.  Maybe not.  At least let's be open to  
 discussing it.

 Finally, in answer to the point about negating the point of  
 generics, I
 respectfully disagree.  One major point of generics is to avoid code
 duplication of boilerplate code.   It it weren't for the need to  
 create
 constructors, there wouldn't be any duplicated code.  I agree that  
 it is a
 fine balance to strike, but there are competing needs of readability  
 and
 maintainability.

 -Doug


 Hoover, William wrote:

 imho, that seems like that adds a lot of unnecessary code. One of the
 nice things about Wicket is that it keeps the bloat to a minimum.

 -Original Message-
 From: Doug Donohoe [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 14, 2008 8:21 AM
 To: users@wicket.apache.org
 Subject: Re: Using generics with some non-generic classes in Wicket


 Somewhat related to this thread, when I moved to generics win Wicket
 1.4,  I created some utility classes such as:

 public class VoidContainer extends WebMarkupContainerlt;Void public
 class VoidPanel extends Panellt;Void public class StringLabel  
 extends
 Labellt;String

 public class IntegerModel extends Modellt;Integer public class
 StringModel extends Modellt;String public class DateModel extends
 Modellt;Date public class DoubleModel extends Modellt;Double

 And so on.  This made my wicket code cleaner and easier to use.  I  
 think
 the Wicket 1.4 generics implementation is headed in the right  
 direction.
 It was a pain at first because I had to parameterize everything, but
 creating convenience classes like this made it easier.

 I'm thinking about creating a patch with a suite of these types of
 classes because I think users will want something like this.

 -Doug


 Johan Compagner wrote:

 The problem is that wicket needs an annotation

 genericsOptional

 so that all the warnings about raw types are gone.

 A component only has to be generic if you use the IModel constructor
 or call getModel(), getModelObject() methods..
 for the rest it is not really needed

 johan

 On Wed, May 14, 2008 at 9:28 AM, Sebastiaan van Erk
 [EMAIL PROTECTED]
 wrote:

 My post kind of missed the point, I shouldn't post when I'm already
 half asleep. :-)

 Obviously MarkupContainer satisfies the MarkupContainer? in a
 method argument, so it accepts the raw type. However, it  
 generates a
 warning because the method says it's generified, so you should be
 using the generic type.

 Johan Compagner wrote:

 I dont care, because i cant do any thing with the ? The only thing
 it enforces is that it must now be a generic class which is
 annoying. Not to mention that in that area eclipse and javac  
 accept

 different things


 The reason it warns you to use generics when generics

Re: Url resolve...

2008-05-13 Thread Doug Donohoe

That actually looks to be correct behavoir.If your URL is
www.myserver.com/myapplication/ , then going to .. takes you to
www.mysesrver.com/myapplication  (no trailing slash).  Then going to
/css/styles.css takes you to www.myserver.com/myapplication/css/styles.css

Where is your CSS file stored?  It should be in webapp/css.

If you go to http://www.myserver.com/myapplication/css/style.css in your
browser, is the file found?

-Doug


danielepiras wrote:
 
 Hi,
 
 I'm developing an application that run on www.myserver.com/myapplication/
 In my Index.html page, I include a css:
 link rel=stylesheet type=text/css href=css/style.css/
 
 The problem is that wicket transform href url and if I give a look to the
 page source I find:
 link rel=stylesheet type=text/css href=../css/style.css/
 
 So the css is not found because is refer to www.myserver.com/css/style.css
 and not www.myserver.com/myapplication/css/style.css
 
 What I have to do?
 Thank you very much
 Daniele
 

-- 
View this message in context: 
http://www.nabble.com/Url-resolve...-tp17203548p17206860.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicket 1.4 Generics

2008-05-09 Thread Doug Donohoe

I just migrated to 1.4-M1 and converted all my classes to use the new
generics support.  It cleaned up my code quite nicely - I got to remove a
lot of casting and cured many unchecked/raw messages.

It also make the code much more readable - especially in list views, etc.

Excellent work, Wicket team.

-Doug
-- 
View this message in context: 
http://www.nabble.com/Wicket-1.4-Generics-tp17149922p17149922.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice throws IllegalArgumentException with Integer values

2008-05-09 Thread Doug Donohoe

I posted on my wiki how I solved this problem.  Hopefully it will help you:

http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=DropDownChoice+Example

-Doug


Michael Mehrle wrote:
 
 The code is pretty massive, would be tough to post all that here.
 Basically, it's an integer backed DropDownChoice that has the word
 'guest' tagged on to incrementing numbers (e.g. 1 - 10) in the label.
 When I remove the word 'guest' in the label it works just fine. Did your
 dropdown have integers as the labels or was there more?
 
 It seems that the problem lies in the conversion, and that Wicket
 somehow is trying to grab the label value and put it into the model.
 
 If anyone has run into such a problem I'd appreciate any input.
 
 Michael
 
 
 
 -Original Message-
 From: Doug Donohoe [mailto:[EMAIL PROTECTED] 
 Sent: Friday, May 09, 2008 8:41 AM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice throws IllegalArgumentException with Integer
 values
 
 
 Post your code.  It's hard to guess w/out seeing the code.  I have an
 integer-based drop down choice working well (I used that example as my
 starting point).
 
 -Doug
 
 
 Michael Mehrle wrote:
 
 Anyone? Was hoping for some input here ;-)
 
 -Original Message-
 From: Michael Mehrle [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 08, 2008 6:35 PM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice throws IllegalArgumentException with
 Integer
 values
 
 Okay, I just stepped through this and getting the feeling that
 'somehow'
 the label is being passed on to the model. Now, if the label is '1' it
 works fine, but if it's '1 day', then I get that error.
 
 The question here is: why is the label being passed back to the model?
 Doesn't make any sense - I'm using a ChoiceRenderer as such:
 
 new ChoiceRenderer(label, value)
 
 Do I also need to add some kind of converter to properly assign the
 model?
 
 Any input would be appreciated.
 
 Michael
 
 -Original Message-
 From: Michael Mehrle [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 08, 2008 5:19 PM
 To: users@wicket.apache.org
 Subject: DropDownChoice throws IllegalArgumentException with Integer
 values
 
 This is the error I'm getting:
 
  
 
 [DEBUG LoadAdDataInterceptor] Loaded
 AdData:[EMAIL PROTECTED] 
 
 [ERROR RequestCycle] Cannot format given Object as a Number 
 
 java.lang.IllegalArgumentException: Cannot format given Object as a
 Number
 
 at java.text.DecimalFormat.format(DecimalFormat.java:480)
 
 at java.text.Format.format(Format.java:133)
 
 at

 org.apache.wicket.util.convert.converters.AbstractNumberConverter.conver
 tToString(AbstractNumberConverter.java:109)
 
 at

 org.apache.wicket.util.lang.PropertyResolverConverter.convert(PropertyRe
 solverConverter.java:84)
 
  
 
 I'm using ListSelectOption to populate the DropDownChoice, as per
 the
 online example:
 
  
 

 http://cwiki.apache.org/WICKET/another-dropdownchoice-example-by-adam.ht
 ml
 
  
 
 The only change I made to SelectOption is to set the 'value' field to
 an
 Integer (which I need for my model).
 
  
 
 Anyone any ideas as to what's going on? I'm pretty sure I didn't swap
 the label/value pairs as the labels show up properly.
 
  
 
 Thanks,
 
  
 
 Michael
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:
 http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-wit
 h-Integer-values-tp17139227p17150771.html
 Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-with-Integer-values-tp17139227p17151647.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PageParameters request-for-enhancement

2008-05-09 Thread Doug Donohoe

What is the likelihood that we can get this patch included in the next 1.4
milestone?

Again, I'll repeat my offer to submit it myself if given commit access.  I
updated the JIRA issue with the API javadoc to show what I added.

-Doug


Doug Donohoe wrote:
 
 I created https://issues.apache.org/jira/browse/WICKET-1596 and submitted
 a patch with test cases.  I'd be happy to commit if given commit access if
 that is easier.
 
 Perhaps my work on wicketstuff-annotation demonstrates my attention to
 detail in code and documentation.
 
 Thanks,
 
 -Doug
 
 
 Eelco Hillenius wrote:
 
 Hi,
 
 You can best file an RFE in JIRA for things like this. The list is
 primarily for questions and discussions, and adding it to JIRA will at
 least make sure it stays on the list of things to look at.
 
 Cheers,
 
 Eelco
 
 On Thu, Apr 24, 2008 at 3:00 PM, Doug Donohoe [EMAIL PROTECTED] wrote:

  Hi Wicket team:

  I'd like to be able to call getInt(name, default) and not have to worry
  about catching exceptions.  If the number can't be parsed, just return
 the
  default.

  I have a utility method which I use:

 public static int getInt(PageParameters params, String name, int
 def)
 {
 try
 {
 return params.getInt(name, def);
 }
 catch (StringValueConversionException ignored)
 {
 return def;
 }
 }

  Basically for my bookmarkable pages, I don't care if a user mucks with
 the
  URL - this would let me default to something reasonable.

  It would be nice if there were a comparable method on PageParameters
 ...
  like getIntSafe(name, def) or some something similar (and for other
  number-based getters).

  In addition, it would be nice to have a getInteger() object method that
  returns null if not defined or an Integer object.  The way it is now, I
 have
  to pick a default value that I assume won't ever be valid (usually -1).
  There are valid use cases where null is an expected value.

  -Doug

  -Doug


  --
  View this message in context:
 http://www.nabble.com/PageParameters-request-for-enhancement-tp16853545p16853545.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/PageParameters-request-for-enhancement-tp16853545p17152141.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: DropDownChoice throws IllegalArgumentException with Integer values

2008-05-09 Thread Doug Donohoe

Yes, I'm on 1.4-m1.  However, you can remove all the generic stuff and it
will still work.  I just migrated to generics yesterday, so the code does
work on 1.3.3.

Or you can invest in moving to 1.4-m1.  It seems to be working great and
using generics is nice.

-Doug


Michael Mehrle wrote:
 
 Hi Doug:
 
 Thanks for that - this might just work :-) One problem I'm running into
 is that the version of IChoiceRenderer I am using cannot be
 parameterized (it's not generic). Do you have a different wicket release
 than I do?
 
 I'm on 1.3.3.
 
 Michael
 
 -Original Message-
 From: Doug Donohoe [mailto:[EMAIL PROTECTED] 
 Sent: Friday, May 09, 2008 9:30 AM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice throws IllegalArgumentException with Integer
 values
 
 
 I posted on my wiki how I solved this problem.  Hopefully it will help
 you:
 
 http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=DropDownChoice+Example
 
 -Doug
 
 
 Michael Mehrle wrote:
 
 The code is pretty massive, would be tough to post all that here.
 Basically, it's an integer backed DropDownChoice that has the word
 'guest' tagged on to incrementing numbers (e.g. 1 - 10) in the label.
 When I remove the word 'guest' in the label it works just fine. Did
 your
 dropdown have integers as the labels or was there more?
 
 It seems that the problem lies in the conversion, and that Wicket
 somehow is trying to grab the label value and put it into the model.
 
 If anyone has run into such a problem I'd appreciate any input.
 
 Michael
 
 
 
 -Original Message-
 From: Doug Donohoe [mailto:[EMAIL PROTECTED] 
 Sent: Friday, May 09, 2008 8:41 AM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice throws IllegalArgumentException with
 Integer
 values
 
 
 Post your code.  It's hard to guess w/out seeing the code.  I have an
 integer-based drop down choice working well (I used that example as my
 starting point).
 
 -Doug
 
 
 Michael Mehrle wrote:
 
 Anyone? Was hoping for some input here ;-)
 
 -Original Message-
 From: Michael Mehrle [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 08, 2008 6:35 PM
 To: users@wicket.apache.org
 Subject: RE: DropDownChoice throws IllegalArgumentException with
 Integer
 values
 
 Okay, I just stepped through this and getting the feeling that
 'somehow'
 the label is being passed on to the model. Now, if the label is '1'
 it
 works fine, but if it's '1 day', then I get that error.
 
 The question here is: why is the label being passed back to the
 model?
 Doesn't make any sense - I'm using a ChoiceRenderer as such:
 
 new ChoiceRenderer(label, value)
 
 Do I also need to add some kind of converter to properly assign the
 model?
 
 Any input would be appreciated.
 
 Michael
 
 -Original Message-
 From: Michael Mehrle [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, May 08, 2008 5:19 PM
 To: users@wicket.apache.org
 Subject: DropDownChoice throws IllegalArgumentException with Integer
 values
 
 This is the error I'm getting:
 
  
 
 [DEBUG LoadAdDataInterceptor] Loaded
 AdData:[EMAIL PROTECTED] 
 
 [ERROR RequestCycle] Cannot format given Object as a Number 
 
 java.lang.IllegalArgumentException: Cannot format given Object as a
 Number
 
 at java.text.DecimalFormat.format(DecimalFormat.java:480)
 
 at java.text.Format.format(Format.java:133)
 
 at


 org.apache.wicket.util.convert.converters.AbstractNumberConverter.conver
 tToString(AbstractNumberConverter.java:109)
 
 at


 org.apache.wicket.util.lang.PropertyResolverConverter.convert(PropertyRe
 solverConverter.java:84)
 
  
 
 I'm using ListSelectOption to populate the DropDownChoice, as per
 the
 online example:
 
  
 


 http://cwiki.apache.org/WICKET/another-dropdownchoice-example-by-adam.ht
 ml
 
  
 
 The only change I made to SelectOption is to set the 'value' field to
 an
 Integer (which I need for my model).
 
  
 
 Anyone any ideas as to what's going on? I'm pretty sure I didn't swap
 the label/value pairs as the labels show up properly.
 
  
 
 Thanks,
 
  
 
 Michael
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View this message in context:

 http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-wit
 h-Integer-values-tp17139227p17150771.html
 Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -- 
 View

RE: DropDownChoice throws IllegalArgumentException with Integer values

2008-05-09 Thread Doug Donohoe

You can get at the underlying Integer by calling getKey() on the
IntegerSelectChoice object the model holds.  If that doesn't work, you'll
have to figure out an alternative on your own.  The good news is that you
have working code to start from.

-Doug



Michael Mehrle wrote:
 
 I like your solution, but you are using an IntegerSelectChoice as your
 model, which won't work for me. I need to set my model to a regular
 Integer since that's what's being persisted on the backend.
 
 Michael
 

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-throws-IllegalArgumentException-with-Integer-values-tp17139227p17159082.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [announce] wicketstuff-annotation 1.0 released

2008-05-07 Thread Doug Donohoe

Thank you Maarten for pointing out the documentation I wrote on this.

In my project, I have 60+ jar files in the classpath and the scan only took
255 milliseconds (on a 1.66 ghz core duo mac).

Initializing hibernate takes much longer.  

I think this is pretty decent, and since it is only incurred at startup, we
don't require an alternate solution.  Also note that anything JAR-based
would not easily work in development environments where you don't JAR after
each change.

-Doug


Maarten Bosteels wrote:
 
 On Wed, May 7, 2008 at 9:20 AM, Johan Compagner [EMAIL PROTECTED]
 wrote:
 
 if the scanning of the classpath is expensive (i guess all classes are
 loaded that are scanned..)
 
 
 Hi,
 
 I guess you haven't read the docs completely :-)
 
 It says: Note that Spring does not load the class to determine this
 information. Instead, it uses a meta-data reader to determine this (which
 is
 faster than going through class loading). and also: The class path
 scanning is very efficient by itself and limiting the search only makes it
 faster.
 
 regards,
 Maarten
 
 

 cant there be an option that the scanning is only done once?
 When you create the jar so with maven/ant?
 When creating the jar you are scanning everything and create a manifest
 entries of all the packages.
 those manifest entries are then read in when the jar is in the classpath

 johan
 
 

-- 
View this message in context: 
http://www.nabble.com/-announce--wicketstuff-annotation-1.0-released-tp17090601p17103504.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: wicket-extensions javadoc

2008-05-07 Thread Doug Donohoe

Matthijs,

I had to host javadoc for my own wicketstuff-annotations project, so I
decided to put the Wicket docs there (since the main site isn't up-to-date). 
I added wicket-extensions to the site:

http://www.ddpoker.com/javadoc/

-Doug


Matthijs Wensveen-2 wrote:
 
 Hi,
 I'm not sure this is the right place, but anyway. The online javadoc of 
 wicket-extensions at 
 http://wicketframework.org/wicket-extensions/apidocs/index.html is of 
 version 1.2-SNAPSHOT, but the latest release is 1.3.3. The javadoc that 
 maven pulls in is more current. Could the online javadocs be updated
 please?
 
 Thanks,
 Matthijs
 
 -- 
 Matthijs Wensveen
 Func. Internet Integration
 W http://www.func.nl
 T +31 20 423
 F +31 20 4223500 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-extensions-javadoc-tp17099232p17108936.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: PageParameters request-for-enhancement

2008-05-07 Thread Doug Donohoe

I created https://issues.apache.org/jira/browse/WICKET-1596 and submitted a
patch with test cases.  I'd be happy to commit if given commit access if
that is easier.

Perhaps my work on wicketstuff-annotation demonstrates my attention to
detail in code and documentation.

Thanks,

-Doug


Eelco Hillenius wrote:
 
 Hi,
 
 You can best file an RFE in JIRA for things like this. The list is
 primarily for questions and discussions, and adding it to JIRA will at
 least make sure it stays on the list of things to look at.
 
 Cheers,
 
 Eelco
 
 On Thu, Apr 24, 2008 at 3:00 PM, Doug Donohoe [EMAIL PROTECTED] wrote:

  Hi Wicket team:

  I'd like to be able to call getInt(name, default) and not have to worry
  about catching exceptions.  If the number can't be parsed, just return
 the
  default.

  I have a utility method which I use:

 public static int getInt(PageParameters params, String name, int def)
 {
 try
 {
 return params.getInt(name, def);
 }
 catch (StringValueConversionException ignored)
 {
 return def;
 }
 }

  Basically for my bookmarkable pages, I don't care if a user mucks with
 the
  URL - this would let me default to something reasonable.

  It would be nice if there were a comparable method on PageParameters ...
  like getIntSafe(name, def) or some something similar (and for other
  number-based getters).

  In addition, it would be nice to have a getInteger() object method that
  returns null if not defined or an Integer object.  The way it is now, I
 have
  to pick a default value that I assume won't ever be valid (usually -1).
  There are valid use cases where null is an expected value.

  -Doug

  -Doug


  --
  View this message in context:
 http://www.nabble.com/PageParameters-request-for-enhancement-tp16853545p16853545.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/PageParameters-request-for-enhancement-tp16853545p17114188.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicket 1.4 and generics

2008-05-07 Thread Doug Donohoe

I'm just now using 1.4.  What type of thing is expected for T in WebPageT ?

It looks like what your model object is.  But if your page doesn't use
models (perhaps just it's children do), is the correct thing to do this?

class MyPage extends WebPage

I have lots of 'unchecked' and 'raw use' warnings now, so I'd like to know
what the recommended approach is.

Thanks,

-Doug
-- 
View this message in context: 
http://www.nabble.com/Wicket-1.4-and-generics-tp17115357p17115357.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Wicket 1.4 faster in development

2008-05-07 Thread Doug Donohoe

I don't know if this is intentional or not, but pages seem to load much
faster in development mode in Wicket 1.4-m1. 

It looks like the CSS and JS files are not reloaded on each request as they
were previously.  Was this an intentional change?

-Doug
-- 
View this message in context: 
http://www.nabble.com/Wicket-1.4-faster-in-development-tp17115476p17115476.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket 1.4 and generics

2008-05-07 Thread Doug Donohoe

HTML gobbled my lt;Object in that last message ... my proposed example was:

class MyPage extends WebPagelt;Object



Doug Donohoe wrote:
 
 I'm just now using 1.4.  What type of thing is expected for T in
 WebPageT ?
 
 It looks like what your model object is.  But if your page doesn't use
 models (perhaps just it's children do), is the correct thing to do this?
 
 class MyPage extends WebPage
 
 I have lots of 'unchecked' and 'raw use' warnings now, so I'd like to know
 what the recommended approach is.
 
 Thanks,
 
 -Doug
 

-- 
View this message in context: 
http://www.nabble.com/Wicket-1.4-and-generics-tp17115357p17115478.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [announce] wicketstuff-annotation 1.0 released

2008-05-06 Thread Doug Donohoe

Matthijs,

That is a good point and I did consider that, but I thought if anyone else
wants to do things with annotations and wicket in the future, this would be
a perfect place to put that code (especially given the underlying scanning
support).  Thus, I was being optimistic about the future.  Believe me, I
spent an hour staring out the window trying to decide on the right name.

Hopefully the documentation explains clearly what it does.

-Doug


Matthijs Wensveen-2 wrote:
 
 Doug Donohoe wrote:
 I am pleased to announce the 1.0 release of wicketstuff-annotation.
   
 
 Nice. But the name 'wicketstuff-annotation' does not say anything about 
 what it does, just 'something with annotations'. IMO 
 'wicketstuff-mount-annotations' or somesuch would be better.
 
 Just my 2c.
 Matthijs
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/-announce--wicketstuff-annotation-1.0-released-tp17090601p17091003.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [announce] wicketstuff-annotation 1.0 released

2008-05-06 Thread Doug Donohoe

That's not a bad idea.  I'll put it on my TODO list.  I may wait and see what
other annotation specific needs arise before acting.

-Doug


Hoover, William wrote:
 
 Would it be better if there were a core wicket-annotation project that
 provides the basics (such as the scanner) and another project called
 wicket-automount (with wicket-annotation dependency)? That way other
 future projects can utilize the core capabilities without reinventing
 the wheel. This would also accommodate those who want a specific
 dependency for wicket-automount.
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of James Carman
 Sent: Tuesday, May 06, 2008 4:37 PM
 To: users@wicket.apache.org
 Subject: Re: [announce] wicketstuff-annotation 1.0 released
 
 The name wicket-annotations doesn't really tell you anything about what
 features it provides (as was pointed out earlier).  If I were a person
 wanting to find an easier way to mount pages, it wouldn't necessarily be
 obvious to check wicket-annotations.  However, it would be more obvious
 if I saw something called wicket-automount.
 
 On Tue, May 6, 2008 at 4:02 PM, Ryan Sonnek [EMAIL PROTECTED]
 wrote:
 the only reason to break annotations out into separate distributions 
 is if  new dependencies are introduced with a subset of annotations.

  if a new annotation comes along that requires hibernate jars to be on
 
 the  classpath, that definitely should be it's own project.  
 otherwise, it makes  sense to lump all annotations together.

  On Tue, May 6, 2008 at 2:59 PM, James Carman 
 [EMAIL PROTECTED]
  wrote:



   Yes, but should we globalize the annotations namespace to mean 
 that   anyone who wants to do anything with annotations should put it
 
 inside   this project?  Perhaps keeping things smaller is a better 
 idea.  That   way, if I want to use automount, but I don't want all 
 of the other   annotation-based goodies, I can just download this 
 little nugget and   use it.
  
   On Tue, May 6, 2008 at 3:55 PM, Doug Donohoe [EMAIL PROTECTED]
 wrote:
   
 Matthijs,
   
 That is a good point and I did consider that, but I thought if 
 anyone   else wants to do things with annotations and wicket in
 
 the future, this   would be a perfect place to put that code 
 (especially given the underlying   scanning support).  Thus, I 
 was being optimistic about the future.  Believe me,   I spent 
 an hour staring out the window trying to decide on the right   name.
   
 Hopefully the documentation explains clearly what it does.
   
 -Doug
   
   
   
   
 Matthijs Wensveen-2 wrote:
 
  Doug Donohoe wrote:
  I am pleased to announce the 1.0 release of
 wicketstuff-annotation.
 
 
  Nice. But the name 'wicketstuff-annotation' does not say 
 anything   about  what it does, just 'something with 
 annotations'. IMO  'wicketstuff-mount-annotations' or somesuch 
 would be better.
 
  Just my 2c.
  Matthijs
 
  
 -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
  -- View this message in 
 context:
   
 http://www.nabble.com/-announce--wicketstuff-annotation-1.0-released-t
 p17090601p17091003.html
   
Sent from the Wicket - User mailing list archive at Nabble.com.
   
   
 
 -
   
   
To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]  
 
 
 -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]

 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/-announce--wicketstuff-annotation-1.0-released-tp17090601p17092957.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket 2.0 time frame

2008-05-03 Thread Doug Donohoe

Eelco,

Thanks for the thorough and thoughtful reply.  Perhaps there are things that
can be done in the framework with cookies and such.

I am going to be looking to additions to wicket.  I need to get the source
built and working in my local environment.

-Doug



Eelco Hillenius wrote:
 
 
  Another approach is to provide a more graceful session-expiration
 strategy.
  In many cases, you could redisplay the original page (perhaps there are
  cases where the no-arg constructor would work).
 
 A much better way of solving your problems is to work with plenty of
 bookmarkable pages AND use cookies to recognize that you could pick up
 a session again, and you could even for instance save the last page or
 pages a user visited in the last visited etc (I'm sure Amazon does
 something like that). You'll just have to plan carefully for it, and
 depend more on your own brainpower than to expect everything to come
 from the framework.
 
  Finally, there are likely cases where parts of a page could be stateful
 and
  others stateless.  In my case, even though I display a login form via
 Ajax,
  it still should be possible to submit it in a stateless format.

  Let me end by saying that I am a big believer in the framework. 
 However, I
  feel the session expiration issue is a stumbling block.  I welcome
 others
  perspectives on this.
 
 The problem that Wicket tries to solve is quite hard*, and
 consequently the framework has gotten quite complex. The more we
 facilitate corner cases and try to be a framework that fits all
 imaginable problems, the harder the framework will be too maintain,
 and - due to having more options to cover - the harder it may be to
 use.
 
 We've taken some serious looks at how to come up with a hybrid model
 and push Wicket into supporting even more stateless use cases, but so
 far these efforts stranded because the solutions we came up with were
 very hackish and would probably open up a big fat can of worms we
 wouldn't be able to support properly. Maybe we can improve things here
 and there (we're all for that!), but it is really important that
 people come up with intelligent solutions (patches would be great)
 rather than just stating shortcomings.
 
 Cheers,
 
 Eelco
 
 

-- 
View this message in context: 
http://www.nabble.com/Wiket-2.0-time-frame-tp16992791p17034406.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket 2.0 time frame

2008-05-01 Thread Doug Donohoe

Hi Jonathan,

I'd like to open a discussion about this stance on stateless web ui
because I think the original question is really one about Wicket's use of
the session.  By default, all wicket forms and links are stateful or
dependent on the Wicket Session.  If the session goes away, the links and
forms cease to work.  This can lead to a bad user experience.

For example, in trying to figure out how to do paging, I was using the
Wicket repeater view examples application: 
http://wicketstuff.org/wicket13/repeater/.  I must have experienced 'page
expired' messages 5 times because I'd look at an example's source code, work
on some code, go back to learn some more only to lose my place and have to
start all over again.  That was frustrating and unnecessary.  Perhaps this
is just bad application design - they could have used bookmarkable pages -
but they used the default wicket way.

You stated i personally think 'stateless' web ui is nearly always a fantasy
or an architectural mistake.  It seems to me there are two classes of
applications:

  * Primarily stateless (or in Wicket parlance, primarily bookmarkable)
  * Primarily stateful

Stateless Sites
-

For example, Google's search is apparently stateless.  I can bookmark any
search result, go away for hours, days or weeks and re-visit the link
without experiencing a session-expired message.  I shop at Amazon quite a
bit.  I can have a page open to a product for hours and no matter when I
click buy now, it always works.  My Yahoo page is similar.  I use several
computers and I may have a My Yahoo page open from days ago.  If I click on
any link, or submit a form (e.g., weather / stock), it always works.  So, in
many common sites, they appear to be stateless.  Some of these cites
certainly maintain some state on the back-end, but it is transparent to the
user.

Stateful Sites
---

Examples of sites which are legitimately stateful and require you to start
over when the session expires are banking and finance sites.  If you leave a
page open for a while and go back to click on a link, you often get your
login timed out and you have to login again and start over.  Some of them
remember where you wanted to go and redirect after you re-login.

Wicket


My experience comes from moving http://online.ddpoker.com/ from jsp to
wicket.  I'm about 75% done.  Other than normal learning curve time, it
feels like I've been spending too much time fighting the session expiration
consequences.  My goal (as is most, I would guess) is to create a site that
has a good user experience.  I don't want a user to ever see a page expired
message.  That is bad application design.  I want my architecture to help
me avoid bad design.

One example was figuring out how to create a bookmarkable form submission (I
captured my experience on my wiki:  http://tinyurl.com/6xhyl3 ).

Another example is trying to get my login form to not expire.  However,
since I unveil it via Ajax, it seems to not want to be stateless ... haven't
investigated it much, but I'll probably have to create some workaround.

My point is that wicket should make things easier.  These seem like very
common issues - I'm curious to hear other users perspectives and
experiences.

If I were on the wicket team, I'd ask the question:  How could one use
Wicket to rebuild sites like Google, Amazon.com, My Yahoo, etc.?  
Developers are looking to choose a framework to build cool applications. 
There are a lot of choices out there.  I chose to use Wicket over other
frameworks like Ruby on Rails because I fundamentally like the approach of
100% Java and very little specialized markup.  Being able to refactor, find
usages and leverage IDE support is a huge win.

Moving Forward
--

So, to further expand the original question regarding plans for the future
of Wicket, let me add these thoughts:

It seems like there are multiple approaches to address the Session
Expiration issue.

One is to make sessions that never expire.  Keeping a session alive for-ever
in memory is obviously not a feasible approach.  However, perhaps sessions
could be spooled to disk after some time.  Has there been any work done on
this?

Another approach is to provide a more graceful session-expiration strategy. 
In many cases, you could redisplay the original page (perhaps there are
cases where the no-arg constructor would work).

Finally, there are likely cases where parts of a page could be stateful and
others stateless.  In my case, even though I display a login form via Ajax,
it still should be possible to submit it in a stateless format.

Let me end by saying that I am a big believer in the framework.  However, I
feel the session expiration issue is a stumbling block.  I welcome others
perspectives on this.

Respectfully,

-Doug


Jonathan Locke wrote:
 
 
 there will be no wicket 2.0 (no breaking changes).  wicket 1.4 and 1.5 are
 next.  
 
 wicket already provides a good amount of support for statelessness 

Re: submit form to bookmarkable page

2008-05-01 Thread Doug Donohoe

Hi Catalin,

Good find on the 'formname:elementname' issue.  I'm not sure whether
isTransparentResolver() will solve the issue - you can try it and find out.

I ended up using a StatelessForm and redirect as I've document here:

http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=Bookmarkable%20Form%20Submission%20in%20Wicket

I haven't looked into getting a single GET to work, however the solution
would basically be putting the wicket stuff in hidden fields.

In the meantime, the Stateless form and redirect is a decent interim
solution.

-Doug


Catalin Marinas wrote:
 
 
 Catalin Marinas wrote:
 
 I'm not sure that's the best way but I wanted to avoid calling
 onComponentTagBody in Form which generates the hidden fields. Ideally, I
 should use a WebMarkupContainer but, as you noticed, it adds the changes
 the elementname with formname:elementname. Somehow, the Form class
 manages to avoid this even though it inherits WebMarkupContainer but I
 couldn't figure out. Does anyone now how it does this?
 
 
 Looking through the code, it seems that the formname:elementname string
 gets generated in FormComponent#getInputName(). This function checks
 whether the parent is a Form and no longer adds the formname: string.
 Since WebMarkupContainer is not a Form, it always does this. A solution
 would be to override this function in any newly created FormComponent.
 
 Would overriding WebMarkupContainer#isTransparentResolver() to return true
 have the same effect by attaching the children directly to the page?
 
 Thanks,
 
 Catalin
 

-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16993338.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wicket 2.0 time frame

2008-05-01 Thread Doug Donohoe

I'm using Wicket 1.3.3 on Tomcat 6.0.16.  I'm using whatever the default
session store implementation is because I haven't done anything to configure
it.

Are you suggesting there is a way to avoid session expirations?  

I'm not sure your previous suggestion to lengthen session time-out solves
the issue because (a) it basically delays the problem and (b) causes the
server to use more memory than perhaps is necessary.

My experience with the wicket-stuff at
http://wicketstuff.org/wicket13/repeater/ suggests that this is an issue.  I
couldn't step away from a source-code example for more than 10/15 minutes
without having the pages expire, at which point I had to find my way back to
the right source file.  I can't link to the source page since it
wicket:interface style link (the one at the top of the page).

Rightly or wrongly, as a first time user, what sticks in my mind is an awful
lot of page expired messages.  I'm pretty sure I saw them very early on
when exploring the examples off the main wicket.apache.org page.  I think
this is all hosted life at wicketstuff.org.  Is that server configured
improperly too?

Cheers,

-Doug


Jonathan Locke wrote:
 
 
 the more i think about this, the more i'm suspecting you've just got a
 bunch of configuration problems.
 
 what version of wicket are you using and what session store
 implementation?
 
 also, tomcat provides a facility for writing out less active sessions to
 disk.
 
 
 Doug Donohoe wrote:
 
 Hi Jonathan,
 
 I'd like to open a discussion about this stance on stateless web ui
 because I think the original question is really one about Wicket's use of
 the session.  By default, all wicket forms and links are stateful or
 dependent on the Wicket Session.  If the session goes away, the links and
 forms cease to work.  This can lead to a bad user experience.
 
 For example, in trying to figure out how to do paging, I was using the
 Wicket repeater view examples application: 
 http://wicketstuff.org/wicket13/repeater/.  I must have experienced 'page
 expired' messages 5 times because I'd look at an example's source code,
 work on some code, go back to learn some more only to lose my place and
 have to start all over again.  That was frustrating and unnecessary. 
 Perhaps this is just bad application design - they could have used
 bookmarkable pages - but they used the default wicket way.
 
 You stated i personally think 'stateless' web ui is nearly always a
 fantasy or an architectural mistake.  It seems to me there are two
 classes of applications:
 
   * Primarily stateless (or in Wicket parlance, primarily bookmarkable)
   * Primarily stateful
 
 Stateless Sites
 -
 
 For example, Google's search is apparently stateless.  I can bookmark any
 search result, go away for hours, days or weeks and re-visit the link
 without experiencing a session-expired message.  I shop at Amazon quite a
 bit.  I can have a page open to a product for hours and no matter when I
 click buy now, it always works.  My Yahoo page is similar.  I use
 several computers and I may have a My Yahoo page open from days ago.  If
 I click on any link, or submit a form (e.g., weather / stock), it always
 works.  So, in many common sites, they appear to be stateless.  Some of
 these cites certainly maintain some state on the back-end, but it is
 transparent to the user.
 
 Stateful Sites
 ---
 
 Examples of sites which are legitimately stateful and require you to
 start over when the session expires are banking and finance sites.  If
 you leave a page open for a while and go back to click on a link, you
 often get your login timed out and you have to login again and start
 over.  Some of them remember where you wanted to go and redirect after
 you re-login.
 
 Wicket
 
 
 My experience comes from moving http://online.ddpoker.com/ from jsp to
 wicket.  I'm about 75% done.  Other than normal learning curve time, it
 feels like I've been spending too much time fighting the session
 expiration consequences.  My goal (as is most, I would guess) is to
 create a site that has a good user experience.  I don't want a user to
 ever see a page expired message.  That is bad application design.  I
 want my architecture to help me avoid bad design.
 
 One example was figuring out how to create a bookmarkable form submission
 (I captured my experience on my wiki:  http://tinyurl.com/6xhyl3 ).
 
 Another example is trying to get my login form to not expire.  However,
 since I unveil it via Ajax, it seems to not want to be stateless ...
 haven't investigated it much, but I'll probably have to create some
 workaround.
 
 My point is that wicket should make things easier.  These seem like very
 common issues - I'm curious to hear other users perspectives and
 experiences.
 
 If I were on the wicket team, I'd ask the question:  How could one use
 Wicket to rebuild sites like Google, Amazon.com, My Yahoo, etc.?  
 Developers are looking to choose a framework to build cool

StatelessForm doesn't work with GET method

2008-04-30 Thread Doug Donohoe

As part of my effort to submit a form to a bookmarkable page, I discovered
this bug when trying to uses a stateless form with the GET method of a form. 
I've documented my saga at 

http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=Bookmarkable%20Form%20Submission%20in%20Wicket

The original thread was
http://www.nabble.com/submit-form-to-bookmarkable-page-to16912974.html

Post method seems to work fine.  The error message is:

WicketMessage: Internal error parsing wicket:interface =
%3A1%3Aform%3A%3AIFormSubmitListener%3A%3A

Root cause:

org.apache.wicket.WicketRuntimeException: Internal error parsing
wicket:interface = %3A1%3Aform%3A%3AIFormSubmitListener%3A%3A
at
org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:583)
at
org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:554)
at
org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.decode(WebRequestCodingStrategy.java:199)
at org.apache.wicket.Request.getRequestParameters(Request.java:171)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1224)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:613)

-- 
View this message in context: 
http://www.nabble.com/StatelessForm-doesn%27t-work-with-GET-method-tp16983393p16983393.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: submit form to bookmarkable page

2008-04-30 Thread Doug Donohoe

Setting the action to the page URL doesn't quite work with default wicket
URLs since they pass information in the query string and browsers ignore
anything after the '?' in a GET action.

I'd have to set some hidden fields like wicket:bookmarkablePage=[.] as
well as the other fields the page depends on (anything in PageParameters). 
I haven't pursued this yet, but will.  I'm not sure if Form has a way to add
arbitrary hidden fields.

Another problem with using a WebMarkupContainer instead of a form is that
the form children get renamed to 'form:days' and 'form:games' instead of
just 'days' and 'games'.  I haven't looked into that either.  The issue with
this is that the params come down as form:days=Xform:games=Y instead of
just days=Xgames=Y.

For posterity, I've documented most of my lessons on my wiki:

http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=Main

-Doug


Johan Compagner wrote:
 
 What you want is just stateless forms, but if you just want to do a
 get to a page then your page with the form can be really simple
 
 Just 1 markup container for the form tag that just has an atribute
 modifier that sets the action to the page url.
 
 On 4/29/08, Doug Donohoe [EMAIL PROTECTED] wrote:

 Obviously, if you post with GET method, you don't get those dialogs.  
 A
 post and redirect means two hits to the server where-as a GET is only
 one.
 Using the GET method makes your average web page bookmarkable.

 The code I used was basically this:

super.onComponentTag(tag)
tag.put(action, urlFor(Foo.class, params);

 That doesn't work.  It still submits using the 'interface' stuff -
 apparently because of hidden fields.  I tried using a WebMarkupContainer
 instead of a form, but that fails due to the ? in the URL.  Also, for
 some
 reason the form elements are renamed 'formname:elementname' when using a
 WebMarkupContainer.

 I really like Wicket quite a bit, but this issue with forms and constant
 'session expired' messages are my biggest sticking point.

 -Doug


 igor.vaynberg wrote:
 
  thats what stateless forms are for. after a submit you want a redirect
  anyways so that a refresh doesnt popup that annoying post values
  dialog.
 
  overriding oncomponenttag() should work just fine, you just have to
  make sure to call super first.
 
  -igor
 
 
  On Mon, Apr 28, 2008 at 7:08 PM, Doug Donohoe [EMAIL PROTECTED]
 wrote:
 
   Overriding onComponentTag doesn't seem to work.  The URL that gets
  generated
   (using urlFor) starts with a question mark which isn't included when
 the
   form is submitted.   The only thing passed down is the form
 parameters,
   which obviously doesn't work since the page is missing.  I'm using
 the
   default URL encoding strategy - was saving that investigation for
 later.
   Maybe I need to bump that up in the queue.
 
   I'll also look at using a stateless form next (and redirecting to a
   bookmarkable page so the URL is nice).
 
   Just a general comment on this.  I basically want a form that can be
   submitted at any time, regardless if a session is there or not.  
 This
  is a
   common use case (e.g., google, login, search) and for all the
 excellent
   stuff in wicket, this seems very hard to do.
 
   Does anyone else have advice on how to do nice-looking-urls using
  GET-method
   form posts?  In other words, if I wanted to build Google's home page
 in
   wicket and be able to bookmark search results, how would I do it?  If
  anyone
   has an example they can share, I would appreciate it.
 
   Regards,
 
   -Doug
 
 
 
 
   igor.vaynberg wrote:
   
override the form's action value in its oncomponenttag callback
 with a
url to a bookmarkable page. but then you have to parse all posted
values yourself.
   
if you dont care about the url you can use a statelessform instead
 and
probably avoid a bunch of headache.
   
-igor
   
   
On Sat, Apr 26, 2008 at 6:36 AM, Doug Donohoe [EMAIL PROTECTED]
  wrote:
   
 Hi,
   
 I'm like to submit a form using bookmarkable page style, so that
   
 a) the form can always be submitted, regardless if the session is
expired or
 not (think of a Google search submission e.g.,
 http://www.google.com/search?q=wicket)
   
 b) the form remembers PageParameters that were there when the
 page
  was
 generated (think of google advanced search where you change the
  number
of
 items per page and that is remembered in subsequent searches
 e.g.,
 http://www.google.com/search?q=wicketnum=30)
   
 How do I tell the form to submit using bookmarkable format (using
  the
 assigned URL encoding strategy)?
   
 Thanks,
   
 -Doug
 --
 View this message in context:
   
 
 http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16912974.html
 Sent from the Wicket - User mailing list archive at Nabble.com.
   
   
   
  -
 To unsubscribe, e-mail: [EMAIL PROTECTED

Re: submit form to bookmarkable page

2008-04-30 Thread Doug Donohoe

If you create a form that looks like:

  lt;form
 
action=?wicket:bookmarkablePage=%3Acom.donohoedigital.poker.pages.Leaderboard
  method=get
  gt;

When the form is posted, the stuff after the ? in the action is ignored.  It
is replaced with the form values (hidden or otherwise).

-Doug


Martijn Dashorst wrote:
 
 On 4/30/08, Doug Donohoe [EMAIL PROTECTED] wrote:
  Setting the action to the page URL doesn't quite work with default
 wicket
  URLs since they pass information in the query string and browsers ignore
  anything after the '?' in a GET action.
 
 Huh? Query string encoding is how browsers submit forms using GET.
 Wicket works just fine with that. You can retrieve the parameters
 using the PageParameters page constructor (mount the page using a
 QueryStringUrlCodingStrategy)
 
 Martijn
 
 -- 
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.3 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16985299.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: StatelessForm doesn't work with GET method

2008-04-30 Thread Doug Donohoe

I created a JIRA issue:

https://issues.apache.org/jira/browse/WICKET-1580


Doug Donohoe wrote:
 
 As part of my effort to submit a form to a bookmarkable page, I discovered
 this bug when trying to uses a stateless form with the GET method of a
 form.  I've documented my saga at 
 
 http://wiki.donohoedigital.com/wiki/Wiki.jsp?page=Bookmarkable%20Form%20Submission%20in%20Wicket
 
 The original thread was
 http://www.nabble.com/submit-form-to-bookmarkable-page-to16912974.html
 
 Post method seems to work fine.  The error message is:
 
 WicketMessage: Internal error parsing wicket:interface =
 %3A1%3Aform%3A%3AIFormSubmitListener%3A%3A
 
 Root cause:
 
 org.apache.wicket.WicketRuntimeException: Internal error parsing
 wicket:interface = %3A1%3Aform%3A%3AIFormSubmitListener%3A%3A
 at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:583)
 at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:554)
 at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.decode(WebRequestCodingStrategy.java:199)
 at org.apache.wicket.Request.getRequestParameters(Request.java:171)
 at org.apache.wicket.RequestCycle.step(RequestCycle.java:1224)
 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331)
 at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
 at
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363)
 at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at
 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
 at
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Thread.java:613)
 
 

-- 
View this message in context: 
http://www.nabble.com/StatelessForm-doesn%27t-work-with-GET-method-tp16983393p16990943.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: submit form to bookmarkable page

2008-04-28 Thread Doug Donohoe

Overriding onComponentTag doesn't seem to work.  The URL that gets generated
(using urlFor) starts with a question mark which isn't included when the
form is submitted.   The only thing passed down is the form parameters,
which obviously doesn't work since the page is missing.  I'm using the
default URL encoding strategy - was saving that investigation for later. 
Maybe I need to bump that up in the queue.

I'll also look at using a stateless form next (and redirecting to a
bookmarkable page so the URL is nice).

Just a general comment on this.  I basically want a form that can be
submitted at any time, regardless if a session is there or not.   This is a
common use case (e.g., google, login, search) and for all the excellent
stuff in wicket, this seems very hard to do.  

Does anyone else have advice on how to do nice-looking-urls using GET-method
form posts?  In other words, if I wanted to build Google's home page in
wicket and be able to bookmark search results, how would I do it?  If anyone
has an example they can share, I would appreciate it.

Regards,

-Doug


igor.vaynberg wrote:
 
 override the form's action value in its oncomponenttag callback with a
 url to a bookmarkable page. but then you have to parse all posted
 values yourself.
 
 if you dont care about the url you can use a statelessform instead and
 probably avoid a bunch of headache.
 
 -igor
 
 
 On Sat, Apr 26, 2008 at 6:36 AM, Doug Donohoe [EMAIL PROTECTED] wrote:

  Hi,

  I'm like to submit a form using bookmarkable page style, so that

  a) the form can always be submitted, regardless if the session is
 expired or
  not (think of a Google search submission e.g.,
  http://www.google.com/search?q=wicket)

  b) the form remembers PageParameters that were there when the page was
  generated (think of google advanced search where you change the number
 of
  items per page and that is remembered in subsequent searches e.g.,
  http://www.google.com/search?q=wicketnum=30)

  How do I tell the form to submit using bookmarkable format (using the
  assigned URL encoding strategy)?

  Thanks,

  -Doug
  --
  View this message in context:
 http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16912974.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16951990.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: submit form to bookmarkable page

2008-04-28 Thread Doug Donohoe

Obviously, if you post with GET method, you don't get those dialogs.   A
post and redirect means two hits to the server where-as a GET is only one. 
Using the GET method makes your average web page bookmarkable.

The code I used was basically this:

   super.onComponentTag(tag)
   tag.put(action, urlFor(Foo.class, params);

That doesn't work.  It still submits using the 'interface' stuff -
apparently because of hidden fields.  I tried using a WebMarkupContainer
instead of a form, but that fails due to the ? in the URL.  Also, for some
reason the form elements are renamed 'formname:elementname' when using a
WebMarkupContainer.

I really like Wicket quite a bit, but this issue with forms and constant
'session expired' messages are my biggest sticking point.

-Doug


igor.vaynberg wrote:
 
 thats what stateless forms are for. after a submit you want a redirect
 anyways so that a refresh doesnt popup that annoying post values
 dialog.
 
 overriding oncomponenttag() should work just fine, you just have to
 make sure to call super first.
 
 -igor
 
 
 On Mon, Apr 28, 2008 at 7:08 PM, Doug Donohoe [EMAIL PROTECTED] wrote:

  Overriding onComponentTag doesn't seem to work.  The URL that gets
 generated
  (using urlFor) starts with a question mark which isn't included when the
  form is submitted.   The only thing passed down is the form parameters,
  which obviously doesn't work since the page is missing.  I'm using the
  default URL encoding strategy - was saving that investigation for later.
  Maybe I need to bump that up in the queue.

  I'll also look at using a stateless form next (and redirecting to a
  bookmarkable page so the URL is nice).

  Just a general comment on this.  I basically want a form that can be
  submitted at any time, regardless if a session is there or not.   This
 is a
  common use case (e.g., google, login, search) and for all the excellent
  stuff in wicket, this seems very hard to do.

  Does anyone else have advice on how to do nice-looking-urls using
 GET-method
  form posts?  In other words, if I wanted to build Google's home page in
  wicket and be able to bookmark search results, how would I do it?  If
 anyone
  has an example they can share, I would appreciate it.

  Regards,

  -Doug




  igor.vaynberg wrote:
  
   override the form's action value in its oncomponenttag callback with a
   url to a bookmarkable page. but then you have to parse all posted
   values yourself.
  
   if you dont care about the url you can use a statelessform instead and
   probably avoid a bunch of headache.
  
   -igor
  
  
   On Sat, Apr 26, 2008 at 6:36 AM, Doug Donohoe [EMAIL PROTECTED]
 wrote:
  
Hi,
  
I'm like to submit a form using bookmarkable page style, so that
  
a) the form can always be submitted, regardless if the session is
   expired or
not (think of a Google search submission e.g.,
http://www.google.com/search?q=wicket)
  
b) the form remembers PageParameters that were there when the page
 was
generated (think of google advanced search where you change the
 number
   of
items per page and that is remembered in subsequent searches e.g.,
http://www.google.com/search?q=wicketnum=30)
  
How do I tell the form to submit using bookmarkable format (using
 the
assigned URL encoding strategy)?
  
Thanks,
  
-Doug
--
View this message in context:
  
 http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16912974.html
Sent from the Wicket - User mailing list archive at Nabble.com.
  
  
   
 -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  

  --
  View this message in context:
 http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16951990.html


 Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16952274.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



submit form to bookmarkable page

2008-04-26 Thread Doug Donohoe

Hi,

I'm like to submit a form using bookmarkable page style, so that

a) the form can always be submitted, regardless if the session is expired or
not (think of a Google search submission e.g.,
http://www.google.com/search?q=wicket)

b) the form remembers PageParameters that were there when the page was
generated (think of google advanced search where you change the number of
items per page and that is remembered in subsequent searches e.g.,
http://www.google.com/search?q=wicketnum=30)

How do I tell the form to submit using bookmarkable format (using the
assigned URL encoding strategy)?

Thanks,

-Doug
-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16912974.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: submit form to bookmarkable page

2008-04-26 Thread Doug Donohoe

I assume the query values will come through in the page parameters, which is
fine since I'm already using those.

Thanks,

-Doug


igor.vaynberg wrote:
 
 override the form's action value in its oncomponenttag callback with a
 url to a bookmarkable page. but then you have to parse all posted
 values yourself.
 
 if you dont care about the url you can use a statelessform instead and
 probably avoid a bunch of headache.
 
 -igor
 
 
 On Sat, Apr 26, 2008 at 6:36 AM, Doug Donohoe [EMAIL PROTECTED] wrote:

  Hi,

  I'm like to submit a form using bookmarkable page style, so that

  a) the form can always be submitted, regardless if the session is
 expired or
  not (think of a Google search submission e.g.,
  http://www.google.com/search?q=wicket)

  b) the form remembers PageParameters that were there when the page was
  generated (think of google advanced search where you change the number
 of
  items per page and that is remembered in subsequent searches e.g.,
  http://www.google.com/search?q=wicketnum=30)

  How do I tell the form to submit using bookmarkable format (using the
  assigned URL encoding strategy)?

  Thanks,

  -Doug
  --
  View this message in context:
 http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16912974.html
  Sent from the Wicket - User mailing list archive at Nabble.com.


  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/submit-form-to-bookmarkable-page-tp16912974p16914750.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Panel that replaces surrogate element rather than contained within it

2008-04-25 Thread Doug Donohoe

I think in order to support updates, you need an output id on the lt;ul
element.  I assume that is what you want to replace ...  Have you tried
adding a wicket:id to the lt;ul and then calling setOutputMarkupId() on
that element?

-Doug




Sam Hough wrote:
 
 Is there a nice way to make a component that behaves like Panel but
 replaces the surrogate element AND supports Ajax partial updates?
 
 So if my parent HTML is:
 
 lt;span wicket:id=here to be replacedlt;/span
 
 
 and my child panel is:
 
 lt;wicket:panelulliMust only have a single root
 element/li/ul/wicket:panel
 
 my output would be:
 
 lt;ulliMust only have a single root element/li/ul
 
 I've almost got this behaviour by using setRenderBodyOnly(true); but then
 I loose the id I need for Ajax partial updates.
 
 Any thoughts?
 
 Thanks
 
 Sam
 

-- 
View this message in context: 
http://www.nabble.com/Panel-that-replaces-surrogate-element-rather-than-contained-within-it-tp16894472p16895545.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: intro and explanation about DataTable and DetachableModel

2008-04-24 Thread Doug Donohoe

This may help.  I am moving my DD Poker site to wicket and implemented an
IDataProvider around my database service as follows:

private class HistoryData implements IDataProvider
{
private static final long serialVersionUID = 42L;

private PokerUser user;
private int count;

private HistoryData(PokerUser user)
{
this.user = user;
count =
histService.getAllTournamentHistoriesForProfileCount(user.getId());
}

@SuppressWarnings({RawUseOfParameterizedType})
public Iterator iterator(int first, int pagesize)
{
return
histService.getAllTournamentHistoriesForProfile(user.getId(), count, first,
pagesize).iterator();
}

public int size()
{
return count;
}

public boolean isEmpty()
{
return count == 0;
}

public IModel model(Object object)
{
return new CompoundPropertyModel(new EntityModel(object));
}

public void detach()
{
}
}

Where EntityModel is:

public class EntityModel extends CompoundPropertyModel
{
private static final long serialVersionUID = 42L;

/**
 * Constructor
 *
 * @param object The model object, which may or may not implement IModel
 */
public EntityModel(Object object)
{
super(new NonLoadableDetachableModel(object));
}
}

and NonLoadableDetachableModel is

public class NonLoadableDetachableModel extends LoadableDetachableModel
{
private static final long serialVersionUID = 42L;

public NonLoadableDetachableModel(Object model)
{
super(model);
}

@Override
protected Object load()
{
throw new UnsupportedOperationException(load should never be
called);
}
}

I created this last class because my pages are read-only and the result set
is always fetched through the service.  I didn't want to have my (JPA based)
entities being serialized.

The HistoryData class worked great with the base DataView class in Wicket.

Note that I drew a lot of inspiration from:

http://wicketstuff.org/wicket13/repeater/

and digging around in the source.

I don't know if this will help you or not - hopefully so!

-Doug


Eyal Golan wrote:
 
 Hi,
 Can anyone give me an explanation about paging with DetachableModel?
 
 My problem:
 We have records in the DB that can be a-lot.
 We also filter them sometimes.
 
 someone in the company created a non-standard paging.
 He doesn't use the Wicket's paging.
 
 The iterator method of the DataProvider he created returns only the number
 of elements that should be displayed in the current page.
 Eg. suppose we decided we show 20 records per page.
 The DataProvider keeps track on which page we're at.
 Then he calculates the indexes of records.
 It's done in getVisibleTickets() method.
 int fromIndex = (currentPage - 1) * (ticketsPerPage);
 int toIndex = ticketsPerPage;
 
 And then he asks the DB for the records in this range (with the filter).
 This is the size() method:
 public int size() {
 if ((visibleTickets == null) || (update)) {
 getVisibleTickets();
 }
 return visibleTickets.size();
 }
 
 OK, I hope i was clear enough.
 I know that it might be done using Wicket's library.
 Can anyone explain?
 
 Thanks
 -- 
 Eyal Golan
 [EMAIL PROTECTED]
 
 Visit: http://jvdrums.sourceforge.net/
 
 

-- 
View this message in context: 
http://www.nabble.com/intro-and-explanation-about-DataTable-and-DetachableModel-tp16852272p16853277.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



PageParameters request-for-enhancement

2008-04-24 Thread Doug Donohoe

Hi Wicket team:

I'd like to be able to call getInt(name, default) and not have to worry
about catching exceptions.  If the number can't be parsed, just return the
default.

I have a utility method which I use:

public static int getInt(PageParameters params, String name, int def)
{
try
{
return params.getInt(name, def);
}
catch (StringValueConversionException ignored)
{
return def;
}
}

Basically for my bookmarkable pages, I don't care if a user mucks with the
URL - this would let me default to something reasonable.

It would be nice if there were a comparable method on PageParameters ...
like getIntSafe(name, def) or some something similar (and for other
number-based getters).

In addition, it would be nice to have a getInteger() object method that
returns null if not defined or an Integer object.  The way it is now, I have
to pick a default value that I assume won't ever be valid (usually -1). 
There are valid use cases where null is an expected value.

-Doug

-Doug


-- 
View this message in context: 
http://www.nabble.com/PageParameters-request-for-enhancement-tp16853545p16853545.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting scriptaculous usage conundrum

2008-04-23 Thread Doug Donohoe

Any ideas from the wicket developers?  In the end, this is a question about
how the architecture work.

-Doug


Doug Donohoe wrote:
 
 The issue isn't with Ajax - that part is working.  The issue is when the
 form is submitted (normally, not via ajax) and redisplayed (e.g., if an
 error occurs like mismatch password).  
 
 When wicket re-renders the entire page, the login form still has an
 AttributeModifier of 'display: none'.   For some reason, if I disable that
 modifier or use the model approach you suggested, wicket ignores that.
 
 -Doug
 
 
 
 John Krasnay wrote:
 
 On Mon, Apr 21, 2008 at 02:11:01PM -0700, Doug Donohoe wrote:
 
 Hi John,
 
 Thanks for the suggestion, but that did not work.  I suspect it didn't
 work
 for the same reason that my attempt to use setEnabled(true/false) on the
 AttributeModifier didn't work.  
 
 It has to be with how wicket cache's pages.  I still don't quite grok
 how it
 decides to re-render stuff...
 
 My code:
 
 public CurrentProfile(String id)
 {
 
 
 displayModel = new DisplayModel();
 loginPanel.add(new AttributeModifier(style, true,
 displayModel));
 
 
 
 Link link = new AjaxFallbackLink(loginLink, new
 Model(loginText))
 {
 @Override
 public void onClick(final AjaxRequestTarget target)
 {
 loginPanel.setVisible(!loginPanel.isVisible());
 
 I suspect your problem is in that last line. Once you've rendered a page
 with an element that's invisible, you can't make it visible again via
 AJAX unless you originally called setOutputMarkupPlaceholderTag(true) on
 it, or you refresh a parent element that was always visible.
 
 jk
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/interesting-scriptaculous-usage-conundrum-tp16807943p16834725.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: If logic in wicket seems complicated

2008-04-22 Thread Doug Donohoe

I used Fragments in another area which made the code simpler.  I went from...

WebMarkupContainer loggedIn = new WebMarkupContainer(loggedIn);
loggedIn.setVisible(hasUser);
add(loggedIn);

WebMarkupContainer notLoggedIn = new
WebMarkupContainer(notLoggedIn);
notLoggedIn.setVisible(!hasUser);
add(notLoggedIn);

... to ...

add(new Fragment(description, hasUser ? loggedIn :
notLoggedIn, this));

... which is quite simpler.

-Doug


Doug Donohoe wrote:
 
 Thanks igor for the suggestion.
 
 It's not quite that simple.  If it is a valid alias, I actually want it to
 be a link (with a label inside).  So it isn't quite equivalent.
 
 I'll checkout fragments too!
 
 -Doug
 
 
 igor.vaynberg wrote:
 
 right, use fragments for these small inline chunks, also because your
 usecase is so simple: just a string, you can simply do
 
 class aliasesmodel extends ldm {
   object load() {
 list aliases=getaliases();
 if (aliases.isempty()) { aliases.add(new alias(none)); }
   }
 }
 
 then there is no need to toggle the none fragment to show up
 
 -igor
 
 
 On Mon, Apr 21, 2008 at 11:33 AM, Enrique Rodriguez [EMAIL PROTECTED]
 wrote:
 On Mon, Apr 21, 2008 at 11:27 AM, Doug Donohoe [EMAIL PROTECTED]
 wrote:
   ...

  I may be having a mental block, but I'm finding it tedious to
 implement 'if'
   behavior in Wicket.

  I use Wicket Fragments all over the place for this sort of thing.

  http://wicket.apache.org/examplefragments.html

  Enrique



  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/If-logic-in-wicket-seems-complicated-tp16808507p16823845.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: If logic in wicket seems complicated

2008-04-22 Thread Doug Donohoe

Hi Cemal.   I have used the setRenderBodyOnly() in other cases.  Thanks for
the reminder.

I ended up doing this:

WebMarkupContainer none = new WebMarkupContainer(none);
none.setVisible(list.isEmpty());
add(none);

RepeatingView rv = new RepeatingView(list);
rv.setVisible(!list.isEmpty());
add(rv);

for (int i = 0; i  list.size(); i++)
{
rv.add( ... )
}

My original post was more of a question about the philosophy of doing
if-then-else logic in wicket.  Based on the responses to this post, it seems
that this is the current best practices:

Putting multiple components in the markup and turning them
visible/not-visible based on the data isn't such a bad thing.  It works in
small cases like this.  The wicket-enclosure tag makes this easy when there
is extra markup associated with a tag.

In slightly more complicated cases, using wicket-fragment is a better
solution which allows you to pick between different markup scenarios without
having to add all those components into the hierarchy and turn them on/off.

In the most complex cases, using separate Panels is more appropriate.

-Doug


jWeekend wrote:
 
 Doug,
 
 Take a look at Component's setRenderBodyOnly method if you sometimes need
 to render a link as plain text based on some condition (thanks Nilklas).
 This combined with Igor's tip could be one possible solution to the
 requirements you have mentioned, so far. 
 On the  http://jweekend.com/dev/LWUGReg/ London Wicket Event registration
 page  we use something like this to show registrants' names as links only
 if they have entered a URL. 
 
 Regards - Cemal
  http://jWeekend.co.uk http://jWeekend.co.uk 
 
 
 Doug Donohoe wrote:
 
 Thanks igor for the suggestion.
 
 It's not quite that simple.  If it is a valid alias, I actually want it
 to be a link (with a label inside).  So it isn't quite equivalent.
 
 I'll checkout fragments too!
 
 -Doug
 
 
 igor.vaynberg wrote:
 
 right, use fragments for these small inline chunks, also because your
 usecase is so simple: just a string, you can simply do
 
 class aliasesmodel extends ldm {
   object load() {
 list aliases=getaliases();
 if (aliases.isempty()) { aliases.add(new alias(none)); }
   }
 }
 
 then there is no need to toggle the none fragment to show up
 
 -igor
 
 
 On Mon, Apr 21, 2008 at 11:33 AM, Enrique Rodriguez
 [EMAIL PROTECTED] wrote:
 On Mon, Apr 21, 2008 at 11:27 AM, Doug Donohoe [EMAIL PROTECTED]
 wrote:
   ...

  I may be having a mental block, but I'm finding it tedious to
 implement 'if'
   behavior in Wicket.

  I use Wicket Fragments all over the place for this sort of thing.

  http://wicket.apache.org/examplefragments.html

  Enrique



  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/If-logic-in-wicket-seems-complicated-tp16808507p16823927.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting scriptaculous usage conundrum

2008-04-22 Thread Doug Donohoe

The issue isn't with Ajax - that part is working.  The issue is when the form
is submitted (normally, not via ajax) and redisplayed (e.g., if an error
occurs like mismatch password).  

When wicket re-renders the entire page, the login form still has an
AttributeModifier of 'display: none'.   For some reason, if I disable that
modifier or use the model approach you suggested, wicket ignores that.

-Doug



John Krasnay wrote:
 
 On Mon, Apr 21, 2008 at 02:11:01PM -0700, Doug Donohoe wrote:
 
 Hi John,
 
 Thanks for the suggestion, but that did not work.  I suspect it didn't
 work
 for the same reason that my attempt to use setEnabled(true/false) on the
 AttributeModifier didn't work.  
 
 It has to be with how wicket cache's pages.  I still don't quite grok how
 it
 decides to re-render stuff...
 
 My code:
 
 public CurrentProfile(String id)
 {
 
 
 displayModel = new DisplayModel();
 loginPanel.add(new AttributeModifier(style, true,
 displayModel));
 
 
 
 Link link = new AjaxFallbackLink(loginLink, new
 Model(loginText))
 {
 @Override
 public void onClick(final AjaxRequestTarget target)
 {
 loginPanel.setVisible(!loginPanel.isVisible());
 
 I suspect your problem is in that last line. Once you've rendered a page
 with an element that's invisible, you can't make it visible again via
 AJAX unless you originally called setOutputMarkupPlaceholderTag(true) on
 it, or you refresh a parent element that was always visible.
 
 jk
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/interesting-scriptaculous-usage-conundrum-tp16807943p16824100.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



interesting scriptaculous usage conundrum

2008-04-21 Thread Doug Donohoe

I am trying to implement a login section which appears (inserted into he
page) when a user clicks a [login] link at the top of the page.  I have this
working fine with AjaxFallbackLink which turns visibility on/off based on
the link.  The pertinent code is as follows:

Link link = new AjaxFallbackLink(loginLink, new Model(loginText))
{
@Override
public void onClick(final AjaxRequestTarget target)
{
loginPanel.setVisible(!loginPanel.isVisible());
loginLabel.setModelObject(loginPanel.isVisible() ?
cancelText : loginText);

if (target != null)
{
target.addComponent(loginPanel);
target.addComponent(loginLabel);
}
}
};

Everything works great.  Next I wanted to use the scriptaculous blind down
effect to unveil the login box instead of just appearing all at once.

So I added a line which did this when displaying the panel:

target.appendJavascript(new BlindDown(loginPanel).toJavascript());

Where BlindDown is an implementation of the wicket-stuff scriptaculous
effect.

This worked with one issue: the login panel flashed, went away and then
was revealed.  This is because the login panel needs to be initially hidden 
(style=display: none) for the 'blind down' to be visually correct.

So I added an attribute modifier to the loginPanel:

new AttributeModifier(style, true, new Model(display: none)

This corrected the 'flash' problem.  But introduced another problem.  Now,
when the form is submitted with an error, when the page is redisplayed, the
form is hidden (because the attribute modifier is still in effect).

I tried two ways to turn off the AttributeModifier:

1) remove it in an onAfterRender call, but I got a exception regarding
modifying component tree during render.  I couldn't find a way to actually
remove it after render due to all the 'final' methods.  However, this may
not have worked anyway for the same reason #2 below didn't work.

2) call setEnabled(false) on the AttributeModifier in the onAfterRender()
call, but that seems to have no effect.  I assume this is because of how the
page is cached internally in wicket.  I'm not 100% certain how wicket
redisplays a page with a form without re-rendering the page, but apparently
it doesn't revisit it's attribute modifiers.

So the question is, how to solve this problem.  I essentially have a case
where I need to have a one-time-only attribute modifier.  When the
component is sent back in an Ajax request, it needs to be set, but otherwise
not set.

Any suggestions on how to solve this?

Thanks,

-Doug
-- 
View this message in context: 
http://www.nabble.com/interesting-scriptaculous-usage-conundrum-tp16807943p16807943.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



If logic in wicket seems complicated

2008-04-21 Thread Doug Donohoe

As mentioned in previous posts, I'm a new wicket user and I'm migrating
online.ddpoker.com to it.

I may be having a mental block, but I'm finding it tedious to implement 'if'
behavior in Wicket.

As an example, I have a page which lists information about a DD Poker online
user.  It lists known aliases for the user (which are linked to details
about that alias) or none:

  Known Aliases:  none 
  --- or ---
  Known Aliases:  _Tahoe_  _Zorro_

Ideally, I'd like a reusable panel component which displays 'none' or the
linked aliases.  Thus the displaying page can just define div
wicket:id=aliases/div and do add(new Aliases(aliases)) in the java
code.

However, in order for Aliases to do it's thing, it seems like I need to do
one of two things:

* OPTION ONE *

Define a template like 

A: -span- wicket-id=noneNone/-span-
B: -a- href=# wicket-id=links-span-
wicket-id=nameName/-span-/-a-

Then in the java code, use setVisible() to turn A/B on/off depending on
whether there are any aliases.

** OPTION TWO *

Define a template like

-div- wicket-id=aliasDetail/-div-
Define two more panels, AliasesNone and AliasesList 

and in the java code do

if (aliases.size() == 0)
{
   add new AliasesNone(aliasDetail);
}
else
{
  add new AliasesList(aliasDetail);
}

The problem I see with this is that to implement a simple fragment would
require 3 panel classes (with 3 associated HTML classes) as opposed to the
few lines of JSP code I use today. 

* END OPTIONS *

In summary, it seems to me that in order to do if-then logic in wicket, I
need to choose one of the following options:

a) list all options in the html template and turn off the ones that don't
apply depending on the data.
b) define Panels at a very fine level and have the Java code select the
correct sub-panel depending on the data. 

This is seems like a lot of work - is there an easier way?

I also feel that I want to be able to add components in Java with out
needing associated markup.  In other words, I feel artificially constrained
not being able to do something like this:

-html-
   Known aliases: -span- wicket:id=aliaseslist here || none/-span-
/-html-


   List a = getAliases(user);
   if (a.empty())
   {
   add(new Label(aliases, none);
   }
   else
   {
  RepeatingView rv = new RepeatingView(aliases);
  add(rv);
  for (Alias alias : a)
  {
 Link l = new Link([detailpage for alias]);
 rv.add(l);
 l.add(new Label(alias.getName());
  }
  }


I'm interested to here what wicket users have done in practice.  It seems
very common to have if-logic in html pages that depending on the condition
display completely different html hierarchies.

Thanks,

-Doug

-- 
View this message in context: 
http://www.nabble.com/If-logic-in-wicket-seems-complicated-tp16808507p16808507.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interesting scriptaculous usage conundrum

2008-04-21 Thread Doug Donohoe

Hi John,

Thanks for the suggestion, but that did not work.  I suspect it didn't work
for the same reason that my attempt to use setEnabled(true/false) on the
AttributeModifier didn't work.  

It has to be with how wicket cache's pages.  I still don't quite grok how it
decides to re-render stuff...

My code:

public CurrentProfile(String id)
{


displayModel = new DisplayModel();
loginPanel.add(new AttributeModifier(style, true, displayModel));



Link link = new AjaxFallbackLink(loginLink, new Model(loginText))
{
@Override
public void onClick(final AjaxRequestTarget target)
{
loginPanel.setVisible(!loginPanel.isVisible());
loginLabel.setModelObject(loginPanel.isVisible() ?
cancelText : loginText);

if (target != null)
{
displayModel.setHidePanel(true);
target.addComponent(loginPanel);
target.addComponent(loginLabel);
target.appendJavascript(new
BlindDown(loginPanel).toJavascript());
}
}
};

 
}

private class DisplayModel extends AbstractReadOnlyModel
{
boolean hidePanel = false;

@Override
public Object getObject()
{
return hidePanel ? display: none : ;
}

private void setHidePanel(boolean b)
{
hidePanel = b;
}
}

@Override
protected void onAfterRender()
{
displayModel.setHidePanel(false);
super.onAfterRender();
}

-Doug


John Krasnay wrote:
 
 On Mon, Apr 21, 2008 at 07:18:57AM -0700, Doug Donohoe wrote:
 
 So I added an attribute modifier to the loginPanel:
 
 new AttributeModifier(style, true, new Model(display: none)
 
 This corrected the 'flash' problem.  But introduced another problem. 
 Now,
 when the form is submitted with an error, when the page is redisplayed,
 the
 form is hidden (because the attribute modifier is still in effect).
 
 
 One of the great things about models is that they facilitate lazy
 evaluation. Try this:
 
 new AttributeModifier(style, true, new AbstractReadOnlyModel() {
 public Object getObject() {
 return hidePanel ? display: none : ;
 }
 });
 
 You can then toggle whether display:none is rendered by toggling the
 hidePanel field of your class.
 
 jk
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/interesting-scriptaculous-usage-conundrum-tp16807943p16813005.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: If logic in wicket seems complicated

2008-04-21 Thread Doug Donohoe

Thanks igor for the suggestion.

It's not quite that simple.  If it is a valid alias, I actually want it to
be a link (with a label inside).  So it isn't quite equivalent.

I'll checkout fragments too!

-Doug


igor.vaynberg wrote:
 
 right, use fragments for these small inline chunks, also because your
 usecase is so simple: just a string, you can simply do
 
 class aliasesmodel extends ldm {
   object load() {
 list aliases=getaliases();
 if (aliases.isempty()) { aliases.add(new alias(none)); }
   }
 }
 
 then there is no need to toggle the none fragment to show up
 
 -igor
 
 
 On Mon, Apr 21, 2008 at 11:33 AM, Enrique Rodriguez [EMAIL PROTECTED]
 wrote:
 On Mon, Apr 21, 2008 at 11:27 AM, Doug Donohoe [EMAIL PROTECTED] wrote:
   ...

  I may be having a mental block, but I'm finding it tedious to implement
 'if'
   behavior in Wicket.

  I use Wicket Fragments all over the place for this sort of thing.

  http://wicket.apache.org/examplefragments.html

  Enrique



  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/If-logic-in-wicket-seems-complicated-tp16808507p16818460.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



clarification on page versioning

2008-04-19 Thread Doug Donohoe

I have a page which displays a [login box] (if not logged in) or an info box
[user name|logout link] if logged in.

I implemented this as follows:

User user = BaseSession.get().getLoggedInUser();
if (user == null)
{
add(new Login(login));
}
else
{
add(new CurrentProfile(login));
}

Both Login and CurrentProfile are subclasses of Panel.  When the login
form is submitted or the logout link is submitted, in order to get the page
to re-render, I had to use this code:

setResponsePage(getPage().getClass()); // need to use class so
page is re-rendered

As a new wicket user, I'd like a clarification on why this is necessary.  If
I used this code:

   setResponsePage(getPage()); 

... which appears to be the default behavior if setResponsePage() isn't
called ... then the page is simply displayed without re-rendering (e.g.,
after login, the login box is still shown).  So, my question is what's the
difference between the two?  Is there a way to mark a page as needing
re-rendering?  Is my solution the correct way in Wicket?

This also raises the question about how many pages are stored in the page
map.  For example, if I were to login and logout 10 times in a row ... would
there be 20 pages in the page map?  Is there a way to clear out the page map
for a page?

In my case, I invalidate the session on logout, so the above case isn't an
issue in this exact case.  I'm more concerned about someone who navigates my
site and visits hundreds of pages.  How do I keep the session from filling
up with old pages?

Finally, is there a best practice to debug/monitor session size and page map
size?

Thanks,

-Doug
-- 
View this message in context: 
http://www.nabble.com/clarification-on-page-versioning-tp16783638p16783638.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: clarification on page versioning

2008-04-19 Thread Doug Donohoe

Thanks for the post. 

I'd probably have to do an anonymous subclass of my Login panel.  It doesn't
know about it's parent or what the parent might like to swap in when a
logged in user is present.

I'll look under the covers of replaceWith() - I basically want to do
whatever replaceWith() does without actually replacing anything.

-Doug


Carl-Eric Menzel-5 wrote:
 
 Both Login and CurrentProfile are subclasses of Panel.  When the 
 login form is submitted or the logout link is submitted, in order to 
 get the page to re-render, I had to use this code:
 
 setResponsePage(getPage().getClass());
 
 In this case the page isn't re-rendered, it is re-created, i.e. a new
 instance of your page class is instantiated, which then does the add(new
 CurrentProfile()) in its constructor.
 
 In the default behavior you're getting the exact same page instance you
 initially created and in which you said add(new Login()).
 
 To replace the login panel with the profile panel, keep a reference to
 the login panel and in your form submit method do this:
 
 login.replaceWith(new CurrentProfile())
 
 This removes the login panel from the page and, as the method name
 suggests, replaces it with the CurrentProfile instance. Remember the
 latter in a field too, if you ever want to switch back.
 
 This way you only have one page and swap out its components instead of
 creating new page instances.
 
 
 Hope this helps
 Carl-Eric
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/clarification-on-page-versioning-tp16783638p16784204.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: clarification on page versioning

2008-04-19 Thread Doug Donohoe

I meant I'd look under the covers to see if I could find a way to force the
page to re-render without adding an entry to the page map.  Maybe I 'm
missing something.

With regards to my page map question, I'm searching for a description of how
the history mechanism works and what controls one has to limit the size of
the page map.  Anyone have any insights on this?

-Doug


Carl-Eric Menzel-5 wrote:
 
 Doug Donohoe wrote:
 I'd probably have to do an anonymous subclass of my Login panel.  It
 doesn't
 know about it's parent or what the parent might like to swap in when a
 logged in user is present.
 
 I'll look under the covers of replaceWith() - I basically want to do
 whatever replaceWith() does without actually replacing anything.
 
 replaceWith() is provided by Component and knows all it needs to do it.
 You shouldn't have to do anything to use it.
 
 Carl-Eric
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/clarification-on-page-versioning-tp16783638p16787301.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



wicket-spring dependency in maven repository

2008-04-18 Thread Doug Donohoe

I'm using wicket-spring-annot and ran into a small problem with maven
dependencies.  The wicket-spring-annot project depends on wicket-spring.

Wicket-spring in turn depends on the entire monolithic spring.jar instead of
the now-preferred spring-core.jar.  This caused a problem in my environment
in that it pulled spring 2.0 down whereas I'm already using spring 2.5.  In
the future, the wicket-spring team may wish to pull this dependency or use
spring-core.

  dependency
  groupIdorg.springframework/groupId
  artifactIdspring/artifactId
  /dependency

Anyhow, to not pull this in, I utilized the exclusions feature of maven:

  dependency
  groupIdorg.apache.wicket/groupId
  artifactIdwicket-spring-annot/artifactId
  version1.3.3/version
  !-- exclude spring framework that wicket pulls in --
  exclusions
exclusion
  groupIdorg.springframework/groupId
  artifactIdspring/artifactId
/exclusion
  /exclusions
/dependency

Just an FYI.
-- 
View this message in context: 
http://www.nabble.com/wicket-spring-dependency-in-maven-repository-tp16764208p16764208.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: wicket markup documentation and question on threading/clustering

2008-04-18 Thread Doug Donohoe

Thanks for the fast response.


igor.vaynberg wrote:
 
 On Thu, Apr 17, 2008 at 6:48 PM, Doug Donohoe [EMAIL PROTECTED] wrote:

  I'm looking for a complete list of all wicket markup (e.g.,
 wicket-panel,
  wicket-child, wicket-exclude etc).  I didn't find anything obvious via
  Google or the wiki.  Am I missing something?  As a newcomer, it would be
  helpful to know what all the choices are and what they do so as to not
 miss
  anything.
 
 http://cwiki.apache.org/confluence/display/WICKET/Wicket%27s+XHTML+tags
 
  Also, I am looking for an explanation of the threading / clustering
  architecture with Wicket.  Neither of the books address these topics in
 any
  depth.  For example, in the simple Link Counter example in Wicket in
  Action, how does that counter work with multiple people accessing the
 page?
  It doesn't appear to be synchronized unless this is under the covers. 
 If
  there is an instance of each page per person that would mean the total
  displayed is per person (and not per all users).
 
 each user gets their own instance of Page. Access to the page object
 is synced on user's session (thats not exactly correct but for
 purposes of this discussion it will do) so you do not have to worry
 about all the nasty syncing yourself. if you have data that you want
 users to share/interact with it has to be kept in some global store:
 database, servlet context, memory, etc.
 
  Finally, if one wants to have multiple application servers for load
  balancing / failover, what options does one have with Wicket?  I assume
 you
  use some sort of clustered session that wicket utilizes.  Perhaps
 something
  like Gigaspaces?
 
 wicket will work with regular servlet container clustering. it stores
 the page in http session and page is serializable so it will be
 replicated.
 
 -igor
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/wicket-markup-documentation-and-question-on-threading-clustering-tp16758965p16764210.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



wicket markup documentation and question on threading/clustering

2008-04-17 Thread Doug Donohoe

Hi Wicket Community:

I'm new to Wicket - I'm using it to rebuild and enhance my www.ddpoker.com
website.  So far I am very impressed with Wicket.  I have two books - the
Wicket in Action MEAP early access edition and enjoy web development with
wicket.  

I'm looking for a complete list of all wicket markup (e.g., wicket-panel,
wicket-child, wicket-exclude etc).  I didn't find anything obvious via
Google or the wiki.  Am I missing something?  As a newcomer, it would be
helpful to know what all the choices are and what they do so as to not miss
anything.

Also, I am looking for an explanation of the threading / clustering
architecture with Wicket.  Neither of the books address these topics in any
depth.  For example, in the simple Link Counter example in Wicket in
Action, how does that counter work with multiple people accessing the page? 
It doesn't appear to be synchronized unless this is under the covers.  If
there is an instance of each page per person that would mean the total
displayed is per person (and not per all users).

Finally, if one wants to have multiple application servers for load
balancing / failover, what options does one have with Wicket?  I assume you
use some sort of clustered session that wicket utilizes.  Perhaps something
like Gigaspaces?

Thanks for any answers.  Hopefully these questions give some insight into
what an experienced developer might ask as a newcomer to the platform.

Finally,

Thanks,

-Doug
-- 
View this message in context: 
http://www.nabble.com/wicket-markup-documentation-and-question-on-threading-clustering-tp16758965p16758965.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]