|
@@ -1,46 +1,46 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.forms.client.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.user.client.*; |
7 |
|
- |
import com.google.gwt.user.client.ui.*; |
8 |
|
- |
|
9 |
|
- |
public class WidgetHidingFormComponent extends AbstractNonShowingFormComponent { |
10 |
|
- |
private Widget mWidget; |
11 |
|
- |
|
12 |
|
- |
public WidgetHidingFormComponent( Widget pWidget ) { |
13 |
|
- |
mWidget = pWidget; |
14 |
|
- |
adjustWidgetVisibility(); |
15 |
|
- |
} |
16 |
|
- |
|
17 |
|
- |
public void relayout() { |
18 |
|
- |
} |
19 |
|
- |
|
20 |
|
- |
public void setWidth( String width ) { |
21 |
|
- |
} |
22 |
|
- |
|
23 |
|
- |
public void setHeight( String height ) { |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
public void setCurrentValue( Object pCurrentValue ) { |
27 |
|
- |
super.setCurrentValue( pCurrentValue ); |
28 |
|
- |
adjustWidgetVisibility(); |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
public boolean isVisible() { |
32 |
|
- |
Object zValue = getCurrentValue(); |
33 |
|
- |
return (zValue != null) && !Boolean.FALSE.equals( Booleans.fromString( zValue.toString() ) ); |
34 |
|
- |
} |
35 |
|
- |
|
36 |
|
- |
private void adjustWidgetVisibility() { |
37 |
|
- |
Element zStyleElement = BackDoorToWidget.getStyleElement( mWidget ); |
38 |
|
- |
String zValue = isVisible() ? "inherit" : "hidden"; |
39 |
|
- |
DOM.setStyleAttribute( zStyleElement, "visibility", zValue ); |
40 |
|
- |
} |
41 |
|
- |
|
42 |
|
- |
@Override |
43 |
|
- |
public boolean hasError() { |
44 |
|
- |
return false; // todo: implement |
45 |
|
- |
} |
46 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.forms.client.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.commonfoundation.typeutils.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.user.client.*; |
|
7 |
+ |
import com.google.gwt.user.client.ui.*; |
|
8 |
+ |
|
|
9 |
+ |
public class WidgetHidingFormComponent extends AbstractNonShowingFormComponent { |
|
10 |
+ |
private Widget mWidget; |
|
11 |
+ |
|
|
12 |
+ |
public WidgetHidingFormComponent( Widget pWidget ) { |
|
13 |
+ |
mWidget = pWidget; |
|
14 |
+ |
adjustWidgetVisibility(); |
|
15 |
+ |
} |
|
16 |
+ |
|
|
17 |
+ |
public void relayout() { |
|
18 |
+ |
} |
|
19 |
+ |
|
|
20 |
+ |
public void setWidth( String width ) { |
|
21 |
+ |
} |
|
22 |
+ |
|
|
23 |
+ |
public void setHeight( String height ) { |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
public void setCurrentValue( Object pCurrentValue ) { |
|
27 |
+ |
super.setCurrentValue( pCurrentValue ); |
|
28 |
+ |
adjustWidgetVisibility(); |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
public boolean isVisible() { |
|
32 |
+ |
Object zValue = getCurrentValue(); |
|
33 |
+ |
return (zValue != null) && !Boolean.FALSE.equals( Booleans.fromString( zValue.toString() ) ); |
|
34 |
+ |
} |
|
35 |
+ |
|
|
36 |
+ |
private void adjustWidgetVisibility() { |
|
37 |
+ |
Element zStyleElement = BackDoorToWidget.getStyleElement( mWidget ); |
|
38 |
+ |
String zValue = isVisible() ? "inherit" : "hidden"; |
|
39 |
+ |
DOM.setStyleAttribute( zStyleElement, "visibility", zValue ); |
|
40 |
+ |
} |
|
41 |
+ |
|
|
42 |
+ |
@Override |
|
43 |
+ |
public boolean hasError() { |
|
44 |
+ |
return false; // todo: implement |
|
45 |
+ |
} |
|
46 |
+ |
} |