|
@@ -1,52 +1,52 @@ |
1 |
|
- |
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
|
- |
package org.litesoft.GWT.client.widgets; |
3 |
|
- |
|
4 |
|
- |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
5 |
|
- |
|
6 |
|
- |
import com.google.gwt.user.client.*; |
7 |
|
- |
|
8 |
|
- |
public class TransparentImageSpacer extends AbstractBrowserEventListenableWidget { |
9 |
|
- |
private String mHeightSet = null; |
10 |
|
- |
private String mWidthSet = null; |
11 |
|
- |
|
12 |
|
- |
public TransparentImageSpacer( int pWidthAndHeight ) { |
13 |
|
- |
setElement( DOM.createImg() ); |
14 |
|
- |
CommonElementHelper.setImgSrc( getElement(), TransparentImage.URL ); |
15 |
|
- |
//noinspection GWTStyleCheck |
16 |
|
- |
setStyleName( "LayoutSpacer" ); |
17 |
|
- |
|
18 |
|
- |
width( pWidthAndHeight ); |
19 |
|
- |
height( pWidthAndHeight ); |
20 |
|
- |
} |
21 |
|
- |
|
22 |
|
- |
public TransparentImageSpacer() { |
23 |
|
- |
this( 1 ); |
24 |
|
- |
} |
25 |
|
- |
|
26 |
|
- |
/** |
27 |
|
- |
* Calling this method eliminates the ability to set width via css class |
28 |
|
- |
*/ |
29 |
|
- |
public TransparentImageSpacer width( int pPixels ) { |
30 |
|
- |
String newWidth = "" + pPixels; |
31 |
|
- |
if ( !newWidth.equals( mWidthSet ) ) { |
32 |
|
- |
setWidth( mWidthSet = newWidth ); |
33 |
|
- |
} |
34 |
|
- |
return (mHeightSet != null) ? this : height( 1 ); |
35 |
|
- |
} |
36 |
|
- |
|
37 |
|
- |
/** |
38 |
|
- |
* Calling this method eliminates the ability to set height via css class |
39 |
|
- |
*/ |
40 |
|
- |
public TransparentImageSpacer height( int pPixels ) { |
41 |
|
- |
String newHeight = "" + pPixels; |
42 |
|
- |
if ( !newHeight.equals( mHeightSet ) ) { |
43 |
|
- |
setHeight( mHeightSet = newHeight ); |
44 |
|
- |
} |
45 |
|
- |
return (mWidthSet != null) ? this : width( 1 ); |
46 |
|
- |
} |
47 |
|
- |
|
48 |
|
- |
public TransparentImageSpacer style( String pStyle ) { |
49 |
|
- |
addStyleName( pStyle ); |
50 |
|
- |
return this; |
51 |
|
- |
} |
52 |
|
- |
} |
|
1 |
+ |
// This Source Code is in the Public Domain per: http://unlicense.org |
|
2 |
+ |
package org.litesoft.GWT.client.widgets; |
|
3 |
+ |
|
|
4 |
+ |
import org.litesoft.GWT.client.widgets.nonpublic.*; |
|
5 |
+ |
|
|
6 |
+ |
import com.google.gwt.user.client.*; |
|
7 |
+ |
|
|
8 |
+ |
public class TransparentImageSpacer extends AbstractBrowserEventListenableWidget { |
|
9 |
+ |
private String mHeightSet = null; |
|
10 |
+ |
private String mWidthSet = null; |
|
11 |
+ |
|
|
12 |
+ |
public TransparentImageSpacer( int pWidthAndHeight ) { |
|
13 |
+ |
setElement( DOM.createImg() ); |
|
14 |
+ |
CommonElementHelper.setImgSrc( getElement(), TransparentImage.URL ); |
|
15 |
+ |
//noinspection GWTStyleCheck |
|
16 |
+ |
setStyleName( "LayoutSpacer" ); |
|
17 |
+ |
|
|
18 |
+ |
width( pWidthAndHeight ); |
|
19 |
+ |
height( pWidthAndHeight ); |
|
20 |
+ |
} |
|
21 |
+ |
|
|
22 |
+ |
public TransparentImageSpacer() { |
|
23 |
+ |
this( 1 ); |
|
24 |
+ |
} |
|
25 |
+ |
|
|
26 |
+ |
/** |
|
27 |
+ |
* Calling this method eliminates the ability to set width via css class |
|
28 |
+ |
*/ |
|
29 |
+ |
public TransparentImageSpacer width( int pPixels ) { |
|
30 |
+ |
String newWidth = "" + pPixels; |
|
31 |
+ |
if ( !newWidth.equals( mWidthSet ) ) { |
|
32 |
+ |
setWidth( mWidthSet = newWidth ); |
|
33 |
+ |
} |
|
34 |
+ |
return (mHeightSet != null) ? this : height( 1 ); |
|
35 |
+ |
} |
|
36 |
+ |
|
|
37 |
+ |
/** |
|
38 |
+ |
* Calling this method eliminates the ability to set height via css class |
|
39 |
+ |
*/ |
|
40 |
+ |
public TransparentImageSpacer height( int pPixels ) { |
|
41 |
+ |
String newHeight = "" + pPixels; |
|
42 |
+ |
if ( !newHeight.equals( mHeightSet ) ) { |
|
43 |
+ |
setHeight( mHeightSet = newHeight ); |
|
44 |
+ |
} |
|
45 |
+ |
return (mWidthSet != null) ? this : width( 1 ); |
|
46 |
+ |
} |
|
47 |
+ |
|
|
48 |
+ |
public TransparentImageSpacer style( String pStyle ) { |
|
49 |
+ |
addStyleName( pStyle ); |
|
50 |
+ |
return this; |
|
51 |
+ |
} |
|
52 |
+ |
} |