|
@@ -5,12 +5,10 @@ |
5 |
5 |
|
import com.google.gwt.dom.client.Style.*; |
6 |
6 |
|
import com.google.gwt.user.client.ui.*; |
7 |
7 |
|
|
8 |
|
- |
public class Spacer extends Composite |
9 |
|
- |
{ |
|
8 |
+ |
public class Spacer extends Composite { |
10 |
9 |
|
private static final String BLANK_TEXT = " "; |
11 |
10 |
|
|
12 |
|
- |
public Spacer( int pWidth, int pHeight ) |
13 |
|
- |
{ |
|
11 |
+ |
public Spacer( int pWidth, int pHeight ) { |
14 |
12 |
|
HTML widget = new HTML( BLANK_TEXT ); |
15 |
13 |
|
widget.getElement().getStyle().setOverflow( Overflow.HIDDEN ); |
16 |
14 |
|
initWidget( widget ); |
|
@@ -21,13 +19,11 @@ |
21 |
19 |
|
height( pHeight ); |
22 |
20 |
|
} |
23 |
21 |
|
|
24 |
|
- |
public Spacer( int pWidthAndHeight ) |
25 |
|
- |
{ |
|
22 |
+ |
public Spacer( int pWidthAndHeight ) { |
26 |
23 |
|
this( pWidthAndHeight, pWidthAndHeight ); |
27 |
24 |
|
} |
28 |
25 |
|
|
29 |
|
- |
public Spacer() |
30 |
|
- |
{ |
|
26 |
+ |
public Spacer() { |
31 |
27 |
|
this( 1 ); |
32 |
28 |
|
} |
33 |
29 |
|
|
|
@@ -38,10 +34,8 @@ |
38 |
34 |
|
* |
39 |
35 |
|
* @return this |
40 |
36 |
|
*/ |
41 |
|
- |
public Spacer style( String pStyle ) |
42 |
|
- |
{ |
43 |
|
- |
if ( null != (pStyle = Strings.noEmpty( pStyle )) ) |
44 |
|
- |
{ |
|
37 |
+ |
public Spacer style( String pStyle ) { |
|
38 |
+ |
if ( null != (pStyle = Strings.noEmpty( pStyle )) ) { |
45 |
39 |
|
addStyleName( pStyle ); |
46 |
40 |
|
} |
47 |
41 |
|
return this; |
|
@@ -50,10 +44,8 @@ |
50 |
44 |
|
/** |
51 |
45 |
|
* Set the width, and allow chaining calls. |
52 |
46 |
|
*/ |
53 |
|
- |
public Spacer width( String pWidth ) |
54 |
|
- |
{ |
55 |
|
- |
if ( pWidth != null ) |
56 |
|
- |
{ |
|
47 |
+ |
public Spacer width( String pWidth ) { |
|
48 |
+ |
if ( pWidth != null ) { |
57 |
49 |
|
setWidth( pWidth ); |
58 |
50 |
|
} |
59 |
51 |
|
return this; |
|
@@ -62,10 +54,8 @@ |
62 |
54 |
|
/** |
63 |
55 |
|
* Set the height, and allow chaining calls. |
64 |
56 |
|
*/ |
65 |
|
- |
public Spacer height( String pHeight ) |
66 |
|
- |
{ |
67 |
|
- |
if ( pHeight != null ) |
68 |
|
- |
{ |
|
57 |
+ |
public Spacer height( String pHeight ) { |
|
58 |
+ |
if ( pHeight != null ) { |
69 |
59 |
|
setHeight( pHeight ); |
70 |
60 |
|
} |
71 |
61 |
|
return this; |
|
@@ -74,37 +64,32 @@ |
74 |
64 |
|
/** |
75 |
65 |
|
* Set the width & height, and allow chaining calls. |
76 |
66 |
|
*/ |
77 |
|
- |
public Spacer size( String pSize ) |
78 |
|
- |
{ |
|
67 |
+ |
public Spacer size( String pSize ) { |
79 |
68 |
|
return width( pSize ).height( pSize ); |
80 |
69 |
|
} |
81 |
70 |
|
|
82 |
71 |
|
/** |
83 |
72 |
|
* Set the width, and allow chaining calls. |
84 |
73 |
|
*/ |
85 |
|
- |
public Spacer width( int pWidth ) |
86 |
|
- |
{ |
|
74 |
+ |
public Spacer width( int pWidth ) { |
87 |
75 |
|
return width( convertSizePositive( pWidth ) ); |
88 |
76 |
|
} |
89 |
77 |
|
|
90 |
78 |
|
/** |
91 |
79 |
|
* Set the height, and allow chaining calls. |
92 |
80 |
|
*/ |
93 |
|
- |
public Spacer height( int pHeight ) |
94 |
|
- |
{ |
|
81 |
+ |
public Spacer height( int pHeight ) { |
95 |
82 |
|
return height( convertSizePositive( pHeight ) ); |
96 |
83 |
|
} |
97 |
84 |
|
|
98 |
85 |
|
/** |
99 |
86 |
|
* Set the width & height, and allow chaining calls. |
100 |
87 |
|
*/ |
101 |
|
- |
public Spacer size( int pSize ) |
102 |
|
- |
{ |
|
88 |
+ |
public Spacer size( int pSize ) { |
103 |
89 |
|
return size( convertSizePositive( pSize ) ); |
104 |
90 |
|
} |
105 |
91 |
|
|
106 |
|
- |
private static String convertSizePositive( int pSize ) |
107 |
|
- |
{ |
|
92 |
+ |
private static String convertSizePositive( int pSize ) { |
108 |
93 |
|
return (pSize > 0) ? String.valueOf( pSize ) : null; |
109 |
94 |
|
} |
110 |
95 |
|
} |