CopyableLabel: Avoid creating Flash movie for empty string

A label built for an empty string is almost certainly a dummy
being initialized by UiBinder before the data is available to
render into the widgets. Delay allocation of the movie DOM as
the movie just has to be rebuilt later when the real text is
supplied by the UI code.

Change-Id: Ifcefbb8bba3d9befa60c608c4457135ada0821b4
This commit is contained in:
Shawn Pearce 2013-08-21 22:25:14 -07:00
parent 8df6e691f9
commit dc3ce8e2dd

View File

@ -130,7 +130,7 @@ public class CopyableLabel extends Composite implements HasText {
}
private void embedMovie() {
if (flashEnabled && UserAgent.hasFlash) {
if (flashEnabled && UserAgent.hasFlash && text.length() > 0) {
final String flashVars = "text=" + URL.encodeQueryString(getText());
final SafeHtmlBuilder h = new SafeHtmlBuilder();