262 if (width == USE_COMPUTED_SIZE) {
263 layout.setWrapWidth(0);
264 } else {
265 double wrappingWidth = Math.max(1, width - left - right);
266 layout.setWrapWidth((float)wrappingWidth);
267 }
268 double height = layout.getBounds().getHeight();
269 double wrappingWidth = Math.max(1, getWidth() - left - right);
270 layout.setWrapWidth((float)wrappingWidth);
271 double top = snapSpaceY(insets.getTop());
272 double bottom = snapSpaceY(insets.getBottom());
273 return top + height + bottom;
274 }
275
276 @Override protected double computeMinHeight(double width) {
277 return computePrefHeight(width);
278 }
279
280 @Override public void requestLayout() {
281 /* The geometry of text nodes can be changed during layout children.
282 * For that reason it has to call impl_geomChanged() causing
283 * requestLayout() to happen during layoutChildren().
284 * The inLayout flag prevents this call to cause any extra work.
285 */
286 if (inLayout) return;
287
288 /*
289 * There is no need to reset the text layout's content every time
290 * requestLayout() is called. For example, the content needs
291 * to be set when:
292 * children add or removed
293 * children managed state changes
294 * children geomChanged (width/height of embedded node)
295 * children content changes (text/font of text node)
296 * The content does not need to set when:
297 * the width/height changes in the region
298 * the insets changes in the region
299 *
300 * Unfortunately, it is not possible to know what change invoked request
301 * layout. The solution is to always reset the content in the text
302 * layout and rely on it to preserve itself if the new content equals to
|
262 if (width == USE_COMPUTED_SIZE) {
263 layout.setWrapWidth(0);
264 } else {
265 double wrappingWidth = Math.max(1, width - left - right);
266 layout.setWrapWidth((float)wrappingWidth);
267 }
268 double height = layout.getBounds().getHeight();
269 double wrappingWidth = Math.max(1, getWidth() - left - right);
270 layout.setWrapWidth((float)wrappingWidth);
271 double top = snapSpaceY(insets.getTop());
272 double bottom = snapSpaceY(insets.getBottom());
273 return top + height + bottom;
274 }
275
276 @Override protected double computeMinHeight(double width) {
277 return computePrefHeight(width);
278 }
279
280 @Override public void requestLayout() {
281 /* The geometry of text nodes can be changed during layout children.
282 * For that reason it has to call NodeHelper.geomChanged(this) causing
283 * requestLayout() to happen during layoutChildren().
284 * The inLayout flag prevents this call to cause any extra work.
285 */
286 if (inLayout) return;
287
288 /*
289 * There is no need to reset the text layout's content every time
290 * requestLayout() is called. For example, the content needs
291 * to be set when:
292 * children add or removed
293 * children managed state changes
294 * children geomChanged (width/height of embedded node)
295 * children content changes (text/font of text node)
296 * The content does not need to set when:
297 * the width/height changes in the region
298 * the insets changes in the region
299 *
300 * Unfortunately, it is not possible to know what change invoked request
301 * layout. The solution is to always reset the content in the text
302 * layout and rely on it to preserve itself if the new content equals to
|