|
@@ -1,45 +1,45 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.widgets.nonpublic; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.user.client.*; |
7 |
|
- |
|
8 |
|
- |
public abstract class AbstractGwtElementDimensionHelper implements GwtElementDimensionHelper { |
9 |
|
- |
private String mWhat; |
10 |
|
- |
private String mStyleDimensionAttribute; |
11 |
|
- |
private String mOffsetDimensionAttribute; |
12 |
|
- |
|
13 |
|
- |
protected AbstractGwtElementDimensionHelper( String pWhat, String pStyleDimensionAttribute, String pOffsetDimensionAttribute ) { |
14 |
|
- |
mWhat = pWhat; |
15 |
|
- |
mStyleDimensionAttribute = pStyleDimensionAttribute; |
16 |
|
- |
mOffsetDimensionAttribute = pOffsetDimensionAttribute; |
17 |
|
- |
} |
18 |
|
- |
|
19 |
|
- |
@Override |
20 |
|
- |
public final String getWhat() { |
21 |
|
- |
return mWhat; |
22 |
|
- |
} |
23 |
|
- |
|
24 |
|
- |
@Override |
25 |
|
- |
public final boolean setStyleDimension( Element pElement, int pDimension ) { |
26 |
|
- |
Objects.assertNotNull( "Element", pElement ); |
27 |
|
- |
if ( pDimension > 0 ) { |
28 |
|
- |
DOM.setIntStyleAttribute( pElement, mStyleDimensionAttribute, pDimension ); |
29 |
|
- |
return true; |
30 |
|
- |
} |
31 |
|
- |
return false; |
32 |
|
- |
} |
33 |
|
- |
|
34 |
|
- |
@Override |
35 |
|
- |
public final void removeStyleDimension( Element pElement ) { |
36 |
|
- |
Objects.assertNotNull( "Element", pElement ); |
37 |
|
- |
DOM.setStyleAttribute( pElement, mStyleDimensionAttribute, "" ); |
38 |
|
- |
} |
39 |
|
- |
|
40 |
|
- |
@Override |
41 |
|
- |
public final int getOffsetDimension( Element pElement ) { |
42 |
|
- |
Objects.assertNotNull( "Element", pElement ); |
43 |
|
- |
return DOM.getElementPropertyInt( pElement, mOffsetDimensionAttribute ); |
44 |
|
- |
} |
45 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.widgets.nonpublic; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.user.client.*; |
|
7 |
+ |
|
|
8 |
+ |
public abstract class AbstractGwtElementDimensionHelper implements GwtElementDimensionHelper { |
|
9 |
+ |
private String mWhat; |
|
10 |
+ |
private String mStyleDimensionAttribute; |
|
11 |
+ |
private String mOffsetDimensionAttribute; |
|
12 |
+ |
|
|
13 |
+ |
protected AbstractGwtElementDimensionHelper( String pWhat, String pStyleDimensionAttribute, String pOffsetDimensionAttribute ) { |
|
14 |
+ |
mWhat = pWhat; |
|
15 |
+ |
mStyleDimensionAttribute = pStyleDimensionAttribute; |
|
16 |
+ |
mOffsetDimensionAttribute = pOffsetDimensionAttribute; |
|
17 |
+ |
} |
|
18 |
+ |
|
|
19 |
+ |
@Override |
|
20 |
+ |
public final String getWhat() { |
|
21 |
+ |
return mWhat; |
|
22 |
+ |
} |
|
23 |
+ |
|
|
24 |
+ |
@Override |
|
25 |
+ |
public final boolean setStyleDimension( Element pElement, int pDimension ) { |
|
26 |
+ |
Confirm.isNotNull( "Element", pElement ); |
|
27 |
+ |
if ( pDimension > 0 ) { |
|
28 |
+ |
DOM.setIntStyleAttribute( pElement, mStyleDimensionAttribute, pDimension ); |
|
29 |
+ |
return true; |
|
30 |
+ |
} |
|
31 |
+ |
return false; |
|
32 |
+ |
} |
|
33 |
+ |
|
|
34 |
+ |
@Override |
|
35 |
+ |
public final void removeStyleDimension( Element pElement ) { |
|
36 |
+ |
Confirm.isNotNull( "Element", pElement ); |
|
37 |
+ |
DOM.setStyleAttribute( pElement, mStyleDimensionAttribute, "" ); |
|
38 |
+ |
} |
|
39 |
+ |
|
|
40 |
+ |
@Override |
|
41 |
+ |
public final int getOffsetDimension( Element pElement ) { |
|
42 |
+ |
Confirm.isNotNull( "Element", pElement ); |
|
43 |
+ |
return DOM.getElementPropertyInt( pElement, mOffsetDimensionAttribute ); |
|
44 |
+ |
} |
|
45 |
+ |
} |