Subversion Repository Public Repository

litesoft

Diff Revisions 949 vs 950 for /trunk/Java/GWT/Client/src/org/litesoft/GWT/forms/client/components/nonpublic/AbstractFocusWidgetErrorableFormElement.java

Diff revisions: vs.
  @@ -1,38 +1,38 @@
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.client.widgets.*;
5 - import org.litesoft.commonfoundation.typeutils.*;
6 -
7 - public abstract class AbstractFocusWidgetErrorableFormElement extends AbstractFocusWidgetFormElement {
8 - protected String mTooltip;
9 - protected String mError = null;
10 -
11 - protected AbstractFocusWidgetErrorableFormElement( IFocusWidget pInputWidget, String pTooltip, String pWidgetStyle, boolean pAddStyle ) {
12 - super( pInputWidget, pWidgetStyle, pAddStyle );
13 - mTooltip = Strings.noEmpty( pTooltip );
14 - }
15 -
16 - // IFormComponent
17 -
18 - @Override
19 - public void setError( String pError ) {
20 - mError = Strings.noEmpty( pError );
21 - stateChanged();
22 - }
23 -
24 - // AbstractFormElement
25 -
26 - @Override
27 - public boolean hasError() {
28 - return (mError != null);
29 - }
30 -
31 - @Override
32 - protected void stateChanged() {
33 - super.stateChanged();
34 - if ( mIndicatorTd != null ) {
35 - mIndicatorTd.setTitle( hasError() ? mError : mTooltip );
36 - }
37 - }
38 - }
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.client.widgets.*;
5 + import org.litesoft.commonfoundation.base.*;
6 +
7 + public abstract class AbstractFocusWidgetErrorableFormElement extends AbstractFocusWidgetFormElement {
8 + protected String mTooltip;
9 + protected String mError = null;
10 +
11 + protected AbstractFocusWidgetErrorableFormElement( IFocusWidget pInputWidget, String pTooltip, String pWidgetStyle, boolean pAddStyle ) {
12 + super( pInputWidget, pWidgetStyle, pAddStyle );
13 + mTooltip = ConstrainTo.significantOrNull( pTooltip );
14 + }
15 +
16 + // IFormComponent
17 +
18 + @Override
19 + public void setError( String pError ) {
20 + mError = ConstrainTo.significantOrNull( pError );
21 + stateChanged();
22 + }
23 +
24 + // AbstractFormElement
25 +
26 + @Override
27 + public boolean hasError() {
28 + return (mError != null);
29 + }
30 +
31 + @Override
32 + protected void stateChanged() {
33 + super.stateChanged();
34 + if ( mIndicatorTd != null ) {
35 + mIndicatorTd.setTitle( hasError() ? mError : mTooltip );
36 + }
37 + }
38 + }