cancel
Showing results for 
Search instead for 
Did you mean: 

DayRanges method.....

Former Member
0 Kudos

Hi,

how to get the days of a week which is selected ,

and display.

how to use addWeek(int week,int year) method which returns void.

actually what does the DayRanges class do?

regards,

Joshua

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Joshua,

> how to get the days of a week which is selected

Ok, to be precise: We are talking of the HTMLB date navigator?! And the question quotated is the question: How to get the concrete days when an onWeekClick event has occured?!

If this is the question, then this is the answer:

public void onWeekClick(Event event) throws PageException {
  DateNavigatorWeekClickEvent wcEvent =
    (DateNavigatorWeekClickEvent) event;
  GregorianCalendar gc = new GregorianCalendar();
  gc.set(Calendar.YEAR, wcEvent.getYear());
  gc.set(Calendar.WEEK_OF_YEAR, wcEvent.getWeek());
  ...
}

Now <i>gc</i> should be set to the first day of the week chosen. I have to admit that I didn't test it, but this at least is the way it <i>should</i> work...

> how to use addWeek(int week,int year) method

> which returns void.

See http://devnetmedia.sap.com/html/submitted_docs/htmlbManuals/HTMLB-DateNavigatorModel.html and the example given.

> actually what does the DayRanges class do?

Also see the link given above ("The DayRanges class specifies any number of days taht should be displayed in the selected state. Every day can have a tooltip.").

In addition, see the following links: http://devnetmedia.sap.com/html/submitted_docs/htmlbManuals/datenavigator_dev.html and http://java.sun.com/j2se/1.4.2/docs/api/java/util/GregorianCalendar.html

Last but not least - it would be very nice if you would be a bit more responsive on answers given to your questions - by rewarding points and/or answering directly, so that the one who tried to help knows if it was correct as well as for other people running into the same issues, e.g. https://forums.sdn.sap.com/thread.jspa?threadID=23084 and https://forums.sdn.sap.com/thread.jspa?threadID=26573

Hope it helps

Detlev

Former Member
0 Kudos

Thank You very much Detlev,

Using DateNavigator i'm able to get the calendar to be displayed with the week numbers on the left side.

when i click on one of the week numbers i'm able to get the week number as an integer, and also the year in the same manner using getWeek(),getYear() methods respectively.

The problem is i need to get the days of the week which i've selected for example.....

if i've selected week no. 9 then i should get the dates of that week like.. 20/02/2005,21/02/2005,22/02/2005

23/02/2005,24/02/2005,25/02/2005,26/02/2005 whichever the date format may be.

i'm confused to how to use these methods..like

DayRanges getSelectedDays()

void addWeek(int week,int year)

if these methods help me to continue in my way plz let me know.

This information might help you to lead me in the success path.

respond as early as possible bcoz im in need very badly......

Regards,

Joshua

detlev_beutner
Active Contributor
0 Kudos

Hi Joshua,

yeah, but that you have! "Now gc should be set to the first day of the week chosen" --> gc.getDate() will return the first day of the week chosen (and the following six days belong to this week).

The additional methods you gave are primarily

for setting an initial selection. Maybe you can choose them, I didn't test it, I just don't know.

But the way showed should do everything you need, doesn't it?!

Hope it helps

Detlev

Former Member
0 Kudos

Thank you Detlev for the quick response,

gc.getDate();....doesnt work bcoz GregorianClendar

doent have the method getDate();

and the thing is if at all i get the first day of the week also it is bit risky to get the consecutive days bcoz...if at all the first day is feb 27th then the next shud be 28thfeb,1 mar,2 mar.......so what i request is will the DayRanges.getSelectedDays(); work?????

regards,

Joshua

detlev_beutner
Active Contributor
0 Kudos

Hi Joshua,

sorry, it's not getDate(), it's getTime(), which in fact returns a Date.

> if at all i get the first day of the week also it is

> bit risky to get the consecutive days bcoz...if at all

> the first day is feb 27th then the next shud be

> 28thfeb,1 mar,2 mar.......

I cannot see the problem:

gc.add(Calendar.DAY_OF_MONTH, 6);
Date endDate = gc.getTime();

will return the end date. That's what calendars are for.

This is very straight forward and I cannot realize any problem. Anyhow, if you want to go another way, just try it! If it works, great, if not, use the straight forward way...

Hope it helps

Detlev

Former Member
0 Kudos

Thank You very much Detlev,

The Problem is Solved.

Thanks a lot for ur quick responses.

i've given the points for solving the problem

Hope the fine.

Now the process is going fine if at all any probs arises i'll definitely contact u.

regards,

Kiran

Answers (0)