Author: rwhitcomb Date: Fri Jan 5 18:01:19 2018 New Revision: 1820338 URL: http://svn.apache.org/viewvc?rev=1820338&view=rev Log: Changes to TextAreaSkin to use the new "getWidth" and "getHeight" methods of Insets to simplify the code.
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java?rev=1820338&r1=1820337&r2=1820338&view=diff ============================================================================== --- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java (original) +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java Fri Jan 5 18:01:19 2018 @@ -198,7 +198,7 @@ public class TextAreaSkin extends Compon preferredWidth = averageCharacterSize.width * lineWidth; } - preferredWidth += margin.left + margin.right; + preferredWidth += margin.getWidth(); return preferredWidth; } @@ -208,15 +208,15 @@ public class TextAreaSkin extends Compon int preferredHeight = 0; // Include margin in constraint - int breakWidth = (wrapText && width != -1) ? Math.max(width - (margin.left + margin.right), - 0) : Integer.MAX_VALUE; + int breakWidth = (wrapText && width != -1) ? + Math.max(width - margin.getWidth(), 0) : Integer.MAX_VALUE; for (TextAreaSkinParagraphView paragraphView : paragraphViews) { paragraphView.setBreakWidth(breakWidth); preferredHeight += paragraphView.getHeight(); } - preferredHeight += margin.top + margin.bottom; + preferredHeight += margin.getHeight(); return preferredHeight; } @@ -232,8 +232,8 @@ public class TextAreaSkin extends Compon preferredHeight += paragraphView.getHeight(); } - preferredWidth += margin.left + margin.right; - preferredHeight += margin.top + margin.bottom; + preferredWidth += margin.getWidth(); + preferredHeight += margin.getHeight(); return new Dimensions(preferredWidth, preferredHeight); } @@ -244,7 +244,7 @@ public class TextAreaSkin extends Compon TextArea textArea = (TextArea) getComponent(); int width = getWidth(); - int breakWidth = (wrapText) ? Math.max(width - (margin.left + margin.right), 0) + int breakWidth = (wrapText) ? Math.max(width - margin.getWidth(), 0) : Integer.MAX_VALUE; int y = margin.top; @@ -313,7 +313,7 @@ public class TextAreaSkin extends Compon graphics.setFont(font); graphics.translate(0, margin.top); - int breakWidth = (wrapText) ? Math.max(width - (margin.left + margin.right), 0) + int breakWidth = (wrapText) ? Math.max(width - margin.getWidth(), 0) : Integer.MAX_VALUE; for (int i = 0, n = paragraphViews.getLength(); i < n; i++) { @@ -1632,7 +1632,7 @@ public class TextAreaSkin extends Compon if (lastRowIndex - firstRowIndex > 0) { selection.add(new Area(new Rectangle(margin.left, leadingSelectionBounds.y - + leadingSelectionBounds.height, width - (margin.left + margin.right), + + leadingSelectionBounds.height, width - margin.getWidth(), trailingSelectionBounds.y - (leadingSelectionBounds.y + leadingSelectionBounds.height)))); }