Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/OldClient/src/org/litesoft/GWT/forms/client/nonpublic/AbstractNonStringRequireableAttributeAdapter.java

Diff revisions: vs.
  @@ -1,33 +1,33 @@
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 - public abstract class AbstractNonStringRequireableAttributeAdapter
9 - extends AbstractFormRequireableAttributeAdapter {
10 - protected IFormComponentWithRawTextAccess mComponent;
11 -
12 - public AbstractNonStringRequireableAttributeAdapter( FormInstanceComponentHandler pComponentHandler,
13 - RequirableAttributeMetaData pRMD,
14 - IFormComponentWithRawTextAccess pComponent ) {
15 - super( pComponentHandler, pRMD, pRMD, pComponent );
16 - mComponent = pComponent;
17 - }
18 -
19 - protected final String convertComponentValueToString( Object pValue ) {
20 - String str = Strings.noEmpty( mComponent.getCurrentText() );
21 - return (str != null) ? "'" + str + "'" : "null";
22 - }
23 -
24 - protected final Object convertStringToComponentValue( String pValue ) {
25 - if ( (pValue == null) || "null".equals( pValue ) ) {
26 - return null;
27 - }
28 - if ( (pValue.length() < 2) && !pValue.startsWith( "'" ) && !pValue.endsWith( "'" ) ) {
29 - return "_Huh_";
30 - }
31 - return pValue.substring( 1, pValue.length() - 1 );
32 - }
33 - }
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 + public abstract class AbstractNonStringRequireableAttributeAdapter
9 + extends AbstractFormRequireableAttributeAdapter {
10 + protected IFormComponentWithRawTextAccess mComponent;
11 +
12 + public AbstractNonStringRequireableAttributeAdapter( FormInstanceComponentHandler pComponentHandler,
13 + RequirableAttributeMetaData pRMD,
14 + IFormComponentWithRawTextAccess pComponent ) {
15 + super( pComponentHandler, pRMD, pRMD, pComponent );
16 + mComponent = pComponent;
17 + }
18 +
19 + protected final String convertComponentValueToString( Object pValue ) {
20 + String str = ConstrainTo.significantOrNull( mComponent.getCurrentText() );
21 + return (str != null) ? "'" + str + "'" : "null";
22 + }
23 +
24 + protected final Object convertStringToComponentValue( String pValue ) {
25 + if ( (pValue == null) || "null".equals( pValue ) ) {
26 + return null;
27 + }
28 + if ( (pValue.length() < 2) && !pValue.startsWith( "'" ) && !pValue.endsWith( "'" ) ) {
29 + return "_Huh_";
30 + }
31 + return pValue.substring( 1, pValue.length() - 1 );
32 + }
33 + }