|
@@ -1,37 +1,37 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.factories.input; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.forms.client.components.*; |
5 |
|
- |
import org.litesoft.GWT.forms.client.components.factories.*; |
6 |
|
- |
import org.litesoft.GWT.forms.client.components.impls.input.*; |
7 |
|
- |
import org.litesoft.GWT.forms.client.nonpublic.*; |
8 |
|
- |
import org.litesoft.ui.def.nonpublic.*; |
9 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
10 |
|
- |
import org.litesoft.uispecification.*; |
11 |
|
- |
|
12 |
|
- |
import com.google.gwt.user.client.ui.*; |
13 |
|
- |
|
14 |
|
- |
public class UiTextFieldWidgetFactory implements InputWidgetFactory { |
15 |
|
- |
public Widget create( FormInstanceComponentHandler pComponentHandler, // |
16 |
|
- |
UiInputDef pUiDef, AttributeMetaData pMetaData, |
17 |
|
- |
boolean pHasHorizontalPeer ) { |
18 |
|
- |
TextFieldMetaData zMD = (TextFieldMetaData) pMetaData; |
19 |
|
- |
|
20 |
|
- |
String zLabelText = !pUiDef.isLabelLess() ? zMD.getExternalText() : null; |
21 |
|
- |
UiFont zLabelFont = pUiDef.getLabelFont(); |
22 |
|
- |
String zTooltip = zMD.getTooltip(); |
23 |
|
- |
|
24 |
|
- |
Integer zPreferredWidth = !pUiDef.isFloodX() ? zMD.getPreferredWidth() : null; |
25 |
|
- |
Integer zMaxChars = zMD.getMaxChars(); |
26 |
|
- |
|
27 |
|
- |
IFormComponent zFC; |
28 |
|
- |
|
29 |
|
- |
if ( pMetaData.hasHint( COMPONENT_FORM, CF_TEXT_FIELD_RIGHT_ALIGNED ) ) { |
30 |
|
- |
zFC = new FormRightAlignTextField( zLabelText, zLabelFont, zTooltip, zPreferredWidth, zMaxChars ); |
31 |
|
- |
} else { |
32 |
|
- |
zFC = new FormTextField( zLabelText, zLabelFont, zTooltip, zPreferredWidth, zMaxChars ); |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
return new StringRequireableAttributeAdapter( pComponentHandler, zMD, zMD, zFC ).init(); |
36 |
|
- |
} |
37 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.factories.input; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.forms.client.components.*; |
|
5 |
+ |
import org.litesoft.GWT.forms.client.components.factories.*; |
|
6 |
+ |
import org.litesoft.GWT.forms.client.components.impls.input.*; |
|
7 |
+ |
import org.litesoft.GWT.forms.client.nonpublic.*; |
|
8 |
+ |
import org.litesoft.ui.def.nonpublic.*; |
|
9 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
10 |
+ |
import org.litesoft.uispecification.*; |
|
11 |
+ |
|
|
12 |
+ |
import com.google.gwt.user.client.ui.*; |
|
13 |
+ |
|
|
14 |
+ |
public class UiTextFieldWidgetFactory implements InputWidgetFactory { |
|
15 |
+ |
public Widget create( FormInstanceComponentHandler pComponentHandler, // |
|
16 |
+ |
UiInputDef pUiDef, AttributeMetaData pMetaData, |
|
17 |
+ |
boolean pHasHorizontalPeer ) { |
|
18 |
+ |
TextFieldMetaData zMD = (TextFieldMetaData) pMetaData; |
|
19 |
+ |
|
|
20 |
+ |
String zLabelText = !pUiDef.isLabelLess() ? zMD.getExternalText() : null; |
|
21 |
+ |
UiFont zLabelFont = pUiDef.getLabelFont(); |
|
22 |
+ |
String zTooltip = zMD.getTooltip(); |
|
23 |
+ |
|
|
24 |
+ |
Integer zPreferredWidth = !pUiDef.isFloodX() ? zMD.getPreferredWidth() : null; |
|
25 |
+ |
Integer zMaxChars = zMD.getMaxChars(); |
|
26 |
+ |
|
|
27 |
+ |
IFormComponent zFC; |
|
28 |
+ |
|
|
29 |
+ |
if ( pMetaData.hasHint( COMPONENT_FORM, CF_TEXT_FIELD_RIGHT_ALIGNED ) ) { |
|
30 |
+ |
zFC = new FormRightAlignTextField( zLabelText, zLabelFont, zTooltip, zPreferredWidth, zMaxChars ); |
|
31 |
+ |
} else { |
|
32 |
+ |
zFC = new FormTextField( zLabelText, zLabelFont, zTooltip, zPreferredWidth, zMaxChars ); |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
return new StringRequireableAttributeAdapter( pComponentHandler, zMD, zMD, zFC ).init(); |
|
36 |
+ |
} |
|
37 |
+ |
} |