|
@@ -10,13 +10,12 @@ |
10 |
10 |
|
|
11 |
11 |
|
public abstract class AbstractSizableSimplePanel extends SimplePanel implements RenderableContainer, |
12 |
12 |
|
GwtRenderableRect, |
13 |
|
- |
SingleWidgetContainer |
14 |
|
- |
{ |
|
13 |
+ |
SingleWidgetContainer { |
15 |
14 |
|
private Element mStyleElement; |
16 |
15 |
|
private Element mContainerElement; |
17 |
16 |
|
|
18 |
|
- |
private AbstractSizableSimplePanel( DIVconstrainer pDIVconstrainer, StyleSet pStyleSet, RenderContainmentApproach pContainmentApproachX, RenderContainmentApproach pContainmentApproachY ) |
19 |
|
- |
{ |
|
17 |
+ |
private AbstractSizableSimplePanel( DIVconstrainer pDIVconstrainer, StyleSet pStyleSet, RenderContainmentApproach pContainmentApproachX, |
|
18 |
+ |
RenderContainmentApproach pContainmentApproachY ) { |
20 |
19 |
|
super( pDIVconstrainer.getOuterElement() ); |
21 |
20 |
|
StyleContainerElements zSCEs = ContainerSupport.createSCEs( pDIVconstrainer.getInnerElement(), pStyleSet ); |
22 |
21 |
|
mStyleElement = zSCEs.getStyleElement(); |
|
@@ -26,72 +25,57 @@ |
26 |
25 |
|
pContainmentApproachY = RenderContainmentApproach.deNull( pContainmentApproachY ); |
27 |
26 |
|
|
28 |
27 |
|
Overflow zCombinedOverflow = ContainerSupport.getAppropriateCombinedOverflow( pContainmentApproachX, pContainmentApproachY ); |
29 |
|
- |
if ( zCombinedOverflow.isScrolledOrClipped() ) |
30 |
|
- |
{ |
|
28 |
+ |
if ( zCombinedOverflow.isScrolledOrClipped() ) { |
31 |
29 |
|
mContainerElement = CommonElementHelper.appendToParent( DOM.createDiv(), zContainerParentElement ); |
32 |
30 |
|
String zOverflowClass = CommonElementHelper.determineOverflowClass( zCombinedOverflow.isClipped() ); |
33 |
31 |
|
CommonElementHelper.setStyleClass( mContainerElement, zOverflowClass ); |
34 |
|
- |
} |
35 |
|
- |
else if ( zSCEs.hasStyleElement() ) |
36 |
|
- |
{ |
|
32 |
+ |
} else if ( zSCEs.hasStyleElement() ) { |
37 |
33 |
|
mContainerElement = CommonElementHelper.appendToParent( DOM.createDiv(), zContainerParentElement ); |
38 |
|
- |
} |
39 |
|
- |
else |
40 |
|
- |
{ |
|
34 |
+ |
} else { |
41 |
35 |
|
mContainerElement = zContainerParentElement; // Not Stylable & Overflow == _None |
42 |
36 |
|
} |
43 |
37 |
|
|
44 |
|
- |
mRenderHelperX = new Gwt1dContainerRenderHelperX( this, pContainmentApproachX, RenderContainerChildrenPolicy.Propogate ) |
45 |
|
- |
{ |
|
38 |
+ |
mRenderHelperX = new Gwt1dContainerRenderHelperX( this, pContainmentApproachX, RenderContainerChildrenPolicy.Propogate ) { |
46 |
39 |
|
@Override |
47 |
|
- |
protected Object[] getChildObjects() |
48 |
|
- |
{ |
|
40 |
+ |
protected Object[] getChildObjects() { |
49 |
41 |
|
return getChildren(); |
50 |
42 |
|
} |
51 |
43 |
|
}; |
52 |
|
- |
mRenderHelperY = new Gwt1dContainerRenderHelperY( this, pContainmentApproachY, RenderContainerChildrenPolicy.Propogate ) |
53 |
|
- |
{ |
|
44 |
+ |
mRenderHelperY = new Gwt1dContainerRenderHelperY( this, pContainmentApproachY, RenderContainerChildrenPolicy.Propogate ) { |
54 |
45 |
|
@Override |
55 |
|
- |
protected Object[] getChildObjects() |
56 |
|
- |
{ |
|
46 |
+ |
protected Object[] getChildObjects() { |
57 |
47 |
|
return getChildren(); |
58 |
48 |
|
} |
59 |
49 |
|
}; |
60 |
50 |
|
} |
61 |
51 |
|
|
62 |
|
- |
protected AbstractSizableSimplePanel( StyleSet pStyleSet, RenderContainmentApproach pContainmentApproachX, RenderContainmentApproach pContainmentApproachY ) |
63 |
|
- |
{ |
|
52 |
+ |
protected AbstractSizableSimplePanel( StyleSet pStyleSet, RenderContainmentApproach pContainmentApproachX, RenderContainmentApproach pContainmentApproachY ) { |
64 |
53 |
|
this( CommonElementHelper.createDIVconstrainer(), pStyleSet, pContainmentApproachX, pContainmentApproachY ); |
65 |
54 |
|
} |
66 |
55 |
|
|
67 |
|
- |
protected AbstractSizableSimplePanel( StyleSet pStyleSet, RCApair pRCApair ) |
68 |
|
- |
{ |
|
56 |
+ |
protected AbstractSizableSimplePanel( StyleSet pStyleSet, RCApair pRCApair ) { |
69 |
57 |
|
this( pStyleSet, RCApair.deNull( pRCApair ).getRCA_X(), RCApair.deNull( pRCApair ).getRCA_Y() ); |
70 |
58 |
|
} |
71 |
59 |
|
|
72 |
|
- |
protected AbstractSizableSimplePanel( StyleSet pStyleSet, RenderContainmentApproach pContainmentApproach ) |
73 |
|
- |
{ |
|
60 |
+ |
protected AbstractSizableSimplePanel( StyleSet pStyleSet, RenderContainmentApproach pContainmentApproach ) { |
74 |
61 |
|
this( pStyleSet, pContainmentApproach, pContainmentApproach ); |
75 |
62 |
|
} |
76 |
63 |
|
|
77 |
64 |
|
protected final RenderContainerHelper mRenderHelperX; |
78 |
65 |
|
protected final RenderContainerHelper mRenderHelperY; |
79 |
66 |
|
|
80 |
|
- |
private Widget[] getChildren() |
81 |
|
- |
{ |
|
67 |
+ |
private Widget[] getChildren() { |
82 |
68 |
|
Widget zWidget = getWidget(); |
83 |
69 |
|
return (zWidget == null) ? NO_WIDGETS : new Widget[]{zWidget}; |
84 |
70 |
|
} |
85 |
71 |
|
|
86 |
72 |
|
@Override |
87 |
|
- |
protected Element getStyleElement() |
88 |
|
- |
{ |
|
73 |
+ |
protected Element getStyleElement() { |
89 |
74 |
|
return mStyleElement; |
90 |
75 |
|
} |
91 |
76 |
|
|
92 |
77 |
|
@Override |
93 |
|
- |
protected Element getContainerElement() |
94 |
|
- |
{ |
|
78 |
+ |
protected Element getContainerElement() { |
95 |
79 |
|
return mContainerElement; |
96 |
80 |
|
} |
97 |
81 |
|
|
|
@@ -104,8 +88,7 @@ |
104 |
88 |
|
* @see Widget#onAttach() |
105 |
89 |
|
*/ |
106 |
90 |
|
@Override |
107 |
|
- |
public void onAttach() |
108 |
|
- |
{ |
|
91 |
+ |
public void onAttach() { |
109 |
92 |
|
super.onAttach(); |
110 |
93 |
|
renderingParticipationChanged(); |
111 |
94 |
|
} |
|
@@ -119,8 +102,7 @@ |
119 |
102 |
|
* @see Widget#onDetach() |
120 |
103 |
|
*/ |
121 |
104 |
|
@Override |
122 |
|
- |
public void onDetach() |
123 |
|
- |
{ |
|
105 |
+ |
public void onDetach() { |
124 |
106 |
|
super.onDetach(); |
125 |
107 |
|
renderingParticipationChanged(); |
126 |
108 |
|
} |
|
@@ -132,10 +114,8 @@ |
132 |
114 |
|
* to hide it |
133 |
115 |
|
*/ |
134 |
116 |
|
@Override |
135 |
|
- |
public void setVisible( boolean pVisible ) |
136 |
|
- |
{ |
137 |
|
- |
if ( isVisible() != pVisible ) |
138 |
|
- |
{ |
|
117 |
+ |
public void setVisible( boolean pVisible ) { |
|
118 |
+ |
if ( isVisible() != pVisible ) { |
139 |
119 |
|
super.setVisible( pVisible ); |
140 |
120 |
|
renderingParticipationChanged(); |
141 |
121 |
|
} |
|
@@ -151,8 +131,7 @@ |
151 |
131 |
|
* @param pWidth the Widget's new width, in CSS px (e.g. "10") |
152 |
132 |
|
*/ |
153 |
133 |
|
@Override |
154 |
|
- |
public void setWidth( String pWidth ) |
155 |
|
- |
{ |
|
134 |
+ |
public void setWidth( String pWidth ) { |
156 |
135 |
|
Parse.andSetSize( getRenderHelperX(), pWidth ); |
157 |
136 |
|
} |
158 |
137 |
|
|
|
@@ -167,8 +146,7 @@ |
167 |
146 |
|
* @param pWidth the Widget's new width, in CSS px (e.g. "10") |
168 |
147 |
|
*/ |
169 |
148 |
|
@Override |
170 |
|
- |
public void LLsetWidgetWidth( int pWidth ) |
171 |
|
- |
{ |
|
149 |
+ |
public void LLsetWidgetWidth( int pWidth ) { |
172 |
150 |
|
Size.set( this, GwtElementDimensionHelperX.INSTANCE, getContainerElement(), pWidth, getDecorationSizeX() ); |
173 |
151 |
|
} |
174 |
152 |
|
|
|
@@ -177,8 +155,7 @@ |
177 |
155 |
|
* "natural" width of the Widget! |
178 |
156 |
|
*/ |
179 |
157 |
|
@Override |
180 |
|
- |
public void clearWidth() |
181 |
|
- |
{ |
|
158 |
+ |
public void clearWidth() { |
182 |
159 |
|
Size.clear( this, GwtElementDimensionHelperX.INSTANCE, getContainerElement() ); |
183 |
160 |
|
} |
184 |
161 |
|
|
|
@@ -192,8 +169,7 @@ |
192 |
169 |
|
* @param pHeight the Widget's new height, in CSS px (e.g. "10") |
193 |
170 |
|
*/ |
194 |
171 |
|
@Override |
195 |
|
- |
public void setHeight( String pHeight ) |
196 |
|
- |
{ |
|
172 |
+ |
public void setHeight( String pHeight ) { |
197 |
173 |
|
Parse.andSetSize( getRenderHelperY(), pHeight ); |
198 |
174 |
|
} |
199 |
175 |
|
|
|
@@ -208,8 +184,7 @@ |
208 |
184 |
|
* @param pHeight the Widget's new height, in CSS px (e.g. "10") |
209 |
185 |
|
*/ |
210 |
186 |
|
@Override |
211 |
|
- |
public void LLsetWidgetHeight( int pHeight ) |
212 |
|
- |
{ |
|
187 |
+ |
public void LLsetWidgetHeight( int pHeight ) { |
213 |
188 |
|
Size.set( this, GwtElementDimensionHelperY.INSTANCE, getContainerElement(), pHeight, getDecorationSizeY() ); |
214 |
189 |
|
} |
215 |
190 |
|
|
|
@@ -218,56 +193,51 @@ |
218 |
193 |
|
* "natural" height of the Widget! |
219 |
194 |
|
*/ |
220 |
195 |
|
@Override |
221 |
|
- |
public void clearHeight() |
222 |
|
- |
{ |
|
196 |
+ |
public void clearHeight() { |
223 |
197 |
|
Size.clear( this, GwtElementDimensionHelperY.INSTANCE, getContainerElement() ); |
224 |
198 |
|
} |
225 |
199 |
|
|
226 |
200 |
|
@Override |
227 |
|
- |
public void renderingParticipationChanged() |
228 |
|
- |
{ |
|
201 |
+ |
public void renderingParticipationChanged() { |
229 |
202 |
|
RenderingParticipationChangedHelper.participationChanged( this, getWidget() ); |
230 |
203 |
|
} |
231 |
204 |
|
|
232 |
205 |
|
@Override |
233 |
|
- |
public RenderHelper getRenderHelperX() |
234 |
|
- |
{ |
|
206 |
+ |
public RenderHelper getRenderHelperX() { |
235 |
207 |
|
return mRenderHelperX; |
236 |
208 |
|
} |
237 |
209 |
|
|
238 |
210 |
|
@Override |
239 |
|
- |
public RenderHelper getRenderHelperY() |
240 |
|
- |
{ |
|
211 |
+ |
public RenderHelper getRenderHelperY() { |
241 |
212 |
|
return mRenderHelperY; |
242 |
213 |
|
} |
243 |
214 |
|
|
244 |
215 |
|
/** |
245 |
|
- |
* Get a Container's Decoration (or Overhead) Size in the 'X' dimension - the difference between the outside size and the inside size (what is available for child widgets) |
|
216 |
+ |
* Get a Container's Decoration (or Overhead) Size in the 'X' dimension - the difference between the outside size and the inside size (what is available |
|
217 |
+ |
* for child widgets) |
246 |
218 |
|
* <p/> |
247 |
219 |
|
* Note: this will NOT be called until the Container is reporting proper sizes! |
248 |
220 |
|
*/ |
249 |
221 |
|
@Override |
250 |
|
- |
public int getDecorationSizeX() |
251 |
|
- |
{ |
|
222 |
+ |
public int getDecorationSizeX() { |
252 |
223 |
|
return DecorationSize.calculate( this, GwtElementDimensionHelperX.INSTANCE, // |
253 |
224 |
|
getElement(), getContainerElement() ); |
254 |
225 |
|
} |
255 |
226 |
|
|
256 |
227 |
|
/** |
257 |
|
- |
* Get a Container's Decoration (or Overhead) Size in the 'Y' dimension - the difference between the outside size and the inside size (what is available for child widgets) |
|
228 |
+ |
* Get a Container's Decoration (or Overhead) Size in the 'Y' dimension - the difference between the outside size and the inside size (what is available |
|
229 |
+ |
* for child widgets) |
258 |
230 |
|
* <p/> |
259 |
231 |
|
* Note: this will NOT be called until the Container is reporting proper sizes! |
260 |
232 |
|
*/ |
261 |
233 |
|
@Override |
262 |
|
- |
public int getDecorationSizeY() |
263 |
|
- |
{ |
|
234 |
+ |
public int getDecorationSizeY() { |
264 |
235 |
|
return DecorationSize.calculate( this, GwtElementDimensionHelperY.INSTANCE, // |
265 |
236 |
|
getElement(), getContainerElement() ); |
266 |
237 |
|
} |
267 |
238 |
|
|
268 |
239 |
|
@Override |
269 |
|
- |
public void relayout() |
270 |
|
- |
{ |
|
240 |
+ |
public void relayout() { |
271 |
241 |
|
getRenderHelperX().layout(); |
272 |
242 |
|
getRenderHelperY().layout(); |
273 |
243 |
|
} |