litesoft
Diff Revisions
762
vs
779
for /trunk/mobileGWT/SampleStarter/src/com/richasp/samplestarter/mobile/client/views/forms/FormsActivity.java
|
@@ -1,11 +1,12 @@ |
1 |
1 |
|
package com.richasp.samplestarter.mobile.client.views.forms; |
2 |
2 |
|
|
3 |
|
- |
import java.util.*; |
4 |
|
- |
|
|
3 |
+ |
import org.litesoft.codec.*; |
5 |
4 |
|
import org.litesoft.core.util.*; |
|
5 |
+ |
import org.litesoft.core.util.externalization.*; |
6 |
6 |
|
import org.litesoft.mgwt.client.pavsupport.*; |
7 |
7 |
|
|
8 |
8 |
|
import com.richasp.samplestarter.mobile.client.common.support.*; |
|
9 |
+ |
import com.richasp.samplestarter.mobile.client.views.forms.memo.*; |
9 |
10 |
|
|
10 |
11 |
|
public class FormsActivity extends AbstractBackableActivity<FormsView> implements FormsPresenter |
11 |
12 |
|
{ |
|
@@ -23,30 +24,21 @@ |
23 |
24 |
|
protected void start() |
24 |
25 |
|
{ |
25 |
26 |
|
String fromStorage = mClientfactory.getLocalStorage().get( LOCAL_STORAGE_KEY ); |
26 |
|
- |
List<String> zStrings = MultiStringPackaging.unpack( StringCodecRegistry.INSTANCE.decode( UtilsCommon.deNull( fromStorage ) ), 3 ); |
27 |
|
- |
String zFirstName = zStrings.get( 0 ); |
28 |
|
- |
String zLastName = zStrings.get( 1 ); |
29 |
|
- |
String zJobTitle = zStrings.get( 2 ); |
30 |
|
- |
mView.setFormValues( zFirstName, zLastName, zJobTitle ); |
|
27 |
+ |
FormsData zFormsData = FormsData.DEFAULT_INSTANCE.fromMemo( VersioningCodec.INSTANCE.decode( fromStorage ) ); |
|
28 |
+ |
mView.setFormValues( zFormsData ); |
31 |
29 |
|
} |
32 |
30 |
|
|
33 |
31 |
|
@Override |
34 |
|
- |
public void saveData( String pFirstName, String pLastName, String pJobTitle ) |
|
32 |
+ |
public void saveData( FormsData pFormsData ) |
35 |
33 |
|
{ |
36 |
|
- |
pFirstName = UtilsCommon.noEmpty( pFirstName ); |
37 |
|
- |
pLastName = UtilsCommon.noEmpty( pLastName ); |
38 |
|
- |
if ( null != (pJobTitle = UtilsCommon.noEmpty( pJobTitle )) ) |
|
34 |
+ |
E13nData zErrorData = pFormsData.validate(); |
|
35 |
+ |
if ( zErrorData != null ) |
39 |
36 |
|
{ |
40 |
|
- |
if ( (pFirstName == null) && (pLastName == null) ) |
41 |
|
- |
{ |
42 |
|
- |
mView.showError( INPUT_REQUIRED, "NoContactName" ); |
43 |
|
- |
return; |
44 |
|
- |
} |
|
37 |
+ |
mView.showError( INPUT_REQUIRED, "NoContactName" ); |
|
38 |
+ |
return; |
45 |
39 |
|
} |
46 |
|
- |
String toStorage = StringCodecRegistry.INSTANCE.encode( MultiStringPackaging.pack( pFirstName, // 0 |
47 |
|
- |
pLastName, // 1 |
48 |
|
- |
pJobTitle ) ); // 2 |
49 |
|
- |
mClientfactory.getLocalStorage().put( LOCAL_STORAGE_KEY, toStorage ); |
|
40 |
+ |
String toStorage = VersioningCodec.INSTANCE.encode( pFormsData.toMemo() ); |
|
41 |
+ |
mClientfactory.getLocalStorage().put( LOCAL_STORAGE_KEY, UtilsCommon.noEmpty( toStorage ) ); |
50 |
42 |
|
goBack(); |
51 |
43 |
|
} |
52 |
44 |
|
} |