You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2018/06/05 00:14:11 UTC
svn commit: r1832904 [1/3] - in /pivot/trunk:
core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/util/
tests/src/org/apache/pivot/tests/
wtk-terra/src/org/apache/pivot/wtk/skin/terra/
wtk/src/org/apache/pivot/wtk/ wtk/src/org/apache/pivot/wtk/s...
Author: rwhitcomb
Date: Tue Jun 5 00:14:11 2018
New Revision: 1832904
URL: http://svn.apache.org/viewvc?rev=1832904&view=rev
Log:
PIVOT-1032: Working on the style errors.
Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BeanMonitor.java
pivot/trunk/core/src/org/apache/pivot/util/Time.java
pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest2.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java
pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/TextInput.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MovieViewSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinTextNodeView.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Document.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Element.java
pivot/trunk/wtk/src/org/apache/pivot/wtk/text/TextNode.java
Modified: pivot/trunk/core/src/org/apache/pivot/beans/BeanMonitor.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BeanMonitor.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BeanMonitor.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BeanMonitor.java Tue Jun 5 00:14:11 2018
@@ -36,7 +36,7 @@ import org.apache.pivot.util.Vote;
public class BeanMonitor {
private class BeanInvocationHandler implements InvocationHandler {
@Override
- public Object invoke(Object proxy, Method event, Object[] arguments) throws Throwable {
+ public Object invoke(final Object proxy, final Method event, final Object[] arguments) throws Throwable {
String propertyName;
if ((propertyName = getPropertyChangeName(event.getName())) != null) {
if (notifyingProperties.contains(propertyName)) {
@@ -59,7 +59,7 @@ public class BeanMonitor {
private class PropertyChangeListenerList extends ListenerList<PropertyChangeListener> implements
PropertyChangeListener {
@Override
- public void add(PropertyChangeListener listener) {
+ public void add(final PropertyChangeListener listener) {
if (isEmpty()) {
registerBeanListeners();
}
@@ -68,7 +68,7 @@ public class BeanMonitor {
}
@Override
- public void remove(PropertyChangeListener listener) {
+ public void remove(final PropertyChangeListener listener) {
super.remove(listener);
if (isEmpty()) {
@@ -77,10 +77,8 @@ public class BeanMonitor {
}
@Override
- public void propertyChanged(Object beanArgument, String propertyName) {
- for (PropertyChangeListener listener : this) {
- listener.propertyChanged(beanArgument, propertyName);
- }
+ public void propertyChanged(final Object beanArgument, final String propertyName) {
+ forEach(listener -> listener.propertyChanged(beanArgument, propertyName));
}
}
@@ -95,14 +93,14 @@ public class BeanMonitor {
public static final String LISTENERS_SUFFIX = "Listeners";
public static final String PROPERTY_CHANGE_SUFFIX = "Changed";
- private static String getPropertyChangeName(String name) {
+ private static String getPropertyChangeName(final String name) {
if (name.endsWith(PROPERTY_CHANGE_SUFFIX)) {
return name.substring(0, name.length() - PROPERTY_CHANGE_SUFFIX.length());
}
return null;
}
- public BeanMonitor(Object bean) {
+ public BeanMonitor(final Object bean) {
Utils.checkNull(bean, "bean object");
this.bean = bean;
@@ -119,7 +117,7 @@ public class BeanMonitor {
Type type = typeArguments[0];
Class<?> listenerInterface;
if (type instanceof ParameterizedType) {
- ParameterizedType paramType = (ParameterizedType)type;
+ ParameterizedType paramType = (ParameterizedType) type;
listenerInterface = (Class<?>) paramType.getRawType();
} else {
listenerInterface = (Class<?>) type;
@@ -158,11 +156,11 @@ public class BeanMonitor {
* @return <tt>true</tt> if the property fires change events; <tt>false</tt>
* otherwise.
*/
- public boolean isNotifying(String key) {
+ public boolean isNotifying(final String key) {
return notifyingProperties.contains(key);
}
- private void invoke(String methodName, boolean addProxy) {
+ private void invoke(final String methodName, final boolean addProxy) {
for (Method method : bean.getClass().getMethods()) {
if (ListenerList.class.isAssignableFrom(method.getReturnType())
&& (method.getModifiers() & Modifier.STATIC) == 0) {
@@ -173,7 +171,7 @@ public class BeanMonitor {
Type type = typeArguments[0];
Class<?> listenerInterface;
if (type instanceof ParameterizedType) {
- ParameterizedType paramType = (ParameterizedType)type;
+ ParameterizedType paramType = (ParameterizedType) type;
listenerInterface = (Class<?>) paramType.getRawType();
} else {
listenerInterface = (Class<?>) type;
@@ -193,7 +191,7 @@ public class BeanMonitor {
if (addProxy) {
listener = Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
- new Class<?>[] { listenerInterface }, invocationHandler);
+ new Class<?>[] {listenerInterface}, invocationHandler);
beanListenerProxies.put(listenerInterface, listener);
} else {
throw new IllegalStateException("Listener proxy is null.");
@@ -203,13 +201,13 @@ public class BeanMonitor {
Class<?> listenerListClass = listenerList.getClass();
Method classMethod;
try {
- classMethod = listenerListClass.getMethod(methodName, new Class<?>[] { Object.class });
+ classMethod = listenerListClass.getMethod(methodName, new Class<?>[] {Object.class});
} catch (NoSuchMethodException exception) {
throw new RuntimeException(exception);
}
try {
- classMethod.invoke(listenerList, new Object[] { listener });
+ classMethod.invoke(listenerList, new Object[] {listener});
} catch (IllegalAccessException | InvocationTargetException exception) {
throw new RuntimeException(exception);
}
Modified: pivot/trunk/core/src/org/apache/pivot/util/Time.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Time.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Time.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Time.java Tue Jun 5 00:14:11 2018
@@ -45,32 +45,32 @@ public final class Time implements Compa
public final Time start;
public final Time end;
- public Range(Time time) {
+ public Range(final Time time) {
this(time, time);
}
- public Range(Time start, Time end) {
+ public Range(final Time start, final Time end) {
this.start = start;
this.end = end;
}
- public Range(String time) {
+ public Range(final String time) {
this.start = this.end = Time.decode(time);
}
- public Range(String start, String end) {
+ public Range(final String start, final String end) {
this.start = Time.decode(start);
this.end = Time.decode(end);
}
- public Range(Range range) {
+ public Range(final Range range) {
Utils.checkNull(range, "range");
this.start = range.start;
this.end = range.end;
}
- public Range(Dictionary<String, ?> range) {
+ public Range(final Dictionary<String, ?> range) {
Utils.checkNull(range, "range");
Object startRange = range.get(START_KEY);
@@ -97,7 +97,7 @@ public final class Time implements Compa
}
}
- public Range(Sequence<?> range) {
+ public Range(final Sequence<?> range) {
Utils.checkNull(range, "range");
Object startRange = range.get(0);
@@ -120,22 +120,24 @@ public final class Time implements Compa
return Math.abs(this.start.subtract(this.end)) + 1;
}
- public boolean contains(Range range) {
+ public boolean contains(final Range range) {
Utils.checkNull(range, "range");
Range normalizedRange = range.normalize();
boolean contains;
if (this.start.compareTo(this.end) < 0) {
- contains = (this.start.compareTo(normalizedRange.start) <= 0 && this.end.compareTo(normalizedRange.end) >= 0);
+ contains = (this.start.compareTo(normalizedRange.start) <= 0
+ && this.end.compareTo(normalizedRange.end) >= 0);
} else {
- contains = (this.end.compareTo(normalizedRange.start) <= 0 && this.start.compareTo(normalizedRange.end) >= 0);
+ contains = (this.end.compareTo(normalizedRange.start) <= 0
+ && this.start.compareTo(normalizedRange.end) >= 0);
}
return contains;
}
- public boolean contains(Time time) {
+ public boolean contains(final Time time) {
Utils.checkNull(time, "time");
boolean contains;
@@ -148,16 +150,18 @@ public final class Time implements Compa
return contains;
}
- public boolean intersects(Range range) {
+ public boolean intersects(final Range range) {
Utils.checkNull(range, "range");
Range normalizedRange = range.normalize();
boolean intersects;
if (this.start.compareTo(this.end) < 0) {
- intersects = (this.start.compareTo(normalizedRange.end) <= 0 && this.end.compareTo(normalizedRange.start) >= 0);
+ intersects = (this.start.compareTo(normalizedRange.end) <= 0
+ && this.end.compareTo(normalizedRange.start) >= 0);
} else {
- intersects = (this.end.compareTo(normalizedRange.end) <= 0 && this.start.compareTo(normalizedRange.start) >= 0);
+ intersects = (this.end.compareTo(normalizedRange.end) <= 0
+ && this.start.compareTo(normalizedRange.start) >= 0);
}
return intersects;
@@ -170,11 +174,10 @@ public final class Time implements Compa
}
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
if (o != null && o instanceof Range) {
- Range r = (Range)o;
- return r.start.equals(this.start) &&
- r.end.equals(this.end);
+ Range r = (Range) o;
+ return r.start.equals(this.start) && r.end.equals(this.end);
}
return false;
}
@@ -185,7 +188,7 @@ public final class Time implements Compa
return start.hashCode() * end.hashCode();
}
- public static Range decode(String value) {
+ public static Range decode(final String value) {
Utils.checkNull(value, "value");
Range range;
@@ -249,7 +252,7 @@ public final class Time implements Compa
this(new GregorianCalendar());
}
- public Time(Calendar calendar) {
+ public Time(final Calendar calendar) {
Utils.checkNull(calendar, "calendar");
this.hour = calendar.get(Calendar.HOUR_OF_DAY);
@@ -258,17 +261,17 @@ public final class Time implements Compa
this.millisecond = calendar.get(Calendar.MILLISECOND);
}
- public Time(int hour, int minute, int second) {
+ public Time(final int hour, final int minute, final int second) {
this(hour, minute, second, 0);
}
- private void check(int value, int limit, String part) {
+ private void check(final int value, final int limit, final String part) {
if (value < 0 || value > limit) {
throw new IllegalArgumentException("Invalid " + part + ".");
}
}
- public Time(int hour, int minute, int second, int millisecond) {
+ public Time(final int hour, final int minute, final int second, final int millisecond) {
check(hour, 23, "hour");
check(minute, 59, "minute");
check(second, 59, "second");
@@ -280,7 +283,7 @@ public final class Time implements Compa
this.millisecond = millisecond;
}
- public Time(int milliseconds) {
+ public Time(final int milliseconds) {
int msec = milliseconds;
msec %= MILLISECONDS_PER_DAY;
@@ -305,7 +308,7 @@ public final class Time implements Compa
* @param localTime The local time to convert.
* @see #NANOS_PER_MILLI
*/
- public Time(LocalTime localTime) {
+ public Time(final LocalTime localTime) {
this(localTime.getHour(),
localTime.getMinute(),
localTime.getSecond(),
@@ -320,7 +323,7 @@ public final class Time implements Compa
* @param milliseconds The number of milliseconds to add to this time.
* @return The resulting time.
*/
- public Time add(int milliseconds) {
+ public Time add(final int milliseconds) {
return new Time(toMilliseconds() + milliseconds);
}
@@ -334,7 +337,7 @@ public final class Time implements Compa
* @param time The time to subtract from this time.
* @return The number of milliseconds in between this time and <tt>time</tt>.
*/
- public int subtract(Time time) {
+ public int subtract(final Time time) {
Utils.checkNull(time, "time");
return toMilliseconds() - time.toMilliseconds();
@@ -356,7 +359,7 @@ public final class Time implements Compa
}
@Override
- public int compareTo(Time time) {
+ public int compareTo(final Time time) {
int result = this.hour - time.hour;
if (result == 0) {
@@ -375,9 +378,12 @@ public final class Time implements Compa
}
@Override
- public boolean equals(Object o) {
- return (o instanceof Time && ((Time) o).hour == this.hour
- && ((Time) o).minute == this.minute && ((Time) o).second == this.second && ((Time) o).millisecond == this.millisecond);
+ public boolean equals(final Object o) {
+ return (o instanceof Time
+ && ((Time) o).hour == this.hour
+ && ((Time) o).minute == this.minute
+ && ((Time) o).second == this.second
+ && ((Time) o).millisecond == this.millisecond);
}
@Override
@@ -425,7 +431,7 @@ public final class Time implements Compa
* <tt>[hh]:[mm]:[ss].[nnn]</tt> (e.g. 17:19:20 or 17:19:20.412).
* @return The {@code Time} value corresponding to the input string.
*/
- public static Time decode(String value) {
+ public static Time decode(final String value) {
Matcher matcher = PATTERN.matcher(value);
if (!matcher.matches()) {
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest2.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest2.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest2.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/HyperlinkButtonTest2.java Tue Jun 5 00:14:11 2018
@@ -29,28 +29,28 @@ public class HyperlinkButtonTest2 implem
private Frame frame = null;
private static final String BXML_FILE =
- "<Frame title=\"Hyperlink Button Test 2\"" +
- " xmlns:bxml=\"http://pivot.apache.org/bxml\"" +
- " xmlns:content=\"org.apache.pivot.wtk.content\"" +
- " xmlns=\"org.apache.pivot.wtk\">" +
- " <BoxPane orientation=\"vertical\">" +
- " <HyperlinkButton url=\"http://commons.apache.org\"/>" +
- " <HyperlinkButton url=\"http://apache.org\">" +
- " <content:ButtonData text=\"ASF website\" icon=\"/org/apache/pivot/tests/house.png\"/>" +
- " </HyperlinkButton>" +
- " </BoxPane>" +
- "</Frame>";
+ "<Frame title=\"Hyperlink Button Test 2\""
+ + " xmlns:bxml=\"http://pivot.apache.org/bxml\""
+ + " xmlns:content=\"org.apache.pivot.wtk.content\""
+ + " xmlns=\"org.apache.pivot.wtk\">"
+ + " <BoxPane orientation=\"vertical\">"
+ + " <HyperlinkButton url=\"http://commons.apache.org\"/>"
+ + " <HyperlinkButton url=\"http://apache.org\">"
+ + " <content:ButtonData text=\"ASF website\" icon=\"/org/apache/pivot/tests/house.png\"/>"
+ + " </HyperlinkButton>"
+ + " </BoxPane>"
+ + "</Frame>";
@Override
- public void startup(Display display, Map<String, String> properties) throws Exception {
+ public void startup(final Display display, final Map<String, String> properties) throws Exception {
BXMLSerializer serializer = new BXMLSerializer();
- frame = (Frame)serializer.readObject(new ByteArrayInputStream(BXML_FILE.getBytes()));
+ frame = (Frame) serializer.readObject(new ByteArrayInputStream(BXML_FILE.getBytes()));
frame.open(display);
}
@Override
- public boolean shutdown(boolean optional) {
+ public boolean shutdown(final boolean optional) {
if (frame != null) {
frame.close();
}
@@ -58,7 +58,7 @@ public class HyperlinkButtonTest2 implem
return false;
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
DesktopApplicationContext.main(HyperlinkButtonTest2.class, args);
}
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraGaugeSkin.java Tue Jun 5 00:14:11 2018
@@ -45,6 +45,8 @@ import org.apache.pivot.wtk.skin.Compone
* Skin class for the {@link Gauge} component, which draws a circular gauge with possible text
* in the center.
* <p> The gauge colors, as well as colors for the warning and/or critical colors can be set.
+ *
+ * @param <T> The numeric type for the gauge value.
*/
public class TerraGaugeSkin<T extends Number> extends ComponentSkin implements GaugeListener<T> {
private static final float STROKE_WIDTH = 6.0f;
@@ -90,7 +92,7 @@ public class TerraGaugeSkin<T extends Nu
}
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
@SuppressWarnings("unchecked")
@@ -102,7 +104,7 @@ public class TerraGaugeSkin<T extends Nu
* This is a "display-only" component, so as such will not accept focus.
*/
@Override
- public boolean isFocusable() {
+ public final boolean isFocusable() {
return false;
}
@@ -112,21 +114,29 @@ public class TerraGaugeSkin<T extends Nu
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
return 128; // Note: same as TerraActivityIndicatorSkin
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
return 128; // Note: same as TerraActivityIndicatorSkin
}
/**
* Do the transformation of the arcs to the normal cartesian coordinates, and for the specified origin,
* then draw the arc in the given color. Assumes the rendering hints and the stroke have already been set.
- * <p> Start and extent are in the 0-360 range
+ * <p> Start and extent are in the 0-360 range.
+ *
+ * @param graphics Where to draw the arc.
+ * @param rect The enclosing rectangle for the arc.
+ * @param origin Which of the compass points to use for the start of the arc.
+ * @param arcStart The starting angle from the origin for the arc.
+ * @param arcExtent The angular extent of the arc (from the start).
+ * @param color The color to use for this arc.
*/
- private void drawArc(Graphics2D graphics, Rectangle2D rect, Origin origin, float arcStart, float arcExtent, Color color) {
+ private void drawArc(final Graphics2D graphics, final Rectangle2D rect, final Origin origin,
+ final float arcStart, final float arcExtent, final Color color) {
float newStart = origin.getOriginAngle() - arcStart - arcExtent;
Arc2D arc = new Arc2D.Float(rect, newStart, arcExtent, Arc2D.OPEN);
graphics.setPaint(color);
@@ -134,7 +144,7 @@ public class TerraGaugeSkin<T extends Nu
}
@Override
- public void paint(Graphics2D graphics) {
+ public void paint(final Graphics2D graphics) {
@SuppressWarnings("unchecked")
Gauge<T> gauge = (Gauge<T>)getComponent();
// NOTE: sanity check: warning level > min && < max, warning < critical if both set
@@ -155,10 +165,10 @@ public class TerraGaugeSkin<T extends Nu
// And only account for the border thickness (the outer part) if > 1.0
boolean showingBorder = showBorder && borderColor != null;
float borderAdjust = (showingBorder ? (borderThickness > 1.0f ? borderThickness : 0.0f) : 0.0f);
- float diameter = (float)(Math.min(size.width - padding.getWidth(), size.height - padding.getHeight()))
+ float diameter = (float) (Math.min(size.width - padding.getWidth(), size.height - padding.getHeight()))
- thickness - (borderAdjust * 2.0f);
- float x = ((float)size.width - diameter) / 2.0f;
- float y = ((float)size.height - diameter) / 2.0f;
+ float x = ((float) size.width - diameter) / 2.0f;
+ float y = ((float) size.height - diameter) / 2.0f;
Rectangle2D rect = new Rectangle2D.Float(x, y, diameter, diameter);
@@ -189,7 +199,10 @@ public class TerraGaugeSkin<T extends Nu
if (onlyMaxColor) {
maxColor = criticalColor;
} else {
- // Three segments here: min->warning (normal color), warning->critical (warning color), critical->active (critical color)
+ // Three segments here:
+ // min->warning (normal color),
+ // warning->critical (warning color),
+ // critical->active (critical color)
float criticalAngle = criticalValue * toAngle;
drawArc(graphics, rect, origin, 0.0f, warningAngle, color);
drawArc(graphics, rect, origin, warningAngle, criticalAngle - warningAngle, warningColor);
@@ -254,8 +267,10 @@ public class TerraGaugeSkin<T extends Nu
float border = borderThickness > 1.0f ? borderThickness : 0.0f;
float halfStroke = (thickness + border) / 2.0f;
float thicknessAdjust = thickness + border;
- Rectangle2D rectOuter = new Rectangle2D.Float(x - halfStroke, y - halfStroke, diameter + thicknessAdjust, diameter + thicknessAdjust);
- Rectangle2D rectInner = new Rectangle2D.Float(x + halfStroke, y + halfStroke, diameter - thicknessAdjust, diameter - thicknessAdjust);
+ Rectangle2D rectOuter = new Rectangle2D.Float(x - halfStroke, y - halfStroke,
+ diameter + thicknessAdjust, diameter + thicknessAdjust);
+ Rectangle2D rectInner = new Rectangle2D.Float(x + halfStroke, y + halfStroke,
+ diameter - thicknessAdjust, diameter - thicknessAdjust);
drawArc(graphics, rectInner, origin, 360.0f, 360.0f, borderColor);
drawArc(graphics, rectOuter, origin, 360.0f, 360.0f, borderColor);
}
@@ -264,7 +279,7 @@ public class TerraGaugeSkin<T extends Nu
if (showTickMarks && tickFrequency != null && tickColor != null) {
// frequency is how many gauge values between marks
float frequency = tickFrequency.floatValue();
- int numMarks = (int)Math.floor(fullRange / frequency);
+ int numMarks = (int) Math.floor(fullRange / frequency);
graphics.setColor(tickColor == null ? backgroundColor : tickColor);
// Note: VALUE_STROKE_PURE tends to make the arcs fine but the lines non-uniform,
// while VALUE_STROKE_NORMALIZE works well for the lines but makes the arcs "wobble" around a bit
@@ -278,16 +293,22 @@ public class TerraGaugeSkin<T extends Nu
// Draw the "0" mark at the origin
switch (origin) {
case NORTH:
- graphics.drawLine((int)xCenter, (int)(yCenter - innerRadius), (int)xCenter, (int)(yCenter - outerRadius));
+ graphics.drawLine((int) xCenter, (int) (yCenter - innerRadius),
+ (int) xCenter, (int) (yCenter - outerRadius));
break;
case EAST:
- graphics.drawLine((int)(xCenter + innerRadius), (int)yCenter, (int)(xCenter + outerRadius), (int)yCenter);
+ graphics.drawLine((int) (xCenter + innerRadius), (int) yCenter,
+ (int) (xCenter + outerRadius), (int) yCenter);
break;
case SOUTH:
- graphics.drawLine((int)xCenter, (int)(yCenter + innerRadius), (int)xCenter, (int)(yCenter + outerRadius));
+ graphics.drawLine((int) xCenter, (int) (yCenter + innerRadius),
+ (int) xCenter, (int) (yCenter + outerRadius));
break;
case WEST:
- graphics.drawLine((int)(xCenter - innerRadius), (int)yCenter, (int)(xCenter - outerRadius), (int)yCenter);
+ graphics.drawLine((int) (xCenter - innerRadius), (int) yCenter,
+ (int) (xCenter - outerRadius), (int) yCenter);
+ break;
+ default:
break;
}
// Draw clockwise from the origin, subtracting the frequency each time
@@ -295,12 +316,12 @@ public class TerraGaugeSkin<T extends Nu
double frequencyAngleRadians = frequency / fullRange * Math.PI * 2.0;
double angleRadians = startAngleRadians - frequencyAngleRadians;
for (int i = 0; i < numMarks; i++) {
- float cosAngle = (float)Math.cos(angleRadians);
- float sinAngle = (float)Math.sin(angleRadians);
- int xInner = (int)(xCenter + (innerRadius * cosAngle) + 0.5f);
- int yInner = (int)(yCenter + (innerRadius * sinAngle) + 0.5f);
- int xOuter = (int)(xCenter + (outerRadius * cosAngle) + 0.5f);
- int yOuter = (int)(yCenter + (outerRadius * sinAngle) + 0.5f);
+ float cosAngle = (float) Math.cos(angleRadians);
+ float sinAngle = (float) Math.sin(angleRadians);
+ int xInner = (int) (xCenter + (innerRadius * cosAngle) + 0.5f);
+ int yInner = (int) (yCenter + (innerRadius * sinAngle) + 0.5f);
+ int xOuter = (int) (xCenter + (outerRadius * cosAngle) + 0.5f);
+ int yOuter = (int) (yCenter + (outerRadius * sinAngle) + 0.5f);
graphics.drawLine(xInner, yInner, xOuter, yOuter);
angleRadians -= frequencyAngleRadians;
}
@@ -321,102 +342,102 @@ public class TerraGaugeSkin<T extends Nu
}
}
- public Font getFont() {
+ public final Font getFont() {
return font;
}
- public void setFont(Font font) {
+ public final void setFont(final Font font) {
Utils.checkNull(font, "font");
this.font = font;
repaintComponent();
}
- public final void setFont(String font) {
+ public final void setFont(final String font) {
setFont(decodeFont(font));
}
- public final void setFont(Dictionary<String, ?> font) {
+ public final void setFont(final Dictionary<String, ?> font) {
setFont(Theme.deriveFont(font));
}
- public Color getBackgroundColor() {
+ public final Color getBackgroundColor() {
return backgroundColor;
}
- public final void setBackgroundColor(Color backgroundColor) {
+ public final void setBackgroundColor(final Color backgroundColor) {
// We allow a null background color here
this.backgroundColor = backgroundColor;
repaintComponent();
}
- public final void setBackgroundColor(String backgroundColor) {
+ public final void setBackgroundColor(final String backgroundColor) {
setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, "backgroundColor"));
}
- public final void setBackgroundColor(int backgroundColor) {
+ public final void setBackgroundColor(final int backgroundColor) {
Theme theme = currentTheme();
setBackgroundColor(theme.getColor(backgroundColor));
}
- public Color getColor() {
+ public final Color getColor() {
return color;
}
- public final void setColor(Color color) {
+ public final void setColor(final Color color) {
Utils.checkNull(color, "color");
this.color = color;
repaintComponent();
}
- public final void setColor(String color) {
+ public final void setColor(final String color) {
setColor(GraphicsUtilities.decodeColor(color, "color"));
}
- public final void setColor(int color) {
+ public final void setColor(final int color) {
Theme theme = currentTheme();
setColor(theme.getColor(color));
}
- public Color getGaugeColor() {
+ public final Color getGaugeColor() {
return gaugeColor;
}
- public final void setGaugeColor(Color gaugeColor) {
+ public final void setGaugeColor(final Color gaugeColor) {
Utils.checkNull(gaugeColor, "gaugeColor");
this.gaugeColor = gaugeColor;
repaintComponent();
}
- public final void setGaugeColor(String gaugeColor) {
+ public final void setGaugeColor(final String gaugeColor) {
setGaugeColor(GraphicsUtilities.decodeColor(gaugeColor, "gaugeColor"));
}
- public final void setGaugeColor(int gaugeColor) {
+ public final void setGaugeColor(final int gaugeColor) {
Theme theme = currentTheme();
setGaugeColor(theme.getColor(gaugeColor));
}
- public Color getTextColor() {
+ public final Color getTextColor() {
return textColor;
}
- public final void setTextColor(Color textColor) {
+ public final void setTextColor(final Color textColor) {
Utils.checkNull(textColor, "textColor");
this.textColor = textColor;
repaintComponent();
}
- public final void setTextColor(String textColor) {
+ public final void setTextColor(final String textColor) {
setTextColor(GraphicsUtilities.decodeColor(textColor, "textColor"));
}
- public final void setTextColor(int textColor) {
+ public final void setTextColor(final int textColor) {
Theme theme = currentTheme();
setTextColor(theme.getColor(textColor));
}
- public Color getTickColor() {
+ public final Color getTickColor() {
return tickColor;
}
@@ -425,22 +446,22 @@ public class TerraGaugeSkin<T extends Nu
* <p> Note: to disable tick drawing, use a style of "showTickMarks:false".
* @param tickColor Any color value, or {@code null} to use the background color.
*/
- public final void setTickColor(Color tickColor) {
+ public final void setTickColor(final Color tickColor) {
// Tick color can be null to use the background color.
this.tickColor = tickColor;
repaintComponent();
}
- public final void setTickColor(String tickColor) {
+ public final void setTickColor(final String tickColor) {
setTickColor(GraphicsUtilities.decodeColor(tickColor, "tickColor"));
}
- public final void setTickColor(int tickColor) {
+ public final void setTickColor(final int tickColor) {
Theme theme = currentTheme();
setTickColor(theme.getColor(tickColor));
}
- public Color getBorderColor() {
+ public final Color getBorderColor() {
return borderColor;
}
@@ -450,22 +471,22 @@ public class TerraGaugeSkin<T extends Nu
* or set this color to null.
* @param borderColor Any color value, or {@code null} to disable border drawing.
*/
- public final void setBorderColor(Color borderColor) {
+ public final void setBorderColor(final Color borderColor) {
// Border color can be null to not draw the border.
this.borderColor = borderColor;
repaintComponent();
}
- public final void setBorderColor(String borderColor) {
+ public final void setBorderColor(final String borderColor) {
setBorderColor(GraphicsUtilities.decodeColor(borderColor, "borderColor"));
}
- public final void setBorderColor(int borderColor) {
+ public final void setBorderColor(final int borderColor) {
Theme theme = currentTheme();
setBorderColor(theme.getColor(borderColor));
}
- public Color getWarningColor() {
+ public final Color getWarningColor() {
return this.warningColor;
}
@@ -478,22 +499,21 @@ public class TerraGaugeSkin<T extends Nu
* @param warningColor A color for the warning levels, or {@code null} to disable
* the warning level checks.
*/
- public final void setWarningColor(Color warningColor) {
- // Note: null is okay here to effectively disable using the warning color logic
+ public final void setWarningColor(final Color warningColor) {
this.warningColor = warningColor;
repaintComponent();
}
- public final void setWarningColor(String warningColor) {
+ public final void setWarningColor(final String warningColor) {
setWarningColor(GraphicsUtilities.decodeColor(warningColor, "warningColor"));
}
- public final void setWarningColor(int warningColor) {
+ public final void setWarningColor(final int warningColor) {
Theme theme = currentTheme();
setWarningColor(theme.getColor(warningColor));
}
- public Color getCriticalColor() {
+ public final Color getCriticalColor() {
return this.criticalColor;
}
@@ -506,25 +526,24 @@ public class TerraGaugeSkin<T extends Nu
* @param criticalColor A color for the critical levels, or {@code null} to disable
* the critical level checks.
*/
- public final void setCriticalColor(Color criticalColor) {
- // Note: null is okay here to disable using the critical color logic
+ public final void setCriticalColor(final Color criticalColor) {
this.criticalColor = criticalColor;
}
- public final void setCriticalColor(String criticalColor) {
+ public final void setCriticalColor(final String criticalColor) {
setCriticalColor(GraphicsUtilities.decodeColor(criticalColor, "criticalColor"));
}
- public final void setCriticalColor(int criticalColor) {
+ public final void setCriticalColor(final int criticalColor) {
Theme theme = currentTheme();
setCriticalColor(theme.getColor(criticalColor));
}
- public Insets getPadding() {
+ public final Insets getPadding() {
return padding;
}
- public void setPadding(Insets padding) {
+ public final void setPadding(final Insets padding) {
Utils.checkNull(padding, "padding");
this.padding = padding;
@@ -537,7 +556,7 @@ public class TerraGaugeSkin<T extends Nu
*
* @param padding A dictionary containing the keys {top ,left, bottom, and/or right}.
*/
- public final void setPadding(Dictionary<String, ?> padding) {
+ public final void setPadding(final Dictionary<String, ?> padding) {
setPadding(new Insets(padding));
}
@@ -547,7 +566,7 @@ public class TerraGaugeSkin<T extends Nu
*
* @param padding A sequence containing the values [top left, bottom, right].
*/
- public final void setPadding(Sequence<?> padding) {
+ public final void setPadding(final Sequence<?> padding) {
setPadding(new Insets(padding));
}
@@ -557,7 +576,7 @@ public class TerraGaugeSkin<T extends Nu
*
* @param padding A single value to use for the padding on all sides.
*/
- public final void setPadding(int padding) {
+ public final void setPadding(final int padding) {
setPadding(new Insets(padding));
}
@@ -567,7 +586,7 @@ public class TerraGaugeSkin<T extends Nu
*
* @param padding A single value to use for the padding on all sides.
*/
- public void setPadding(Number padding) {
+ public final void setPadding(final Number padding) {
setPadding(new Insets(padding));
}
@@ -578,11 +597,11 @@ public class TerraGaugeSkin<T extends Nu
* @param padding A string containing an integer or a JSON map or list with
* keys/values top, left, bottom, and/or right.
*/
- public final void setPadding(String padding) {
+ public final void setPadding(final String padding) {
setPadding(Insets.decode(padding));
}
- public float getThickness() {
+ public final float getThickness() {
return thickness;
}
@@ -591,52 +610,52 @@ public class TerraGaugeSkin<T extends Nu
* @param thickness The new value (default is {@link #STROKE_WIDTH}).
* @throws IllegalArgumentException if the value is 0.0 or less.
*/
- public final void setThickness(float thickness) {
+ public final void setThickness(final float thickness) {
Utils.checkPositive(thickness, "thickness");
this.thickness = thickness;
repaintComponent();
}
- public final void setThickness(Number thickness) {
+ public final void setThickness(final Number thickness) {
Utils.checkNull(thickness, "thickness");
setThickness(thickness.floatValue());
}
- public final void setThickness(String thickness) {
+ public final void setThickness(final String thickness) {
Utils.checkNullOrEmpty(thickness, "thickness");
setThickness(StringUtils.toNumber(thickness, Float.class));
}
- public boolean getShowTickMarks() {
+ public final boolean getShowTickMarks() {
return showTickMarks;
}
- public final void setShowTickMarks(boolean showTickMarks) {
+ public final void setShowTickMarks(final boolean showTickMarks) {
this.showTickMarks = showTickMarks;
repaintComponent();
}
- public T getTickFrequency() {
+ public final T getTickFrequency() {
return tickFrequency;
}
- public final void setTickFrequency(T frequency) {
+ public final void setTickFrequency(final T frequency) {
Utils.checkNull(frequency, "frequency");
this.tickFrequency = frequency;
repaintComponent();
}
- public boolean getShowBorder() {
+ public final boolean getShowBorder() {
return showBorder;
}
- public final void setShowBorder(boolean showBorder) {
+ public final void setShowBorder(final boolean showBorder) {
this.showBorder = showBorder;
repaintComponent();
}
- public float getBorderThickness() {
+ public final float getBorderThickness() {
return borderThickness;
}
@@ -645,24 +664,24 @@ public class TerraGaugeSkin<T extends Nu
* @param borderThickness The new value (default is 1.0f).
* @throws IllegalArgumentException if the value is 0.0 or less.
*/
- public final void setBorderThickness(float borderThickness) {
+ public final void setBorderThickness(final float borderThickness) {
Utils.checkPositive(borderThickness, "borderThickness");
this.borderThickness = borderThickness;
invalidateComponent();
}
- public final void setBorderThickness(Number borderThickness) {
+ public final void setBorderThickness(final Number borderThickness) {
Utils.checkNull(borderThickness, "borderThickness");
setBorderThickness(borderThickness.floatValue());
}
- public final void setBorderThickness(String borderThickness) {
+ public final void setBorderThickness(final String borderThickness) {
Utils.checkNullOrEmpty(borderThickness, "borderThickness");
setBorderThickness(StringUtils.toNumber(borderThickness, Float.class));
}
- public boolean getOnlyMaxColor() {
+ public final boolean getOnlyMaxColor() {
return onlyMaxColor;
}
@@ -673,43 +692,43 @@ public class TerraGaugeSkin<T extends Nu
* and the warning or critical levels (again if set), <tt>false</tt> to
* show multiple segments.
*/
- public final void setOnlyMaxColor(boolean onlyMaxColor) {
+ public final void setOnlyMaxColor(final boolean onlyMaxColor) {
this.onlyMaxColor = onlyMaxColor;
repaintComponent();
}
@Override
- public void originChanged(Gauge<T> gauge, Origin previousOrigin) {
+ public void originChanged(final Gauge<T> gauge, final Origin previousOrigin) {
invalidateComponent();
}
@Override
- public void valueChanged(Gauge<T> gauge, T previousValue) {
+ public void valueChanged(final Gauge<T> gauge, final T previousValue) {
repaintComponent();
}
@Override
- public void textChanged(Gauge<T> gauge, String previousText) {
+ public void textChanged(final Gauge<T> gauge, final String previousText) {
repaintComponent();
}
@Override
- public void minValueChanged(Gauge<T> gauge, T previousMinValue) {
+ public void minValueChanged(final Gauge<T> gauge, final T previousMinValue) {
repaintComponent();
}
@Override
- public void maxValueChanged(Gauge<T> gauge, T previousMaxValue) {
+ public void maxValueChanged(final Gauge<T> gauge, final T previousMaxValue) {
repaintComponent();
}
@Override
- public void warningLevelChanged(Gauge<T> gauge, T previousWarningLevel) {
+ public void warningLevelChanged(final Gauge<T> gauge, final T previousWarningLevel) {
repaintComponent();
}
@Override
- public void criticalLevelChanged(Gauge<T> gauge, T previousCriticalLevel) {
+ public void criticalLevelChanged(final Gauge<T> gauge, final T previousCriticalLevel) {
repaintComponent();
}
}
Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java Tue Jun 5 00:14:11 2018
@@ -101,7 +101,7 @@ public class TerraListViewSkin extends C
}
@Override
- public void install(Component component) {
+ public void install(final Component component) {
super.install(component);
ListView listView = (ListView) component;
@@ -112,7 +112,7 @@ public class TerraListViewSkin extends C
}
@Override
- public int getPreferredWidth(int height) {
+ public int getPreferredWidth(final int height) {
int preferredWidth = 0;
ListView listView = (ListView) getComponent();
@@ -135,7 +135,7 @@ public class TerraListViewSkin extends C
}
@Override
- public int getPreferredHeight(int width) {
+ public int getPreferredHeight(final int width) {
int preferredHeight = 0;
ListView listView = (ListView) getComponent();
@@ -171,7 +171,7 @@ public class TerraListViewSkin extends C
}
@Override
- public int getBaseline(int width, int height) {
+ public int getBaseline(final int width, final int height) {
ListView listView = (ListView) getComponent();
int baseline = -1;
@@ -288,7 +288,7 @@ public class TerraListViewSkin extends C
}
@Override
- public void paint(Graphics2D graphics) {
+ public void paint(final Graphics2D graphics) {
ListView listView = (ListView) getComponent();
@SuppressWarnings("unchecked")
List<Object> listData = (List<Object>) listView.getListData();
@@ -412,7 +412,7 @@ public class TerraListViewSkin extends C
// List view skin methods
@Override
- public int getItemAt(int y) {
+ public int getItemAt(final int y) {
Utils.checkNonNegative(y, "y");
ListView listView = (ListView) getComponent();
@@ -441,7 +441,7 @@ public class TerraListViewSkin extends C
}
@Override
- public Bounds getItemBounds(int index) {
+ public Bounds getItemBounds(final int index) {
return new Bounds(0, getItemY(index), getWidth(), getItemHeight(index));
}
@@ -457,7 +457,7 @@ public class TerraListViewSkin extends C
return itemIndent;
}
- private int getItemY(int index) {
+ private int getItemY(final int index) {
int itemY;
if (variableItemHeight) {
@@ -473,7 +473,7 @@ public class TerraListViewSkin extends C
return itemY;
}
- private int getItemHeight(int index) {
+ private int getItemHeight(final int index) {
int itemHeight;
if (variableItemHeight) {
@@ -490,274 +490,274 @@ public class TerraListViewSkin extends C
}
@Override
- public boolean isFocusable() {
+ public final boolean isFocusable() {
ListView listView = (ListView) getComponent();
return (listView.getSelectMode() != SelectMode.NONE);
}
@Override
- public boolean isOpaque() {
+ public final boolean isOpaque() {
return (backgroundColor != null && backgroundColor.getTransparency() == Transparency.OPAQUE);
}
- public Font getFont() {
+ public final Font getFont() {
return font;
}
- public void setFont(Font font) {
+ public final void setFont(final Font font) {
Utils.checkNull(font, "font");
this.font = font;
invalidateComponent();
}
- public final void setFont(String font) {
+ public final void setFont(final String font) {
setFont(decodeFont(font));
}
- public final void setFont(Dictionary<String, ?> font) {
+ public final void setFont(final Dictionary<String, ?> font) {
setFont(Theme.deriveFont(font));
}
- public Color getColor() {
+ public final Color getColor() {
return color;
}
- public void setColor(Color color) {
+ public final void setColor(final Color color) {
Utils.checkNull(color, "color");
this.color = color;
repaintComponent();
}
- public final void setColor(String color) {
+ public final void setColor(final String color) {
setColor(GraphicsUtilities.decodeColor(color, "color"));
}
- public final void setColor(int color) {
+ public final void setColor(final int color) {
Theme theme = currentTheme();
setColor(theme.getColor(color));
}
- public Color getDisabledColor() {
+ public final Color getDisabledColor() {
return disabledColor;
}
- public void setDisabledColor(Color disabledColor) {
+ public final void setDisabledColor(final Color disabledColor) {
Utils.checkNull(disabledColor, "disabledColor");
this.disabledColor = disabledColor;
repaintComponent();
}
- public final void setDisabledColor(String disabledColor) {
+ public final void setDisabledColor(final String disabledColor) {
setDisabledColor(GraphicsUtilities.decodeColor(disabledColor, "disabledColor"));
}
- public final void setDisabledColor(int disabledColor) {
+ public final void setDisabledColor(final int disabledColor) {
Theme theme = currentTheme();
setDisabledColor(theme.getColor(disabledColor));
}
- public Color getBackgroundColor() {
+ public final Color getBackgroundColor() {
return backgroundColor;
}
- public void setBackgroundColor(Color backgroundColor) {
+ public final void setBackgroundColor(final Color backgroundColor) {
// We allow a null background color here
this.backgroundColor = backgroundColor;
repaintComponent();
}
- public final void setBackgroundColor(String backgroundColor) {
+ public final void setBackgroundColor(final String backgroundColor) {
setBackgroundColor(GraphicsUtilities.decodeColor(backgroundColor, "backgroundColor"));
}
- public final void setBackgroundColor(int backgroundColor) {
+ public final void setBackgroundColor(final int backgroundColor) {
Theme theme = currentTheme();
setBackgroundColor(theme.getColor(backgroundColor));
}
- public Color getSelectionColor() {
+ public final Color getSelectionColor() {
return selectionColor;
}
- public void setSelectionColor(Color selectionColor) {
+ public final void setSelectionColor(final Color selectionColor) {
Utils.checkNull(selectionColor, "selectionColor");
this.selectionColor = selectionColor;
repaintComponent();
}
- public final void setSelectionColor(String selectionColor) {
+ public final void setSelectionColor(final String selectionColor) {
setSelectionColor(GraphicsUtilities.decodeColor(selectionColor, "selectionColor"));
}
- public final void setSelectionColor(int selectionColor) {
+ public final void setSelectionColor(final int selectionColor) {
Theme theme = currentTheme();
setSelectionColor(theme.getColor(selectionColor));
}
- public Color getSelectionBackgroundColor() {
+ public final Color getSelectionBackgroundColor() {
return selectionBackgroundColor;
}
- public void setSelectionBackgroundColor(Color selectionBackgroundColor) {
+ public final void setSelectionBackgroundColor(final Color selectionBackgroundColor) {
Utils.checkNull(selectionBackgroundColor, "selectionBackgroundColor");
this.selectionBackgroundColor = selectionBackgroundColor;
repaintComponent();
}
- public final void setSelectionBackgroundColor(String selectionBackgroundColor) {
+ public final void setSelectionBackgroundColor(final String selectionBackgroundColor) {
setSelectionBackgroundColor(GraphicsUtilities.decodeColor(selectionBackgroundColor,
"selectionBackgroundColor"));
}
- public final void setSelectionBackgroundColor(int selectionBackgroundColor) {
+ public final void setSelectionBackgroundColor(final int selectionBackgroundColor) {
Theme theme = currentTheme();
setSelectionBackgroundColor(theme.getColor(selectionBackgroundColor));
}
- public Color getInactiveSelectionColor() {
+ public final Color getInactiveSelectionColor() {
return inactiveSelectionColor;
}
- public void setInactiveSelectionColor(Color inactiveSelectionColor) {
+ public final void setInactiveSelectionColor(final Color inactiveSelectionColor) {
Utils.checkNull(inactiveSelectionColor, "inactiveSelectionColor");
this.inactiveSelectionColor = inactiveSelectionColor;
repaintComponent();
}
- public final void setInactiveSelectionColor(String inactiveSelectionColor) {
+ public final void setInactiveSelectionColor(final String inactiveSelectionColor) {
setInactiveSelectionColor(GraphicsUtilities.decodeColor(inactiveSelectionColor,
"inactiveSelectionColor"));
}
- public final void setInactiveSelectionColor(int inactiveSelectionColor) {
+ public final void setInactiveSelectionColor(final int inactiveSelectionColor) {
Theme theme = currentTheme();
setInactiveSelectionColor(theme.getColor(inactiveSelectionColor));
}
- public Color getInactiveSelectionBackgroundColor() {
+ public final Color getInactiveSelectionBackgroundColor() {
return inactiveSelectionBackgroundColor;
}
- public void setInactiveSelectionBackgroundColor(Color inactiveSelectionBackgroundColor) {
+ public final void setInactiveSelectionBackgroundColor(final Color inactiveSelectionBackgroundColor) {
Utils.checkNull(inactiveSelectionBackgroundColor, "inactiveSelectionBackgroundColor");
this.inactiveSelectionBackgroundColor = inactiveSelectionBackgroundColor;
repaintComponent();
}
- public final void setInactiveSelectionBackgroundColor(String inactiveSelectionBackgroundColor) {
+ public final void setInactiveSelectionBackgroundColor(final String inactiveSelectionBackgroundColor) {
setInactiveSelectionBackgroundColor(GraphicsUtilities.decodeColor(inactiveSelectionBackgroundColor,
"inactiveSelectionBackgroundColor"));
}
- public final void setInactiveSelectionBackgroundColor(int inactiveSelectionBackgroundColor) {
+ public final void setInactiveSelectionBackgroundColor(final int inactiveSelectionBackgroundColor) {
Theme theme = currentTheme();
setInactiveSelectionBackgroundColor(theme.getColor(inactiveSelectionBackgroundColor));
}
- public Color getHighlightBackgroundColor() {
+ public final Color getHighlightBackgroundColor() {
return highlightBackgroundColor;
}
- public void setHighlightBackgroundColor(Color highlightBackgroundColor) {
+ public final void setHighlightBackgroundColor(final Color highlightBackgroundColor) {
Utils.checkNull(highlightBackgroundColor, "highlightBackgroundColor");
this.highlightBackgroundColor = highlightBackgroundColor;
repaintComponent();
}
- public final void setHighlightBackgroundColor(String highlightBackgroundColor) {
+ public final void setHighlightBackgroundColor(final String highlightBackgroundColor) {
setHighlightBackgroundColor(GraphicsUtilities.decodeColor(highlightBackgroundColor,
"highlightBackgroundColor"));
}
- public final void setHighlightBackgroundColor(int highlightBackgroundColor) {
+ public final void setHighlightBackgroundColor(final int highlightBackgroundColor) {
Theme theme = currentTheme();
setHighlightBackgroundColor(theme.getColor(highlightBackgroundColor));
}
- public Color getAlternateItemBackgroundColor() {
+ public final Color getAlternateItemBackgroundColor() {
return alternateItemBackgroundColor;
}
- public void setAlternateItemBackgroundColor(Color alternateItemBackgroundColor) {
+ public final void setAlternateItemBackgroundColor(final Color alternateItemBackgroundColor) {
Utils.checkNull(alternateItemBackgroundColor, "alternateItemBackgroundColor");
this.alternateItemBackgroundColor = alternateItemBackgroundColor;
repaintComponent();
}
- public final void setAlternateItemBackgroundColor(String alternateItemBackgroundColor) {
+ public final void setAlternateItemBackgroundColor(final String alternateItemBackgroundColor) {
setAlternateItemBackgroundColor(GraphicsUtilities.decodeColor(alternateItemBackgroundColor,
"alternateItemBackgroundColor"));
}
- public final void setAlternateItemColor(int alternateItemBackgroundColor) {
+ public final void setAlternateItemColor(final int alternateItemBackgroundColor) {
Theme theme = currentTheme();
setAlternateItemBackgroundColor(theme.getColor(alternateItemBackgroundColor));
}
- public boolean getShowHighlight() {
+ public final boolean getShowHighlight() {
return showHighlight;
}
- public void setShowHighlight(boolean showHighlight) {
+ public final void setShowHighlight(final boolean showHighlight) {
this.showHighlight = showHighlight;
repaintComponent();
}
- public boolean getWrapSelectNext() {
+ public final boolean getWrapSelectNext() {
return wrapSelectNext;
}
- public void setWrapSelectNext(boolean wrapSelectNext) {
+ public final void setWrapSelectNext(final boolean wrapSelectNext) {
this.wrapSelectNext = wrapSelectNext;
}
- public Insets getCheckboxPadding() {
+ public final Insets getCheckboxPadding() {
return checkboxPadding;
}
- public void setCheckboxPadding(Insets checkboxPadding) {
+ public final void setCheckboxPadding(final Insets checkboxPadding) {
Utils.checkNull(checkboxPadding, "checkboxPadding");
this.checkboxPadding = checkboxPadding;
invalidateComponent();
}
- public final void setCheckboxPadding(Dictionary<String, ?> checkboxPadding) {
+ public final void setCheckboxPadding(final Dictionary<String, ?> checkboxPadding) {
setCheckboxPadding(new Insets(checkboxPadding));
}
- public final void setCheckboxPadding(int checkboxPadding) {
+ public final void setCheckboxPadding(final int checkboxPadding) {
setCheckboxPadding(new Insets(checkboxPadding));
}
- public final void setCheckboxPadding(Number padding) {
+ public final void setCheckboxPadding(final Number padding) {
setCheckboxPadding(new Insets(padding));
}
- public final void setCheckboxPadding(String checkboxPadding) {
+ public final void setCheckboxPadding(final String checkboxPadding) {
setCheckboxPadding(Insets.decode(checkboxPadding));
}
- public boolean isVariableItemHeight() {
+ public final boolean isVariableItemHeight() {
return variableItemHeight;
}
- public void setVariableItemHeight(boolean variableItemHeight) {
+ public final void setVariableItemHeight(final boolean variableItemHeight) {
this.variableItemHeight = variableItemHeight;
invalidateComponent();
}
@Override
- public boolean mouseMove(Component component, int x, int y) {
+ public boolean mouseMove(final Component component, final int x, final int y) {
boolean consumed = super.mouseMove(component, x, y);
ListView listView = (ListView) getComponent();
@@ -780,7 +780,7 @@ public class TerraListViewSkin extends C
}
@Override
- public void mouseOut(Component component) {
+ public void mouseOut(final Component component) {
super.mouseOut(component);
ListView listView = (ListView) getComponent();
@@ -796,7 +796,7 @@ public class TerraListViewSkin extends C
}
@Override
- public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
+ public boolean mouseDown(final Component component, final Mouse.Button button, final int x, final int y) {
boolean consumed = super.mouseDown(component, button, x, y);
ListView listView = (ListView) getComponent();
@@ -861,7 +861,7 @@ public class TerraListViewSkin extends C
}
@Override
- public boolean mouseUp(Component component, Mouse.Button button, int x, int y) {
+ public boolean mouseUp(final Component component, final Mouse.Button button, final int x, final int y) {
boolean consumed = super.mouseUp(component, button, x, y);
ListView listView = (ListView) getComponent();
@@ -875,7 +875,8 @@ public class TerraListViewSkin extends C
}
@Override
- public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
+ public boolean mouseClick(final Component component, final Mouse.Button button, final int x, final int y,
+ final int count) {
boolean consumed = super.mouseClick(component, button, x, y, count);
ListView listView = (ListView) getComponent();
@@ -901,6 +902,8 @@ public class TerraListViewSkin extends C
case SELECTED:
nextState = Button.State.UNSELECTED;
break;
+ default:
+ break;
}
listView.setItemCheckmarkState(itemIndex, nextState);
} else {
@@ -926,7 +929,7 @@ public class TerraListViewSkin extends C
return consumed;
}
- private Bounds getCheckboxBounds(int itemIndex) {
+ private Bounds getCheckboxBounds(final int itemIndex) {
Bounds itemBounds = getItemBounds(itemIndex);
int checkboxHeight = CHECKBOX.getHeight();
@@ -935,8 +938,8 @@ public class TerraListViewSkin extends C
}
@Override
- public boolean mouseWheel(Component component, Mouse.ScrollType scrollType, int scrollAmount,
- int wheelRotation, int x, int y) {
+ public boolean mouseWheel(final Component component, final Mouse.ScrollType scrollType, final int scrollAmount,
+ final int wheelRotation, final int x, final int y) {
ListView listView = (ListView) getComponent();
if (highlightIndex != -1) {
@@ -969,14 +972,14 @@ public class TerraListViewSkin extends C
* </ul>
*/
@Override
- public boolean keyPressed(Component component, int keyCode, KeyLocation keyLocation) {
+ public boolean keyPressed(final Component component, final int keyCode, final KeyLocation keyLocation) {
boolean consumed = super.keyPressed(component, keyCode, keyLocation);
ListView listView = (ListView) getComponent();
SelectMode selectMode = listView.getSelectMode();
switch (keyCode) {
- case KeyCode.UP: {
+ case KeyCode.UP:
if (selectMode != SelectMode.NONE) {
int index = listView.getFirstSelectedIndex();
int count = listView.getListData().getLength();
@@ -1007,9 +1010,8 @@ public class TerraListViewSkin extends C
}
break;
- }
- case KeyCode.DOWN: {
+ case KeyCode.DOWN:
if (selectMode != SelectMode.NONE) {
int index = listView.getLastSelectedIndex();
int count = listView.getListData().getLength();
@@ -1040,11 +1042,9 @@ public class TerraListViewSkin extends C
}
break;
- }
- default: {
+ default:
break;
- }
}
// Clear the highlight
@@ -1063,13 +1063,13 @@ public class TerraListViewSkin extends C
* is {@link SelectMode#SINGLE}.
*/
@Override
- public boolean keyReleased(Component component, int keyCode, KeyLocation keyLocation) {
+ public boolean keyReleased(final Component component, final int keyCode, final KeyLocation keyLocation) {
boolean consumed = super.keyReleased(component, keyCode, keyLocation);
ListView listView = (ListView) getComponent();
switch (keyCode) {
- case KeyCode.SPACE: {
+ case KeyCode.SPACE:
if (listView.getCheckmarksEnabled()
&& listView.getSelectMode() == SelectMode.SINGLE) {
int selectedIndex = listView.getSelectedIndex();
@@ -1082,11 +1082,9 @@ public class TerraListViewSkin extends C
}
break;
- }
- default: {
+ default:
break;
- }
}
return consumed;
@@ -1097,7 +1095,7 @@ public class TerraListViewSkin extends C
* rendered text matches the typed key (case insensitive).
*/
@Override
- public boolean keyTyped(Component component, char character) {
+ public boolean keyTyped(final Component component, final char character) {
boolean consumed = super.keyTyped(component, character);
ListView listView = (ListView) getComponent();
@@ -1145,14 +1143,14 @@ public class TerraListViewSkin extends C
// Component state events
@Override
- public void enabledChanged(Component component) {
+ public void enabledChanged(final Component component) {
super.enabledChanged(component);
repaintComponent();
}
@Override
- public void focusedChanged(Component component, Component obverseComponent) {
+ public void focusedChanged(final Component component, final Component obverseComponent) {
super.focusedChanged(component, obverseComponent);
repaintComponent();
@@ -1160,60 +1158,60 @@ public class TerraListViewSkin extends C
// List view events
@Override
- public void listDataChanged(ListView listView, List<?> previousListData) {
+ public void listDataChanged(final ListView listView, final List<?> previousListData) {
highlightIndex = -1;
invalidateComponent();
}
@Override
- public void itemRendererChanged(ListView listView, ListView.ItemRenderer previousItemRenderer) {
+ public void itemRendererChanged(final ListView listView, final ListView.ItemRenderer previousItemRenderer) {
invalidateComponent();
}
@Override
- public void itemEditorChanged(ListView listView, ListView.ItemEditor previousItemEditor) {
+ public void itemEditorChanged(final ListView listView, final ListView.ItemEditor previousItemEditor) {
// No-op
}
@Override
- public void selectModeChanged(ListView listView, SelectMode previousSelectMode) {
+ public void selectModeChanged(final ListView listView, final SelectMode previousSelectMode) {
repaintComponent();
}
@Override
- public void checkmarksEnabledChanged(ListView listView) {
+ public void checkmarksEnabledChanged(final ListView listView) {
invalidateComponent();
}
@Override
- public void checkmarksTriStateChanged(ListView listView) {
+ public void checkmarksTriStateChanged(final ListView listView) {
repaintComponent();
}
@Override
- public void checkmarksMixedAsCheckedChanged(ListView listView) {
+ public void checkmarksMixedAsCheckedChanged(final ListView listView) {
repaintComponent();
}
@Override
- public void disabledItemFilterChanged(ListView listView, Filter<?> previousDisabledItemFilter) {
+ public void disabledItemFilterChanged(final ListView listView, final Filter<?> previousDisabledItemFilter) {
repaintComponent();
}
@Override
- public void disabledCheckmarkFilterChanged(ListView listView,
- Filter<?> previousDisabledCheckmarkFilter) {
+ public void disabledCheckmarkFilterChanged(final ListView listView,
+ final Filter<?> previousDisabledCheckmarkFilter) {
repaintComponent();
}
// List view item events
@Override
- public void itemInserted(ListView listView, int index) {
+ public void itemInserted(final ListView listView, final int index) {
invalidateComponent();
}
@Override
- public void itemsRemoved(ListView listView, int index, int count) {
+ public void itemsRemoved(final ListView listView, final int index, final int count) {
if (highlightIndex >= index) {
highlightIndex = -1;
}
@@ -1221,18 +1219,18 @@ public class TerraListViewSkin extends C
}
@Override
- public void itemUpdated(ListView listView, int index) {
+ public void itemUpdated(final ListView listView, final int index) {
invalidateComponent();
}
@Override
- public void itemsCleared(ListView listView) {
+ public void itemsCleared(final ListView listView) {
highlightIndex = -1;
invalidateComponent();
}
@Override
- public void itemsSorted(ListView listView) {
+ public void itemsSorted(final ListView listView) {
if (variableItemHeight) {
invalidateComponent();
} else {
@@ -1242,18 +1240,18 @@ public class TerraListViewSkin extends C
// List view item state events
@Override
- public void itemCheckedChanged(ListView listView, int index) {
+ public void itemCheckedChanged(final ListView listView, final int index) {
repaintComponent(getItemBounds(index));
}
@Override
- public void itemCheckedStateChanged(ListView listView, int index) {
+ public void itemCheckedStateChanged(final ListView listView, final int index) {
repaintComponent(getItemBounds(index));
}
// List view selection detail events
@Override
- public void selectedRangeAdded(ListView listView, int rangeStart, int rangeEnd) {
+ public void selectedRangeAdded(final ListView listView, final int rangeStart, final int rangeEnd) {
if (listView.isValid()) {
Bounds selectionBounds = getItemBounds(rangeStart);
selectionBounds = selectionBounds.union(getItemBounds(rangeEnd));
@@ -1270,7 +1268,7 @@ public class TerraListViewSkin extends C
}
@Override
- public void selectedRangeRemoved(ListView listView, int rangeStart, int rangeEnd) {
+ public void selectedRangeRemoved(final ListView listView, final int rangeStart, final int rangeEnd) {
// Repaint the area containing the removed selection
if (listView.isValid()) {
Bounds selectionBounds = getItemBounds(rangeStart);
@@ -1280,7 +1278,7 @@ public class TerraListViewSkin extends C
}
@Override
- public void selectedRangesChanged(ListView listView, Sequence<Span> previousSelectedRanges) {
+ public void selectedRangesChanged(final ListView listView, final Sequence<Span> previousSelectedRanges) {
if (previousSelectedRanges != null
&& previousSelectedRanges != listView.getSelectedRanges()) {
if (listView.isValid()) {
@@ -1321,7 +1319,7 @@ public class TerraListViewSkin extends C
}
@Override
- public void selectedItemChanged(ListView listView, Object previousSelectedItem) {
+ public void selectedItemChanged(final ListView listView, final Object previousSelectedItem) {
// No-op
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java?rev=1832904&r1=1832903&r2=1832904&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Button.java Tue Jun 5 00:14:11 2018
@@ -687,8 +687,8 @@ public abstract class Button extends Com
if (buttonDataKey != null && JSON.containsKey(context, buttonDataKey)
&& buttonDataBindType != BindType.STORE) {
Object value = JSON.get(context, buttonDataKey);
- setButtonData((buttonDataBindMapping == null) ? value
- : buttonDataBindMapping.toButtonData(value));
+ setButtonData((buttonDataBindMapping == null)
+ ? value : buttonDataBindMapping.toButtonData(value));
}
}
@@ -698,21 +698,21 @@ public abstract class Button extends Com
if (triState) {
// Bind using state key
if (stateKey != null && stateBindType != BindType.LOAD) {
- JSON.put(context, stateKey, (stateBindMapping == null) ? state
- : stateBindMapping.valueOf(state));
+ JSON.put(context, stateKey, (stateBindMapping == null)
+ ? state : stateBindMapping.valueOf(state));
}
} else {
// Bind using selected key
if (selectedKey != null && selectedBindType != BindType.LOAD) {
- JSON.put(context, selectedKey, (selectedBindMapping == null) ?
- Boolean.valueOf(isSelected()) : selectedBindMapping.valueOf(isSelected()));
+ JSON.put(context, selectedKey, (selectedBindMapping == null)
+ ? Boolean.valueOf(isSelected()) : selectedBindMapping.valueOf(isSelected()));
}
}
}
if (buttonDataKey != null && buttonDataBindType != BindType.LOAD) {
- JSON.put(context, buttonDataKey, (buttonDataBindMapping == null) ? buttonData
- : buttonDataBindMapping.valueOf(buttonData));
+ JSON.put(context, buttonDataKey, (buttonDataBindMapping == null)
+ ? buttonData : buttonDataBindMapping.valueOf(buttonData));
}
}