|
@@ -1,261 +1,261 @@ |
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.GWT.client.widgets.*; |
5 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
6 |
|
- |
import org.litesoft.logger.*; |
7 |
|
- |
import org.litesoft.render.*; |
8 |
|
- |
import org.litesoft.uispecification.*; |
9 |
|
- |
|
10 |
|
- |
import com.google.gwt.user.client.*; |
11 |
|
- |
import com.google.gwt.user.client.ui.*; |
12 |
|
- |
|
13 |
|
- |
public interface GwtRenderableRect extends RenderableRect { |
14 |
|
- |
public static final Logger LOGGER = LoggerFactory.getLogger( GwtRenderableRect.class ); |
15 |
|
- |
|
16 |
|
- |
public static final Widget[] NO_WIDGETS = new Widget[0]; |
17 |
|
- |
|
18 |
|
- |
/** |
19 |
|
- |
* This method is called to attach a widget browser's document (if there are any child widgets they are |
20 |
|
- |
* also attached AFTER the attached flag is set). |
21 |
|
- |
* <p/> |
22 |
|
- |
* This method is normally overiden, and after a call to super, "renderingParticipationChanged()" is notified. |
23 |
|
- |
* |
24 |
|
- |
* @see Widget#onAttach() |
25 |
|
- |
*/ |
26 |
|
- |
public void onAttach(); |
27 |
|
- |
|
28 |
|
- |
/** |
29 |
|
- |
* This method is called to detach the widget from the browser's document (if there are any child widgets |
30 |
|
- |
* they are deattached BEFORE the attached flag is set). |
31 |
|
- |
* <p/> |
32 |
|
- |
* This method is normally overiden, and after a call to super, "renderingParticipationChanged()" is notified. |
33 |
|
- |
* |
34 |
|
- |
* @see Widget#onDetach() |
35 |
|
- |
*/ |
36 |
|
- |
public void onDetach(); |
37 |
|
- |
|
38 |
|
- |
/** |
39 |
|
- |
* Sets whether this object is visible - normally overiden from "UIObject" so that "renderingParticipationChanged()" can be notified. |
40 |
|
- |
* |
41 |
|
- |
* @param pVisible <code>true</code> to show the object, <code>false</code> |
42 |
|
- |
* to hide it |
43 |
|
- |
*/ |
44 |
|
- |
public void setVisible( boolean pVisible ); |
45 |
|
- |
|
46 |
|
- |
/** |
47 |
|
- |
* Gets the Widget's offset width in pixels (not normally overiden from "UIObject"). This is the total width of the |
48 |
|
- |
* Widget, including decorations such as border, margin, and padding. |
49 |
|
- |
* |
50 |
|
- |
* @return the Widget's offset width |
51 |
|
- |
*/ |
52 |
|
- |
public int getOffsetWidth(); |
53 |
|
- |
|
54 |
|
- |
/** |
55 |
|
- |
* Sets the widget's width, overiding the method in "UIObject". Unlike the standard GWT "UIObject" method, the |
56 |
|
- |
* pWidth is "assumed" to include ALL decorations (such as border, margin, and padding). This means that a |
57 |
|
- |
* subsequent call to "getOffsetWidth()" will "eventually" return the value "set"! |
58 |
|
- |
* <p/> |
59 |
|
- |
* This method is normally delegated to the 'X' RenderHelper |
60 |
|
- |
* |
61 |
|
- |
* @param pWidth the Widget's new width, in CSS px (e.g. "10") |
62 |
|
- |
*/ |
63 |
|
- |
public void setWidth( String pWidth ); |
64 |
|
- |
|
65 |
|
- |
/** |
66 |
|
- |
* Sets the widget's width, unlike the standard GWT "UIObject" method, this pWidth is "assumed" to include ALL |
67 |
|
- |
* decorations (such as border, margin, and padding). This means that a subsequent call to "getOffsetWidth()" |
68 |
|
- |
* will "eventually" return the value "set"! |
69 |
|
- |
* <p/> |
70 |
|
- |
* This method is used by the 'X' RenderHelper via the GwtRenderDimensionAdapterX to bypass the normal delegation |
71 |
|
- |
* on "setWidth()" to the 'X' RenderHelper. |
72 |
|
- |
* |
73 |
|
- |
* @param pWidth the Widget's new width, in CSS px (e.g. "10") |
74 |
|
- |
*/ |
75 |
|
- |
public void LLsetWidgetWidth( int pWidth ); |
76 |
|
- |
|
77 |
|
- |
/** |
78 |
|
- |
* Remove the Widget's width, after this call subsequent calls to "getOffsetWidth()" will "eventually" return the |
79 |
|
- |
* "natural" width of the Widget! |
80 |
|
- |
*/ |
81 |
|
- |
public void clearWidth(); |
82 |
|
- |
|
83 |
|
- |
/** |
84 |
|
- |
* Gets the Widget's offset height in pixels (not normally overiden from "UIObject"). This is the total height of the |
85 |
|
- |
* Widget, including decorations such as border, margin, and padding. |
86 |
|
- |
* |
87 |
|
- |
* @return the Widget's offset height |
88 |
|
- |
*/ |
89 |
|
- |
public int getOffsetHeight(); |
90 |
|
- |
|
91 |
|
- |
/** |
92 |
|
- |
* Sets the widget's height, overiding the method in "UIObject". Unlike the standard GWT "UIObject" method, this |
93 |
|
- |
* pHeight is "assumed" to include ALL decorations (such as border, margin, and padding). This means that a |
94 |
|
- |
* subsequent call to "getOffsetHeight()" will "eventually" return the value "set"! |
95 |
|
- |
* <p/> |
96 |
|
- |
* This method is normally delegated to the 'Y' RenderHelper |
97 |
|
- |
* |
98 |
|
- |
* @param pHeight the Widget's new height, in CSS px (e.g. "10") |
99 |
|
- |
*/ |
100 |
|
- |
public void setHeight( String pHeight ); |
101 |
|
- |
|
102 |
|
- |
/** |
103 |
|
- |
* Sets the widget's height, unlike the standard GWT "UIObject" method, this pHeight is "assumed" to include ALL |
104 |
|
- |
* decorations (such as border, margin, and padding). This means that a subsequent call to "getOffsetHeight()" |
105 |
|
- |
* will "eventually" return the value "set"! |
106 |
|
- |
* <p/> |
107 |
|
- |
* This method is used by the 'Y' RenderHelper via the GwtRenderDimensionAdapterY to bypass the normal delegation |
108 |
|
- |
* on "setHeight()" to the 'Y' RenderHelper. |
109 |
|
- |
* |
110 |
|
- |
* @param pHeight the Widget's new height, in CSS px (e.g. "10") |
111 |
|
- |
*/ |
112 |
|
- |
public void LLsetWidgetHeight( int pHeight ); |
113 |
|
- |
|
114 |
|
- |
/** |
115 |
|
- |
* Remove the Widget's height, after this call subsequent calls to "getOffsetHeight()" will "eventually" return the |
116 |
|
- |
* "natural" height of the Widget! |
117 |
|
- |
*/ |
118 |
|
- |
public void clearHeight(); |
119 |
|
- |
|
120 |
|
- |
public static final GwtRenderableRect NULL_GRR = new NullGwtRenderableRect(); |
121 |
|
- |
|
122 |
|
- |
public static class NullGwtRenderableRect extends NullRenderableRect implements GwtRenderableRect { |
123 |
|
- |
@Override |
124 |
|
- |
public void onAttach() { |
125 |
|
- |
throw whatThe( "onAttach" ); |
126 |
|
- |
} |
127 |
|
- |
|
128 |
|
- |
@Override |
129 |
|
- |
public void onDetach() { |
130 |
|
- |
throw whatThe( "onDetach" ); |
131 |
|
- |
} |
132 |
|
- |
|
133 |
|
- |
@Override |
134 |
|
- |
public void setVisible( boolean pVisible ) { |
135 |
|
- |
throw whatThe( "setVisible", Boolean.toString( pVisible ) ); |
136 |
|
- |
} |
137 |
|
- |
|
138 |
|
- |
@Override |
139 |
|
- |
public int getOffsetWidth() { |
140 |
|
- |
return 0; |
141 |
|
- |
} |
142 |
|
- |
|
143 |
|
- |
@Override |
144 |
|
- |
public void setWidth( String pWidth ) { |
145 |
|
- |
throw whatThe( "setWidth", pWidth ); |
146 |
|
- |
} |
147 |
|
- |
|
148 |
|
- |
@Override |
149 |
|
- |
public void LLsetWidgetWidth( int pWidth ) { |
150 |
|
- |
throw whatThe( "LLsetWidgetWidth", pWidth ); |
151 |
|
- |
} |
152 |
|
- |
|
153 |
|
- |
@Override |
154 |
|
- |
public void clearWidth() { |
155 |
|
- |
} |
156 |
|
- |
|
157 |
|
- |
@Override |
158 |
|
- |
public int getOffsetHeight() { |
159 |
|
- |
return 0; |
160 |
|
- |
} |
161 |
|
- |
|
162 |
|
- |
@Override |
163 |
|
- |
public void setHeight( String pHeight ) { |
164 |
|
- |
throw whatThe( "setHeight", pHeight ); |
165 |
|
- |
} |
166 |
|
- |
|
167 |
|
- |
@Override |
168 |
|
- |
public void LLsetWidgetHeight( int pHeight ) { |
169 |
|
- |
throw whatThe( "LLsetWidgetHeight", pHeight ); |
170 |
|
- |
} |
171 |
|
- |
|
172 |
|
- |
@Override |
173 |
|
- |
public void clearHeight() { |
174 |
|
- |
} |
175 |
|
- |
} |
176 |
|
- |
|
177 |
|
- |
public static class Parse { |
178 |
|
- |
public static Integer size( String pSize ) |
179 |
|
- |
throws NumberFormatException { |
180 |
|
- |
String cleaned = Strings.deNull( pSize ).trim(); |
181 |
|
- |
if ( cleaned.length() == 0 ) { |
182 |
|
- |
return null; |
183 |
|
- |
} |
184 |
|
- |
String toParse = "0" + cleaned; |
185 |
|
- |
if ( toParse.endsWith( "px" ) ) { |
186 |
|
- |
toParse = toParse.substring( 0, toParse.length() - 2 ); |
187 |
|
- |
} |
188 |
|
- |
return Integer.parseInt( toParse ); |
189 |
|
- |
} |
190 |
|
- |
|
191 |
|
- |
public static void andSetSize( final RenderHelper pRenderHelper, String pSize ) { |
192 |
|
- |
Integer zInteger; |
193 |
|
- |
try { |
194 |
|
- |
zInteger = size( pSize ); |
195 |
|
- |
} |
196 |
|
- |
catch ( NumberFormatException e ) { |
197 |
|
- |
LOGGER.error.log( e, pRenderHelper, " setSize( ", pSize, " )" ); |
198 |
|
- |
return; |
199 |
|
- |
} |
200 |
|
- |
if ( zInteger != null ) { |
201 |
|
- |
pRenderHelper.setSize( zInteger ); |
202 |
|
- |
} |
203 |
|
- |
} |
204 |
|
- |
} |
205 |
|
- |
|
206 |
|
- |
public static class Size { |
207 |
|
- |
public static void set( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pContainerElement, int pNewSize, int pDecorationSize ) { |
208 |
|
- |
if ( LOGGER.trace.isEnabled() ) { |
209 |
|
- |
LOGGER.trace.log( "Size.set ", pDimensionHelper.getWhat(), " on ", pOnWidget.getClass(), " NewSize= " + pNewSize, // |
210 |
|
- |
" DecorationSize= " + pDecorationSize, // |
211 |
|
- |
" -> " + (pNewSize - pDecorationSize) ); |
212 |
|
- |
} |
213 |
|
- |
set( pOnWidget, pDimensionHelper, pContainerElement, pNewSize - pDecorationSize ); |
214 |
|
- |
} |
215 |
|
- |
|
216 |
|
- |
@SuppressWarnings({"UnusedDeclaration"}) |
217 |
|
- |
public static void set( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pSizingElement, int pNewSize ) { |
218 |
|
- |
pDimensionHelper.setStyleDimension( pSizingElement, pNewSize ); |
219 |
|
- |
} |
220 |
|
- |
|
221 |
|
- |
@SuppressWarnings({"UnusedDeclaration"}) |
222 |
|
- |
public static void clear( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pSizingElement ) { |
223 |
|
- |
pDimensionHelper.removeStyleDimension( pSizingElement ); |
224 |
|
- |
} |
225 |
|
- |
} |
226 |
|
- |
|
227 |
|
- |
public static class DecorationSize { |
228 |
|
- |
@SuppressWarnings({"UnusedDeclaration"}) |
229 |
|
- |
public static int calculate( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pOuterElement, Element pContainerElement ) { |
230 |
|
- |
int zOuterDim = pDimensionHelper.getOffsetDimension( pOuterElement ); |
231 |
|
- |
int zContainerDim = pDimensionHelper.getOffsetDimension( pContainerElement ); |
232 |
|
- |
return zOuterDim - zContainerDim; |
233 |
|
- |
} |
234 |
|
- |
} |
235 |
|
- |
|
236 |
|
- |
public static class ContainerSupport { |
237 |
|
- |
public static StyleContainerElements createSCEs( Element pStyleParentElement, StyleSet pStyleSet ) { |
238 |
|
- |
return (pStyleSet == null) ? // |
239 |
|
- |
new StyleContainerElements( pStyleParentElement ) : |
240 |
|
- |
new StyleContainerElements( CommonElementHelper.appendToParent( pStyleSet.getOuterElement(), pStyleParentElement ), |
241 |
|
- |
pStyleSet.getInnerElement() ); |
242 |
|
- |
} |
243 |
|
- |
|
244 |
|
- |
public static Overflow getAppropriateCombinedOverflow( RenderContainmentApproach pContainmentApproachX, |
245 |
|
- |
RenderContainmentApproach pContainmentApproachY ) { |
246 |
|
- |
return pContainmentApproachX.getOverflow().mergeWith( pContainmentApproachY.getOverflow() ); |
247 |
|
- |
} |
248 |
|
- |
|
249 |
|
- |
public static Widget[] toArray( WidgetCollection pCollection ) { |
250 |
|
- |
int zSize = pCollection.size(); |
251 |
|
- |
if ( zSize == 0 ) { |
252 |
|
- |
return NO_WIDGETS; |
253 |
|
- |
} |
254 |
|
- |
Widget[] rv = new Widget[zSize]; |
255 |
|
- |
for ( int i = 0; i < zSize; i++ ) { |
256 |
|
- |
rv[i] = pCollection.get( i ); |
257 |
|
- |
} |
258 |
|
- |
return rv; |
259 |
|
- |
} |
260 |
|
- |
} |
261 |
|
- |
} |
|
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.GWT.client.widgets.*; |
|
5 |
+ |
import org.litesoft.commonfoundation.base.*; |
|
6 |
+ |
import org.litesoft.logger.*; |
|
7 |
+ |
import org.litesoft.render.*; |
|
8 |
+ |
import org.litesoft.uispecification.*; |
|
9 |
+ |
|
|
10 |
+ |
import com.google.gwt.user.client.*; |
|
11 |
+ |
import com.google.gwt.user.client.ui.*; |
|
12 |
+ |
|
|
13 |
+ |
public interface GwtRenderableRect extends RenderableRect { |
|
14 |
+ |
public static final Logger LOGGER = LoggerFactory.getLogger( GwtRenderableRect.class ); |
|
15 |
+ |
|
|
16 |
+ |
public static final Widget[] NO_WIDGETS = new Widget[0]; |
|
17 |
+ |
|
|
18 |
+ |
/** |
|
19 |
+ |
* This method is called to attach a widget browser's document (if there are any child widgets they are |
|
20 |
+ |
* also attached AFTER the attached flag is set). |
|
21 |
+ |
* <p/> |
|
22 |
+ |
* This method is normally overiden, and after a call to super, "renderingParticipationChanged()" is notified. |
|
23 |
+ |
* |
|
24 |
+ |
* @see Widget#onAttach() |
|
25 |
+ |
*/ |
|
26 |
+ |
public void onAttach(); |
|
27 |
+ |
|
|
28 |
+ |
/** |
|
29 |
+ |
* This method is called to detach the widget from the browser's document (if there are any child widgets |
|
30 |
+ |
* they are deattached BEFORE the attached flag is set). |
|
31 |
+ |
* <p/> |
|
32 |
+ |
* This method is normally overiden, and after a call to super, "renderingParticipationChanged()" is notified. |
|
33 |
+ |
* |
|
34 |
+ |
* @see Widget#onDetach() |
|
35 |
+ |
*/ |
|
36 |
+ |
public void onDetach(); |
|
37 |
+ |
|
|
38 |
+ |
/** |
|
39 |
+ |
* Sets whether this object is visible - normally overiden from "UIObject" so that "renderingParticipationChanged()" can be notified. |
|
40 |
+ |
* |
|
41 |
+ |
* @param pVisible <code>true</code> to show the object, <code>false</code> |
|
42 |
+ |
* to hide it |
|
43 |
+ |
*/ |
|
44 |
+ |
public void setVisible( boolean pVisible ); |
|
45 |
+ |
|
|
46 |
+ |
/** |
|
47 |
+ |
* Gets the Widget's offset width in pixels (not normally overiden from "UIObject"). This is the total width of the |
|
48 |
+ |
* Widget, including decorations such as border, margin, and padding. |
|
49 |
+ |
* |
|
50 |
+ |
* @return the Widget's offset width |
|
51 |
+ |
*/ |
|
52 |
+ |
public int getOffsetWidth(); |
|
53 |
+ |
|
|
54 |
+ |
/** |
|
55 |
+ |
* Sets the widget's width, overiding the method in "UIObject". Unlike the standard GWT "UIObject" method, the |
|
56 |
+ |
* pWidth is "assumed" to include ALL decorations (such as border, margin, and padding). This means that a |
|
57 |
+ |
* subsequent call to "getOffsetWidth()" will "eventually" return the value "set"! |
|
58 |
+ |
* <p/> |
|
59 |
+ |
* This method is normally delegated to the 'X' RenderHelper |
|
60 |
+ |
* |
|
61 |
+ |
* @param pWidth the Widget's new width, in CSS px (e.g. "10") |
|
62 |
+ |
*/ |
|
63 |
+ |
public void setWidth( String pWidth ); |
|
64 |
+ |
|
|
65 |
+ |
/** |
|
66 |
+ |
* Sets the widget's width, unlike the standard GWT "UIObject" method, this pWidth is "assumed" to include ALL |
|
67 |
+ |
* decorations (such as border, margin, and padding). This means that a subsequent call to "getOffsetWidth()" |
|
68 |
+ |
* will "eventually" return the value "set"! |
|
69 |
+ |
* <p/> |
|
70 |
+ |
* This method is used by the 'X' RenderHelper via the GwtRenderDimensionAdapterX to bypass the normal delegation |
|
71 |
+ |
* on "setWidth()" to the 'X' RenderHelper. |
|
72 |
+ |
* |
|
73 |
+ |
* @param pWidth the Widget's new width, in CSS px (e.g. "10") |
|
74 |
+ |
*/ |
|
75 |
+ |
public void LLsetWidgetWidth( int pWidth ); |
|
76 |
+ |
|
|
77 |
+ |
/** |
|
78 |
+ |
* Remove the Widget's width, after this call subsequent calls to "getOffsetWidth()" will "eventually" return the |
|
79 |
+ |
* "natural" width of the Widget! |
|
80 |
+ |
*/ |
|
81 |
+ |
public void clearWidth(); |
|
82 |
+ |
|
|
83 |
+ |
/** |
|
84 |
+ |
* Gets the Widget's offset height in pixels (not normally overiden from "UIObject"). This is the total height of the |
|
85 |
+ |
* Widget, including decorations such as border, margin, and padding. |
|
86 |
+ |
* |
|
87 |
+ |
* @return the Widget's offset height |
|
88 |
+ |
*/ |
|
89 |
+ |
public int getOffsetHeight(); |
|
90 |
+ |
|
|
91 |
+ |
/** |
|
92 |
+ |
* Sets the widget's height, overiding the method in "UIObject". Unlike the standard GWT "UIObject" method, this |
|
93 |
+ |
* pHeight is "assumed" to include ALL decorations (such as border, margin, and padding). This means that a |
|
94 |
+ |
* subsequent call to "getOffsetHeight()" will "eventually" return the value "set"! |
|
95 |
+ |
* <p/> |
|
96 |
+ |
* This method is normally delegated to the 'Y' RenderHelper |
|
97 |
+ |
* |
|
98 |
+ |
* @param pHeight the Widget's new height, in CSS px (e.g. "10") |
|
99 |
+ |
*/ |
|
100 |
+ |
public void setHeight( String pHeight ); |
|
101 |
+ |
|
|
102 |
+ |
/** |
|
103 |
+ |
* Sets the widget's height, unlike the standard GWT "UIObject" method, this pHeight is "assumed" to include ALL |
|
104 |
+ |
* decorations (such as border, margin, and padding). This means that a subsequent call to "getOffsetHeight()" |
|
105 |
+ |
* will "eventually" return the value "set"! |
|
106 |
+ |
* <p/> |
|
107 |
+ |
* This method is used by the 'Y' RenderHelper via the GwtRenderDimensionAdapterY to bypass the normal delegation |
|
108 |
+ |
* on "setHeight()" to the 'Y' RenderHelper. |
|
109 |
+ |
* |
|
110 |
+ |
* @param pHeight the Widget's new height, in CSS px (e.g. "10") |
|
111 |
+ |
*/ |
|
112 |
+ |
public void LLsetWidgetHeight( int pHeight ); |
|
113 |
+ |
|
|
114 |
+ |
/** |
|
115 |
+ |
* Remove the Widget's height, after this call subsequent calls to "getOffsetHeight()" will "eventually" return the |
|
116 |
+ |
* "natural" height of the Widget! |
|
117 |
+ |
*/ |
|
118 |
+ |
public void clearHeight(); |
|
119 |
+ |
|
|
120 |
+ |
public static final GwtRenderableRect NULL_GRR = new NullGwtRenderableRect(); |
|
121 |
+ |
|
|
122 |
+ |
public static class NullGwtRenderableRect extends NullRenderableRect implements GwtRenderableRect { |
|
123 |
+ |
@Override |
|
124 |
+ |
public void onAttach() { |
|
125 |
+ |
throw whatThe( "onAttach" ); |
|
126 |
+ |
} |
|
127 |
+ |
|
|
128 |
+ |
@Override |
|
129 |
+ |
public void onDetach() { |
|
130 |
+ |
throw whatThe( "onDetach" ); |
|
131 |
+ |
} |
|
132 |
+ |
|
|
133 |
+ |
@Override |
|
134 |
+ |
public void setVisible( boolean pVisible ) { |
|
135 |
+ |
throw whatThe( "setVisible", Boolean.toString( pVisible ) ); |
|
136 |
+ |
} |
|
137 |
+ |
|
|
138 |
+ |
@Override |
|
139 |
+ |
public int getOffsetWidth() { |
|
140 |
+ |
return 0; |
|
141 |
+ |
} |
|
142 |
+ |
|
|
143 |
+ |
@Override |
|
144 |
+ |
public void setWidth( String pWidth ) { |
|
145 |
+ |
throw whatThe( "setWidth", pWidth ); |
|
146 |
+ |
} |
|
147 |
+ |
|
|
148 |
+ |
@Override |
|
149 |
+ |
public void LLsetWidgetWidth( int pWidth ) { |
|
150 |
+ |
throw whatThe( "LLsetWidgetWidth", pWidth ); |
|
151 |
+ |
} |
|
152 |
+ |
|
|
153 |
+ |
@Override |
|
154 |
+ |
public void clearWidth() { |
|
155 |
+ |
} |
|
156 |
+ |
|
|
157 |
+ |
@Override |
|
158 |
+ |
public int getOffsetHeight() { |
|
159 |
+ |
return 0; |
|
160 |
+ |
} |
|
161 |
+ |
|
|
162 |
+ |
@Override |
|
163 |
+ |
public void setHeight( String pHeight ) { |
|
164 |
+ |
throw whatThe( "setHeight", pHeight ); |
|
165 |
+ |
} |
|
166 |
+ |
|
|
167 |
+ |
@Override |
|
168 |
+ |
public void LLsetWidgetHeight( int pHeight ) { |
|
169 |
+ |
throw whatThe( "LLsetWidgetHeight", pHeight ); |
|
170 |
+ |
} |
|
171 |
+ |
|
|
172 |
+ |
@Override |
|
173 |
+ |
public void clearHeight() { |
|
174 |
+ |
} |
|
175 |
+ |
} |
|
176 |
+ |
|
|
177 |
+ |
public static class Parse { |
|
178 |
+ |
public static Integer size( String pSize ) |
|
179 |
+ |
throws NumberFormatException { |
|
180 |
+ |
String cleaned = ConstrainTo.notNull( pSize ).trim(); |
|
181 |
+ |
if ( cleaned.length() == 0 ) { |
|
182 |
+ |
return null; |
|
183 |
+ |
} |
|
184 |
+ |
String toParse = "0" + cleaned; |
|
185 |
+ |
if ( toParse.endsWith( "px" ) ) { |
|
186 |
+ |
toParse = toParse.substring( 0, toParse.length() - 2 ); |
|
187 |
+ |
} |
|
188 |
+ |
return Integer.parseInt( toParse ); |
|
189 |
+ |
} |
|
190 |
+ |
|
|
191 |
+ |
public static void andSetSize( final RenderHelper pRenderHelper, String pSize ) { |
|
192 |
+ |
Integer zInteger; |
|
193 |
+ |
try { |
|
194 |
+ |
zInteger = size( pSize ); |
|
195 |
+ |
} |
|
196 |
+ |
catch ( NumberFormatException e ) { |
|
197 |
+ |
LOGGER.error.log( e, pRenderHelper, " setSize( ", pSize, " )" ); |
|
198 |
+ |
return; |
|
199 |
+ |
} |
|
200 |
+ |
if ( zInteger != null ) { |
|
201 |
+ |
pRenderHelper.setSize( zInteger ); |
|
202 |
+ |
} |
|
203 |
+ |
} |
|
204 |
+ |
} |
|
205 |
+ |
|
|
206 |
+ |
public static class Size { |
|
207 |
+ |
public static void set( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pContainerElement, int pNewSize, int pDecorationSize ) { |
|
208 |
+ |
if ( LOGGER.trace.isEnabled() ) { |
|
209 |
+ |
LOGGER.trace.log( "Size.set ", pDimensionHelper.getWhat(), " on ", pOnWidget.getClass(), " NewSize= " + pNewSize, // |
|
210 |
+ |
" DecorationSize= " + pDecorationSize, // |
|
211 |
+ |
" -> " + (pNewSize - pDecorationSize) ); |
|
212 |
+ |
} |
|
213 |
+ |
set( pOnWidget, pDimensionHelper, pContainerElement, pNewSize - pDecorationSize ); |
|
214 |
+ |
} |
|
215 |
+ |
|
|
216 |
+ |
@SuppressWarnings({"UnusedDeclaration"}) |
|
217 |
+ |
public static void set( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pSizingElement, int pNewSize ) { |
|
218 |
+ |
pDimensionHelper.setStyleDimension( pSizingElement, pNewSize ); |
|
219 |
+ |
} |
|
220 |
+ |
|
|
221 |
+ |
@SuppressWarnings({"UnusedDeclaration"}) |
|
222 |
+ |
public static void clear( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pSizingElement ) { |
|
223 |
+ |
pDimensionHelper.removeStyleDimension( pSizingElement ); |
|
224 |
+ |
} |
|
225 |
+ |
} |
|
226 |
+ |
|
|
227 |
+ |
public static class DecorationSize { |
|
228 |
+ |
@SuppressWarnings({"UnusedDeclaration"}) |
|
229 |
+ |
public static int calculate( Widget pOnWidget, GwtElementDimensionHelper pDimensionHelper, Element pOuterElement, Element pContainerElement ) { |
|
230 |
+ |
int zOuterDim = pDimensionHelper.getOffsetDimension( pOuterElement ); |
|
231 |
+ |
int zContainerDim = pDimensionHelper.getOffsetDimension( pContainerElement ); |
|
232 |
+ |
return zOuterDim - zContainerDim; |
|
233 |
+ |
} |
|
234 |
+ |
} |
|
235 |
+ |
|
|
236 |
+ |
public static class ContainerSupport { |
|
237 |
+ |
public static StyleContainerElements createSCEs( Element pStyleParentElement, StyleSet pStyleSet ) { |
|
238 |
+ |
return (pStyleSet == null) ? // |
|
239 |
+ |
new StyleContainerElements( pStyleParentElement ) : |
|
240 |
+ |
new StyleContainerElements( CommonElementHelper.appendToParent( pStyleSet.getOuterElement(), pStyleParentElement ), |
|
241 |
+ |
pStyleSet.getInnerElement() ); |
|
242 |
+ |
} |
|
243 |
+ |
|
|
244 |
+ |
public static Overflow getAppropriateCombinedOverflow( RenderContainmentApproach pContainmentApproachX, |
|
245 |
+ |
RenderContainmentApproach pContainmentApproachY ) { |
|
246 |
+ |
return pContainmentApproachX.getOverflow().mergeWith( pContainmentApproachY.getOverflow() ); |
|
247 |
+ |
} |
|
248 |
+ |
|
|
249 |
+ |
public static Widget[] toArray( WidgetCollection pCollection ) { |
|
250 |
+ |
int zSize = pCollection.size(); |
|
251 |
+ |
if ( zSize == 0 ) { |
|
252 |
+ |
return NO_WIDGETS; |
|
253 |
+ |
} |
|
254 |
+ |
Widget[] rv = new Widget[zSize]; |
|
255 |
+ |
for ( int i = 0; i < zSize; i++ ) { |
|
256 |
+ |
rv[i] = pCollection.get( i ); |
|
257 |
+ |
} |
|
258 |
+ |
return rv; |
|
259 |
+ |
} |
|
260 |
+ |
} |
|
261 |
+ |
} |