Re: Equal InputValidator

2009-03-06 Thread Peter Thomas
On Thu, Mar 5, 2009 at 11:13 PM, SrinivasaRaju Ch 
srinivas.r...@sifycorp.com wrote:

 Hi,

 How to use Equal InputValidator in wicket  can any one give small example
 on it.


see line #30

http://code.google.com/p/perfbench/source/browse/trunk/perfbench/wicket-jpa/src/main/java/wicketjpa/wicket/PasswordPage.java#30

This particular example is for EqualPasswordInputValidator on 2
PasswordTextField instances - you can try EqualInputValidator on 2 TextField
instances.



 Regards,
 Srinviasa Raju CH.


 Get your world in your inbox!

 Mail, widgets, documents, spreadsheets, organizer and much more with your
 Sifymail WIYI id!
 Log on to http://www.sify.com

 ** DISCLAIMER **
 Information contained and transmitted by this E-MAIL is proprietary to Sify
 Limited and is intended for use only by the individual or entity to which it
 is addressed, and may contain information that is privileged, confidential
 or exempt from disclosure under applicable law. If this is a forwarded
 message, the content of this E-MAIL may not have been sent with the
 authority of the Company. If you are not the intended recipient, an agent of
 the intended recipient or a  person responsible for delivering the
 information to the named recipient,  you are notified that any use,
 distribution, transmission, printing, copying or dissemination of this
 information in any way or in any manner is strictly prohibited. If you have
 received this communication in error, please delete this mail  notify us
 immediately at ad...@sifycorp.com

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




Re: Expected close tag for wicket:link ??

2009-03-06 Thread Edwin Ansicodd

My error came from a missing a closing /wicket:link tag.

wicket:link/wicket:link



Erik van Oosten wrote:
 
 You will also get this error when you accidentally use a WebComponent 
 instead of a WebMarkupContainer. The first does not allow embedded 
 content and will therefor issue this error.
 
 Regards,
 Erik.
 
 
 
 Edwin Ansicodd wrote:
 I find this error in my log file when a wicket page loads.  Would anyone
 know
 what causes this error?

 ERROR org.apache.wicket.RequestCycle  - unexpected exception when
 handling
 another exception: Expected close tag for wicket:link
   
 
 
 -- 
 Erik van Oosten
 http://www.day-to-day-stuff.blogspot.com/
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Expected-close-tag-for-%3Cwicket%3Alink%3Etp22335083p22368030.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: What does Page Expired mean?

2009-03-06 Thread Edwin Ansicodd

Actually, the page became invalid because I missed the closing tag for
wicket:link in the html, only had wicket:link and not the
/wicket:link.

This caused:

ERROR org.apache.wicket.RequestCycle  - unexpected exception when handling
another exception: Expected close tag for wicket:link

which invalided the page.   

So missing wicket end tags can also cause pages to become invalid.



Edwin Ansicodd wrote:
 
 Thank you for all the comments!
 
 The Page Expired seemed to result because I had in my WebApplication: 
 
 
 mountBookmarkablePage(homepage, InitialPage.class);
 
 But InitialPage extended a different base page as the search page I was
 using.  I changed InitialPage to use the same base page and then Page
 Expired no longer appeared.  
 
   
 

-- 
View this message in context: 
http://www.nabble.com/What-does-Page-Expired-mean--tp22327219p22368125.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: [java-171] Tiles 2 + Spring management interface

2009-03-06 Thread Antony Stubbs

Would you care to back up that bold statement with some reasoning?

Regards,
Antony Stubbs,
NZ

On 6/03/2009, at 8:39 AM, Karl W wrote:


Dave

Stick with Spring MVC, stable, flexible, huge community. Also, with  
the new Spring Webflow/Spring Faces modules it makes JSF more  
manageable.


Wicket is not currently a commercially viable Framework, and never  
will be.


Karl


On 05/03/2009 23:16, Daves dave.snow...@gmail.com wrote:

I've used Spring MVC on a bunch of other projects and it's worked  
OK. So I guess the answer is that I'm comfortable with it. I've  
never used Wicket, why do you think it's a better option?

Dave

2009/3/5 Antony Stubbs antony.stu...@gmail.com
How did you decide on Spring MVC? Use Wicket.


Regards,
Antony Stubbs,
NZ


On 5/03/2009, at 11:37 PM, Daves wrote:

Hi David
Thanks - I've downloaded the source and I'll take a look.
cheers
Dave

2009/3/5 David Santoro soulnaf...@gmail.com

Hi Dave,

I have an ongoing project (University) developed with Spring MVC and  
Tiles 2.

 It something very simple but it could help you to start.

The source code is visible here, you will need maven to build.

http://github.com/soulnafein/lesshassles/

Cheers,

David


2009/3/5 Karl W karl.wid...@c4k.com


 Hi Dave

 I have a full set of application code that you can have for a  
project I did about 18 months ago.


 Regards
 Karl



 On 05/03/2009 17:01, Daves dave.snow...@gmail.com http://dave.snow...@gmail.com 
  wrote:



Hi folks

 I'm going to be starting on a new project soon based on Spring MVC.  
We have a requirement to be able to compose output from multiple  
components so we are planning to use Tiles 2.


 Although Spring supports Tiles 2 the documentation is a little  
sketchy and I wondered if anyone on the list had used Spring MVC   
Tiles2 together and had any advice to share.


 Also, Is anyone aware of a web-based user interface for managing  
Tiles2 configuration? Another requirement we have is for a web based  
management interface - I haven't found anything yet but if anyone  
here knows anything please shout before I spend some time rolling my  
own.


 thanks!

 Dave




 --
 Please Note: If you hit REPLY, your message will be sent to  
everyone on this mailing list (java-...@meetup.com http://java-...@meetup.com 
 )
 This message was sent by Daves (dave.snow...@gmail.com http://dave.snow...@gmail.com 
 ) from LJC - London Java Community http://www.meetup.com/Londonjavacommunity/ 
 .
 To learn more about Daves, visit his/her member profile http://www.meetup.com/Londonjavacommunity/members/4448264/ 

 To unsubscribe or to update your mailing list settings, click here http://www.meetup.com/account/comm/ 



 Meetup Support: supp...@meetup.com http://supp...@meetup.com
 632 Broadway, New York, NY 10012 USA






 --
 Please Note: If you hit REPLY, your message will be sent to  
everyone on this mailing list (java-...@meetup.com)
 This message was sent by Karl W (karl.wid...@c4k.com) from LJC -  
London Java Community http://www.meetup.com/Londonjavacommunity/ .
 To learn more about Karl W, visit his/her member profile http://www.meetup.com/Londonjavacommunity/members/5737154/ 



 To unsubscribe or to update your mailing list settings, click here http://www.meetup.com/account/comm/ 



  Meetup Support: supp...@meetup.com
 632 Broadway, New York, NY 10012 USA






 --
 Please Note: If you hit REPLY, your message will be sent to  
everyone on this mailing list (java-...@meetup.com)
 This message was sent by David Santoro (soulnaf...@gmail.com) from  
LJC - London Java Community http://www.meetup.com/Londonjavacommunity/ 
 .
 To learn more about David Santoro, visit his/her member profile http://www.meetup.com/Londonjavacommunity/members/8584827/ 



 To unsubscribe or to update your mailing list settings, click here http://www.meetup.com/account/comm/ 



  Meetup Support: supp...@meetup.com
 632 Broadway, New York, NY 10012 USA






 --
 Please Note: If you hit REPLY, your message will be sent to  
everyone on this mailing list (java-...@meetup.com)
 This message was sent by Daves (dave.snow...@gmail.com) from LJC -  
London Java Community http://www.meetup.com/Londonjavacommunity/ .
 To learn more about Daves, visit his/her member profile http://www.meetup.com/Londonjavacommunity/members/4448264/ 

 To unsubscribe or to update your mailing list settings, click here http://www.meetup.com/account/comm/ 



  Meetup Support: supp...@meetup.com
 632 Broadway, New York, NY 10012 USA






--
Please Note: If you hit REPLY, your message will be sent to  
everyone on this mailing list (java-...@meetup.com)
This message was sent by Daves (dave.snow...@gmail.com) from LJC -  
London Java Community http://www.meetup.com/Londonjavacommunity/ .
To learn more about Daves, visit his/her member profile http://www.meetup.com/Londonjavacommunity/members/4448264/ 

To unsubscribe or to update your mailing list settings, click here http://www.meetup.com/account/comm/ 



Meetup Support: 

A massive flaw in my understanding of Wicket

2009-03-06 Thread triswork

Hi 

I am new to wicket and have run into a problem in the development of my
application. The problem has a few workarounds, but I am afraid it is
pointing to a far larger gap in my understanding of Wicket. If anyone can
tell my what is going on here, I will be *very* grateful. I put together a
test app to illustrate:

public class TestPage1 extends TestBasePage
{
public TestPage1()
{
User user = MySession.get().getUser();
String userDescription = (user == null? No User :
user.toString());

add(new Link(login)
{
@Override
public void onClick()
{
MySession.get().setUser(new User(1, Mr, T, Test,
t...@test.com, 12, test, test));
setResponsePage(getApplication().getHomePage());
}

@Override
public boolean isVisible()
{
return !MySession.get().isAuthenticated();
}

});

add(new Label(user, userDescription));

//add(new Link(logout)
//{
//@Override
//public void onClick()
//{
//MaiaSession.get().invalidate();
//setResponsePage(getApplication().getHomePage());
//}
//
//@Override
//public boolean isVisible()
//{
//return MySession.get().isAuthenticated();
//}
//});

add(new BookmarkablePageLink(logout, TestLogoutPage.class)
{
@Override
public boolean isVisible()
{
boolean result = MySession.get().isAuthenticated();
return result;
}
});
}
}


The TestLogoutPage is very simple:
public class TestLogoutPage extends BasePage
{
public TestLogoutPage()
{
MySession.get().invalidate();
setResponsePage(getApplication().getHomePage());
}
}

If I use the commented out code for the logout link, it works as expected.
If, however, I use the BookmarkableLink to the TestLogoutPage, the
application breaks. If I click logout, the page doesn't refresh unless I
do it manually (F5). If I click logout again, then the page refreshes, but
any subsequent clicks (of either login or logout) give me a Page Expired
message.

I dont understand
1. Why the Bookmarkable page version isn't working and
2. Why the pages expire if I call logout multiple times.
-- 
View this message in context: 
http://www.nabble.com/A-massive-flaw-in-my-understanding-of-Wicket-tp22369056p22369056.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: openstreetmap in openlayers

2009-03-06 Thread morbo

Thank you very much. That really helped a lot. I am now able to render the
different openstreetmap layers (mapnik, ti...@home, cycleMap) with the above
mentioned OpenLayers.Layer.OSM object.

But there still exist some problems. It is not entirely possible to edit the
maps with the wicketstuff project. Once the map is rendered there is no
problem: dragging, zooming, layerswitching are working. But before rendering
not all functions are working. For example the setCenter(lonlat, zoom)
function of the wicketstuff openlayers contrib seems to do nothing with the
map. Also the setZoom function did not worked at the beginning, but after
some changes I got it working.

I think the project is not entirely up to date with the openlayers api?
Maybe a user who is more familiar with this project could give a statement
about the problem.





Michael O'Cleirigh wrote:
 
 Hello,
 
 Pink tiles means there is a mismatch somewhere between your layers.
 
 Does your openlayers javascript work correctly? (i.e. when not emitted 
 from wicket openlayers?)
 
 This page embeds an openstreet map in openlayers: 
 http://wiki.openstreetmap.org/wiki/OpenLayers
 
 But it doesn't use the OpenLayers.Layer.TMS object. It adds its own 
 import (http://openstreetmap.org/openlayers/OpenStreetMap.js ) and uses  
 an OpenLayers.Layer.OSM object.
 
 Perhaps your integration should use that instead?
 
 There is a ticket for something similiar that might get into OpenLayers 
 2.8 (http://trac.openlayers.org/ticket/1950)
 
 Mike
 
 I tried a few things and I think I managed the integration of
 openstreetmaps.
 The browser is contacting the osm tile server BUT everything I get are
 pink
 tiles?


 Here is the output of the final html page:

 html
 head
 titleWicket Quickstart Archetype Homepage/title
 script type=text/javascript
 src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script
 script type=text/javascript
 src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script
 script type=text/javascript
 src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script
 script type=text/javascript
 id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/
 wicketAjaxDebugEnable=true;
 /*--]]*//script

 script type=text/javascript
 src=http://openlayers.org/api/OpenLayers.js;/script

 script type=text/javascript
 src=resources/org.wicketstuff.openlayers.OpenLayersMap/wicket-openlayersmap.js/script
 script type=text/javascript !--/*--![CDATA[/*!--*/
 Wicket.Event.add(window, load, function(event) { function
 osm_getTileURL(bounds) {var res = this.map.getResolution();var x =
 Math.round((bounds.left - this.maxExtent.left) / (res *
 this.tileSize.w));var y = Math.round((this.maxExtent.top - bounds.top) /
 (res * this.tileSize.h)); var z = this.map.getZoom(); var limit =
 Math.pow(2, z);   if (y  0 || y = limit) { return
 OpenLayers.Util.getImagesLocation() + '404.png'; } else { x = ((x %
 limit) +
 limit) % limit; return this.url + z + '/' + x + '/' + y + '.' +
 this.type; }  }  ;});
 /*--]]*//script

 script type=text/javascript !--/*--![CDATA[/*!--*/
 Wicket.Event.add(window, domready, function(event) { 
 var options = {maxResolution: 156543.0339,
 projection: new OpenLayers.Projection('EPSG:900913'),
 numZoomLevels:18,
 maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34,
 20037508.34),
 units: 'm',
 displayProjection: new OpenLayers.Projection('EPSG:4326')};
 new WicketOMap('map7', options);
 var osm23008635 =new OpenLayers.Layer.TMS('OpenStreetMap (Mapnik)',
 'http://tile.openstreetmap.org/', {type: 'png',
 attribution:  http://www.openstreetmap.org/ OpenStreetMap ,
 displayOutsideMaxExtent: true});
 Wicket.omaps['map7'].addLayer(osm23008635,23008635);
 Wicket.omaps['map7'].zoomToMaxExtent();
 Wicket.omaps['map7'].addControl('LayerSwitcher', new
 OpenLayers.Control.LayerSwitcher());
 Wicket.omaps['map7'].setPopupId('content8');
 ;});
 /*--]]*//script

 /head
 body
 br/br/
 wicket:panel
  div wicket:id=infoWindow style=display: none 
 id=infoWindow9

  div wicket:id=content 
 id=content8wicket:panel
  wicket:child/
 /wicket:panel/div
  /div
  div wicket:id=map class=map style=width: 100%; 
 height: 100%;
 id=map7/div
  /wicket:panel

 /body
 /html


 Any ideas?


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

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


-
To unsubscribe, e-mail: 

Re: A massive flaw in my understanding of Wicket

2009-03-06 Thread Daniel Peters
Hi tristan,

try adding setRedirect(true) before calling setResponsePage. I think that 
should work:

public TestLogoutPage()
{
MySession.get().invalidate();
setRedirect(true); // ---
setResponsePage(getApplication().getHomePage());
}


regards
Daniel

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



Re: Place Button or Link in w_content_3 of ModalWindow

2009-03-06 Thread HITECH79



HITECH79 wrote:
 
 Hallo,
 
 how can i place components (buttons, links etc) in a ModalWindow which is
 displayed by div class w_content_3??? Is there an possibility to structure
 the modalwindow analog the css-classes. 
 
 Thanks for help...
 
 
 

ANY WAYS TO HANDLE THIS PROBLEM? 

Please Help... :)
-- 
View this message in context: 
http://www.nabble.com/Place-Button-or-Link-in-w_content_3-of-ModalWindow-tp22356556p22369247.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Place Button or Link in w_content_3 of ModalWindow

2009-03-06 Thread Martijn Dashorst
On Fri, Mar 6, 2009 at 11:16 AM, HITECH79 hitec...@web.de wrote:
 Please Help... :)

First read, understand and follow this document:
http://www.catb.org/~esr/faqs/smart-questions.html

Then ask again.

Martijn

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



Re: Uppercasing inputs

2009-03-06 Thread Leszek Gawron
I've been out for one day. I come back and see a thread with 38 
messages. That's crazy !:)


jWeekend wrote:

Leszek,

Thank you asking such a deep question ;-)
We may not all agree, but in the end, at least you have been offered around
87 well-intentioned solutions you can ask your customer to choose from; that
will teach them to request such complex features and fuctionality!


I was really blown by the amount of approaches you all presented. Thank 
you for all of them.


Some answers:

1. Dave wrote:

A slightly different approach: I would talk with the customer again, because 
this is a really stupid (excusez le mot) requirement. I hope you understand 
their motivation, possibly some legacy system that depends on uppercase 
information? Maybe the problem can be shifted to that legacy system that 
uppercases all data read from the database?


I thought so too but actually it's not that stupid after all. The 
customer has to enter A LOT of names, addresses etc. It speeds things up 
not to have to think about Proper Word Capitalization. Anything you type 
in always looks good.


2. I wanted to go with most non invasive way to do it. That is why I like:


public class UpperCaseBehavior extends AttributeAppender
{
   private static final long serialVersionUID = 1L;

   public UpperCaseBehavior()
   {
   super(style, new ModelString(text-transform: uppercase), ;);
   }

   @Override
   public void bind(Component component)
   {
   super.bind(component);
   component.add(new AttributeAppender(
   onkeyup, new ModelString(this.value = this.value.toUpperCase()), 
;));
   }
}



especially used with some nasty logic that would apply the behavior to 
every string field.


This is why I find this:


public void setFoo(String foo) {
  this.foo = foo == null ? null : foo.toUpperCase();
}


really ugly. Remember that I have to apply this for 99% of my domain model.

3. Igor, will this work:

class uppercasetextfield extends textfieldstring {
public void updatemodel()
{
  final String str=getconvertedinput();
  setdefaultmodelobject((str==null)?null:str.touppercase());
}
}


If the form model is a loadable detachable model?


The solution I chose:


@UpperCased
@Entity
@Table(name = usr)
@Inheritance(strategy = InheritanceType.JOINED)
public class User extends Persistent {
private boolean active  = true;
private String  code;

@NormalCased
private String  username;

@NormalCased
private String  password;
private String  firstName;
private String  lastName;
private SetRole roles   = new HashSetRole();
private String  mobilePhone;
private String  workPhone;
private String  colour;

 }

and:


public aspect Uppercaser {
pointcut setString( String value ) : ( ( set(String (@UpperCased *).* ) 
 set(!...@normalcased String *.* ) )

|| set(@UpperCased String *.* ) )

 args( value );

void around( String value ) : setString( value ) {
proceed( StringUtils.upperCase( value ) );
}
}


because:

1. I decided that the uppercasing should available for junit 
tests/command line tools etc.

2. It introduces the least changes into existing code.
3. It allows me to get rid of uppercasing just by recompiling the domain 
model library without the aspect (if ever my customer came back to 
sanity).


It feels like I'm introducing way too complicated tool to solve an easy 
task (maybe judging by the number of the posts - not that easy after 
all), but what the hell...



Thank you for all posts. You are by no means one of the most helpful and 
vigorous OS community there is.


PS. I laughed almost to tears reading some posts. Very refreshing :)

--
Leszek Gawron 3.14159265358979323846264338327950288419716939937510
58209749445923078164062862089986280348253421170679
82148086513282306647093844609550582231725359408128
48111745028410270193852110555964462294895493038196
44288109756659334461284756482337867831652712019091
45648566923460348610454326648213393607260249141273
72458700660631558817488152092096282925409171536436
78925903600113305305488204665213841469519415116094
33057270365759591953092186117381932611793105118548
07446237996274956735188575272489122793818301194912
98336733624406566430860213949463952247371907021798
60943702770539217176293176752384674818467669405132
00056812714526356082778577134275778960917363717872
14684409012249534301465495853710507922796892589235
42019956112129021960864034418159813629774771309960
5187072113499837297804995105973173281609631859
50244594553469083026425223082533446850352619311881
71010003137838752886587533208381420617177669147303

Only one session for logged user.

2009-03-06 Thread Martin Bednář
Hello,

In our application I must guarantee that user is logged only once to the
application.
I have the following problem.

1,User logged to aplication, create session1
2,User browser crased, but session1 is still alive for next 30minutes
(session expiration time is 30minutes).
3,User open new browser and login to application (session2 is created).

And in point 3 I need close session1 before I log user in.

I hold userId in user session, but I don't know how to iterate over all
sessions and check if another session for same user is here.

Any advice ?

Thx Martin


Re: Only one session for logged user.

2009-03-06 Thread Ernesto Reinaldo Barreiro
Using a session listener to record session creation/destruction and them use
that info to invalidate previous sessions where the user is the same?

Ernesto

On Fri, Mar 6, 2009 at 11:34 AM, Martin Bednář martin.bed...@triax.czwrote:

 Hello,

 In our application I must guarantee that user is logged only once to the
 application.
 I have the following problem.

 1,User logged to aplication, create session1
 2,User browser crased, but session1 is still alive for next 30minutes
 (session expiration time is 30minutes).
 3,User open new browser and login to application (session2 is created).

 And in point 3 I need close session1 before I log user in.

 I hold userId in user session, but I don't know how to iterate over all
 sessions and check if another session for same user is here.

 Any advice ?

 Thx Martin



Re: modal window with iframe - ajax refresh on parent page

2009-03-06 Thread jensiator

Hi geke
Have you solved your problem? I also have a ModalWindow with my own defined
callbacks that wont update the parent page components. I'm using pagecreator
to add the content of the ModalWindow. When I add a Panel to the ModalWindow
through setContent It works.
Jens
-- 
View this message in context: 
http://www.nabble.com/modal-window-with-iframe---ajax-refresh-on-parent-page-tp17816849p22369478.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: WYSIWYG component

2009-03-06 Thread rolandpeng

I use wicket 1.4-rc2 and meet the same problem.

you can download jazzy.jar here to solve the exception.
http://sourceforge.net/projects/jazzy/

then all the program works.

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


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



Re: Only one session for logged user.

2009-03-06 Thread Leszek Gawron

Martin Bednář wrote:

Hello,

In our application I must guarantee that user is logged only once to the
application.
I have the following problem.

1,User logged to aplication, create session1
2,User browser crased, but session1 is still alive for next 30minutes
(session expiration time is 30minutes).
3,User open new browser and login to application (session2 is created).

And in point 3 I need close session1 before I log user in.

I hold userId in user session, but I don't know how to iterate over all
sessions and check if another session for same user is here.

Any advice ?


Have a look at how Acegi Security handles concurrent sessions management:

http://www.acegisecurity.org/guide/springsecurity.html#concurrent-sessions

hth

--
Leszek Gawron

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



Re: localization and session expiration

2009-03-06 Thread Leszek Gawron

Anton Veretennikov wrote:

May be cookie?


You can also try to extract the locale used by user in the browser from 
request header:



http://www.acegisecurity.org/guide/springsecurity.html#concurrent-sessions

GET /guide/springsecurity.html HTTP/1.1
Host: www.acegisecurity.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) 
Gecko/2009011913 Firefox/3.0.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en;q=0.7,en-us;q=0.3

   ^

Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.acooke.org/cute/SessionLim0.html
If-Modified-Since: Tue, 15 Apr 2008 17:18:26 GMT
If-None-Match: 28002-5ba09-44aec96961c80
Cache-Control: max-age=0

HTTP/1.x 304 Not Modified
Date: Fri, 06 Mar 2009 11:52:59 GMT
Server: Apache/2.2.8 (EL)
Connection: close
Etag: 28002-5ba09-44aec96961c80


Spring can resolve locale for you in a flexible manner:

http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/LocaleResolver.html

in your case:

http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.html

To integrate wicket with spring in this context override 
WebApplication.newSession:


@Override
public Session newSession( Request request, Response response ) {
return new WebSession( request ) {
@Override
public Locale getLocale() {
return LocaleContextHolder.getLocale();
}
};
}


--
Leszek Gawron

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



Re: Equal InputValidator

2009-03-06 Thread Leszek Gawron

Peter Thomas wrote:

On Thu, Mar 5, 2009 at 11:13 PM, SrinivasaRaju Ch 
srinivas.r...@sifycorp.com wrote:


Hi,

How to use Equal InputValidator in wicket  can any one give small example
on it.



see line #30

http://code.google.com/p/perfbench/source/browse/trunk/perfbench/wicket-jpa/src/main/java/wicketjpa/wicket/PasswordPage.java#30

This particular example is for EqualPasswordInputValidator on 2
PasswordTextField instances - you can try EqualInputValidator on 2 TextField
instances.


I recently found out there is Google Code Search in Google Labs. Saves 
me a lot of trouble:


http://www.google.com/codesearch?q=EqualInputValidatorhl=enbtnG=Search+Code

--
Leszek Gawron

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



Re: DropDownChoice with disabled items

2009-03-06 Thread Adriano dos Santos Fernandes

Thanks, Cemal.

However, I must say that I don't like how generics are handled (or not 
handled at all) in these components.



Adriano


jWeekend escreveu:

Adriano,

Take a look at a mini-presentation I gave at one of our London Wicket Events
sometime in last couple of years on Select and SelectOption at
http://jweekend.com/dev/ArticlesPage/  .

Regards - Cemal
http://jWeekend.com jWeekend  



Adriano dos Santos Fernandes-3 wrote:
  

Is there an easy way to do it? Output would be:

select
optionEnabled item/option
option disabled=disabledDisabled item/option
...
/select


Adriano


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






  



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



Re: localization and session expiration

2009-03-06 Thread Jonas
No need to use spring for that, the locale of a WebSession is
initialized from ServletRequest#getLocale()
by default, which is based on the Accept-Language header.

On Fri, Mar 6, 2009 at 12:57 PM, Leszek Gawron lgaw...@apache.org wrote:
 Anton Veretennikov wrote:

 May be cookie?

 You can also try to extract the locale used by user in the browser from
 request header:

 http://www.acegisecurity.org/guide/springsecurity.html#concurrent-sessions

 GET /guide/springsecurity.html HTTP/1.1
 Host: www.acegisecurity.org
 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6)
 Gecko/2009011913 Firefox/3.0.6
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
 Accept-Language: pl,en;q=0.7,en-us;q=0.3

                   ^

 Accept-Encoding: gzip,deflate
 Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
 Keep-Alive: 300
 Connection: keep-alive
 Referer: http://www.acooke.org/cute/SessionLim0.html
 If-Modified-Since: Tue, 15 Apr 2008 17:18:26 GMT
 If-None-Match: 28002-5ba09-44aec96961c80
 Cache-Control: max-age=0

 HTTP/1.x 304 Not Modified
 Date: Fri, 06 Mar 2009 11:52:59 GMT
 Server: Apache/2.2.8 (EL)
 Connection: close
 Etag: 28002-5ba09-44aec96961c80

 Spring can resolve locale for you in a flexible manner:

 http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/LocaleResolver.html

 in your case:

 http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.html

 To integrate wicket with spring in this context override
 WebApplication.newSession:

 @Override
 public Session newSession( Request request, Response response ) {
        return new WebSession( request ) {
               �...@override
                public Locale getLocale() {
                        return LocaleContextHolder.getLocale();
                }
        };
 }


 --
 Leszek Gawron

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



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



Ajaxifying FormComponentPanel

2009-03-06 Thread Linda van der Pal
I have a FormComponentPanel that contains a TextField and a 
DropDownChoice. Of those two only one is visible at any moment. (The 
TextField is there for when the DropDownChoice doesn't offer the wanted 
result.) On the panel that contains the FormComponentPanel, I want 
another element to respond to any change in the FormComponentPanel (most 
importantly if the user selects something from the DropDownChoice). I 
have added ajax behavior to the component, but the model isn't updated, 
so when I debug the onChange method of the behavior, I find that the 
object in the model is null. How do I get it to update properly?


Regards,
Linda van der Pal

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



Re: DropDownChoice with disabled items

2009-03-06 Thread jWeekend

Adriano,

I'm glad it was useful - these classes make DDCs pretty versatile.

Wicket 1.3 is designed to be ale to run on Java versions before 1.5 (when
generics were introduced to the language). Take a look at 
http://wicket.apache.org/docs/1.4/ SelectOption in Wicket 1.4   if you are
using Java 5 or better.

Regards - Cemal
http://jWeekend.com jWeekend 


Adriano dos Santos Fernandes-3 wrote:
 
 Thanks, Cemal.
 
 However, I must say that I don't like how generics are handled (or not 
 handled at all) in these components.
 
 
 Adriano
 
 
 jWeekend escreveu:
 Adriano,

 Take a look at a mini-presentation I gave at one of our London Wicket
 Events
 sometime in last couple of years on Select and SelectOption at
 http://jweekend.com/dev/ArticlesPage/  .

 Regards - Cemal
 http://jWeekend.com jWeekend  


 Adriano dos Santos Fernandes-3 wrote:
   
 Is there an easy way to do it? Output would be:

 select
 optionEnabled item/option
 option disabled=disabledDisabled item/option
 ...
 /select


 Adriano


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



 

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

-- 
View this message in context: 
http://www.nabble.com/DropDownChoice-with-disabled-items-tp22351308p22371622.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: DropDownChoice with disabled items

2009-03-06 Thread Adriano dos Santos Fernandes

jWeekend escreveu:

Adriano,

I'm glad it was useful - these classes make DDCs pretty versatile.

Wicket 1.3 is designed to be ale to run on Java versions before 1.5 (when
generics were introduced to the language). Take a look at 
http://wicket.apache.org/docs/1.4/ SelectOption in Wicket 1.4   if you are

using Java 5 or better.

I'm using Wicket 1.4. :-)

Let me explain. The problems are:
- Select is not generified. It receives an unparameterized Model.
- SelectOption is parameterized, but we should rely on getDefaultModel 
(that returns a IModel?), so it getDefaultModel().getObject() always 
returns an Object.



Adriano


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



Re: A massive flaw in my understanding of Wicket

2009-03-06 Thread triswork

Hi Daniel

Thanks for that. It solves the problem completely. I still don't understand,
however, what actually happens under-the-hood (i.e. What does Wicket do if I
don't call setRedirect(true) - and why does this break my application?)

Regards,

Tristan



Daniel Peters-2 wrote:
 
 Hi tristan,
 
 try adding setRedirect(true) before calling setResponsePage. I think that
 should work:
 
 public TestLogoutPage()
 {
 MySession.get().invalidate();
   setRedirect(true); // ---
 setResponsePage(getApplication().getHomePage());
 }
 
 
 regards
 Daniel
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/A-massive-flaw-in-my-understanding-of-Wicket-tp22369056p22371850.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: localization and session expiration

2009-03-06 Thread Anton Veretennikov
If cookie is already set, get it and use, if no then set it as browser's
getLocale() and save to cookie.

To get cookies:

Cookie[] cookies =
((WebRequest)getRequestCycle().getRequest()).getCookies();
if (cookies!=null) {
for (int i = 0; i  cookies.length; i++) {
  Cookie cookie = cookies[i];
  ...
}
}

To set cookie:

Cookie cookie = new Cookie(language, selectedLanguage);
cookie.setMaxAge(2678400); //31 день
((WebResponse) getRequestCycle().getResponse()).addCookie(cookie);

-- Tony

On Fri, Mar 6, 2009 at 7:26 PM, Jonas barney...@gmail.com wrote:

 No need to use spring for that, the locale of a WebSession is
 initialized from ServletRequest#getLocale()
 by default, which is based on the Accept-Language header.

 On Fri, Mar 6, 2009 at 12:57 PM, Leszek Gawron lgaw...@apache.org wrote:
  Anton Veretennikov wrote:
 
  May be cookie?
 
  You can also try to extract the locale used by user in the browser from
  request header:
 
 
 http://www.acegisecurity.org/guide/springsecurity.html#concurrent-sessions
 
  GET /guide/springsecurity.html HTTP/1.1
  Host: www.acegisecurity.org
  User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6)
  Gecko/2009011913 Firefox/3.0.6
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: pl,en;q=0.7,en-us;q=0.3
 
^
 
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 300
  Connection: keep-alive
  Referer: http://www.acooke.org/cute/SessionLim0.html
  If-Modified-Since: Tue, 15 Apr 2008 17:18:26 GMT
  If-None-Match: 28002-5ba09-44aec96961c80
  Cache-Control: max-age=0
 
  HTTP/1.x 304 Not Modified
  Date: Fri, 06 Mar 2009 11:52:59 GMT
  Server: Apache/2.2.8 (EL)
  Connection: close
  Etag: 28002-5ba09-44aec96961c80
 
  Spring can resolve locale for you in a flexible manner:
 
 
 http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/LocaleResolver.html
 
  in your case:
 
 
 http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.html
 
  To integrate wicket with spring in this context override
  WebApplication.newSession:
 
  @Override
  public Session newSession( Request request, Response response ) {
 return new WebSession( request ) {
 @Override
 public Locale getLocale() {
 return LocaleContextHolder.getLocale();
 }
 };
  }
 
 
  --
  Leszek Gawron
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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




Re: Ajaxifying FormComponentPanel

2009-03-06 Thread jWeekend

Linda,

Take a look at AjaxFormComponentUpdatingBehavior.

Regards - Cemal
http://jWeekend.com jWeekend 


Linda van der Pal wrote:
 
 I have a FormComponentPanel that contains a TextField and a 
 DropDownChoice. Of those two only one is visible at any moment. (The 
 TextField is there for when the DropDownChoice doesn't offer the wanted 
 result.) On the panel that contains the FormComponentPanel, I want 
 another element to respond to any change in the FormComponentPanel (most 
 importantly if the user selects something from the DropDownChoice). I 
 have added ajax behavior to the component, but the model isn't updated, 
 so when I debug the onChange method of the behavior, I find that the 
 object in the model is null. How do I get it to update properly?
 
 Regards,
 Linda van der Pal
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

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


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



Re: modal window with iframe - ajax refresh on parent page

2009-03-06 Thread geke

There is an workaround for the problem.
See http://www.dooriented.com/blog/category/programming/.
There is a topic Wicket - Ajax like file upload on a modal window.


jensiator wrote:
 
 Hi geke
 Have you solved your problem? I also have a ModalWindow with my own
 defined callbacks that wont update the parent page components. I'm using
 pagecreator to add the content of the ModalWindow. When I add a Panel to
 the ModalWindow through setContent It works.
 Jens
 
-- 
View this message in context: 
http://www.nabble.com/modal-window-with-iframe---ajax-refresh-on-parent-page-tp17816849p22372528.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Uppercasing inputs

2009-03-06 Thread taha siddiqi
Thanks!!( everyone MADE a joke and I BECAME one )

On Fri, Mar 6, 2009 at 3:55 PM, Leszek Gawron lgaw...@apache.org wrote:
 I've been out for one day. I come back and see a thread with 38 messages.
 That's crazy !:)

 jWeekend wrote:

 Leszek,

 Thank you asking such a deep question ;-)
 We may not all agree, but in the end, at least you have been offered
 around
 87 well-intentioned solutions you can ask your customer to choose from;
 that
 will teach them to request such complex features and fuctionality!

 I was really blown by the amount of approaches you all presented. Thank you
 for all of them.

 Some answers:

 1. Dave wrote:

 A slightly different approach: I would talk with the customer again,
 because this is a really stupid (excusez le mot) requirement. I hope you
 understand their motivation, possibly some legacy system that depends on
 uppercase information? Maybe the problem can be shifted to that legacy
 system that uppercases all data read from the database?

 I thought so too but actually it's not that stupid after all. The customer
 has to enter A LOT of names, addresses etc. It speeds things up not to have
 to think about Proper Word Capitalization. Anything you type in always looks
 good.

 2. I wanted to go with most non invasive way to do it. That is why I like:

 public class UpperCaseBehavior extends AttributeAppender
 {
   private static final long serialVersionUID = 1L;

   public UpperCaseBehavior()
   {
       super(style, new ModelString(text-transform: uppercase), ;);
   }

   @Override
   public void bind(Component component)
   {
       super.bind(component);
       component.add(new AttributeAppender(
           onkeyup, new ModelString(this.value =
 this.value.toUpperCase()), ;));
   }
 }


 especially used with some nasty logic that would apply the behavior to every
 string field.

 This is why I find this:

 public void setFoo(String foo) {
  this.foo = foo == null ? null : foo.toUpperCase();
 }

 really ugly. Remember that I have to apply this for 99% of my domain model.

 3. Igor, will this work:

 class uppercasetextfield extends textfieldstring {
        public void updatemodel()
        {
              final String str=getconvertedinput();
              setdefaultmodelobject((str==null)?null:str.touppercase());
        }
 }

 If the form model is a loadable detachable model?


 The solution I chose:

 @UpperCased
 @Entity
 @Table(name = usr)
 @Inheritance(strategy = InheritanceType.JOINED)
 public class User extends Persistent {
        private boolean         active  = true;
        private String          code;

       �...@normalcased
        private String          username;

       �...@normalcased
        private String          password;
        private String          firstName;
        private String          lastName;
        private SetRole       roles   = new HashSetRole();
        private String          mobilePhone;
        private String          workPhone;
        private String          colour;

 }

 and:

 public aspect Uppercaser {
        pointcut setString( String value ) : ( ( set(String (@UpperCased
 *).* )  set(!...@normalcased String *.* ) )

      || set(@UpperCased String *.* ) )

       args( value );

        void around( String value ) : setString( value ) {
                proceed( StringUtils.upperCase( value ) );
        }
 }

 because:

 1. I decided that the uppercasing should available for junit tests/command
 line tools etc.
 2. It introduces the least changes into existing code.
 3. It allows me to get rid of uppercasing just by recompiling the domain
 model library without the aspect (if ever my customer came back to
 sanity).

 It feels like I'm introducing way too complicated tool to solve an easy task
 (maybe judging by the number of the posts - not that easy after all), but
 what the hell...


 Thank you for all posts. You are by no means one of the most helpful and
 vigorous OS community there is.

 PS. I laughed almost to tears reading some posts. Very refreshing :)

 --
 Leszek Gawron 3.14159265358979323846264338327950288419716939937510
 58209749445923078164062862089986280348253421170679
 82148086513282306647093844609550582231725359408128
 48111745028410270193852110555964462294895493038196
 44288109756659334461284756482337867831652712019091
 45648566923460348610454326648213393607260249141273
 72458700660631558817488152092096282925409171536436
 78925903600113305305488204665213841469519415116094
 33057270365759591953092186117381932611793105118548
 07446237996274956735188575272489122793818301194912
 98336733624406566430860213949463952247371907021798
 60943702770539217176293176752384674818467669405132
 00056812714526356082778577134275778960917363717872
 14684409012249534301465495853710507922796892589235
 42019956112129021960864034418159813629774771309960
 5187072113499837297804995105973173281609631859
 50244594553469083026425223082533446850352619311881
 71010003137838752886587533208381420617177669147303
 

Re: Dutch government picks Hippo CMS for all public websites

2009-03-06 Thread Arje Cahn
Hi Wicket folks,

 HippoCMS uses Wicket in large parts of their infrastructure and I am
 excited to hear that Wicket will be at the basis for the Dutch
 government.

Thanks! And feel free to add this to the Wicket marketing material :-)
It's public information anyway.

To clarify:
The Dutch Central Government has decided to use open source (in
general) for their public websites [1].
The main website (www.rijksoverheid.nl) will be running Hippo CMS [2],
which will host the Ministry of Finance, Economics, Internal Affairs,
and all the other ministries.
Wicket is used in the Hippo CMS user interface. The website itself
will be a lot less statefull and not run Wicket :)

Apart from Wicket, we rely heavily on Apache Jackrabbit and Lucene.

 Kudos to the Hippo team!

Thanks Martijn, Cemal and Francisco!

And Kudos to the Wicket community for making such a great framework!
Don't forget to visit the Wicket Meetup:
http://cwiki.apache.org/confluence/display/WICKET/Wicket+Community+meetups+-+Amsterdam
I'll be there :-)

-- Arjé

CTO, Hippo

[1] 
http://www.ez.nl/Actueel/Pers_en_nieuwsberichten/Nieuwsberichten_2009/Maart_2009/Nieuwe_website_rijksoverheid_gemaakt_met_open_source_software
[2] http://www.onehippo.org/cms7

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



Re: Ajaxifying FormComponentPanel

2009-03-06 Thread Linda van der Pal

That is in fact the type of behavior I am using. Here's a bit of the code:

   // The subgenre-field
   IModelListSubgenre subgenreModel = new 
AbstractReadOnlyModelListSubgenre() {

   @Override
   public ListSubgenre getObject() {
   ListSubgenre subgenres = new ArrayListSubgenre();
   if (selectedGenre != null){
   // Fetch the subgenres based on selectedGenre
subgenres = ...
   }
   return subgenres;
   }
   };
   final FieldSwitchPanel subgenrefield = new 
SubgenreFieldSwitchPanel(subgenre, subgenreModel);

   subgenrefield.setOutputMarkupId(true);
   subgenrefield.setOutputMarkupPlaceholderTag(true);
   form.add(subgenrefield);
  
  
   // The genre-field

   // fetch the genres
   ListDomainObject genres = ...
  
   final FieldSwitchPanel genrefield = new 
GenreFieldSwitchPanel(genre, genres, new 
PropertyModelDomainObject(this, selectedGenre));
   genrefield.add(new 
AjaxFormComponentUpdatingBehavior(onchange) {

   @Override
   protected void onUpdate(AjaxRequestTarget target) {
   target.addComponent(subgenrefield);
   }
   });
   genrefield.setOutputMarkupPlaceholderTag(true);
   form.add(genrefield);

The problem is that selectedGenre stays null. So I'm looking for the 
cause of that. My guess is that it is because the model isn't updated. 
(I did implement convertInput() in GenreFieldSwitchPanel, which extends 
FormComponentPanel.)


Linda

jWeekend wrote:

Linda,

Take a look at AjaxFormComponentUpdatingBehavior.

Regards - Cemal
http://jWeekend.com jWeekend 



Linda van der Pal wrote:
  
I have a FormComponentPanel that contains a TextField and a 
DropDownChoice. Of those two only one is visible at any moment. (The 
TextField is there for when the DropDownChoice doesn't offer the wanted 
result.) On the panel that contains the FormComponentPanel, I want 
another element to respond to any change in the FormComponentPanel (most 
importantly if the user selects something from the DropDownChoice). I 
have added ajax behavior to the component, but the model isn't updated, 
so when I debug the onChange method of the behavior, I find that the 
object in the model is null. How do I get it to update properly?


Regards,
Linda van der Pal

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






  




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.278 / Virus Database: 270.11.8/1986 - Release Date: 03/05/09 19:32:00


  




What javascript event trigger component update?

2009-03-06 Thread Daniele Dellafiore
Hi everyone.

I have this problem:

a panel with a list is hided via a jquery hide(). It works but this
panel is also refreshed via a wicket AjaxTimerBehavior.
So when the page is loaded, I call the jquery hide() and at the first
onTimer() the panel is refreshed and become visible.

How can I avoid this *without* any flickering effect?
What is the event that arrives to the component before it is refreshed?

Make this panel visible/invisible can be a solution but I prefer
relying on ajax toolkit to manage this sort of stuff.

Thanks.

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

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



Re: What javascript event trigger component update?

2009-03-06 Thread Linda van der Pal

A guess from a newbie would be onBeforeRender

Regards,
Linda

Daniele Dellafiore wrote:

Hi everyone.

I have this problem:

a panel with a list is hided via a jquery hide(). It works but this
panel is also refreshed via a wicket AjaxTimerBehavior.
So when the page is loaded, I call the jquery hide() and at the first
onTimer() the panel is refreshed and become visible.

How can I avoid this *without* any flickering effect?
What is the event that arrives to the component before it is refreshed?

Make this panel visible/invisible can be a solution but I prefer
relying on ajax toolkit to manage this sort of stuff.

Thanks.

  




No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.278 / Virus Database: 270.11.8/1986 - Release Date: 03/05/09 19:32:00


  



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



Re: What javascript event trigger component update?

2009-03-06 Thread Daniele Dellafiore
On Fri, Mar 6, 2009 at 3:27 PM, Linda van der Pal
lvd...@heritageagenturen.nl wrote:
 A guess from a newbie would be onBeforeRender

 Regards,
 Linda


no :)

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

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



Re: Uppercasing inputs

2009-03-06 Thread Leszek Gawron

taha siddiqi wrote:

Thanks!!( everyone MADE a joke and I BECAME one )


I'm sorry if you felt offended. It wasn't personal. Maybe my expression 
was not exact enough. After all I have used your proposal (modify 
Strings directly in domain model). What I didn't like is the requirement 
to change every set*( String value ) so I used AspectJ for that (which 
is probably a total overkill).


My regards
lg
--
Leszek Gawron

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



Re: Non-serializable model objects

2009-03-06 Thread Leszek Gawron

Timo Rantalaiho wrote:

On Tue, 03 Mar 2009, Chris Hansen wrote:

The situation that I'm dealing with most commonly is where I'm dealing
with simple, DTO-like POJOS with no-arg constructors and
getters/setters (why they are not serializable in the first place is
beyond me). It just seems like it would be possible, in this simple
case, to create a proxy for each object in the object graph which is
not serializable until you get down to the actual data (i.e.
primitives, Strings, etc.) which is serializable. The proxies would
have to keep track of whatever information they need to de-serialize
themselves (e.g. class name and constructor). It seems like this has
not been implemented, but do you think it is possible to do so?


That sounds cumbersome too :)

If the objects are in fact serializable, why can't you make 
them Serializable?


As I am learning AspectJ lately I try to solve every problem with it :)

it turns out you could weave DTOs you have no control over to implement 
Serializable interface:


public aspect SerializerImplementer {
declare parents: ProductDTO implements Serializable;
declare parents: ContractorDTO implements Serializable;
declare parents: InvoiceDTO implements Serializable;
}

You can do it once and have no problem with it ever again...

--
Leszek Gawron

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



Wizard and onSubmit of nested form

2009-03-06 Thread Dave Schoorl

Hi all,

I am building my first Wizard with the wizard from wicket-extensions 
version 1.3.5. Every step contains a panel with it's own form, so I have 
a nested form in the wizards form. I was expecting that when I click 
next, the onSubmit of my current form is called, but it's not. Instead 
the onSubmit of the form in the next step is called.


This seems to be related: http://markmail.org/message/ktpvzvslq5tupo6x

Am I doing something wrong?

Regards,
Dave


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



Using RequestCycle outside of a http request

2009-03-06 Thread Wayne Pope
Hi,

We have some Bookmarkable pages that display some given content. I
would like to email these links out to a set of users. We have a set
of classes that knows how to build the good bookmarkable link
depending on the content. Now this works all fine and good.

However we need to move the email sending aspect to a batch/thread
(for daily updates). I would like create the bookmarkable link the
same way and call toString() to get the good URL. However I get an
exception about not running inside a request/application.

Is it possible to create a new RequestCycle outside of a request (it
doesn't appear so) or is there any other way of creating the link
aside from hand coding/crafting them?

thanks for any pointers
Wayne








www.glasscubes.com

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



Re: Wizard and onSubmit of nested form

2009-03-06 Thread rmattler

Use public void validate(Form form)

See example below.  Hope it helps.


private final class Step2 extends WizardStep {
public Step2() {
setTitleModel(new Model(Add pictures));

add(new AbstractFormValidator() {
public FormComponent[] 
getDependentFormComponents() {
return null;
}

public void validate(Form form) {

String dir = 
Constants.ADD_PROJECT_FILE_PIC_PATH +
getProjects().getTblId();

File filesDir = new File(dir);
if (filesDir.canRead() || 
filesDir.isDirectory()) {
String[] fileNames = 
filesDir.list();
if (fileNames.length  0) {

getProjects().setNumPhotos(fileNames.length);
} else {
form.error(Please 
upload some photos);
}
} else {
form.error(Please upload some 
photos);
}

}
});

}
}

Dave Schoorl wrote:
 
 Hi all,
 
 I am building my first Wizard with the wizard from wicket-extensions 
 version 1.3.5. Every step contains a panel with it's own form, so I have 
 a nested form in the wizards form. I was expecting that when I click 
 next, the onSubmit of my current form is called, but it's not. Instead 
 the onSubmit of the form in the next step is called.
 
 This seems to be related: http://markmail.org/message/ktpvzvslq5tupo6x
 
 Am I doing something wrong?
 
 Regards,
 Dave
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Wizard-and-onSubmit-of-nested-form-tp22375244p22375366.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Using RequestCycle outside of a http request

2009-03-06 Thread Jeremy Thomerson
Search the mail list - there's a lot of examples of this.  Basically, you'll
need to use WicketTester - it will set up a mock request cycle, etc. for
you.

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

On Fri, Mar 6, 2009 at 10:03 AM, Wayne Pope 
waynemailingli...@googlemail.com wrote:

 Hi,

 We have some Bookmarkable pages that display some given content. I
 would like to email these links out to a set of users. We have a set
 of classes that knows how to build the good bookmarkable link
 depending on the content. Now this works all fine and good.

 However we need to move the email sending aspect to a batch/thread
 (for daily updates). I would like create the bookmarkable link the
 same way and call toString() to get the good URL. However I get an
 exception about not running inside a request/application.

 Is it possible to create a new RequestCycle outside of a request (it
 doesn't appear so) or is there any other way of creating the link
 aside from hand coding/crafting them?

 thanks for any pointers
 Wayne








 www.glasscubes.com

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




Re: Using RequestCycle outside of a http request

2009-03-06 Thread Wayne Pope
ok thanks Jeremy

On Fri, Mar 6, 2009 at 5:28 PM, Jeremy Thomerson
jer...@wickettraining.com wrote:
 Search the mail list - there's a lot of examples of this.  Basically, you'll
 need to use WicketTester - it will set up a mock request cycle, etc. for
 you.

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

 On Fri, Mar 6, 2009 at 10:03 AM, Wayne Pope 
 waynemailingli...@googlemail.com wrote:

 Hi,

 We have some Bookmarkable pages that display some given content. I
 would like to email these links out to a set of users. We have a set
 of classes that knows how to build the good bookmarkable link
 depending on the content. Now this works all fine and good.

 However we need to move the email sending aspect to a batch/thread
 (for daily updates). I would like create the bookmarkable link the
 same way and call toString() to get the good URL. However I get an
 exception about not running inside a request/application.

 Is it possible to create a new RequestCycle outside of a request (it
 doesn't appear so) or is there any other way of creating the link
 aside from hand coding/crafting them?

 thanks for any pointers
 Wayne








 www.glasscubes.com

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




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



Re: Only one session for logged user.

2009-03-06 Thread Igor Vaynberg
instead of storing a user id store a uuid that is generated on login,
and resolve the uuid back to user.

every time the user logs in you invalidate all other uuids they have
and generate a new one.

-igor

On Fri, Mar 6, 2009 at 2:34 AM, Martin Bednář martin.bed...@triax.cz wrote:
 Hello,

 In our application I must guarantee that user is logged only once to the
 application.
 I have the following problem.

 1,User logged to aplication, create session1
 2,User browser crased, but session1 is still alive for next 30minutes
 (session expiration time is 30minutes).
 3,User open new browser and login to application (session2 is created).

 And in point 3 I need close session1 before I log user in.

 I hold userId in user session, but I don't know how to iterate over all
 sessions and check if another session for same user is here.

 Any advice ?

 Thx Martin


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



Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Zhubin Salehi

Hi guys,

I have a similar problem that NonCachingImage does not solve. I have
implemented a simple expand/collapse button. I check the rendered page
source in FireFox and image name is always /img/expand.gif. Here is the
code:

/* advanced search link */
add(new AjaxSubmitLink(advancedSearch) {

private static final long serialVersionUID = 
3847759110695405700L;

@Override
protected void onSubmit(AjaxRequestTarget 
target, Form? form) {
advancedSearch = !advancedSearch;
target.addComponent(findUserAcountForm);
}
}.add(new NonCachingImage(expandCollapse, new 
ModelString() {

private static final long serialVersionUID = 
3430522655787763141L;

@Override
public String getObject() {
return advancedSearch ? 
/img/collapse.gif : /img/expand.gif;
}
})));

Thanks,
Zhubin


Marco Santos wrote:
 
 Hello there!
 
 I'm with problems refreshing an Image. On my web application i'm trying to
 refresh or change an Image that is on a Panel. On the panel there is a
 Image (it is rendered the first time) and a label. Outside the panel i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the link
 is clicked, the label e refreshed with the new text, but the image still
 the same. The code is the following:
 
 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
 /** Creates a new instance of PhotoPanel*/
 public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
 super(id);
 setOutputMarkupId(true);
 
 MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
 mainPhoto.setOutputMarkupId(true);
 
 Label label = new Label(index, MYLABEL:  + index.toString());
 
 add(mainPhoto);
 add(label);
 }
 }
 
 /** 
  * The AjaxLink's on a Parent panel that holds a panel with the links, and
 the panel with the image
  * to be refreshed
  **/
 private class PhotoSlideLink extends AjaxLink {
 private byte[] photoSlideData = null;
 Integer index = 0;
 public PhotoSlideLink(String id, byte[] photoSlideData ) {
 super(id);
 this.photoSlideData = photoSlideData ;
 
 MyImage photoSlide = new MyImage(photoSlide, photoSlideData
 , 100);
 add(photoSlide );
 }
 
 @Override
 public void onClick(AjaxRequestTarget ajaxRequestTarget) {
 Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel,
 photoSlideData , MAIN_PHOTO_SIZE, index++);
 newMainPhotoPanel .setOutputMarkupId(true);
 
 /*the first PhotoPanel created when the page was loaded*/
 mainPhotoPanel.replaceWith(newMainPhotoPanel);
 mainPhotoPanel= newMainPhotoPanel ;
 
 ajaxRequestTarget.addComponent(newMainPhotoPanel);
 }
 }
 
 Does any one know why refreshing the panel, the label change, but not the
 image? Am i forgetting to do something? 
 
 Thanks a lot 
 

-- 
View this message in context: 
http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22376598.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: What javascript event trigger component update?

2009-03-06 Thread Igor Vaynberg
hide a div around the panel, wait for panel update, and then show the
div around it

there is iajaxcalldecorator that will allow you to insert javascript
for onsuccess/onfailure callbacks on the clientside.

-igor

On Fri, Mar 6, 2009 at 6:19 AM, Daniele Dellafiore ilde...@gmail.com wrote:
 Hi everyone.

 I have this problem:

 a panel with a list is hided via a jquery hide(). It works but this
 panel is also refreshed via a wicket AjaxTimerBehavior.
 So when the page is loaded, I call the jquery hide() and at the first
 onTimer() the panel is refreshed and become visible.

 How can I avoid this *without* any flickering effect?
 What is the event that arrives to the component before it is refreshed?

 Make this panel visible/invisible can be a solution but I prefer
 relying on ajax toolkit to manage this sort of stuff.

 Thanks.

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

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



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



Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Zhubin Salehi

Here is the source code without tabs:

/* advanced search link */
add(new AjaxSubmitLink(advancedSearch) {

private static final long serialVersionUID = 3847759110695405700L;

@Override
protected void onSubmit(AjaxRequestTarget target, Form? form) {
advancedSearch = !advancedSearch;
target.addComponent(findUserAcountForm);
}
}.add(new NonCachingImage(expandCollapse, new ModelString() {

private static final long serialVersionUID = 3430522655787763141L;

@Override
public String getObject() {
return advancedSearch ? /img/collapse.gif : /img/expand.gif;
}
})));

I hope it's more readable this way :-)

Zhubin

Zhubin Salehi wrote:
 
 Hi guys,
 
 I have a similar problem that NonCachingImage does not solve. I have
 implemented a simple expand/collapse button. I check the rendered page
 source in FireFox and image name is always /img/expand.gif. Here is the
 code:
 
   /* advanced search link */
   add(new AjaxSubmitLink(advancedSearch) {
 
   private static final long serialVersionUID = 
 3847759110695405700L;
 
   @Override
   protected void onSubmit(AjaxRequestTarget 
 target, Form? form) {
   advancedSearch = !advancedSearch;
   target.addComponent(findUserAcountForm);
   }
   }.add(new NonCachingImage(expandCollapse, new 
 ModelString() {
 
   private static final long serialVersionUID = 
 3430522655787763141L;
 
   @Override
   public String getObject() {
   return advancedSearch ? 
 /img/collapse.gif : /img/expand.gif;
   }
   })));
 
 Thanks,
 Zhubin
 
 
 Marco Santos wrote:
 
 Hello there!
 
 I'm with problems refreshing an Image. On my web application i'm trying
 to refresh or change an Image that is on a Panel. On the panel there is a
 Image (it is rendered the first time) and a label. Outside the panel i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the link
 is clicked, the label e refreshed with the new text, but the image still
 the same. The code is the following:
 
 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
 /** Creates a new instance of PhotoPanel*/
 public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
 super(id);
 setOutputMarkupId(true);
 
 MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
 mainPhoto.setOutputMarkupId(true);
 
 Label label = new Label(index, MYLABEL:  + index.toString());
 
 add(mainPhoto);
 add(label);
 }
 }
 
 /** 
  * The AjaxLink's on a Parent panel that holds a panel with the links,
 and the panel with the image
  * to be refreshed
  **/
 private class PhotoSlideLink extends AjaxLink {
 private byte[] photoSlideData = null;
 Integer index = 0;
 public PhotoSlideLink(String id, byte[] photoSlideData ) {
 super(id);
 this.photoSlideData = photoSlideData ;
 
 MyImage photoSlide = new MyImage(photoSlide, photoSlideData
 , 100);
 add(photoSlide );
 }
 
 @Override
 public void onClick(AjaxRequestTarget ajaxRequestTarget) {
 Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel,
 photoSlideData , MAIN_PHOTO_SIZE, index++);
 newMainPhotoPanel .setOutputMarkupId(true);
 
 /*the first PhotoPanel created when the page was loaded*/
 mainPhotoPanel.replaceWith(newMainPhotoPanel);
 mainPhotoPanel= newMainPhotoPanel ;
 
 ajaxRequestTarget.addComponent(newMainPhotoPanel);
 }
 }
 
 Does any one know why refreshing the panel, the label change, but not the
 image? Am i forgetting to do something? 
 
 Thanks a lot 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22376853.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Igor Vaynberg
is advancedSearch inside findUserAccountForm?

-igor

On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi zhooz...@yahoo.com wrote:

 Here is the source code without tabs:

 /* advanced search link */
 add(new AjaxSubmitLink(advancedSearch) {

        private static final long serialVersionUID = 3847759110695405700L;

       �...@override
        protected void onSubmit(AjaxRequestTarget target, Form? form) {
                advancedSearch = !advancedSearch;
                target.addComponent(findUserAcountForm);
        }
 }.add(new NonCachingImage(expandCollapse, new ModelString() {

        private static final long serialVersionUID = 3430522655787763141L;

       �...@override
        public String getObject() {
                return advancedSearch ? /img/collapse.gif : 
 /img/expand.gif;
        }
 })));

 I hope it's more readable this way :-)

 Zhubin

 Zhubin Salehi wrote:

 Hi guys,

 I have a similar problem that NonCachingImage does not solve. I have
 implemented a simple expand/collapse button. I check the rendered page
 source in FireFox and image name is always /img/expand.gif. Here is the
 code:

                       /* advanced search link */
                       add(new AjaxSubmitLink(advancedSearch) {

                               private static final long serialVersionUID = 
 3847759110695405700L;

                               @Override
                               protected void onSubmit(AjaxRequestTarget 
 target, Form? form) {
                                       advancedSearch = !advancedSearch;
                                       
 target.addComponent(findUserAcountForm);
                               }
                       }.add(new NonCachingImage(expandCollapse, new 
 ModelString() {

                               private static final long serialVersionUID = 
 3430522655787763141L;

                               @Override
                               public String getObject() {
                                       return advancedSearch ? 
 /img/collapse.gif : /img/expand.gif;
                               }
                       })));

 Thanks,
 Zhubin


 Marco Santos wrote:

 Hello there!

 I'm with problems refreshing an Image. On my web application i'm trying
 to refresh or change an Image that is on a Panel. On the panel there is a
 Image (it is rendered the first time) and a label. Outside the panel i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the link
 is clicked, the label e refreshed with the new text, but the image still
 the same. The code is the following:

 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
     /** Creates a new instance of PhotoPanel*/
     public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
         super(id);
         setOutputMarkupId(true);

         MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
         mainPhoto.setOutputMarkupId(true);

         Label label = new Label(index, MYLABEL:  + index.toString());

         add(mainPhoto);
         add(label);
     }
 }

 /**
  * The AjaxLink's on a Parent panel that holds a panel with the links,
 and the panel with the image
  * to be refreshed
  **/
 private class PhotoSlideLink extends AjaxLink {
         private byte[] photoSlideData = null;
         Integer index = 0;
         public PhotoSlideLink(String id, byte[] photoSlideData ) {
             super(id);
             this.photoSlideData = photoSlideData ;

             MyImage photoSlide = new MyImage(photoSlide, photoSlideData
 , 100);
             add(photoSlide );
         }

         @Override
         public void onClick(AjaxRequestTarget ajaxRequestTarget) {
             Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel,
 photoSlideData , MAIN_PHOTO_SIZE, index++);
             newMainPhotoPanel .setOutputMarkupId(true);

             /*the first PhotoPanel created when the page was loaded*/
             mainPhotoPanel.replaceWith(newMainPhotoPanel);
             mainPhotoPanel= newMainPhotoPanel ;

             ajaxRequestTarget.addComponent(newMainPhotoPanel);
         }
     }

 Does any one know why refreshing the panel, the label change, but not the
 image? Am i forgetting to do something?

 Thanks a lot




 --
 View this message in context: 
 http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22376853.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



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

Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Zhubin Salehi

advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in a
PanelCachingTab in FindUserAcountForm.

Zhubin


igor.vaynberg wrote:
 
 is advancedSearch inside findUserAccountForm?
 
 -igor
 
 On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi zhooz...@yahoo.com wrote:

 Here is the source code without tabs:

 /* advanced search link */
 add(new AjaxSubmitLink(advancedSearch) {

        private static final long serialVersionUID = 3847759110695405700L;

       �...@override
        protected void onSubmit(AjaxRequestTarget target, Form? form) {
                advancedSearch = !advancedSearch;
                target.addComponent(findUserAcountForm);
        }
 }.add(new NonCachingImage(expandCollapse, new ModelString() {

        private static final long serialVersionUID = 3430522655787763141L;

       �...@override
        public String getObject() {
                return advancedSearch ? /img/collapse.gif :
 /img/expand.gif;
        }
 })));

 I hope it's more readable this way :-)

 Zhubin

 Zhubin Salehi wrote:

 Hi guys,

 I have a similar problem that NonCachingImage does not solve. I have
 implemented a simple expand/collapse button. I check the rendered page
 source in FireFox and image name is always /img/expand.gif. Here is
 the
 code:

                       /* advanced search link */
                       add(new AjaxSubmitLink(advancedSearch) {

                               private static final long serialVersionUID
 = 3847759110695405700L;

                               @Override
                               protected void onSubmit(AjaxRequestTarget
 target, Form? form) {
                                       advancedSearch = !advancedSearch;
                                      
 target.addComponent(findUserAcountForm);
                               }
                       }.add(new NonCachingImage(expandCollapse, new
 ModelString() {

                               private static final long serialVersionUID
 = 3430522655787763141L;

                               @Override
                               public String getObject() {
                                       return advancedSearch ?
 /img/collapse.gif : /img/expand.gif;
                               }
                       })));

 Thanks,
 Zhubin


 Marco Santos wrote:

 Hello there!

 I'm with problems refreshing an Image. On my web application i'm trying
 to refresh or change an Image that is on a Panel. On the panel there is
 a
 Image (it is rendered the first time) and a label. Outside the panel i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the
 link
 is clicked, the label e refreshed with the new text, but the image
 still
 the same. The code is the following:

 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
     /** Creates a new instance of PhotoPanel*/
     public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
         super(id);
         setOutputMarkupId(true);

         MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
         mainPhoto.setOutputMarkupId(true);

         Label label = new Label(index, MYLABEL:  +
 index.toString());

         add(mainPhoto);
         add(label);
     }
 }

 /**
  * The AjaxLink's on a Parent panel that holds a panel with the links,
 and the panel with the image
  * to be refreshed
  **/
 private class PhotoSlideLink extends AjaxLink {
         private byte[] photoSlideData = null;
         Integer index = 0;
         public PhotoSlideLink(String id, byte[] photoSlideData ) {
             super(id);
             this.photoSlideData = photoSlideData ;

             MyImage photoSlide = new MyImage(photoSlide,
 photoSlideData
 , 100);
             add(photoSlide );
         }

         @Override
         public void onClick(AjaxRequestTarget ajaxRequestTarget) {
             Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel,
 photoSlideData , MAIN_PHOTO_SIZE, index++);
             newMainPhotoPanel .setOutputMarkupId(true);

             /*the first PhotoPanel created when the page was loaded*/
             mainPhotoPanel.replaceWith(newMainPhotoPanel);
             mainPhotoPanel= newMainPhotoPanel ;

             ajaxRequestTarget.addComponent(newMainPhotoPanel);
         }
     }

 Does any one know why refreshing the panel, the label change, but not
 the
 image? Am i forgetting to do something?

 Thanks a lot




 --
 View this message in context:
 http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22376853.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How can I injecting a Springbean into a custom session.

2009-03-06 Thread CrocodileShoes

By the way is this safe to use in any Wicket component, for example, a Panel?

I can't think of any reason why not, but this is my first foray into web
development.
-- 
View this message in context: 
http://www.nabble.com/How-can-I-inject-a-Springbean-into-a-custom-session.-tp22340379p22377028.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How can I injecting a Springbean into a custom session.

2009-03-06 Thread Leszek Gawron

CrocodileShoes wrote:

By the way is this safe to use in any Wicket component, for example, a Panel?

I can't think of any reason why not, but this is my first foray into web
development.


Yes it is. @SpringBean creates a proxy to your spring bean so there are 
no serialization issues.


--
Leszek Gawron

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



Re: Wizard and onSubmit of nested form

2009-03-06 Thread Dave Schoorl

Hi Robert, thanks for your quick reply.

I am not sure if I understand what you mean. How is form validation 
helping with the trigger of onSubmit() on the correct form?
But I gave it a try and the problem remains: the onSubmit of the next 
step is called instead of the current step. I think that first the panel 
of the current step is replaced with the panel of the next step and then 
the onSubmit is executed.


Hope someone can help me.

Regards,
Dave


rmattler wrote:

Use public void validate(Form form)

See example below.  Hope it helps.


private final class Step2 extends WizardStep {
public Step2() {
setTitleModel(new Model(Add pictures));

add(new AbstractFormValidator() {
public FormComponent[] 
getDependentFormComponents() {
return null;
}

public void validate(Form form) {

String dir = 
Constants.ADD_PROJECT_FILE_PIC_PATH +
getProjects().getTblId();

File filesDir = new File(dir);
if (filesDir.canRead() || 
filesDir.isDirectory()) {
String[] fileNames = 
filesDir.list();
if (fileNames.length  0) {

getProjects().setNumPhotos(fileNames.length);
} else {
form.error(Please upload 
some photos);
}
} else {
form.error(Please upload some 
photos);
}

}
});

}
}

Dave Schoorl wrote:
  

Hi all,

I am building my first Wizard with the wizard from wicket-extensions 
version 1.3.5. Every step contains a panel with it's own form, so I have 
a nested form in the wizards form. I was expecting that when I click 
next, the onSubmit of my current form is called, but it's not. Instead 
the onSubmit of the form in the next step is called.


This seems to be related: http://markmail.org/message/ktpvzvslq5tupo6x

Am I doing something wrong?

Regards,
Dave


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






  



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



Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Zhubin Salehi

I figured out if the page starts with 'advancedSearch = false' the image is
always expand.gif and if it starts with 'advancedSearch = true' the image is
always collapse.gif. So the value of Model object is cached somewhere, but
not in the browser for sure.

What I don't understand is that every time the panel is rendered,
getObject() method is called but apparently the return value is ignored.



Zhubin Salehi wrote:
 
 advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in
 a PanelCachingTab in FindUserAcountForm.
 
 Zhubin
 
 
 igor.vaynberg wrote:
 
 is advancedSearch inside findUserAccountForm?
 
 -igor
 
 On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi zhooz...@yahoo.com wrote:

 Here is the source code without tabs:

 /* advanced search link */
 add(new AjaxSubmitLink(advancedSearch) {

        private static final long serialVersionUID =
 3847759110695405700L;

       �...@override
        protected void onSubmit(AjaxRequestTarget target, Form? form) {
                advancedSearch = !advancedSearch;
                target.addComponent(findUserAcountForm);
        }
 }.add(new NonCachingImage(expandCollapse, new ModelString() {

        private static final long serialVersionUID =
 3430522655787763141L;

       �...@override
        public String getObject() {
                return advancedSearch ? /img/collapse.gif :
 /img/expand.gif;
        }
 })));

 I hope it's more readable this way :-)

 Zhubin

 Zhubin Salehi wrote:

 Hi guys,

 I have a similar problem that NonCachingImage does not solve. I have
 implemented a simple expand/collapse button. I check the rendered page
 source in FireFox and image name is always /img/expand.gif. Here is
 the
 code:

                       /* advanced search link */
                       add(new AjaxSubmitLink(advancedSearch) {

                               private static final long
 serialVersionUID = 3847759110695405700L;

                               @Override
                               protected void onSubmit(AjaxRequestTarget
 target, Form? form) {
                                       advancedSearch = !advancedSearch;
                                      
 target.addComponent(findUserAcountForm);
                               }
                       }.add(new NonCachingImage(expandCollapse, new
 ModelString() {

                               private static final long
 serialVersionUID = 3430522655787763141L;

                               @Override
                               public String getObject() {
                                       return advancedSearch ?
 /img/collapse.gif : /img/expand.gif;
                               }
                       })));

 Thanks,
 Zhubin


 Marco Santos wrote:

 Hello there!

 I'm with problems refreshing an Image. On my web application i'm
 trying
 to refresh or change an Image that is on a Panel. On the panel there
 is a
 Image (it is rendered the first time) and a label. Outside the panel i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the
 link
 is clicked, the label e refreshed with the new text, but the image
 still
 the same. The code is the following:

 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
     /** Creates a new instance of PhotoPanel*/
     public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
         super(id);
         setOutputMarkupId(true);

         MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
         mainPhoto.setOutputMarkupId(true);

         Label label = new Label(index, MYLABEL:  +
 index.toString());

         add(mainPhoto);
         add(label);
     }
 }

 /**
  * The AjaxLink's on a Parent panel that holds a panel with the links,
 and the panel with the image
  * to be refreshed
  **/
 private class PhotoSlideLink extends AjaxLink {
         private byte[] photoSlideData = null;
         Integer index = 0;
         public PhotoSlideLink(String id, byte[] photoSlideData ) {
             super(id);
             this.photoSlideData = photoSlideData ;

             MyImage photoSlide = new MyImage(photoSlide,
 photoSlideData
 , 100);
             add(photoSlide );
         }

         @Override
         public void onClick(AjaxRequestTarget ajaxRequestTarget) {
             Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel,
 photoSlideData , MAIN_PHOTO_SIZE, index++);
             newMainPhotoPanel .setOutputMarkupId(true);

             /*the first PhotoPanel created when the page was loaded*/
             mainPhotoPanel.replaceWith(newMainPhotoPanel);
             mainPhotoPanel= newMainPhotoPanel ;

             ajaxRequestTarget.addComponent(newMainPhotoPanel);
         }
     }

 Does any one know why refreshing the panel, the label change, but not
 the
 image? Am i 

Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Zhubin Salehi

I figured out if the page starts with 'advancedSearch = false' the image is
always expand.gif and if it starts with 'advancedSearch = true' the image is
always collapse.gif. So the value of Model object is cached somewhere, but
not in the browser for sure.

What I don't understand is that every time the panel is rendered,
getObject() method is called but apparently the return value is ignored.



Zhubin Salehi wrote:
 
 advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in
 a PanelCachingTab in FindUserAcountForm.
 
 Zhubin
 
 
 igor.vaynberg wrote:
 
 is advancedSearch inside findUserAccountForm?
 
 -igor
 
 On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi zhooz...@yahoo.com wrote:

 Here is the source code without tabs:

 /* advanced search link */
 add(new AjaxSubmitLink(advancedSearch) {

        private static final long serialVersionUID =
 3847759110695405700L;

       �...@override
        protected void onSubmit(AjaxRequestTarget target, Form? form) {
                advancedSearch = !advancedSearch;
                target.addComponent(findUserAcountForm);
        }
 }.add(new NonCachingImage(expandCollapse, new ModelString() {

        private static final long serialVersionUID =
 3430522655787763141L;

       �...@override
        public String getObject() {
                return advancedSearch ? /img/collapse.gif :
 /img/expand.gif;
        }
 })));

 I hope it's more readable this way :-)

 Zhubin

 Zhubin Salehi wrote:

 Hi guys,

 I have a similar problem that NonCachingImage does not solve. I have
 implemented a simple expand/collapse button. I check the rendered page
 source in FireFox and image name is always /img/expand.gif. Here is
 the
 code:

                       /* advanced search link */
                       add(new AjaxSubmitLink(advancedSearch) {

                               private static final long
 serialVersionUID = 3847759110695405700L;

                               @Override
                               protected void onSubmit(AjaxRequestTarget
 target, Form? form) {
                                       advancedSearch = !advancedSearch;
                                      
 target.addComponent(findUserAcountForm);
                               }
                       }.add(new NonCachingImage(expandCollapse, new
 ModelString() {

                               private static final long
 serialVersionUID = 3430522655787763141L;

                               @Override
                               public String getObject() {
                                       return advancedSearch ?
 /img/collapse.gif : /img/expand.gif;
                               }
                       })));

 Thanks,
 Zhubin


 Marco Santos wrote:

 Hello there!

 I'm with problems refreshing an Image. On my web application i'm
 trying
 to refresh or change an Image that is on a Panel. On the panel there
 is a
 Image (it is rendered the first time) and a label. Outside the panel i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the
 link
 is clicked, the label e refreshed with the new text, but the image
 still
 the same. The code is the following:

 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
     /** Creates a new instance of PhotoPanel*/
     public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
         super(id);
         setOutputMarkupId(true);

         MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
         mainPhoto.setOutputMarkupId(true);

         Label label = new Label(index, MYLABEL:  +
 index.toString());

         add(mainPhoto);
         add(label);
     }
 }

 /**
  * The AjaxLink's on a Parent panel that holds a panel with the links,
 and the panel with the image
  * to be refreshed
  **/
 private class PhotoSlideLink extends AjaxLink {
         private byte[] photoSlideData = null;
         Integer index = 0;
         public PhotoSlideLink(String id, byte[] photoSlideData ) {
             super(id);
             this.photoSlideData = photoSlideData ;

             MyImage photoSlide = new MyImage(photoSlide,
 photoSlideData
 , 100);
             add(photoSlide );
         }

         @Override
         public void onClick(AjaxRequestTarget ajaxRequestTarget) {
             Panel newMainPhotoPanel = new PhotoPanel(mainPhotoPanel,
 photoSlideData , MAIN_PHOTO_SIZE, index++);
             newMainPhotoPanel .setOutputMarkupId(true);

             /*the first PhotoPanel created when the page was loaded*/
             mainPhotoPanel.replaceWith(newMainPhotoPanel);
             mainPhotoPanel= newMainPhotoPanel ;

             ajaxRequestTarget.addComponent(newMainPhotoPanel);
         }
     }

 Does any one know why refreshing the panel, the label change, but not
 the
 image? Am i 

Re: How can I injecting a Springbean into a custom session.

2009-03-06 Thread Warren Bell
Do you still have to use addComponentInstantiationListener(new 
SpringComponentInjector(this)) in your WebApplication#init() in order to 
use @SpringBean in sub classes of Component or is that done 
automatically now?


Warren


Igor Vaynberg wrote:


all subclasses of Component are injected automatically, you only need to do
this in classes outside the Component hierarchy.

-igor

On Fri, Mar 6, 2009 at 9:32 AM, CrocodileShoes markjohndo...@googlemail.com
  

wrote:



  

By the way is this safe to use in any Wicket component, for example, a
Panel?

I can't think of any reason why not, but this is my first foray into web
development.
--
View this message in context:
http://www.nabble.com/How-can-I-inject-a-Springbean-into-a-custom-session.-tp22340379p22377028.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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





  



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



Re: How can I injecting a Springbean into a custom session.

2009-03-06 Thread Igor Vaynberg
you still have to do it, that is what enables @SpringBean inside components

-igor

On Fri, Mar 6, 2009 at 11:32 AM, Warren Bell warrenbe...@gmail.com wrote:

 Do you still have to use addComponentInstantiationListener(new
 SpringComponentInjector(this)) in your WebApplication#init() in order to use
 @SpringBean in sub classes of Component or is that done automatically now?

 Warren



 Igor Vaynberg wrote:

  all subclasses of Component are injected automatically, you only need to
 do
 this in classes outside the Component hierarchy.

 -igor

 On Fri, Mar 6, 2009 at 9:32 AM, CrocodileShoes 
 markjohndo...@googlemail.com


 wrote:





 By the way is this safe to use in any Wicket component, for example, a
 Panel?

 I can't think of any reason why not, but this is my first foray into web
 development.
 --
 View this message in context:

 http://www.nabble.com/How-can-I-inject-a-Springbean-into-a-custom-session.-tp22340379p22377028.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


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









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




Ajax table/grid questions

2009-03-06 Thread Seven Corners

I have to write a table that updates via AJAX on a timer that polls data from
the server (the data comes as collection, not as a database call).  

My first question is what class I need to use; I've looked at a few of the
available classes and I think the AjaxFallbackDefaultDataTable is too
heavyweight because I don't need to sort or page.  I need to use my own CSS
and I also need to set the background colors of cells dependent upon the
values in the model.  It looks like a DataView would be adequate with a
provider that wraps a LoadableDetachableModel if I hook it up to a timer and
set the output markup ID to true.  

So if I'm using a DataView, I get stumped at a point that should be easy. 
All the examples let you instantiate a DataView but I'm using Wicket 1.4-m3
and DataView is abstract, so I'd have to subclass it and provide my own
HTML.  Fine, but I can't figure out how to plug the table into its parent
panel.

So if I have in the enclosing panel:

html
body
  wicket:panel
  ...
  table wicket:id=storageUnits class=fullTabWidth
cellspacing=0/table  
  /wicket:panel
/body
/html

and I've called my DataView subclass StorageUnitAJAXDataView, then in my
enclosing panel, the code:

StorageUnitAJAXDataView dataView = new StorageUnitAJAXDataView(
storageUnits, new StorageServerUnitsDataProvider( m_strClientRole,
m_strPlatformId ) );

isn't going to work.  According to the sample, I need to make the ID the ID
of the repeating rows.  My HTML for the DataView looks like this:

html
body
  wicket:extend
 table class=fullTabWidth cellspacing=0
thead class=tableGridheader
  tr
th/th
th/th
th/th
th/th
th/th
th/th
  /tr
/thead
tbody class=tableGrid
  tr wicket:id=storageUnitStatus
td/td
td/td
td/td
td/td
td/td
td/td  
  /tr
/tbody
  /table  
  /wicket:extend
/body
/html

So the real question is, since I have to subclass and have a separate HTML
file for the DataView, how do I get the right ID in there?  What should the
HTML look like?

-- 
View this message in context: 
http://www.nabble.com/Ajax-table-grid-questions-tp22379387p22379387.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Problems Refreshin a Image from AjaxLink

2009-03-06 Thread Zhubin Salehi

OK I couldn't figure out what was wrong so I did it as a last resort:

/* advanced search link */
AjaxSubmitLink advancedSearchLink;
mainTable.add(advancedSearchLink = new AjaxSubmitLink(advancedSearch) {

private static final long serialVersionUID = 4373219220751138123L;

@Override
protected void onSubmit(AjaxRequestTarget target, Form? form) {
advancedSearch = !advancedSearch;
target.addComponent(mainTable);
}
});
advancedSearchLink.add(new WebComponent(expand) {

private static final long serialVersionUID = 1566267580506427230L;

@Override
public boolean isVisible() {
return !advancedSearch;
}
});
advancedSearchLink.add(new WebComponent(collapse) {

private static final long serialVersionUID = 4204455496315941511L;

@Override
public boolean isVisible() {
return advancedSearch;
}
});

It's not the best way to go, but it works.

Zhubin


Zhubin Salehi wrote:
 
 I figured out if the page starts with 'advancedSearch = false' the image
 is always expand.gif and if it starts with 'advancedSearch = true' the
 image is always collapse.gif. So the value of Model object is cached
 somewhere, but not in the browser for sure.
 
 What I don't understand is that every time the panel is rendered,
 getObject() method is called but apparently the return value is ignored.
 
 
 
 Zhubin Salehi wrote:
 
 advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in
 a PanelCachingTab in FindUserAcountForm.
 
 Zhubin
 
 
 igor.vaynberg wrote:
 
 is advancedSearch inside findUserAccountForm?
 
 -igor
 
 On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi zhooz...@yahoo.com
 wrote:

 Here is the source code without tabs:

 /* advanced search link */
 add(new AjaxSubmitLink(advancedSearch) {

        private static final long serialVersionUID =
 3847759110695405700L;

       �...@override
        protected void onSubmit(AjaxRequestTarget target, Form? form)
 {
                advancedSearch = !advancedSearch;
                target.addComponent(findUserAcountForm);
        }
 }.add(new NonCachingImage(expandCollapse, new ModelString() {

        private static final long serialVersionUID =
 3430522655787763141L;

       �...@override
        public String getObject() {
                return advancedSearch ? /img/collapse.gif :
 /img/expand.gif;
        }
 })));

 I hope it's more readable this way :-)

 Zhubin

 Zhubin Salehi wrote:

 Hi guys,

 I have a similar problem that NonCachingImage does not solve. I have
 implemented a simple expand/collapse button. I check the rendered page
 source in FireFox and image name is always /img/expand.gif. Here is
 the
 code:

                       /* advanced search link */
                       add(new AjaxSubmitLink(advancedSearch) {

                               private static final long
 serialVersionUID = 3847759110695405700L;

                               @Override
                               protected void
 onSubmit(AjaxRequestTarget target, Form? form) {
                                       advancedSearch =
 !advancedSearch;
                                      
 target.addComponent(findUserAcountForm);
                               }
                       }.add(new NonCachingImage(expandCollapse, new
 ModelString() {

                               private static final long
 serialVersionUID = 3430522655787763141L;

                               @Override
                               public String getObject() {
                                       return advancedSearch ?
 /img/collapse.gif : /img/expand.gif;
                               }
                       })));

 Thanks,
 Zhubin


 Marco Santos wrote:

 Hello there!

 I'm with problems refreshing an Image. On my web application i'm
 trying
 to refresh or change an Image that is on a Panel. On the panel there
 is a
 Image (it is rendered the first time) and a label. Outside the panel
 i
 have AjaxLink's (that are images too) that refresh the panel, and
 consequently the components on it, the image and the label. when the
 link
 is clicked, the label e refreshed with the new text, but the image
 still
 the same. The code is the following:

 /**
  *The Panel with the image to be refreshed:
  *(the label on the panel is freshed when the link is pressed.
  **/
 public class PhotoPanel extends Panel {
     /** Creates a new instance of PhotoPanel*/
     public PhotoPanel(String id, byte[] photoData, int size, Integer
 index) {
         super(id);
         setOutputMarkupId(true);

         MyImage mainPhoto = new MyImage(mainPhoto, photoData,
 size);//component that extends Image
         mainPhoto.setOutputMarkupId(true);

         Label label = new Label(index, MYLABEL:  +
 index.toString());

         add(mainPhoto);
         add(label);
     }
 }

 /**
  * The AjaxLink's on a Parent panel that holds a panel with the
 links,
 and the panel 

Creating a brandable or white label type of application

2009-03-06 Thread Tauren Mills
I'm looking for thoughts on ways to create a site that can be branded
by a customer.  It should do the following:

* run in a single webapp deployed in a WAR file
* multiple host names resolve to this same web app
   domain1.com - myapp.com
   domain2.com -- myapp.com
* based on the host name, the app selects a skin (color scheme,
images, maybe even layout changes)
* users need to be able to alter colors, images, and layout in real
time, so updating the WAR with new skins isn't possible
* need to pull alternate CSS content and perhaps HTML markup from a
database and images from a location outside of the WAR.

This needs to be kind of like blogger.com, where a user can change
images and colors, and the application displays their blog that way.
But in my case, the content on the page primarily remains the same,
just the way it is presented changes.

So I'm looking at the localization and style features thinking they
might help.  But they rely on alternate versions of files to be in the
WAR.
http://cwiki.apache.org/WICKET/localization-and-skinning-of-applications.html

What methods would you recommend to get the current hostname from the request?
Whould this be best done in the RequestCycle, the Session, or?
What techniques would be useful for using external CSS, images, and HTML?
Will getStyle/setStyle even help since the content is external of the WAR?

I realize that I shouldn't allow users to modify HTML markup that
contains wicket tags.  That could break things very quickly.

I'm just starting to think about how to do this, so I'm looking for
any suggestions to direct me to the right tools for the job.

Thanks,
Tauren

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



Re: localization and session expiration

2009-03-06 Thread ElSe

Thanks for your answers! It is quite good idea with cookies and header...
Unfortunately it will not work if the user turns off cookies in his
browser... but I think in this case he can thank himself for such
inconvenience :

BR,
Elena.


Anton Veretennikov wrote:
 
 If cookie is already set, get it and use, if no then set it as browser's
 getLocale() and save to cookie.
 
 To get cookies:
 
 Cookie[] cookies =
 ((WebRequest)getRequestCycle().getRequest()).getCookies();
 if (cookies!=null) {
 for (int i = 0; i  cookies.length; i++) {
   Cookie cookie = cookies[i];
   ...
 }
 }
 
 To set cookie:
 
 Cookie cookie = new Cookie(language, selectedLanguage);
 cookie.setMaxAge(2678400); //31 день
 ((WebResponse) getRequestCycle().getResponse()).addCookie(cookie);
 
 -- Tony
 
 On Fri, Mar 6, 2009 at 7:26 PM, Jonas barney...@gmail.com wrote:
 
 No need to use spring for that, the locale of a WebSession is
 initialized from ServletRequest#getLocale()
 by default, which is based on the Accept-Language header.

 On Fri, Mar 6, 2009 at 12:57 PM, Leszek Gawron lgaw...@apache.org
 wrote:
  Anton Veretennikov wrote:
 
  May be cookie?
 
  You can also try to extract the locale used by user in the browser from
  request header:
 
 
 http://www.acegisecurity.org/guide/springsecurity.html#concurrent-sessions
 
  GET /guide/springsecurity.html HTTP/1.1
  Host: www.acegisecurity.org
  User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
 rv:1.9.0.6)
  Gecko/2009011913 Firefox/3.0.6
  Accept:
 text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: pl,en;q=0.7,en-us;q=0.3
 
^
 
  Accept-Encoding: gzip,deflate
  Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
  Keep-Alive: 300
  Connection: keep-alive
  Referer: http://www.acooke.org/cute/SessionLim0.html
  If-Modified-Since: Tue, 15 Apr 2008 17:18:26 GMT
  If-None-Match: 28002-5ba09-44aec96961c80
  Cache-Control: max-age=0
 
  HTTP/1.x 304 Not Modified
  Date: Fri, 06 Mar 2009 11:52:59 GMT
  Server: Apache/2.2.8 (EL)
  Connection: close
  Etag: 28002-5ba09-44aec96961c80
 
  Spring can resolve locale for you in a flexible manner:
 
 
 http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/LocaleResolver.html
 
  in your case:
 
 
 http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/web/servlet/i18n/AcceptHeaderLocaleResolver.html
 
  To integrate wicket with spring in this context override
  WebApplication.newSession:
 
  @Override
  public Session newSession( Request request, Response response ) {
 return new WebSession( request ) {
 @Override
 public Locale getLocale() {
 return LocaleContextHolder.getLocale();
 }
 };
  }
 
 
  --
  Leszek Gawron
 
  -
  To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
  For additional commands, e-mail: users-h...@wicket.apache.org
 
 

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


 
 

-- 
View this message in context: 
http://www.nabble.com/localization-and-session-expiration-tp22366384p22384529.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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