|
@@ -1,48 +1,48 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.server.support.mdconstruction; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.forms.server.support.*; |
5 |
|
- |
import org.litesoft.GWT.forms.server.support.converters.*; |
6 |
|
- |
import org.litesoft.GWT.forms.server.support.nonpublic.*; |
7 |
|
- |
import org.litesoft.ui.def.nonpublic.support.*; |
8 |
|
- |
import org.litesoft.ui_1_5.def.nonpublic.*; |
9 |
|
- |
|
10 |
|
- |
public class FormAMDFactory_Boolean implements FormAttributeMetaDataFactory { |
11 |
|
- |
public static final FormAttributeMetaDataFactory INSTANCE = new FormAMDFactory_Boolean(); |
12 |
|
- |
|
13 |
|
- |
public AMDconverterPair createAttributeMetaData( CreateAMDParamsPlus pParams ) { |
14 |
|
- |
String zFormHint = pParams.getHintValue( COMPONENT_FORM ); |
15 |
|
- |
if ( pParams.isEditRequired() ) { |
16 |
|
- |
if ( CF_RADIO_GROUP.equals( zFormHint ) ) { |
17 |
|
- |
SendableBooleanKeyValuePairConverter converter = createBooleanOptions( pParams ); |
18 |
|
- |
return RadioGroupFormAMD.INSTANCE.create( pParams, converter, converter.getEntries() ); |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
return createCheckBox( pParams ); |
22 |
|
- |
} |
23 |
|
- |
|
24 |
|
- |
SendableBooleanKeyValuePairConverter converter = createBooleanOptions( pParams ); |
25 |
|
- |
return ComboBoxFormAMD.INSTANCE.create( pParams, converter, converter.getEntries() ); |
26 |
|
- |
} |
27 |
|
- |
|
28 |
|
- |
private SendableBooleanKeyValuePairConverter createBooleanOptions( CreateAMDParamsPlus pHintSource ) { |
29 |
|
- |
String value = pHintSource.getHintValue( BOOLEAN_VIEW ); |
30 |
|
- |
if ( value != null ) { |
31 |
|
- |
try { |
32 |
|
- |
return new SendableBooleanKeyValuePairConverter( new BooleanViewValues( value ) ); |
33 |
|
- |
} |
34 |
|
- |
catch ( IllegalArgumentException e ) { |
35 |
|
- |
LOGGER.warn.log( e, "Hint '", BOOLEAN_VIEW, "': ", value ); |
36 |
|
- |
// Fall Thru |
37 |
|
- |
} |
38 |
|
- |
} |
39 |
|
- |
return SendableBooleanKeyValuePairConverter.DEFAULT; |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
private AMDconverterPair createCheckBox( CreateAMDParamsPlus pParams ) { |
43 |
|
- |
return new AMDconverterPair( SendableBooleanConverter.INSTANCE, // |
44 |
|
- |
new CheckBoxMetaData( pParams.getUsage(), pParams.isDisabled(), // |
45 |
|
- |
pParams.getFieldLabel(), // |
46 |
|
- |
pParams.getFieldTooltip() ) ); |
47 |
|
- |
} |
48 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.server.support.mdconstruction; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.forms.server.support.*; |
|
5 |
+ |
import org.litesoft.GWT.forms.server.support.converters.*; |
|
6 |
+ |
import org.litesoft.GWT.forms.server.support.nonpublic.*; |
|
7 |
+ |
import org.litesoft.ui.def.nonpublic.support.*; |
|
8 |
+ |
import org.litesoft.ui_1_5.def.nonpublic.*; |
|
9 |
+ |
|
|
10 |
+ |
public class FormAMDFactory_Boolean implements FormAttributeMetaDataFactory { |
|
11 |
+ |
public static final FormAttributeMetaDataFactory INSTANCE = new FormAMDFactory_Boolean(); |
|
12 |
+ |
|
|
13 |
+ |
public AMDconverterPair createAttributeMetaData( CreateAMDParamsPlus pParams ) { |
|
14 |
+ |
String zFormHint = pParams.getHintValue( COMPONENT_FORM ); |
|
15 |
+ |
if ( pParams.isEditRequired() ) { |
|
16 |
+ |
if ( CF_RADIO_GROUP.equals( zFormHint ) ) { |
|
17 |
+ |
SendableBooleanKeyValuePairConverter converter = createBooleanOptions( pParams ); |
|
18 |
+ |
return RadioGroupFormAMD.INSTANCE.create( pParams, converter, converter.getEntries() ); |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
return createCheckBox( pParams ); |
|
22 |
+ |
} |
|
23 |
+ |
|
|
24 |
+ |
SendableBooleanKeyValuePairConverter converter = createBooleanOptions( pParams ); |
|
25 |
+ |
return ComboBoxFormAMD.INSTANCE.create( pParams, converter, converter.getEntries() ); |
|
26 |
+ |
} |
|
27 |
+ |
|
|
28 |
+ |
private SendableBooleanKeyValuePairConverter createBooleanOptions( CreateAMDParamsPlus pHintSource ) { |
|
29 |
+ |
String value = pHintSource.getHintValue( BOOLEAN_VIEW ); |
|
30 |
+ |
if ( value != null ) { |
|
31 |
+ |
try { |
|
32 |
+ |
return new SendableBooleanKeyValuePairConverter( new BooleanViewValues( value ) ); |
|
33 |
+ |
} |
|
34 |
+ |
catch ( IllegalArgumentException e ) { |
|
35 |
+ |
LOGGER.warn.log( e, "Hint '", BOOLEAN_VIEW, "': ", value ); |
|
36 |
+ |
// Fall Thru |
|
37 |
+ |
} |
|
38 |
+ |
} |
|
39 |
+ |
return SendableBooleanKeyValuePairConverter.DEFAULT; |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
private AMDconverterPair createCheckBox( CreateAMDParamsPlus pParams ) { |
|
43 |
+ |
return new AMDconverterPair( SendableBooleanConverter.INSTANCE, // |
|
44 |
+ |
new CheckBoxMetaData( pParams.getUsage(), pParams.isDisabled(), // |
|
45 |
+ |
pParams.getFieldLabel(), // |
|
46 |
+ |
pParams.getFieldTooltip() ) ); |
|
47 |
+ |
} |
|
48 |
+ |
} |