|
@@ -1,39 +1,39 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.components.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.forms.client.components.*; |
5 |
|
- |
|
6 |
|
- |
public class AbstractFormattableTextField extends AbstractTextField { |
7 |
|
- |
/** |
8 |
|
- |
* @param pTooltip - empty means no tooltip |
9 |
|
- |
* @param pDisplayCharsWidth - null means floodX |
10 |
|
- |
* @param pMaxChars - null means unlimited? |
11 |
|
- |
*/ |
12 |
|
- |
public AbstractFormattableTextField( String pTooltip, Integer pDisplayCharsWidth, Integer pMaxChars ) { |
13 |
|
- |
super( pTooltip, false, pDisplayCharsWidth, pMaxChars ); |
14 |
|
- |
} |
15 |
|
- |
|
16 |
|
- |
@Override |
17 |
|
- |
protected void fireBlurListeners() { |
18 |
|
- |
setCurrentValue( getCurrentValue() ); // todo: Is this how to force an Error? |
19 |
|
- |
super.fireBlurListeners(); |
20 |
|
- |
} |
21 |
|
- |
|
22 |
|
- |
@SuppressWarnings({"UnnecessaryLocalVariable"}) |
23 |
|
- |
@Override |
24 |
|
- |
public Object getCurrentValue() { |
25 |
|
- |
Object zValue = super.getCurrentValue(); |
26 |
|
- |
// undecorate & possibly return FormTextInputErrorValue |
27 |
|
- |
return zValue; |
28 |
|
- |
} |
29 |
|
- |
|
30 |
|
- |
@Override |
31 |
|
- |
public void setCurrentValue( Object pNewValue ) { |
32 |
|
- |
if ( pNewValue instanceof FormTextInputErrorValue ) { |
33 |
|
- |
super.setCurrentValue( pNewValue.toString() ); |
34 |
|
- |
return; |
35 |
|
- |
} |
36 |
|
- |
// decorate |
37 |
|
- |
super.setCurrentValue( pNewValue ); |
38 |
|
- |
} |
39 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.components.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.forms.client.components.*; |
|
5 |
+ |
|
|
6 |
+ |
public class AbstractFormattableTextField extends AbstractTextField { |
|
7 |
+ |
/** |
|
8 |
+ |
* @param pTooltip - empty means no tooltip |
|
9 |
+ |
* @param pDisplayCharsWidth - null means floodX |
|
10 |
+ |
* @param pMaxChars - null means unlimited? |
|
11 |
+ |
*/ |
|
12 |
+ |
public AbstractFormattableTextField( String pTooltip, Integer pDisplayCharsWidth, Integer pMaxChars ) { |
|
13 |
+ |
super( pTooltip, false, pDisplayCharsWidth, pMaxChars ); |
|
14 |
+ |
} |
|
15 |
+ |
|
|
16 |
+ |
@Override |
|
17 |
+ |
protected void fireBlurListeners() { |
|
18 |
+ |
setCurrentValue( getCurrentValue() ); // todo: Is this how to force an Error? |
|
19 |
+ |
super.fireBlurListeners(); |
|
20 |
+ |
} |
|
21 |
+ |
|
|
22 |
+ |
@SuppressWarnings({"UnnecessaryLocalVariable"}) |
|
23 |
+ |
@Override |
|
24 |
+ |
public Object getCurrentValue() { |
|
25 |
+ |
Object zValue = super.getCurrentValue(); |
|
26 |
+ |
// undecorate & possibly return FormTextInputErrorValue |
|
27 |
+ |
return zValue; |
|
28 |
+ |
} |
|
29 |
+ |
|
|
30 |
+ |
@Override |
|
31 |
+ |
public void setCurrentValue( Object pNewValue ) { |
|
32 |
+ |
if ( pNewValue instanceof FormTextInputErrorValue ) { |
|
33 |
+ |
super.setCurrentValue( pNewValue.toString() ); |
|
34 |
+ |
return; |
|
35 |
+ |
} |
|
36 |
+ |
// decorate |
|
37 |
+ |
super.setCurrentValue( pNewValue ); |
|
38 |
+ |
} |
|
39 |
+ |
} |