cancel
Showing results for 
Search instead for 
Did you mean: 

IWDMessage from a message pool and assign to java.lang.String

Former Member
0 Kudos

Hi,

I had a message in Message pool.

"Do you want to Modify curreny from to "

I had the "OLD curreny" value and "NEW Currency" values from View Context attributes.

I need to assign these 2 values to place holders in above message.

Is it possiable to format the above message(<b>IWDMessage</b>) with dynamic values at runtime and assign the message to java.lang.String

<b>Example</b>:

String strOldCurrencyValue="42";

String strNewCurrencyValue="38";

String strFormatedMessage ="Do you want to Modify curreny from 42 to 38.

Regards

Chandrashekar.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member485701
Active Participant
0 Kudos

Hi,

This is possible.

like you used a key in the message pool

ex.

WANT_MODIFY is key for text

"Do you want to Modify curreny from to "

Take an object arry of size 2.

String strOldCurrencyValue="42";

String strNewCurrencyValue="38";

Object[] objects={strOldCurrencyValue,strNewCurrencyValue};

And write following statement:-

wdComponentAPI.getMessageManager().reportMessage(IMessage<CompName>.WANT_MODIFY, objects);

Your work is done.

Regards,

Praveen

Former Member
0 Kudos

Hi All,

This is possiable if message is to be used in"wdComponentAPI.getMessageManager().reportMessage" as per method signature.

<b><i>But What i need to do if I need to use the message as java.lang.String as argument ("dialogText" as below formessage) in "IWDConfirmationDialog".</i></b>

<i>I mean i need to show a dynamic message from message pool in "Confirmation Dialog Window"</i>

IWDControllerInfo controllerInfo = wdControllerAPI.getViewInfo().getViewController();

String <b>dialogText</b>="Do you want to Modify curreny from" +wdContext.currentOldOperationValueElement().getOldOperation() +" to" +wdContext.currentNewOperationValueElement().getNewOperation();

IWDConfirmationDialog dialog =

wdComponentAPI.getWindowManager().createConfirmationWindow(<b>dialogText</b>,controllerInfo.findInEventHandlers("Ok")," Ok ");

dialog.addChoice(controllerInfo.findInEventHandlers("Cancel"), "Cancel");

dialog.open();

Message was edited by:

Raghu v

former_member485701
Active Participant
0 Kudos

Hi,

you can get the text directly and store it in a String in the

following manner:-

Object[] objects={string1, string2};

wdComponentAPI.getTextAccessor().getText(IMessage<Component name>.KEY_NAME, objects);

I think this will solve your problem.

Regards,

Praveen

Former Member
0 Kudos

Hi Praveen,

This is perfectly working.

Former Member
0 Kudos

Hi,

Yes it's possible

Define "Do you want to Modify curreny from to " in MessagePool

You can pass parameters When you are reporting message like

wdComponentAPI.getMessageManager().reportMessage(IMessage<ComponentName>.<Key>,new Object[]{"42","38"},null);

Regards

LakshmiNarayana

Message was edited by:

Lakshmi Narayana Chowdary Namala