You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/02/26 16:11:38 UTC
svn commit: r1450207 - in
/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk: ./ content/ effects/
skin/ text/
Author: smartini
Date: Tue Feb 26 15:11:37 2013
New Revision: 1450207
URL: http://svn.apache.org/r1450207
Log:
fix many eclipse (4.2.x) warnings, enforcing best practice coding
Modified:
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Container.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/FileBrowser.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Limits.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Mouse.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TablePane.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/CalendarButtonDataRenderer.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ColorItem.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/MenuButtonDataRenderer.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java
pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/text/Paragraph.java
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Tue Feb 26 15:11:37 2013
@@ -432,27 +432,32 @@ public abstract class ApplicationContext
@Override
public void repaint(int x, int y, int width, int height) {
+ int xMutable = x;
+ int yMutable = y;
+ int widthMutable = width;
+ int heightMutable = height;
+
// Ensure that the repaint call is properly bounded (some
// implementations of AWT do not properly clip the repaint call
// when x or y is negative: the negative value is converted to 0,
// but the width/height is not adjusted)
- if (x < 0) {
- width = Math.max(width + x, 0);
- x = 0;
+ if (xMutable < 0) {
+ widthMutable = Math.max(widthMutable + xMutable, 0);
+ xMutable = 0;
}
- if (y < 0) {
- height = Math.max(height + y, 0);
- y = 0;
+ if (yMutable < 0) {
+ heightMutable = Math.max(heightMutable + yMutable, 0);
+ yMutable = 0;
}
- if (width > 0
- && height > 0) {
+ if (widthMutable > 0
+ && heightMutable > 0) {
if (scale == 1) {
- super.repaint(x, y, width, height);
+ super.repaint(xMutable, yMutable, widthMutable, heightMutable);
} else {
- super.repaint((int)Math.floor(x * scale), (int)Math.floor(y * scale),
- (int)Math.ceil(width * scale) + 1, (int)Math.ceil(height * scale) + 1);
+ super.repaint((int)Math.floor(xMutable * scale), (int)Math.floor(yMutable * scale),
+ (int)Math.ceil(widthMutable * scale) + 1, (int)Math.ceil(heightMutable * scale) + 1);
}
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Component.java Tue Feb 26 15:11:37 2013
@@ -1625,11 +1625,14 @@ public abstract class Component implemen
* A point containing the translated coordinates, or <tt>null</tt> if the
* component is not a descendant of the specified ancestor.
*/
- public Point mapPointToAncestor(Container ancestor, int xArgument, int yArgument) {
+ public Point mapPointToAncestor(final Container ancestor, int xArgument, int yArgument) {
if (ancestor == null) {
throw new IllegalArgumentException("ancestor is null");
}
+ int xArgumentMutable = xArgument;
+ int yArgumentMutable = yArgument;
+
Point coordinates = null;
Component component = this;
@@ -1637,10 +1640,10 @@ public abstract class Component implemen
while (component != null
&& coordinates == null) {
if (component == ancestor) {
- coordinates = new Point(xArgument, yArgument);
+ coordinates = new Point(xArgumentMutable, yArgumentMutable);
} else {
- xArgument += component.x;
- yArgument += component.y;
+ xArgumentMutable += component.x;
+ yArgumentMutable += component.y;
component = component.getParent();
}
@@ -1681,22 +1684,24 @@ public abstract class Component implemen
* A point containing the translated coordinates, or <tt>null</tt> if the
* component is not a descendant of the specified ancestor.
*/
- public Point mapPointFromAncestor(Container ancestor, int xArgument, int yArgument) {
+ public Point mapPointFromAncestor(final Container ancestor, int xArgument, int yArgument) {
if (ancestor == null) {
throw new IllegalArgumentException("ancestor is null");
}
- Point coordinates = null;
+ int xArgumentMutable = xArgument;
+ int yArgumentMutable = yArgument;
+ Point coordinates = null;
Component component = this;
while (component != null
&& coordinates == null) {
if (component == ancestor) {
- coordinates = new Point(xArgument, yArgument);
+ coordinates = new Point(xArgumentMutable, yArgumentMutable);
} else {
- xArgument -= component.x;
- yArgument -= component.y;
+ xArgumentMutable -= component.x;
+ yArgumentMutable -= component.y;
component = component.getParent();
}
@@ -1854,6 +1859,11 @@ public abstract class Component implemen
* @param height
*/
public void scrollAreaToVisible(int xArgument, int yArgument, int width, int height) {
+ int xArgumentMutable = xArgument;
+ int yArgumentMutable = yArgument;
+ int widthMutable = width;
+ int heightMutable = height;
+
Component component = this;
while (component != null) {
@@ -1866,8 +1876,8 @@ public abstract class Component implemen
int deltaX = 0;
- int leftDisplacement = xArgument - viewportBounds.x;
- int rightDisplacement = (xArgument + width) -
+ int leftDisplacement = xArgumentMutable - viewportBounds.x;
+ int rightDisplacement = (xArgumentMutable + widthMutable) -
(viewportBounds.x + viewportBounds.width);
if ((leftDisplacement & rightDisplacement) < 0) {
@@ -1889,17 +1899,17 @@ public abstract class Component implemen
Math.max(viewWidth - viewportBounds.width, 0));
viewport.setScrollLeft(scrollLeft);
- xArgument -= deltaX;
+ xArgumentMutable -= deltaX;
}
- xArgument = Math.max(xArgument, viewportBounds.x);
- width = Math.min(width,
- Math.max(viewportBounds.width - (xArgument - viewportBounds.x), 0));
+ xArgumentMutable = Math.max(xArgumentMutable, viewportBounds.x);
+ widthMutable = Math.min(widthMutable,
+ Math.max(viewportBounds.width - (xArgumentMutable - viewportBounds.x), 0));
int deltaY = 0;
- int topDisplacement = yArgument - viewportBounds.y;
- int bottomDisplacement = (yArgument + height) -
+ int topDisplacement = yArgumentMutable - viewportBounds.y;
+ int bottomDisplacement = (yArgumentMutable + heightMutable) -
(viewportBounds.y + viewportBounds.height);
if ((topDisplacement & bottomDisplacement) < 0) {
@@ -1919,12 +1929,12 @@ public abstract class Component implemen
Math.max(viewHeight - viewportBounds.height, 0));
viewport.setScrollTop(scrollTop);
- yArgument -= deltaY;
+ yArgumentMutable -= deltaY;
}
- yArgument = Math.max(yArgument, viewportBounds.y);
- height = Math.min(height,
- Math.max(viewportBounds.height - (yArgument - viewportBounds.y), 0));
+ yArgumentMutable = Math.max(yArgumentMutable, viewportBounds.y);
+ heightMutable = Math.min(heightMutable,
+ Math.max(viewportBounds.height - (yArgumentMutable - viewportBounds.y), 0));
} catch (UnsupportedOperationException ex) {
// If the viewport doesn't support getting the viewport
// bounds, we simply act as we would have had the viewport
@@ -1933,8 +1943,8 @@ public abstract class Component implemen
}
}
- xArgument += component.x;
- yArgument += component.y;
+ xArgumentMutable += component.x;
+ yArgumentMutable += component.y;
component = component.getParent();
}
@@ -2046,21 +2056,26 @@ public abstract class Component implemen
public void repaint(int xArgument, int yArgument, int width, int height, boolean immediate) {
Container.assertEventDispatchThread(this);
if (parent != null) {
+ int xArgumentMutable = xArgument;
+ int yArgumentMutable = yArgument;
+ int widthMutable = width;
+ int heightMutable = height;
+
// Constrain the repaint area to this component's bounds
- int top = yArgument;
- int left = xArgument;
- int bottom = top + height - 1;
- int right = left + width - 1;
-
- xArgument = Math.max(left, 0);
- yArgument = Math.max(top, 0);
- width = Math.min(right, getWidth() - 1) - xArgument + 1;
- height = Math.min(bottom, getHeight() - 1) - yArgument + 1;
+ int top = yArgumentMutable;
+ int left = xArgumentMutable;
+ int bottom = top + heightMutable - 1;
+ int right = left + widthMutable - 1;
+
+ xArgumentMutable = Math.max(left, 0);
+ yArgumentMutable = Math.max(top, 0);
+ widthMutable = Math.min(right, getWidth() - 1) - xArgumentMutable + 1;
+ heightMutable = Math.min(bottom, getHeight() - 1) - yArgumentMutable + 1;
- if (width > 0
- && height > 0) {
+ if (widthMutable > 0
+ && heightMutable > 0) {
// Notify the parent that the region needs updating
- parent.repaint(xArgument + this.x, yArgument + this.y, width, height, immediate);
+ parent.repaint(xArgumentMutable + this.x, yArgumentMutable + this.y, widthMutable, heightMutable, immediate);
// Repaint any affected decorators
for (Decorator decorator : decorators) {
@@ -2068,7 +2083,7 @@ public abstract class Component implemen
if (!transform.isIdentity()) {
// Apply the decorator's transform to the repaint area
- Rectangle area = new Rectangle(xArgument, yArgument, width, height);
+ Rectangle area = new Rectangle(xArgumentMutable, yArgumentMutable, widthMutable, heightMutable);
Shape transformedShape = transform.createTransformedShape(area);
Bounds tranformedBounds = new Bounds(transformedShape.getBounds());
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Container.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Container.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Container.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Container.java Tue Feb 26 15:11:37 2013
@@ -534,33 +534,34 @@ public abstract class Container extends
* The direction in which to transfer focus.
*/
public Component transferFocus(Component component, FocusTraversalDirection direction) {
+ Component componentUpdated = component;
if (focusTraversalPolicy == null) {
// The container has no traversal policy; move up a level
- component = transferFocus(direction);
+ componentUpdated = transferFocus(direction);
} else {
do {
- component = focusTraversalPolicy.getNextComponent(this, component, direction);
+ componentUpdated = focusTraversalPolicy.getNextComponent(this, componentUpdated, direction);
- if (component != null) {
- if (component.isFocusable()) {
- component.requestFocus();
+ if (componentUpdated != null) {
+ if (componentUpdated.isFocusable()) {
+ componentUpdated.requestFocus();
} else {
- if (component instanceof Container) {
- Container container = (Container)component;
- component = container.transferFocus(null, direction);
+ if (componentUpdated instanceof Container) {
+ Container container = (Container)componentUpdated;
+ componentUpdated = container.transferFocus(null, direction);
}
}
}
- } while (component != null
- && !component.isFocused());
+ } while (componentUpdated != null
+ && !componentUpdated.isFocused());
- if (component == null) {
+ if (componentUpdated == null) {
// We are at the end of the traversal
- component = transferFocus(direction);
+ componentUpdated = transferFocus(direction);
}
}
- return component;
+ return componentUpdated;
}
/**
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/FileBrowser.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/FileBrowser.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/FileBrowser.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/FileBrowser.java Tue Feb 26 15:11:37 2013
@@ -165,22 +165,23 @@ public class FileBrowser extends Contain
* <tt>true</tt> if the file was added; <tt>false</tt> if it was already
* selected.
*/
- public boolean addSelectedFile(File file) {
+ public boolean addSelectedFile(final File file) {
if (file == null) {
throw new IllegalArgumentException();
}
- if (file.isAbsolute()) {
- if (!file.getParentFile().equals(rootDirectory)) {
+ File fileMutable = file;
+ if (fileMutable.isAbsolute()) {
+ if (!fileMutable.getParentFile().equals(rootDirectory)) {
throw new IllegalArgumentException();
}
} else {
- file = new File(rootDirectory, file.getPath());
+ fileMutable = new File(rootDirectory, fileMutable.getPath());
}
- int index = selectedFiles.add(file);
+ int index = selectedFiles.add(fileMutable);
if (index != -1) {
- fileBrowserListeners.selectedFileAdded(this, file);
+ fileBrowserListeners.selectedFileAdded(this, fileMutable);
}
return (index != -1);
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java Tue Feb 26 15:11:37 2013
@@ -193,41 +193,41 @@ public final class GraphicsUtilities {
* illegal hexadecimal digits.
* @throws IllegalArgumentException if the value is not in one of the formats listed above.
*/
- public static Color decodeColor(String value) throws NumberFormatException {
+ public static Color decodeColor(final String value) throws NumberFormatException {
if (value == null) {
throw new IllegalArgumentException("Cannot decode a null String.");
}
- value = value.toLowerCase(Locale.ENGLISH);
+ String valueLowercase = value.toLowerCase(Locale.ENGLISH);
Color color;
- if (value.startsWith("0x")) {
- value = value.substring(2);
- if (value.length() != 8) {
+ if (valueLowercase.startsWith("0x")) {
+ valueLowercase = valueLowercase.substring(2);
+ if (valueLowercase.length() != 8) {
throw new IllegalArgumentException(
"Incorrect Color format. Expecting exactly 8 digits after the '0x' prefix.");
}
- int rgb = Integer.parseInt(value.substring(0, 6), 16);
- float alpha = Integer.parseInt(value.substring(6, 8), 16) / 255f;
+ int rgb = Integer.parseInt(valueLowercase.substring(0, 6), 16);
+ float alpha = Integer.parseInt(valueLowercase.substring(6, 8), 16) / 255f;
color = getColor(rgb, alpha);
- } else if (value.startsWith("#")) {
- value = value.substring(1);
- if (value.length() != 6) {
+ } else if (valueLowercase.startsWith("#")) {
+ valueLowercase = valueLowercase.substring(1);
+ if (valueLowercase.length() != 6) {
throw new IllegalArgumentException(
"Incorrect Color format. Expecting exactly 6 digits after the '#' prefix.");
}
- int rgb = Integer.parseInt(value, 16);
+ int rgb = Integer.parseInt(valueLowercase, 16);
float alpha = 1.0f;
color = getColor(rgb, alpha);
} else {
try {
- color = (Color)Color.class.getDeclaredField(value).get(null);
+ color = (Color)Color.class.getDeclaredField(valueLowercase).get(null);
} catch (Exception exception) {
- throw new IllegalArgumentException("\"" + value + "\" is not a valid color constant.");
+ throw new IllegalArgumentException("\"" + valueLowercase + "\" is not a valid color constant.");
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Limits.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Limits.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Limits.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Limits.java Tue Feb 26 15:11:37 2013
@@ -86,9 +86,9 @@ public final class Limits implements Ser
*/
public int constrain(int value) {
if (value < minimum) {
- value = minimum;
+ return minimum;
} else if (value > maximum) {
- value = maximum;
+ return maximum;
}
return value;
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Mouse.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Mouse.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Mouse.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Mouse.java Tue Feb 26 15:11:37 2013
@@ -271,7 +271,7 @@ public final class Mouse {
*
* @param component
*/
- public static void setCursor(Component component) {
+ public static void setCursor(final Component component) {
if (component == null) {
throw new IllegalArgumentException("component is null.");
}
@@ -280,22 +280,23 @@ public final class Mouse {
throw new IllegalArgumentException("component is not visible.");
}
+ Component componentOrParent = component;
Cursor cursor = null;
- if (component.isEnabled()) {
- cursor = component.getCursor();
+ if (componentOrParent.isEnabled()) {
+ cursor = componentOrParent.getCursor();
while (cursor == null
- && component != null
- && !(component instanceof Display)) {
- component = component.getParent();
- if (component != null) {
- cursor = component.getCursor();
+ && componentOrParent != null
+ && !(componentOrParent instanceof Display)) {
+ componentOrParent = componentOrParent.getParent();
+ if (componentOrParent != null) {
+ cursor = componentOrParent.getCursor();
}
}
}
- if (component != null) {
- Display display = component.getDisplay();
+ if (componentOrParent != null) {
+ Display display = componentOrParent.getDisplay();
ApplicationContext.DisplayHost displayHost = display.getDisplayHost();
displayHost.setCursor((cursor == null) ? java.awt.Cursor.getDefaultCursor() :
getCursor(cursor));
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java Tue Feb 26 15:11:37 2013
@@ -384,8 +384,9 @@ public class RadioButtonGroup extends Bu
* @see Sequence#remove(int, int)
*/
public Sequence<Button> remove(int index, int count) {
+ int countMutable = count;
Sequence<Button> removed = new ArrayList<Button>();
- while (count-- > 0) {
+ while (countMutable-- > 0) {
Button button = get(index);
boolean result = this.remove(button);
if (result) {
@@ -449,31 +450,32 @@ public class RadioButtonGroup extends Bu
* unless the group contains a selected or focused button, in which case
* that button will be used as the starting point for the search.
*/
- public void selectNextButton(Button button) {
+ public void selectNextButton(final Button button) {
+ Button buttonWithDefault = button;
+
// No explicit starting point was supplied
- if (button == null) {
+ if (buttonWithDefault == null) {
// If there is a selected button in this group, we will try to use
// it as the starting point.
- button = getSelection();
-
- if (button == null) {
+ buttonWithDefault = getSelection();
+ if (buttonWithDefault == null) {
// No selection, but perhaps one of the buttons has focus?
Component focusedComponent = Component.getFocusedComponent();
if (focusedComponent instanceof Button) {
int index = this.indexOf((Button)focusedComponent);
if (index != NOT_FOUND_INDEX) {
- button = this.get(index);
+ buttonWithDefault = this.get(index);
}
}
}
// Try again, using new starting point if one was determined
- if (button != null) {
- selectNextButton(button);
+ if (buttonWithDefault != null) {
+ selectNextButton(buttonWithDefault);
} else {
selectFirstButton();
}
} else {
- int index = indexOf(button);
+ int index = indexOf(buttonWithDefault);
if (index == NOT_FOUND_INDEX) {
throw new IllegalArgumentException(
"Button does not belong to this RadioButtonGroup.");
@@ -493,32 +495,33 @@ public class RadioButtonGroup extends Bu
* the group contains a selected or focused button, in which case that
* button will be used as the starting point for the search.
*/
- public void selectPreviousButton(Button button) {
+ public void selectPreviousButton(final Button button) {
+ Button buttonWithDefault = button;
+
// No explicit starting point was supplied
- if (button == null) {
+ if (buttonWithDefault == null) {
// If there is a selected button in this group, we will try to use
// it as the starting point.
- button = getSelection();
-
- if (button == null) {
+ buttonWithDefault = getSelection();
+ if (buttonWithDefault == null) {
// No selection, but perhaps one of the buttons has focus?
Component focusedComponent = Component.getFocusedComponent();
if (focusedComponent instanceof Button) {
int index = this.indexOf((Button)focusedComponent);
if (index != NOT_FOUND_INDEX) {
- button = this.get(index);
+ buttonWithDefault = this.get(index);
}
}
}
// Try again, using new starting point if one was determined
- if (button != null) {
- selectPreviousButton(button);
+ if (buttonWithDefault != null) {
+ selectPreviousButton(buttonWithDefault);
} else {
selectLastButton();
}
} else {
- int index = indexOf(button);
+ int index = indexOf(buttonWithDefault);
if (index == NOT_FOUND_INDEX) {
throw new IllegalArgumentException(
"Button does not belong to this RadioButtonGroup.");
@@ -542,14 +545,14 @@ public class RadioButtonGroup extends Bu
*
* @see #setCircular(boolean)
*/
- private int findNext(int index, Filter<Integer> filter, boolean circularArgument) {
- filter = (filter == null ? defaultFilter : filter);
+ private int findNext(int index, final Filter<Integer> filter, boolean circularArgument) {
+ Filter<Integer> filterWithDefault = (filter == null ? defaultFilter : filter);
int result = NOT_FOUND_INDEX;
int length = buttonOrder.getLength();
if (length > 0) {
// (index + 1) --> last index
for (int i = (index + 1); i < length; i++) {
- if (filter.include(i)) {
+ if (filterWithDefault.include(i)) {
result = i;
break;
}
@@ -557,7 +560,7 @@ public class RadioButtonGroup extends Bu
if (circularArgument && result == NOT_FOUND_INDEX) {
// first index --> index
for (int i = 0; i <= index; i++) {
- if (filter.include(i)) {
+ if (filterWithDefault.include(i)) {
result = i;
break;
}
@@ -583,14 +586,14 @@ public class RadioButtonGroup extends Bu
*
* @see #setCircular(boolean)
*/
- private int findPrevious(int index, Filter<Integer> filter, boolean circularArgument) {
- filter = (filter == null ? defaultFilter : filter);
+ private int findPrevious(int index, final Filter<Integer> filter, boolean circularArgument) {
+ Filter<Integer> filterWithDefault = (filter == null ? defaultFilter : filter);
int result = NOT_FOUND_INDEX;
int length = buttonOrder.getLength();
if (length > 0) {
// (index - 1) --> first index
for (int i = (index - 1); i >= 0; i--) {
- if (filter.include(i)) {
+ if (filterWithDefault.include(i)) {
result = i;
break;
}
@@ -598,7 +601,7 @@ public class RadioButtonGroup extends Bu
if (circularArgument && result == NOT_FOUND_INDEX) {
// last index --> index
for (int i = (length - 1); i >= index; i--) {
- if (filter.include(i)) {
+ if (filterWithDefault.include(i)) {
result = i;
break;
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TablePane.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TablePane.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TablePane.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TablePane.java Tue Feb 26 15:11:37 2013
@@ -122,10 +122,11 @@ public class TablePane extends Container
if (height.endsWith(RELATIVE_SIZE_INDICATOR)) {
relativeLocal = true;
- height = height.substring(0, height.length() - 1);
+ setHeight(Integer.parseInt(height.substring(0, height.length() - 1)), relativeLocal);
+ } else {
+ setHeight(Integer.parseInt(height), relativeLocal);
}
- setHeight(Integer.parseInt(height), relativeLocal);
}
/**
@@ -362,10 +363,11 @@ public class TablePane extends Container
if (width.endsWith(RELATIVE_SIZE_INDICATOR)) {
relativeLocal = true;
- width = width.substring(0, width.length() - 1);
+ setWidth(Integer.parseInt(width.substring(0, width.length() - 1)), relativeLocal);
+ } else {
+ setWidth(Integer.parseInt(width), relativeLocal);
}
- setWidth(Integer.parseInt(width), relativeLocal);
}
/**
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/TableView.java Tue Feb 26 15:11:37 2013
@@ -281,10 +281,11 @@ public class TableView extends Component
if (width.endsWith("*")) {
relativeLocal = true;
- width = width.substring(0, width.length() - 1);
+ setWidth(Integer.parseInt(width.substring(0, width.length() - 1)), relativeLocal);
+ } else {
+ setWidth(Integer.parseInt(width), relativeLocal);
}
- setWidth(Integer.parseInt(width), relativeLocal);
}
/**
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/CalendarButtonDataRenderer.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/CalendarButtonDataRenderer.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/CalendarButtonDataRenderer.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/CalendarButtonDataRenderer.java Tue Feb 26 15:11:37 2013
@@ -34,21 +34,22 @@ public class CalendarButtonDataRenderer
}
@Override
- public void render(Object data, Button button, boolean highlight) {
+ public void render(final Object data, final Button button, boolean highlight) {
+ Object dataMutable = data;
CalendarButton calendarButton = (CalendarButton)button;
Locale locale = calendarButton.getLocale();
- if (data == null) {
- data = "";
+ if (dataMutable == null) {
+ dataMutable = "";
} else {
- if (data instanceof CalendarDate) {
- CalendarDate date = (CalendarDate)data;
+ if (dataMutable instanceof CalendarDate) {
+ CalendarDate date = (CalendarDate)dataMutable;
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
- data = dateFormat.format(date.toCalendar().getTime());
+ dataMutable = dateFormat.format(date.toCalendar().getTime());
}
}
- super.render(data, button, highlight);
+ super.render(dataMutable, button, highlight);
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ColorItem.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ColorItem.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ColorItem.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ColorItem.java Tue Feb 26 15:11:37 2013
@@ -66,11 +66,12 @@ public class ColorItem {
public void setName(String name) {
if (name == null) {
- name = String.format("#%02X%02X%02X", color.getRed(), color.getGreen(),
+ this.name = String.format("#%02X%02X%02X", color.getRed(), color.getGreen(),
color.getBlue());
+ } else {
+ this.name = name;
}
- this.name = name;
}
@Override
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java Tue Feb 26 15:11:37 2013
@@ -31,16 +31,17 @@ public class ListButtonDataRenderer exte
}
@Override
- public void render(Object data, Button button, boolean highlight) {
- if (data == null) {
- data = "";
+ public void render(final Object data, final Button button, boolean highlight) {
+ Object dataMutable = data;
+ if (dataMutable == null) {
+ dataMutable = "";
} else {
- if (data instanceof ListItem) {
- ListItem listItem = (ListItem)data;
- data = new ButtonData(listItem.getIcon(), listItem.getText());
+ if (dataMutable instanceof ListItem) {
+ ListItem listItem = (ListItem)dataMutable;
+ dataMutable = new ButtonData(listItem.getIcon(), listItem.getText());
}
}
- super.render(data, button, highlight);
+ super.render(dataMutable, button, highlight);
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/MenuButtonDataRenderer.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/MenuButtonDataRenderer.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/MenuButtonDataRenderer.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/MenuButtonDataRenderer.java Tue Feb 26 15:11:37 2013
@@ -28,11 +28,12 @@ public class MenuButtonDataRenderer exte
}
@Override
- public void render(Object data, Button button, boolean highlight) {
- if (data == null) {
- data = "";
+ public void render(final Object data, final Button button, boolean highlight) {
+ Object dataMutable = data;
+ if (dataMutable == null) {
+ dataMutable = "";
}
- super.render(data, button, highlight);
+ super.render(dataMutable, button, highlight);
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java Tue Feb 26 15:11:37 2013
@@ -338,19 +338,19 @@ public class ScaleDecorator implements D
// No-op
}
- public void repaint(Component component, int x, int y, int width, int height) {
+ public void repaint(final Component component, int x, int y, int width, int height) {
Container parent = component.getParent();
if (parent != null) {
int tx = getTranslatedX(component);
int ty = getTranslatedY(component);
- x = (int)((x * scaleX) + component.getX() + tx);
- y = (int)((y * scaleY) + component.getY() + ty);
- width = (int)Math.ceil(width * scaleX);
- height = (int)Math.ceil(height * scaleY);
+ int xUpdated = (int)((x * scaleX) + component.getX() + tx);
+ int yUpdated = (int)((y * scaleY) + component.getY() + ty);
+ int widthUpdated = (int)Math.ceil(width * scaleX);
+ int heightUpdated = (int)Math.ceil(height * scaleY);
- parent.repaint(x, y, width, height);
+ parent.repaint(xUpdated, yUpdated, widthUpdated, heightUpdated);
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java Tue Feb 26 15:11:37 2013
@@ -93,12 +93,13 @@ public class BorderSkin extends Containe
Component content = border.getContent();
if (content != null) {
- if (height != -1) {
- height = Math.max(height - (topThickness + thickness) -
+ int heightUpdated = height;
+ if (heightUpdated != -1) {
+ heightUpdated = Math.max(heightUpdated - (topThickness + thickness) -
padding.top - padding.bottom, 0);
}
- preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(height));
+ preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(heightUpdated));
}
preferredWidth += (padding.left + padding.right) + (thickness * 2);
@@ -123,12 +124,13 @@ public class BorderSkin extends Containe
Component content = border.getContent();
if (content != null) {
- if (width != -1) {
- width = Math.max(width - (thickness * 2)
+ int widthUpdated = width;
+ if (widthUpdated != -1) {
+ widthUpdated = Math.max(widthUpdated - (thickness * 2)
- padding.left - padding.right, 0);
}
- preferredHeight = content.getPreferredHeight(width);
+ preferredHeight = content.getPreferredHeight(widthUpdated);
}
preferredHeight += (padding.top + padding.bottom) + (topThickness + thickness);
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java Tue Feb 26 15:11:37 2013
@@ -53,9 +53,10 @@ public class BoxPaneSkin extends Contain
Orientation orientation = boxPane.getOrientation();
if (orientation == Orientation.HORIZONTAL) {
+ int heightUpdated = height;
// Include padding in constraint
- if (height != -1) {
- height = Math.max(height - (padding.top + padding.bottom), 0);
+ if (heightUpdated != -1) {
+ heightUpdated = Math.max(heightUpdated - (padding.top + padding.bottom), 0);
}
// Preferred width is the sum of the preferred widths of all components
@@ -64,7 +65,7 @@ public class BoxPaneSkin extends Contain
Component component = boxPane.get(i);
if (component.isVisible()) {
- preferredWidth += component.getPreferredWidth(fill ? height : -1);
+ preferredWidth += component.getPreferredWidth(fill ? heightUpdated : -1);
j++;
}
}
@@ -109,9 +110,10 @@ public class BoxPaneSkin extends Contain
}
}
} else {
+ int widthUpdated = width;
// Include padding in constraint
- if (width != -1) {
- width = Math.max(width - (padding.left + padding.right), 0);
+ if (widthUpdated != -1) {
+ widthUpdated = Math.max(widthUpdated - (padding.left + padding.right), 0);
}
// Preferred height is the sum of the preferred heights of all components
@@ -120,7 +122,7 @@ public class BoxPaneSkin extends Contain
Component component = boxPane.get(i);
if (component.isVisible()) {
- preferredHeight += component.getPreferredHeight(fill ? width : -1);
+ preferredHeight += component.getPreferredHeight(fill ? widthUpdated : -1);
j++;
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java Tue Feb 26 15:11:37 2013
@@ -48,9 +48,10 @@ public class FillPaneSkin extends Contai
Orientation orientation = fillPane.getOrientation();
if (orientation == Orientation.HORIZONTAL) {
+ int heightUpdated = height;
// Include padding in constraint
- if (height != -1) {
- height = Math.max(height - (padding.top + padding.bottom), 0);
+ if (heightUpdated != -1) {
+ heightUpdated = Math.max(heightUpdated - (padding.top + padding.bottom), 0);
}
// Preferred width is the sum of the preferred widths of all components
@@ -59,7 +60,7 @@ public class FillPaneSkin extends Contai
Component component = fillPane.get(i);
if (component.isVisible()) {
- preferredWidth += component.getPreferredWidth(height);
+ preferredWidth += component.getPreferredWidth(heightUpdated);
j++;
}
}
@@ -104,9 +105,10 @@ public class FillPaneSkin extends Contai
}
}
} else {
+ int widthUpdated = width;
// Include padding in constraint
- if (width != -1) {
- width = Math.max(width - (padding.left + padding.right), 0);
+ if (widthUpdated != -1) {
+ widthUpdated = Math.max(widthUpdated - (padding.left + padding.right), 0);
}
// Preferred height is the sum of the preferred heights of all components
@@ -115,7 +117,7 @@ public class FillPaneSkin extends Contai
Component component = fillPane.get(i);
if (component.isVisible()) {
- preferredHeight += component.getPreferredHeight(width);
+ preferredHeight += component.getPreferredHeight(widthUpdated);
j++;
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java Tue Feb 26 15:11:37 2013
@@ -108,6 +108,7 @@ public class LabelSkin extends Component
float preferredHeight;
if (text != null) {
+ int widthUpdated = width;
FontRenderContext fontRenderContext = Platform.getFontRenderContext();
LineMetrics lm = font.getLineMetrics("", fontRenderContext);
float lineHeight = lm.getHeight();
@@ -117,9 +118,9 @@ public class LabelSkin extends Component
int n = text.length();
if (n > 0
&& wrapText
- && width != -1) {
+ && widthUpdated != -1) {
// Adjust width for padding
- width -= (padding.left + padding.right);
+ widthUpdated -= (padding.left + padding.right);
float lineWidth = 0;
int lastWhitespaceIndex = -1;
@@ -141,7 +142,7 @@ public class LabelSkin extends Component
fontRenderContext);
lineWidth += characterBounds.getWidth();
- if (lineWidth > width
+ if (lineWidth > widthUpdated
&& lastWhitespaceIndex != -1) {
i = lastWhitespaceIndex;
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java Tue Feb 26 15:11:37 2013
@@ -394,7 +394,7 @@ public abstract class ListButtonSkin ext
List<?> listData = listButton.getListData();
ListView.ItemRenderer itemRenderer = listButton.getItemRenderer();
- character = Character.toUpperCase(character);
+ char characterUpper = Character.toUpperCase(character);
for (int i = listButton.getSelectedIndex() + 1, n = listData.getLength(); i < n; i++) {
if (!listButton.isItemDisabled(i)) {
@@ -404,7 +404,7 @@ public abstract class ListButtonSkin ext
&& string.length() > 0) {
char first = Character.toUpperCase(string.charAt(0));
- if (first == character) {
+ if (first == characterUpper) {
listButton.setSelectedIndex(i);
consumed = true;
break;
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java Tue Feb 26 15:11:37 2013
@@ -167,14 +167,14 @@ public class ScrollPaneSkin extends Cont
// Preferred width is the sum of the constrained preferred
// width of the view and the unconstrained preferred width of
// the row header
-
- if (height >= 0) {
+ int heightUpdated = height;
+ if (heightUpdated >= 0) {
// Subtract the unconstrained preferred height of the
// column header from the height constraint
- height = Math.max(height - preferredColumnHeaderHeight, 0);
+ heightUpdated = Math.max(heightUpdated - preferredColumnHeaderHeight, 0);
}
- preferredWidth = view.getPreferredWidth(height) +
+ preferredWidth = view.getPreferredWidth(heightUpdated) +
preferredRowHeaderWidth;
}
}
@@ -257,14 +257,14 @@ public class ScrollPaneSkin extends Cont
// Preferred height is the sum of the constrained preferred height
// of the view and the unconstrained preferred height of the column
// header
-
- if (width >= 0) {
+ int widthUpdated = width;
+ if (widthUpdated >= 0) {
// Subtract the unconstrained preferred width of the row header
// from the width constraint
- width = Math.max(width - preferredRowHeaderWidth, 0);
+ widthUpdated = Math.max(widthUpdated - preferredRowHeaderWidth, 0);
}
- preferredHeight = view.getPreferredHeight(width) +
+ preferredHeight = view.getPreferredHeight(widthUpdated) +
preferredColumnHeaderHeight;
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java Tue Feb 26 15:11:37 2013
@@ -264,11 +264,12 @@ public class TablePaneSkin extends Conta
int totalRelativeWeight = 0;
- if (width < 0) {
- width = getPreferredWidth(-1);
+ int widthUpdated = width;
+ if (widthUpdated < 0) {
+ widthUpdated = getPreferredWidth(-1);
}
- int[] columnWidthsLocal = getColumnWidths(width);
+ int[] columnWidthsLocal = getColumnWidths(widthUpdated);
// First, we calculate the base heights of the rows, giving relative
// rows their preferred height
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java Tue Feb 26 15:11:37 2013
@@ -318,14 +318,14 @@ public class TextPaneSkin extends Contai
if (documentView == null) {
offset = -1;
} else {
- x = Math.min(documentView.getWidth() - 1, Math.max(x - margin.left, 0));
+ int xUpdated = Math.min(documentView.getWidth() - 1, Math.max(x - margin.left, 0));
if (y < margin.top) {
- offset = documentView.getNextInsertionPoint(x, -1, TextPane.ScrollDirection.DOWN);
+ offset = documentView.getNextInsertionPoint(xUpdated, -1, TextPane.ScrollDirection.DOWN);
} else if (y > documentView.getHeight() + margin.top) {
- offset = documentView.getNextInsertionPoint(x, -1, TextPane.ScrollDirection.UP);
+ offset = documentView.getNextInsertionPoint(xUpdated, -1, TextPane.ScrollDirection.UP);
} else {
- offset = documentView.getInsertionPoint(x, y - margin.top);
+ offset = documentView.getInsertionPoint(xUpdated, y - margin.top);
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java Tue Feb 26 15:11:37 2013
@@ -51,13 +51,14 @@ class TextPaneSkinNumberedListView exten
};
private static String int2roman(int n) {
+ int num = n;
StringBuffer result = new StringBuffer(10);
// ... Start with largest value, and work toward smallest.
for (RomanValue equiv : ROMAN_VALUE_TABLE) {
// ... Remove as many of this value as possible (maybe none).
- while (n >= equiv.integerVal) {
- n -= equiv.integerVal;
+ while (num >= equiv.integerVal) {
+ num -= equiv.integerVal;
result.append(equiv.romanNumeral);
}
}
Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/text/Paragraph.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/text/Paragraph.java?rev=1450207&r1=1450206&r2=1450207&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/text/Paragraph.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/text/Paragraph.java Tue Feb 26 15:11:37 2013
@@ -41,7 +41,7 @@ public class Paragraph extends Block {
@Override
public Node removeRange(int offset, int characterCount) {
if (offset + characterCount == getCharacterCount()) {
- characterCount--;
+ return super.removeRange(offset, characterCount - 1);
}
return super.removeRange(offset, characterCount);
@@ -50,7 +50,7 @@ public class Paragraph extends Block {
@Override
public Paragraph getRange(int offset, int characterCount) {
if (offset + characterCount == getCharacterCount()) {
- characterCount--;
+ return (Paragraph) super.getRange(offset, characterCount - 1);
}
return (Paragraph) super.getRange(offset, characterCount);