|
@@ -1,33 +1,33 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.factories.others; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
5 |
|
- |
import org.litesoft.GWT.forms.client.components.factories.*; |
6 |
|
- |
import org.litesoft.GWT.forms.client.nonpublic.*; |
7 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
8 |
|
- |
import org.litesoft.ui.def.*; |
9 |
|
- |
import org.litesoft.ui.def.nonpublic.*; |
10 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
11 |
|
- |
|
12 |
|
- |
import com.google.gwt.user.client.ui.*; |
13 |
|
- |
|
14 |
|
- |
public class UiLabelWidgetFactory implements FormComponentFactory { |
15 |
|
- |
public Widget create( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
16 |
|
- |
FormMetaData pFormMetaData, boolean pHasHorizontalPeer ) { |
17 |
|
- |
UiLabelDef zDef = (UiLabelDef) pUiDef; |
18 |
|
- |
LabelMetaData zMD = pFormMetaData.getLabel( zDef ); |
19 |
|
- |
if ( zMD == null ) { |
20 |
|
- |
throw new IllegalStateException( "Metadata required for a " + zDef ); |
21 |
|
- |
} |
22 |
|
- |
return ApplyFont.to( zDef.getFont(), createLabel( zDef, zMD ) ); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
protected Widget createLabel( UiLabelDef pDef, LabelMetaData pMD ) { |
26 |
|
- |
String text = Strings.normalizeNewLines( pMD.getExternalText() ); |
27 |
|
- |
if ( -1 == text.indexOf( '\n' ) ) { |
28 |
|
- |
return new Label( text ); |
29 |
|
- |
} |
30 |
|
- |
String html = null; // todo: translate: UtilsGwt.HTMLize( text ); |
31 |
|
- |
return new HTML( html ); |
32 |
|
- |
} |
33 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.factories.others; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
5 |
+ |
import org.litesoft.GWT.forms.client.components.factories.*; |
|
6 |
+ |
import org.litesoft.GWT.forms.client.nonpublic.*; |
|
7 |
+ |
import org.litesoft.commonfoundation.typeutils.*; |
|
8 |
+ |
import org.litesoft.ui.def.*; |
|
9 |
+ |
import org.litesoft.ui.def.nonpublic.*; |
|
10 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
11 |
+ |
|
|
12 |
+ |
import com.google.gwt.user.client.ui.*; |
|
13 |
+ |
|
|
14 |
+ |
public class UiLabelWidgetFactory implements FormComponentFactory { |
|
15 |
+ |
public Widget create( FormInstanceComponentHandler pComponentHandler, UiDef pUiDef, |
|
16 |
+ |
FormMetaData pFormMetaData, boolean pHasHorizontalPeer ) { |
|
17 |
+ |
UiLabelDef zDef = (UiLabelDef) pUiDef; |
|
18 |
+ |
LabelMetaData zMD = pFormMetaData.getLabel( zDef ); |
|
19 |
+ |
if ( zMD == null ) { |
|
20 |
+ |
throw new IllegalStateException( "Metadata required for a " + zDef ); |
|
21 |
+ |
} |
|
22 |
+ |
return ApplyFont.to( zDef.getFont(), createLabel( zDef, zMD ) ); |
|
23 |
+ |
} |
|
24 |
+ |
|
|
25 |
+ |
protected Widget createLabel( UiLabelDef pDef, LabelMetaData pMD ) { |
|
26 |
+ |
String text = Strings.normalizeNewLines( pMD.getExternalText() ); |
|
27 |
+ |
if ( -1 == text.indexOf( '\n' ) ) { |
|
28 |
+ |
return new Label( text ); |
|
29 |
+ |
} |
|
30 |
+ |
String html = null; // todo: translate: UtilsGwt.HTMLize( text ); |
|
31 |
+ |
return new HTML( html ); |
|
32 |
+ |
} |
|
33 |
+ |
} |