Author: rwhitcomb
Date: Fri Apr 2 06:29:30 2021
New Revision: 1888287
URL: http://svn.apache.org/viewvc?rev=1888287&view=rev
Log:
PIVOT-1032: Changes to reduce "checkstyle" violations.
Modified:
pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
pivot/trunk/demos/src/org/apache/pivot/demos/xml/NodeRenderer.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/WTKTaskListener.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java
Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Fri Apr 2
06:29:30 2021
@@ -68,30 +68,33 @@ public class JSONSerializer implements S
private JSONSerializerListener.Listeners jsonSerializerListeners = null;
+ private static final String NULL_STRING = "null";
+
public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
public static final Type DEFAULT_TYPE = Object.class;
public static final String JSON_EXTENSION = "json";
public static final String MIME_TYPE = "application/json";
+
public JSONSerializer() {
this(DEFAULT_CHARSET, DEFAULT_TYPE);
}
- public JSONSerializer(final Charset charset) {
- this(charset, DEFAULT_TYPE);
+ public JSONSerializer(final Charset cs) {
+ this(cs, DEFAULT_TYPE);
}
- public JSONSerializer(final Type type) {
- this(DEFAULT_CHARSET, type);
+ public JSONSerializer(final Type objType) {
+ this(DEFAULT_CHARSET, objType);
}
- public JSONSerializer(final Charset charset, final Type type) {
- Utils.checkNull(charset, "charset");
- Utils.checkNull(type, "type");
+ public JSONSerializer(final Charset cs, final Type objType) {
+ Utils.checkNull(cs, "charset");
+ Utils.checkNull(objType, "type");
- this.charset = charset;
- this.type = type;
+ charset = cs;
+ type = objType;
}
/**
@@ -126,11 +129,11 @@ public class JSONSerializer implements S
/**
* Sets a flag indicating that map keys should always be quote-delimited.
*
- * @param alwaysDelimitMapKeys {@code true} to bound map keys in double
+ * @param delimitKeys {@code true} to bound map keys in double
* quotes; {@code false} to only quote-delimit keys as necessary.
*/
- public void setAlwaysDelimitMapKeys(final boolean alwaysDelimitMapKeys) {
- this.alwaysDelimitMapKeys = alwaysDelimitMapKeys;
+ public void setAlwaysDelimitMapKeys(final boolean delimitKeys) {
+ alwaysDelimitMapKeys = delimitKeys;
}
/**
@@ -145,10 +148,10 @@ public class JSONSerializer implements S
* Sets the serializer's verbosity flag. When verbosity is enabled, all
data
* read or written will be echoed to the console.
*
- * @param verbose {@code true} to set verbose mode, {@code false} to
disable.
+ * @param verboseValue {@code true} to set verbose mode, {@code false} to
disable.
*/
- public void setVerbose(final boolean verbose) {
- this.verbose = verbose;
+ public void setVerbose(final boolean verboseValue) {
+ verbose = verboseValue;
}
/**
@@ -164,12 +167,12 @@ public class JSONSerializer implements S
* a non-standard feature. See the documentation in {@link MacroReader}
for more details
* on the specification of macros.
* <p> Note: must be called before {@link #readObject} is called.
- * @param macros Flag indicating whether macros are allowed (default is
{@code false}).
+ * @param allowMacros Flag indicating whether macros are allowed (default
is {@code false}).
* The flag must be set to true in order to activate this feature, because
there is a
* definitely measured 25x slowdown when using it, even if no macros are
defined.
*/
- public void setAllowMacros(final boolean macros) {
- this.macros = macros;
+ public void setAllowMacros(final boolean allowMacros) {
+ macros = allowMacros;
}
/**
@@ -240,7 +243,7 @@ public class JSONSerializer implements S
return object;
}
- private Object readValue(final Reader reader, final Type typeArgument,
final String key)
+ private Object readValue(final Reader reader, final Type objTypeValue,
final String key)
throws IOException, SerializationException {
Object object = null;
@@ -253,15 +256,15 @@ public class JSONSerializer implements S
if (c == 'n') {
object = readNullValue(reader);
} else if (c == '"' || c == '\'') {
- object = readStringValue(reader, typeArgument, key);
+ object = readStringValue(reader, objTypeValue, key);
} else if (c == '+' || c == '-' || Character.isDigit(c)) {
- object = readNumberValue(reader, typeArgument, key);
+ object = readNumberValue(reader, objTypeValue, key);
} else if (c == 't' || c == 'f') {
- object = readBooleanValue(reader, typeArgument, key);
+ object = readBooleanValue(reader, objTypeValue, key);
} else if (c == '[') {
- object = readListValue(reader, typeArgument, key);
+ object = readListValue(reader, objTypeValue, key);
} else if (c == '{') {
- object = readMapValue(reader, typeArgument);
+ object = readMapValue(reader, objTypeValue);
} else {
throw new SerializationException("Unexpected character in input
stream: '" + (char) c + "'");
}
@@ -310,13 +313,11 @@ public class JSONSerializer implements S
}
private Object readNullValue(final Reader reader) throws IOException,
SerializationException {
- String nullString = "null";
-
- int n = nullString.length();
+ int n = NULL_STRING.length();
int i = 0;
while (c != -1 && i < n) {
- if (nullString.charAt(i) != c) {
+ if (NULL_STRING.charAt(i) != c) {
throw new SerializationException("Unexpected character in
input stream: '" + (char) c + "'");
}
@@ -395,10 +396,10 @@ public class JSONSerializer implements S
return stringBuilder.toString();
}
- private Object readStringValue(final Reader reader, final Type
typeArgument, final String key)
+ private Object readStringValue(final Reader reader, final Type
objTypeValue, final String key)
throws IOException, SerializationException {
- if (!(typeArgument instanceof Class<?>)) {
- throw new SerializationException("Cannot convert string to " +
typeArgument + ".");
+ if (!(objTypeValue instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert string to " +
objTypeValue + ".");
}
String string = readString(reader);
@@ -408,13 +409,13 @@ public class JSONSerializer implements S
jsonSerializerListeners.readString(this, string);
}
- return BeanAdapter.coerce(string, (Class<?>) typeArgument, key);
+ return BeanAdapter.coerce(string, (Class<?>) objTypeValue, key);
}
- private Object readNumberValue(final Reader reader, final Type
typeArgument, final String key)
+ private Object readNumberValue(final Reader reader, final Type
objTypeValue, final String key)
throws IOException, SerializationException {
- if (!(typeArgument instanceof Class<?>)) {
- throw new SerializationException("Cannot convert number to " +
typeArgument + ".");
+ if (!(objTypeValue instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert number to " +
objTypeValue + ".");
}
Number number = null;
@@ -451,13 +452,13 @@ public class JSONSerializer implements S
jsonSerializerListeners.readNumber(this, number);
}
- return BeanAdapter.coerce(number, (Class<?>) typeArgument, key);
+ return BeanAdapter.coerce(number, (Class<?>) objTypeValue, key);
}
- private Object readBooleanValue(final Reader reader, final Type
typeArgument, final String key)
+ private Object readBooleanValue(final Reader reader, final Type
objTypeValue, final String key)
throws IOException, SerializationException {
- if (!(typeArgument instanceof Class<?>)) {
- throw new SerializationException("Cannot convert boolean to " +
typeArgument + ".");
+ if (!(objTypeValue instanceof Class<?>)) {
+ throw new SerializationException("Cannot convert boolean to " +
objTypeValue + ".");
}
String text = (c == 't') ? "true" : "false";
@@ -485,22 +486,22 @@ public class JSONSerializer implements S
jsonSerializerListeners.readBoolean(this, value);
}
- return BeanAdapter.coerce(value, (Class<?>) typeArgument, key);
+ return BeanAdapter.coerce(value, (Class<?>) objTypeValue, key);
}
@SuppressWarnings("unchecked")
- private Object readListValue(final Reader reader, final Type typeArgument,
final String key)
+ private Object readListValue(final Reader reader, final Type objTypeValue,
final String key)
throws IOException, SerializationException {
Sequence<Object> sequence = null;
Type itemType = null;
- if (typeArgument == Object.class) {
+ if (objTypeValue == Object.class) {
// Return the default sequence and item types
sequence = new ArrayList<>();
itemType = Object.class;
} else {
// Determine the item type from generic parameters
- Type parentType = typeArgument;
+ Type parentType = objTypeValue;
while (parentType != null) {
if (parentType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType)
parentType;
@@ -548,11 +549,11 @@ public class JSONSerializer implements S
// Instantiate the sequence type
Class<?> sequenceType;
- if (typeArgument instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType)
typeArgument;
+ if (objTypeValue instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)
objTypeValue;
sequenceType = (Class<?>) parameterizedType.getRawType();
} else {
- sequenceType = (Class<?>) typeArgument;
+ sequenceType = (Class<?>) objTypeValue;
}
try {
@@ -600,18 +601,18 @@ public class JSONSerializer implements S
}
@SuppressWarnings("unchecked")
- private Object readMapValue(final Reader reader, final Type typeArgument)
+ private Object readMapValue(final Reader reader, final Type objTypeValue)
throws IOException, SerializationException {
Dictionary<String, Object> dictionary = null;
Type valueType = null;
- if (typeArgument == Object.class) {
+ if (objTypeValue == Object.class) {
// Return the default dictionary and value types
dictionary = new HashMap<>();
valueType = Object.class;
} else {
// Determine the value type from generic parameters
- Type parentType = typeArgument;
+ Type parentType = objTypeValue;
while (parentType != null) {
if (parentType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType)
parentType;
@@ -655,7 +656,7 @@ public class JSONSerializer implements S
// Instantiate the dictionary or bean type
if (valueType == null) {
- Class<?> beanType = (Class<?>) typeArgument;
+ Class<?> beanType = (Class<?>) objTypeValue;
try {
dictionary = new
BeanAdapter(beanType.getDeclaredConstructor().newInstance());
@@ -665,11 +666,11 @@ public class JSONSerializer implements S
}
} else {
Class<?> dictionaryType;
- if (typeArgument instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType)
typeArgument;
+ if (objTypeValue instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = (ParameterizedType)
objTypeValue;
dictionaryType = (Class<?>) parameterizedType.getRawType();
} else {
- dictionaryType = (Class<?>) typeArgument;
+ dictionaryType = (Class<?>) objTypeValue;
}
try {
Modified: pivot/trunk/demos/src/org/apache/pivot/demos/xml/NodeRenderer.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/xml/NodeRenderer.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/xml/NodeRenderer.java
(original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/xml/NodeRenderer.java Fri Apr
2 06:29:30 2021
@@ -16,9 +16,6 @@
*/
package org.apache.pivot.demos.xml;
-import java.awt.Color;
-import java.awt.Font;
-
import org.apache.pivot.collections.Sequence;
import org.apache.pivot.wtk.Label;
import org.apache.pivot.wtk.Style;
@@ -30,10 +27,13 @@ import org.apache.pivot.xml.TextNode;
* Custom tree view node renderer for presenting XML nodes.
*/
public class NodeRenderer extends Label implements TreeView.NodeRenderer {
+ /**
+ * Maximum text length to display (without ellipsis) for a node.
+ */
public static final int MAXIMUM_TEXT_LENGTH = 20;
@Override
- public void setSize(int width, int height) {
+ public void setSize(final int width, final int height) {
super.setSize(width, height);
// Since this component doesn't have a parent, it won't be validated
@@ -42,9 +42,9 @@ public class NodeRenderer extends Label
}
@Override
- public void render(Object node, Sequence.Tree.Path path, int rowIndex,
TreeView treeView,
- boolean expanded, boolean selected, TreeView.NodeCheckState checkState,
- boolean highlighted, boolean disabled) {
+ public void render(final Object node, final Sequence.Tree.Path path, final
int rowIndex,
+ final TreeView treeView, final boolean expanded, final boolean
selected,
+ final TreeView.NodeCheckState checkState, final boolean highlighted,
final boolean disabled) {
if (node != null) {
String text;
if (node instanceof Element) {
@@ -87,7 +87,7 @@ public class NodeRenderer extends Label
}
@Override
- public String toString(Object node) {
+ public String toString(final Object node) {
String string;
if (node instanceof Element) {
Element element = (Element) node;
Modified:
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
---
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
(original)
+++
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
Fri Apr 2 06:29:30 2021
@@ -20,7 +20,6 @@ import java.awt.Color;
import java.awt.Font;
import org.apache.pivot.beans.BXMLSerializer;
-import org.apache.pivot.collections.Dictionary;
import org.apache.pivot.collections.Sequence;
import org.apache.pivot.util.Vote;
import org.apache.pivot.wtk.BoxPane;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/WTKTaskListener.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/WTKTaskListener.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/WTKTaskListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/WTKTaskListener.java Fri Apr 2
06:29:30 2021
@@ -23,10 +23,12 @@ import org.apache.pivot.util.concurrent.
/**
* Default implementation of the {@link TaskListener} interface
* with default implementations of the methods.
+ *
+ * @param <V> Return value type for the task.
*/
public class WTKTaskListener<V> implements TaskListener<V> {
@Override
- public void taskExecuted(Task<V> task) {
+ public void taskExecuted(final Task<V> task) {
// Empty block
}
@@ -35,7 +37,7 @@ public class WTKTaskListener<V> implemen
* with the {@link Task#getBackgroundThread} and {@link Task#getFault}.
*/
@Override
- public void executeFailed(Task<V> task) {
+ public void executeFailed(final Task<V> task) {
ApplicationContext.handleUncaughtException(task.getBackgroundThread(),
task.getFault());
}
}
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
(original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
Fri Apr 2 06:29:30 2021
@@ -42,14 +42,24 @@ public class DropShadowDecorator impleme
public static final float DEFAULT_SHADOW_OPACITY = 0.25f;
+ /**
+ * Default constructor with values of <code>3, 3, 3</code>.
+ */
public DropShadowDecorator() {
this(3, 3, 3);
}
- public DropShadowDecorator(int blurRadius, int xOffset, int yOffset) {
- this.blurRadius = blurRadius;
- this.xOffset = xOffset;
- this.yOffset = yOffset;
+ /**
+ * Construct using non-default values of radius and offsets.
+ *
+ * @param radius The radius to blur around the component.
+ * @param xOff X-offset for the blurring to occur.
+ * @param yOff Y-offset of the blurring.
+ */
+ public DropShadowDecorator(final int radius, final int xOff, final int
yOff) {
+ blurRadius = radius;
+ xOffset = xOff;
+ yOffset = yOff;
}
/**
@@ -62,21 +72,21 @@ public class DropShadowDecorator impleme
/**
* Sets the color used to draw the shadow.
*
- * @param shadowColor The color used to draw the shadow.
+ * @param colorValue The color used to draw the shadow.
*/
- public void setShadowColor(Color shadowColor) {
- this.shadowColor = shadowColor;
+ public void setShadowColor(final Color colorValue) {
+ shadowColor = colorValue;
}
/**
* Sets the color used to draw the shadow.
*
- * @param shadowColor The color used to draw the shadow, which can be any
of
+ * @param shadowColorString The color used to draw the shadow, which can
be any of
* the {@linkplain GraphicsUtilities#decodeColor color values recognized by
* Pivot}.
*/
- public final void setShadowColor(String shadowColor) {
- setShadowColor(GraphicsUtilities.decodeColor(shadowColor,
"shadowColor"));
+ public final void setShadowColor(final String shadowColorString) {
+ setShadowColor(GraphicsUtilities.decodeColor(shadowColorString,
"shadowColor"));
}
/**
@@ -91,10 +101,10 @@ public class DropShadowDecorator impleme
/**
* Sets the opacity used to draw the shadow.
*
- * @param shadowOpacity The opacity used to draw the shadow.
+ * @param opacity The opacity used to draw the shadow.
*/
- public void setShadowOpacity(float shadowOpacity) {
- this.shadowOpacity = shadowOpacity;
+ public void setShadowOpacity(final float opacity) {
+ shadowOpacity = opacity;
}
/**
@@ -107,10 +117,10 @@ public class DropShadowDecorator impleme
/**
* Sets the blur radius used to draw the shadow.
*
- * @param blurRadius The blur radius used to draw the shadow.
+ * @param radius The blur radius used to draw the shadow.
*/
- public void setBlurRadius(int blurRadius) {
- this.blurRadius = blurRadius;
+ public void setBlurRadius(final int radius) {
+ blurRadius = radius;
}
/**
@@ -125,10 +135,10 @@ public class DropShadowDecorator impleme
/**
* Sets the amount that the drop shadow will be offset along the x axis.
*
- * @param xOffset The x offset used to draw the shadow.
+ * @param xOff The x offset used to draw the shadow.
*/
- public void setXOffset(int xOffset) {
- this.xOffset = xOffset;
+ public void setXOffset(final int xOff) {
+ xOffset = xOff;
}
/**
@@ -143,19 +153,20 @@ public class DropShadowDecorator impleme
/**
* Sets the amount that the drop shadow will be offset along the y axis.
*
- * @param yOffset The y offset used to draw the shadow.
+ * @param yOff The y offset used to draw the shadow.
*/
- public void setYOffset(int yOffset) {
- this.yOffset = yOffset;
+ public void setYOffset(final int yOff) {
+ yOffset = yOff;
}
@Override
- public Graphics2D prepare(Component component, Graphics2D graphics) {
+ public Graphics2D prepare(final Component component, final Graphics2D
graphics) {
int width = component.getWidth();
int height = component.getHeight();
if (width > 0 && height > 0) {
- if (shadowImage == null || shadowImage.getWidth() != width + 2 *
blurRadius
+ if (shadowImage == null
+ || shadowImage.getWidth() != width + 2 * blurRadius
|| shadowImage.getHeight() != height + 2 * blurRadius) {
// Recreate the shadow
BufferedImage rectangleImage = new BufferedImage(width, height,
@@ -181,21 +192,24 @@ public class DropShadowDecorator impleme
}
@Override
- public Bounds getBounds(Component component) {
- return new Bounds(xOffset - blurRadius, yOffset - blurRadius,
component.getWidth()
- + blurRadius * 2, component.getHeight() + blurRadius * 2);
+ public Bounds getBounds(final Component component) {
+ return new Bounds(
+ xOffset - blurRadius,
+ yOffset - blurRadius,
+ component.getWidth() + blurRadius * 2,
+ component.getHeight() + blurRadius * 2);
}
/**
* Generates the shadow for a given picture and the current properties of
* the decorator. The generated image dimensions are computed as follows:
- * <pre> width = imageWidth + 2 * blurRadius height = imageHeight + 2 *
- * blurRadius </pre>
+ * <pre> width = imageWidth + 2 * blurRadius
+ * height = imageHeight + 2 * blurRadius </pre>
*
* @param src The image from which the shadow will be cast.
* @return An image containing the generated shadow.
*/
- private BufferedImage createShadow(BufferedImage src) {
+ private BufferedImage createShadow(final BufferedImage src) {
int shadowSize = blurRadius * 2;
int srcWidth = src.getWidth();
@@ -281,8 +295,7 @@ public class DropShadowDecorator impleme
int a = hSumLookup[aSum];
dstBuffer[dstOffset++] = a << 24;
- // Subtract the oldest pixel from the sum...and nothing new
- // to add!
+ // Subtract the oldest pixel from the sum...and nothing new to
add!
aSum -= aHistory[historyIdx];
if (++historyIdx >= shadowSize) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarSkin.java Fri Apr 2
06:29:30 2021
@@ -27,7 +27,7 @@ import org.apache.pivot.wtk.Component;
public abstract class CalendarSkin extends ContainerSkin implements
CalendarListener,
CalendarSelectionListener {
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
Calendar calendar = (Calendar) component;
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java
URL:
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java?rev=1888287&r1=1888286&r2=1888287&view=diff
==============================================================================
---
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java
(original)
+++
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkinParagraphView.java
Fri Apr 2 06:29:30 2021
@@ -34,14 +34,20 @@ import org.apache.pivot.wtk.Platform;
import org.apache.pivot.wtk.Span;
import org.apache.pivot.wtk.TextArea;
+/**
+ * The view of a {@code TextArea} paragraph, used for layout and drawing.
+ */
class TextAreaSkinParagraphView implements TextArea.ParagraphListener {
+ /**
+ * Variables needed to display one row of text.
+ */
private static class Row {
public final GlyphVector glyphVector;
public final int offset;
- public Row(GlyphVector glyphVector, int offset) {
- this.glyphVector = glyphVector;
- this.offset = offset;
+ Row(final GlyphVector glyphVectorValues, final int offsetValue) {
+ glyphVector = glyphVectorValues;
+ offset = offsetValue;
}
}
@@ -62,7 +68,7 @@ class TextAreaSkinParagraphView implemen
private static final int PARAGRAPH_TERMINATOR_WIDTH = 2;
- public TextAreaSkinParagraphView(TextAreaSkin textAreaSkin,
TextArea.Paragraph paragraph) {
+ TextAreaSkinParagraphView(final TextAreaSkin textAreaSkin,
TextArea.Paragraph paragraph) {
this.textAreaSkin = textAreaSkin;
this.paragraph = paragraph;
}
@@ -75,7 +81,7 @@ class TextAreaSkinParagraphView implemen
return x;
}
- public void setX(int x) {
+ public void setX(final int x) {
this.x = x;
}
@@ -83,7 +89,7 @@ class TextAreaSkinParagraphView implemen
return y;
}
- public void setY(int y) {
+ public void setY(final int y) {
this.y = y;
}
@@ -91,7 +97,7 @@ class TextAreaSkinParagraphView implemen
return rowOffset;
}
- public void setRowOffset(int rowOffset) {
+ public void setRowOffset(final int rowOffset) {
this.rowOffset = rowOffset;
}
@@ -109,7 +115,7 @@ class TextAreaSkinParagraphView implemen
return breakWidth;
}
- public void setBreakWidth(int breakWidth) {
+ public void setBreakWidth(final int breakWidth) {
int previousBreakWidth = this.breakWidth;
if (previousBreakWidth != breakWidth) {
this.breakWidth = breakWidth;
@@ -117,7 +123,7 @@ class TextAreaSkinParagraphView implemen
}
}
- public void paint(Graphics2D graphics) {
+ public void paint(final Graphics2D graphics) {
TextArea textArea = (TextArea) textAreaSkin.getComponent();
int selectionStart = textArea.getSelectionStart();
@@ -156,7 +162,8 @@ class TextAreaSkinParagraphView implemen
}
}
- private void paint(Graphics2D graphics, boolean focused, boolean editable,
boolean selected) {
+ private void paint(final Graphics2D graphics, final boolean focused, final
boolean editable,
+ final boolean selected) {
Font font = textAreaSkin.getFont();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = font.getLineMetrics("", fontRenderContext);
@@ -191,8 +198,7 @@ class TextAreaSkinParagraphView implemen
}
public void validate() {
- // TODO Validate from known invalid offset rather than 0, so we don't
- // need to
+ // TODO Validate from known invalid offset rather than 0, so we don't
need to
// recalculate all glyph vectors
if (!valid) {
rows = new ArrayList<>();
@@ -212,10 +218,8 @@ class TextAreaSkinParagraphView implemen
int lastWhitespaceIndex = -1;
// NOTE We use a character iterator here only because it is the
most
- // efficient way to measure the character bounds (as of Java 6, the
- // version
- // of Font#getStringBounds() that takes a String performs a string
- // copy,
+ // efficient way to measure the character bounds (as of Java 6,
the version
+ // of Font#getStringBounds() that takes a String performs a string
copy,
// whereas the version that takes a character iterator does not)
CharSequenceCharacterIterator ci = new
CharSequenceCharacterIterator(characters);
while (i < n) {
@@ -258,8 +262,8 @@ class TextAreaSkinParagraphView implemen
valid = true;
}
- private void appendLine(CharSequence characters, int start, int end, Font
font,
- FontRenderContext fontRenderContext) {
+ private void appendLine(final CharSequence characters, final int start,
final int end, final Font font,
+ final FontRenderContext fontRenderContext) {
CharSequenceCharacterIterator line = new
CharSequenceCharacterIterator(characters, start,
end, start);
GlyphVector glyphVector = font.createGlyphVector(fontRenderContext,
line);
@@ -270,7 +274,7 @@ class TextAreaSkinParagraphView implemen
height += textBounds.getHeight();
}
- public int getInsertionPoint(int xArgument, int yArgument) {
+ public int getInsertionPoint(final int xArgument, final int yArgument) {
Font font = textAreaSkin.getFont();
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = font.getLineMetrics("", fontRenderContext);
@@ -282,7 +286,8 @@ class TextAreaSkinParagraphView implemen
return (i < 0 || i >= n) ? -1 : getRowInsertionPoint(i, xArgument);
}
- public int getNextInsertionPoint(int xArgument, int from,
TextArea.ScrollDirection direction) {
+ public int getNextInsertionPoint(final int xArgument, final int from,
+ final TextArea.ScrollDirection direction) {
// Identify the row that contains the from index
int n = rows.getLength();
int i;
@@ -328,14 +333,12 @@ class TextAreaSkinParagraphView implemen
Rectangle2D glyphBounds2D = glyphBounds.getBounds2D();
if (glyphBounds2D.contains(xArgument, glyphBounds2D.getY())) {
- // Determine the bias; if the user clicks on the right half
- // of the
+ // Determine the bias; if the user clicks on the right
half of the
// character; select the next character
if (xArgument - glyphBounds2D.getX() >
glyphBounds2D.getWidth() / 2
&& index < n - 1) {
index++;
}
-
break;
}