You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/06/15 20:31:55 UTC
svn commit: r784901 - in /incubator/pivot/trunk:
core/src/org/apache/pivot/collections/adapter/
core/src/org/apache/pivot/io/ core/src/org/apache/pivot/util/
demos/src/org/apache/pivot/demos/dnd/
tutorials/src/org/apache/pivot/tutorials/stocktracker/ t...
Author: gbrown
Date: Mon Jun 15 18:31:54 2009
New Revision: 784901
URL: http://svn.apache.org/viewvc?rev=784901&view=rev
Log:
Eliminate unnecessary cast warnings; remove FileList#add(Folder) method, since it can't reliably be used to add Files that are directories (this can be done in app code).
Modified:
incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
incubator/pivot/trunk/core/src/org/apache/pivot/io/FileList.java
incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java
incubator/pivot/trunk/demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuoteView.java
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/CollapseTransition.java
incubator/pivot/trunk/web/src/org/apache/pivot/web/server/ProxyServlet.java
incubator/pivot/trunk/web/test/org/apache/pivot/web/test/QueryDictionaryTest.java
incubator/pivot/trunk/web/test/org/apache/pivot/web/test/server/WebQueryTestServlet.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewNumberCellRenderer.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/CubicCurve.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Line.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Path.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/QuadCurve.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Text.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java Mon Jun 15 18:31:54 2009
@@ -110,7 +110,7 @@
public Sequence<T> remove(int index, int count) {
java.util.List<T> removedList = null;
try {
- removedList = (java.util.List<T>)list.getClass().newInstance();
+ removedList = list.getClass().newInstance();
} catch(IllegalAccessException exception) {
} catch(InstantiationException exception) {
}
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/io/FileList.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/io/FileList.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/io/FileList.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/io/FileList.java Mon Jun 15 18:31:54 2009
@@ -61,18 +61,6 @@
return index;
}
- public int add(Folder folder) {
- for (File file : folder) {
- if (file instanceof Folder) {
- add((Folder)file);
- } else {
- add(file);
- }
- }
-
- return -1;
- }
-
@Override
public void insert(File file, int index) {
throw new UnsupportedOperationException();
Modified: incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java (original)
+++ incubator/pivot/trunk/core/src/org/apache/pivot/util/Version.java Mon Jun 15 18:31:54 2009
@@ -87,10 +87,10 @@
}
public int getNumber() {
- int number = (((int)majorRevision) & 0xff) << (8 * 3)
- | (((int)minorRevision) & 0xff) << (8 * 2)
- | (((int)maintenanceRevision) & 0xff) << (8 * 1)
- | (((int)updateRevision) & 0xff) << (8 * 0);
+ int number = ((majorRevision) & 0xff) << (8 * 3)
+ | ((minorRevision) & 0xff) << (8 * 2)
+ | ((maintenanceRevision) & 0xff) << (8 * 1)
+ | ((updateRevision) & 0xff) << (8 * 0);
return number;
}
Modified: incubator/pivot/trunk/demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java (original)
+++ incubator/pivot/trunk/demos/src/org/apache/pivot/demos/dnd/FileDropTargetDemo.java Mon Jun 15 18:31:54 2009
@@ -24,7 +24,6 @@
import org.apache.pivot.collections.ListListener;
import org.apache.pivot.collections.Sequence;
import org.apache.pivot.io.FileList;
-import org.apache.pivot.io.Folder;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.Button;
import org.apache.pivot.wtk.ButtonPressListener;
@@ -131,11 +130,11 @@
FileList tableData = (FileList)fileTableView.getTableData();
FileList fileList = dragContent.getFileList();
for (File file : fileList) {
- if (file instanceof Folder) {
- tableData.add((Folder)file);
- } else {
- tableData.add(file);
+ if (file.isDirectory()) {
+ // TODO Expand recursively
}
+
+ tableData.add(file);
}
dropAction = DropAction.COPY;
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuoteView.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuoteView.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuoteView.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/stocktracker/StockQuoteView.java Mon Jun 15 18:31:54 2009
@@ -58,13 +58,13 @@
}
} else if (key.equals("change")) {
try {
- value = changeFormat.format((Number)value);
+ value = changeFormat.format(value);
} catch(Exception exception) {
value = "";
}
} else if (key.equals("volume")) {
try {
- value = volumeFormat.format((Number)value);
+ value = volumeFormat.format(value);
} catch(Exception exception) {
value = "";
}
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/CollapseTransition.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/CollapseTransition.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/CollapseTransition.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/transition/CollapseTransition.java Mon Jun 15 18:31:54 2009
@@ -56,10 +56,9 @@
if (percentComplete < 1.0f) {
int duration = getDuration();
-
- int width = (int)((float)initialWidth * (1.0f - percentComplete));
-
+ int width = (int)(initialWidth * (1.0f - percentComplete));
width = (int)easing.easeInOut(getElapsedTime(), initialWidth, width - initialWidth, duration);
+
component.setPreferredWidth(width);
fadeDecorator.setOpacity(1.0f - percentComplete);
Modified: incubator/pivot/trunk/web/src/org/apache/pivot/web/server/ProxyServlet.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/src/org/apache/pivot/web/server/ProxyServlet.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/web/src/org/apache/pivot/web/server/ProxyServlet.java (original)
+++ incubator/pivot/trunk/web/src/org/apache/pivot/web/server/ProxyServlet.java Mon Jun 15 18:31:54 2009
@@ -146,14 +146,12 @@
connection.setUseCaches(false);
// Write request headers to connection
- Enumeration<String> headerNames = (Enumeration<String>)request.getHeaderNames();
+ Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
-
- Enumeration<String> headerValues =
- (Enumeration<String>)request.getHeaders(headerName);
+ Enumeration<String> headerValues = request.getHeaders(headerName);
while (headerValues.hasMoreElements()) {
String headerValue = headerValues.nextElement();
Modified: incubator/pivot/trunk/web/test/org/apache/pivot/web/test/QueryDictionaryTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/test/org/apache/pivot/web/test/QueryDictionaryTest.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/web/test/org/apache/pivot/web/test/QueryDictionaryTest.java (original)
+++ incubator/pivot/trunk/web/test/org/apache/pivot/web/test/QueryDictionaryTest.java Mon Jun 15 18:31:54 2009
@@ -76,7 +76,7 @@
validKeys.add("key2");
validKeys.add("key3");
- for (String s : (Iterable<String>) dict) {
+ for (String s : dict) {
assertTrue(s, validKeys.remove(s));
}
Modified: incubator/pivot/trunk/web/test/org/apache/pivot/web/test/server/WebQueryTestServlet.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/web/test/org/apache/pivot/web/test/server/WebQueryTestServlet.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/web/test/org/apache/pivot/web/test/server/WebQueryTestServlet.java (original)
+++ incubator/pivot/trunk/web/test/org/apache/pivot/web/test/server/WebQueryTestServlet.java Mon Jun 15 18:31:54 2009
@@ -70,7 +70,7 @@
// Dump headers
System.out.println("[Request Headers]");
- Enumeration<String> headerNames = (Enumeration<String>)request.getHeaderNames();
+ Enumeration<String> headerNames = request.getHeaderNames();
while(headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
System.out.print(headerName + "=");
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java Mon Jun 15 18:31:54 2009
@@ -209,7 +209,7 @@
}
rgb = Integer.parseInt(value.substring(0, 6), 16);
- alpha = (float)Integer.parseInt(value.substring(6, 8), 16) / 255f;
+ alpha = Integer.parseInt(value.substring(6, 8), 16) / 255f;
} else if (value.startsWith("#")) {
value = value.substring(1);
if (value.length() != 6) {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Theme.java Mon Jun 15 18:31:54 2009
@@ -126,8 +126,7 @@
for (Integer handle : componentHandles) {
Component component = components.get(handle);
- Class<? extends Component> componentClass =
- (Class<? extends Component>)component.getClass();
+ Class<? extends Component> componentClass = component.getClass();
if (theme.componentSkinMap.containsKey(componentClass)
&& (componentClass.getEnclosingClass() == null
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewNumberCellRenderer.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewNumberCellRenderer.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewNumberCellRenderer.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewNumberCellRenderer.java Mon Jun 15 18:31:54 2009
@@ -80,7 +80,7 @@
Object cellData = rowData.get(columnName);
if (cellData instanceof Number) {
- formattedNumber = numberFormat.format((Number)cellData);
+ formattedNumber = numberFormat.format(cellData);
} else {
System.err.println("Data for \"" + columnName + "\" is not an instance of "
+ Number.class.getName());
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java Mon Jun 15 18:31:54 2009
@@ -158,7 +158,7 @@
* The transition interval, in milliseconds.
*/
public int getInterval() {
- return (int)((1f / (float)rate) * 1000);
+ return (int)((1f / rate) * 1000);
}
/**
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/CubicCurve.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/CubicCurve.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/CubicCurve.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/CubicCurve.java Mon Jun 15 18:31:54 2009
@@ -180,7 +180,7 @@
if (!isValid()) {
// Over-estimate the bounds to keep the logic simple
int strokeThickness = getStrokeThickness();
- double radius = ((double)strokeThickness/Math.cos(Math.PI / 4)) / 2;
+ double radius = (strokeThickness / Math.cos(Math.PI / 4)) / 2;
Rectangle2D boundingRectangle = cubicCurve2D.getBounds2D();
setBounds((int)Math.floor(boundingRectangle.getX() - radius),
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Line.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Line.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Line.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Line.java Mon Jun 15 18:31:54 2009
@@ -136,7 +136,7 @@
if (!isValid()) {
// Over-estimate the bounds to keep the logic simple
int strokeThickness = getStrokeThickness();
- double radius = ((double)strokeThickness/Math.cos(Math.PI / 4)) / 2;
+ double radius = (strokeThickness / Math.cos(Math.PI / 4)) / 2;
double top = Math.min(line2D.y1, line2D.y2);
double left = Math.min(line2D.x1, line2D.x2);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Path.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Path.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Path.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Path.java Mon Jun 15 18:31:54 2009
@@ -702,7 +702,7 @@
// Over-estimate the bounds to keep the logic simple
int strokeThickness = getStrokeThickness();
- double radius = ((double)strokeThickness/Math.cos(Math.PI / 4)) / 2;
+ double radius = (strokeThickness / Math.cos(Math.PI / 4)) / 2;
Rectangle2D bounds = generalPath.getBounds2D();
setBounds((int)Math.floor(bounds.getX() - radius),
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/QuadCurve.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/QuadCurve.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/QuadCurve.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/QuadCurve.java Mon Jun 15 18:31:54 2009
@@ -158,7 +158,7 @@
if (!isValid()) {
// Over-estimate the bounds to keep the logic simple
int strokeThickness = getStrokeThickness();
- double radius = ((double)strokeThickness/Math.cos(Math.PI / 4)) / 2;
+ double radius = (strokeThickness / Math.cos(Math.PI / 4)) / 2;
Rectangle2D boundingRectangle = quadCurve2D.getBounds2D();
setBounds((int)Math.floor(boundingRectangle.getX() - radius),
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Text.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Text.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Text.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/drawing/Text.java Mon Jun 15 18:31:54 2009
@@ -245,12 +245,12 @@
}
case RIGHT: {
- x = (float)bounds.width - (float)(lineBounds.getX() + lineBounds.getWidth());
+ x = bounds.width - (float)(lineBounds.getX() + lineBounds.getWidth());
break;
}
case CENTER: {
- x = ((float)bounds.width - (float)(lineBounds.getX() + lineBounds.getWidth())) / 2f;
+ x = (bounds.width - (float)(lineBounds.getX() + lineBounds.getWidth())) / 2f;
break;
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java Mon Jun 15 18:31:54 2009
@@ -248,7 +248,7 @@
// Note that we add one pixel to the string bounds for spacing
Rectangle2D titleBounds = font.getStringBounds(title, fontRenderContext);
- titleBounds = new Rectangle2D.Double((double)(padding.left + thickness),
+ titleBounds = new Rectangle2D.Double(padding.left + thickness,
(topThickness - titleBounds.getHeight()) / 2,
titleBounds.getWidth() + 1, titleBounds.getHeight());
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java Mon Jun 15 18:31:54 2009
@@ -175,8 +175,8 @@
float percentComplete = slideEasing.easeOut(getElapsedTime(), 0, 1, getDuration());
- int dx = (int)((float)width * percentComplete) * direction;
- int dy = (int)((float)height * percentComplete) * direction;
+ int dx = (int)(width * percentComplete) * direction;
+ int dy = (int)(height * percentComplete) * direction;
if (selectionChangeEffect == SelectionChangeEffect.HORIZONTAL_SLIDE) {
fromCard.setLocation(dx, 0);
@@ -285,8 +285,8 @@
height = toSize.height;
}
- int preferredWidth = previousWidth + (int)((float)(width - previousWidth) * percentComplete);
- int preferredHeight = previousHeight + (int)((float)(height - previousHeight) * percentComplete);
+ int preferredWidth = previousWidth + (int)((width - previousWidth) * percentComplete);
+ int preferredHeight = previousHeight + (int)((height - previousHeight) * percentComplete);
preferredSize = new Dimensions(preferredWidth, preferredHeight);
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java Mon Jun 15 18:31:54 2009
@@ -127,8 +127,8 @@
double heightScale = (double)preferredHeight
/ (double)totalPreferredHeight;
- componentHeight = (int)Math.round((double)(height
- - totalSpacing) * heightScale);
+ componentHeight = (int)Math.round((height - totalSpacing)
+ * heightScale);
} else {
componentHeight = 0;
}
@@ -219,8 +219,8 @@
double widthScale = (double)preferredWidth
/ (double)totalPreferredWidth;
- componentWidth = (int)Math.round((double)(width
- - totalSpacing) * widthScale);
+ componentWidth = (int)Math.round((width - totalSpacing)
+ * widthScale);
}
}
@@ -367,7 +367,7 @@
double widthScale = ((double)(width - fixedWidth)
/ (double)(preferredWidth - fixedWidth));
- componentWidth = (int)Math.max(Math.round((double)component.getPreferredWidth(-1)
+ componentWidth = (int)Math.max(Math.round(component.getPreferredWidth(-1)
* widthScale), 0);
if (verticalAlignment == VerticalAlignment.JUSTIFY) {
@@ -481,7 +481,7 @@
double heightScale = (double)(height - fixedHeight)
/ (double)(preferredHeight - fixedHeight);
- componentHeight = (int)Math.max(Math.round((double)component.getPreferredHeight(-1)
+ componentHeight = (int)Math.max(Math.round(component.getPreferredHeight(-1)
* heightScale), 0);
if (horizontalAlignment == HorizontalAlignment.JUSTIFY) {
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ImageViewSkin.java Mon Jun 15 18:31:54 2009
@@ -63,10 +63,10 @@
public void regionUpdated(Image image, int x, int y, int width, int height) {
// TODO A rounding error is causing an off-by-one error; we're
// accounting for it here by adding 1 to width and height
- Bounds bounds = new Bounds(imageX + (int)Math.floor(((float)x * scaleX)),
- imageY + (int)Math.floor((float)y * scaleY),
- (int)Math.ceil((float)width * scaleX) + 1,
- (int)Math.ceil((float)height * scaleY) + 1);
+ Bounds bounds = new Bounds(imageX + (int)Math.floor(x * scaleX),
+ imageY + (int)Math.floor(y * scaleY),
+ (int)Math.ceil(width * scaleX) + 1,
+ (int)Math.ceil(height * scaleY) + 1);
repaintComponent(bounds);
}
};
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java Mon Jun 15 18:31:54 2009
@@ -567,12 +567,12 @@
if (horizontalSpacing > 1) {
columnWidth += horizontalSpacing - 1;
- columnX -= (int)(((float)horizontalSpacing * 0.5f) - 0.5f);
+ columnX -= (int)((horizontalSpacing * 0.5f) - 0.5f);
}
if (verticalSpacing > 1) {
rowHeight += verticalSpacing - 1;
- rowY -= (int)(((float)verticalSpacing * 0.5f) - 0.5f);
+ rowY -= (int)((verticalSpacing * 0.5f) - 0.5f);
}
Rectangle2D.Float bounds = new Rectangle2D.Float(columnX, rowY,
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java Mon Jun 15 18:31:54 2009
@@ -485,7 +485,7 @@
if (panel == selectionChangeTransition.fromPanel) {
panel.setLocation(padding.left + 1, panelY + padding.top);
- int previousSelectedPanelHeight = Math.round((float)panelHeight * (1.0f
+ int previousSelectedPanelHeight = Math.round(panelHeight * (1.0f
- selectionChangeTransition.getEasedPercentComplete()));
previousSelectedPanelClipDecorator.setWidth(contentWidth);
previousSelectedPanelClipDecorator.setHeight(previousSelectedPanelHeight);
@@ -496,7 +496,7 @@
if (panel == selectionChangeTransition.toPanel) {
panel.setLocation(padding.left + 1, panelY + padding.top);
- int selectedPanelHeight = Math.round((float)panelHeight
+ int selectedPanelHeight = Math.round(panelHeight
* selectionChangeTransition.getEasedPercentComplete());
selectedPanelClipDecorator.setWidth(contentWidth);
selectedPanelClipDecorator.setHeight(selectedPanelHeight);
@@ -744,7 +744,7 @@
button.setSelected(false);
}
} else {
- Button button = (Button)panelHeaders.get(selectedIndex);
+ Button button = panelHeaders.get(selectedIndex);
button.setSelected(true);
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraActivityIndicatorSkin.java Mon Jun 15 18:31:54 2009
@@ -72,12 +72,12 @@
if (width > height) {
graphics.translate((width - height) / 2, 0);
- float scale = (float)height / 128f;
+ float scale = height / 128f;
graphics.scale(scale, scale);
} else {
graphics.translate(0, (height - width) / 2);
- float scale = (float)width / 128f;
+ float scale = width / 128f;
graphics.scale(scale, scale);
}
@@ -106,7 +106,7 @@
colors = new Color[12];
for (int i = 0; i < 12; i++) {
- float alpha = 255f * (float)i / 12;
+ float alpha = 255f * i / 12;
colors[i] = new Color(color.getRed(), color.getGreen(), color.getBlue(), (int)alpha);
}
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java Mon Jun 15 18:31:54 2009
@@ -336,7 +336,7 @@
+ content.getPreferredHeight(contentWidth));
} else {
float scale = expandTransition.getScale();
- preferredHeight += (int)(scale * (float)(padding.top + padding.bottom
+ preferredHeight += (int)(scale * (padding.top + padding.bottom
+ content.getPreferredHeight(contentWidth)));
}
}
@@ -372,7 +372,7 @@
preferredHeight += (padding.top + padding.bottom + contentSize.height);
} else {
float scale = expandTransition.getScale();
- preferredHeight += (int)(scale * (float)(padding.top + padding.bottom
+ preferredHeight += (int)(scale * (padding.top + padding.bottom
+ contentSize.height));
}
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraPushButtonSkin.java Mon Jun 15 18:31:54 2009
@@ -102,7 +102,7 @@
if (!Float.isNaN(preferredAspectRatio)
&& preferredAspectRatio >= 1
&& (float)preferredWidth / (float)height < preferredAspectRatio) {
- preferredWidth = (int)((float)height * preferredAspectRatio);
+ preferredWidth = (int)(height * preferredAspectRatio);
}
}
@@ -134,7 +134,7 @@
if (!Float.isNaN(preferredAspectRatio)
&& preferredAspectRatio >= 1
&& (float)width / (float)preferredHeight < preferredAspectRatio) {
- preferredHeight = (int)((float)width / preferredAspectRatio);
+ preferredHeight = (int)(width / preferredAspectRatio);
}
}
@@ -159,11 +159,11 @@
if (!Float.isNaN(preferredAspectRatio)) {
if (preferredAspectRatio >= 1) {
if ((float)preferredWidth / (float)preferredHeight < preferredAspectRatio) {
- preferredWidth = (int)((float)preferredHeight * preferredAspectRatio);
+ preferredWidth = (int)(preferredHeight * preferredAspectRatio);
}
} else {
if ((float)preferredWidth / (float)preferredHeight > preferredAspectRatio) {
- preferredHeight = (int)((float)preferredWidth / preferredAspectRatio);
+ preferredHeight = (int)(preferredWidth / preferredAspectRatio);
}
}
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraScrollBarSkin.java Mon Jun 15 18:31:54 2009
@@ -369,13 +369,13 @@
GeneralPath arrow = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- arrow.moveTo((float)width + 0.5f, 0);
- arrow.lineTo(0, (float)height / 2.0f);
- arrow.lineTo((float)width + 0.5f, height);
+ arrow.moveTo(width + 0.5f, 0);
+ arrow.lineTo(0, height / 2.0f);
+ arrow.lineTo(width + 0.5f, height);
} else {
- arrow.moveTo(0, (float)height + 0.5f);
- arrow.lineTo((float)width / 2.0f, 0);
- arrow.lineTo(width, (float)height + 0.5f);
+ arrow.moveTo(0, height + 0.5f);
+ arrow.lineTo(width / 2.0f, 0);
+ arrow.lineTo(width, height + 0.5f);
}
arrow.closePath();
@@ -399,11 +399,11 @@
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
arrow.moveTo(0, 0);
- arrow.lineTo((float)width + 0.5f, (float)height / 2.0f);
+ arrow.lineTo(width + 0.5f, height / 2.0f);
arrow.lineTo(0, height);
} else {
arrow.moveTo(0, 0);
- arrow.lineTo((float)width / 2.0f, (float)height + 0.5f);
+ arrow.lineTo(width / 2.0f, height + 0.5f);
arrow.lineTo(width, 0);
}
@@ -541,7 +541,7 @@
pixelValue = component.getY() - scrollUpButton.getHeight() + y - dragOffset;
}
- int realValue = (int)((float)pixelValue / getValueScale());
+ int realValue = (int)(pixelValue / getValueScale());
// Bound the value
int rangeEnd = scrollBar.getRangeEnd();
@@ -718,13 +718,13 @@
int availableWidth = width - scrollUpButton.getWidth() -
scrollDownButton.getWidth() + 2;
int handleWidth = Math.max(minimumHandleLength,
- Math.round(extentPercentage * (float)availableWidth));
+ Math.round(extentPercentage * availableWidth));
// Calculate the position of the handle by calculating the
// scale that maps logical value to pixel value
int numLegalPixelValues = availableWidth - handleWidth + 1;
float valueScale = (float)numLegalPixelValues / (float)numLegalRealValues;
- int handleX = (int)((float)value * valueScale) +
+ int handleX = (int)(value * valueScale) +
scrollUpButton.getWidth() - 1;
if (handleWidth > availableWidth) {
@@ -754,13 +754,13 @@
int availableHeight = height - scrollUpButton.getHeight() -
scrollDownButton.getHeight() + 2;
int handleHeight = Math.max(minimumHandleLength,
- Math.round(extentPercentage * (float)availableHeight));
+ Math.round(extentPercentage * availableHeight));
// Calculate the position of the handle by calculating the
// scale maps logical value to pixel value
int numLegalPixelValues = availableHeight - handleHeight + 1;
float valueScale = (float)numLegalPixelValues / (float)numLegalRealValues;
- int handleY = (int)((float)value * valueScale) +
+ int handleY = (int)(value * valueScale) +
scrollUpButton.getHeight() - 1;
if (handleHeight > availableHeight) {
@@ -1049,7 +1049,7 @@
pixelStopValue -= handle.getWidth();
}
- realStopValue = (int)((float)pixelStopValue / getValueScale());
+ realStopValue = (int)(pixelStopValue / getValueScale());
} else {
direction = y < handle.getY() ? -1 : 1;
@@ -1062,7 +1062,7 @@
pixelStopValue -= handle.getHeight();
}
- realStopValue = (int)((float)pixelStopValue / getValueScale());
+ realStopValue = (int)(pixelStopValue / getValueScale());
}
// Start the automatic scroller
@@ -1239,12 +1239,12 @@
int value = scrollBar.getValue();
if (scrollBar.getOrientation() == Orientation.HORIZONTAL) {
- int handleX = (int)((float)value * getValueScale()) +
+ int handleX = (int)(value * getValueScale()) +
scrollUpButton.getWidth() - 1;
handle.setLocation(handleX, 0);
} else {
- int handleY = (int)((float)value * getValueScale()) +
+ int handleY = (int)(value * getValueScale()) +
scrollUpButton.getHeight() - 1;
handle.setLocation(0, handleY);
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java Mon Jun 15 18:31:54 2009
@@ -127,7 +127,7 @@
int minimum = slider.getMinimum();
int maximum = slider.getMaximum();
- int value = (int)(minimum + (float)(maximum - minimum) * ratio);
+ int value = (int)(minimum + (maximum - minimum) * ratio);
slider.setValue(value);
}
@@ -250,7 +250,7 @@
float ratio = (float)(value - minimum) / (maximum - minimum);
thumb.setSize(thumbWidth, thumbHeight);
- thumb.setLocation((int)((float)(width - thumbWidth) * ratio),
+ thumb.setLocation((int)((width - thumbWidth) * ratio),
(height - thumbHeight) / 2);
}
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java Mon Jun 15 18:31:54 2009
@@ -506,7 +506,7 @@
if (selectionChangeTransition != null) {
float scale = selectionChangeTransition.getScale();
- preferredWidth = (int)((float)preferredWidth * scale);
+ preferredWidth = (int)(preferredWidth * scale);
}
preferredWidth += 2;
@@ -549,7 +549,7 @@
if (selectionChangeTransition != null) {
float scale = selectionChangeTransition.getScale();
- preferredHeight = (int)((float)preferredHeight * scale);
+ preferredHeight = (int)(preferredHeight * scale);
}
preferredHeight += 2;
@@ -618,7 +618,7 @@
if (selectionChangeTransition != null) {
float scale = selectionChangeTransition.getScale();
- preferredHeight = (int)((float)preferredHeight * scale);
+ preferredHeight = (int)(preferredHeight * scale);
}
preferredHeight += 2;
@@ -652,7 +652,7 @@
if (selectionChangeTransition != null) {
float scale = selectionChangeTransition.getScale();
- preferredWidth = (int)((float)preferredWidth * scale);
+ preferredWidth = (int)(preferredWidth * scale);
}
preferredWidth += 2;
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java?rev=784901&r1=784900&r2=784901&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtkx/Translator.java Mon Jun 15 18:31:54 2009
@@ -445,7 +445,7 @@
("Root node must represent a typed object.");
}
- Class<?> type = (Class<?>)element.clazz;
+ Class<?> type = element.clazz;
if (BeanDictionary.isReadOnly(type, localName)) {
Class<?> valueType = BeanDictionary.getType(type, localName);
@@ -486,7 +486,7 @@
// If the element's parent is a sequence or a listener list, add
// the element value to it
if (element.parent != null) {
- Class<?> parentType = (Class<?>)element.parent.clazz;
+ Class<?> parentType = element.parent.clazz;
if (parentType != null
&& (Sequence.class.isAssignableFrom(parentType)
@@ -528,8 +528,8 @@
switch (element.type) {
case WRITABLE_PROPERTY: {
- Class<?> type = (Class<?>)element.clazz;
- Class<?> parentType = (Class<?>)element.parent.clazz;
+ Class<?> type = element.clazz;
+ Class<?> parentType = element.parent.clazz;
Method setterMethod = BeanDictionary.getSetterMethod(parentType, localName, type);
writer.format(
@@ -544,7 +544,7 @@
}
default: {
- Class<?> type = (Class<?>)element.clazz;
+ Class<?> type = element.clazz;
if (type != null && Dictionary.class.isAssignableFrom(type)) {
// The element is an untyped object