Re: Is there any other way? DataProviders must hit the Db twice for (possible) large datasets

2008-11-27 Thread Wayne Pope
>> you mentioned that you implemented such a repeater yourself. didn't you
use
>> any navigation or did you write that yourself? just wondering.

>i implemented a simple prev/next pager which is all that was required
>or that usecase.


Matej's implementation from inMethods works perfectly. I suggest you use
that Stefan if you need such a thing.
(Thanks Matej!)




On Thu, Nov 27, 2008 at 7:51 PM, Igor Vaynberg <[EMAIL PROTECTED]>wrote:

> On Thu, Nov 27, 2008 at 10:28 AM, Stefan Fußenegger
> <[EMAIL PROTECTED]> wrote:
> >
> > Hi Igor,
> >
> > thanks for implementing this minimal version. i totally agree with your
> > reasoning. Is there any chance though that this goes into 1.3 branch as
> > well? I'd really appreciate that.
>
> done
>
> > you mentioned that you implemented such a repeater yourself. didn't you
> use
> > any navigation or did you write that yourself? just wondering.
>
> i implemented a simple prev/next pager which is all that was required
> for that usecase.
>
> > shall i open a ticket against 1.5 to track this issue/enhancement?
>
> i added it to the wishlist wiki page. if you add a jira ticket please
> add the number to the wiki page.
>
> -igor
>
> >
> > best regards, stefan
> >
> >
> >
> > igor.vaynberg wrote:
> >>
> >> On Thu, Nov 27, 2008 at 12:46 AM, Stefan Fußenegger
> >> <[EMAIL PROTECTED]> wrote:
> >>>
> >>> I don't think IDataProvider is only about databases.
> >>
> >> you started off with your core assumption being wrong. idataprovider
> >> was written exclusively for accessing databases. my thinking, at the
> >> time, was that 99% of people use wicket to build applications that
> >> access databases, and i dare say it was a good guess because in its ~3
> >> years of existence only a handful of people had a problem with the way
> >> it works.
> >>
> >>> There are other data
> >>> sources and some return the total amount and the desired subset at the
> >>> same
> >>> time (Lucene as a famous example). Such data sources would really
> benefit
> >>> of
> >>> a single-query-approach.
> >>
> >> i am not disputing this fact. i am simply saying that we are not going
> >> to fix this right now because this is not a bug. you are trying to use
> >> the components for something they were not designed to be used. in 1.5
> >> we may address this.
> >>
> >>> I faced this issue myself in a search (read Lucene)
> >>> centered application. I successfully went down the road of implementing
> a
> >>> custom repeater.
> >>
> >> i had to do the same myself.
> >>
> >>> But when the repeater was working as desired, I figured out
> >>> that PagingNavigationLink is the real showstopper, not IDataProvider
> (see
> >>> my
> >>> JIRA comment [0]). The fix would be rather trivial, as
> >>> PagingNavigationLink
> >>> is doing something it needn't do (checking the requested page against
> the
> >>> valid range of pages).
> >>>
> >>> Let me answer 2 possible questions in advance:
> >>>
> >>> Q: Why is this check in PagingNavigationLink a problem?
> >>> A: Obviously, you can't fetch size and data as long as the page isn't
> >>> known.
> >>
> >> the check is there because we code defensively. we do not assume that
> >> every implementation of ipageable will cull the number when you call
> >> setcurrentpage(x).
> >>
> >>> Q: How would a custom repeater that fetches data and size at the same
> >>> tame
> >>> handle invalid (out of range) pages?
> >>> A: Out of range pages will return the size and an empty dataset. In
> this
> >>> case, the repeater would change the page number to the last valid and
> do
> >>> a
> >>> second query. Yeah, two queries again. But this should only happen
> rarely
> >>> though.
> >>
> >> this will change the existing behavior. if you are on page 5 and click
> >> page 10 (which happens to not exist) you would end up back on 5 with
> >> your suggestion where as currently you would properly end up on 9.
> >>
> >> looking at WICKET-1784, i extracted the code you want into an
> >> overridable int cullPageNumber(int x). so feel free to subclass the
> >> link and override that to return x without any extra checks.
> >>
> >> we may properly fix this in 1.5, but for right now this is too big a
> >> refactor because it changes the basic assumptions with which the code
> >> was written.
> >>
> >> -igor
> >>
> >>>
> >>> Best regards, Stefan
> >>>
> >>> [0]
> >>>
> https://issues.apache.org/jira/browse/WICKET-1784?focusedCommentId=12651278#action_12651278
> >>>
> >>>
> >>> igor.vaynberg wrote:
> 
>  On Wed, Nov 26, 2008 at 9:32 AM, Wayne Pope
>  <[EMAIL PROTECTED]> wrote:
> >>so you think pushing all that extra data over the network is actually
> >>more efficient then doing another query wtf.
> > The point is I'd rather avoid 2 calls where 1 will do.
> > AbstractPageableView
> > will do fine I believe.
> 
>  the number of calls itself is meaningless, i dont comprehend why
>  people have a hard time understanding this simple fact.
> 
>  if you h

Re: getting ip address from URIRequestTargetUrlCodingStrategy

2008-11-27 Thread Stefan Becker
great!

i didn't think it was THAT easy. 
i spend a whole day to find an answer to this, but was looking at the wrong 
places.

thank you

 Original-Nachricht 
> Datum: Thu, 27 Nov 2008 11:06:31 -0500
> Von: Michael O\'Cleirigh <[EMAIL PROTECTED]>
> An: users@wicket.apache.org
> Betreff: Re: getting ip address from URIRequestTargetUrlCodingStrategy

> Hi Stefan,
> 
> You can get the IP address that sent the request like this:
> 
> WebRequest wr = (WebRequest) RequestCycle.get().getRequest();
> 
> String originatingIPAddress  = wr.getHttpServletRequest().getRemoteHost();
> 
> You can probably place it directly in the decode(...) method of your url 
> coding strategy.
> 
> Regards,
> 
> Mike
> 
> > in my webapp i want to serve files from the filesystem to the user. so i
> coded something like this:
> >
> > mount(new URIRequestTargetUrlCodingStrategy("/files") {
> > @Override
> > public IRequestTarget decode(RequestParameters
> requestParameters) {
> >   
> > final String fileId = getURI(requestParameters);
> >
> > ... read some info from database and build a fileInfo object ...
> >
> > /* Get file for this instance */
> > return new ResourceStreamRequestTarget(new
> AnonFileResourceStream(fileInfo));
> > }
> > });
> >
> > (AnonFileResourceStream extends AbstractResourceStream)
> >
> > all requests to "/files" use the remaining part of the request to ask
> the database where the real file is located and stream it to the client. 
> > the problem is that i need to know from which ip address the request was
> made. i need the WebRequest object for this request to get some http
> headers. 
> > is this possible or is there another way to get hold of this
> information?
> >
> >
> > thanx alot
> > stefan
> >
> > -
> > 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]



Re: [VOTE] Consistent naming for Wicket Stuff projects

2008-11-27 Thread Ned Collyer

[X] YES - I would like consistent naming!

Contrib is a bit lame... could be gift or present.. but again - they are all
lame.

wicket stuff seems good.  Makes sense too.

I was thinking of making a post about all these vote threads :)  I'm
personally not a fan, but i think a vote page on the wiki would be
overlooked by many.

Perhaps if there was some vote section.. or the current vote on the wicket
homepage itself?



jwcarman wrote:
> 
> [X] YES - I would like consistent naming!
> 
> 
> On Thu, Nov 27, 2008 at 4:54 PM, Jeremy Thomerson
> <[EMAIL PROTECTED]
>> wrote:
> 
>> I am beginning the WS reorg as noted in previous emails.  You can monitor
>> progress here:
>>
>> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/
>>
>> As we move projects into the wicketstuff-core, I would like to see us
>> rename
>> them consistently, getting rid of the prepended "wicket-contrib-" or
>> "wicketstuff-".  This would mean that when we release WicketStuff 1.4
>> (when
>> Wicket 1.4 is released) that if you are using that project, you would
>> need
>> to update your POM to the new name.  Please vote:
>>
>> [ ] - YES - I would like consistent naming
>> [ ] - NO (convincing reason)
>>
>> PS - I feel like I'm starting a lot of vote threads - should I not be? 
>> Any
>> suggestions?  I would like to efficiently get this reorg done, but I am
>> leery of just moving other people's projects around and making changes
>> without permission.  Feelings / thoughts?
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-VOTE--Consistent-naming-for-Wicket-Stuff-projects-tp20726075p20729328.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: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Igor Vaynberg
or even something cooler with interfaces and multiple inheritance...

interface admin extends user,publisher {}

-igor

On Thu, Nov 27, 2008 at 7:57 PM, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> this is where the classes variation comes in. class AdminRole extends
> UserRole - done
>
> -igor
>
> On Thu, Nov 27, 2008 at 6:56 PM, Casper Bang <[EMAIL PROTECTED]> wrote:
>> Yeah. First I actually didn't understand why until Igor pointed it out. I'm
>> no longer using wicket-auth-roles, if one can live with the roles being
>> defined along side the authorization code it works quite nicely (and with
>> somewhat cleaner code). I ran into another issue however, trying to model
>> how an ADMIN transitively is also a USER. Sadly the Sun compiler does not
>> allow Enum forward referencing to itself, only the Eclipse compiler does.
>>
>> /Casper
>>
>>
>> Ned Collyer wrote:
>>>
>>> Interestingly we used a similar approach with using classes as pseudo
>>> enums.
>>>
>>> Not being able to extend enums is a bit suckfull.
>>>
>>>
>>> igor.vaynberg wrote:
>>>

 the problem is that the enum would have to live *inside* the
 wicketstuffauth code. so wicketstuffauth would be the library that
 would need to define the enum - and it doesnt know about your
 application specific roles. at least this was the issue when it was
 first being designed. i havent really looked at it since than.

 -igor


>>>
>>>
>>
>>
>> -
>> 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]



Re: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Igor Vaynberg
this is where the classes variation comes in. class AdminRole extends
UserRole - done

-igor

On Thu, Nov 27, 2008 at 6:56 PM, Casper Bang <[EMAIL PROTECTED]> wrote:
> Yeah. First I actually didn't understand why until Igor pointed it out. I'm
> no longer using wicket-auth-roles, if one can live with the roles being
> defined along side the authorization code it works quite nicely (and with
> somewhat cleaner code). I ran into another issue however, trying to model
> how an ADMIN transitively is also a USER. Sadly the Sun compiler does not
> allow Enum forward referencing to itself, only the Eclipse compiler does.
>
> /Casper
>
>
> Ned Collyer wrote:
>>
>> Interestingly we used a similar approach with using classes as pseudo
>> enums.
>>
>> Not being able to extend enums is a bit suckfull.
>>
>>
>> igor.vaynberg wrote:
>>
>>>
>>> the problem is that the enum would have to live *inside* the
>>> wicketstuffauth code. so wicketstuffauth would be the library that
>>> would need to define the enum - and it doesnt know about your
>>> application specific roles. at least this was the issue when it was
>>> first being designed. i havent really looked at it since than.
>>>
>>> -igor
>>>
>>>
>>
>>
>
>
> -
> 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]



Re: [VOTE] Consistent naming for Wicket Stuff projects

2008-11-27 Thread James Carman
[X] YES - I would like consistent naming!


On Thu, Nov 27, 2008 at 4:54 PM, Jeremy Thomerson <[EMAIL PROTECTED]
> wrote:

> I am beginning the WS reorg as noted in previous emails.  You can monitor
> progress here:
>
> https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/
>
> As we move projects into the wicketstuff-core, I would like to see us
> rename
> them consistently, getting rid of the prepended "wicket-contrib-" or
> "wicketstuff-".  This would mean that when we release WicketStuff 1.4 (when
> Wicket 1.4 is released) that if you are using that project, you would need
> to update your POM to the new name.  Please vote:
>
> [ ] - YES - I would like consistent naming
> [ ] - NO (convincing reason)
>
> PS - I feel like I'm starting a lot of vote threads - should I not be?  Any
> suggestions?  I would like to efficiently get this reorg done, but I am
> leery of just moving other people's projects around and making changes
> without permission.  Feelings / thoughts?
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>


Re: Set format date "inline"

2008-11-27 Thread Timo Rantalaiho
On Thu, 27 Nov 2008, kan wrote:
> I have a MyPojo with property java.util.Date someDate
> I use CompoundPropertyModel
> Now I add components on my page, like add(new Label("someDate")) and
> it automagically uses IConvertor to convert from Date to string.
> But in some places of web-site I need print only "27/11/2008", in some
> places better will be "2 days ago", in some places "27/11/2008
> 16:53:34 UTC" and so on.
> What is an elegant way to specify a format in particular piece of code?

I'm not sure if it's elegant, but you can do

  add(new Label("someDate") {
  @Override
  public IConverter getConverter(Class type) {
  return new FooDateConverter();
  }
  });

If these cases get repeated a lot, you can make named top-level
subclasses of Label for them. Or a generic custom component
with what you can do

  add(new DateLabel("someDate").setDateConverter(new FooDateConverter()));

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations Oyhttp://www.ri.fi/ >

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



Re: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Casper Bang
Yeah. First I actually didn't understand why until Igor pointed it out. 
I'm no longer using wicket-auth-roles, if one can live with the roles 
being defined along side the authorization code it works quite nicely 
(and with somewhat cleaner code). I ran into another issue however, 
trying to model how an ADMIN transitively is also a USER. Sadly the Sun 
compiler does not allow Enum forward referencing to itself, only the 
Eclipse compiler does.


/Casper


Ned Collyer wrote:

Interestingly we used a similar approach with using classes as pseudo enums.

Not being able to extend enums is a bit suckfull.


igor.vaynberg wrote:
  

the problem is that the enum would have to live *inside* the
wicketstuffauth code. so wicketstuffauth would be the library that
would need to define the enum - and it doesnt know about your
application specific roles. at least this was the issue when it was
first being designed. i havent really looked at it since than.

-igor




  



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



Re: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Ned Collyer

Interestingly we used a similar approach with using classes as pseudo enums.

Not being able to extend enums is a bit suckfull.


igor.vaynberg wrote:
> 
> the problem is that the enum would have to live *inside* the
> wicketstuffauth code. so wicketstuffauth would be the library that
> would need to define the enum - and it doesnt know about your
> application specific roles. at least this was the issue when it was
> first being designed. i havent really looked at it since than.
> 
> -igor
> 

-- 
View this message in context: 
http://www.nabble.com/Why-does-org.apache.wicket.authorization-revolve-around-string-tokens--tp20723820p20728137.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: ImageButton picture.x and picture.y

2008-11-27 Thread Nino Saturnino Martinez Vazquez Wael
maybe james patch can help you : 
http://www.nabble.com/Client-Side-Image-Map...-td20516107.html#a20516107 ?


Otherwise it should be  ImageMap already there..
Nino Saturnino Martinez Vazquez Wael wrote:

Hi Tim

You should get a grasp on models. But isnt it an imagearea (cant 
remember the exact name) or something you want? Image button is just a 
button which has a image...


Tim Squires wrote:

Hi,

I'm trying to retrieve the x and y coords from a user click on an 
ImageButton.  Can anyone tell me how to get these parameters in an 
onSubmit method?


Currently I'm doing

   final IModel picture = new 
AbstractReadOnlyModel() {


   @Override
   public Picture getObject() {
   return pictureService.findRandom();
   }
   };

   Form form = new Form("form") {
   @Override
   protected void onSubmit() {
 // picture.x and picture.y 
parameters, where are they?

   }
   };

   form.add(new ImageButton("picture", new 
ImageResource(defaults

   .getPicturesLocation(), picture)));

   add(form);

but cannot find any way of retrieving the page parameters in the 
onSubmit() - getPageParameters() returns null.


I'm using 1.4-rc1.

Thanks for any help,
Tim

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





--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: ImageButton picture.x and picture.y

2008-11-27 Thread Nino Saturnino Martinez Vazquez Wael

Hi Tim

You should get a grasp on models. But isnt it an imagearea (cant 
remember the exact name) or something you want? Image button is just a 
button which has a image...


Tim Squires wrote:

Hi,

I'm trying to retrieve the x and y coords from a user click on an 
ImageButton.  Can anyone tell me how to get these parameters in an 
onSubmit method?


Currently I'm doing

   final IModel picture = new 
AbstractReadOnlyModel() {


   @Override
   public Picture getObject() {
   return pictureService.findRandom();
   }
   };

   Form form = new Form("form") {
   @Override
   protected void onSubmit() {
 // picture.x and picture.y 
parameters, where are they?

   }
   };

   form.add(new ImageButton("picture", new ImageResource(defaults
   .getPicturesLocation(), picture)));

   add(form);

but cannot find any way of retrieving the page parameters in the 
onSubmit() - getPageParameters() returns null.


I'm using 1.4-rc1.

Thanks for any help,
Tim

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



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



ImageButton picture.x and picture.y

2008-11-27 Thread Tim Squires

Hi,

I'm trying to retrieve the x and y coords from a user click on an 
ImageButton.  Can anyone tell me how to get these parameters in an 
onSubmit method?


Currently I'm doing

   final IModel picture = new 
AbstractReadOnlyModel() {


   @Override
   public Picture getObject() {
   return pictureService.findRandom();
   }
   };

   Form form = new Form("form") {
   @Override
   protected void onSubmit() {
  
   // picture.x and picture.y parameters, where are they?

   }
   };

   form.add(new ImageButton("picture", new ImageResource(defaults
   .getPicturesLocation(), picture)));

   add(form);

but cannot find any way of retrieving the page parameters in the 
onSubmit() - getPageParameters() returns null.


I'm using 1.4-rc1.

Thanks for any help,
Tim

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



Re: [VOTE] Consistent naming for Wicket Stuff projects

2008-11-27 Thread Nino Saturnino Martinez Vazquez Wael

[ X ] - YES - I would like consistent naming



Jeremy Thomerson wrote:

I am beginning the WS reorg as noted in previous emails.  You can monitor
progress here:
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/

As we move projects into the wicketstuff-core, I would like to see us rename
them consistently, getting rid of the prepended "wicket-contrib-" or
"wicketstuff-".  This would mean that when we release WicketStuff 1.4 (when
Wicket 1.4 is released) that if you are using that project, you would need
to update your POM to the new name.  Please vote:

[ ] - YES - I would like consistent naming
[ ] - NO (convincing reason)

PS - I feel like I'm starting a lot of vote threads - should I not be?  Any
suggestions?  I would like to efficiently get this reorg done, but I am
leery of just moving other people's projects around and making changes
without permission.  Feelings / thoughts?

  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: [VOTE] End of Life wicket-contrib-gmap?

2008-11-27 Thread Nino Saturnino Martinez Vazquez Wael

HI Jeremy

[ X ] - YES, please create a branch in the Wicket Stuff repo just for

I were handed over the code some time ago as I've participated on the 
project, but I think gmap2 are more developed and stable.. And I have no 
intention of having the two projects compete im thinking of gmap2, so 
lets put gmap in the attic.


Jeremy Thomerson wrote:

I am starting to work on the WicketStuff reorg as the community voted to
do.  In doing so, I noticed that wicket-contrib-gmap is still set up to
compile against 1.3.0-incubating-snapshot.  Also, we know that Iulian has
said he is no longer maintaining it.  In light of this, I propose the
following vote:

[ ] - YES, please create a branch in the Wicket Stuff repo just for
abandoned projects and move wicket-contrib-gmap into that branch.
[ ] - NO (please provide convincing reason).

For those who say "I'm still using it" - you'll still be able to - from the
abandoned branch, you can build your own release, just like you must be
doing now.  But it helps new users not be as confused with the multiple
projects, and trying to use one that's dead.

PS - I will probably be sending more votes along like this as I go through
the repo trying to organize it.  If you have suggestions, please let us
know.

Thanks,

Jeremy Thomerson
http://www.wickettraining.com

  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: DateTimeField and java.util.Calendar

2008-11-27 Thread jWeekend

Eduardo,

See org.apache.wicket.extensions.yui.calendar.DateField if you want a popup
DateTextField does not have a popup
DateTimeField has fields for time (as well as date) 

All the javadoc seems to be 
http://repo1.maven.org/maven2/org/apache/wicket/wicket/ there .
http://repo1.maven.org/maven2/org/apache/wicket/wicket/
Also see  http://wicket.apache.org/quickstart.html this .

There are a lot of good people working on this project. The documentation is
constantly improving (but  http://manning.com/dashorst/ Wicket In Action  is
a great resource) and this forum will give you more help than you can buy
for money anywhere else.

Regards - Cemal
http://www.jWeekend.co.uk http://jWeekend.co.uk 





Eduardo Simioni wrote:
> 
> If you want Wicket to be competitive, you should think about better and
> centralized documentation.
> Many developer blogs is not documentation, an outdated wiki is not
> documentation, and definitely source code is not documentation.
> I'm saying all this, because, once again, I spent a lot of time to get to
> work something that should be easy and straight.
> The first problem was my mistake, I haven't had realized that the
> DatePicker
> was a separate component.
> But the second problem with the DateTimeField, as almost always, I had to
> realize myself what was happening looking at the source code of the
> component. There was no example, no documentation at all showing how to
> use
> the component.
> Wicket is the only framework I work with that is impossible to achieve
> simple tasks without opening the source code. I know that this can happen,
> and I sometimes have to open the source code of other frameworks, but with
> Wicket this happens all the time.
> Another problem is that JavaDoc doesn't come with the dist. I have to read
> it at source code as well, because on the website there is just the
> JavaDoc
> for the current release. Please, don't ask me to generate the JavaDoc
> myself.
> 
> Wicket is nice, but its doc is still very poor.
> 
> Eduardo.
> 
> On 11/26/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote:
>>
>> Nobody? Am I the only one having problems with these fields?
>>
>> Thanks,
>>
>> Eduardo.
>>
>> On 11/25/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote:
>>>
>>> Thanks for the hints.
>>>
>>> The conversion using nested models worked, although I have had to do
>>> some
>>> ugly things in the code because, unlike other fields, date fields
>>> model's
>>> don't get automatically updated when the form model is updated. Probably
>>> because of the converter model, it would definitely be better if we
>>> could
>>> work with something more "magic". But for now that's ok.
>>>
>>> The problem now is that the date fields don't show up as expected in the
>>> page. I tried the DateTextField as in the examples but the button to
>>> open
>>> the calendar pop-up is not showing in the page.
>>> The DateTimeField (my first option) has a different problem, it shows an
>>> extra field that does nothing, I could not manage to remove it. Are
>>> these
>>> known bugs? I'm using 1.4-m3.
>>>
>>> See this image: http://www.simioni.net/wicket-date-fields-problems.jpg
>>>
>>> The relevant parts of the code for the class and page are the following:
>>>
>>> Class:
>>> private class RankingForm extends EntityForm {
>>>
>>> private CalendarToDateModel modelStartDate;
>>> private CalendarToDateModel modelEndDate;
>>>
>>> public RankingForm( IModel model, Component dataTable )
>>> {
>>> super( model, dataTable );
>>> add( new TextField( "name" ) );
>>> modelStartDate = new CalendarToDateModel( new
>>> PropertyModel( model, "startDate" ) );
>>> add( new DateTextField( "startDate", modelStartDate, new
>>> StyleDateConverter( "SM", false ) ) );
>>> modelEndDate = new CalendarToDateModel( new
>>> PropertyModel( model, "endDate" ) );
>>> add( new DateTimeField( "endDate", modelEndDate ) );
>>> add( new TextField( "scoreRight" ) );
>>> add( new TextField( "scoreWrong" ) );
>>> add( new TextField( "scoreLimit" ) );
>>> }
>>>
>>> @Override
>>> public MarkupContainer setDefaultModel( IModel model ) {
>>> modelStartDate.setDefaultModel( new PropertyModel(
>>> model, "startDate" ) );
>>> modelEndDate.setDefaultModel( new PropertyModel(
>>> model, "endDate" ) );
>>> return super.setDefaultModel( model );
>>> }
>>> ...
>>>
>>> HTML:
>>> 
>>> Criar/Editar Ranking
>>> Feedback
>>> Panel
>>> Nome: >> type="text" size="20"/>
>>> Data/Hora Início: >> type="text" wicket:id="startDate"/>
>>> Data/Hora Fim: >> type="text"
>>> wicket:id="endDate"/>
>>> Pontos para Acerto: >> wicket:id="scoreRight" type="text" size="10"/>
>>> Pontos para Erro: >> wicket:id="scoreWrong" type="text" size="10"/>
>>> Limite de Pontos: >> wicket:

Re: [VOTE] End of Life wicket-contrib-gmap?

2008-11-27 Thread Bruno Borges
Create a branch named 'attic' and put dead projects there...

:-)

Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld


On Thu, Nov 27, 2008 at 7:49 PM, Jeremy Thomerson <[EMAIL PROTECTED]
> wrote:

> I am starting to work on the WicketStuff reorg as the community voted to
> do.  In doing so, I noticed that wicket-contrib-gmap is still set up to
> compile against 1.3.0-incubating-snapshot.  Also, we know that Iulian has
> said he is no longer maintaining it.  In light of this, I propose the
> following vote:
>
> [ ] - YES, please create a branch in the Wicket Stuff repo just for
> abandoned projects and move wicket-contrib-gmap into that branch.
> [ ] - NO (please provide convincing reason).
>
> For those who say "I'm still using it" - you'll still be able to - from the
> abandoned branch, you can build your own release, just like you must be
> doing now.  But it helps new users not be as confused with the multiple
> projects, and trying to use one that's dead.
>
> PS - I will probably be sending more votes along like this as I go through
> the repo trying to organize it.  If you have suggestions, please let us
> know.
>
> Thanks,
>
> Jeremy Thomerson
> http://www.wickettraining.com
>


Re: [VOTE] Consistent naming for Wicket Stuff projects

2008-11-27 Thread Bruno Borges
[X] YES

But I'd like to suggest to use wicket-stuff-myproject

I like the 'stuff' word instead of 'contrib'... sounds more ... cool! :D

cheers,
Bruno

Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld


On Thu, Nov 27, 2008 at 8:28 PM, Timm Helbig <[EMAIL PROTECTED]>wrote:

> Am Thursday 27 November 2008 22:54:28 schrieb Jeremy Thomerson:
>
> [X] - YES - I would like consistent naming
>
> > PS - I feel like I'm starting a lot of vote threads - should I not be?
> IMHO if you feel the need to do so, go ahead. I won't mind. Thank you for
> asking!
>
> Regards,
> Timm
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: DateTimeField and java.util.Calendar

2008-11-27 Thread Bruno Borges
If you are working with Maven, you can set the Eclipse plugin to download
the source for you, then you will have the JavaDoc while developing through
this IDE.

You can also buy the Wicket in Action book (no, Martijn is not giving me any
money ... though I'd really appreciate a few dutch beers).

Anyway,  I think Wicket is well documented just like any other Web Framework
out there. If you look at the Struts documentation when that framework
completed 2 years of intensive development and community support, you would
be surprised of how poor that documentation was. By the way,  that
documentation didn't quite help too much to find out what was going on on
weird exceptions... ;-)

[]'s
Bruno Borges
blog.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
- Francois de La Rochefoucauld


On Thu, Nov 27, 2008 at 5:40 PM, Eduardo Simioni
<[EMAIL PROTECTED]>wrote:

> If you want Wicket to be competitive, you should think about better and
> centralized documentation.
> Many developer blogs is not documentation, an outdated wiki is not
> documentation, and definitely source code is not documentation.
> I'm saying all this, because, once again, I spent a lot of time to get to
> work something that should be easy and straight.
> The first problem was my mistake, I haven't had realized that the
> DatePicker
> was a separate component.
> But the second problem with the DateTimeField, as almost always, I had to
> realize myself what was happening looking at the source code of the
> component. There was no example, no documentation at all showing how to use
> the component.
> Wicket is the only framework I work with that is impossible to achieve
> simple tasks without opening the source code. I know that this can happen,
> and I sometimes have to open the source code of other frameworks, but with
> Wicket this happens all the time.
> Another problem is that JavaDoc doesn't come with the dist. I have to read
> it at source code as well, because on the website there is just the JavaDoc
> for the current release. Please, don't ask me to generate the JavaDoc
> myself.
>
> Wicket is nice, but its doc is still very poor.
>
> Eduardo.
>
> On 11/26/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote:
> >
> > Nobody? Am I the only one having problems with these fields?
> >
> > Thanks,
> >
> > Eduardo.
> >
> > On 11/25/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote:
> >>
> >> Thanks for the hints.
> >>
> >> The conversion using nested models worked, although I have had to do
> some
> >> ugly things in the code because, unlike other fields, date fields
> model's
> >> don't get automatically updated when the form model is updated. Probably
> >> because of the converter model, it would definitely be better if we
> could
> >> work with something more "magic". But for now that's ok.
> >>
> >> The problem now is that the date fields don't show up as expected in the
> >> page. I tried the DateTextField as in the examples but the button to
> open
> >> the calendar pop-up is not showing in the page.
> >> The DateTimeField (my first option) has a different problem, it shows an
> >> extra field that does nothing, I could not manage to remove it. Are
> these
> >> known bugs? I'm using 1.4-m3.
> >>
> >> See this image: http://www.simioni.net/wicket-date-fields-problems.jpg
> >>
> >> The relevant parts of the code for the class and page are the following:
> >>
> >> Class:
> >> private class RankingForm extends EntityForm {
> >>
> >> private CalendarToDateModel modelStartDate;
> >> private CalendarToDateModel modelEndDate;
> >>
> >> public RankingForm( IModel model, Component dataTable )
> {
> >> super( model, dataTable );
> >> add( new TextField( "name" ) );
> >> modelStartDate = new CalendarToDateModel( new
> >> PropertyModel( model, "startDate" ) );
> >> add( new DateTextField( "startDate", modelStartDate, new
> >> StyleDateConverter( "SM", false ) ) );
> >> modelEndDate = new CalendarToDateModel( new
> >> PropertyModel( model, "endDate" ) );
> >> add( new DateTimeField( "endDate", modelEndDate ) );
> >> add( new TextField( "scoreRight" ) );
> >> add( new TextField( "scoreWrong" ) );
> >> add( new TextField( "scoreLimit" ) );
> >> }
> >>
> >> @Override
> >> public MarkupContainer setDefaultModel( IModel model ) {
> >> modelStartDate.setDefaultModel( new PropertyModel(
> >> model, "startDate" ) );
> >> modelEndDate.setDefaultModel( new PropertyModel(
> >> model, "endDate" ) );
> >> return super.setDefaultModel( model );
> >> }
> >> ...
> >>
> >> HTML:
> >> 
> >> Criar/Editar Ranking
> >> Feedback
> >> Panel
> >> Nome:  >> type="text" size="20"/>
> >> Data/Hora Início:  >> type="text" wicket:id="startDate"/>
> >> Data/

Re: [VOTE] Consistent naming for Wicket Stuff projects

2008-11-27 Thread Timm Helbig
Am Thursday 27 November 2008 22:54:28 schrieb Jeremy Thomerson:

[X] - YES - I would like consistent naming

> PS - I feel like I'm starting a lot of vote threads - should I not be?
IMHO if you feel the need to do so, go ahead. I won't mind. Thank you for 
asking!

Regards,
Timm




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



[VOTE] Consistent naming for Wicket Stuff projects

2008-11-27 Thread Jeremy Thomerson
I am beginning the WS reorg as noted in previous emails.  You can monitor
progress here:
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/

As we move projects into the wicketstuff-core, I would like to see us rename
them consistently, getting rid of the prepended "wicket-contrib-" or
"wicketstuff-".  This would mean that when we release WicketStuff 1.4 (when
Wicket 1.4 is released) that if you are using that project, you would need
to update your POM to the new name.  Please vote:

[ ] - YES - I would like consistent naming
[ ] - NO (convincing reason)

PS - I feel like I'm starting a lot of vote threads - should I not be?  Any
suggestions?  I would like to efficiently get this reorg done, but I am
leery of just moving other people's projects around and making changes
without permission.  Feelings / thoughts?

-- 
Jeremy Thomerson
http://www.wickettraining.com


[VOTE] End of Life wicket-contrib-gmap?

2008-11-27 Thread Jeremy Thomerson
I am starting to work on the WicketStuff reorg as the community voted to
do.  In doing so, I noticed that wicket-contrib-gmap is still set up to
compile against 1.3.0-incubating-snapshot.  Also, we know that Iulian has
said he is no longer maintaining it.  In light of this, I propose the
following vote:

[ ] - YES, please create a branch in the Wicket Stuff repo just for
abandoned projects and move wicket-contrib-gmap into that branch.
[ ] - NO (please provide convincing reason).

For those who say "I'm still using it" - you'll still be able to - from the
abandoned branch, you can build your own release, just like you must be
doing now.  But it helps new users not be as confused with the multiple
projects, and trying to use one that's dead.

PS - I will probably be sending more votes along like this as I go through
the repo trying to organize it.  If you have suggestions, please let us
know.

Thanks,

Jeremy Thomerson
http://www.wickettraining.com


Re: Markup other than HTML

2008-11-27 Thread Ernesto Reinaldo Barreiro
What else do you want to generate? For XML maybe this link give you a hint:

http://www.jroller.com/wireframe/entry/wicket_feedpage

As for generating other things (e.g. PDF)... One idea could be navigate
the component hierarchy and produce some document out of it. Of course,
for doing this you will have to attribute some "meaning", on the target
output format, to your components (e.g. a GRID into a PDF grid-table, a
form into table displaying your filters, etc)... I have tried this once
and it worked fine but at the end I ended up using other approach to
generate  content different than HTML: instead of the navigating
components just navigate the data used to produce them...

Regards,

Ernesto 

Eyal Golan wrote:
> Hi,
> I was asked today if it's possible to render a page to different format than
> HTML.
> I guess it is possible, but how one can do it?
>
>
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>
>   


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



Re: Markup other than HTML

2008-11-27 Thread Jeremy Thomerson
Oops - sent early - override that in YourPage.java and then just make
YourPage.xml - viola!

On Thu, Nov 27, 2008 at 3:00 PM, Jeremy Thomerson <[EMAIL PROTECTED]
> wrote:

> @Override
> public String getMarkupType() {
> return "xml";
> }
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
> On Thu, Nov 27, 2008 at 2:30 PM, Eyal Golan <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>> I was asked today if it's possible to render a page to different format
>> than
>> HTML.
>> I guess it is possible, but how one can do it?
>>
>>
>> Eyal Golan
>> [EMAIL PROTECTED]
>>
>> Visit: http://jvdrums.sourceforge.net/
>> LinkedIn: http://www.linkedin.com/in/egolan74
>>
>> P  Save a tree. Please don't print this e-mail unless it's really
>> necessary
>>
>
>
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: Markup other than HTML

2008-11-27 Thread Jeremy Thomerson
@Override
public String getMarkupType() {
return "xml";
}

-- 
Jeremy Thomerson
http://www.wickettraining.com


On Thu, Nov 27, 2008 at 2:30 PM, Eyal Golan <[EMAIL PROTECTED]> wrote:

> Hi,
> I was asked today if it's possible to render a page to different format
> than
> HTML.
> I guess it is possible, but how one can do it?
>
>
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>


Markup other than HTML

2008-11-27 Thread Eyal Golan
Hi,
I was asked today if it's possible to render a page to different format than
HTML.
I guess it is possible, but how one can do it?


Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


Re: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Valentine2008

Hi Igor,

I understand. I cannot dump all my code here. It is too much.

I will try to give you a runnable code.

Now, I am using iterator() instead of iterator(Comparator) to bypass the
problem.

Thanks,
Valentine


igor.vaynberg wrote:
> 
> i cannot put this into my ide and run it to confirm the error you are
> getting.
> 
> -igor
> 
> On Thu, Nov 27, 2008 at 11:22 AM, Valentine2008
> <[EMAIL PROTECTED]> wrote:
>>
>> The getInputForm() will return an instance of Form class in Wicket.
>> After creating the form,
>> ---
>> // 3. create, setup, and add the input form
>>inputForm = new Form("inputForm");
>>inputForm.setOutputMarkupId(true);
>>add(inputForm);
>> --
>>
>> I added the following to the form:
>> 1. a FeedbackPanel component;
>> 2. a AjaxSubmitLink component;
>> 3. a AjaxLink component;
>> 4. A Button component;
>> 5. Several Label components, some are invisible (Which are in a
>> WebMarkupContainer to control its visibility);
>> 6. Several TextField components;
>> 7. Several DropDownList components, some are invisible (Which are in a
>> WebMarkupContainer to control its visibility);
>> 8. Several ListMultipleChoice components, some are invisible (Which are
>> in a
>> WebMarkupContainer to control its visibility).
>>
>> Thanks.
>>
>>
>> Valentine2008 wrote:
>>>
>>> Hi,
>>>
>>> I wrote the following code to print out all the children of the an input
>>> form.
>>> ---
>>> Iterator iterator = getInputForm().iterator(new Comparator() {
>>>
>>> public int compare(Object o1, Object o2)
>>> {
>>> System.out.format(":%s, %s%n", o1, o2);
>>>
>>> Component component1 = (Component) o1;
>>> Component component2 = (Component) o2;
>>> return
>>> component1.getId().compareTo(component2.getId());
>>> }
>>> });
>>>
>>> while(iterator.hasNext())
>>> {
>>> System.out.format("---Child of input form:
>>> id=%s%n", ((Component)iterator.next()).getId());
>>> }
>>> -
>>>
>>> When running, the following error occurs:
>>> ---
>>> [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432)
>>> -
>>> org.ap
>>> ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
>>> [Lorg.apache.wick
>>> et.Component;
>>> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
>>> [Lorg.apache
>>> .wicket.Component;
>>> at
>>> org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
>>> .
>>>
>>> The code on line 478 of MarkupContainer.java is:
>>> sorted = Arrays.asList((Component[])children);
>>>
>>> Is it a bug of Wicket?
>>>
>>> Thanks,
>>> Valentine
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.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/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724952.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: Set format date "inline"

2008-11-27 Thread Igor Vaynberg
public class datelabel extends webcomponent {
  private string pattern;
  public datelabel(string id, imodel date, string pattern) {
super(id, date);
this.pattern=pattern;
  }
  protected void onComponentTagBody(markupstream s, componenttag t) {
replacecomponenttagbody(s,t, new
simpledateformat(pattern).format((date)getmodelobject());
  }
}

-igor

On Thu, Nov 27, 2008 at 12:06 PM, kan <[EMAIL PROTECTED]> wrote:
> Yes, I know. But it takes Class only. And I have several different
> formats (just date, date+time+tz, "human readable date" like "2 days
> ago" and so on), how can I substitute a format in given piece of code
> like add(new Label("someDate"))?
>
> 2008/11/27 Bruno Cesar Borges <[EMAIL PROTECTED]>:
>> @Override
>>public IConverter getConverter(Class type)
>>{
>>return MyConverter();
>>}
>>
>> -Mensagem original-
>> De: kan [mailto:[EMAIL PROTECTED]
>> Enviada em: quinta-feira, 27 de novembro de 2008 14:57
>> Para: users@wicket.apache.org
>> Assunto: Set format date "inline"
>>
>>
>> I have a MyPojo with property java.util.Date someDate
>> I use CompoundPropertyModel
>> Now I add components on my page, like add(new Label("someDate")) and
>> it automagically uses IConvertor to convert from Date to string.
>> But in some places of web-site I need print only "27/11/2008", in some
>> places better will be "2 days ago", in some places "27/11/2008
>> 16:53:34 UTC" and so on.
>> What is an elegant way to specify a format in particular piece of code?
>>
>> --
>> WBR, kan.
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>> ***
>> "Atenção: Esta mensagem foi enviada para uso exclusivo do(s) 
>> destinatários(s) acima identificado(s),
>> podendo conter informações e/ou documentos confidencias/privilegiados e seu 
>> sigilo é protegido por
>> lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
>> apague-a de seu sistema.
>> Notificamos que é proibido por lei a sua retenção, disseminação, 
>> distribuição, cópia ou uso sem
>> expressa autorização do remetente. Opiniões pessoais do remetente não 
>> refletem, necessariamente,
>> o ponto de vista da CETIP, o qual é divulgado somente por pessoas 
>> autorizadas."
>>
>>
>> "Warning: This message was sent for exclusive use of the addressees above 
>> identified, possibly
>> containing information and or privileged/confidential documents whose 
>> content is protected by law.
>> In case you have mistakenly received it, please notify the sender and delete 
>> it from your system.
>> Be noticed that the law forbids the retention, dissemination, distribution, 
>> copy or use without
>> express authorization from the sender. Personal opinions of the sender do 
>> not necessarily reflect
>> CETIP's point of view, which is only divulged by authorized personnel."
>> ***
>>
>
>
>
> --
> WBR, kan.
>

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



Re: Set format date "inline"

2008-11-27 Thread Jeremy Thomerson
Not really the best solution, but you can create a different label for
different formats that you want, i.e.:

DateOnlyLabel (which overrides getConverter and always returns a converter
that displays only the date)
DateAndTimeLabel (etc)

ala...

public class DateOnlyLabel extends Label {
private static final long serialVersionUID = 1L;
public DateOnlyLabel(String id, IModel model) {
super(id, model);
}
@Override
public IConverter getConverter(Class type) {
return new DateConverter() {
private static final long serialVersionUID = 1L;

@Override
public DateFormat getDateFormat(Locale locale) {
return new SimpleDateFormat("MM/DD/");
}

};
}
}


On Thu, Nov 27, 2008 at 2:06 PM, kan <[EMAIL PROTECTED]> wrote:

> Yes, I know. But it takes Class only. And I have several different
> formats (just date, date+time+tz, "human readable date" like "2 days
> ago" and so on), how can I substitute a format in given piece of code
> like add(new Label("someDate"))?
>
> 2008/11/27 Bruno Cesar Borges <[EMAIL PROTECTED]>:
>  > @Override
> >public IConverter getConverter(Class type)
> >{
> >return MyConverter();
> >}
> >
> > -Mensagem original-
> > De: kan [mailto:[EMAIL PROTECTED]
> > Enviada em: quinta-feira, 27 de novembro de 2008 14:57
> > Para: users@wicket.apache.org
> > Assunto: Set format date "inline"
> >
> >
> > I have a MyPojo with property java.util.Date someDate
> > I use CompoundPropertyModel
> > Now I add components on my page, like add(new Label("someDate")) and
> > it automagically uses IConvertor to convert from Date to string.
> > But in some places of web-site I need print only "27/11/2008", in some
> > places better will be "2 days ago", in some places "27/11/2008
> > 16:53:34 UTC" and so on.
> > What is an elegant way to specify a format in particular piece of code?
> >
> > --
> > WBR, kan.
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> ***
> > "Atenção: Esta mensagem foi enviada para uso exclusivo do(s)
> destinatários(s) acima identificado(s),
> > podendo conter informações e/ou documentos confidencias/privilegiados e
> seu sigilo é protegido por
> > lei. Caso você tenha recebido por engano, por favor, informe o remetente
> e apague-a de seu sistema.
> > Notificamos que é proibido por lei a sua retenção, disseminação,
> distribuição, cópia ou uso sem
> > expressa autorização do remetente. Opiniões pessoais do remetente não
> refletem, necessariamente,
> > o ponto de vista da CETIP, o qual é divulgado somente por pessoas
> autorizadas."
> >
> >
> > "Warning: This message was sent for exclusive use of the addressees above
> identified, possibly
> > containing information and or privileged/confidential documents whose
> content is protected by law.
> > In case you have mistakenly received it, please notify the sender and
> delete it from your system.
> > Be noticed that the law forbids the retention, dissemination,
> distribution, copy or use without
> > express authorization from the sender. Personal opinions of the sender do
> not necessarily reflect
> > CETIP's point of view, which is only divulged by authorized personnel."
> >
> ***
> >
>
>
>
> --
> WBR, kan.
>



-- 
Jeremy Thomerson
http://www.wickettraining.com


Re: How to get all the children of a MarkupContainer?

2008-11-27 Thread Igor Vaynberg
no. why would it do that? visibility is a render-time condition, it
has nothing to do with component hierarchy.

-igor

On Thu, Nov 27, 2008 at 12:01 PM, Valentine2008
<[EMAIL PROTECTED]> wrote:
>
> But Component.get(pathString) will check the visibility and will return null
> if the child is invisible. Right?
>
> Thanks,
> Valentine
>
>
>
>
> igor.vaynberg wrote:
>>
>> iterator() does not check visibility.
>>
>> -igor
>>
>> On Thu, Nov 27, 2008 at 11:24 AM, Valentine2008
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Can we get even the invisible children?
>>>
>>> Seems we cannot:-(
>>>
>>> igor.vaynberg wrote:

 iterator()

 -igor

 On Thu, Nov 27, 2008 at 10:42 AM, Valentine2008
 <[EMAIL PROTECTED]> wrote:
>
> Use iterator(Comparator)?
>
> Or other ways?
>
> Thanks,
> Valentine
> --
> View this message in context:
> http://www.nabble.com/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20723938.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/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20724471.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/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20724656.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]



Re: Set format date "inline"

2008-11-27 Thread kan
Yes, I know. But it takes Class only. And I have several different
formats (just date, date+time+tz, "human readable date" like "2 days
ago" and so on), how can I substitute a format in given piece of code
like add(new Label("someDate"))?

2008/11/27 Bruno Cesar Borges <[EMAIL PROTECTED]>:
> @Override
>public IConverter getConverter(Class type)
>{
>return MyConverter();
>}
>
> -Mensagem original-
> De: kan [mailto:[EMAIL PROTECTED]
> Enviada em: quinta-feira, 27 de novembro de 2008 14:57
> Para: users@wicket.apache.org
> Assunto: Set format date "inline"
>
>
> I have a MyPojo with property java.util.Date someDate
> I use CompoundPropertyModel
> Now I add components on my page, like add(new Label("someDate")) and
> it automagically uses IConvertor to convert from Date to string.
> But in some places of web-site I need print only "27/11/2008", in some
> places better will be "2 days ago", in some places "27/11/2008
> 16:53:34 UTC" and so on.
> What is an elegant way to specify a format in particular piece of code?
>
> --
> WBR, kan.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ***
> "Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
> acima identificado(s),
> podendo conter informações e/ou documentos confidencias/privilegiados e seu 
> sigilo é protegido por
> lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
> apague-a de seu sistema.
> Notificamos que é proibido por lei a sua retenção, disseminação, 
> distribuição, cópia ou uso sem
> expressa autorização do remetente. Opiniões pessoais do remetente não 
> refletem, necessariamente,
> o ponto de vista da CETIP, o qual é divulgado somente por pessoas 
> autorizadas."
>
>
> "Warning: This message was sent for exclusive use of the addressees above 
> identified, possibly
> containing information and or privileged/confidential documents whose content 
> is protected by law.
> In case you have mistakenly received it, please notify the sender and delete 
> it from your system.
> Be noticed that the law forbids the retention, dissemination, distribution, 
> copy or use without
> express authorization from the sender. Personal opinions of the sender do not 
> necessarily reflect
> CETIP's point of view, which is only divulged by authorized personnel."
> ***
>



-- 
WBR, kan.


Re: How to get all the children of a MarkupContainer?

2008-11-27 Thread Valentine2008

But Component.get(pathString) will check the visibility and will return null
if the child is invisible. Right?

Thanks,
Valentine




igor.vaynberg wrote:
> 
> iterator() does not check visibility.
> 
> -igor
> 
> On Thu, Nov 27, 2008 at 11:24 AM, Valentine2008
> <[EMAIL PROTECTED]> wrote:
>>
>> Can we get even the invisible children?
>>
>> Seems we cannot:-(
>>
>> igor.vaynberg wrote:
>>>
>>> iterator()
>>>
>>> -igor
>>>
>>> On Thu, Nov 27, 2008 at 10:42 AM, Valentine2008
>>> <[EMAIL PROTECTED]> wrote:

 Use iterator(Comparator)?

 Or other ways?

 Thanks,
 Valentine
 --
 View this message in context:
 http://www.nabble.com/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20723938.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/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20724471.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/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20724656.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: DateTimeField and java.util.Calendar

2008-11-27 Thread Eduardo Simioni
If you want Wicket to be competitive, you should think about better and
centralized documentation.
Many developer blogs is not documentation, an outdated wiki is not
documentation, and definitely source code is not documentation.
I'm saying all this, because, once again, I spent a lot of time to get to
work something that should be easy and straight.
The first problem was my mistake, I haven't had realized that the DatePicker
was a separate component.
But the second problem with the DateTimeField, as almost always, I had to
realize myself what was happening looking at the source code of the
component. There was no example, no documentation at all showing how to use
the component.
Wicket is the only framework I work with that is impossible to achieve
simple tasks without opening the source code. I know that this can happen,
and I sometimes have to open the source code of other frameworks, but with
Wicket this happens all the time.
Another problem is that JavaDoc doesn't come with the dist. I have to read
it at source code as well, because on the website there is just the JavaDoc
for the current release. Please, don't ask me to generate the JavaDoc
myself.

Wicket is nice, but its doc is still very poor.

Eduardo.

On 11/26/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote:
>
> Nobody? Am I the only one having problems with these fields?
>
> Thanks,
>
> Eduardo.
>
> On 11/25/08, Eduardo Simioni <[EMAIL PROTECTED]> wrote:
>>
>> Thanks for the hints.
>>
>> The conversion using nested models worked, although I have had to do some
>> ugly things in the code because, unlike other fields, date fields model's
>> don't get automatically updated when the form model is updated. Probably
>> because of the converter model, it would definitely be better if we could
>> work with something more "magic". But for now that's ok.
>>
>> The problem now is that the date fields don't show up as expected in the
>> page. I tried the DateTextField as in the examples but the button to open
>> the calendar pop-up is not showing in the page.
>> The DateTimeField (my first option) has a different problem, it shows an
>> extra field that does nothing, I could not manage to remove it. Are these
>> known bugs? I'm using 1.4-m3.
>>
>> See this image: http://www.simioni.net/wicket-date-fields-problems.jpg
>>
>> The relevant parts of the code for the class and page are the following:
>>
>> Class:
>> private class RankingForm extends EntityForm {
>>
>> private CalendarToDateModel modelStartDate;
>> private CalendarToDateModel modelEndDate;
>>
>> public RankingForm( IModel model, Component dataTable ) {
>> super( model, dataTable );
>> add( new TextField( "name" ) );
>> modelStartDate = new CalendarToDateModel( new
>> PropertyModel( model, "startDate" ) );
>> add( new DateTextField( "startDate", modelStartDate, new
>> StyleDateConverter( "SM", false ) ) );
>> modelEndDate = new CalendarToDateModel( new
>> PropertyModel( model, "endDate" ) );
>> add( new DateTimeField( "endDate", modelEndDate ) );
>> add( new TextField( "scoreRight" ) );
>> add( new TextField( "scoreWrong" ) );
>> add( new TextField( "scoreLimit" ) );
>> }
>>
>> @Override
>> public MarkupContainer setDefaultModel( IModel model ) {
>> modelStartDate.setDefaultModel( new PropertyModel(
>> model, "startDate" ) );
>> modelEndDate.setDefaultModel( new PropertyModel(
>> model, "endDate" ) );
>> return super.setDefaultModel( model );
>> }
>> ...
>>
>> HTML:
>> 
>> Criar/Editar Ranking
>> Feedback
>> Panel
>> Nome: > type="text" size="20"/>
>> Data/Hora Início: > type="text" wicket:id="startDate"/>
>> Data/Hora Fim: > wicket:id="endDate"/>
>> Pontos para Acerto: > wicket:id="scoreRight" type="text" size="10"/>
>> Pontos para Erro: > wicket:id="scoreWrong" type="text" size="10"/>
>> Limite de Pontos: > wicket:id="scoreLimit" type="text" size="10"/>
>> ...
>>
>>
>> Does anyone know a solution for these problems?
>>
>> Thanks!
>>
>> Eduardo.
>>
>>
>> On 11/24/08, Jeremy Thomerson <[EMAIL PROTECTED]> wrote:
>>>
>>> Yes - this would be a perfect time for a nested model - write a generic
>>> model that implements IModel and takes an IModel as its
>>> input.
>>>
>>> See
>>>
>>> http://www.jeremythomerson.com/blog/2008/11/06/wicket-the-power-of-nested-models/
>>> for
>>> assistance with the rest.
>>>
>>>
>>> --
>>> Jeremy Thomerson
>>> http://www.wickettraining.com
>>>
>>>
>>>
>>>
>>> On Mon, Nov 24, 2008 at 3:08 PM, Igor Vaynberg <[EMAIL PROTECTED]
>>> >wrote:
>>>
>>>
>>> > write a model that converts to and from.
>>> >
>>> > -igor
>>> >
>>> > On Mon, Nov 24, 2008 at 12:30 PM, Eduardo Simioni
>>> > <[EMAIL PROTECTED]> wrote:
>>> > > Hi all,
>>> > >
>>> > > I'm trying to use the DateTimeField from the wicket

Re: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Igor Vaynberg
i cannot put this into my ide and run it to confirm the error you are getting.

-igor

On Thu, Nov 27, 2008 at 11:22 AM, Valentine2008
<[EMAIL PROTECTED]> wrote:
>
> The getInputForm() will return an instance of Form class in Wicket.
> After creating the form,
> ---
> // 3. create, setup, and add the input form
>inputForm = new Form("inputForm");
>inputForm.setOutputMarkupId(true);
>add(inputForm);
> --
>
> I added the following to the form:
> 1. a FeedbackPanel component;
> 2. a AjaxSubmitLink component;
> 3. a AjaxLink component;
> 4. A Button component;
> 5. Several Label components, some are invisible (Which are in a
> WebMarkupContainer to control its visibility);
> 6. Several TextField components;
> 7. Several DropDownList components, some are invisible (Which are in a
> WebMarkupContainer to control its visibility);
> 8. Several ListMultipleChoice components, some are invisible (Which are in a
> WebMarkupContainer to control its visibility).
>
> Thanks.
>
>
> Valentine2008 wrote:
>>
>> Hi,
>>
>> I wrote the following code to print out all the children of the an input
>> form.
>> ---
>> Iterator iterator = getInputForm().iterator(new Comparator() {
>>
>> public int compare(Object o1, Object o2)
>> {
>> System.out.format(":%s, %s%n", o1, o2);
>>
>> Component component1 = (Component) o1;
>> Component component2 = (Component) o2;
>> return
>> component1.getId().compareTo(component2.getId());
>> }
>> });
>>
>> while(iterator.hasNext())
>> {
>> System.out.format("---Child of input form:
>> id=%s%n", ((Component)iterator.next()).getId());
>> }
>> -
>>
>> When running, the following error occurs:
>> ---
>> [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
>> org.ap
>> ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
>> [Lorg.apache.wick
>> et.Component;
>> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
>> [Lorg.apache
>> .wicket.Component;
>> at
>> org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
>> .
>>
>> The code on line 478 of MarkupContainer.java is:
>> sorted = Arrays.asList((Component[])children);
>>
>> Is it a bug of Wicket?
>>
>> Thanks,
>> Valentine
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.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]



Re: How to get all the children of a MarkupContainer?

2008-11-27 Thread Igor Vaynberg
iterator() does not check visibility.

-igor

On Thu, Nov 27, 2008 at 11:24 AM, Valentine2008
<[EMAIL PROTECTED]> wrote:
>
> Can we get even the invisible children?
>
> Seems we cannot:-(
>
> igor.vaynberg wrote:
>>
>> iterator()
>>
>> -igor
>>
>> On Thu, Nov 27, 2008 at 10:42 AM, Valentine2008
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Use iterator(Comparator)?
>>>
>>> Or other ways?
>>>
>>> Thanks,
>>> Valentine
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20723938.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/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20724471.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]



Re: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Igor Vaynberg
the problem is that the enum would have to live *inside* the
wicketstuffauth code. so wicketstuffauth would be the library that
would need to define the enum - and it doesnt know about your
application specific roles. at least this was the issue when it was
first being designed. i havent really looked at it since than.

-igor

On Thu, Nov 27, 2008 at 11:12 AM, Casper Bang <[EMAIL PROTECTED]> wrote:
> No but an application is designed for a given number of roles, what would
> you possibly accomplish by adding new roles without editing source code and
> account for the new behavior you are putting in?
>
> Seems to me the application would always need to be revised to work with
> these new roles (say modify web-pages annotations) no-matter if you do it
> with strings or enums. Anyway, perhaps I am being anal about it, but it
> doesn't strike me as fitting the Wicket philosophy I've picked up in other
> corners of the API. I was hoping for consensus that it would be beneficial
> to make it type-safe since it is part of a very visible and convenient API,
> but I'll try to write my own Enum version instead then.
>
> Thanks,
> Casper
>
>
>
> Igor Vaynberg wrote:
>>
>> because you cannot add custom enum values without editing source code.
>> there is a version implemented using classes in wicketstuff somewhere.
>>
>> -igor
>>
>> On Thu, Nov 27, 2008 at 10:33 AM, Casper Bang <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> What attracts me to Wicket is how it tries to do as much in type-safe
>>> Java
>>> code as possible, so I was a bit surprised with the finding that the
>>> org.apache.wicket.authorization stuff is not based upon Enum and EnumSet
>>> but
>>> rather type-unsafe string tokens.
>>>
>>> Are there good reasons for this design that outweighs the benefits of
>>> having
>>> code completion and static verification? (Extendability, decoupling,
>>> transitive relationships, runs on Java 1.4 etc.)
>>>
>>> Also, before I delve deeper into it, would it be a trivial matter to
>>> write a
>>> type safe version?
>>>
>>>
>>> Thanks in advance,
>>> Casper
>>>
>>> -
>>> 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]



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Valentine2008

The getInputForm() will return an instance of Form class in Wicket.
After creating the form, 
---
// 3. create, setup, and add the input form
inputForm = new Form("inputForm");
inputForm.setOutputMarkupId(true);
add(inputForm);
--

I added the following to the form:
1. a FeedbackPanel component;
2. a AjaxSubmitLink component;
3. a AjaxLink component;
4. A Button component;
5. Several Label components, some are invisible (Which are in a
WebMarkupContainer to control its visibility);
6. Several TextField components;
7. Several DropDownList components, some are invisible (Which are in a
WebMarkupContainer to control its visibility);
8. Several ListMultipleChoice components, some are invisible (Which are in a
WebMarkupContainer to control its visibility).

Thanks.


Valentine2008 wrote:
> 
> Hi,
> 
> I wrote the following code to print out all the children of the an input
> form.
> ---
> Iterator iterator = getInputForm().iterator(new Comparator() {
> 
> public int compare(Object o1, Object o2)
> {
> System.out.format(":%s, %s%n", o1, o2);
> 
> Component component1 = (Component) o1;
> Component component2 = (Component) o2;
> return 
> component1.getId().compareTo(component2.getId());
> }
> });
> 
> while(iterator.hasNext())
> {
> System.out.format("---Child of input form:
> id=%s%n", ((Component)iterator.next()).getId());
> }
> -
> 
> When running, the following error occurs:
> ---
> [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
> org.ap
> ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
> [Lorg.apache.wick
> et.Component;
> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
> [Lorg.apache
> .wicket.Component;
> at
> org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
> .
> 
> The code on line 478 of MarkupContainer.java is:
> sorted = Arrays.asList((Component[])children);
> 
> Is it a bug of Wicket?
> 
> Thanks,
> Valentine
> 

-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20724441.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: How to get all the children of a MarkupContainer?

2008-11-27 Thread Valentine2008

Can we get even the invisible children?

Seems we cannot:-(

igor.vaynberg wrote:
> 
> iterator()
> 
> -igor
> 
> On Thu, Nov 27, 2008 at 10:42 AM, Valentine2008
> <[EMAIL PROTECTED]> wrote:
>>
>> Use iterator(Comparator)?
>>
>> Or other ways?
>>
>> Thanks,
>> Valentine
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20723938.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/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20724471.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: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Casper Bang
No but an application is designed for a given number of roles, what 
would you possibly accomplish by adding new roles without editing source 
code and account for the new behavior you are putting in?


Seems to me the application would always need to be revised to work with 
these new roles (say modify web-pages annotations) no-matter if you do 
it with strings or enums. Anyway, perhaps I am being anal about it, but 
it doesn't strike me as fitting the Wicket philosophy I've picked up in 
other corners of the API. I was hoping for consensus that it would be 
beneficial to make it type-safe since it is part of a very visible and 
convenient API, but I'll try to write my own Enum version instead then.


Thanks,
Casper



Igor Vaynberg wrote:

because you cannot add custom enum values without editing source code.
there is a version implemented using classes in wicketstuff somewhere.

-igor

On Thu, Nov 27, 2008 at 10:33 AM, Casper Bang <[EMAIL PROTECTED]> wrote:
  

What attracts me to Wicket is how it tries to do as much in type-safe Java
code as possible, so I was a bit surprised with the finding that the
org.apache.wicket.authorization stuff is not based upon Enum and EnumSet but
rather type-unsafe string tokens.

Are there good reasons for this design that outweighs the benefits of having
code completion and static verification? (Extendability, decoupling,
transitive relationships, runs on Java 1.4 etc.)

Also, before I delve deeper into it, would it be a trivial matter to write a
type safe version?


Thanks in advance,
Casper

-
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]



Re: Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Igor Vaynberg
show us the full code please

-igor

On Thu, Nov 27, 2008 at 10:39 AM, Valentine2008
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I wrote the following code to print out all the children of the an input
> form.
> ---
> Iterator iterator = getInputForm().iterator(new Comparator() {
>
>public int compare(Object o1, Object o2)
>{
>System.out.format(":%s, %s%n", o1, o2);
>
>Component component1 = (Component) o1;
>Component component2 = (Component) o2;
>return
> component1.getId().compareTo(component2.getId());
>}
>});
>
>while(iterator.hasNext())
>{
>System.out.format("---Child of input form:
> id=%s%n", ((Component)iterator.next()).getId());
>}
> -
>
> When running, the following error occurs:
> ---
> [27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
> org.ap
> ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
> [Lorg.apache.wick
> et.Component;
> java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
> [Lorg.apache
> .wicket.Component;
>at
> org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
> .
>
> The code on line 478 of MarkupContainer.java is:
> sorted = Arrays.asList((Component[])children);
>
> Is it a bug of Wicket?
>
> Thanks,
> Valentine
> --
> View this message in context: 
> http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20723903.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]



RES: RES: How can I instance home page myself

2008-11-27 Thread Bruno Cesar Borges
By the way, you can implement an IPageFactory :-)

-Mensagem original-
De: Bruno Cesar Borges [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 27 de novembro de 2008 16:49
Para: users@wicket.apache.org
Assunto: RES: RES: How can I instance home page myself


You can always code your page in such way that makes it easy to be tested, like 
this:

public MyPage() {
   setFoo(getApplication().getFoo());
}

protected MyPage(IFoo foo) {
   setFoo(foo);
}

-Mensagem original-
De: Kamil Hark [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 27 de novembro de 2008 16:39
Para: users@wicket.apache.org
Assunto: Re: RES: How can I instance home page myself



Yes I know that I can do it through Application but then it is very dificult
to test. If I could inject args into constructur like below then it would be
much better

new MyPage(Foo foo){...}
-- 
View this message in context: 
http://www.nabble.com/How-can-I-instance-home-page-myself-tp20723688p20723898.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]

***
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***


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

***
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***


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



Re: How to get all the children of a MarkupContainer?

2008-11-27 Thread Igor Vaynberg
iterator()

-igor

On Thu, Nov 27, 2008 at 10:42 AM, Valentine2008
<[EMAIL PROTECTED]> wrote:
>
> Use iterator(Comparator)?
>
> Or other ways?
>
> Thanks,
> Valentine
> --
> View this message in context: 
> http://www.nabble.com/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20723938.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]



Re: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Igor Vaynberg
because you cannot add custom enum values without editing source code.
there is a version implemented using classes in wicketstuff somewhere.

-igor

On Thu, Nov 27, 2008 at 10:33 AM, Casper Bang <[EMAIL PROTECTED]> wrote:
> What attracts me to Wicket is how it tries to do as much in type-safe Java
> code as possible, so I was a bit surprised with the finding that the
> org.apache.wicket.authorization stuff is not based upon Enum and EnumSet but
> rather type-unsafe string tokens.
>
> Are there good reasons for this design that outweighs the benefits of having
> code completion and static verification? (Extendability, decoupling,
> transitive relationships, runs on Java 1.4 etc.)
>
> Also, before I delve deeper into it, would it be a trivial matter to write a
> type safe version?
>
>
> Thanks in advance,
> Casper
>
> -
> 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]



Re: Is there any other way? DataProviders must hit the Db twice for (possible) large datasets

2008-11-27 Thread Igor Vaynberg
On Thu, Nov 27, 2008 at 10:28 AM, Stefan Fußenegger
<[EMAIL PROTECTED]> wrote:
>
> Hi Igor,
>
> thanks for implementing this minimal version. i totally agree with your
> reasoning. Is there any chance though that this goes into 1.3 branch as
> well? I'd really appreciate that.

done

> you mentioned that you implemented such a repeater yourself. didn't you use
> any navigation or did you write that yourself? just wondering.

i implemented a simple prev/next pager which is all that was required
for that usecase.

> shall i open a ticket against 1.5 to track this issue/enhancement?

i added it to the wishlist wiki page. if you add a jira ticket please
add the number to the wiki page.

-igor

>
> best regards, stefan
>
>
>
> igor.vaynberg wrote:
>>
>> On Thu, Nov 27, 2008 at 12:46 AM, Stefan Fußenegger
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> I don't think IDataProvider is only about databases.
>>
>> you started off with your core assumption being wrong. idataprovider
>> was written exclusively for accessing databases. my thinking, at the
>> time, was that 99% of people use wicket to build applications that
>> access databases, and i dare say it was a good guess because in its ~3
>> years of existence only a handful of people had a problem with the way
>> it works.
>>
>>> There are other data
>>> sources and some return the total amount and the desired subset at the
>>> same
>>> time (Lucene as a famous example). Such data sources would really benefit
>>> of
>>> a single-query-approach.
>>
>> i am not disputing this fact. i am simply saying that we are not going
>> to fix this right now because this is not a bug. you are trying to use
>> the components for something they were not designed to be used. in 1.5
>> we may address this.
>>
>>> I faced this issue myself in a search (read Lucene)
>>> centered application. I successfully went down the road of implementing a
>>> custom repeater.
>>
>> i had to do the same myself.
>>
>>> But when the repeater was working as desired, I figured out
>>> that PagingNavigationLink is the real showstopper, not IDataProvider (see
>>> my
>>> JIRA comment [0]). The fix would be rather trivial, as
>>> PagingNavigationLink
>>> is doing something it needn't do (checking the requested page against the
>>> valid range of pages).
>>>
>>> Let me answer 2 possible questions in advance:
>>>
>>> Q: Why is this check in PagingNavigationLink a problem?
>>> A: Obviously, you can't fetch size and data as long as the page isn't
>>> known.
>>
>> the check is there because we code defensively. we do not assume that
>> every implementation of ipageable will cull the number when you call
>> setcurrentpage(x).
>>
>>> Q: How would a custom repeater that fetches data and size at the same
>>> tame
>>> handle invalid (out of range) pages?
>>> A: Out of range pages will return the size and an empty dataset. In this
>>> case, the repeater would change the page number to the last valid and do
>>> a
>>> second query. Yeah, two queries again. But this should only happen rarely
>>> though.
>>
>> this will change the existing behavior. if you are on page 5 and click
>> page 10 (which happens to not exist) you would end up back on 5 with
>> your suggestion where as currently you would properly end up on 9.
>>
>> looking at WICKET-1784, i extracted the code you want into an
>> overridable int cullPageNumber(int x). so feel free to subclass the
>> link and override that to return x without any extra checks.
>>
>> we may properly fix this in 1.5, but for right now this is too big a
>> refactor because it changes the basic assumptions with which the code
>> was written.
>>
>> -igor
>>
>>>
>>> Best regards, Stefan
>>>
>>> [0]
>>> https://issues.apache.org/jira/browse/WICKET-1784?focusedCommentId=12651278#action_12651278
>>>
>>>
>>> igor.vaynberg wrote:

 On Wed, Nov 26, 2008 at 9:32 AM, Wayne Pope
 <[EMAIL PROTECTED]> wrote:
>>so you think pushing all that extra data over the network is actually
>>more efficient then doing another query wtf.
> The point is I'd rather avoid 2 calls where 1 will do.
> AbstractPageableView
> will do fine I believe.

 the number of calls itself is meaningless, i dont comprehend why
 people have a hard time understanding this simple fact.

 if you have one call that takes 1000ms and ten calls that each take
 10ms you should concentrate on the one call that takes a long time
 rather then eliminating all ten 10ms calls which only saves you 100ms.
 if you can optimize the 1000ms and shave off 20% then your eleven
 calls are still faster then the one call.

 and since connection pools have been inventind many years ago there is
 no more overhead of establishing network connections, just pushing
 bits around. maybe that is still a problem in php, but in java it has
 been solved a long time ago.

 -igor


>
>>i can only assume that you have actually profiled your app and that
>

RES: RES: How can I instance home page myself

2008-11-27 Thread Bruno Cesar Borges
You can always code your page in such way that makes it easy to be tested, like 
this:

public MyPage() {
   setFoo(getApplication().getFoo());
}

protected MyPage(IFoo foo) {
   setFoo(foo);
}

-Mensagem original-
De: Kamil Hark [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 27 de novembro de 2008 16:39
Para: users@wicket.apache.org
Assunto: Re: RES: How can I instance home page myself



Yes I know that I can do it through Application but then it is very dificult
to test. If I could inject args into constructur like below then it would be
much better

new MyPage(Foo foo){...}
-- 
View this message in context: 
http://www.nabble.com/How-can-I-instance-home-page-myself-tp20723688p20723898.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]

***
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***


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



Re: Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Nino Saturnino Martinez Vazquez Wael
A really good question. I've heard that it's because that it is a demo 
of how you could implement it.


I share the exact same thoughts as you do about this.

Casper Bang wrote:
What attracts me to Wicket is how it tries to do as much in type-safe 
Java code as possible, so I was a bit surprised with the finding that 
the org.apache.wicket.authorization stuff is not based upon Enum and 
EnumSet but rather type-unsafe string tokens.


Are there good reasons for this design that outweighs the benefits of 
having code completion and static verification? (Extendability, 
decoupling, transitive relationships, runs on Java 1.4 etc.)


Also, before I delve deeper into it, would it be a trivial matter to 
write a type safe version?



Thanks in advance,
Casper

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



--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



How to get all the children of a MarkupContainer?

2008-11-27 Thread Valentine2008

Use iterator(Comparator)?

Or other ways?

Thanks,
Valentine
-- 
View this message in context: 
http://www.nabble.com/How-to-get-all-the-children-of-a-MarkupContainer--tp20723938p20723938.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]



Bug of Wicket when iterate the form using iterator()?

2008-11-27 Thread Valentine2008

Hi,

I wrote the following code to print out all the children of the an input
form.
---
Iterator iterator = getInputForm().iterator(new Comparator() {

public int compare(Object o1, Object o2)
{
System.out.format(":%s, %s%n", o1, o2);

Component component1 = (Component) o1;
Component component2 = (Component) o2;
return 
component1.getId().compareTo(component2.getId());
}
});

while(iterator.hasNext())
{
System.out.format("---Child of input form:
id=%s%n", ((Component)iterator.next()).getId());
}
-

When running, the following error occurs:
---
[27 Nov 2008 10:38:15,325] ERROR [http-8080-6] (RequestCycle.java:1432) -
org.ap
ache.wicket.RequestCycle [Ljava.lang.Object; cannot be cast to
[Lorg.apache.wick
et.Component;
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
[Lorg.apache
.wicket.Component;
at
org.apache.wicket.MarkupContainer.iterator(MarkupContainer.java:478)
.

The code on line 478 of MarkupContainer.java is:
sorted = Arrays.asList((Component[])children);

Is it a bug of Wicket?

Thanks,
Valentine
-- 
View this message in context: 
http://www.nabble.com/Bug-of-Wicket-when-iterate-the-form-using-iterator%28%29--tp20723903p20723903.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: RES: How can I instance home page myself

2008-11-27 Thread Kamil Hark

Yes I know that I can do it through Application but then it is very dificult
to test. If I could inject args into constructur like below then it would be
much better

new MyPage(Foo foo){...}
-- 
View this message in context: 
http://www.nabble.com/How-can-I-instance-home-page-myself-tp20723688p20723898.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]



Why does org.apache.wicket.authorization revolve around string tokens?

2008-11-27 Thread Casper Bang
What attracts me to Wicket is how it tries to do as much in type-safe 
Java code as possible, so I was a bit surprised with the finding that 
the org.apache.wicket.authorization stuff is not based upon Enum and 
EnumSet but rather type-unsafe string tokens.


Are there good reasons for this design that outweighs the benefits of 
having code completion and static verification? (Extendability, 
decoupling, transitive relationships, runs on Java 1.4 etc.)


Also, before I delve deeper into it, would it be a trivial matter to 
write a type safe version?



Thanks in advance,
Casper

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



Re: Is there any other way? DataProviders must hit the Db twice for (possible) large datasets

2008-11-27 Thread Stefan Fußenegger

Hi Igor,

thanks for implementing this minimal version. i totally agree with your
reasoning. Is there any chance though that this goes into 1.3 branch as
well? I'd really appreciate that.

you mentioned that you implemented such a repeater yourself. didn't you use
any navigation or did you write that yourself? just wondering.

shall i open a ticket against 1.5 to track this issue/enhancement?

best regards, stefan



igor.vaynberg wrote:
> 
> On Thu, Nov 27, 2008 at 12:46 AM, Stefan Fußenegger
> <[EMAIL PROTECTED]> wrote:
>>
>> I don't think IDataProvider is only about databases.
> 
> you started off with your core assumption being wrong. idataprovider
> was written exclusively for accessing databases. my thinking, at the
> time, was that 99% of people use wicket to build applications that
> access databases, and i dare say it was a good guess because in its ~3
> years of existence only a handful of people had a problem with the way
> it works.
> 
>> There are other data
>> sources and some return the total amount and the desired subset at the
>> same
>> time (Lucene as a famous example). Such data sources would really benefit
>> of
>> a single-query-approach.
> 
> i am not disputing this fact. i am simply saying that we are not going
> to fix this right now because this is not a bug. you are trying to use
> the components for something they were not designed to be used. in 1.5
> we may address this.
> 
>> I faced this issue myself in a search (read Lucene)
>> centered application. I successfully went down the road of implementing a
>> custom repeater.
> 
> i had to do the same myself.
> 
>> But when the repeater was working as desired, I figured out
>> that PagingNavigationLink is the real showstopper, not IDataProvider (see
>> my
>> JIRA comment [0]). The fix would be rather trivial, as
>> PagingNavigationLink
>> is doing something it needn't do (checking the requested page against the
>> valid range of pages).
>>
>> Let me answer 2 possible questions in advance:
>>
>> Q: Why is this check in PagingNavigationLink a problem?
>> A: Obviously, you can't fetch size and data as long as the page isn't
>> known.
> 
> the check is there because we code defensively. we do not assume that
> every implementation of ipageable will cull the number when you call
> setcurrentpage(x).
> 
>> Q: How would a custom repeater that fetches data and size at the same
>> tame
>> handle invalid (out of range) pages?
>> A: Out of range pages will return the size and an empty dataset. In this
>> case, the repeater would change the page number to the last valid and do
>> a
>> second query. Yeah, two queries again. But this should only happen rarely
>> though.
> 
> this will change the existing behavior. if you are on page 5 and click
> page 10 (which happens to not exist) you would end up back on 5 with
> your suggestion where as currently you would properly end up on 9.
> 
> looking at WICKET-1784, i extracted the code you want into an
> overridable int cullPageNumber(int x). so feel free to subclass the
> link and override that to return x without any extra checks.
> 
> we may properly fix this in 1.5, but for right now this is too big a
> refactor because it changes the basic assumptions with which the code
> was written.
> 
> -igor
> 
>>
>> Best regards, Stefan
>>
>> [0]
>> https://issues.apache.org/jira/browse/WICKET-1784?focusedCommentId=12651278#action_12651278
>>
>>
>> igor.vaynberg wrote:
>>>
>>> On Wed, Nov 26, 2008 at 9:32 AM, Wayne Pope
>>> <[EMAIL PROTECTED]> wrote:
>so you think pushing all that extra data over the network is actually
>more efficient then doing another query wtf.
 The point is I'd rather avoid 2 calls where 1 will do.
 AbstractPageableView
 will do fine I believe.
>>>
>>> the number of calls itself is meaningless, i dont comprehend why
>>> people have a hard time understanding this simple fact.
>>>
>>> if you have one call that takes 1000ms and ten calls that each take
>>> 10ms you should concentrate on the one call that takes a long time
>>> rather then eliminating all ten 10ms calls which only saves you 100ms.
>>> if you can optimize the 1000ms and shave off 20% then your eleven
>>> calls are still faster then the one call.
>>>
>>> and since connection pools have been inventind many years ago there is
>>> no more overhead of establishing network connections, just pushing
>>> bits around. maybe that is still a problem in php, but in java it has
>>> been solved a long time ago.
>>>
>>> -igor
>>>
>>>

>i can only assume that you have actually profiled your app and that
>one select count() call was what was taking a significant chunk of
>processing time in the database server? to the point where eliminating
>it will actually reduce enough load on the database to increase your
>throughput?

 No I haven't, as mentioned before, I just want to avoid 2 calls when
 one
 will do.  I have however seen several times in production systems
 waitin

RES: How can I instance home page myself

2008-11-27 Thread Bruno Cesar Borges
What kind of dependencies you want to pass on?

If you want URL parameters, just put a PageParameters argument to the Page's 
constructor. Wicket will inject that automatically.

If you want to inject objects from the Application instance, you can just get 
those from Page's constructor itself.

public MyPage() {
  Foo foo = getApplication().getFoo();
}

Cheers,
Bruno

-Mensagem original-
De: Kamil Hark [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 27 de novembro de 2008 16:22
Para: users@wicket.apache.org
Assunto: How can I instance home page myself



an Application class (and WebApplication) has method Class getHomePage()

 Why this method returns class instead of Page object?
 Now I'm limited to use non-argument constructor, I connot pass any
dependiences and so on. 

Are there any posibilities to instance and return Page object?
 
 
regards
 
Kamil
-- 
View this message in context: 
http://www.nabble.com/How-can-I-instance-home-page-myself-tp20723688p20723688.html
Sent from the Wicket - User mailing list archive at Nabble.com.
***
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***


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



How can I instance home page myself

2008-11-27 Thread Kamil Hark

an Application class (and WebApplication) has method Class getHomePage()

 Why this method returns class instead of Page object?
 Now I'm limited to use non-argument constructor, I connot pass any
dependiences and so on. 

Are there any posibilities to instance and return Page object?
 
 
regards
 
Kamil
-- 
View this message in context: 
http://www.nabble.com/How-can-I-instance-home-page-myself-tp20723688p20723688.html
Sent from the Wicket - User mailing list archive at Nabble.com.


Re: Is there any other way? DataProviders must hit the Db twice for (possible) large datasets

2008-11-27 Thread Igor Vaynberg
On Thu, Nov 27, 2008 at 12:46 AM, Stefan Fußenegger
<[EMAIL PROTECTED]> wrote:
>
> I don't think IDataProvider is only about databases.

you started off with your core assumption being wrong. idataprovider
was written exclusively for accessing databases. my thinking, at the
time, was that 99% of people use wicket to build applications that
access databases, and i dare say it was a good guess because in its ~3
years of existence only a handful of people had a problem with the way
it works.

> There are other data
> sources and some return the total amount and the desired subset at the same
> time (Lucene as a famous example). Such data sources would really benefit of
> a single-query-approach.

i am not disputing this fact. i am simply saying that we are not going
to fix this right now because this is not a bug. you are trying to use
the components for something they were not designed to be used. in 1.5
we may address this.

> I faced this issue myself in a search (read Lucene)
> centered application. I successfully went down the road of implementing a
> custom repeater.

i had to do the same myself.

> But when the repeater was working as desired, I figured out
> that PagingNavigationLink is the real showstopper, not IDataProvider (see my
> JIRA comment [0]). The fix would be rather trivial, as PagingNavigationLink
> is doing something it needn't do (checking the requested page against the
> valid range of pages).
>
> Let me answer 2 possible questions in advance:
>
> Q: Why is this check in PagingNavigationLink a problem?
> A: Obviously, you can't fetch size and data as long as the page isn't known.

the check is there because we code defensively. we do not assume that
every implementation of ipageable will cull the number when you call
setcurrentpage(x).

> Q: How would a custom repeater that fetches data and size at the same tame
> handle invalid (out of range) pages?
> A: Out of range pages will return the size and an empty dataset. In this
> case, the repeater would change the page number to the last valid and do a
> second query. Yeah, two queries again. But this should only happen rarely
> though.

this will change the existing behavior. if you are on page 5 and click
page 10 (which happens to not exist) you would end up back on 5 with
your suggestion where as currently you would properly end up on 9.

looking at WICKET-1784, i extracted the code you want into an
overridable int cullPageNumber(int x). so feel free to subclass the
link and override that to return x without any extra checks.

we may properly fix this in 1.5, but for right now this is too big a
refactor because it changes the basic assumptions with which the code
was written.

-igor

>
> Best regards, Stefan
>
> [0]
> https://issues.apache.org/jira/browse/WICKET-1784?focusedCommentId=12651278#action_12651278
>
>
> igor.vaynberg wrote:
>>
>> On Wed, Nov 26, 2008 at 9:32 AM, Wayne Pope
>> <[EMAIL PROTECTED]> wrote:
so you think pushing all that extra data over the network is actually
more efficient then doing another query wtf.
>>> The point is I'd rather avoid 2 calls where 1 will do.
>>> AbstractPageableView
>>> will do fine I believe.
>>
>> the number of calls itself is meaningless, i dont comprehend why
>> people have a hard time understanding this simple fact.
>>
>> if you have one call that takes 1000ms and ten calls that each take
>> 10ms you should concentrate on the one call that takes a long time
>> rather then eliminating all ten 10ms calls which only saves you 100ms.
>> if you can optimize the 1000ms and shave off 20% then your eleven
>> calls are still faster then the one call.
>>
>> and since connection pools have been inventind many years ago there is
>> no more overhead of establishing network connections, just pushing
>> bits around. maybe that is still a problem in php, but in java it has
>> been solved a long time ago.
>>
>> -igor
>>
>>
>>>
i can only assume that you have actually profiled your app and that
one select count() call was what was taking a significant chunk of
processing time in the database server? to the point where eliminating
it will actually reduce enough load on the database to increase your
throughput?
>>>
>>> No I haven't, as mentioned before, I just want to avoid 2 calls when one
>>> will do.  I have however seen several times in production systems waiting
>>> on
>>> i/o's reduces your scalability. I'd rather keep server count down as
>>> money
>>> is tight.
>>> I'll be mindfull not to ask 'stupid' questions again.
>>>
>>>
>>>
>>> On Wed, Nov 26, 2008 at 6:19 PM, Igor Vaynberg
>>> <[EMAIL PROTECTED]>wrote:
>>>
 On Wed, Nov 26, 2008 at 9:06 AM, Wayne Pope
 <[EMAIL PROTECTED]> wrote:
 > Hi Igor,
 >
 >>what? why would you ever load the whole dataset?
 > just to avoid 2 calls on smallish datasets, especially when there are
 > multiple joins and database isnt on the same box.

 so you think pushing all that extra data over the network 

RES: Set format date "inline"

2008-11-27 Thread Bruno Cesar Borges
@Override
public IConverter getConverter(Class type)
{
return MyConverter();
}

-Mensagem original-
De: kan [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 27 de novembro de 2008 14:57
Para: users@wicket.apache.org
Assunto: Set format date "inline"


I have a MyPojo with property java.util.Date someDate
I use CompoundPropertyModel
Now I add components on my page, like add(new Label("someDate")) and
it automagically uses IConvertor to convert from Date to string.
But in some places of web-site I need print only "27/11/2008", in some
places better will be "2 days ago", in some places "27/11/2008
16:53:34 UTC" and so on.
What is an elegant way to specify a format in particular piece of code?

-- 
WBR, kan.

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

***
"Atenção: Esta mensagem foi enviada para uso exclusivo do(s) destinatários(s) 
acima identificado(s),
podendo conter informações e/ou documentos confidencias/privilegiados e seu 
sigilo é protegido por 
lei. Caso você tenha recebido por engano, por favor, informe o remetente e 
apague-a de seu sistema.
Notificamos que é proibido por lei a sua retenção, disseminação, distribuição, 
cópia ou uso sem 
expressa autorização do remetente. Opiniões pessoais do remetente não refletem, 
necessariamente, 
o ponto de vista da CETIP, o qual é divulgado somente por pessoas autorizadas."


"Warning: This message was sent for exclusive use of the addressees above 
identified, possibly 
containing information and or privileged/confidential documents whose content 
is protected by law. 
In case you have mistakenly received it, please notify the sender and delete it 
from your system. 
Be noticed that the law forbids the retention, dissemination, distribution, 
copy or use without 
express authorization from the sender. Personal opinions of the sender do not 
necessarily reflect 
CETIP's point of view, which is only divulged by authorized personnel."
***


Set format date "inline"

2008-11-27 Thread kan
I have a MyPojo with property java.util.Date someDate
I use CompoundPropertyModel
Now I add components on my page, like add(new Label("someDate")) and
it automagically uses IConvertor to convert from Date to string.
But in some places of web-site I need print only "27/11/2008", in some
places better will be "2 days ago", in some places "27/11/2008
16:53:34 UTC" and so on.
What is an elegant way to specify a format in particular piece of code?

-- 
WBR, kan.

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



Re: Wicket-Spring Injection

2008-11-27 Thread Igor Vaynberg
On Thu, Nov 27, 2008 at 4:44 AM, Arie Fishler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have some injection related issues in my wicket application.
>
> 1. My session hold a bean (managed by the spring container) that is passed
> to it on construction of the session. It is not a Serializable object (some
> of the interfaces that this object is using are spring interfaces and not
> serializable by themselves) and in any case I would not like this object to
> be serialized by wicket.
>
> This object is not injected directly to the session since it depends on some
> parameters provided in the http request.
>
> Will it be ok to plug into the session's deserializing method and get this
> object not to be null?

session cannot keep anything that is not serializable - that is the
http spec. what you should do is stick the object into some
application-bound map and store the key in session (clustering wont
work).
>
> 2. My authentication uses a proprietary User  class that uses AOP with the
> @Configurable annotation. After invalidating the session (user loggs out)
> any other user trying to login seems to run into problems that are caused
> from the fact that it seems AOP is not working anymore on this class and the
> objects supposed to be injected into it are not injected anymore. When I
> restart my wicket application (on tomcat) after clearing the tomcat saved
> caches...all seems to be okuntil the next time. What might cause spring
> to stop injecting the objects using AOP?

wicket is not involved with @configurable, you should ask on spring forums

-igor

>
> Thanks,
> Arie
>

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



Re: Hand on session code

2008-11-27 Thread Eyal Golan
I actually did find it afterward :)
the ctrl+o in my eclipse confused me. :/

And I understood that it's the same

Thanks anyway...
I
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, Nov 27, 2008 at 6:16 PM, Michael Sparer <[EMAIL PROTECTED]>wrote:

>
> Nicer? Well it's quite the same with the difference that I overrode the
> cycle
> processor and Dipu just the cycle ... I suspect you didn't find the right
> method to override ;-)
>
> regards,
> Michael
>
>
> egolan74 wrote:
> >
> > Thanks Dipu and Michael,
> >
> > Michael, you understood correctly.
> > I used Dipu's solution as it looks nicer (no offend Michael :) )
> > However, I added a check for development / deployment.
> > And this is my (almost) final method.
> > /**
> >  * @see
> > org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
> >  *  org.apache.wicket.Response)
> >  */
> > @Override
> > public RequestCycle newRequestCycle(final Request request,
> > final Response response) {
> > return new WebRequestCycle(this, (WebRequest) request,
> > (WebResponse) response) {
> >
> > @Override
> > public Page onRuntimeException(Page page, RuntimeException e)
> > {
> > if (DEPLOYMENT.equalsIgnoreCase(getConfigurationType()))
> {
> > if
> > (PageExpiredException.class.isAssignableFrom(e.getClass())) {
> > return null;
> > }
> > return new InternalErrorPage();
> > } else {
> > // In development we want to see the exception
> > return null;
> > }
> >
> > }
> > };
> > }
> >
> > All I need now is to work on the InternalErrorPage to get parameters and
> > add
> > the information.
> >
> > I have noticed one thing.
> > Overriding this method caused the
> > getExceptionSettings().setUnexpectedExceptionDisplay to be overridden.
> >
> > Thanks again, that was very much helpful.
> >
> >
> > Eyal Golan
> > [EMAIL PROTECTED]
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> > necessary
> >
> >
> > On Thu, Nov 27, 2008 at 4:27 PM, Michael Sparer
> > <[EMAIL PROTECTED]>wrote:
> >
> >>
> >> What do you mean by saying you "didn't see onRuntimeException" in
> >> WebRequestCycleProcessor? If you didn't find it there it's because it's
> a
> >> method of its base class ;-)
> >>
> >> What I didn't mention when providing the code was that it's actually
> >> returning a Page (our internal server error page) and gets the Exception
> >> that caused the pain in the constructor. I might be misunderstanding
> you,
> >> but wasn't that the thing you wanted? Displaying different stuff in your
> >> error page based on what Exception was thrown?
> >>
> >> regards,
> >> Michael
> >>
> >>
> >> egolan74 wrote:
> >> >
> >> > Thanks,
> >> >
> >> > but looking at WebRequestCycleProcessor I didn't see
> onRuntimeException
> >> > method.
> >> > We use 1.3.4 version
> >> >
> >> > Looking at AbstractRequestCycleProcessor:respond, I see the call:
> >> > if (responseClass != internalErrorPageClass &&
> >> > settings.getUnexpectedExceptionDisplay() ==
> >> > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
> >> > {
> >> > throw new
> >> > RestartResponseException(internalErrorPageClass);
> >> > }
> >> >
> >> > And I also see that RestartResponseException has a constructor with
> >> > PageParameters.
> >> >
> >> > Is there a nice way to call the constructor with the parameters in
> >> respond
> >> > ?
> >> > Without overriding all this method?
> >> >
> >> > Thanks
> >> >
> >> > Eyal Golan
> >> > [EMAIL PROTECTED]
> >> >
> >> > Visit: http://jvdrums.sourceforge.net/
> >> > LinkedIn: http://www.linkedin.com/in/egolan74
> >> >
> >> > P  Save a tree. Please don't print this e-mail unless it's really
> >> > necessary
> >> >
> >> >
> >> > On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer
> >> > <[EMAIL PROTECTED]>wrote:
> >> >
> >> >>
> >> >> the first possibility that comes to my mind is overriding the
> >> following
> >> >> method in your application:
> >> >>
> >> >>@Override
> >> >>protected IRequestCycleProcessor newRequestCycleProcessor() {
> >> >>return new WebRequestCycleProcessor() {
> >> >>
> >> >>@Override
> >> >>protected Page onRuntimeException(final Page
> >> page,
> >> >> final RuntimeException
> >> >> e) {
> >> >>// do the default handling on
> >> >> pageexpiredexceptions
> >> >>if (e instanceof PageExpiredException
> >> |

Re: Hand on session code

2008-11-27 Thread Michael Sparer

Nicer? Well it's quite the same with the difference that I overrode the cycle
processor and Dipu just the cycle ... I suspect you didn't find the right
method to override ;-)

regards,
Michael


egolan74 wrote:
> 
> Thanks Dipu and Michael,
> 
> Michael, you understood correctly.
> I used Dipu's solution as it looks nicer (no offend Michael :) )
> However, I added a check for development / deployment.
> And this is my (almost) final method.
> /**
>  * @see
> org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
>  *  org.apache.wicket.Response)
>  */
> @Override
> public RequestCycle newRequestCycle(final Request request,
> final Response response) {
> return new WebRequestCycle(this, (WebRequest) request,
> (WebResponse) response) {
> 
> @Override
> public Page onRuntimeException(Page page, RuntimeException e)
> {
> if (DEPLOYMENT.equalsIgnoreCase(getConfigurationType())) {
> if
> (PageExpiredException.class.isAssignableFrom(e.getClass())) {
> return null;
> }
> return new InternalErrorPage();
> } else {
> // In development we want to see the exception
> return null;
> }
> 
> }
> };
> }
> 
> All I need now is to work on the InternalErrorPage to get parameters and
> add
> the information.
> 
> I have noticed one thing.
> Overriding this method caused the
> getExceptionSettings().setUnexpectedExceptionDisplay to be overridden.
> 
> Thanks again, that was very much helpful.
> 
> 
> Eyal Golan
> [EMAIL PROTECTED]
> 
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
> 
> P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> 
> 
> On Thu, Nov 27, 2008 at 4:27 PM, Michael Sparer
> <[EMAIL PROTECTED]>wrote:
> 
>>
>> What do you mean by saying you "didn't see onRuntimeException" in
>> WebRequestCycleProcessor? If you didn't find it there it's because it's a
>> method of its base class ;-)
>>
>> What I didn't mention when providing the code was that it's actually
>> returning a Page (our internal server error page) and gets the Exception
>> that caused the pain in the constructor. I might be misunderstanding you,
>> but wasn't that the thing you wanted? Displaying different stuff in your
>> error page based on what Exception was thrown?
>>
>> regards,
>> Michael
>>
>>
>> egolan74 wrote:
>> >
>> > Thanks,
>> >
>> > but looking at WebRequestCycleProcessor I didn't see onRuntimeException
>> > method.
>> > We use 1.3.4 version
>> >
>> > Looking at AbstractRequestCycleProcessor:respond, I see the call:
>> > if (responseClass != internalErrorPageClass &&
>> > settings.getUnexpectedExceptionDisplay() ==
>> > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
>> > {
>> > throw new
>> > RestartResponseException(internalErrorPageClass);
>> > }
>> >
>> > And I also see that RestartResponseException has a constructor with
>> > PageParameters.
>> >
>> > Is there a nice way to call the constructor with the parameters in
>> respond
>> > ?
>> > Without overriding all this method?
>> >
>> > Thanks
>> >
>> > Eyal Golan
>> > [EMAIL PROTECTED]
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P  Save a tree. Please don't print this e-mail unless it's really
>> > necessary
>> >
>> >
>> > On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer
>> > <[EMAIL PROTECTED]>wrote:
>> >
>> >>
>> >> the first possibility that comes to my mind is overriding the
>> following
>> >> method in your application:
>> >>
>> >>@Override
>> >>protected IRequestCycleProcessor newRequestCycleProcessor() {
>> >>return new WebRequestCycleProcessor() {
>> >>
>> >>@Override
>> >>protected Page onRuntimeException(final Page
>> page,
>> >> final RuntimeException
>> >> e) {
>> >>// do the default handling on
>> >> pageexpiredexceptions
>> >>if (e instanceof PageExpiredException
>> ||
>> e
>> >> instanceof
>> >> AuthorizationException) {
>> >>return null;
>> >>}
>> >>return new InternalServerError(page,
>> e);
>> >> //
>> >>  e.getCause for your NPE
>> >>}
>> >>
>> >>};
>> >> }
>> >>
>> >> egolan74 wrote:
>> >> >
>> >> > Hi,
>> >> > In deployment, we set our own internal error page:
>> >> >
>> getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
>> >> > and
>> >> > getExceptionSettings().setUnexpectedExceptionDisplay(
>> >> > IExceptionSettings.SHOW_INTERNAL_ERROR

Re: getting ip address from URIRequestTargetUrlCodingStrategy

2008-11-27 Thread Michael O'Cleirigh

Hi Stefan,

You can get the IP address that sent the request like this:

WebRequest wr = (WebRequest) RequestCycle.get().getRequest();

String originatingIPAddress  = wr.getHttpServletRequest().getRemoteHost();

You can probably place it directly in the decode(...) method of your url 
coding strategy.


Regards,

Mike


in my webapp i want to serve files from the filesystem to the user. so i coded 
something like this:

mount(new URIRequestTargetUrlCodingStrategy("/files") {
@Override
public IRequestTarget decode(RequestParameters requestParameters) {
  
final String fileId = getURI(requestParameters);


... read some info from database and build a fileInfo object ...

/* Get file for this instance */
return new ResourceStreamRequestTarget(new 
AnonFileResourceStream(fileInfo));
}
});

(AnonFileResourceStream extends AbstractResourceStream)

all requests to "/files" use the remaining part of the request to ask the database where the real file is located and stream it to the client. 
the problem is that i need to know from which ip address the request was made. i need the WebRequest object for this request to get some http headers. 
is this possible or is there another way to get hold of this information?



thanx alot
stefan

-
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]



Re: Hand on session code

2008-11-27 Thread Eyal Golan
Thanks Dipu and Michael,

Michael, you understood correctly.
I used Dipu's solution as it looks nicer (no offend Michael :) )
However, I added a check for development / deployment.
And this is my (almost) final method.
/**
 * @see
org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
 *  org.apache.wicket.Response)
 */
@Override
public RequestCycle newRequestCycle(final Request request,
final Response response) {
return new WebRequestCycle(this, (WebRequest) request,
(WebResponse) response) {

@Override
public Page onRuntimeException(Page page, RuntimeException e) {
if (DEPLOYMENT.equalsIgnoreCase(getConfigurationType())) {
if
(PageExpiredException.class.isAssignableFrom(e.getClass())) {
return null;
}
return new InternalErrorPage();
} else {
// In development we want to see the exception
return null;
}

}
};
}

All I need now is to work on the InternalErrorPage to get parameters and add
the information.

I have noticed one thing.
Overriding this method caused the
getExceptionSettings().setUnexpectedExceptionDisplay to be overridden.

Thanks again, that was very much helpful.


Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, Nov 27, 2008 at 4:27 PM, Michael Sparer <[EMAIL PROTECTED]>wrote:

>
> What do you mean by saying you "didn't see onRuntimeException" in
> WebRequestCycleProcessor? If you didn't find it there it's because it's a
> method of its base class ;-)
>
> What I didn't mention when providing the code was that it's actually
> returning a Page (our internal server error page) and gets the Exception
> that caused the pain in the constructor. I might be misunderstanding you,
> but wasn't that the thing you wanted? Displaying different stuff in your
> error page based on what Exception was thrown?
>
> regards,
> Michael
>
>
> egolan74 wrote:
> >
> > Thanks,
> >
> > but looking at WebRequestCycleProcessor I didn't see onRuntimeException
> > method.
> > We use 1.3.4 version
> >
> > Looking at AbstractRequestCycleProcessor:respond, I see the call:
> > if (responseClass != internalErrorPageClass &&
> > settings.getUnexpectedExceptionDisplay() ==
> > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
> > {
> > throw new
> > RestartResponseException(internalErrorPageClass);
> > }
> >
> > And I also see that RestartResponseException has a constructor with
> > PageParameters.
> >
> > Is there a nice way to call the constructor with the parameters in
> respond
> > ?
> > Without overriding all this method?
> >
> > Thanks
> >
> > Eyal Golan
> > [EMAIL PROTECTED]
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> > necessary
> >
> >
> > On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer
> > <[EMAIL PROTECTED]>wrote:
> >
> >>
> >> the first possibility that comes to my mind is overriding the following
> >> method in your application:
> >>
> >>@Override
> >>protected IRequestCycleProcessor newRequestCycleProcessor() {
> >>return new WebRequestCycleProcessor() {
> >>
> >>@Override
> >>protected Page onRuntimeException(final Page
> page,
> >> final RuntimeException
> >> e) {
> >>// do the default handling on
> >> pageexpiredexceptions
> >>if (e instanceof PageExpiredException ||
> e
> >> instanceof
> >> AuthorizationException) {
> >>return null;
> >>}
> >>return new InternalServerError(page, e);
> >> //
> >>  e.getCause for your NPE
> >>}
> >>
> >>};
> >> }
> >>
> >> egolan74 wrote:
> >> >
> >> > Hi,
> >> > In deployment, we set our own internal error page:
> >> >
> getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
> >> > and
> >> > getExceptionSettings().setUnexpectedExceptionDisplay(
> >> > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
> >> >
> >> > Is there a quick way to get the type of the exception and show a
> >> different
> >> > message in our internal error page accordingly?
> >> > For example: if we get NullPointerException, show a message: "You
> >> > developer
> >> > coded null !!! .
> >> > And ArrayIndexOutOfBoundException will show: "oops.. the array is too
> >> > small"
> >> > .
> >> >
> >> > Thanks
> >> >
> >> > Eyal Golan
> >> > [EMAIL PROT

TinyMCE in an Ajax loaded panel

2008-11-27 Thread Martijn Lindhout
Hi all,

I searched nabble, but couldn't find any recent posts that brought me a
solution to this problem:

I have a page with two panels, a master/detail setup. The master has a list
of items, the detail a TinyMCE editor. The details panel is invisible until
the user clicks an item in the master list. The list disappears and the
detail panel is shown, all using Ajax. The problem is that the TinyMCE
editor doesn't appear, it's just a normal textarea.

Has anyone a solution to this problem?

Thanks


getting ip address from URIRequestTargetUrlCodingStrategy

2008-11-27 Thread Stefan Becker
hi,

in my webapp i want to serve files from the filesystem to the user. so i coded 
something like this:

mount(new URIRequestTargetUrlCodingStrategy("/files") {
@Override
public IRequestTarget decode(RequestParameters requestParameters) {
final String fileId = getURI(requestParameters);

... read some info from database and build a fileInfo object ...

/* Get file for this instance */
return new ResourceStreamRequestTarget(new 
AnonFileResourceStream(fileInfo));
}
});

(AnonFileResourceStream extends AbstractResourceStream)

all requests to "/files" use the remaining part of the request to ask the 
database where the real file is located and stream it to the client. 
the problem is that i need to know from which ip address the request was made. 
i need the WebRequest object for this request to get some http headers. 
is this possible or is there another way to get hold of this information?


thanx alot
stefan

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



Re: Label & Link item within a same table cell

2008-11-27 Thread James Carman
I typically use Fragments for these kinds of situations, unless of course,
the same type of component will need to be used elsewhere.  Then, I use a
custom Panel class.

On Thu, Nov 27, 2008 at 8:01 AM, Nicolas Castin <[EMAIL PROTECTED]>wrote:

> Hello,
>
> I had approxymatly the same think to do (with image in place of link /
> label).
> I created a custom panel handling the content of the cell, which allows
> more
> that one element into it.
>
> Regards
>
> On Thu, Nov 27, 2008 at 1:50 PM, simonm <[EMAIL PROTECTED]> wrote:
>
> >
> > I am drawing a table using DataView and implement the populateItem method
> > to
> > add every table row item.
> > One of my table cell should display a simple text OR a link OR both (e.g.
> > the cell will have a text, and a link beneath – both in the same cell)
> > My HTML snippet:
> > ….
> >  …
> >   [Here should come Text &
> > Link]
> >  …
> > 
> > My question is how can I insert those two items into one cell? AFAIK, I
> can
> > add only one wicket:id to a table column and therefore only one Component
> > is
> > attached to it (in the Java code). I have tried to split the cell to two
> > rows (rowspan="2") such that the above part will have the text and the
> > bottom part will have the link, but then I get into undesired UI problems
> > (the border is shown though it is not desirable and the partition of the
> > cell is always fixed – 50-50 for rowspan=2 etc...)
> > Lots of WEB search yields no result (I read Wicket in Action at a whole!)
> -
> > still can't figure out how to do that!
> >
> > Any idea how can I combine those two items into one table cell ?
> > !Thanks!
> >
> > --
> > View this message in context:
> >
> http://www.nabble.com/Label---Link-item-within-a-same-table-cell-tp20718713p20718713.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]
> >
> >
>
>
> --
> Nicolas Castin
> Senior Software Developer
> EURid.eu
>


Re: Hand on session code

2008-11-27 Thread Michael Sparer

What do you mean by saying you "didn't see onRuntimeException" in
WebRequestCycleProcessor? If you didn't find it there it's because it's a
method of its base class ;-)

What I didn't mention when providing the code was that it's actually
returning a Page (our internal server error page) and gets the Exception
that caused the pain in the constructor. I might be misunderstanding you,
but wasn't that the thing you wanted? Displaying different stuff in your
error page based on what Exception was thrown?

regards,
Michael


egolan74 wrote:
> 
> Thanks,
> 
> but looking at WebRequestCycleProcessor I didn't see onRuntimeException
> method.
> We use 1.3.4 version
> 
> Looking at AbstractRequestCycleProcessor:respond, I see the call:
> if (responseClass != internalErrorPageClass &&
> settings.getUnexpectedExceptionDisplay() ==
> IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
> {
> throw new
> RestartResponseException(internalErrorPageClass);
> }
> 
> And I also see that RestartResponseException has a constructor with
> PageParameters.
> 
> Is there a nice way to call the constructor with the parameters in respond
> ?
> Without overriding all this method?
> 
> Thanks
> 
> Eyal Golan
> [EMAIL PROTECTED]
> 
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
> 
> P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> 
> 
> On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer
> <[EMAIL PROTECTED]>wrote:
> 
>>
>> the first possibility that comes to my mind is overriding the following
>> method in your application:
>>
>>@Override
>>protected IRequestCycleProcessor newRequestCycleProcessor() {
>>return new WebRequestCycleProcessor() {
>>
>>@Override
>>protected Page onRuntimeException(final Page page,
>> final RuntimeException
>> e) {
>>// do the default handling on
>> pageexpiredexceptions
>>if (e instanceof PageExpiredException || e
>> instanceof
>> AuthorizationException) {
>>return null;
>>}
>>return new InternalServerError(page, e);
>> //
>>  e.getCause for your NPE
>>}
>>
>>};
>> }
>>
>> egolan74 wrote:
>> >
>> > Hi,
>> > In deployment, we set our own internal error page:
>> > getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
>> > and
>> > getExceptionSettings().setUnexpectedExceptionDisplay(
>> > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
>> >
>> > Is there a quick way to get the type of the exception and show a
>> different
>> > message in our internal error page accordingly?
>> > For example: if we get NullPointerException, show a message: "You
>> > developer
>> > coded null !!! .
>> > And ArrayIndexOutOfBoundException will show: "oops.. the array is too
>> > small"
>> > .
>> >
>> > Thanks
>> >
>> > Eyal Golan
>> > [EMAIL PROTECTED]
>> >
>> > Visit: http://jvdrums.sourceforge.net/
>> > LinkedIn: http://www.linkedin.com/in/egolan74
>> >
>> > P  Save a tree. Please don't print this e-mail unless it's really
>> > necessary
>> >
>> >
>> > -
>> > Eyal Golan
>> > [EMAIL PROTECTED]
>> >
>> > Visit: JVDrums
>> > LinkedIn: LinkedIn
>> >
>>
>>
>> -
>> Michael Sparer
>> http://talk-on-tech.blogspot.com
>> --
>> View this message in context:
>> http://www.nabble.com/Hand-on-session-code-tp20719154p20719327.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]
>>
>>
> 
> 
> -
> Eyal Golan
> [EMAIL PROTECTED]
> 
> Visit: JVDrums 
> LinkedIn: LinkedIn 
> 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Hand-on-session-code-tp20719154p20720178.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: Hand on session code

2008-11-27 Thread Dipu
this is what I do
/**
 * @see
org.apache.wicket.Application#newRequestCycle(org.apache.wicket.Request,
 *  org.apache.wicket.Response)
 */
public RequestCycle newRequestCycle(final Request request, final Response
response)
{
return new WebRequestCycle(this, (WebRequest)request, (WebResponse)response)
{

@Override
public Page onRuntimeException(Page page, RuntimeException e)
{
if(PageExpiredException.class.isAssignableFrom(e.getClass()))
{
return null;
}
return new ErrorPage(e,page);
}
 };
 }

Cheers
Dipu

On Thu, Nov 27, 2008 at 2:18 PM, Eyal Golan <[EMAIL PROTECTED]> wrote:

> Thanks,
>
> but looking at WebRequestCycleProcessor I didn't see onRuntimeException
> method.
> We use 1.3.4 version
>
> Looking at AbstractRequestCycleProcessor:respond, I see the call:
>if (responseClass != internalErrorPageClass &&
>settings.getUnexpectedExceptionDisplay() ==
> IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
> {
>throw new RestartResponseException(internalErrorPageClass);
>}
>
> And I also see that RestartResponseException has a constructor with
> PageParameters.
>
> Is there a nice way to call the constructor with the parameters in respond
> ?
> Without overriding all this method?
>
> Thanks
>
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
>
> P  Save a tree. Please don't print this e-mail unless it's really necessary
>
>
> On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer <[EMAIL PROTECTED]
> >wrote:
>
> >
> > the first possibility that comes to my mind is overriding the following
> > method in your application:
> >
> >@Override
> >protected IRequestCycleProcessor newRequestCycleProcessor() {
> >return new WebRequestCycleProcessor() {
> >
> >@Override
> >protected Page onRuntimeException(final Page page,
> > final RuntimeException
> > e) {
> >// do the default handling on
> > pageexpiredexceptions
> >if (e instanceof PageExpiredException || e
> > instanceof
> > AuthorizationException) {
> >return null;
> >}
> >return new InternalServerError(page, e);
> //
> >  e.getCause for your NPE
> >}
> >
> >};
> > }
> >
> > egolan74 wrote:
> > >
> > > Hi,
> > > In deployment, we set our own internal error page:
> > > getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
> > > and
> > > getExceptionSettings().setUnexpectedExceptionDisplay(
> > > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
> > >
> > > Is there a quick way to get the type of the exception and show a
> > different
> > > message in our internal error page accordingly?
> > > For example: if we get NullPointerException, show a message: "You
> > > developer
> > > coded null !!! .
> > > And ArrayIndexOutOfBoundException will show: "oops.. the array is too
> > > small"
> > > .
> > >
> > > Thanks
> > >
> > > Eyal Golan
> > > [EMAIL PROTECTED]
> > >
> > > Visit: http://jvdrums.sourceforge.net/
> > > LinkedIn: http://www.linkedin.com/in/egolan74
> > >
> > > P  Save a tree. Please don't print this e-mail unless it's really
> > > necessary
> > >
> > >
> > > -
> > > Eyal Golan
> > > [EMAIL PROTECTED]
> > >
> > > Visit: JVDrums
> > > LinkedIn: LinkedIn
> > >
> >
> >
> > -
> > Michael Sparer
> > http://talk-on-tech.blogspot.com
> > --
> > View this message in context:
> > http://www.nabble.com/Hand-on-session-code-tp20719154p20719327.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: Hand on session code

2008-11-27 Thread Eyal Golan
Thanks,

but looking at WebRequestCycleProcessor I didn't see onRuntimeException
method.
We use 1.3.4 version

Looking at AbstractRequestCycleProcessor:respond, I see the call:
if (responseClass != internalErrorPageClass &&
settings.getUnexpectedExceptionDisplay() ==
IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE)
{
throw new RestartResponseException(internalErrorPageClass);
}

And I also see that RestartResponseException has a constructor with
PageParameters.

Is there a nice way to call the constructor with the parameters in respond ?
Without overriding all this method?

Thanks

Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


On Thu, Nov 27, 2008 at 3:31 PM, Michael Sparer <[EMAIL PROTECTED]>wrote:

>
> the first possibility that comes to my mind is overriding the following
> method in your application:
>
>@Override
>protected IRequestCycleProcessor newRequestCycleProcessor() {
>return new WebRequestCycleProcessor() {
>
>@Override
>protected Page onRuntimeException(final Page page,
> final RuntimeException
> e) {
>// do the default handling on
> pageexpiredexceptions
>if (e instanceof PageExpiredException || e
> instanceof
> AuthorizationException) {
>return null;
>}
>return new InternalServerError(page, e); //
>  e.getCause for your NPE
>}
>
>};
> }
>
> egolan74 wrote:
> >
> > Hi,
> > In deployment, we set our own internal error page:
> > getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
> > and
> > getExceptionSettings().setUnexpectedExceptionDisplay(
> > IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
> >
> > Is there a quick way to get the type of the exception and show a
> different
> > message in our internal error page accordingly?
> > For example: if we get NullPointerException, show a message: "You
> > developer
> > coded null !!! .
> > And ArrayIndexOutOfBoundException will show: "oops.. the array is too
> > small"
> > .
> >
> > Thanks
> >
> > Eyal Golan
> > [EMAIL PROTECTED]
> >
> > Visit: http://jvdrums.sourceforge.net/
> > LinkedIn: http://www.linkedin.com/in/egolan74
> >
> > P  Save a tree. Please don't print this e-mail unless it's really
> > necessary
> >
> >
> > -
> > Eyal Golan
> > [EMAIL PROTECTED]
> >
> > Visit: JVDrums
> > LinkedIn: LinkedIn
> >
>
>
> -
> Michael Sparer
> http://talk-on-tech.blogspot.com
> --
> View this message in context:
> http://www.nabble.com/Hand-on-session-code-tp20719154p20719327.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: Hand on session code

2008-11-27 Thread Michael Sparer

the first possibility that comes to my mind is overriding the following
method in your application:

@Override
protected IRequestCycleProcessor newRequestCycleProcessor() {
return new WebRequestCycleProcessor() {

@Override
protected Page onRuntimeException(final Page page, 
final RuntimeException
e) {
// do the default handling on 
pageexpiredexceptions
if (e instanceof PageExpiredException || e 
instanceof
AuthorizationException) {
return null;
}
return new InternalServerError(page, e); //  
e.getCause for your NPE
}

};
}

egolan74 wrote:
> 
> Hi,
> In deployment, we set our own internal error page:
> getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
> and
> getExceptionSettings().setUnexpectedExceptionDisplay(
> IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
> 
> Is there a quick way to get the type of the exception and show a different
> message in our internal error page accordingly?
> For example: if we get NullPointerException, show a message: "You
> developer
> coded null !!! .
> And ArrayIndexOutOfBoundException will show: "oops.. the array is too
> small"
> .
> 
> Thanks
> 
> Eyal Golan
> [EMAIL PROTECTED]
> 
> Visit: http://jvdrums.sourceforge.net/
> LinkedIn: http://www.linkedin.com/in/egolan74
> 
> P  Save a tree. Please don't print this e-mail unless it's really
> necessary
> 
> 
> -
> Eyal Golan
> [EMAIL PROTECTED]
> 
> Visit: JVDrums 
> LinkedIn: LinkedIn 
> 


-
Michael Sparer
http://talk-on-tech.blogspot.com
-- 
View this message in context: 
http://www.nabble.com/Hand-on-session-code-tp20719154p20719327.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]



Hand on session code

2008-11-27 Thread Eyal Golan
Hi,
In deployment, we set our own internal error page:
getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);
and
getExceptionSettings().setUnexpectedExceptionDisplay(
IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);

Is there a quick way to get the type of the exception and show a different
message in our internal error page accordingly?
For example: if we get NullPointerException, show a message: "You developer
coded null !!! .
And ArrayIndexOutOfBoundException will show: "oops.. the array is too small"
.

Thanks

Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary


Re: Label & Link item within a same table cell

2008-11-27 Thread Nicolas Castin
Hello,

I had approxymatly the same think to do (with image in place of link /
label).
I created a custom panel handling the content of the cell, which allows more
that one element into it.

Regards

On Thu, Nov 27, 2008 at 1:50 PM, simonm <[EMAIL PROTECTED]> wrote:

>
> I am drawing a table using DataView and implement the populateItem method
> to
> add every table row item.
> One of my table cell should display a simple text OR a link OR both (e.g.
> the cell will have a text, and a link beneath – both in the same cell)
> My HTML snippet:
> ….
>  …
>   [Here should come Text &
> Link]
>  …
> 
> My question is how can I insert those two items into one cell? AFAIK, I can
> add only one wicket:id to a table column and therefore only one Component
> is
> attached to it (in the Java code). I have tried to split the cell to two
> rows (rowspan="2") such that the above part will have the text and the
> bottom part will have the link, but then I get into undesired UI problems
> (the border is shown though it is not desirable and the partition of the
> cell is always fixed – 50-50 for rowspan=2 etc...)
> Lots of WEB search yields no result (I read Wicket in Action at a whole!) -
> still can't figure out how to do that!
>
> Any idea how can I combine those two items into one table cell ?
> !Thanks!
>
> --
> View this message in context:
> http://www.nabble.com/Label---Link-item-within-a-same-table-cell-tp20718713p20718713.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]
>
>


-- 
Nicolas Castin
Senior Software Developer
EURid.eu


Re: Label & Link item within a same table cell

2008-11-27 Thread Dipu
take a look at the LinkIconPanel.java to get an idea, either you can use it
or you can roll out a similar component that fits your requirement.

Cheers
Dipu

On Thu, Nov 27, 2008 at 12:50 PM, simonm <[EMAIL PROTECTED]> wrote:

>
> I am drawing a table using DataView and implement the populateItem method
> to
> add every table row item.
> One of my table cell should display a simple text OR a link OR both (e.g.
> the cell will have a text, and a link beneath – both in the same cell)
> My HTML snippet:
> ….
>  …
>   [Here should come Text &
> Link]
>  …
> 
> My question is how can I insert those two items into one cell? AFAIK, I can
> add only one wicket:id to a table column and therefore only one Component
> is
> attached to it (in the Java code). I have tried to split the cell to two
> rows (rowspan="2") such that the above part will have the text and the
> bottom part will have the link, but then I get into undesired UI problems
> (the border is shown though it is not desirable and the partition of the
> cell is always fixed – 50-50 for rowspan=2 etc...)
> Lots of WEB search yields no result (I read Wicket in Action at a whole!) -
> still can't figure out how to do that!
>
> Any idea how can I combine those two items into one table cell ?
> !Thanks!
>
> --
> View this message in context:
> http://www.nabble.com/Label---Link-item-within-a-same-table-cell-tp20718713p20718713.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]
>
>


Label & Link item within a same table cell

2008-11-27 Thread simonm

I am drawing a table using DataView and implement the populateItem method to
add every table row item.
One of my table cell should display a simple text OR a link OR both (e.g.
the cell will have a text, and a link beneath – both in the same cell)
My HTML snippet: 
….
  …
   [Here should come Text &
Link]
  …

My question is how can I insert those two items into one cell? AFAIK, I can
add only one wicket:id to a table column and therefore only one Component is
attached to it (in the Java code). I have tried to split the cell to two
rows (rowspan="2") such that the above part will have the text and the
bottom part will have the link, but then I get into undesired UI problems
(the border is shown though it is not desirable and the partition of the
cell is always fixed – 50-50 for rowspan=2 etc...)
Lots of WEB search yields no result (I read Wicket in Action at a whole!) -
still can't figure out how to do that!

Any idea how can I combine those two items into one table cell ?
!Thanks!

-- 
View this message in context: 
http://www.nabble.com/Label---Link-item-within-a-same-table-cell-tp20718713p20718713.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 Injection

2008-11-27 Thread Arie Fishler
Hi,

I have some injection related issues in my wicket application.

1. My session hold a bean (managed by the spring container) that is passed
to it on construction of the session. It is not a Serializable object (some
of the interfaces that this object is using are spring interfaces and not
serializable by themselves) and in any case I would not like this object to
be serialized by wicket.

This object is not injected directly to the session since it depends on some
parameters provided in the http request.

Will it be ok to plug into the session's deserializing method and get this
object not to be null?

2. My authentication uses a proprietary User  class that uses AOP with the
@Configurable annotation. After invalidating the session (user loggs out)
any other user trying to login seems to run into problems that are caused
from the fact that it seems AOP is not working anymore on this class and the
objects supposed to be injected into it are not injected anymore. When I
restart my wicket application (on tomcat) after clearing the tomcat saved
caches...all seems to be okuntil the next time. What might cause spring
to stop injecting the objects using AOP?

Thanks,
Arie


Re: nice URL for forms

2008-11-27 Thread kan
Just a thought. Does it have any sense to make something like
"BookmarkablePageForm" component?
So, the component would be designed to use with  and takes
Page.class (and maybe PageParameters which could be serialized as set
of ). It generates "action" attribute which points
to the page (probably mounted) and behaves like BookmarkablePageLink,
but data could be taken from form input.
Example:
[SomePage.html]

[SomePage.java]
add(new BookmarkablePageForm("search", SearchPage.class));
[SearchPage.java]
pubilc SearchPage(PageParameters params)
{
// use params.getAsString("q") as search criteria.
}

Could it be useful for anybody?

2008/11/18 Jeremy Thomerson <[EMAIL PROTECTED]>:
> See this answer from Johan maybe two days ago on the same question:
> http://www.nabble.com/Simple-GET-based-stateless-form-to20535056.html#a20536810
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
> On Tue, Nov 18, 2008 at 6:15 AM, Anatoly Kupriyanov <[EMAIL PROTECTED]>wrote:
>
>> I have a simple search form. with query text field "q" and "go"
>> button. I do the form method=get and stateless (as search form shd be
>> I guess).
>> The url becomes:
>>
>> http://127.0.0.1:8080/site/search/wicket:interface/:20:design:search::IFormSubmitListener::/?search7c_hf_0=&..%2F..%2F..%2F..%2Fclient%2Fsearch%2Fwicket%3Ainterface%2F%3A30%3Adesign%3Asearch%3A%3AIFormSubmitListener%3A%3A%2F=&q=word
>>
>> What can I do to make it more RESTful?
>>
>> PS: wicket v1.4-rc1
>>
>> --
>> WBR, kan.
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>



-- 
WBR, kan.

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



javascript conflicts

2008-11-27 Thread Daniele Dellafiore
Hi all.

I am using wicket-animator and I have discovered today a conflict with
the wicket default component update via ajax.

If a single component is added to the AjaxRequestTarget and I append a
custom javascript via AjaxRequestTarget.appendJavascript() that affect
the same component, i.e. calling a animator.js function, the animation
does not start but the component is refreshed via the wicket standard
mechanism.

The order is: first I call addComponent and after the appendJavascript.

What I would like is that the component get the update and then my
custom javascript runs.

Any advice?

-- 
Daniele Dellafiore
http://blog.ildella.net/

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



Re: Wicket and CoC

2008-11-27 Thread Nino Saturnino Martinez Vazquez Wael

COOL!!! :)

Jeremy Thomerson wrote:

You can do exactly what you asked in less than 40 lines of code - and not be
bound to the class name in the HTML (which you shouldn't do).  Here's how:

IN YOUR APPLICATION CLASS:

@Override
protected void init() {
super.init();
registerConventionalComponent("feedbackPanel", FeedbackPanel.class);
registerConventionalComponent("submitLink", SubmitLink.class);
registerConventionalComponent("submitButton", Button.class);
}
private void registerConventionalComponent(String id, Class clazz) {
getPageSettings().addComponentResolver(new
ConventionalComponentResolver(id, clazz));
}
private static final class ConventionalComponentResolver implements
IComponentResolver {
private static final long serialVersionUID = 1L;
private final String mID;
private final Class mComponentClass;

public ConventionalComponentResolver(String id, Class clazz) {
mID = id;
mComponentClass = clazz;
}
public boolean resolve(MarkupContainer container, MarkupStream
markupStream, ComponentTag tag) {
CharSequence wicketId = tag.getString("wicket:id");
if (mID.equals(wicketId)) {
container.autoAdd(createInstance(), markupStream);
// Yes, we handled the tag
return true;
}
// We were not able to handle the tag
return false;
}
private Component createInstance() {
try {
return
mComponentClass.getConstructor(String.class).newInstance(mID);
} catch (Exception ex) {
throw new WicketRuntimeException("Error creating component
instance of class: " + mComponentClass.getName(), ex);
}
}
}
NIFTY!!  I hadn't written any IComponentResolver's before - but wanted to
try it.  Wicket is AWESOME!!  It makes it so easy to customize the framework
to YOUR needs without imposing one person's ideas on another person.
  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


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



Re: Is there any other way? DataProviders must hit the Db twice for (possible) large datasets

2008-11-27 Thread Stefan Fußenegger

Hi Igor,

I don't think IDataProvider is only about databases. There are other data
sources and some return the total amount and the desired subset at the same
time (Lucene as a famous example). Such data sources would really benefit of
a single-query-approach. I faced this issue myself in a search (read Lucene)
centered application. I successfully went down the road of implementing a
custom repeater. But when the repeater was working as desired, I figured out
that PagingNavigationLink is the real showstopper, not IDataProvider (see my
JIRA comment [0]). The fix would be rather trivial, as PagingNavigationLink
is doing something it needn't do (checking the requested page against the
valid range of pages). 

Let me answer 2 possible questions in advance:

Q: Why is this check in PagingNavigationLink a problem?
A: Obviously, you can't fetch size and data as long as the page isn't known.

Q: How would a custom repeater that fetches data and size at the same tame
handle invalid (out of range) pages?
A: Out of range pages will return the size and an empty dataset. In this
case, the repeater would change the page number to the last valid and do a
second query. Yeah, two queries again. But this should only happen rarely
though.

Best regards, Stefan

[0]
https://issues.apache.org/jira/browse/WICKET-1784?focusedCommentId=12651278#action_12651278


igor.vaynberg wrote:
> 
> On Wed, Nov 26, 2008 at 9:32 AM, Wayne Pope
> <[EMAIL PROTECTED]> wrote:
>>>so you think pushing all that extra data over the network is actually
>>>more efficient then doing another query wtf.
>> The point is I'd rather avoid 2 calls where 1 will do.
>> AbstractPageableView
>> will do fine I believe.
> 
> the number of calls itself is meaningless, i dont comprehend why
> people have a hard time understanding this simple fact.
> 
> if you have one call that takes 1000ms and ten calls that each take
> 10ms you should concentrate on the one call that takes a long time
> rather then eliminating all ten 10ms calls which only saves you 100ms.
> if you can optimize the 1000ms and shave off 20% then your eleven
> calls are still faster then the one call.
> 
> and since connection pools have been inventind many years ago there is
> no more overhead of establishing network connections, just pushing
> bits around. maybe that is still a problem in php, but in java it has
> been solved a long time ago.
> 
> -igor
> 
> 
>>
>>>i can only assume that you have actually profiled your app and that
>>>one select count() call was what was taking a significant chunk of
>>>processing time in the database server? to the point where eliminating
>>>it will actually reduce enough load on the database to increase your
>>>throughput?
>>
>> No I haven't, as mentioned before, I just want to avoid 2 calls when one
>> will do.  I have however seen several times in production systems waiting
>> on
>> i/o's reduces your scalability. I'd rather keep server count down as
>> money
>> is tight.
>> I'll be mindfull not to ask 'stupid' questions again.
>>
>>
>>
>> On Wed, Nov 26, 2008 at 6:19 PM, Igor Vaynberg
>> <[EMAIL PROTECTED]>wrote:
>>
>>> On Wed, Nov 26, 2008 at 9:06 AM, Wayne Pope
>>> <[EMAIL PROTECTED]> wrote:
>>> > Hi Igor,
>>> >
>>> >>what? why would you ever load the whole dataset?
>>> > just to avoid 2 calls on smallish datasets, especially when there are
>>> > multiple joins and database isnt on the same box.
>>>
>>> so you think pushing all that extra data over the network is actually
>>> more efficient then doing another query wtf.
>>>
>>> >>yeah. because select count() queries are the most expensive queries
>>> >>you can run on the database. you are right, its totally going to kill
>>> >>it. you know how all those sites on the internet that have a pager
>>> >>above the pageable view that shows you the number of the last
>>> >>available page...you know how those work without doing a select
>>> >>count()?
>>> >
>>> > Ouch.
>>> > I just want to limit calls if possible to the database as waiting for
>>> i/o's
>>> > is never great for scalability. I'm not 'having a go' at wicket or
>>> DataViews
>>> > or anything, just trying to understand it. I never claimed to be a
>>> guru -
>>> > far from it.
>>>
>>> i can only assume that you have actually profiled your app and that
>>> one select count() call was what was taking a significant chunk of
>>> processing time in the database server? to the point where eliminating
>>> it will actually reduce enough load on the database to increase your
>>> throughput?
>>>
>>> -igor
>>>
>>> >
>>> > Wayne
>>> >
>>> >
>>> > On Wed, Nov 26, 2008 at 5:58 PM, Igor Vaynberg
>>> <[EMAIL PROTECTED]
>>> >wrote:
>>> >
>>> >> On Wed, Nov 26, 2008 at 7:32 AM, Wayne Pope
>>> >> <[EMAIL PROTECTED]> wrote:
>>> >> > I'm sure I must be missing something still, as I can't beleive that
>>> we
>>> >> need
>>> >> > to either a) load the whole data set
>>> >>
>>> >> what? why would you ever load the whole dataset?
>>> >>
>>> >> b) call count on the Db ,

Re: Wicket and CoC

2008-11-27 Thread Jeremy Thomerson
You can do exactly what you asked in less than 40 lines of code - and not be
bound to the class name in the HTML (which you shouldn't do).  Here's how:

IN YOUR APPLICATION CLASS:

@Override
protected void init() {
super.init();
registerConventionalComponent("feedbackPanel", FeedbackPanel.class);
registerConventionalComponent("submitLink", SubmitLink.class);
registerConventionalComponent("submitButton", Button.class);
}
private void registerConventionalComponent(String id, Class clazz) {
getPageSettings().addComponentResolver(new
ConventionalComponentResolver(id, clazz));
}
private static final class ConventionalComponentResolver implements
IComponentResolver {
private static final long serialVersionUID = 1L;
private final String mID;
private final Class mComponentClass;

public ConventionalComponentResolver(String id, Class clazz) {
mID = id;
mComponentClass = clazz;
}
public boolean resolve(MarkupContainer container, MarkupStream
markupStream, ComponentTag tag) {
CharSequence wicketId = tag.getString("wicket:id");
if (mID.equals(wicketId)) {
container.autoAdd(createInstance(), markupStream);
// Yes, we handled the tag
return true;
}
// We were not able to handle the tag
return false;
}
private Component createInstance() {
try {
return
mComponentClass.getConstructor(String.class).newInstance(mID);
} catch (Exception ex) {
throw new WicketRuntimeException("Error creating component
instance of class: " + mComponentClass.getName(), ex);
}
}
}
NIFTY!!  I hadn't written any IComponentResolver's before - but wanted to
try it.  Wicket is AWESOME!!  It makes it so easy to customize the framework
to YOUR needs without imposing one person's ideas on another person.
-- 
Jeremy Thomerson
http://www.wickettraining.com

On Thu, Nov 27, 2008 at 2:05 AM, Alex Objelean
<[EMAIL PROTECTED]>wrote:

>
> Using AutoComponentResolver, you can add a feedback panel like this:
>  class="org.apache.wicket.markup.html.panel.FeedbackPanel"/>
>
>
>
>
> Ricardo Mayerhofer wrote:
> >
> > I started to use wicket some time ago, and I'm really enjoying it. Best
> > framework ever.
> > But I've some suggestions.
> > I think wicket could be better if it had less boiler plate code. This
> > could be reduced by using CoC.
> > Take the FeedBackPanel for example, you always have to add the component
> > on the web page, even if no special handling is requires (which is almost
> > the case).
> > Wicket could have some reserved ids, so if I add a markup with id
> > feedbackPanel, a feedbackpanel component is automatically added to that
> > page.
> > Another example is SubmitLink component. No special handling required,
> but
> > for wicket sake the developer must add it on the java the page.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Wicket-and-CoC-tp20706881p20714917.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 and CoC

2008-11-27 Thread Alex Objelean

Using AutoComponentResolver, you can add a feedback panel like this:





Ricardo Mayerhofer wrote:
> 
> I started to use wicket some time ago, and I'm really enjoying it. Best
> framework ever.
> But I've some suggestions.
> I think wicket could be better if it had less boiler plate code. This
> could be reduced by using CoC.
> Take the FeedBackPanel for example, you always have to add the component
> on the web page, even if no special handling is requires (which is almost
> the case). 
> Wicket could have some reserved ids, so if I add a markup with id
> feedbackPanel, a feedbackpanel component is automatically added to that
> page.
> Another example is SubmitLink component. No special handling required, but
> for wicket sake the developer must add it on the java the page.
> 

-- 
View this message in context: 
http://www.nabble.com/Wicket-and-CoC-tp20706881p20714917.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]