on 01-14-2010 1:52 PM
Hello,
Where are using ESS/MSS leave request. One of the options is that you can display a calendar. The first day of the week is a Sunday, which is not correct for country Netherlands. Our first day of the week is Monday. I checked the standard SAP Java webdynpro and saw that the property firstDayOfWeek of the datenavigator is set to Auto. When the property is set to Auto the WebDynpro will specify the first day of the week automatically, according to the country-specific beginning of the week.
What i would like to know is, can somebody tell me where the Webdynpro finds the country so it can display the correct first day of the week. Does the WebDynpro looks on the server where it is deployed, or on the client or is it a setting in the Visual Administrator?
Thanks in advance.
Kind regards,
Maarten
Hello,
Thanks for all the answers.
I created a WebDynpro view with just a DateNavigator on it. I didn't changed the properties (everything default). In the onInit i placed the following code:
Locale locale = WDClientUser.getLoggedInClientUser().getLocale();
wdComponentAPI.getMessageManager().reportWarning("Locale (WDClientUser.getLoggedInClientUser) --> " + locale);
IWDResourceHandler resourceHandler = WDResourceHandler.createResourceHandlerForCurrentUser();
wdComponentAPI.getMessageManager().reportWarning("Locale (WDResourceHandler.createResourceHandler) --> " + resourceHandler.getLocale());
Locale local = WDResourceHandler.getCurrentSessionLocale();
wdComponentAPI.getMessageManager().reportWarning("Locale (WDResourceHandler.getCurrentSessionLocale) --> " + local);
The result is:
Locale (WDClientUser.getLoggedInClientUser) --> nl
+Locale (WDResourceHandler.createResourceHandler) --> nl+
Locale (WDResourceHandler.getCurrentSessionLocale) --> nl
The first day of the week in the datenavigator is still Sunday instead of Monday.
I think that i should start an OSS Call. Anyone another suggestion?
Kind regards,
Maarten.
Edited by: Maarten Duits on Jan 18, 2010 12:26 PM -typos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you checked this one:
Locale locale = WDClientUser.getLoggedInClientUser().getLocale();
Calendar loCalendar = Calendar.getInstance(locale);
loCalendar.getFirstDayOfWeek();
Because the problem could be in the initialization of datenavigator ui and if it is there then you can easily fix the problem.
Regards,
Anton
You can do this in one of the following ways:
1). Go in the view where your DateNavigator is placed and write the following code in the wddomodify method
if (firstTime) {
....
Locale locale = WDClientUser.getLoggedInClientUser().getLocale();
Calendar loCalendar = Calendar.getInstance(locale);
IWDDateNavigator loNavigator = (IWDDateNavigator)view.getElement("<YOUR DATE NAVIFATOR UI ELEMENT ID>");
loNavigator.setFirstDayOfWeek(WDDayOfWeek.valueOf(loCalendar.getFirstDayOfWeek()));
}
2). In the same view you can create a context element of type dayofweek and bind it to firstdayofweek property of DateNavigator, then in wddoinit method:
Locale locale = WDClientUser.getLoggedInClientUser().getLocale();
Calendar loCalendar = Calendar.getInstance(locale);
wdContext.currentContextElement().setFirstDayOfWeek(WDDayOfWeek.valueOf(loCalendar.getFirstDayOfWeek()));
In either of two ways you are avoiding using the 'auto' value of firstdayofweek property, and now everything should work properly.
Best regards,
Anton
I think it is an internal problem, but I don't know where it is. We have the same problem, but in my case the problem occurred in 7.0 sp 12, after the upgrade to sp16 problem disappeared. You could test of course: create calendar with the current locale and get its first date of week, if it returns the correct one than the problem is in initialization code of the datenavigator ui element (and you can write two lines of code to initialize it with the correct value), if it also returns wrong value than it must be some problem in localization definitions or something other related to localizations (or may be in the calendar class ). But as you said, OSS message is also an option :).
Best regards,
Anton
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The DateNavigator UI element with firstDayOfWeek=AUTO uses a Calendar that is initialized with the session locale. The first day of week is then defined by that Calendar object (at least this is what I see in the 7.11 code).
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
Thx for the quick replies.
I just check, with the code of Omri what my locale is. It's nl, which is correct. As mentioned in the first post, the Calendar in leaverequest shows as first day of the week Sunday. Which is not correct for nl.
Anyone another idea? Or should i make an OSS request?
Kind regards,
Maarten.
Could you check with the debugger what the following method returns:
Armin
Hi,
You can use the following code to check the Locale of the user
Locale locale = WDClientUser.getLoggedInClientUser().getLocale();
wdComponentAPI.getMessageManager().reportWarning("Locale --> " + locale);
Regards,
Omri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.