|
@@ -1,241 +1,241 @@ |
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.dom.client.*; |
7 |
|
- |
import com.google.gwt.user.client.*; |
8 |
|
- |
import com.google.gwt.user.client.Element; |
9 |
|
- |
import com.google.gwt.user.client.ui.*; |
10 |
|
- |
|
11 |
|
- |
import static com.google.gwt.dom.client.Style.*; |
12 |
|
- |
|
13 |
|
- |
public class CommonElementHelper { |
14 |
|
- |
public static final String LAYOUT_OVERFLOW_HIDDEN = "litesoft-LayoutOverflowHidden"; |
15 |
|
- |
public static final String LAYOUT_OVERFLOW_AUTO = "litesoft-LayoutOverflowAuto"; |
16 |
|
- |
|
17 |
|
- |
public static String determineOverflowClass( boolean pHidden ) { |
18 |
|
- |
return pHidden ? LAYOUT_OVERFLOW_HIDDEN : LAYOUT_OVERFLOW_AUTO; |
19 |
|
- |
} |
20 |
|
- |
|
21 |
|
- |
public static Element setOverflowClass( Element pElement, boolean pHidden ) { |
22 |
|
- |
return setStyleClass( pElement, determineOverflowClass( pHidden ) ); |
23 |
|
- |
} |
24 |
|
- |
|
25 |
|
- |
public static Element setStyleClass( Element pElement, String pStyleClassName ) { |
26 |
|
- |
if ( null != (pStyleClassName = Strings.noEmpty( pStyleClassName )) ) { |
27 |
|
- |
pElement.setClassName( pStyleClassName ); |
28 |
|
- |
} |
29 |
|
- |
return pElement; |
30 |
|
- |
} |
31 |
|
- |
|
32 |
|
- |
public static Element setTextAreaWordWrap( Element pElement, boolean pWrap ) { |
33 |
|
- |
pElement.setPropertyString( "wrap", pWrap ? "soft" : "off" ); |
34 |
|
- |
return setWhiteSpaceWrap( pElement, pWrap ); |
35 |
|
- |
} |
36 |
|
- |
|
37 |
|
- |
public static Element setWhiteSpaceWrap( Element pElement, boolean pWrap ) { |
38 |
|
- |
return setStyleProperty( pElement, "whiteSpace", pWrap ? "normal" : "nowrap" ); |
39 |
|
- |
} |
40 |
|
- |
|
41 |
|
- |
public static boolean isWhiteSpaceWrap( Element pElement ) { |
42 |
|
- |
return !"nowrap".equals( pElement.getPropertyString( "whiteSpace" ) ); |
43 |
|
- |
} |
44 |
|
- |
|
45 |
|
- |
public static Element setDisplayTableCell( Element pElement ) { |
46 |
|
- |
return setStyleProperty( pElement, "display", "table-cell" ); |
47 |
|
- |
} |
48 |
|
- |
|
49 |
|
- |
public static Element setPositionAbsolute( Element pElement ) { |
50 |
|
- |
pElement.getStyle().setPosition( Position.ABSOLUTE ); |
51 |
|
- |
return pElement; |
52 |
|
- |
} |
53 |
|
- |
|
54 |
|
- |
public static Element setPositionRelative( Element pElement ) { |
55 |
|
- |
pElement.getStyle().setPosition( Position.RELATIVE ); |
56 |
|
- |
return pElement; |
57 |
|
- |
} |
58 |
|
- |
|
59 |
|
- |
public static Element setTop( Element pElement, int pPX ) { |
60 |
|
- |
pElement.getStyle().setTop( pPX, Unit.PX ); |
61 |
|
- |
return pElement; |
62 |
|
- |
} |
63 |
|
- |
|
64 |
|
- |
public static Element setLeft( Element pElement, int pPX ) { |
65 |
|
- |
pElement.getStyle().setLeft( pPX, Unit.PX ); |
66 |
|
- |
return pElement; |
67 |
|
- |
} |
68 |
|
- |
|
69 |
|
- |
public static Element setHeight( Element pElement, int pPX ) { |
70 |
|
- |
pElement.getStyle().setHeight( pPX, Unit.PX ); |
71 |
|
- |
return pElement; |
72 |
|
- |
} |
73 |
|
- |
|
74 |
|
- |
public static Element setWidth( Element pElement, int pPX ) { |
75 |
|
- |
pElement.getStyle().setWidth( pPX, Unit.PX ); |
76 |
|
- |
return pElement; |
77 |
|
- |
} |
78 |
|
- |
|
79 |
|
- |
/** |
80 |
|
- |
* @return pParent |
81 |
|
- |
*/ |
82 |
|
- |
public static Element appendChild( Element pParent, Element pChild ) { |
83 |
|
- |
DOM.appendChild( pParent, pChild ); |
84 |
|
- |
return pParent; |
85 |
|
- |
} |
86 |
|
- |
|
87 |
|
- |
/** |
88 |
|
- |
* @return pChild |
89 |
|
- |
*/ |
90 |
|
- |
public static Element appendToParent( Element pChild, Element pParent ) { |
91 |
|
- |
DOM.appendChild( pParent, pChild ); |
92 |
|
- |
return pChild; |
93 |
|
- |
} |
94 |
|
- |
|
95 |
|
- |
/** |
96 |
|
- |
* @return Div |
97 |
|
- |
*/ |
98 |
|
- |
public static Element createDiv( String pStyleClassName ) { |
99 |
|
- |
return setStyleClass( DOM.createDiv(), pStyleClassName ); |
100 |
|
- |
} |
101 |
|
- |
|
102 |
|
- |
/** |
103 |
|
- |
* @return Table |
104 |
|
- |
*/ |
105 |
|
- |
public static Element createTable( String pStyleClassName ) { |
106 |
|
- |
return setStyleClass( createTable(), pStyleClassName ); |
107 |
|
- |
} |
108 |
|
- |
|
109 |
|
- |
public static Element setImgSrc( Element pImg, String pUrl ) { |
110 |
|
- |
ImageElement.as( pImg ).setSrc( pUrl ); |
111 |
|
- |
return pImg; |
112 |
|
- |
} |
113 |
|
- |
|
114 |
|
- |
public static void setTDalign( Element pTD, HasHorizontalAlignment.HorizontalAlignmentConstant pAlign ) { |
115 |
|
- |
TableCellElement.as( pTD ).setAlign( pAlign.getTextAlignString() ); |
116 |
|
- |
} |
117 |
|
- |
|
118 |
|
- |
public static void setTDvAlign( Element pTD, HasVerticalAlignment.VerticalAlignmentConstant pValign ) { |
119 |
|
- |
TableCellElement.as( pTD ).setVAlign( pValign.getVerticalAlignString() ); |
120 |
|
- |
} |
121 |
|
- |
|
122 |
|
- |
/** |
123 |
|
- |
* @return Table |
124 |
|
- |
*/ |
125 |
|
- |
public static Element createTable() { |
126 |
|
- |
TableElement zElement = Document.get().createTableElement(); |
127 |
|
- |
zElement.setBorder( 0 ); |
128 |
|
- |
zElement.setCellSpacing( 0 ); |
129 |
|
- |
zElement.setCellPadding( 0 ); |
130 |
|
- |
return zElement.cast(); |
131 |
|
- |
} |
132 |
|
- |
|
133 |
|
- |
/** |
134 |
|
- |
* @return TBody |
135 |
|
- |
*/ |
136 |
|
- |
public static Element finishTableNgetTBody( Element pTable ) { |
137 |
|
- |
Element rv; |
138 |
|
- |
appendChild( pTable, rv = DOM.createTBody() ); |
139 |
|
- |
return rv; |
140 |
|
- |
} |
141 |
|
- |
|
142 |
|
- |
/** |
143 |
|
- |
* @return TR |
144 |
|
- |
*/ |
145 |
|
- |
public static Element finishTableNgetTR( Element pTable ) { |
146 |
|
- |
Element rv; |
147 |
|
- |
appendChild( finishTableNgetTBody( pTable ), rv = DOM.createTR() ); |
148 |
|
- |
return rv; |
149 |
|
- |
} |
150 |
|
- |
|
151 |
|
- |
/** |
152 |
|
- |
* @return TD |
153 |
|
- |
*/ |
154 |
|
- |
public static Element finishTableNgetTD( Element pTable ) { |
155 |
|
- |
Element rv; |
156 |
|
- |
appendChild( finishTableNgetTR( pTable ), rv = DOM.createTD() ); |
157 |
|
- |
return rv; |
158 |
|
- |
} |
159 |
|
- |
|
160 |
|
- |
public static int getOffsetHeight( Element pElement ) { |
161 |
|
- |
return pElement.getOffsetHeight(); |
162 |
|
- |
} |
163 |
|
- |
|
164 |
|
- |
public static int getOffsetWidth( Element pElement ) { |
165 |
|
- |
return pElement.getOffsetWidth(); |
166 |
|
- |
} |
167 |
|
- |
|
168 |
|
- |
/** |
169 |
|
- |
* Get the HTML tag name. |
170 |
|
- |
* |
171 |
|
- |
* @param element a DOM element |
172 |
|
- |
* |
173 |
|
- |
* @return the value of the tagName property, or null if |
174 |
|
- |
* <code>element</code> is null |
175 |
|
- |
*/ |
176 |
|
- |
public static native String getTagName( Element element ) /*-{ |
177 |
|
- |
return element ? element.tagName : null; |
178 |
|
- |
}-*/; |
179 |
|
- |
|
180 |
|
- |
public static DIVconstrainer createDIVconstrainer() { |
181 |
|
- |
Element zTable = createTable(); |
182 |
|
- |
Element zTR = finishTableNgetTR( zTable ); |
183 |
|
- |
Element zTD = appendToParent( DOM.createTD(), zTR ); |
184 |
|
- |
return new DIVconstrainer( zTable, zTD ); |
185 |
|
- |
} |
186 |
|
- |
|
187 |
|
- |
public static void forceNoMarginOrPadding( Element pElement ) { |
188 |
|
- |
Style zStyle = pElement.getStyle(); |
189 |
|
- |
zStyle.setMargin( 0, Unit.PX ); |
190 |
|
- |
zStyle.setPadding( 0, Unit.PX ); |
191 |
|
- |
} |
192 |
|
- |
|
193 |
|
- |
public static void setOverflowAuto( com.google.gwt.dom.client.Element pElement ) { |
194 |
|
- |
setOverflow( pElement, Overflow.AUTO ); |
195 |
|
- |
} |
196 |
|
- |
|
197 |
|
- |
public static void setOverflowVisible( com.google.gwt.dom.client.Element pElement ) { |
198 |
|
- |
setOverflow( pElement, Overflow.VISIBLE ); |
199 |
|
- |
} |
200 |
|
- |
|
201 |
|
- |
public static void setOverflowHidden( com.google.gwt.dom.client.Element pElement ) { |
202 |
|
- |
setOverflow( pElement, Overflow.HIDDEN ); |
203 |
|
- |
} |
204 |
|
- |
|
205 |
|
- |
public static void setOverflowScroll( com.google.gwt.dom.client.Element pElement ) { |
206 |
|
- |
setOverflow( pElement, Overflow.SCROLL ); |
207 |
|
- |
} |
208 |
|
- |
|
209 |
|
- |
private static void setOverflow( com.google.gwt.dom.client.Element pElement, Overflow pToWhat ) { |
210 |
|
- |
pElement.getStyle().setOverflow( pToWhat ); |
211 |
|
- |
} |
212 |
|
- |
|
213 |
|
- |
public static void hide( com.google.gwt.dom.client.Element pElement ) { |
214 |
|
- |
setHidden( pElement, true ); |
215 |
|
- |
} |
216 |
|
- |
|
217 |
|
- |
public static void unhide( com.google.gwt.dom.client.Element pElement ) { |
218 |
|
- |
setHidden( pElement, false ); |
219 |
|
- |
} |
220 |
|
- |
|
221 |
|
- |
public static void setHidden( com.google.gwt.dom.client.Element pElement, boolean pHide ) { |
222 |
|
- |
pElement.getStyle().setVisibility( pHide ? Visibility.HIDDEN : Visibility.VISIBLE ); |
223 |
|
- |
} |
224 |
|
- |
|
225 |
|
- |
public static boolean isHidden( com.google.gwt.dom.client.Element pElement ) { |
226 |
|
- |
return is( pElement.getStyle().getVisibility(), Visibility.HIDDEN ); |
227 |
|
- |
} |
228 |
|
- |
|
229 |
|
- |
public static boolean isVisible( com.google.gwt.dom.client.Element pElement ) { |
230 |
|
- |
return !is( pElement.getStyle().getDisplay(), Display.NONE ); |
231 |
|
- |
} |
232 |
|
- |
|
233 |
|
- |
private static boolean is( String pPropertyValue, HasCssName pExpected ) { |
234 |
|
- |
return pExpected.getCssName().equals( pPropertyValue ); |
235 |
|
- |
} |
236 |
|
- |
|
237 |
|
- |
private static Element setStyleProperty( Element pElement, String pProperty, String pValue ) { |
238 |
|
- |
pElement.getStyle().setProperty( pProperty, pValue ); |
239 |
|
- |
return pElement; |
240 |
|
- |
} |
241 |
|
- |
} |
|
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.dom.client.*; |
|
7 |
+ |
import com.google.gwt.user.client.*; |
|
8 |
+ |
import com.google.gwt.user.client.Element; |
|
9 |
+ |
import com.google.gwt.user.client.ui.*; |
|
10 |
+ |
|
|
11 |
+ |
import static com.google.gwt.dom.client.Style.*; |
|
12 |
+ |
|
|
13 |
+ |
public class CommonElementHelper { |
|
14 |
+ |
public static final String LAYOUT_OVERFLOW_HIDDEN = "litesoft-LayoutOverflowHidden"; |
|
15 |
+ |
public static final String LAYOUT_OVERFLOW_AUTO = "litesoft-LayoutOverflowAuto"; |
|
16 |
+ |
|
|
17 |
+ |
public static String determineOverflowClass( boolean pHidden ) { |
|
18 |
+ |
return pHidden ? LAYOUT_OVERFLOW_HIDDEN : LAYOUT_OVERFLOW_AUTO; |
|
19 |
+ |
} |
|
20 |
+ |
|
|
21 |
+ |
public static Element setOverflowClass( Element pElement, boolean pHidden ) { |
|
22 |
+ |
return setStyleClass( pElement, determineOverflowClass( pHidden ) ); |
|
23 |
+ |
} |
|
24 |
+ |
|
|
25 |
+ |
public static Element setStyleClass( Element pElement, String pStyleClassName ) { |
|
26 |
+ |
if ( null != (pStyleClassName = ConstrainTo.significantOrNull( pStyleClassName )) ) { |
|
27 |
+ |
pElement.setClassName( pStyleClassName ); |
|
28 |
+ |
} |
|
29 |
+ |
return pElement; |
|
30 |
+ |
} |
|
31 |
+ |
|
|
32 |
+ |
public static Element setTextAreaWordWrap( Element pElement, boolean pWrap ) { |
|
33 |
+ |
pElement.setPropertyString( "wrap", pWrap ? "soft" : "off" ); |
|
34 |
+ |
return setWhiteSpaceWrap( pElement, pWrap ); |
|
35 |
+ |
} |
|
36 |
+ |
|
|
37 |
+ |
public static Element setWhiteSpaceWrap( Element pElement, boolean pWrap ) { |
|
38 |
+ |
return setStyleProperty( pElement, "whiteSpace", pWrap ? "normal" : "nowrap" ); |
|
39 |
+ |
} |
|
40 |
+ |
|
|
41 |
+ |
public static boolean isWhiteSpaceWrap( Element pElement ) { |
|
42 |
+ |
return !"nowrap".equals( pElement.getPropertyString( "whiteSpace" ) ); |
|
43 |
+ |
} |
|
44 |
+ |
|
|
45 |
+ |
public static Element setDisplayTableCell( Element pElement ) { |
|
46 |
+ |
return setStyleProperty( pElement, "display", "table-cell" ); |
|
47 |
+ |
} |
|
48 |
+ |
|
|
49 |
+ |
public static Element setPositionAbsolute( Element pElement ) { |
|
50 |
+ |
pElement.getStyle().setPosition( Position.ABSOLUTE ); |
|
51 |
+ |
return pElement; |
|
52 |
+ |
} |
|
53 |
+ |
|
|
54 |
+ |
public static Element setPositionRelative( Element pElement ) { |
|
55 |
+ |
pElement.getStyle().setPosition( Position.RELATIVE ); |
|
56 |
+ |
return pElement; |
|
57 |
+ |
} |
|
58 |
+ |
|
|
59 |
+ |
public static Element setTop( Element pElement, int pPX ) { |
|
60 |
+ |
pElement.getStyle().setTop( pPX, Unit.PX ); |
|
61 |
+ |
return pElement; |
|
62 |
+ |
} |
|
63 |
+ |
|
|
64 |
+ |
public static Element setLeft( Element pElement, int pPX ) { |
|
65 |
+ |
pElement.getStyle().setLeft( pPX, Unit.PX ); |
|
66 |
+ |
return pElement; |
|
67 |
+ |
} |
|
68 |
+ |
|
|
69 |
+ |
public static Element setHeight( Element pElement, int pPX ) { |
|
70 |
+ |
pElement.getStyle().setHeight( pPX, Unit.PX ); |
|
71 |
+ |
return pElement; |
|
72 |
+ |
} |
|
73 |
+ |
|
|
74 |
+ |
public static Element setWidth( Element pElement, int pPX ) { |
|
75 |
+ |
pElement.getStyle().setWidth( pPX, Unit.PX ); |
|
76 |
+ |
return pElement; |
|
77 |
+ |
} |
|
78 |
+ |
|
|
79 |
+ |
/** |
|
80 |
+ |
* @return pParent |
|
81 |
+ |
*/ |
|
82 |
+ |
public static Element appendChild( Element pParent, Element pChild ) { |
|
83 |
+ |
DOM.appendChild( pParent, pChild ); |
|
84 |
+ |
return pParent; |
|
85 |
+ |
} |
|
86 |
+ |
|
|
87 |
+ |
/** |
|
88 |
+ |
* @return pChild |
|
89 |
+ |
*/ |
|
90 |
+ |
public static Element appendToParent( Element pChild, Element pParent ) { |
|
91 |
+ |
DOM.appendChild( pParent, pChild ); |
|
92 |
+ |
return pChild; |
|
93 |
+ |
} |
|
94 |
+ |
|
|
95 |
+ |
/** |
|
96 |
+ |
* @return Div |
|
97 |
+ |
*/ |
|
98 |
+ |
public static Element createDiv( String pStyleClassName ) { |
|
99 |
+ |
return setStyleClass( DOM.createDiv(), pStyleClassName ); |
|
100 |
+ |
} |
|
101 |
+ |
|
|
102 |
+ |
/** |
|
103 |
+ |
* @return Table |
|
104 |
+ |
*/ |
|
105 |
+ |
public static Element createTable( String pStyleClassName ) { |
|
106 |
+ |
return setStyleClass( createTable(), pStyleClassName ); |
|
107 |
+ |
} |
|
108 |
+ |
|
|
109 |
+ |
public static Element setImgSrc( Element pImg, String pUrl ) { |
|
110 |
+ |
ImageElement.as( pImg ).setSrc( pUrl ); |
|
111 |
+ |
return pImg; |
|
112 |
+ |
} |
|
113 |
+ |
|
|
114 |
+ |
public static void setTDalign( Element pTD, HasHorizontalAlignment.HorizontalAlignmentConstant pAlign ) { |
|
115 |
+ |
TableCellElement.as( pTD ).setAlign( pAlign.getTextAlignString() ); |
|
116 |
+ |
} |
|
117 |
+ |
|
|
118 |
+ |
public static void setTDvAlign( Element pTD, HasVerticalAlignment.VerticalAlignmentConstant pValign ) { |
|
119 |
+ |
TableCellElement.as( pTD ).setVAlign( pValign.getVerticalAlignString() ); |
|
120 |
+ |
} |
|
121 |
+ |
|
|
122 |
+ |
/** |
|
123 |
+ |
* @return Table |
|
124 |
+ |
*/ |
|
125 |
+ |
public static Element createTable() { |
|
126 |
+ |
TableElement zElement = Document.get().createTableElement(); |
|
127 |
+ |
zElement.setBorder( 0 ); |
|
128 |
+ |
zElement.setCellSpacing( 0 ); |
|
129 |
+ |
zElement.setCellPadding( 0 ); |
|
130 |
+ |
return zElement.cast(); |
|
131 |
+ |
} |
|
132 |
+ |
|
|
133 |
+ |
/** |
|
134 |
+ |
* @return TBody |
|
135 |
+ |
*/ |
|
136 |
+ |
public static Element finishTableNgetTBody( Element pTable ) { |
|
137 |
+ |
Element rv; |
|
138 |
+ |
appendChild( pTable, rv = DOM.createTBody() ); |
|
139 |
+ |
return rv; |
|
140 |
+ |
} |
|
141 |
+ |
|
|
142 |
+ |
/** |
|
143 |
+ |
* @return TR |
|
144 |
+ |
*/ |
|
145 |
+ |
public static Element finishTableNgetTR( Element pTable ) { |
|
146 |
+ |
Element rv; |
|
147 |
+ |
appendChild( finishTableNgetTBody( pTable ), rv = DOM.createTR() ); |
|
148 |
+ |
return rv; |
|
149 |
+ |
} |
|
150 |
+ |
|
|
151 |
+ |
/** |
|
152 |
+ |
* @return TD |
|
153 |
+ |
*/ |
|
154 |
+ |
public static Element finishTableNgetTD( Element pTable ) { |
|
155 |
+ |
Element rv; |
|
156 |
+ |
appendChild( finishTableNgetTR( pTable ), rv = DOM.createTD() ); |
|
157 |
+ |
return rv; |
|
158 |
+ |
} |
|
159 |
+ |
|
|
160 |
+ |
public static int getOffsetHeight( Element pElement ) { |
|
161 |
+ |
return pElement.getOffsetHeight(); |
|
162 |
+ |
} |
|
163 |
+ |
|
|
164 |
+ |
public static int getOffsetWidth( Element pElement ) { |
|
165 |
+ |
return pElement.getOffsetWidth(); |
|
166 |
+ |
} |
|
167 |
+ |
|
|
168 |
+ |
/** |
|
169 |
+ |
* Get the HTML tag name. |
|
170 |
+ |
* |
|
171 |
+ |
* @param element a DOM element |
|
172 |
+ |
* |
|
173 |
+ |
* @return the value of the tagName property, or null if |
|
174 |
+ |
* <code>element</code> is null |
|
175 |
+ |
*/ |
|
176 |
+ |
public static native String getTagName( Element element ) /*-{ |
|
177 |
+ |
return element ? element.tagName : null; |
|
178 |
+ |
}-*/; |
|
179 |
+ |
|
|
180 |
+ |
public static DIVconstrainer createDIVconstrainer() { |
|
181 |
+ |
Element zTable = createTable(); |
|
182 |
+ |
Element zTR = finishTableNgetTR( zTable ); |
|
183 |
+ |
Element zTD = appendToParent( DOM.createTD(), zTR ); |
|
184 |
+ |
return new DIVconstrainer( zTable, zTD ); |
|
185 |
+ |
} |
|
186 |
+ |
|
|
187 |
+ |
public static void forceNoMarginOrPadding( Element pElement ) { |
|
188 |
+ |
Style zStyle = pElement.getStyle(); |
|
189 |
+ |
zStyle.setMargin( 0, Unit.PX ); |
|
190 |
+ |
zStyle.setPadding( 0, Unit.PX ); |
|
191 |
+ |
} |
|
192 |
+ |
|
|
193 |
+ |
public static void setOverflowAuto( com.google.gwt.dom.client.Element pElement ) { |
|
194 |
+ |
setOverflow( pElement, Overflow.AUTO ); |
|
195 |
+ |
} |
|
196 |
+ |
|
|
197 |
+ |
public static void setOverflowVisible( com.google.gwt.dom.client.Element pElement ) { |
|
198 |
+ |
setOverflow( pElement, Overflow.VISIBLE ); |
|
199 |
+ |
} |
|
200 |
+ |
|
|
201 |
+ |
public static void setOverflowHidden( com.google.gwt.dom.client.Element pElement ) { |
|
202 |
+ |
setOverflow( pElement, Overflow.HIDDEN ); |
|
203 |
+ |
} |
|
204 |
+ |
|
|
205 |
+ |
public static void setOverflowScroll( com.google.gwt.dom.client.Element pElement ) { |
|
206 |
+ |
setOverflow( pElement, Overflow.SCROLL ); |
|
207 |
+ |
} |
|
208 |
+ |
|
|
209 |
+ |
private static void setOverflow( com.google.gwt.dom.client.Element pElement, Overflow pToWhat ) { |
|
210 |
+ |
pElement.getStyle().setOverflow( pToWhat ); |
|
211 |
+ |
} |
|
212 |
+ |
|
|
213 |
+ |
public static void hide( com.google.gwt.dom.client.Element pElement ) { |
|
214 |
+ |
setHidden( pElement, true ); |
|
215 |
+ |
} |
|
216 |
+ |
|
|
217 |
+ |
public static void unhide( com.google.gwt.dom.client.Element pElement ) { |
|
218 |
+ |
setHidden( pElement, false ); |
|
219 |
+ |
} |
|
220 |
+ |
|
|
221 |
+ |
public static void setHidden( com.google.gwt.dom.client.Element pElement, boolean pHide ) { |
|
222 |
+ |
pElement.getStyle().setVisibility( pHide ? Visibility.HIDDEN : Visibility.VISIBLE ); |
|
223 |
+ |
} |
|
224 |
+ |
|
|
225 |
+ |
public static boolean isHidden( com.google.gwt.dom.client.Element pElement ) { |
|
226 |
+ |
return is( pElement.getStyle().getVisibility(), Visibility.HIDDEN ); |
|
227 |
+ |
} |
|
228 |
+ |
|
|
229 |
+ |
public static boolean isVisible( com.google.gwt.dom.client.Element pElement ) { |
|
230 |
+ |
return !is( pElement.getStyle().getDisplay(), Display.NONE ); |
|
231 |
+ |
} |
|
232 |
+ |
|
|
233 |
+ |
private static boolean is( String pPropertyValue, HasCssName pExpected ) { |
|
234 |
+ |
return pExpected.getCssName().equals( pPropertyValue ); |
|
235 |
+ |
} |
|
236 |
+ |
|
|
237 |
+ |
private static Element setStyleProperty( Element pElement, String pProperty, String pValue ) { |
|
238 |
+ |
pElement.getStyle().setProperty( pProperty, pValue ); |
|
239 |
+ |
return pElement; |
|
240 |
+ |
} |
|
241 |
+ |
} |