|
@@ -1,96 +1,96 @@ |
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 |
|
- |
import org.litesoft.uispecification.*; |
6 |
|
- |
|
7 |
|
- |
import com.google.gwt.user.client.*; |
8 |
|
- |
|
9 |
|
- |
public class StyleSet { |
10 |
|
- |
public Element getOuterElement() { |
11 |
|
- |
return mOuterElement; |
12 |
|
- |
} |
13 |
|
- |
|
14 |
|
- |
public Element getInnerElement() { |
15 |
|
- |
return mInnerElement; |
16 |
|
- |
} |
17 |
|
- |
|
18 |
|
- |
public StyleSet style( String pStyleClassname ) { |
19 |
|
- |
CommonElementHelper.setStyleClass( getOuterElement(), pStyleClassname ); |
20 |
|
- |
return this; |
21 |
|
- |
} |
22 |
|
- |
|
23 |
|
- |
public static StyleSet createDiv() { |
24 |
|
- |
return new StyleSet( div() ); |
25 |
|
- |
} |
26 |
|
- |
|
27 |
|
- |
public static StyleSet createDivDiv() { |
28 |
|
- |
return create( div(), div() ); |
29 |
|
- |
} |
30 |
|
- |
|
31 |
|
- |
public static StyleSet createFieldSet() { |
32 |
|
- |
return new StyleSet( fs() ); |
33 |
|
- |
} |
34 |
|
- |
|
35 |
|
- |
public static StyleSet createFieldSet( String pLegendTitle ) { |
36 |
|
- |
return createFieldSet( pLegendTitle, null ); |
37 |
|
- |
} |
38 |
|
- |
|
39 |
|
- |
public static StyleSet createFieldSet( String pLegendTitle, UiFont pTitleFont ) { |
40 |
|
- |
return new StyleSet( fs( pLegendTitle, pTitleFont ) ); |
41 |
|
- |
} |
42 |
|
- |
|
43 |
|
- |
public static StyleSet create( Element... pElements ) { |
44 |
|
- |
if ( pElements != null ) { |
45 |
|
- |
for ( int i = 0; i < pElements.length; i++ ) { |
46 |
|
- |
Element zFirst = pElements[i]; |
47 |
|
- |
if ( zFirst != null ) { |
48 |
|
- |
int zNestedStyleAppend = 1; |
49 |
|
- |
Element zLast = zFirst; |
50 |
|
- |
while ( ++i < pElements.length ) { |
51 |
|
- |
Element zElement = pElements[i]; |
52 |
|
- |
if ( zElement != null ) { |
53 |
|
- |
zLast = CommonElementHelper.appendToParent( zElement, zLast ); |
54 |
|
- |
CommonElementHelper.setStyleClass( zLast, "NestedStyle" + zNestedStyleAppend++ ); |
55 |
|
- |
} |
56 |
|
- |
} |
57 |
|
- |
return new StyleSet( zFirst, zLast ); |
58 |
|
- |
} |
59 |
|
- |
} |
60 |
|
- |
} |
61 |
|
- |
return null; |
62 |
|
- |
} |
63 |
|
- |
|
64 |
|
- |
public static Element div() { |
65 |
|
- |
return DOM.createDiv(); |
66 |
|
- |
} |
67 |
|
- |
|
68 |
|
- |
public static Element fs() { |
69 |
|
- |
return DOM.createFieldSet(); |
70 |
|
- |
} |
71 |
|
- |
|
72 |
|
- |
public static Element fs( String pLegendTitle ) { |
73 |
|
- |
return fs( pLegendTitle, null ); |
74 |
|
- |
} |
75 |
|
- |
|
76 |
|
- |
public static Element fs( String pLegendTitle, UiFont pTitleFont ) { |
77 |
|
- |
Element zFieldSet = fs(); |
78 |
|
- |
Element zLegend = DOM.createLegend(); |
79 |
|
- |
DOM.appendChild( zFieldSet, zLegend ); |
80 |
|
- |
DOM.setInnerText( zLegend, pLegendTitle ); |
81 |
|
- |
ApplyFont.to( pTitleFont, zLegend ); |
82 |
|
- |
return zFieldSet; |
83 |
|
- |
} |
84 |
|
- |
|
85 |
|
- |
private StyleSet( Element pOuterElement, Element pInnerElement ) { |
86 |
|
- |
mOuterElement = pOuterElement; |
87 |
|
- |
mInnerElement = pInnerElement; |
88 |
|
- |
} |
89 |
|
- |
|
90 |
|
- |
private StyleSet( Element pElement ) { |
91 |
|
- |
this( pElement, pElement ); |
92 |
|
- |
} |
93 |
|
- |
|
94 |
|
- |
private Element mOuterElement; |
95 |
|
- |
private Element mInnerElement; |
96 |
|
- |
} |
|
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 |
+ |
import org.litesoft.uispecification.*; |
|
6 |
+ |
|
|
7 |
+ |
import com.google.gwt.user.client.*; |
|
8 |
+ |
|
|
9 |
+ |
public class StyleSet { |
|
10 |
+ |
public Element getOuterElement() { |
|
11 |
+ |
return mOuterElement; |
|
12 |
+ |
} |
|
13 |
+ |
|
|
14 |
+ |
public Element getInnerElement() { |
|
15 |
+ |
return mInnerElement; |
|
16 |
+ |
} |
|
17 |
+ |
|
|
18 |
+ |
public StyleSet style( String pStyleClassname ) { |
|
19 |
+ |
CommonElementHelper.setStyleClass( getOuterElement(), pStyleClassname ); |
|
20 |
+ |
return this; |
|
21 |
+ |
} |
|
22 |
+ |
|
|
23 |
+ |
public static StyleSet createDiv() { |
|
24 |
+ |
return new StyleSet( div() ); |
|
25 |
+ |
} |
|
26 |
+ |
|
|
27 |
+ |
public static StyleSet createDivDiv() { |
|
28 |
+ |
return create( div(), div() ); |
|
29 |
+ |
} |
|
30 |
+ |
|
|
31 |
+ |
public static StyleSet createFieldSet() { |
|
32 |
+ |
return new StyleSet( fs() ); |
|
33 |
+ |
} |
|
34 |
+ |
|
|
35 |
+ |
public static StyleSet createFieldSet( String pLegendTitle ) { |
|
36 |
+ |
return createFieldSet( pLegendTitle, null ); |
|
37 |
+ |
} |
|
38 |
+ |
|
|
39 |
+ |
public static StyleSet createFieldSet( String pLegendTitle, UiFont pTitleFont ) { |
|
40 |
+ |
return new StyleSet( fs( pLegendTitle, pTitleFont ) ); |
|
41 |
+ |
} |
|
42 |
+ |
|
|
43 |
+ |
public static StyleSet create( Element... pElements ) { |
|
44 |
+ |
if ( pElements != null ) { |
|
45 |
+ |
for ( int i = 0; i < pElements.length; i++ ) { |
|
46 |
+ |
Element zFirst = pElements[i]; |
|
47 |
+ |
if ( zFirst != null ) { |
|
48 |
+ |
int zNestedStyleAppend = 1; |
|
49 |
+ |
Element zLast = zFirst; |
|
50 |
+ |
while ( ++i < pElements.length ) { |
|
51 |
+ |
Element zElement = pElements[i]; |
|
52 |
+ |
if ( zElement != null ) { |
|
53 |
+ |
zLast = CommonElementHelper.appendToParent( zElement, zLast ); |
|
54 |
+ |
CommonElementHelper.setStyleClass( zLast, "NestedStyle" + zNestedStyleAppend++ ); |
|
55 |
+ |
} |
|
56 |
+ |
} |
|
57 |
+ |
return new StyleSet( zFirst, zLast ); |
|
58 |
+ |
} |
|
59 |
+ |
} |
|
60 |
+ |
} |
|
61 |
+ |
return null; |
|
62 |
+ |
} |
|
63 |
+ |
|
|
64 |
+ |
public static Element div() { |
|
65 |
+ |
return DOM.createDiv(); |
|
66 |
+ |
} |
|
67 |
+ |
|
|
68 |
+ |
public static Element fs() { |
|
69 |
+ |
return DOM.createFieldSet(); |
|
70 |
+ |
} |
|
71 |
+ |
|
|
72 |
+ |
public static Element fs( String pLegendTitle ) { |
|
73 |
+ |
return fs( pLegendTitle, null ); |
|
74 |
+ |
} |
|
75 |
+ |
|
|
76 |
+ |
public static Element fs( String pLegendTitle, UiFont pTitleFont ) { |
|
77 |
+ |
Element zFieldSet = fs(); |
|
78 |
+ |
Element zLegend = DOM.createLegend(); |
|
79 |
+ |
DOM.appendChild( zFieldSet, zLegend ); |
|
80 |
+ |
DOM.setInnerText( zLegend, pLegendTitle ); |
|
81 |
+ |
ApplyFont.to( pTitleFont, zLegend ); |
|
82 |
+ |
return zFieldSet; |
|
83 |
+ |
} |
|
84 |
+ |
|
|
85 |
+ |
private StyleSet( Element pOuterElement, Element pInnerElement ) { |
|
86 |
+ |
mOuterElement = pOuterElement; |
|
87 |
+ |
mInnerElement = pInnerElement; |
|
88 |
+ |
} |
|
89 |
+ |
|
|
90 |
+ |
private StyleSet( Element pElement ) { |
|
91 |
+ |
this( pElement, pElement ); |
|
92 |
+ |
} |
|
93 |
+ |
|
|
94 |
+ |
private Element mOuterElement; |
|
95 |
+ |
private Element mInnerElement; |
|
96 |
+ |
} |