Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/OldServer/src/org/litesoft/GWT/forms/server/support/converters/SendableBooleanKeyValuePairConverter.java

Diff revisions: vs.
  @@ -1,55 +1,55 @@
1 - // This Source Code is in the Public Domain per: http://unlicense.org
2 - package org.litesoft.GWT.forms.server.support.converters;
3 -
4 - import org.litesoft.GWT.forms.server.support.nonpublic.*;
5 - import org.litesoft.core.simpletypes.*;
6 - import org.litesoft.ui_1_5.def.nonpublic.*;
7 -
8 - import java.io.*;
9 -
10 - public class SendableBooleanKeyValuePairConverter extends AbstractSendableDataConverter {
11 - public static final SendableBooleanKeyValuePairConverter DEFAULT =
12 - new SendableBooleanKeyValuePairConverter();
13 -
14 - private StringKeyValuePair mTruePair;
15 - private StringKeyValuePair mFalsePair;
16 - private StringKeyValuePair[] mEntries;
17 -
18 - public SendableBooleanKeyValuePairConverter( String pTrueValue, String pFalseValue ) {
19 - mEntries = new StringKeyValuePair[] //
20 - { //
21 - mFalsePair = new StringKeyValuePair( Boolean.FALSE.toString(), pFalseValue ), //
22 - mTruePair = new StringKeyValuePair( Boolean.TRUE.toString(), pTrueValue ), //
23 - };
24 - }
25 -
26 - public SendableBooleanKeyValuePairConverter( BooleanViewValues pViewValues ) {
27 - this( pViewValues.getTrueValue(), pViewValues.getFalseValue() );
28 - }
29 -
30 - public SendableBooleanKeyValuePairConverter() {
31 - this( Boolean.TRUE.toString(), Boolean.FALSE.toString() );
32 - }
33 -
34 - public StringKeyValuePair getTruePair() {
35 - return mTruePair;
36 - }
37 -
38 - public StringKeyValuePair getFalsePair() {
39 - return mFalsePair;
40 - }
41 -
42 - public StringKeyValuePair[] getEntries() {
43 - return mEntries;
44 - }
45 -
46 - protected Serializable convertNotNullToPassable( Object pValue ) {
47 - return to_boolean( pValue ) ? mTruePair : mFalsePair;
48 - }
49 -
50 - protected Object convertNotNullNotBoxedTypeFromPassable( Serializable pValue ) {
51 - return (pValue instanceof SimpleKeyValuePair) ? //
52 - to_Boolean( ((SimpleKeyValuePair) pValue).getKey() ) : //
53 - to_Boolean( pValue );
54 - }
55 - }
1 + // This Source Code is in the Public Domain per: http://unlicense.org
2 + package org.litesoft.GWT.forms.server.support.converters;
3 +
4 + import org.litesoft.GWT.forms.server.support.nonpublic.*;
5 + import org.litesoft.core.simpletypes.*;
6 + import org.litesoft.ui_1_5.def.nonpublic.*;
7 +
8 + import java.io.*;
9 +
10 + public class SendableBooleanKeyValuePairConverter extends AbstractSendableDataConverter {
11 + public static final SendableBooleanKeyValuePairConverter DEFAULT =
12 + new SendableBooleanKeyValuePairConverter();
13 +
14 + private StringKeyValuePair mTruePair;
15 + private StringKeyValuePair mFalsePair;
16 + private StringKeyValuePair[] mEntries;
17 +
18 + public SendableBooleanKeyValuePairConverter( String pTrueValue, String pFalseValue ) {
19 + mEntries = new StringKeyValuePair[] //
20 + { //
21 + mFalsePair = new StringKeyValuePair( Boolean.FALSE.toString(), pFalseValue ), //
22 + mTruePair = new StringKeyValuePair( Boolean.TRUE.toString(), pTrueValue ), //
23 + };
24 + }
25 +
26 + public SendableBooleanKeyValuePairConverter( BooleanViewValues pViewValues ) {
27 + this( pViewValues.getTrueValue(), pViewValues.getFalseValue() );
28 + }
29 +
30 + public SendableBooleanKeyValuePairConverter() {
31 + this( Boolean.TRUE.toString(), Boolean.FALSE.toString() );
32 + }
33 +
34 + public StringKeyValuePair getTruePair() {
35 + return mTruePair;
36 + }
37 +
38 + public StringKeyValuePair getFalsePair() {
39 + return mFalsePair;
40 + }
41 +
42 + public StringKeyValuePair[] getEntries() {
43 + return mEntries;
44 + }
45 +
46 + protected Serializable convertNotNullToPassable( Object pValue ) {
47 + return to_boolean( pValue ) ? mTruePair : mFalsePair;
48 + }
49 +
50 + protected Object convertNotNullNotBoxedTypeFromPassable( Serializable pValue ) {
51 + return (pValue instanceof SimpleKeyValuePair) ? //
52 + to_Boolean( ((SimpleKeyValuePair) pValue).getKey() ) : //
53 + to_Boolean( pValue );
54 + }
55 + }