Graceful Session Expiry

2011-06-09 Thread Arjun Dhar
Hi,
 I want to be able to show a Warning message appear when the session is
about to expire (say 5 minutes before) and if the session has expired then
on the UI it should come. This is to ensure a User does not enter any data
and lose it when they click Submit.

Use Case I wanna prevent: Lazy User goes for Coffee, comes back completes
Form, presses Submit ...curses me!

thanks

-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584660.html
Sent from the Users forum 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



Binding selected values from a ListView into a Mode

2011-06-09 Thread Nivedan Nadaraj
Hi All,

I have a problem to deal with binding selected values into a model within a
ListView. I have tried to outline the approach and class definitions out
here. I hope I have been clear. Would appreciate your thoughts on the design
and approach i have taken so far. I guess am pretty close to it just one
hurdle.


public class MainVO{
private ListUserModuleRole userRoleList;
}
public class UserModuleRole{
private Role role;
private Module module;
private User user;
}


*Problem:*
1. I want to list the modules and the roles available for each module in a
list view.
2. Select a Role from  each module  for a user
3. Save - Will have the user linked to one or more modules with a role for
each.(only one role per module)

*Approach*

I used a ListView and rendered the list of modules and their respective
roles in a drop down. To render this List view these are the steps I took.

public class ModuleVO implements Serializable{

private Module module;
private ListRole moduleRoles;
}


1. I get a Collection/List of ModuleVO via the service. The collection will
have a ModuleVO per module with the associated roles as a member.
2. I iterated the list and rendered the Module and render a DropDownChoice
3. End of which I get the following output in the list
*
Output from List view*:

Module   Role

Module-A   Role-1
 Role-2

Module-B   Role-3
 Role-4

What I have not done and not clear is:
4. At this time I have not bound a Model to the dropdown and just used new
Model() for the Model argument of dropDownChoice.

I know that the selected values must eventually be in the MainVO's
ListUserModuleRole userRoleList property.

What is not very clear to me at this point is how to bind it ...so that when
the user saves the selected values are captured. I am sure this is possible
and should be elegant. Your thoughts and time will be of great value.

Many thanks
Regards


Re: Binding selected values from a ListView into a Mode

2011-06-09 Thread Per Newgro

Am 09.06.2011 09:01, schrieb Nivedan Nadaraj:

Hi All,

I have a problem to deal with binding selected values into a model within a
ListView. I have tried to outline the approach and class definitions out
here. I hope I have been clear. Would appreciate your thoughts on the design
and approach i have taken so far. I guess am pretty close to it just one
hurdle.


public class MainVO{
 private ListUserModuleRole  userRoleList;
}
public class UserModuleRole{
 private Role role;
 private Module module;
 private User user;
}


*Problem:*
1. I want to list the modules and the roles available for each module in a
list view.
2. Select a Role from  each module  for a user
3. Save - Will have the user linked to one or more modules with a role for
each.(only one role per module)

*Approach*

I used a ListView and rendered the list of modules and their respective
roles in a drop down. To render this List view these are the steps I took.

public class ModuleVO implements Serializable{

 private Module module;
 private ListRole  moduleRoles;
}


1. I get a Collection/List of ModuleVO via the service. The collection will
have a ModuleVO per module with the associated roles as a member.
2. I iterated the list and rendered the Module and render a DropDownChoice
3. End of which I get the following output in the list
*
Output from List view*:

Module   Role

Module-A   Role-1
  Role-2

Module-B   Role-3
  Role-4

What I have not done and not clear is:
4. At this time I have not bound a Model to the dropdown and just used new
Model() for the Model argument of dropDownChoice.

I know that the selected values must eventually be in the MainVO's
ListUserModuleRole  userRoleList property.

What is not very clear to me at this point is how to bind it ...so that when
the user saves the selected values are captured. I am sure this is possible
and should be elegant. Your thoughts and time will be of great value.

Many thanks
Regards

Instanciate the MainVO with a UserModuleRole for every Module and the 
known user. The role

has only to be loaded if it's already assigned. That is the base.
If your listview is on a panel / form - give it the MainVO instance.
Set the MainVO.userRoleList to the ListView by using a 
PropertyModelListUserModuleRole.
In ListView.populateItem you get every single UserModuleRole. Render the 
UserModuleRole to the

ListViewItem.
The DDC for the roles gets a PropertyModel pointing to the 
UserModuleRole of the ListViewItem.
The selectable Roles have to be provided by a LoadableDetachableModel 
calling your service.


Hth
Cheers
Per

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



Re: navigation menu

2011-06-09 Thread hubert_hupe
hi,

thanks for the hint thats the thing iam looking for. unfortunately i cannot run 
the example. i get the following error message: Index cannot be resolved to a 
type
there is no method or class names Index...

regards
hubert

private ListMenuItem buildMenu() {
//Create one seperator menu item
MenuItem seperatorMenuItem = new MenuItem(true);
//Define Primary Menu items (menuText,destinationWebPage)   
//MenuItem primaryMenu1 = new MenuItem(MENU 1, new Index());
   
  MenuItem primaryMenu1 = new MenuItem(MENU 1, new Index());  ERROR Index 
cannot be resolved to a type


Am 08.06.2011 um 17:51 schrieb Fatih Mehmet Ucar:

 http://code.google.com/p/wicket-menu/
 
 Not complete but if you see the source code, it will give you an idea.
 
 cheers,
 -fatih
 
 On 8 June 2011 16:28, hubert_hupe hubert_h...@gmx.de wrote:
 hi guys,
 
 i have no clue how to create a simple navigation bar like this: 
 http://net.tutsplus.com/tutorials/javascript-ajax/a-different-top-navigation/
 if possible i need images for the headlines.
 when you move the mouse over the menu it drops down - there are millions of 
 website with this functionality.
 the problem is: i have to ceate the menu dynamically. the informations which 
 menuitem should be in the menu comes from the database. so i cannot use a 
 static javascript code in the html file.
 is anybody there who can give me a hint or even an example?
 
 best regards
 
 hubert
 -
 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: Binding selected values from a ListView into a Mode

2011-06-09 Thread Madan Mohan
Hi,
I am using wicket:enclosureto hide some rows in a table.

Take for ex.,
 trtd Phone: span wicket:id=phoneNumber//td/tr
 wicket:enclosure
trtd Fax: span wicket:id=faxNumbertd/tr
 /wicket:enclosure

Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
Later based on some user action, i want to make faxNumber to *visible*.

How to do this?

regards,
*Madan*
*www.educator.eu*


need help using wicket:enclosure tag.

2011-06-09 Thread Madan Mohan
Hi,
I am using wicket:enclosureto hide some rows in a table.

Take for ex.,
 trtd Phone: span wicket:id=phoneNumber//td
/tr
 wicket:enclosure
trtd Fax: span wicket:id=faxNumbertd/tr
 /wicket:enclosure

Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
Later based on some user action, i want to make faxNumber to *visible*.

How to do this?


-- 

regards,
*Madan*
*www.educator.eu*


Re: need help using wicket:enclosure tag.

2011-06-09 Thread Martin Grigorov
Just make faxNumber component visible and re-render the page.

If you use ajax then you'll have to re-render the repeater's parent

On Thu, Jun 9, 2011 at 10:10 AM, Madan Mohan mmo...@educator.eu wrote:
 Hi,
        I am using wicket:enclosureto hide some rows in a table.

 Take for ex.,
         trtd Phone: span wicket:id=phoneNumber//td
 /tr
         wicket:enclosure
                    trtd Fax: span wicket:id=faxNumbertd/tr
         /wicket:enclosure

 Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
 Later based on some user action, i want to make faxNumber to *visible*.

 How to do this?


 --

 regards,
 *Madan*
 *www.educator.eu*




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: wicket production statistics

2011-06-09 Thread rebecca
Thanks Martin - the list is impressive, but it would really help me if I also
had a list of big IT companies other well banks/ organizations that use
wicket in production.

Does anyone have a promotional presentation about wicket?

Thanks
Rebbecca


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-production-statistics-tp3574928p3584823.html
Sent from the Users forum 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



Rounding values for display

2011-06-09 Thread Zeldor
Hi,

I have labels showing data that is in Double format, but I don't need so
much precision in UI. Can I easily make my page round those values [down]
and display just numbers without fraction?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Rounding-values-for-display-tp3584858p3584858.html
Sent from the Users forum 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



Major session problem [GAE]

2011-06-09 Thread Zeldor
Hi,

I have really serious problems with my sessions - or rather getting and
displaying data with it. It works great when tested locally, but when
deployed to GAE it acts weird. In bad way. I have no idea if it's wicket or
GAE issue, but maybe I can get some hints here.

Problem is that:
- it quite often fails to load data, so when user logs it it shows blank
pages, without any data, that should com from session
[MySession.loggedInUser.get...]
- on very rare occasions it can show old values, that were changed long time
ago, some residue must be left over somewhere and is not cleaned and somehow
it can switch between
- and there was a case when one user could see data from other user [so
sessions switched?]

Of course situations 23 can never happen. Situation 1 neither - but maybe
it can be solved by some check and reload of data?

Some code to illustrate:

MySession:

public class MySession extends WebSession {

public MySession(Request request) {
super(request);
}

public boolean isAuthenticated() {
return (loggedInUser != null);
}

public static User loggedInUser;


public User getLoggedInUser() {
return loggedInUser;
}
public void setLoggedInUser(User loggedInUser) {
this.loggedInUser = loggedInUser;
}
}

In Login:

((MySession) MySession.get()).setLoggedInUser(user);


Later data is accessed by MySession.loggedInUser.[getters/setters here] and
persisted to datastore when anything changes.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3584894.html
Sent from the Users forum 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: Rounding values for display

2011-06-09 Thread Martin Grigorov
class DoubleLabel extends Label {

@Override
public void onComponentTagBody(final MarkupStream markupStream,
final ComponentTag openTag) {
  replaceComponentTagBody(markupStream, openTag, getFormatted());
}

private String getFormatted() {
  // your logic to format modelobject
}
}

On Thu, Jun 9, 2011 at 10:31 AM, Zeldor pgronkiew...@gmail.com wrote:
 Hi,

 I have labels showing data that is in Double format, but I don't need so
 much precision in UI. Can I easily make my page round those values [down]
 and display just numbers without fraction?

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Rounding-values-for-display-tp3584858p3584858.html
 Sent from the Users forum 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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Rounding values for display

2011-06-09 Thread Andrea Del Bene

Hi Zeldor,

you could register a custom converter for Double type which displays 
value with the desired precision. Take a look at this page 
https://cwiki.apache.org/WICKET/using-custom-converters.html, example 
for Wicket 1.3 is what you need.

Hi,

I have labels showing data that is in Double format, but I don't need so
much precision in UI. Can I easily make my page round those values [down]
and display just numbers without fraction?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Rounding-values-for-display-tp3584858p3584858.html
Sent from the Users forum 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: Graceful Session Expiry

2011-06-09 Thread Martin Grigorov
The servlet API doesn't provide such notifications.
The only way to do this that I see is to track the times for each user
in your code.
But even then you'll have to send the notification to the browser and
here comes the question - how?

On Thu, Jun 9, 2011 at 8:24 AM, Arjun Dhar dhar...@yahoo.com wrote:
 Hi,
  I want to be able to show a Warning message appear when the session is
 about to expire (say 5 minutes before) and if the session has expired then
 on the UI it should come. This is to ensure a User does not enter any data
 and lose it when they click Submit.

 Use Case I wanna prevent: Lazy User goes for Coffee, comes back completes
 Form, presses Submit ...curses me!

 thanks

 -
 Software documentation is like sex: when it is good, it is very, very good; 
 and when it is bad, it is still better than nothing!
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584660.html
 Sent from the Users forum 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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Rounding values for display

2011-06-09 Thread Zeldor
So I can use one converter in Application for all my Labels? That would be
great :)

P.S. I am really amazed how fast you can get responses here. It's hard not
to love Wicket.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Rounding-values-for-display-tp3584858p3584914.html
Sent from the Users forum 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



setEnabled(true) doesn't work on onUpdate method

2011-06-09 Thread Mathilde Pellerin
Hi all,

In a form, I have a textfield and a button which is disable. I want to
enable the button when user enter a value on textfield.

so I do that :
emailField.add(new AjaxFormComponentUpdatingBehavior(onkeyup) {

@Override
protected void onUpdate(AjaxRequestTarget target) {
System.out.println( onUpdate trace);
submitButton.setEnabled(true);
}
});

onUpdate method is called (I have the trace in console) but my button is
still disable...

This is the code of the button :
final Button submitButton = new Button(submitButton);
submitButton.setEnabled(false);

I don't understand why this code doesn't work because I saw similar code on
the Web that seems to work.

Thanks for your help.

-- 
*Mathilde Pellerin*
Ingénieur en développement de logiciel

STATLIFE
tel : 01.42.11.64.88
mail : mathilde.pelle...@statlife.fr


Re: Graceful Session Expiry

2011-06-09 Thread Arjun Dhar
I just had an idea to solve both the problems. (please see if it makes sense)

Well, what if we on every Page request tell the Browser how much time it has
left = Session Duration. (Pass it via some param or header script variable)
And let the Browser do house keeping for that window session.

I'll put a script via WebPage.setHeader(...) in my base class; extended by
all pages that use a session.
The rest is taken care by the client.

..though am not sure if there is a way for me to inject into all pages that
use a particular session object automatically or I should keep it simple and
put it in the base WebPage class?
(All WebPages may not share a common parent)


thanks

-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584943.html
Sent from the Users forum 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: Graceful Session Expiry

2011-06-09 Thread Arjun Dhar
Sorry I meant , make base class implement
IHeaderContributor.renderHead(IHeaderResponse response) , inject script via
that.

-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584955.html
Sent from the Users forum 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: Got some code for you (ObjectSizeOfAgent)

2011-06-09 Thread Martin Grigorov
Hi,

Are there big differences between the results from
DeepInstrumentationSizeOfStrategy and
InstrumentationObjectSizeOfStrategy ?

On Wed, Jun 8, 2011 at 8:32 PM, Jochen Mader pflanzenmoer...@gmail.com wrote:
 Hey,
 a while ago I wrote about the difficulties to get the ObjectSizeOfAgent to 
 run.
 As I needed it pretty badly for a project I built something new and
 added some more accurate size measurement for objects.
 I put all my code on Github and I am going to add some more
 performance related things in  there.
 https://github.com/pflanzenmoerder/object-size/

 I copied the code from the size of agent (with proper mentioning of
 where I got it from) and added it as one of the possible strategies to
 estimate the size of pages in ram.
 It all uses AspectJ and has no direct dependencies to Wicket and can
 be deploied as an agent using LoadTimeWeaving.
 It's all Appache 2 License (I hope that's correct).

 Would that be of any interest for the Wicket-project?

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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Major session problem [GAE]

2011-06-09 Thread i...@e-dog.hu
On 2011.06.09. 10:48, Zeldor wrote:
 public static User loggedInUser;
Is it correct? I think it is better without static!

GeZo

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



Re: Graceful Session Expiry

2011-06-09 Thread Andrea Del Bene

Hi,
as Martin said this kind of strong interaction is not part of standard 
API. But you could do a very simple thing to warn your users: start a 
Javascript time-event with session timeout as time-interval: 
http://www.w3schools.com/js/js_timing.asp.


I.e:
var t=setTimeout(/alert('Back to your job lazy user!!') /, session 
timeout in millisecond minus something);






The servlet API doesn't provide such notifications.
The only way to do this that I see is to track the times for each user
in your code.
But even then you'll have to send the notification to the browser and
here comes the question - how?

On Thu, Jun 9, 2011 at 8:24 AM, Arjun Dhardhar...@yahoo.com  wrote:

Hi,
  I want to be able to show a Warning message appear when the session is
about to expire (say 5 minutes before) and if the session has expired then
on the UI it should come. This is to ensure a User does not enter any data
and lose it when they click Submit.

Use Case I wanna prevent: Lazy User goes for Coffee, comes back completes
Form, presses Submit ...curses me!

thanks

-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584660.html
Sent from the Users forum 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: Graceful Session Expiry

2011-06-09 Thread Martin Grigorov
Yep, this will work.

For each request to the page you'll have to reset the JS counter.
This JS counter will count from session-timeout to 0 and display some
notification when it reaches the treshold.
But you have to assure that this counter is reset for *every* request.

On Thu, Jun 9, 2011 at 11:11 AM, Arjun Dhar dhar...@yahoo.com wrote:
 I just had an idea to solve both the problems. (please see if it makes sense)

 Well, what if we on every Page request tell the Browser how much time it has
 left = Session Duration. (Pass it via some param or header script variable)
 And let the Browser do house keeping for that window session.

 I'll put a script via WebPage.setHeader(...) in my base class; extended by
 all pages that use a session.
 The rest is taken care by the client.

 ..though am not sure if there is a way for me to inject into all pages that
 use a particular session object automatically or I should keep it simple and
 put it in the base WebPage class?
 (All WebPages may not share a common parent)


 thanks

 -
 Software documentation is like sex: when it is good, it is very, very good; 
 and when it is bad, it is still better than nothing!
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584943.html
 Sent from the Users forum 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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: setEnabled(true) doesn't work on onUpdate method

2011-06-09 Thread Martin Grigorov
On Thu, Jun 9, 2011 at 11:06 AM, Mathilde Pellerin
mathilde.pelle...@statlife.fr wrote:
 Hi all,

 In a form, I have a textfield and a button which is disable. I want to
 enable the button when user enter a value on textfield.

 so I do that :
        emailField.add(new AjaxFormComponentUpdatingBehavior(onkeyup) {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                System.out.println( onUpdate trace);
                submitButton.setEnabled(true);
target.add(submitButton);
            }
        });

 onUpdate method is called (I have the trace in console) but my button is
 still disable...

 This is the code of the button :
        final Button submitButton = new Button(submitButton);
        submitButton.setEnabled(false);

 I don't understand why this code doesn't work because I saw similar code on
 the Web that seems to work.

 Thanks for your help.

 --
 *Mathilde Pellerin*
 Ingénieur en développement de logiciel

 STATLIFE
 tel : 01.42.11.64.88
 mail : mathilde.pelle...@statlife.fr




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Major session problem [GAE]

2011-06-09 Thread Pepijn de Geus
Storing the User in a static field doesn't seem wise: the static field is 
shared between all session instances, so this will break.
Besides that, I'd advise not to store the User instance itself in the session, 
but only the user ID (or username, or email). The User instance can be cached 
in a transient field, which can be checked and loaded on request by a 
(non-static) getUser() method.

Something like this:

public class MySession extends WebSession {

private int userId = -1;
private transient User user;

public void setUser(User user) {
userId = user.getId();
this.user = user;
}

public User getUser() {
if (userId == -1) return null;
if (user == null) {
user = UserDAO.loadUser(userId);
}
return user;
}

@Override
public void detach() {
user = null;
super.detach();
}

}


On 9 jun 2011, at 10:48, Zeldor wrote:

 Hi,
 
 I have really serious problems with my sessions - or rather getting and
 displaying data with it. It works great when tested locally, but when
 deployed to GAE it acts weird. In bad way. I have no idea if it's wicket or
 GAE issue, but maybe I can get some hints here.
 
 Problem is that:
 - it quite often fails to load data, so when user logs it it shows blank
 pages, without any data, that should com from session
 [MySession.loggedInUser.get...]
 - on very rare occasions it can show old values, that were changed long time
 ago, some residue must be left over somewhere and is not cleaned and somehow
 it can switch between
 - and there was a case when one user could see data from other user [so
 sessions switched?]
 
 Of course situations 23 can never happen. Situation 1 neither - but maybe
 it can be solved by some check and reload of data?
 
 Some code to illustrate:
 
 MySession:
 
 public class MySession extends WebSession {
   
   public MySession(Request request) {
   super(request);
   }
   
   public boolean isAuthenticated() {
   return (loggedInUser != null);
   }
   
   public static User loggedInUser;
   
   
   public User getLoggedInUser() {
   return loggedInUser;
   }
   public void setLoggedInUser(User loggedInUser) {
   this.loggedInUser = loggedInUser;
   }
 }
 
 In Login:
 
 ((MySession) MySession.get()).setLoggedInUser(user);
 
 
 Later data is accessed by MySession.loggedInUser.[getters/setters here] and
 persisted to datastore when anything changes.
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3584894.html
 Sent from the Users forum 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: Major session problem [GAE]

2011-06-09 Thread Zeldor
Yeah, no idea why Static is there, must be some leftover from early code.
It's good to have someone else take a look at your code and point the
obvious :) I will check if it solves my problems.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3585007.html
Sent from the Users forum 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: Major session problem [GAE]

2011-06-09 Thread Hielke Hoeve
Using static non-final fields in a multi user environment is very very
very very bad. The only cases you should use static are for example a
logger (log4j etc) a global variable defining a number or string.
If you do need to keep track of something using final then wrap this
using the ThreadLocal class.

final static Logger log;
final static String applicationName = Zeldors application;
final static String maxNumUsers = 2; 

Hielke

-Original Message-
From: Zeldor [mailto:pgronkiew...@gmail.com] 
Sent: donderdag 9 juni 2011 11:32
To: users@wicket.apache.org
Subject: Re: Major session problem [GAE]

Yeah, no idea why Static is there, must be some leftover from early
code.
It's good to have someone else take a look at your code and point the
obvious :) I will check if it solves my problems.

--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3
584894p3585007.html
Sent from the Users forum 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: need help using wicket:enclosure tag.

2011-06-09 Thread James Carman
You might want to check out Wicketopia.  It has logic for handling
this kind of stuff and it might even do some of it automatically for
you.

http://wicketopia.sourceforge.net/

Download it from SVN, build it, and run the example application.
There is an example in there that hides/shows the SSN field based
upon whether or not the logged in user is an admin.

On Thu, Jun 9, 2011 at 4:10 AM, Madan Mohan mmo...@educator.eu wrote:
 Hi,
        I am using wicket:enclosureto hide some rows in a table.

 Take for ex.,
         trtd Phone: span wicket:id=phoneNumber//td
 /tr
         wicket:enclosure
                    trtd Fax: span wicket:id=faxNumbertd/tr
         /wicket:enclosure

 Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
 Later based on some user action, i want to make faxNumber to *visible*.

 How to do this?


 --

 regards,
 *Madan*
 *www.educator.eu*


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



Re: need help using wicket:enclosure tag.

2011-06-09 Thread Madan Mohan
@Martin Grigorov, @James Carman: Thanks ;)

I was doing mistake while re-rendering the parent. I fixed it, working fine
now ;)


On Thu, Jun 9, 2011 at 4:59 PM, James Carman ja...@carmanconsulting.comwrote:

 You might want to check out Wicketopia.  It has logic for handling
 this kind of stuff and it might even do some of it automatically for
 you.

 http://wicketopia.sourceforge.net/

 Download it from SVN, build it, and run the example application.
 There is an example in there that hides/shows the SSN field based
 upon whether or not the logged in user is an admin.

 On Thu, Jun 9, 2011 at 4:10 AM, Madan Mohan mmo...@educator.eu wrote:
  Hi,
 I am using wicket:enclosureto hide some rows in a table.
 
  Take for ex.,
  trtd Phone: span wicket:id=phoneNumber//td
  /tr
  wicket:enclosure
 trtd Fax: span wicket:id=faxNumbertd/tr
  /wicket:enclosure
 
  Initially faxNumber is *not visible*. So the faxNumber row is not
 rendered.
  Later based on some user action, i want to make faxNumber to *visible*.
 
  How to do this?
 
 
  --
 
  regards,
  *Madan*
  *www.educator.eu*
 

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




-- 

regards,
*Madan*
*www.educator.eu*


Wicket, invalidurlexception with ajax panel, possibly ajax calls

2011-06-09 Thread Brown, Berlin [GCG-PFS]
I am getting this error intermittently with a web application that uses
ajax calls.  My theory is that on slower Internet connections, parts of
a page aren't returned at the correct time.  With the ajax call, maybe a
user clicks on a link but the link hasn't been entirely processed by the
server back end.
 
Error:
 
org.apache.wicket.protocol.http.request.InvalidUrlException:
org.apache.wicket.WicketRuntimeException: component panel:theLink not
found on page MyHomePage[id = 1], listener interface =
[RequestListenerInterface name=IBehaviorListener, method=public abstract
void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
at
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ
estCycleProcessor.java:262)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484
)
at
org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:1
38)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 
 
 
...
 

Version: Wicket1.4.13
 
Pseudo Code:
 
I am using the wicket ajax tabbed panel.  On the panel, there is a link
added to the tabbed panel.  And the tabs are added to the page.  We
normally don't refresh the entire page.  Content is controlled by the
ajax tabbed panel system.
 
It looks like I am getting the invalid URL exception on the link.  I
haven't been able to recreate the error.  It is something that the end
user tends to see.
 
...
 
import
org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
 

public class MyTab extends AbstractTab {
 
@Override
public Panel getPanel( final String arg0 ) {
   return new MyPanel();
} 
}
 
public class MyPanel {
   
 public MyPanel() {
 
   this.add( new AjaxSubmitLink Object ( theLink ) {


@Override
public void onEvent( final AjaxRequestTarget target ) {
  ...
}

} );   
 
 } 
  
}
 
...
 
 


Re: Major session problem [GAE]

2011-06-09 Thread Zeldor
norckon:

Getting whole entity is good in my case. User can modify only his data and
no one else can even access or see it. It speeds up things too. 

Anyway, how do you invoke the rest? Without static you of course get
non-static method cannot be referenced from a static context compilation
error.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3585460.html
Sent from the Users forum 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: database

2011-06-09 Thread Miroslav F.
Hielke,

this is what I was looking for :-)

Thanks,

Miro

 

 -Original Message-
 From: Hielke Hoeve [mailto:hielke.ho...@topicus.nl] 
 Sent: Wednesday, 08. June 2011 08:37
 To: users@wicket.apache.org
 Subject: RE: database
 
 http://lmgtfy.com/?q=wicket+hibernate+spring+howto
 
 First hit: 
 http://wicketinaction.com/2009/06/wicketspringhibernate-configuration/
 
 
 Hielke
 
 -Original Message-
 From: Miroslav F. [mailto:mir...@seznam.cz]
 Sent: dinsdag 7 juni 2011 11:42
 To: users@wicket.apache.org
 Subject: RE: database
 
 The original question was I would like to make my wicket app 
 to store images in database. No problem but I don't know how 
 to configure tomcat
 + wicket for database.
 
 No is it good idea to store images in database? ;-)
 
 Still don't know how to work with database in wicket. Is 
 anywhere examples?
 wicket phonebook example is not working:
 http://wicketstuff.org/confluence/display/STUFFWIKI/wicket-phonebook/
 
 I move to direction not use pure JDBC and using Hibernate. 
 Does someone know where to find docs for using Hibernate in 
 webapp project? Where to put config file or any other 
 specific issues for using Hibernate in webapp?
 
 Thanks, Miro
 
 
 
  -Original Message-
  From: meduolis [mailto:meduol...@gmail.com]
  Sent: Sunday, 05. June 2011 12:19
  To: users@wicket.apache.org
  Subject: Re: database
  
  Why do you want to store images in database? I think that is not a 
  very good idea. You better store images in your file system, and 
  persist into database only the paths to images.
  
  --
  View this message in context: 
  http://apache-wicket.1842946.n4.nabble.com/database-tp3573282p
 3574812.html
  Sent from the Users forum 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
 
 
 -
 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: Major session problem [GAE]

2011-06-09 Thread Pepijn de Geus
The Wicket websession has a static .get(), which will always return the 
ThreadLocal session instance for the current user.
So you can use that and cast the result to your session, or add your own get() 
to your session:

public static MySession get() {
return (MySession) WebSession.get();
}

WebPage also has his own getSession() you could use.


On 9 jun 2011, at 15:02, Zeldor wrote:

 norckon:
 
 Getting whole entity is good in my case. User can modify only his data and
 no one else can even access or see it. It speeds up things too. 
 
 Anyway, how do you invoke the rest? Without static you of course get
 non-static method cannot be referenced from a static context compilation
 error.
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3585460.html
 Sent from the Users forum 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: Major session problem [GAE]

2011-06-09 Thread Zeldor
So...

MySession.get().getUser().getLand() 

to properly get a value from session? Looks like it could have some
performance issues, or does it just look so scary? :)


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Major-session-problem-GAE-tp3584894p3585657.html
Sent from the Users forum 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: navigation menu

2011-06-09 Thread hubert_hupe
hi,

the wicket menu works fairly ( 
http://www.cooldatasoft.com/wicket-menu-demo/wicket/bookmarkable/com.cooldatasoft.page.SunriseGlossDropDownMenuDemo?1
 )
the problem at the moment is that the target page (p1) replaces the current 
page where the menu is inside.
is there a way to define a target container/DIV where the target page should be 
shown? for example like this: http://wicketstuff.org/wicket/navomatic/

regards hubert

i used the component in this way:

final testMenu p1 = new testMenu();

//Define Primary Menu items (menuText,destinationWebPage)   
MenuItem primaryMenu1 = new MenuItem(MENU 1,p1);
ListMenuItem primaryMenuList = new ArrayListMenuItem();
primaryMenuList.add(primaryMenu1);

add(new SunriseGlossDropDownMenu(sunriseGlossMenu, primaryMenuList));

markup:
div wicket:id=sunriseGlossMenu/div


Am 08.06.2011 um 21:33 schrieb Peter Karich:
Am 08.06.2011 um 17:51 schrieb Fatih Mehmet Ucar:

 http://code.google.com/p/wicket-menu/
 
 Not complete but if you see the source code, it will give you an idea.
 
 cheers,
 -fatih
 
 On 8 June 2011 16:28, hubert_hupe hubert_h...@gmx.de wrote:
 hi guys,
 
 i have no clue how to create a simple navigation bar like this: 
 http://net.tutsplus.com/tutorials/javascript-ajax/a-different-top-navigation/
 if possible i need images for the headlines.
 when you move the mouse over the menu it drops down - there are millions of 
 website with this functionality.
 the problem is: i have to ceate the menu dynamically. the informations which 
 menuitem should be in the menu comes from the database. so i cannot use a 
 static javascript code in the html file.
 is anybody there who can give me a hint or even an example?
 
 best regards
 
 hubert
 -
 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: Binding selected values from a ListView into a Mode

2011-06-09 Thread Per Newgro

Am 09.06.2011 10:07, schrieb Madan Mohan:

Hi,
 I am usingwicket:enclosureto hide some rows in a table.

Take for ex.,
  trtd  Phone:span wicket:id=phoneNumber//td/tr
  wicket:enclosure
 trtd  Fax:span wicket:id=faxNumbertd/tr
  /wicket:enclosure

Initially faxNumber is *not visible*. So the faxNumber row is not rendered.
Later based on some user action, i want to make faxNumber to *visible*.

How to do this?

regards,
*Madan*
*www.educator.eu*


1) Please don't capture threads. Open another one.
2) You can overwrite onConfigure in every component and set visibility 
by calling Component.setVisible.

So you need to call
spanWithWicketIdfaxNumber.setVisible(true);
if your conditions are met.

Hth
Per

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



Re: navigation menu

2011-06-09 Thread Fatih Mehmet UCAR
Well at the beginning of my email I stated that it is not complete. I don't 
there is a way to do it directly, but you may wanna change the code or use 
some pieces to make it the way you want it, better than starting from 
scratch. Take a look at the source of both components and then you can 
create your own.


cheers,
fatih

-Original Message- 
From: hubert_hupe

Sent: Thursday, June 09, 2011 15:31 PM
To: users@wicket.apache.org
Subject: Re: navigation menu

hi,

the wicket menu works fairly ( 
http://www.cooldatasoft.com/wicket-menu-demo/wicket/bookmarkable/com.cooldatasoft.page.SunriseGlossDropDownMenuDemo?1 
)
the problem at the moment is that the target page (p1) replaces the current 
page where the menu is inside.
is there a way to define a target container/DIV where the target page should 
be shown? for example like this: http://wicketstuff.org/wicket/navomatic/


regards hubert

i used the component in this way:

final testMenu p1 = new testMenu();

//Define Primary Menu items (menuText,destinationWebPage)
MenuItem primaryMenu1 = new MenuItem(MENU 1,p1);
ListMenuItem primaryMenuList = new ArrayListMenuItem();
primaryMenuList.add(primaryMenu1);

add(new SunriseGlossDropDownMenu(sunriseGlossMenu, primaryMenuList));

markup:
div wicket:id=sunriseGlossMenu/div


Am 08.06.2011 um 21:33 schrieb Peter Karich:
Am 08.06.2011 um 17:51 schrieb Fatih Mehmet Ucar:


http://code.google.com/p/wicket-menu/

Not complete but if you see the source code, it will give you an idea.

cheers,
-fatih

On 8 June 2011 16:28, hubert_hupe hubert_h...@gmx.de wrote:

hi guys,

i have no clue how to create a simple navigation bar like this: 
http://net.tutsplus.com/tutorials/javascript-ajax/a-different-top-navigation/

if possible i need images for the headlines.
when you move the mouse over the menu it drops down - there are millions 
of website with this functionality.
the problem is: i have to ceate the menu dynamically. the informations 
which menuitem should be in the menu comes from the database. so i cannot 
use a static javascript code in the html file.

is anybody there who can give me a hint or even an example?

best regards

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




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



Re: Graceful Session Expiry

2011-06-09 Thread Jered Myers
I have done this in the past (not in Wicket).  The problem I ran into 
was JavaScript alerts stopping the JavaScript timer thread until the 
user closed the alert box.  I used a modal window for my warning message 
to prevent that problem.


On 6/9/2011 2:25 AM, Martin Grigorov wrote:

Yep, this will work.

For each request to the page you'll have to reset the JS counter.
This JS counter will count from session-timeout to 0 and display some
notification when it reaches the treshold.
But you have to assure that this counter is reset for *every* request.

On Thu, Jun 9, 2011 at 11:11 AM, Arjun Dhardhar...@yahoo.com  wrote:

I just had an idea to solve both the problems. (please see if it makes sense)

Well, what if we on every Page request tell the Browser how much time it has
left = Session Duration. (Pass it via some param or header script variable)
And let the Browser do house keeping for that window session.

I'll put a script via WebPage.setHeader(...) in my base class; extended by
all pages that use a session.
The rest is taken care by the client.

..though am not sure if there is a way for me to inject into all pages that
use a particular session object automatically or I should keep it simple and
put it in the base WebPage class?
(All WebPages may not share a common parent)


thanks

-
Software documentation is like sex: when it is good, it is very, very good; and 
when it is bad, it is still better than nothing!
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Graceful-Session-Expiry-tp3584660p3584943.html
Sent from the Users forum 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