cancel
Showing results for 
Search instead for 
Did you mean: 

How to highlight days in IWDDateNavigator

Former Member
0 Kudos

Dear Web Dynpro Java experts,

I try to highlight vacation days dynamically in a DateNavigator element.

I didn't understand the UI elements guide and I'm desperately looking for an example how to

assign a Datenavigator legend to a datenavigator and how to highlight some days dynamically.

What I don't understand is how to assign a marking to a legend and how to assign a special date to a marking/legend.

IWDView thisView = (IWDView) wdControllerAPI;

IWDDateNavigator DateNavigator = (IWDDateNavigator) thisView.getElement("DateNavigator");

DateNavigator.setFirstSelectedDate(Date.valueOf("2009-03-24"));

DateNavigator.setLastSelectedDate(Date.valueOf("2009-04-21"));

IWDDateNavigatorLegend DateNavigatorLegend = (IWDDateNavigatorLegend) thisView.createElement(IWDDateNavigatorLegend.class, "DateNavigatorLegend" );

DateNavigatorLegend.setText("test");

IWDDateNavigatorMarking DateNavigatorMark = (IWDDateNavigatorMarking) thisView.createElement(IWDDateNavigatorMarking.class, "DateNavigatorMark" );

DateNavigatorMark.setCategory(WDDateMarkingCategory.ONE);

DateNavigator.setLegend(DateNavigatorLegend);

DateNavigator.setMarking(DateNavigatorMark);

Edited by: Daniel Wetzler on Apr 16, 2009 7:25 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hey Daniel,

First of all thanks for posting the solution.. i was able to set one category, but i am having trouble marking a second cateegory.

What did you mean when you said - to make another category you have to create another element?

Thanks..

Former Member
0 Kudos

Okay, it's not too difficult if you know where to search...

But since I searched for a long time for a manual to solve this problem I don't want to keep secret my findings :

I will describe what I've done since I wasn't able to find an example here in a forum or the other docmentation :

(I used Netweaver 2004.)

Prerequisite is an Context Node with 3 Attributes in my case :

Node "Data" with 3 attributes

category (type : type com.sap.ide.webdynpro.uielementdefinitions.DateMarkingCategory)

date (type: date)

tooltip (type : string)

First I created the Datenavigator using the View Designer. After selecting the DateNavigator element I could click using the right mouse button on the DataNavigator in the Outline.

I chosed "Insert Legend" and "Insert Markup" to create the DateNavigatorLegend and DateNavigatorMarkup instances and bind them to the DateNavigator.

The Tree view showed the Legend and the markup object.

By clicking onto these objects and editing the properties window for them I could assign the node I described above as data source for the Legend and the Marking. I also filled the fields for tooltip, category and so on with the suiting parts of my structure.

For example :

Legend :

category = Data.category

datasource = Data

text = Data.tooltip

Marking

category = Data.category

datasource = Data

tooltip = Data.tooltip

date = Data.date

The only thing I had to do now was to fill my node with the data to display

marked days (in my example I did it in the wdDoInit of my view):

java.util.Date mydate;

mydate = Date.valueOf("2009-04-21");

IWDNodeElement Dataele = wdContext.nodeData().createElement();

Dataele.setAttributeValue("category", WDDateMarkingCategory.ONE );

Dataele.setAttributeValue("date", mydate );

Dataele.setAttributeValue("tooltip", "Date" );

wdContext.nodeProjectData().addElement(Dataele);

To display marks of another Category I only had to add another elements to my node.

Of course it is much better to create an extra node for Legend data.