cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically change the img URL

Former Member
0 Kudos

Hi all,

I have developped an application for that I need to display four images depending some condition.

My all images are in source-mimes-components-com.ram-img1,img2,img3.img4.

These images are I mapped My view UI element InterctiveForm Object URL.

Here I only mapped statically.but I need to set the URL path dynamically how to do it.

Any suggestions welcome.

Thanks

Lohi.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Define a calculated attribute and bind the UI element property, e.g. Image.source, to this attribute.

In the generated getter, return the name of the image file depending on the condition value.

Armin

Former Member
0 Kudos

Hi Armin,

Thanks for ur response.

Could you please elobarate more.

thanks

Lohi.

Former Member
0 Kudos

Hi Armin,

Thanks for your response,

I have done what u said in previous post.

That calculated Attribute getter method retunrs only the string value.

Here my problem is I want to retrive the Images from src-mimes-componets-one.jpg

In My calculated getter method only I am getting this as a string.

but I want to map this as a Image in UI Interactiveform but that UI Elemenets needs to display as Image or Static image for we need to pass the URL.

Give any otheralternative solutions.

Thanks

Lohi.

Former Member
0 Kudos

If you need the complete URL, you can use the WDURLGenerator API.

Armin

Former Member
0 Kudos

Hi

I have done with URL and set it to the nodeattribute it throws stackoverflow error.

My problem capture the images from src and put into the UI Interactive form.

I am struck over here Please suggest me.

Thanks

Lohi.

Former Member
0 Kudos

Can you post the stacktrace?

A possible cause may be that you call the calculated attribute get<Attribute>() method inside itself and get a recursion.

Armin

Former Member
0 Kudos

Hi

public java.lang.String Z_Ff_Ar_Invoice_Copy_InputImageUrl(IPrivateInvoiceAppView.IZ_Ff_Ar_Invoice_Copy_InputElement element)

{

//@@begin getZ_Ff_Ar_Invoice_Copy_InputImageUrl(IPrivateInvoiceAppView.IZ_Ff_Ar_Invoice_Copy_InputElement)

String path ="";

String title = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("title");

if(title.equalsIgnoreCase("ONE"))

{

try {

path =

WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(),"ONE.jpg");

} catch (WDURLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return path;

}

else

{

try {

path =WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(),"LII.bmp");

} catch (WDURLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return path;

}

This is my gettter method.

In context rootnode mapped to Interactive element contain the my attribute imageUrl that have created as calculate attribute.

This imageUrl Attribute only getting the images that need to be mapped into Interactiveform UI element.

And getting the path variable to setted to imageUrl then it shows error like this.

Root Cause

The initial exception that caused the request to fail, was:

java.lang.StackOverflowError .

This is my problem.

Please suggest me.

Thanks

Lohi.

Former Member
0 Kudos

Can you post the code inside getImageURL()?

Armin

Former Member
0 Kudos

Hi

See this Thread

Kind Regards

Mukesh