pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject Re: How to express a newline in a Label within BXML?
Date Thu, 22 Aug 2013 10:00:24 GMT
Hi Erik,
you have reason, currently I find multiline label samples only in
LabelTest.java class, I have to add a bxml version of it ...
Searching in our sources, I find other examples for multiline strings
(in bxml files), but for other components (TableView, and related
renderers), like: table_pane_test2.bxml, table_pane_test4.bxml ... but
these could be a starting point. Could you do some tests starting from
here ?

Anyway this could be a BXMLSerializer issue (LabelSkin does the line
splitting if it finds the \n snside the label text , but as a single
char), so we have to verify it.

Roger, what do you think ?

Let's update.


2013/8/22 Erik Innocent <einnocent@gmail.com>:
> Thanks everyone for your help so far! I've yet another question.
> How do I place a newline in a Label's text in BXML? I see that in 2.0.3,
> Pivot began supporting text labels with hard newlines with the "\n"
> character
> (http://mail-archives.apache.org/mod_mbox/pivot-commits/201301.mbox/%3C20130122010418.3EC4223889F7@eris.apache.org%3E),
> but this seems only to work programmatically.
> As a workaround, I've tried the following things, which all fail:
> Placing "\n" as the value of the text attribute in the label in BXML. This
> shows up as "\n" in the application, and "\\n" when viewing the
> label.getText() result
> Using "\\n" as the value instead, in hopes that the double backslash might
> escape. It does not, and the label text appears as "\\n" in the app.
> Doing label.setText(label.getText()) with 'text="\n" in BXML'. Doesn't work
> because the "\n" is already escaped to "\\n". I suppose I could do a replace
> of "\\" with "\" before setText(), but it seems inelegant to have to
> initialize all labels like this.
> Other than setting the label programmatically, any tips? Note that setting
> the value programmatically does work for me. I've got "wrapText:true" set in
> my tests.
> Thanks!
> --E

View raw message