|
@@ -1,39 +1,39 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.forms.client.components.*; |
5 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
6 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
7 |
|
- |
|
8 |
|
- |
import java.io.*; |
9 |
|
- |
|
10 |
|
- |
public class StringRequireableAttributeAdapter extends AbstractFormRequireableAttributeAdapter { |
11 |
|
- |
public StringRequireableAttributeAdapter( FormInstanceComponentHandler pComponentHandler, |
12 |
|
- |
AttributeMetaData pMD, UiRequirableMetaData pRMD, |
13 |
|
- |
IFormComponent pComponent ) { |
14 |
|
- |
super( pComponentHandler, pMD, pRMD, pComponent ); |
15 |
|
- |
} |
16 |
|
- |
|
17 |
|
- |
protected Serializable LLconvertNonNullComponentValueToSendable( Object pValue ) { |
18 |
|
- |
return Strings.noEmpty( (String) pValue ); |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
protected Object convertSendableToComponentValue( Serializable pValue ) { |
22 |
|
- |
return (pValue == null) ? "" : pValue.toString().trim(); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
protected String convertComponentValueToString( Object pValue ) { |
26 |
|
- |
String str = Strings.noEmpty( (String) pValue ); |
27 |
|
- |
return (str != null) ? "'" + str + "'" : "null"; |
28 |
|
- |
} |
29 |
|
- |
|
30 |
|
- |
protected Object convertStringToComponentValue( String pValue ) { |
31 |
|
- |
if ( (pValue == null) || "null".equals( pValue ) ) { |
32 |
|
- |
return null; |
33 |
|
- |
} |
34 |
|
- |
if ( (pValue.length() < 2) && !pValue.startsWith( "'" ) && !pValue.endsWith( "'" ) ) { |
35 |
|
- |
return "_Huh_"; |
36 |
|
- |
} |
37 |
|
- |
return pValue.substring( 1, pValue.length() - 1 ); |
38 |
|
- |
} |
39 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.forms.client.components.*; |
|
5 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
6 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
7 |
+ |
|
|
8 |
+ |
import java.io.*; |
|
9 |
+ |
|
|
10 |
+ |
public class StringRequireableAttributeAdapter extends AbstractFormRequireableAttributeAdapter { |
|
11 |
+ |
public StringRequireableAttributeAdapter( FormInstanceComponentHandler pComponentHandler, |
|
12 |
+ |
AttributeMetaData pMD, UiRequirableMetaData pRMD, |
|
13 |
+ |
IFormComponent pComponent ) { |
|
14 |
+ |
super( pComponentHandler, pMD, pRMD, pComponent ); |
|
15 |
+ |
} |
|
16 |
+ |
|
|
17 |
+ |
protected Serializable LLconvertNonNullComponentValueToSendable( Object pValue ) { |
|
18 |
+ |
return ConstrainTo.significantOrNull( (String) pValue ); |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
protected Object convertSendableToComponentValue( Serializable pValue ) { |
|
22 |
+ |
return (pValue == null) ? "" : pValue.toString().trim(); |
|
23 |
+ |
} |
|
24 |
+ |
|
|
25 |
+ |
protected String convertComponentValueToString( Object pValue ) { |
|
26 |
+ |
String str = ConstrainTo.significantOrNull( (String) pValue ); |
|
27 |
+ |
return (str != null) ? "'" + str + "'" : "null"; |
|
28 |
+ |
} |
|
29 |
+ |
|
|
30 |
+ |
protected Object convertStringToComponentValue( String pValue ) { |
|
31 |
+ |
if ( (pValue == null) || "null".equals( pValue ) ) { |
|
32 |
+ |
return null; |
|
33 |
+ |
} |
|
34 |
+ |
if ( (pValue.length() < 2) && !pValue.startsWith( "'" ) && !pValue.endsWith( "'" ) ) { |
|
35 |
+ |
return "_Huh_"; |
|
36 |
+ |
} |
|
37 |
+ |
return pValue.substring( 1, pValue.length() - 1 ); |
|
38 |
+ |
} |
|
39 |
+ |
} |