Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java Tue Jun  5 
00:14:11 2018
@@ -47,7 +47,7 @@ public abstract class Element extends No
     public Element() {
     }
 
-    public Element(Element element, boolean recursive) {
+    public Element(final Element element, final boolean recursive) {
         this.font = element.getFont();
         this.foregroundColor = element.getForegroundColor();
         this.backgroundColor = element.getBackgroundColor();
@@ -61,10 +61,10 @@ public abstract class Element extends No
     }
 
     @Override
-    public void insertRange(Node range, int offset) {
+    public void insertRange(final Node range, final int offset) {
         if (!(range instanceof Element)) {
-            throw new IllegalArgumentException("Range node (" +
-                range.getClass().getSimpleName() + ") is not an Element.");
+            throw new IllegalArgumentException("Range node ("
+                + range.getClass().getSimpleName() + ") is not an Element.");
         }
 
         Utils.checkIndexBounds(offset, 0, characterCount);
@@ -109,7 +109,7 @@ public abstract class Element extends No
         }
     }
 
-    private Paragraph getParagraphParent(Node node) {
+    private Paragraph getParagraphParent(final Node node) {
         Element parent = node.getParent();
         while ((parent != null) && !(parent instanceof Paragraph)) {
             parent = parent.getParent();
@@ -118,7 +118,7 @@ public abstract class Element extends No
     }
 
     @Override
-    public Node removeRange(int offset, int charCount) {
+    public Node removeRange(final int offset, final int charCount) {
         Utils.checkIndexBounds(offset, charCount, 0, characterCount);
 
         // Create a copy of this element
@@ -144,8 +144,8 @@ public abstract class Element extends No
                     // empty line, so check that condition and don't remove the
                     // entire node.
                     Paragraph paragraph;
-                    if (node instanceof TextNode && (paragraph = 
getParagraphParent(node)) != null &&
-                        paragraph.getLength() == 1) {
+                    if (node instanceof TextNode && (paragraph = 
getParagraphParent(node)) != null
+                     && paragraph.getLength() == 1) {
                         segment = node.removeRange(0, charCount);
                     } else {
                         // Remove the entire node
@@ -205,7 +205,7 @@ public abstract class Element extends No
     }
 
     @Override
-    public Element getRange(int offset, int charCount) {
+    public Element getRange(final int offset, final int charCount) {
         Utils.checkIndexBounds(offset, charCount, 0, characterCount);
 
         // Create a copy of this element
@@ -273,7 +273,7 @@ public abstract class Element extends No
     public abstract Element duplicate(boolean recursive);
 
     @Override
-    public char getCharacterAt(int offset) {
+    public char getCharacterAt(final int offset) {
         Node node = nodes.get(getNodeAt(offset));
         return node.getCharacterAt(offset - node.getOffset());
     }
@@ -283,7 +283,7 @@ public abstract class Element extends No
         return characterCount;
     }
 
-    private void addCharacters(Appendable buf, Element element) {
+    private void addCharacters(final Appendable buf, final Element element) {
         try {
             for (Node child : element.nodes) {
                 if (child instanceof Element) {
@@ -311,7 +311,7 @@ public abstract class Element extends No
     }
 
     @Override
-    public int add(Node node) {
+    public int add(final Node node) {
         int index = nodes.getLength();
         insert(node, index);
 
@@ -319,7 +319,7 @@ public abstract class Element extends No
     }
 
     @Override
-    public void insert(Node node, int index) {
+    public void insert(final Node node, final int index) {
         Utils.checkNull(node, "node");
         Utils.checkIndexBounds(index, 0, nodes.getLength());
 
@@ -362,12 +362,12 @@ public abstract class Element extends No
     }
 
     @Override
-    public Node update(int index, Node node) {
+    public Node update(final int index, final Node node) {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public int remove(Node node) {
+    public int remove(final Node node) {
         int index = indexOf(node);
         if (index != -1) {
             remove(index, 1);
@@ -377,17 +377,17 @@ public abstract class Element extends No
     }
 
     @Override
-    public Sequence<Node> remove(int index, int count) {
+    public Sequence<Node> remove(final int index, final int count) {
         Utils.checkIndexBounds(index, count, 0, nodes.getLength());
 
         // Remove the nodes
         Sequence<Node> removed = nodes.remove(index, count);
-        count = removed.getLength();
+        int len = removed.getLength();
         StringBuilder removedChars = new StringBuilder();
 
-        if (count > 0) {
+        if (len > 0) {
             int removedCharacterCount = 0;
-            for (int i = 0; i < count; i++) {
+            for (int i = 0; i < len; i++) {
                 Node node = removed.get(i);
                 node.setParent(null);
                 removedCharacterCount += node.getCharacterCount();
@@ -429,14 +429,14 @@ public abstract class Element extends No
     }
 
     @Override
-    public Node get(int index) {
+    public Node get(final int index) {
         Utils.checkZeroBasedIndex(index, nodes.getLength());
 
         return nodes.get(index);
     }
 
     @Override
-    public int indexOf(Node node) {
+    public int indexOf(final Node node) {
         Utils.checkNull(node, "node");
 
         return nodes.indexOf(node);
@@ -453,7 +453,7 @@ public abstract class Element extends No
      * @param offset The text offset to search for.
      * @return The index of the child node at the given offset.
      */
-    public int getNodeAt(int offset) {
+    public int getNodeAt(final int offset) {
         Utils.checkZeroBasedIndex(offset, characterCount);
 
         int i = nodes.getLength() - 1;
@@ -472,7 +472,7 @@ public abstract class Element extends No
      * @param offset The text offset to search for.
      * @return The path to the descendant node at the given offset.
      */
-    public Sequence<Integer> getPathAt(int offset) {
+    public Sequence<Integer> getPathAt(final int offset) {
         Sequence<Integer> path;
 
         int index = getNodeAt(offset);
@@ -496,7 +496,7 @@ public abstract class Element extends No
      * @param offset The text offset to search for.
      * @return The descendant node at the given offset.
      */
-    public Node getDescendantAt(int offset) {
+    public Node getDescendantAt(final int offset) {
         Node descendant = nodes.get(getNodeAt(offset));
 
         if (descendant instanceof Element) {
@@ -508,7 +508,7 @@ public abstract class Element extends No
     }
 
     @Override
-    protected void rangeInserted(int offset, int charCount) {
+    protected void rangeInserted(final int offset, final int charCount) {
         this.characterCount += charCount;
 
         // Update the offsets of consecutive nodes
@@ -523,7 +523,8 @@ public abstract class Element extends No
     }
 
     @Override
-    protected void rangeRemoved(Node originalNode, int offset, int charCount, 
CharSequence removedChars) {
+    protected void rangeRemoved(final Node originalNode, final int offset, 
final int charCount,
+        final CharSequence removedChars) {
         // Update the offsets of consecutive nodes, if any
         if (offset < this.characterCount) {
             int index = getNodeAt(offset);
@@ -544,11 +545,11 @@ public abstract class Element extends No
         return new ImmutableIterator<>(nodes.iterator());
     }
 
-    public java.awt.Font getFont() {
+    public final Font getFont() {
         return font;
     }
 
-    public void setFont(Font font) {
+    public final void setFont(final Font font) {
         Utils.checkNull(font, "font");
 
         Font previousFont = this.font;
@@ -558,7 +559,7 @@ public abstract class Element extends No
         }
     }
 
-    public final void setFont(String font) {
+    public final void setFont(final String font) {
         setFont(FontUtilities.decodeFont(font));
     }
 
@@ -566,17 +567,17 @@ public abstract class Element extends No
      * @return The current foreground color, or <tt>null</tt> if no color is
      * foreground.
      */
-    public Color getForegroundColor() {
+    public final Color getForegroundColor() {
         return foregroundColor;
     }
 
     /**
-     * Sets the currently foreground color.
+     * Sets the current foreground color.
      *
      * @param foregroundColor The foreground color, or <tt>null</tt> to specify
      * no selection.
      */
-    public void setForegroundColor(Color foregroundColor) {
+    public final void setForegroundColor(final Color foregroundColor) {
         Color previousForegroundColor = this.foregroundColor;
 
         if (foregroundColor != previousForegroundColor) {
@@ -590,7 +591,7 @@ public abstract class Element extends No
      *
      * @param foregroundColor The foreground color.
      */
-    public void setForegroundColor(String foregroundColor) {
+    public final void setForegroundColor(final String foregroundColor) {
         setForegroundColor(GraphicsUtilities.decodeColor(foregroundColor, 
"foregroundColor"));
     }
 
@@ -598,7 +599,7 @@ public abstract class Element extends No
      * @return The current background color, or <tt>null</tt> if no color is
      * background.
      */
-    public Color getBackgroundColor() {
+    public final Color getBackgroundColor() {
         return backgroundColor;
     }
 
@@ -608,7 +609,7 @@ public abstract class Element extends No
      * @param backgroundColor The background color, or <tt>null</tt> to specify
      * no selection.
      */
-    public void setBackgroundColor(Color backgroundColor) {
+    public final void setBackgroundColor(final Color backgroundColor) {
         Color previousBackgroundColor = this.backgroundColor;
 
         if (backgroundColor != previousBackgroundColor) {
@@ -622,15 +623,15 @@ public abstract class Element extends No
      *
      * @param backgroundColor The background color.
      */
-    public void setBackgroundColor(String backgroundColor) {
+    public final void setBackgroundColor(final String backgroundColor) {
         setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, 
"backgroundColor"));
     }
 
-    public boolean isUnderline() {
+    public final boolean isUnderline() {
         return underline;
     }
 
-    public void setUnderline(boolean underline) {
+    public final void setUnderline(final boolean underline) {
         boolean previousUnderline = this.underline;
         if (previousUnderline != underline) {
             this.underline = underline;
@@ -638,11 +639,11 @@ public abstract class Element extends No
         }
     }
 
-    public boolean isStrikethrough() {
+    public final boolean isStrikethrough() {
         return strikethrough;
     }
 
-    public void setStrikethrough(boolean strikethrough) {
+    public final void setStrikethrough(final boolean strikethrough) {
         boolean previousStrikethrough = this.strikethrough;
         if (previousStrikethrough != strikethrough) {
             this.strikethrough = strikethrough;

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java Tue Jun  5 
00:14:11 2018
@@ -32,11 +32,11 @@ public final class TextNode extends Node
         this("");
     }
 
-    public TextNode(TextNode textNode) {
+    public TextNode(final TextNode textNode) {
         this(textNode.getText());
     }
 
-    public TextNode(String text) {
+    public TextNode(final String text) {
         Utils.checkNull(text, "text");
 
         characters = new StringBuilder(text);
@@ -46,30 +46,30 @@ public final class TextNode extends Node
         return characters.toString();
     }
 
-    public String getText(int beginIndex, int endIndex) {
+    public String getText(final int beginIndex, final int endIndex) {
         return characters.substring(beginIndex, endIndex);
     }
 
-    public String getText(Span span) {
+    public String getText(final Span span) {
         Utils.checkNull(span, "span");
 
         return characters.substring(span.normalStart(), span.normalEnd() + 1);
     }
 
-    public String getText(CharSpan charSpan) {
+    public String getText(final CharSpan charSpan) {
         Utils.checkNull(charSpan, "charSpan");
 
         return characters.substring(charSpan.start, charSpan.start + 
charSpan.length);
     }
 
-    public void setText(String text) {
+    public void setText(final String text) {
         Utils.checkNull(text, "text");
 
         removeText(0, getCharacterCount());
         insertText(text, 0);
     }
 
-    public void appendText(CharSequence text) {
+    public void appendText(final CharSequence text) {
         insertText(text, characters.length());
     }
 
@@ -77,7 +77,7 @@ public final class TextNode extends Node
      * @param text  The new text to insert into this node.
      * @param index Starting index into this node for the insertion.
      */
-    public void insertText(CharSequence text, int index) {
+    public void insertText(final CharSequence text, final int index) {
         Utils.checkNull(text, "text");
         Utils.checkIndexBounds(index, 0, characters.length());
 
@@ -93,7 +93,7 @@ public final class TextNode extends Node
      * @param index Index into this node.
      * @param count Count of characters to remove.
      */
-    public void removeText(int index, int count) {
+    public void removeText(final int index, final int count) {
         Utils.checkIndexBounds(index, count, 0, characters.length());
 
         if (count > 0) {
@@ -106,16 +106,16 @@ public final class TextNode extends Node
         }
     }
 
-    public String getSubstring(Span range) {
+    public String getSubstring(final Span range) {
         Utils.checkNull(range, "range");
         return characters.substring(range.start, range.end + 1);
     }
 
-    public String getSubstring(int start, int end) {
+    public String getSubstring(final int start, final int end) {
         return characters.substring(start, end);
     }
 
-    public String getSubstring(CharSpan charSpan) {
+    public String getSubstring(final CharSpan charSpan) {
         Utils.checkNull(charSpan, "charSpan");
         return characters.substring(charSpan.start, charSpan.start + 
charSpan.length);
     }
@@ -124,22 +124,22 @@ public final class TextNode extends Node
         return characters;
     }
 
-    public CharSequence getCharacters(int start, int end) {
+    public CharSequence getCharacters(final int start, final int end) {
         return characters.subSequence(start, end);
     }
 
-    public CharSequence getCharacters(Span range) {
+    public CharSequence getCharacters(final Span range) {
         Utils.checkNull(range, "range");
         return characters.subSequence(range.start, range.end + 1);
     }
 
-    public CharSequence getCharacters(CharSpan charSpan) {
+    public CharSequence getCharacters(final CharSpan charSpan) {
         Utils.checkNull(charSpan, "charSpan");
         return characters.subSequence(charSpan.start, charSpan.start + 
charSpan.length);
     }
 
     @Override
-    public char getCharacterAt(int index) {
+    public char getCharacterAt(final int index) {
         return characters.charAt(index);
     }
 
@@ -152,10 +152,10 @@ public final class TextNode extends Node
      * @param offset Offset into this text node.
      */
     @Override
-    public void insertRange(Node range, int offset) {
+    public void insertRange(final Node range, final int offset) {
         if (!(range instanceof TextNode)) {
-            throw new IllegalArgumentException("Range node (" +
-                range.getClass().getSimpleName() + ") is not a text node.");
+            throw new IllegalArgumentException("Range node ("
+                + range.getClass().getSimpleName() + ") is not a text node.");
         }
 
         TextNode textNode = (TextNode) range;
@@ -163,7 +163,7 @@ public final class TextNode extends Node
     }
 
     @Override
-    public Node removeRange(int offset, int characterCount) {
+    public Node removeRange(final int offset, final int characterCount) {
         Utils.checkNonNegative(characterCount, "characterCount");
 
         String removed = characters.substring(offset, offset + characterCount);
@@ -174,7 +174,7 @@ public final class TextNode extends Node
     }
 
     @Override
-    public Node getRange(int offset, int characterCount) {
+    public Node getRange(final int offset, final int characterCount) {
         Utils.checkNonNegative(characterCount, "characterCount");
         Utils.checkIndexBounds(offset, characterCount, 0, characters.length());
 
@@ -188,7 +188,7 @@ public final class TextNode extends Node
     }
 
     @Override
-    public Node duplicate(boolean recursive) {
+    public Node duplicate(final boolean recursive) {
         return new TextNode(this);
     }
 


Reply via email to