cancel
Showing results for 
Search instead for 
Did you mean: 

Display of date& day and image and image as being link to other iView

Former Member
0 Kudos

Hi

As I stated the Subject,

I want to display the system date in View in the following format.

"Wednesday, September 21st, 2005"

Is there any way I can get this in the view.

I have an application in which the an image is shown in the Image Area. Thae image has to be picked and displayed randomly from a set of images in the image area. How do we achieve this?? is this possible in Web Dynpro.

And I have to provide Image as link to other View. Is this possible??

I would be too happy if some one can suggest some thing in this regard.

Thanks a million in advance

Srikant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srikant,

1) Use these lines of code to diplay the system date in the required format:

String day = (new SimpleDateFormat("EEEEEE, MMMMMM dd , yyyy").format(new Date()));

wdComponentAPI.getMessageManager().reportSuccess("Date::"+day);

2) Store your images in your components folder. Bind the 'source' attribute of your image to a string attribute say for eg: 'src'. Now create a simple type of string and in it's enumeration, store you image names as key-value pair. For eg : '0 pic1.jpeg', '1 pic2.jpeg' etc. Then create an attribute of that type in your view context.

Let the total no: of images be n;

then write these lines of code to populate the image randomly:

int a = (int)((Math.random()*100)%(n-1));

String attributeName = IPrivate<your_view>View.IContextElement.<your_simpletype_attribute>;

IWDAttributeInfo attributeInfo = wdThis.wdGetContext().getNodeInfo().getAttribute(attributeName);

ISimpleType simpleType = attributeInfo.getSimpleType();

ISimpleValueSet valueset = simpleType.getSVServices().getValues();

Object key = valueset.getKey(a);

String val = valueset.getText(Integer.parseInt((String)key));

wdContext.currentContextElement().setSrc(val);

This will show images randomly on each execution

3) Store the image that you want to display as the link in your components folder.create a LinkToAction UI element and give the 'imageSource' as your image name. Now in the action you create for LinkToAction, you can write the code for firing the plug to your second view.

Hope this helps,

Best regards,

Nibu.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Srikant,

Nibu's Date format is absolutely fine..

You will get your required format. Try it out.

All the best.

Sirisha.

Former Member
0 Kudos

Hi Nibu and Sirisha,

Thanks for the help as my problem totally got solved. Nibu you are fabulous. Thanks for the help.

Still I have a question:

If there are three different Transparent Container UI Elements, how do I give different background colours for each of them.

Once again thanks for all the help.

Thanks in advance for subsequent problem

Srikant

Former Member
0 Kudos

Hi Srikant,

In the LayoutData of your TransparentContainer, you can find a property 'cellBackgroundDesign'. For this property you can select different values from the limited options available for having background colours. But it is not very useful as the options are very limited.

Best Regards,

Nibu.

Former Member
0 Kudos

Hi,

Place the image on the button :

To place the image in the button, first u should have all your images copy in the src/mimes/component/<ur package folder>.

then set the imagesource property of your button with the name of the image that u want to display.

And then on action of the button u can go to another view.(raise fire plug event or any way...) can be coded as per your requirement.

For the Date. Use DateFormat class which gives u a particular format.

All the best.

Regards,

Sirisha.

Former Member
0 Kudos

Hi Sirisha,

Thanks for the reply I'll try on these lines.

Can you please tell me how to display a single image from a set of images in image area?? they have to chosen randomly and displayed in it.

Thanks in advance

Srikant

Former Member
0 Kudos

Hi Srikant,

Have all your images in stored in the context and depending on the action select them and set in that action.

and for your date its better you use Calendar help.

u can get

int dat =Calendar.DATE ;

int month = Calendar.DAY_OF_MONTH;

int year = Calendar.DAY_OF_WEEK;

and then further process them and display the way you want.

All the best.

Regards,

Sirisha.R.S.