|
@@ -6,21 +6,16 @@ |
6 |
6 |
|
import com.google.gwt.user.client.*; |
7 |
7 |
|
import com.google.gwt.user.client.ui.*; |
8 |
8 |
|
|
9 |
|
- |
public class ApplyFont |
10 |
|
- |
{ |
11 |
|
- |
public static Widget to( UiFont pUiFont, Widget pWidget ) |
12 |
|
- |
{ |
13 |
|
- |
if ( (pWidget != null) && (pUiFont != null) ) |
14 |
|
- |
{ |
|
9 |
+ |
public class ApplyFont { |
|
10 |
+ |
public static Widget to( UiFont pUiFont, Widget pWidget ) { |
|
11 |
+ |
if ( (pWidget != null) && (pUiFont != null) ) { |
15 |
12 |
|
to( pUiFont, pWidget.getElement() ); |
16 |
13 |
|
} |
17 |
14 |
|
return pWidget; |
18 |
15 |
|
} |
19 |
16 |
|
|
20 |
|
- |
public static void to( UiFont pUiFont, Element pElement ) |
21 |
|
- |
{ |
22 |
|
- |
if ( (pElement != null) && (pUiFont != null) ) |
23 |
|
- |
{ |
|
17 |
+ |
public static void to( UiFont pUiFont, Element pElement ) { |
|
18 |
+ |
if ( (pElement != null) && (pUiFont != null) ) { |
24 |
19 |
|
set( pElement, "fontFamily", pUiFont.getFamily(), ",courier" ); |
25 |
20 |
|
set( pElement, "color", pUiFont.getColor() ); |
26 |
21 |
|
set( pElement, "fontSize", pUiFont.getSize() ); |
|
@@ -30,10 +25,8 @@ |
30 |
25 |
|
} |
31 |
26 |
|
} |
32 |
27 |
|
|
33 |
|
- |
public static String toHtmlStyle( UiFont pUiFont ) |
34 |
|
- |
{ |
35 |
|
- |
if ( pUiFont != null ) |
36 |
|
- |
{ |
|
28 |
+ |
public static String toHtmlStyle( UiFont pUiFont ) { |
|
29 |
+ |
if ( pUiFont != null ) { |
37 |
30 |
|
StringBuilder sb = new StringBuilder(); |
38 |
31 |
|
set( sb, "font-family", pUiFont.getFamily(), ",courier" ); |
39 |
32 |
|
set( sb, "color", pUiFont.getColor() ); |
|
@@ -41,42 +34,33 @@ |
41 |
34 |
|
set( sb, "font-style", pUiFont.getStyle() ); |
42 |
35 |
|
set( sb, "font-weight", pUiFont.getWeight() ); |
43 |
36 |
|
set( sb, "text-decoration", pUiFont.getDecoration() ); |
44 |
|
- |
if ( sb.length() != 0 ) |
45 |
|
- |
{ |
|
37 |
+ |
if ( sb.length() != 0 ) { |
46 |
38 |
|
return " style=\"" + sb.toString() + "\""; |
47 |
39 |
|
} |
48 |
40 |
|
} |
49 |
41 |
|
return ""; |
50 |
42 |
|
} |
51 |
43 |
|
|
52 |
|
- |
private static void set( StringBuilder pSB, String pAttributeName, String pValue, String pAdditionalIfNotNull ) |
53 |
|
- |
{ |
54 |
|
- |
if ( pValue != null ) |
55 |
|
- |
{ |
|
44 |
+ |
private static void set( StringBuilder pSB, String pAttributeName, String pValue, String pAdditionalIfNotNull ) { |
|
45 |
+ |
if ( pValue != null ) { |
56 |
46 |
|
set( pSB, pAttributeName, pValue + pAdditionalIfNotNull ); |
57 |
47 |
|
} |
58 |
48 |
|
} |
59 |
49 |
|
|
60 |
|
- |
private static void set( StringBuilder pSB, String pAttributeName, String pValue ) |
61 |
|
- |
{ |
62 |
|
- |
if ( pValue != null ) |
63 |
|
- |
{ |
|
50 |
+ |
private static void set( StringBuilder pSB, String pAttributeName, String pValue ) { |
|
51 |
+ |
if ( pValue != null ) { |
64 |
52 |
|
pSB.append( pAttributeName ).append( ':' ).append( pValue ).append( ';' ); |
65 |
53 |
|
} |
66 |
54 |
|
} |
67 |
55 |
|
|
68 |
|
- |
private static void set( Element pElement, String pAttributeName, String pValue, String pAdditionalIfNotNull ) |
69 |
|
- |
{ |
70 |
|
- |
if ( pValue != null ) |
71 |
|
- |
{ |
|
56 |
+ |
private static void set( Element pElement, String pAttributeName, String pValue, String pAdditionalIfNotNull ) { |
|
57 |
+ |
if ( pValue != null ) { |
72 |
58 |
|
set( pElement, pAttributeName, pValue + pAdditionalIfNotNull ); |
73 |
59 |
|
} |
74 |
60 |
|
} |
75 |
61 |
|
|
76 |
|
- |
private static void set( Element pElement, String pAttributeName, String pValue ) |
77 |
|
- |
{ |
78 |
|
- |
if ( pValue != null ) |
79 |
|
- |
{ |
|
62 |
+ |
private static void set( Element pElement, String pAttributeName, String pValue ) { |
|
63 |
+ |
if ( pValue != null ) { |
80 |
64 |
|
DOM.setStyleAttribute( pElement, pAttributeName, pValue ); |
81 |
65 |
|
} |
82 |
66 |
|
} |