cancel
Showing results for 
Search instead for 
Did you mean: 

DateNavigator

Former Member
0 Kudos

Hi

How can we display Datenavigator cells with different colors?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi shah,

check this link out

hope this helps you

Regards

Rohit

Former Member
0 Kudos

Hi

In my application I want change the color of day cells which got some data inside so that users can only select those cells which are in different color instead of selecting all the cells to know which one has data.

Thanks

Former Member
0 Kudos

Hi,

You can make use of DateNavigatorMarking API to assign different colors for dates. You can then use DateNavigator Legend to describe what each of these colors imply.

And about the display of text associated with each date, you can try displaying them aas a tooltip.

The limitation here is we cant use more than 4 colors.

http://help.sap.com/saphelp_nw04/helpdata/en/5c/1b76bc3da0504e8b535cf3e154eaa7/frameset.htm

Regards

Bharathwaj

Former Member
0 Kudos

Hi

How can i use IWDDateNavigatorMarking Properties.

I mean Category, datasource, date, Tooltip how can i bind these values with context attribute.

Thanks

Former Member
0 Kudos

Hi,

I am struggling with IWDDateNavigatorLegend and IWDDateNavigatorMarking. I dont understand how to set colors for DateNavigator cells by using these API s

can anybody help me out in this...?

Thanks.

Former Member
0 Kudos

Setup a context node to hold the attributes (category, date, text for tooltip) about the dates you want to display with colors. Each element in the node will be for a date you want to have information about. So as you add the elements to the node, assign a category (to get the color), the date value, and any text you want bound to the tooltip. For the category attribute, you will need to have its type set to DateMarkingCategory and set it using WDDateMarkingCategory.ONE, etc. If you are using more than one category, you should add a legend as well to denote what the categories mean. These are setup similar to the markings (node for holding category and legend text).

Cindy

Former Member
0 Kudos

Hi,

Thanks for your reply itz very helpful, well I have created Node under that 3 attributes(category, date, text) category of type DateMarkingCategory.

Here how could i set WDDateMarkingCategory.ONE to category attribute..? if i put WDDateMarkingCategory.ONE value directly in the category set method itz not resolving(I've imported required packages) or do i have to create instance for WDDateMarkingCategory if so how cud i do that..?

Thnaks

Former Member
0 Kudos

Which type did you assign to attribute "category"? It should be the local dictionary type "com.sap.ide.webdynpro.uielementdefinitions.DateMarkingCategory".

At runtime, this will be type com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDDateMarkingCategory.

Values can only be accessed via the public constants like WDDateMarkingCategory.ONE

Armin

Former Member
0 Kudos

Hi

yeah I assigned that one only(com.sap.ide.webdynpro.uielementdefinitions.DateMarkingCategory) to category.

IWDNodeElement element = wdContext.nodeNode().createElement();

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

itz not resolving WDDateMaerkingCategory

Former Member
0 Kudos

Use the typed context API.

If your node has name "MyNode", use


IMyNodeElement e = wdContext.nodeMyNode().createMyNodeElement();
e.setCategory(WDDateMarkingCategory.ONE);

Armin

Former Member
0 Kudos

Your import statement should look like this:

import com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDDateMarkingCategory;

Be sure everything is spelled properly (although your code listed looks ok).

Cindy

Former Member
0 Kudos

Hi

this is my complete code:

wdDoInit()

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

String date = format.format(new java.util.Date());

wdContext.nodeDate().currentDateElement().setD1(date);

IWDNodeElement element = wdContext.nodeLegend().createElement();

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

element.setAttributeValue("date", date);

element.setAttributeValue("text", "select");

wdContext.nodeLegend().addElement(element);

wdDoModifyView

IWDDateNavigatorMarking dm = (IWDDateNavigatorMarking)view.getElement("DateNavigator1");

dm.bindCategory("Legend.category");

dm.bindDate("Legend.date");

dm.bindTooltip("Legend.text");

getting this error:

java.lang.ClassCastException

at us.dot.co.legendcomp.LegendView.wdDoModifyView(LegendView.java:166)

at us.dot.co.legendcomp.wdp.InternalLegendView.wdDoModifyView(InternalLegendView.java:194)

Former Member
0 Kudos

If DateNavigator1 is your DateNavigator element, you cannot cast it to IWDDateNavigatorMarking. The marking and legend are separate elements that can be attached to a DateNavigator. If you set it up using the view layout, right-click on the DateNavigator and choose InsertMarking (or InsertLegend to add a legend). You can then bind the node and attributes for the marking to the properties of the DateNavigatorMarking element.

Cindy

Former Member
0 Kudos

Use the typed context API, use the view designer to create UI elements and bind their properties to context attributes.

If using dictionary type "date", you have to use java.sql.Date values at runtime.

The reason for the ClassCastException has been explained by Cindy.

Armin

Former Member
0 Kudos

Hi

I got it.

Thank you very much to both of you

Former Member
0 Kudos

Sorry! I Can't understand your meaning.

If I don't use "insert marking"

the calender won't change color.

my code is like this

Calendar cal = Calendar.getInstance();

cal.set(2006, 9, 18);

Date date = new Date(cal.getTimeInMillis());

IMutidateElement e = wdContext.nodeMutidate().createMutidateElement();

e.setCategory(WDDateMarkingCategory.FOUR);

e.setSingledate(date);

wdContext.nodeMutidate().addElement(e);

IMutidateElement e1 = wdContext.nodeMutidate().createMutidateElement();

e1.setCategory(WDDateMarkingCategory.TWO);

cal.set(2006, 9, 19);

date = new Date(cal.getTimeInMillis());

e1.setSingledate(date);

wdContext.nodeMutidate().addElement(e1);

Would you please tell me where did i go wrong?

tks

Message was edited by: Allen Chou

Former Member
0 Kudos

by the way

the above code

Is there any right function to use?

something like "for loop".

I feel is worng to do the same thing twice times.

thanks for reply.

Former Member
0 Kudos

Hai Allen,

what is your exact need with this date markering?

Former Member
0 Kudos

Hi~~

I will receive several Date variables and display them on the same navigator with various colors.

My problem is I don't know how to use DateNavigatorMarking and DateNavigatorLegend.

Thanks

Former Member
0 Kudos

Hi Allen,

your code is correct.The marking is set in the Datenavigator, but not for september. it will highlight the dates in october.

Because, the Calendar takes month values from 0..11 so if you want to color the dates in september you should give value 8 for month.

try, cal.set(2006, 8, 18); instead of cal.set(2006, 9, 18);

Former Member
0 Kudos

HI~

I know what you mean. This is Java knowledge.

My question is 9/18 i want display in red and 9/19 display in blue.

I have seen Datenavigator API and it works after i tried and tried.

Now I got another question.

I fonud WDDateMarkingCategory have only 4 types.

What will i do to display 5 colors in one Datenavigator?

Anyway,You are so kind. Thanks for your help.

Former Member
0 Kudos

Hi Allen,

The WDDateMarkingCategory has only 4 types. so you can show only four colors on your Navigator. i think there are no possibilties to change the color(or add a new type). i dont know whether this facility provided in later version of webdynpro.

Former Member
0 Kudos

OK I got it!

Thanks again.

Answers (1)

Answers (1)

Former Member
0 Kudos

Is there a way to configure the display of the days of the week on top of the dateNavigator control. Just asking because we are trying to deploy in English , German and Spanish. English and German are fine displaying only 2 letters for each day of the week. But for some reason Spanish is displaying the full word for each day of the week which make the iView not consistent (and big) with English and German.

Former Member
0 Kudos

Open an OSS message on component BC-WD-JAV-CLT-HTML.

Armin

Former Member
0 Kudos

How to change the properties for the current system date in the DateNavigator?

I change the color of another date works fine but not for the current date.

Thanks in advance

Former Member
0 Kudos

Get the current system date and through the setAttributeValue() set the context attribute value of type date of type node attribute.

the coding is

Date date = new Date(System.currentTimeMillis());

IWDNodeElement element =wdContext.nodeMarking().createElement();

element.setAttributeValue("date", date);

wdContext.nodeMarking().addElement(element);