PDA

View Full Version : Can I add raw text into LayoutConainer ?



jita
25 Jun 2008, 12:22 AM
Hello.

Can I add raw text into LayoutConainer ?

First, I tried ...
addText("aaa");

The result is
<div>
<div>aaa</div>
</div>

Second, I tried ...
Text text = new Text();
t.setText("aaa");
add(text);

The result is same.

I wish ...
<div>
aaa
</div>

I want to construct big span tree including ...
a lot of raw texts (very very short),
a lot of nested span nodes,
and a few components.
And, I want to add and remove any node in this tree.

If usually raw text is wraped by <div> or <span> tag,
the cost is high for my tree.

Can I have good solution ?

Thanks.
jita

gslender
25 Jun 2008, 1:51 AM
why not just keep a StringBuffer of the text, and then just text.setText(sb.toString()) when you need to ? there is no need to keep adding Text elements if you don't need/want to

jita
25 Jun 2008, 2:57 AM
Thanks, your reply !

>keep a StringBuffer of the text, and then just text.setText(sb.toString()) when you need to ?

You mean, use a few text component with connected short texts ?

Short raw texts are separated by span in my tree,
and the span range has defferent attribute.

My tree is like ...

<span>
aaa
<span>
bbb
<span>ccc</span>
bbb
<span>ccc</span>
bbb
</span>
aaa
<span>
bbb
<span>ccc</span>
bbb
<span>ccc</span>
bbb
</span>
aaa
</span>

There is 7 tag sets;
Above aaa,bbb,ccc is corresponds to a word,colon,semicolon,space...
And span range is corresponds to section,sentence,phrase ...
I wish the aaa,bbb(not ccc) be not wrapped by tags.
If they are wrapped, The tag sets count up 9.

jita

gslender
25 Jun 2008, 3:49 AM
I'm not sure I understand your problem - perhaps its not really a GXT issue?

eitherway, if you know what you want, just build it and put that into a HTML that sits in the panel??

jita
25 Jun 2008, 4:36 AM
Yes, for construct my tree,
I can generate big html string from my data,
and addText() to LayoutContainer.
It will build up the tree from html.

But this way, I can't use any nice components in that tree. isn't it ?
I wish to place some shining star in that tree.

jita

gslender
26 Jun 2008, 12:11 AM
But this way, I can't use any nice components in that tree. isn't it ?


Yep - if you need/want to use the components then ya gonna have to accept the way they layout and produce HTML in the browser... that's point I think?