@@ -44,6 +44,7 @@ source product.
4444using System ;
4545using System . Collections . Generic ;
4646using System . Text ;
47+ using Java . Lang ;
4748using iText . IO . Log ;
4849using iText . IO . Util ;
4950using iText . Kernel . Colors ;
@@ -335,6 +336,35 @@ public virtual TransparentColor GetPropertyAsTransparentColor(int property) {
335336 return this . GetProperty < TransparentColor > ( property ) ;
336337 }
337338
339+ /// <summary>Returns a property with a certain key, as a floating point value.</summary>
340+ /// <param name="property">
341+ /// an
342+ /// <see cref="iText.Layout.Properties.Property">enum value</see>
343+ /// </param>
344+ /// <returns>
345+ /// a
346+ /// <see cref="float?"/>
347+ /// </returns>
348+ public virtual float ? GetPropertyAsFloat ( int property ) {
349+ Number value = this . GetProperty < Number > ( property ) ;
350+ return value != null ? value : null ;
351+ }
352+
353+ /// <summary>Returns a property with a certain key, as a floating point value.</summary>
354+ /// <param name="property">
355+ /// an
356+ /// <see cref="iText.Layout.Properties.Property">enum value</see>
357+ /// </param>
358+ /// <param name="defaultValue">default value to be returned if property is not found</param>
359+ /// <returns>
360+ /// a
361+ /// <see cref="float?"/>
362+ /// </returns>
363+ public virtual float ? GetPropertyAsFloat ( int property , float ? defaultValue ) {
364+ Number value = this . GetProperty < Number > ( property , defaultValue ) ;
365+ return value != null ? value : null ;
366+ }
367+
338368 /// <summary>Returns a property with a certain key, as a boolean value.</summary>
339369 /// <param name="property">
340370 /// an
@@ -348,6 +378,20 @@ public virtual TransparentColor GetPropertyAsTransparentColor(int property) {
348378 return this . GetProperty < bool ? > ( property ) ;
349379 }
350380
381+ /// <summary>Returns a property with a certain key, as an integer value.</summary>
382+ /// <param name="property">
383+ /// an
384+ /// <see cref="iText.Layout.Properties.Property">enum value</see>
385+ /// </param>
386+ /// <returns>
387+ /// a
388+ /// <see cref="int?"/>
389+ /// </returns>
390+ public virtual int ? GetPropertyAsInteger ( int property ) {
391+ Number value = GetProperty ( property ) ;
392+ return value != null ? value : null ;
393+ }
394+
351395 /// <summary>Returns a string representation of the renderer.</summary>
352396 /// <returns>
353397 /// a
@@ -476,25 +520,18 @@ public virtual void DrawBackground(DrawContext drawContext) {
476520 /// </summary>
477521 /// <param name="drawContext">the context (canvas, document, etc) of this drawing operation.</param>
478522 public virtual void DrawChildren ( DrawContext drawContext ) {
479- IList < IRenderer > waitingRenderers = new List < IRenderer > ( ) ;
480523 foreach ( IRenderer child in childRenderers ) {
481524 if ( FloatingHelper . IsRendererFloating ( child ) ) {
482525 RootRenderer rootRenderer = GetRootRenderer ( ) ;
483526 if ( rootRenderer != null ) {
484527 rootRenderer . waitingDrawingElements . Add ( child ) ;
485528 child . SetProperty ( Property . FLOAT , null ) ;
486529 }
487- else {
488- waitingRenderers . Add ( child ) ;
489- }
490530 }
491531 else {
492532 child . Draw ( drawContext ) ;
493533 }
494534 }
495- foreach ( IRenderer waitingRenderer in waitingRenderers ) {
496- waitingRenderer . Draw ( drawContext ) ;
497- }
498535 }
499536
500537 /// <summary>
@@ -1211,9 +1248,9 @@ protected internal virtual float[] CalculateShiftToPositionBBoxOfPointsAt(float
12111248 }
12121249
12131250 protected internal virtual void OverrideHeightProperties ( ) {
1214- float ? height = this . GetPropertyAsFloat ( Property . HEIGHT ) ;
1215- float ? maxHeight = this . GetPropertyAsFloat ( Property . MAX_HEIGHT ) ;
1216- float ? minHeight = this . GetPropertyAsFloat ( Property . MIN_HEIGHT ) ;
1251+ float ? height = this . GetPropertyAsFloat < float > ( Property . HEIGHT ) ;
1252+ float ? maxHeight = this . GetPropertyAsFloat < float > ( Property . MAX_HEIGHT ) ;
1253+ float ? minHeight = this . GetPropertyAsFloat < float > ( Property . MIN_HEIGHT ) ;
12171254 if ( null != height ) {
12181255 if ( null == maxHeight || height < maxHeight ) {
12191256 maxHeight = height ;
0 commit comments