cancel
Showing results for 
Search instead for 
Did you mean: 

insert <br/> in LinkToAction

Former Member
0 Kudos

how do you put a <br/> in a sentence containing linktoaction?

example

example:

IWDLinkToAction la = (IWDLinkToAction) view.createElement (IWDLinkToAction.class, null);

la.setOnAction (wdThis.wdGetMyAction ());

la.setEnabled (true);

String foo = "<br/> aaaa bbbb cccc <br/> <br/>";

la.setText (foo);

la.setVisible (WDVisibility.VISIBLE);

groupElement.addChild (la);

only that this appears like this:

<br/> aaaa bbbb cccc <br/> <br/>

Instead I want to see that;

aaaa

bbbb

cccc

someone help me?

thanks

banana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Friend,

Try This it worked in my Case i am using NWDS 7.1


 wdContext.currentContextElement().setString("Jeetendra"+"\n"+"Kumar"+"\n");

Make a value attribute of type String.

Bind that to the text property of Link to Action.

Make the Wrapping Property True.(Don't forget).

and you are done.

Hope it will help.

Regards

Jeetendra.

Former Member
0 Kudos

Hi friends

I tried these 2 ways but not working properly ....

Here are two sources:

Banana method:


for(int i=0;i<wdContext.nodeClassi().size();i++){
	wdContext.nodeClassi().moveTo(i);
	IWDLinkToAction la = (IWDLinkToAction) view.createElement(IWDLinkToAction.class, null );
	la.setOnAction(wdThis.wdGetMyAction());
	la.setEnabled(true);
	StringBuffer mesg= new StringBuffer();
	mesg.append( wdContext.nodeClass().getClassiElementAt(i).getA() );
	mesg.append( "\n" );
	mesg.append(wdContext.nodeClass().getClassiElementAt(i).getB());
	mesg.append( "\n" );
	mesg.append(wdContext.nodeClass().getClassiElementAt(i).getC());
	mesg.append( "\n" );
			
	String prov = mesg.toString(); 
	la.setWrapping(true);
	la.setText(prov);
	
	la.setVisible(WDVisibility.VISIBLE);
	groupElement.addChild(la);
}

Dreams4Desires method :


for(int i=0;i<wdContext.nodeClassi().size();i++){
	wdContext.nodeClassi().moveTo(i);
	IWDLinkToAction la = (IWDLinkToAction) view.createElement(IWDLinkToAction.class, null );
	la.setOnAction(wdThis.wdGetMyAction());
	la.setEnabled(true);
	wdContext.currentContextElement().setLinkProv("Jeetendra"+"\n"+"Kumar"+"\n");
	la.setText(wdContext.currentContextElement().getLinkProv());
	la.setWrapping(true);
	la.setVisible(WDVisibility.VISIBLE);
	groupElement.addChild(la);
}

I use NWDS 7.0.15

Help me

Thank

Banana

Edited by: Captain Banana on Nov 27, 2009 8:27 AM

Edited by: Captain Banana on Nov 27, 2009 8:28 AM

Former Member
0 Kudos

Hi Banana,

I had already told you that newline character (\n) just doesn't work for LinkToAction on 7.0. I has tried it myself. Only, if we put it in transparent container and set the width of the transparent container to something say 150px and then turn the wrapping of the LinkToAction UI element to true, you can have more than 1 line to display text of LinkToAction. I understand, the text wrapping for LinkToAction should have worked, but that is just a bug. So, we have to find alternatives rather. And the alternative includes setting space in between the words that need to be displayed in different lines manually. It is trial and check.

Use the following code to insert a transparent container and the create Link to Action within a transparent container and then insert the transparent container in your group UI element.

for(int i=0;i<wdContext.nodeClassi().size();i++){

wdContext.nodeClassi().moveTo(i);

IWDTransparentContainer root= (IWDTransparentContainer)view.getRootElement();

IWDGroup groupElement = (IWDGroup) view.createElement(IWDGroup.class, null);

root.addChild(groupElement);

IWDTransparentContainer wrapperTc= (IWDTransparentContainer)view.createElement(IWDTransparentContainer.class, null);

wrapperTc.setWidth("150px");

groupElement .addChild(wrapperTc);

IWDLinkToAction la = (IWDLinkToAction) view.createElement(IWDLinkToAction.class, null );

la.setOnAction(wdThis.wdGetMyAction());

la.setEnabled(true);

StringBuffer mesg= new StringBuffer();

mesg.append( wdContext.nodeClass().getClassiElementAt(i).getA() );

mesg.append( " " );

mesg.append(wdContext.nodeClass().getClassiElementAt(i).getB());

mesg.append( " " );

mesg.append(wdContext.nodeClass().getClassiElementAt(i).getC());

mesg.append( " " );

String prov = mesg.toString();

la.setWrapping(true);

la.setText(prov);

la.setVisible(WDVisibility.VISIBLE);

wrapperTc.addChild(la);

}

Hope your problem is solved.

Regards,

Tushar Sinha

Former Member
0 Kudos

Thank Tushar Sinha

This problem is solved.

Regards

Banana

Edited by: Captain Banana on Nov 27, 2009 10:18 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Banana,

Did you try using newline character between the strings to show them in different lines. I mean use

String xyz = "aaaa \nbbbb \n cccc";

and then set this string to your text.

Regards,

Tushar Sinha

Former Member
0 Kudos

I tried to do as you say does not go ...

String xyz = "yyyy \n bbbb \n CCCC";

shows that;

aaaa bbbb cccc

Instead I

aaaa

bbbb

cccc

I do not understand the \n does not wrap.

Do you have any other suggestions?

Thanks

Banana

Former Member
0 Kudos

Hi Banana,

I tried using newline character between the strings to show them in different lines. I mean use

String xyz = "aaaa \nbbbb \n cccc";

and then set this string to text of Link to Action but doesn't work.

Got an idea. You can put this LinkToAction in a transparent container and set the width to around 150, set the wrapping of the link to action and the transparent container both as true and then adjust the spacing of the letters manually. I checked. It works.

I mean something link

String xyz = "aaaa... bbbb.... cccc";

Regards,

Tushar Sinha