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/10/05 01:45:53 UTC
svn commit: r1529349 [38/44] - in /pivot/trunk:
charts/src/org/apache/pivot/charts/
charts/src/org/apache/pivot/charts/skin/ core/src/org/apache/pivot/beans/
core/src/org/apache/pivot/collections/
core/src/org/apache/pivot/collections/adapter/ core/src...
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/DropShadowDecorator.java Fri Oct 4 23:45:40 2013
@@ -55,9 +55,8 @@ public class DropShadowDecorator impleme
/**
* Returns the color used to draw the shadow.
- *
- * @return
- * The color used to draw the shadow.
+ *
+ * @return The color used to draw the shadow.
*/
public Color getShadowColor() {
return shadowColor;
@@ -65,9 +64,8 @@ public class DropShadowDecorator impleme
/**
* Sets the color used to draw the shadow.
- *
- * @param shadowColor
- * The color used to draw the shadow.
+ *
+ * @param shadowColor The color used to draw the shadow.
*/
public void setShadowColor(Color shadowColor) {
this.shadowColor = shadowColor;
@@ -75,10 +73,10 @@ public class DropShadowDecorator impleme
/**
* Sets the color used to draw the shadow.
- *
- * @param shadowColor
- * The color used to draw the shadow, which can be any of the
- * {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ *
+ * @param shadowColor The color used to draw the shadow, which can be any of
+ * the {@linkplain GraphicsUtilities#decodeColor color values recognized by
+ * Pivot}.
*/
public final void setShadowColor(String shadowColor) {
if (shadowColor == null) {
@@ -90,9 +88,8 @@ public class DropShadowDecorator impleme
/**
* Returns the opacity used to draw the shadow.
- *
- * @return
- * The color used to draw the shadow.
+ *
+ * @return The color used to draw the shadow.
*/
public float getShadowOpacity() {
return shadowOpacity;
@@ -100,9 +97,8 @@ public class DropShadowDecorator impleme
/**
* Sets the opacity used to draw the shadow.
- *
- * @param shadowOpacity
- * The opacity used to draw the shadow.
+ *
+ * @param shadowOpacity The opacity used to draw the shadow.
*/
public void setShadowOpacity(float shadowOpacity) {
this.shadowOpacity = shadowOpacity;
@@ -110,9 +106,8 @@ public class DropShadowDecorator impleme
/**
* Returns the blur radius used to draw the shadow.
- *
- * @return
- * The blur radius used to draw the shadow.
+ *
+ * @return The blur radius used to draw the shadow.
*/
public int getBlurRadius() {
return blurRadius;
@@ -120,9 +115,8 @@ public class DropShadowDecorator impleme
/**
* Sets the blur radius used to draw the shadow.
- *
- * @param blurRadius
- * The blur radius used to draw the shadow.
+ *
+ * @param blurRadius The blur radius used to draw the shadow.
*/
public void setBlurRadius(int blurRadius) {
this.blurRadius = blurRadius;
@@ -130,9 +124,8 @@ public class DropShadowDecorator impleme
/**
* Returns the amount that the drop shadow will be offset along the x axis.
- *
- * @return
- * The x offset used to draw the shadow
+ *
+ * @return The x offset used to draw the shadow
*/
public int getXOffset() {
return xOffset;
@@ -140,9 +133,8 @@ public class DropShadowDecorator impleme
/**
* Sets the amount that the drop shadow will be offset along the x axis.
- *
- * @param xOffset
- * The x offset used to draw the shadow
+ *
+ * @param xOffset The x offset used to draw the shadow
*/
public void setXOffset(int xOffset) {
this.xOffset = xOffset;
@@ -150,9 +142,8 @@ public class DropShadowDecorator impleme
/**
* Returns the amount that the drop shadow will be offset along the y axis.
- *
- * @return
- * The y offset used to draw the shadow
+ *
+ * @return The y offset used to draw the shadow
*/
public int getYOffset() {
return yOffset;
@@ -160,9 +151,8 @@ public class DropShadowDecorator impleme
/**
* Sets the amount that the drop shadow will be offset along the y axis.
- *
- * @param yOffset
- * The y offset used to draw the shadow
+ *
+ * @param yOffset The y offset used to draw the shadow
*/
public void setYOffset(int yOffset) {
this.yOffset = yOffset;
@@ -173,13 +163,12 @@ public class DropShadowDecorator impleme
int width = component.getWidth();
int height = component.getHeight();
- if (width > 0
- && height > 0) {
- if (shadowImage == null
- || shadowImage.getWidth() != width + 2 * blurRadius
+ if (width > 0 && height > 0) {
+ if (shadowImage == null || shadowImage.getWidth() != width + 2 * blurRadius
|| shadowImage.getHeight() != height + 2 * blurRadius) {
// Recreate the shadow
- BufferedImage rectangleImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
+ BufferedImage rectangleImage = new BufferedImage(width, height,
+ BufferedImage.TYPE_INT_ARGB);
Graphics2D rectangleImageGraphics = rectangleImage.createGraphics();
rectangleImageGraphics.setColor(Color.BLACK);
rectangleImageGraphics.fillRect(0, 0, width, height);
@@ -187,9 +176,11 @@ public class DropShadowDecorator impleme
shadowImage = createShadow(rectangleImage);
}
- // Avoid drawing shadow if it will be covered by the component itself:
+ // Avoid drawing shadow if it will be covered by the component
+ // itself:
Bounds paintBounds = new Bounds(0, 0, width, height);
- if (!component.isOpaque() || !paintBounds.contains(new Bounds(graphics.getClipBounds())))
+ if (!component.isOpaque()
+ || !paintBounds.contains(new Bounds(graphics.getClipBounds())))
graphics.drawImage(shadowImage, xOffset - blurRadius, yOffset - blurRadius, null);
} else {
shadowImage = null;
@@ -205,9 +196,8 @@ public class DropShadowDecorator impleme
@Override
public Bounds getBounds(Component component) {
- return new Bounds(xOffset - blurRadius, yOffset - blurRadius,
- component.getWidth() + blurRadius * 2,
- component.getHeight() + blurRadius * 2);
+ return new Bounds(xOffset - blurRadius, yOffset - blurRadius, component.getWidth()
+ + blurRadius * 2, component.getHeight() + blurRadius * 2);
}
@Override
@@ -218,17 +208,11 @@ public class DropShadowDecorator impleme
/**
* Generates the shadow for a given picture and the current properties of
* the decorator. The generated image dimensions are computed as follows:
- *
- * <pre>
- * width = imageWidth + 2 * blurRadius
- * height = imageHeight + 2 * blurRadius
- * </pre>
- *
- * @param src
- * The image from which the shadow will be cast.
- *
- * @return
- * An image containing the generated shadow.
+ * <pre> width = imageWidth + 2 * blurRadius height = imageHeight + 2 *
+ * blurRadius </pre>
+ *
+ * @param src The image from which the shadow will be cast.
+ * @return An image containing the generated shadow.
*/
private BufferedImage createShadow(BufferedImage src) {
int shadowSize = blurRadius * 2;
@@ -251,8 +235,8 @@ public class DropShadowDecorator impleme
int aSum;
Graphics2D srcGraphics = src.createGraphics();
- BufferedImage dst = srcGraphics.getDeviceConfiguration()
- .createCompatibleImage(dstWidth, dstHeight, Transparency.TRANSLUCENT);
+ BufferedImage dst = srcGraphics.getDeviceConfiguration().createCompatibleImage(dstWidth,
+ dstHeight, Transparency.TRANSLUCENT);
srcGraphics.dispose();
int[] dstBuffer = new int[dstWidth * dstHeight];
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/FadeDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/FadeDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/FadeDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/FadeDecorator.java Fri Oct 4 23:45:40 2013
@@ -23,7 +23,6 @@ import java.awt.geom.AffineTransform;
import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Component;
-
/**
* Decorator that applies an opacity to a component.
*/
@@ -43,9 +42,9 @@ public class FadeDecorator implements De
}
public void setOpacity(float opacity) {
- if (opacity < 0f
- || opacity > 1f) {
- throw new IllegalArgumentException("opacity must be a value between 0 and 1, inclusive.");
+ if (opacity < 0f || opacity > 1f) {
+ throw new IllegalArgumentException(
+ "opacity must be a value between 0 and 1, inclusive.");
}
this.opacity = opacity;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/GrayscaleDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/GrayscaleDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/GrayscaleDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/GrayscaleDecorator.java Fri Oct 4 23:45:40 2013
@@ -44,7 +44,8 @@ public class GrayscaleDecorator implemen
int width = component.getWidth();
int height = component.getHeight();
- /* To convert to gray, we create a BufferedImage in the grayscale color
+ /*
+ * To convert to gray, we create a BufferedImage in the grayscale color
* space into which the decorated component draws, and we output the
* resulting image. The naive way to create the buffer is new
* BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); but that
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/OverlayDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/OverlayDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/OverlayDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/OverlayDecorator.java Fri Oct 4 23:45:40 2013
@@ -23,8 +23,8 @@ import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Component;
/**
- * Decorator that overlays a component on top of another component. The
- * overlay component is strictly visual and does not respond to user input.
+ * Decorator that overlays a component on top of another component. The overlay
+ * component is strictly visual and does not respond to user input.
*/
public class OverlayDecorator implements Decorator {
private Component overlay;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ReflectionDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ReflectionDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ReflectionDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ReflectionDecorator.java Fri Oct 4 23:45:40 2013
@@ -26,11 +26,9 @@ import java.awt.image.BufferedImage;
import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Component;
-
/**
- * Decorator that paints a reflection of a component.
- * <p>
- * TODO Make gradient properties configurable.
+ * Decorator that paints a reflection of a component. <p> TODO Make gradient
+ * properties configurable.
*/
public class ReflectionDecorator implements Decorator {
private Component component = null;
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/RotationDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/RotationDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/RotationDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/RotationDecorator.java Fri Oct 4 23:45:40 2013
@@ -37,9 +37,8 @@ public class RotationDecorator implement
/**
* Creates a new rotation decorator with the specified theta value.
- *
- * @param theta
- * The rotation angle, in radians.
+ *
+ * @param theta The rotation angle, in radians.
*/
public RotationDecorator(double theta) {
setTheta(theta);
@@ -87,10 +86,10 @@ public class RotationDecorator implement
double sinTheta = Math.abs(Math.sin(theta));
double cosTheta = Math.abs(Math.cos(theta));
- int transformedWidth = (int)Math.ceil((height * sinTheta) + (width * cosTheta));
- int transformedHeight = (int)Math.ceil((height * cosTheta) + (width * sinTheta));
- int transformedX = (int)Math.floor((width - transformedWidth) * 0.5);
- int transformedY = (int)Math.floor((height - transformedHeight) * 0.5);
+ int transformedWidth = (int) Math.ceil((height * sinTheta) + (width * cosTheta));
+ int transformedHeight = (int) Math.ceil((height * cosTheta) + (width * sinTheta));
+ int transformedX = (int) Math.floor((width - transformedWidth) * 0.5);
+ int transformedY = (int) Math.floor((height - transformedHeight) * 0.5);
return new Bounds(transformedX, transformedY, transformedWidth, transformedHeight);
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/SaturationDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/SaturationDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/SaturationDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/SaturationDecorator.java Fri Oct 4 23:45:40 2013
@@ -111,8 +111,7 @@ public class SaturationDecorator impleme
int srcRGB = buffer[i * width + j];
// Adjust color saturation
- Color.RGBtoHSB((srcRGB >> 16) & 0xff,
- (srcRGB >> 8) & 0xff, srcRGB & 0xff, hsb);
+ Color.RGBtoHSB((srcRGB >> 16) & 0xff, (srcRGB >> 8) & 0xff, srcRGB & 0xff, hsb);
int dstRGB = Color.HSBtoRGB(hsb[0],
Math.min(Math.max(hsb[1] * multiplier, 0f), 1f), hsb[2]);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java Fri Oct 4 23:45:40 2013
@@ -28,14 +28,14 @@ import org.apache.pivot.wtk.HorizontalAl
import org.apache.pivot.wtk.Platform;
import org.apache.pivot.wtk.VerticalAlignment;
-
/**
* Decorator that scales the painting of a component along the X and/or Y axes.
- * <p> Generally speaking, decorators don't force a repaint of the component(s) they
- * are attached to when their parameters are changed. So, if this decorator is changed
- * after being applied to a particular component (e.g., to do a dynamic resize) then
- * either the component.repaint() method must be called or the decorator should be
- * removed and added again to force a repaint with the new scale.
+ * <p> Generally speaking, decorators don't force a repaint of the component(s)
+ * they are attached to when their parameters are changed. So, if this decorator
+ * is changed after being applied to a particular component (e.g., to do a
+ * dynamic resize) then either the component.repaint() method must be called or
+ * the decorator should be removed and added again to force a repaint with the
+ * new scale.
*/
public class ScaleDecorator implements Decorator {
private float scaleX;
@@ -54,12 +54,9 @@ public class ScaleDecorator implements D
/**
* Creates a new <tt>ScaleDecorator</tt> with the specified <tt>scaleX</tt>
* and <tt>scaleY</tt> values.
- *
- * @param scaleX
- * The amount to scale the component's x-axis
- *
- * @param scaleY
- * The amount to scale the component's y-axis
+ *
+ * @param scaleX The amount to scale the component's x-axis
+ * @param scaleY The amount to scale the component's y-axis
*/
public ScaleDecorator(float scaleX, float scaleY) {
setScale(scaleX, scaleY);
@@ -68,9 +65,8 @@ public class ScaleDecorator implements D
/**
* Gets the amount by which drawing operations will be scaled along the
* x-axis.
- *
- * @return
- * The amount to scale the component's x-axis
+ *
+ * @return The amount to scale the component's x-axis
*/
public float getScaleX() {
return scaleX;
@@ -79,9 +75,8 @@ public class ScaleDecorator implements D
/**
* Sets the amount by which drawing operations will be scaled along the
* x-axis.
- *
- * @param scaleX
- * The amount to scale the component's x-axis
+ *
+ * @param scaleX The amount to scale the component's x-axis
*/
public void setScaleX(float scaleX) {
setScale(scaleX, scaleY);
@@ -90,9 +85,8 @@ public class ScaleDecorator implements D
/**
* Sets the amount by which drawing operations will be scaled along the
* x-axis.
- *
- * @param scaleX
- * The amount to scale the component's x-axis
+ *
+ * @param scaleX The amount to scale the component's x-axis
*/
public void setScaleX(Number scaleX) {
if (scaleX == null) {
@@ -105,9 +99,8 @@ public class ScaleDecorator implements D
/**
* Gets the amount by which drawing operations will be scaled along the
* y-axis.
- *
- * @return
- * The amount to scale the component's y-axis
+ *
+ * @return The amount to scale the component's y-axis
*/
public float getScaleY() {
return scaleY;
@@ -116,9 +109,8 @@ public class ScaleDecorator implements D
/**
* Sets the amount by which drawing operations will be scaled along the
* y-axis.
- *
- * @param scaleY
- * The amount to scale the component's y-axis
+ *
+ * @param scaleY The amount to scale the component's y-axis
*/
public void setScaleY(float scaleY) {
setScale(scaleX, scaleY);
@@ -127,9 +119,8 @@ public class ScaleDecorator implements D
/**
* Sets the amount by which drawing operations will be scaled along the
* y-axis.
- *
- * @param scaleY
- * The amount to scale the component's y-axis
+ *
+ * @param scaleY The amount to scale the component's y-axis
*/
public void setScaleY(Number scaleY) {
if (scaleY == null) {
@@ -140,14 +131,11 @@ public class ScaleDecorator implements D
}
/**
- * Sets the amount by which drawing operations will be scaled along the
- * x and y axes.
- *
- * @param scaleX
- * The amount to scale the component's x-axis.
- *
- * @param scaleY
- * The amount to scale the component's y-axis.
+ * Sets the amount by which drawing operations will be scaled along the x
+ * and y axes.
+ *
+ * @param scaleX The amount to scale the component's x-axis.
+ * @param scaleY The amount to scale the component's y-axis.
*/
public void setScale(float scaleX, float scaleY) {
if (scaleX < 0) {
@@ -163,11 +151,10 @@ public class ScaleDecorator implements D
}
/**
- * Sets the amount by which drawing operations will be scaled along both
- * the x and y axes.
- *
- * @param scale
- * The amount to scale the component's x and y axes.
+ * Sets the amount by which drawing operations will be scaled along both the
+ * x and y axes.
+ *
+ * @param scale The amount to scale the component's x and y axes.
*/
public void setScale(float scale) {
setScaleX(scale);
@@ -177,13 +164,12 @@ public class ScaleDecorator implements D
/**
* Gets the horizontal alignment of the decorator. A left alignment will
* paint the component's left edge at the component's x-coordinate. A right
- * alignment will paint the component's right edge along the right side
- * of the component's bounding box. A center or justified alignment will
- * paint the scaled component centered with respect to the component's
- * bounding box.
- *
- * @return
- * The horizontal alignment
+ * alignment will paint the component's right edge along the right side of
+ * the component's bounding box. A center or justified alignment will paint
+ * the scaled component centered with respect to the component's bounding
+ * box.
+ *
+ * @return The horizontal alignment
*/
public HorizontalAlignment getHorizontalAlignment() {
return horizontalAlignment;
@@ -192,13 +178,12 @@ public class ScaleDecorator implements D
/**
* Sets the horizontal alignment of the decorator. A left alignment will
* paint the component's left edge at the component's x-coordinate. A right
- * alignment will paint the component's right edge along the right side
- * of the component's bounding box. A center or justified alignment will
- * paint the scaled component centered with respect to the component's
- * bounding box.
- *
- * @param horizontalAlignment
- * The horizontal alignment
+ * alignment will paint the component's right edge along the right side of
+ * the component's bounding box. A center or justified alignment will paint
+ * the scaled component centered with respect to the component's bounding
+ * box.
+ *
+ * @param horizontalAlignment The horizontal alignment
*/
public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment) {
if (horizontalAlignment == null) {
@@ -209,30 +194,28 @@ public class ScaleDecorator implements D
}
/**
- * Gets the vertical alignment of the decorator. A top alignment will
- * paint the component's top edge at the component's y-coordinate. A bottom
- * alignment will paint the component's bottom edge along the bottom side
- * of the component's bounding box. A center or justified alignment will
- * paint the scaled component centered with respect to the component's
- * bounding box.
- *
- * @return
- * The vertical alignment
+ * Gets the vertical alignment of the decorator. A top alignment will paint
+ * the component's top edge at the component's y-coordinate. A bottom
+ * alignment will paint the component's bottom edge along the bottom side of
+ * the component's bounding box. A center or justified alignment will paint
+ * the scaled component centered with respect to the component's bounding
+ * box.
+ *
+ * @return The vertical alignment
*/
public VerticalAlignment getVerticalAlignment() {
return verticalAlignment;
}
/**
- * Sets the vertical alignment of the decorator. A top alignment will
- * paint the component's top edge at the component's y-coordinate. A bottom
- * alignment will paint the component's bottom edge along the bottom side
- * of the component's bounding box. A center or justified alignment will
- * paint the scaled component centered with respect to the component's
- * bounding box.
- *
- * @param verticalAlignment
- * The vertical alignment
+ * Sets the vertical alignment of the decorator. A top alignment will paint
+ * the component's top edge at the component's y-coordinate. A bottom
+ * alignment will paint the component's bottom edge along the bottom side of
+ * the component's bounding box. A center or justified alignment will paint
+ * the scaled component centered with respect to the component's bounding
+ * box.
+ *
+ * @param verticalAlignment The vertical alignment
*/
public void setVerticalAlignment(VerticalAlignment verticalAlignment) {
if (verticalAlignment == null) {
@@ -243,66 +226,60 @@ public class ScaleDecorator implements D
}
/**
- * Gets the x translation that will be applied with respect to the
- * specified component, given this decorator's <tt>scaleX</tt> and
+ * Gets the x translation that will be applied with respect to the specified
+ * component, given this decorator's <tt>scaleX</tt> and
* <tt>horizontalAlignment</tt> properties.
- *
- * @param component
- * The component being decorated
- *
- * @return
- * The amount to translate x-coordinate actions when decorating this
+ *
+ * @param component The component being decorated
+ * @return The amount to translate x-coordinate actions when decorating this
* component
*/
private int getTranslatedX(Component component) {
int width = component.getWidth();
- int translatedWidth = (int)Math.ceil(width * scaleX);
+ int translatedWidth = (int) Math.ceil(width * scaleX);
int tx;
switch (horizontalAlignment) {
- case LEFT:
- tx = 0;
- break;
- case RIGHT:
- tx = width - translatedWidth;
- break;
- default:
- tx = (width - translatedWidth) / 2;
- break;
+ case LEFT:
+ tx = 0;
+ break;
+ case RIGHT:
+ tx = width - translatedWidth;
+ break;
+ default:
+ tx = (width - translatedWidth) / 2;
+ break;
}
return tx;
}
/**
- * Gets the y translation that will be applied with respect to the
- * specified component, given this decorator's <tt>scaleY</tt> and
+ * Gets the y translation that will be applied with respect to the specified
+ * component, given this decorator's <tt>scaleY</tt> and
* <tt>verticalAlignment</tt> properties.
- *
- * @param component
- * The component being decorated
- *
- * @return
- * The amount to translate y-coordinate actions when decorating this
+ *
+ * @param component The component being decorated
+ * @return The amount to translate y-coordinate actions when decorating this
* component
*/
private int getTranslatedY(Component component) {
int height = component.getHeight();
- int translatedHeight = (int)Math.ceil(height * scaleY);
+ int translatedHeight = (int) Math.ceil(height * scaleY);
int ty;
switch (verticalAlignment) {
- case TOP:
- ty = 0;
- break;
- case BOTTOM:
- ty = height - translatedHeight;
- break;
- default:
- ty = (height - translatedHeight) / 2;
- break;
+ case TOP:
+ ty = 0;
+ break;
+ case BOTTOM:
+ ty = height - translatedHeight;
+ break;
+ default:
+ ty = (height - translatedHeight) / 2;
+ break;
}
return ty;
@@ -345,10 +322,10 @@ public class ScaleDecorator implements D
int tx = getTranslatedX(component);
int ty = getTranslatedY(component);
- 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);
+ 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(xUpdated, yUpdated, widthUpdated, heightUpdated);
}
@@ -356,8 +333,8 @@ public class ScaleDecorator implements D
@Override
public Bounds getBounds(Component component) {
- int width = (int)Math.ceil(component.getWidth() * scaleX);
- int height = (int)Math.ceil(component.getHeight() * scaleY);
+ int width = (int) Math.ceil(component.getWidth() * scaleX);
+ int height = (int) Math.ceil(component.getHeight() * scaleY);
int tx = getTranslatedX(component);
int ty = getTranslatedY(component);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ShadeDecorator.java Fri Oct 4 23:45:40 2013
@@ -26,8 +26,8 @@ import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.GraphicsUtilities;
/**
- * Decorator that applies a "shade" to a component. The shade is a rectangle
- * of the same size as the component that is painted over the component using a
+ * Decorator that applies a "shade" to a component. The shade is a rectangle of
+ * the same size as the component that is painted over the component using a
* given color and opacity value.
*/
public class ShadeDecorator implements Decorator {
@@ -38,8 +38,8 @@ public class ShadeDecorator implements D
private Graphics2D graphics;
/**
- * Creates a new <tt>ShadeDecorator</tt> with the default opacity and
- * shade color.
+ * Creates a new <tt>ShadeDecorator</tt> with the default opacity and shade
+ * color.
*/
public ShadeDecorator() {
this(0.33f, Color.BLACK);
@@ -48,16 +48,12 @@ public class ShadeDecorator implements D
/**
* Creates a new <tt>ShadeDecorator</tt> with the specified opacity and
* shade color.
- *
- * @param opacity
- * The opacity of the shade, between 0 and 1, exclusive.
- *
- * @param color
- * The color of the shade.
+ *
+ * @param opacity The opacity of the shade, between 0 and 1, exclusive.
+ * @param color The color of the shade.
*/
public ShadeDecorator(float opacity, Color color) {
- if (opacity <= 0
- || opacity >= 1) {
+ if (opacity <= 0 || opacity >= 1) {
throw new IllegalArgumentException("opacity must be between 0 and 1, exclusive.");
}
@@ -78,6 +74,7 @@ public class ShadeDecorator implements D
/**
* Sets the opacity of the decorator.
+ *
* @param opacity A number between 0 (transparent) and 1 (opaque)
*/
public void setOpacity(float opacity) {
@@ -86,6 +83,7 @@ public class ShadeDecorator implements D
/**
* Sets the opacity of the decorator.
+ *
* @param opacity A number between 0 (transparent) and 1 (opaque)
*/
public void setOpacity(Number opacity) {
@@ -116,7 +114,9 @@ public class ShadeDecorator implements D
/**
* Sets the color of the decorator
- * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color values recognized by Pivot}.
+ *
+ * @param color Any of the {@linkplain GraphicsUtilities#decodeColor color
+ * values recognized by Pivot}.
*/
public final void setColor(String color) {
if (color == null) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TagDecorator.java Fri Oct 4 23:45:40 2013
@@ -25,7 +25,6 @@ import org.apache.pivot.wtk.HorizontalAl
import org.apache.pivot.wtk.VerticalAlignment;
import org.apache.pivot.wtk.Visual;
-
/**
* Decorator that allows a caller to attach a "tag" visual to a component.
*/
@@ -47,9 +46,8 @@ public class TagDecorator implements Dec
this(tag, HorizontalAlignment.RIGHT, VerticalAlignment.TOP, 0, 0);
}
- public TagDecorator(Visual tag,
- HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment,
- int xOffset, int yOffset) {
+ public TagDecorator(Visual tag, HorizontalAlignment horizontalAlignment,
+ VerticalAlignment verticalAlignment, int xOffset, int yOffset) {
if (horizontalAlignment == null) {
throw new IllegalArgumentException("horizontalAlignment is null.");
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/Transition.java Fri Oct 4 23:45:40 2013
@@ -60,12 +60,9 @@ public abstract class Transition {
/**
* Creates a new non-repeating transition with the given duration, rate.
- *
- * @param duration
- * Transition duration, in milliseconds.
- *
- * @param rate
- * Transition rate, in frames per second.
+ *
+ * @param duration Transition duration, in milliseconds.
+ * @param rate Transition rate, in frames per second.
*/
public Transition(int duration, int rate) {
this(duration, rate, false);
@@ -73,15 +70,11 @@ public abstract class Transition {
/**
* Creates a new transition with the given duration, rate, and repeat.
- *
- * @param duration
- * Transition duration, in milliseconds.
- *
- * @param rate
- * Transition rate, in frames per second.
- *
- * @param repeating
- * <tt>true</tt> if the transition should repeat; <tt>false</tt>, otherwise.
+ *
+ * @param duration Transition duration, in milliseconds.
+ * @param rate Transition rate, in frames per second.
+ * @param repeating <tt>true</tt> if the transition should repeat;
+ * <tt>false</tt>, otherwise.
*/
public Transition(int duration, int rate, boolean repeating) {
this(duration, rate, repeating, false);
@@ -89,19 +82,13 @@ public abstract class Transition {
/**
* Creates a new transition with the given duration, rate, and repeat.
- *
- * @param duration
- * Transition duration, in milliseconds.
- *
- * @param rate
- * Transition rate, in frames per second.
- *
- * @param repeating
- * <tt>true</tt> if the transition should repeat; <tt>false</tt>, otherwise.
- *
- * @param reversed
- * <tt>true</tt> if the transition should run in reverse; <tt>false</tt>
- * otherwise.
+ *
+ * @param duration Transition duration, in milliseconds.
+ * @param rate Transition rate, in frames per second.
+ * @param repeating <tt>true</tt> if the transition should repeat;
+ * <tt>false</tt>, otherwise.
+ * @param reversed <tt>true</tt> if the transition should run in reverse;
+ * <tt>false</tt> otherwise.
*/
public Transition(int duration, int rate, boolean repeating, boolean reversed) {
if (duration <= 0) {
@@ -116,10 +103,8 @@ public abstract class Transition {
/**
* Returns the transition duration.
- *
- * @return
- * The duration of the transition, in milliseconds.
- *
+ *
+ * @return The duration of the transition, in milliseconds.
* @see #setDuration(int)
*/
public int getDuration() {
@@ -129,9 +114,8 @@ public abstract class Transition {
/**
* Sets the transition duration, the length of time the transition is
* scheduled to run.
- *
- * @param duration
- * The duration of the transition, in milliseconds.
+ *
+ * @param duration The duration of the transition, in milliseconds.
*/
public void setDuration(int duration) {
if (duration < 0) {
@@ -147,10 +131,8 @@ public abstract class Transition {
/**
* Returns the transition rate.
- *
- * @return
- * The rate of the transition, in frames per second.
- *
+ *
+ * @return The rate of the transition, in frames per second.
* @see #setRate(int)
*/
public int getRate() {
@@ -160,9 +142,8 @@ public abstract class Transition {
/**
* Sets the transition rate, the number of times the transition will be
* updated within the span of one second.
- *
- * @param rate
- * The transition rate, in frames per second.
+ *
+ * @param rate The transition rate, in frames per second.
*/
public void setRate(int rate) {
if (rate < 0) {
@@ -179,19 +160,17 @@ public abstract class Transition {
/**
* Returns the transition interval, the number of milliseconds between
* updates.
- *
- * @return
- * The transition interval, in milliseconds.
+ *
+ * @return The transition interval, in milliseconds.
*/
public int getInterval() {
- return (int)((1f / rate) * 1000);
+ return (int) ((1f / rate) * 1000);
}
/**
* Returns the time at which the transition was started.
- *
- * @return
- * The transition's start time.
+ *
+ * @return The transition's start time.
*/
public long getStartTime() {
return startTime;
@@ -199,9 +178,8 @@ public abstract class Transition {
/**
* Returns the last time the transition was updated.
- *
- * @return
- * The most recent update time.
+ *
+ * @return The most recent update time.
*/
public long getCurrentTime() {
return currentTime;
@@ -209,9 +187,8 @@ public abstract class Transition {
/**
* Returns the elapsed time since the transition started.
- *
- * @return
- * Returns the amount of time that has passed since the transition
+ *
+ * @return Returns the amount of time that has passed since the transition
* was started. If the transition is reversed, this value reflects the
* amount of time remaining.
*/
@@ -220,9 +197,9 @@ public abstract class Transition {
int elapsedTime;
if (reversed) {
- elapsedTime = (int)(endTime - currentTime);
+ elapsedTime = (int) (endTime - currentTime);
} else {
- elapsedTime = (int)(currentTime - startTime);
+ elapsedTime = (int) (currentTime - startTime);
}
return elapsedTime;
@@ -230,14 +207,13 @@ public abstract class Transition {
/**
* Returns the percentage of the transition that has completed.
- *
- * @return
- * A value between 0 and 1, inclusive, representing the transition's
- * percent complete. If the transition is reversed, this value reflects
- * the percent remaining.
+ *
+ * @return A value between 0 and 1, inclusive, representing the transition's
+ * percent complete. If the transition is reversed, this value reflects the
+ * percent remaining.
*/
public float getPercentComplete() {
- float percentComplete = (float)(currentTime - startTime) / (float)(duration);
+ float percentComplete = (float) (currentTime - startTime) / (float) (duration);
if (reversed) {
percentComplete = 1.0f - percentComplete;
@@ -248,10 +224,9 @@ public abstract class Transition {
/**
* Tells whether or not the transition is currently running.
- *
- * @return
- * <tt>true</tt> if the transition is currently running; <tt>false</tt> if
- * it is not
+ *
+ * @return <tt>true</tt> if the transition is currently running;
+ * <tt>false</tt> if it is not
*/
public boolean isRunning() {
return (transitionCallback != null);
@@ -259,7 +234,7 @@ public abstract class Transition {
/**
* Starts the transition with no listener.
- *
+ *
* @see #start(TransitionListener)
*/
public final void start() {
@@ -267,15 +242,13 @@ public abstract class Transition {
}
/**
- * Starts the transition. Calls {@link #update()} to establish the
- * initial state and starts a timer that will repeatedly call
- * {@link #update()} at the current rate. The specified
- * <tt>TransitionListener</tt> will be notified when the transition
- * completes.
- *
- * @param transitionListenerArgument
- * The listener to get notified when the transition completes, or
- * <tt>null</tt> if no notification is necessary
+ * Starts the transition. Calls {@link #update()} to establish the initial
+ * state and starts a timer that will repeatedly call {@link #update()} at
+ * the current rate. The specified <tt>TransitionListener</tt> will be
+ * notified when the transition completes.
+ *
+ * @param transitionListenerArgument The listener to get notified when the
+ * transition completes, or <tt>null</tt> if no notification is necessary
*/
public void start(TransitionListener transitionListenerArgument) {
if (transitionCallback != null) {
@@ -330,9 +303,9 @@ public abstract class Transition {
/**
* Tests whether the transition is reversed.
- *
- * @return
- * <tt>true</tt> if the transition is reversed; <tt>false</tt>, otherwise.
+ *
+ * @return <tt>true</tt> if the transition is reversed; <tt>false</tt>,
+ * otherwise.
*/
public boolean isReversed() {
return reversed;
@@ -340,7 +313,7 @@ public abstract class Transition {
/**
* Sets the transition's reversed flag.
- *
+ *
* @param reversed
*/
public void setReversed(boolean reversed) {
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TransitionListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TransitionListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TransitionListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TransitionListener.java Fri Oct 4 23:45:40 2013
@@ -22,7 +22,7 @@ package org.apache.pivot.wtk.effects;
public interface TransitionListener {
/**
* Called when a transition has completed.
- *
+ *
* @param transition
*/
public void transitionCompleted(Transition transition);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/TranslationDecorator.java Fri Oct 4 23:45:40 2013
@@ -23,7 +23,6 @@ import org.apache.pivot.wtk.Bounds;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.Point;
-
/**
* Decorator that translates the paint origin of its component.
*/
@@ -91,8 +90,7 @@ public class TranslationDecorator implem
if (clip) {
Bounds decoratedBounds = component.getDecoratedBounds();
graphics.clipRect(decoratedBounds.x - component.getX(),
- decoratedBounds.y - component.getY(),
- decoratedBounds.width, decoratedBounds.height);
+ decoratedBounds.y - component.getY(), decoratedBounds.width, decoratedBounds.height);
}
graphics.translate(x, y);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/WatermarkDecorator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/WatermarkDecorator.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/WatermarkDecorator.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/WatermarkDecorator.java Fri Oct 4 23:45:40 2013
@@ -58,9 +58,8 @@ public class WatermarkDecorator implemen
/**
* Creates a new <tt>WatermarkDecorator</tt> with the specified string as
* its text and no image.
- *
- * @param text
- * The text to paint over the decorated component
+ *
+ * @param text The text to paint over the decorated component
*/
public WatermarkDecorator(String text) {
this(text, null);
@@ -69,9 +68,8 @@ public class WatermarkDecorator implemen
/**
* Creates a new <tt>WatermarkDecorator</tt> with no text and the specified
* image.
- *
- * @param image
- * The image to paint over the decorated component
+ *
+ * @param image The image to paint over the decorated component
*/
public WatermarkDecorator(Image image) {
this(null, image);
@@ -80,12 +78,9 @@ public class WatermarkDecorator implemen
/**
* Creates a new <tt>WatermarkDecorator</tt> with the specified text and
* image.
- *
- * @param text
- * The text to paint over the decorated component
- *
- * @param image
- * The image to paint over the decorated component
+ *
+ * @param text The text to paint over the decorated component
+ * @param image The image to paint over the decorated component
*/
public WatermarkDecorator(String text, Image image) {
boxPane.add(imageView);
@@ -94,7 +89,7 @@ public class WatermarkDecorator implemen
boxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
imageView.getStyles().put("opacity", opacity);
- Font font = (Font)label.getStyles().get("font");
+ Font font = (Font) label.getStyles().get("font");
label.getStyles().put("font", font.deriveFont(Font.BOLD, 60));
label.setText(text != null ? text : "");
@@ -105,9 +100,8 @@ public class WatermarkDecorator implemen
/**
* Gets the text that will be painted over this decorator's component.
- *
- * @return
- * This decorator's text
+ *
+ * @return This decorator's text
*/
public String getText() {
return label.getText();
@@ -115,9 +109,8 @@ public class WatermarkDecorator implemen
/**
* Sets the text that will be painted over this decorator's component.
- *
- * @param text
- * This decorator's text
+ *
+ * @param text This decorator's text
*/
public void setText(String text) {
label.setText(text != null ? text : "");
@@ -126,19 +119,17 @@ public class WatermarkDecorator implemen
/**
* Gets the font that will be used when painting this decorator's text.
- *
- * @return
- * This decorator's font
+ *
+ * @return This decorator's font
*/
public Font getFont() {
- return (Font)label.getStyles().get("font");
+ return (Font) label.getStyles().get("font");
}
/**
* Sets the font that will be used when painting this decorator's text.
- *
- * @param font
- * This decorator's font
+ *
+ * @param font This decorator's font
*/
public void setFont(Font font) {
if (font == null) {
@@ -151,9 +142,8 @@ public class WatermarkDecorator implemen
/**
* Sets the font that will be used when painting this decorator's text.
- *
- * @param font
- * This decorator's font
+ *
+ * @param font This decorator's font
*/
public final void setFont(String font) {
if (font == null) {
@@ -173,9 +163,8 @@ public class WatermarkDecorator implemen
/**
* Gets the image that will be painted over this decorator's component.
- *
- * @return
- * This decorator's image
+ *
+ * @return This decorator's image
*/
public Image getImage() {
return imageView.getImage();
@@ -183,9 +172,8 @@ public class WatermarkDecorator implemen
/**
* Sets the image that will be painted over this decorator's component.
- *
- * @param image
- * This decorator's image
+ *
+ * @param image This decorator's image
*/
public void setImage(Image image) {
imageView.setImage(image);
@@ -194,14 +182,11 @@ public class WatermarkDecorator implemen
/**
* Sets the image that will be painted over this decorator's component by
- * URL.
- * <p>
- * If the icon already exists in the application context resource cache,
- * the cached value will be used. Otherwise, the icon will be loaded
+ * URL. <p> If the icon already exists in the application context resource
+ * cache, the cached value will be used. Otherwise, the icon will be loaded
* synchronously and added to the cache.
- *
- * @param imageURL
- * The location of the image to set.
+ *
+ * @param imageURL The location of the image to set.
*/
public void setImage(URL imageURL) {
if (imageURL == null) {
@@ -213,10 +198,8 @@ public class WatermarkDecorator implemen
/**
* Sets the image that will be painted over this decorator's component.
- *
- * @param imageName
- * The resource name of the image to set.
- *
+ *
+ * @param imageName The resource name of the image to set.
* @see #setImage(URL)
*/
public void setImage(String imageName) {
@@ -234,9 +217,8 @@ public class WatermarkDecorator implemen
/**
* Gets the opacity of the watermark.
- *
- * @return
- * This decorator's opacity
+ *
+ * @return This decorator's opacity
*/
public float getOpacity() {
return opacity;
@@ -244,9 +226,8 @@ public class WatermarkDecorator implemen
/**
* Sets the opacity of the watermark.
- *
- * @param opacity
- * This decorator's opacity
+ *
+ * @param opacity This decorator's opacity
*/
public void setOpacity(float opacity) {
this.opacity = opacity;
@@ -255,9 +236,8 @@ public class WatermarkDecorator implemen
/**
* Gets the angle at the watermark will be painted, in radians.
- *
- * @return
- * This decorator's watermark angle
+ *
+ * @return This decorator's watermark angle
*/
public double getTheta() {
return theta;
@@ -266,13 +246,11 @@ public class WatermarkDecorator implemen
/**
* Sets the angle at the watermark will be painted, in radians. This value
* must lie between <tt>0</tt> and <tt>PI / 2</tt> (inclusive).
- *
- * @param theta
- * This decorator's watermark angle
+ *
+ * @param theta This decorator's watermark angle
*/
public void setTheta(double theta) {
- if (theta < 0
- || theta > Math.PI / 2) {
+ if (theta < 0 || theta > Math.PI / 2) {
throw new IllegalArgumentException("Theta must be between 0 nd PI / 2.");
}
@@ -303,23 +281,22 @@ public class WatermarkDecorator implemen
double sinTheta = Math.sin(theta);
double cosTheta = Math.cos(theta);
- Graphics2D watermarkGraphics = (Graphics2D)graphics.create();
+ Graphics2D watermarkGraphics = (Graphics2D) graphics.create();
watermarkGraphics.clipRect(0, 0, component.getWidth(), component.getHeight());
- watermarkGraphics.setComposite(AlphaComposite.getInstance
- (AlphaComposite.SRC_OVER, opacity));
+ watermarkGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
watermarkGraphics.rotate(theta);
// Calculate the separation in between each repetition of the watermark
- int dX = (int)(1.5 * boxPane.getWidth());
+ int dX = (int) (1.5 * boxPane.getWidth());
int dY = 2 * boxPane.getHeight();
// Prepare the origin of our graphics context
int x = 0;
- int y = (int)(-width * sinTheta);
+ int y = (int) (-width * sinTheta);
watermarkGraphics.translate(x, y);
- for (int yStop = (int)(height * cosTheta), p = 0; y < yStop; y += dY, p = 1 - p) {
- for (int xStop = (int)(height * sinTheta + width * cosTheta); x < xStop; x += dX) {
+ for (int yStop = (int) (height * cosTheta), p = 0; y < yStop; y += dY, p = 1 - p) {
+ for (int xStop = (int) (height * sinTheta + width * cosTheta); x < xStop; x += dX) {
boxPane.paint(watermarkGraphics);
watermarkGraphics.translate(dX, 0);
}
@@ -329,7 +306,7 @@ public class WatermarkDecorator implemen
x = 0;
// Shift the x back and forth to add randomness feel to pattern
- watermarkGraphics.translate((int)((0.5f - p) * boxPane.getWidth()), 0);
+ watermarkGraphics.translate((int) ((0.5f - p) * boxPane.getWidth()), 0);
}
watermarkGraphics.dispose();
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Circular.java Fri Oct 4 23:45:40 2013
@@ -22,20 +22,20 @@ package org.apache.pivot.wtk.effects.eas
public class Circular implements Easing {
@Override
public float easeIn(float time, float begin, float change, float duration) {
- return -change * ((float)Math.sqrt(1f - (time /= duration) * time) - 1f) + begin;
+ return -change * ((float) Math.sqrt(1f - (time /= duration) * time) - 1f) + begin;
}
@Override
public float easeOut(float time, float begin, float change, float duration) {
- return change * (float)Math.sqrt(1f - (time = time / duration - 1f) * time) + begin;
+ return change * (float) Math.sqrt(1f - (time = time / duration - 1f) * time) + begin;
}
@Override
public float easeInOut(float time, float begin, float change, float duration) {
if ((time /= duration / 2f) < 1f) {
- return -change / 2f * ((float)Math.sqrt(1f - time * time) - 1f) + begin;
+ return -change / 2f * ((float) Math.sqrt(1f - time * time) - 1f) + begin;
}
- return change / 2f * ((float)Math.sqrt(1f - (time -= 2f) * time) + 1f) + begin;
+ return change / 2f * ((float) Math.sqrt(1f - (time -= 2f) * time) + 1f) + begin;
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Easing.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Easing.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Easing.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Easing.java Fri Oct 4 23:45:40 2013
@@ -21,6 +21,8 @@ package org.apache.pivot.wtk.effects.eas
*/
public interface Easing {
public float easeIn(float time, float begin, float change, float duration);
+
public float easeOut(float time, float begin, float change, float duration);
+
public float easeInOut(float time, float begin, float change, float duration);
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Exponential.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Exponential.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Exponential.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Exponential.java Fri Oct 4 23:45:40 2013
@@ -22,14 +22,14 @@ package org.apache.pivot.wtk.effects.eas
public class Exponential implements Easing {
@Override
public float easeIn(float time, float begin, float change, float duration) {
- return (time == 0) ? begin
- : change * (float)Math.pow(2, 10 * (time / duration - 1f)) + begin;
+ return (time == 0) ? begin : change * (float) Math.pow(2, 10 * (time / duration - 1f))
+ + begin;
}
@Override
public float easeOut(float time, float begin, float change, float duration) {
- return (time == duration) ? begin + change
- : change * ((float)-Math.pow(2, -10 * time / duration) + 1f) + begin;
+ return (time == duration) ? begin + change : change
+ * ((float) -Math.pow(2, -10 * time / duration) + 1f) + begin;
}
@Override
@@ -43,9 +43,9 @@ public class Exponential implements Easi
}
if ((time /= duration / 2f) < 1) {
- return change / 2f * (float)Math.pow(2, 10 * (time - 1)) + begin;
+ return change / 2f * (float) Math.pow(2, 10 * (time - 1)) + begin;
}
- return change / 2f * ((float)-Math.pow(2, -10 * (time - 1)) + 2) + begin;
+ return change / 2f * ((float) -Math.pow(2, -10 * (time - 1)) + 2) + begin;
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Sine.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Sine.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Sine.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/easing/Sine.java Fri Oct 4 23:45:40 2013
@@ -22,16 +22,16 @@ package org.apache.pivot.wtk.effects.eas
public class Sine implements Easing {
@Override
public float easeIn(float time, float begin, float change, float duration) {
- return -change * (float)Math.cos(time / duration * (Math.PI/2)) + change + begin;
+ return -change * (float) Math.cos(time / duration * (Math.PI / 2)) + change + begin;
}
@Override
public float easeOut(float time, float begin, float change, float duration) {
- return change * (float)Math.sin(time / duration * (Math.PI/2)) + begin;
+ return change * (float) Math.sin(time / duration * (Math.PI / 2)) + begin;
}
@Override
public float easeInOut(float time, float begin, float change, float duration) {
- return -change / 2f * (float)(Math.cos(Math.PI * time / duration) - 1) + begin;
+ return -change / 2f * (float) (Math.cos(Math.PI * time / duration) - 1) + begin;
}
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/BufferedImageSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/BufferedImageSerializer.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/BufferedImageSerializer.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/BufferedImageSerializer.java Fri Oct 4 23:45:40 2013
@@ -26,7 +26,6 @@ import javax.imageio.ImageIO;
import org.apache.pivot.serialization.SerializationException;
import org.apache.pivot.serialization.Serializer;
-
/**
* Implementation of the {@link Serializer} interface that reads and writes
* instances of {@link java.awt.image.BufferedImage}.
@@ -36,11 +35,8 @@ public class BufferedImageSerializer imp
* Supported image formats.
*/
public enum Format {
- PNG("png", "image/png"),
- JPEG("jpeg", "image/jpeg"),
- BMP("bmp", "image/bmp"),
- WBMP("wbmp", "image/vnd.wap.wbmp"),
- GIF("gif", "image/gif");
+ PNG("png", "image/png"), JPEG("jpeg", "image/jpeg"), BMP("bmp", "image/bmp"), WBMP("wbmp",
+ "image/vnd.wap.wbmp"), GIF("gif", "image/gif");
private String name;
private String mimeType;
@@ -89,9 +85,8 @@ public class BufferedImageSerializer imp
/**
* Reads a serialized image from an input stream.
- *
- * @return
- * A <tt>BufferedImage</tt> object
+ *
+ * @return A <tt>BufferedImage</tt> object
*/
@Override
public BufferedImage readObject(InputStream inputStream) throws IOException,
@@ -104,7 +99,6 @@ public class BufferedImageSerializer imp
return bufferedImage;
}
-
/**
* Writes a buffered image to an output stream.
*/
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Drawing.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Drawing.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Drawing.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Drawing.java Fri Oct 4 23:45:40 2013
@@ -19,8 +19,6 @@ package org.apache.pivot.wtk.media;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
-import org.apache.pivot.wtk.media.Image;
-
import com.kitfox.svg.SVGDiagram;
import com.kitfox.svg.SVGElementException;
import com.kitfox.svg.SVGException;
@@ -47,12 +45,12 @@ public class Drawing extends Image {
@Override
public int getWidth() {
- return (int)Math.ceil(diagram.getWidth());
+ return (int) Math.ceil(diagram.getWidth());
}
@Override
public int getHeight() {
- return (int)Math.ceil(diagram.getHeight());
+ return (int) Math.ceil(diagram.getHeight());
}
public void setSize(int width, int height) {
@@ -79,7 +77,8 @@ public class Drawing extends Image {
@Override
public void paint(Graphics2D graphics) {
try {
- graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
diagram.render(graphics);
} catch (SVGException exception) {
throw new RuntimeException(exception);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Image.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Image.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Image.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Image.java Fri Oct 4 23:45:40 2013
@@ -35,15 +35,15 @@ import org.apache.pivot.wtk.Visual;
import com.kitfox.svg.SVGDiagram;
/**
- * Abstract base class for images. An image is either a bitmapped "picture"
- * or a vector "drawing".
+ * Abstract base class for images. An image is either a bitmapped "picture" or a
+ * vector "drawing".
*/
public abstract class Image implements Visual {
/**
* Image listener list.
*/
- protected static class ImageListenerList extends ListenerList<ImageListener>
- implements ImageListener {
+ protected static class ImageListenerList extends ListenerList<ImageListener> implements
+ ImageListener {
@Override
public void sizeChanged(Image image, int previousWidth, int previousHeight) {
for (ImageListener listener : this) {
@@ -93,9 +93,11 @@ public abstract class Image implements V
InputStream inputStream = null;
try {
- // NOTE We don't open the stream until the callback executes because
+ // NOTE We don't open the stream until the callback executes
+ // because
// this is a potentially time-consuming operation
- inputStream = new MonitoredInputStream(new BufferedInputStream(location.openStream()));
+ inputStream = new MonitoredInputStream(new BufferedInputStream(
+ location.openStream()));
if (location.getFile().endsWith(SVGDiagramSerializer.SVG_EXTENSION)) {
SVGDiagramSerializer serializer = new SVGDiagramSerializer();
@@ -161,7 +163,7 @@ public abstract class Image implements V
throw new IllegalArgumentException("location is null.");
}
- Image image = (Image)ApplicationContext.getResourceCache().get(location);
+ Image image = (Image) ApplicationContext.getResourceCache().get(location);
if (image == null) {
try {
image = Image.load(location);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/ImageListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/ImageListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/ImageListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/ImageListener.java Fri Oct 4 23:45:40 2013
@@ -22,7 +22,7 @@ package org.apache.pivot.wtk.media;
public interface ImageListener {
/**
* Called when an image's size has changed.
- *
+ *
* @param image
* @param previousWidth
* @param previousHeight
@@ -31,7 +31,7 @@ public interface ImageListener {
/**
* Called when an image's baseline has changed.
- *
+ *
* @param image
* @param previousBaseline
*/
@@ -39,7 +39,7 @@ public interface ImageListener {
/**
* Called when a region within an image needs to be repainted.
- *
+ *
* @param image
* @param x
* @param y
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Movie.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Movie.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Movie.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Movie.java Fri Oct 4 23:45:40 2013
@@ -21,17 +21,16 @@ import org.apache.pivot.wtk.ApplicationC
import org.apache.pivot.wtk.Dimensions;
import org.apache.pivot.wtk.Visual;
-
/**
- * Abstract base class for movies. A movie is either a bitmapped "video"
- * or a vector "animation".
+ * Abstract base class for movies. A movie is either a bitmapped "video" or a
+ * vector "animation".
*/
public abstract class Movie implements Visual {
/**
* Movie listener list.
*/
- protected static class MovieListenerList extends ListenerList<MovieListener>
- implements MovieListener {
+ protected static class MovieListenerList extends ListenerList<MovieListener> implements
+ MovieListener {
@Override
public void sizeChanged(Movie movie, int previousWidth, int previousHeight) {
for (MovieListener listener : this) {
@@ -154,7 +153,7 @@ public abstract class Movie implements V
}
scheduledCallback = ApplicationContext.scheduleRecurringCallback(nextFrameCallback,
- (int)((1 / (double)frameRate) * 1000));
+ (int) ((1 / (double) frameRate) * 1000));
movieListeners.movieStarted(this);
}
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/MovieListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/MovieListener.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/MovieListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/MovieListener.java Fri Oct 4 23:45:40 2013
@@ -62,7 +62,7 @@ public interface MovieListener {
/**
* Called when a movie's size has changed.
- *
+ *
* @param movie
* @param previousWidth
* @param previousHeight
@@ -71,7 +71,7 @@ public interface MovieListener {
/**
* Called when a movie's baseline has changed.
- *
+ *
* @param movie
* @param previousBaseline
*/
@@ -79,7 +79,7 @@ public interface MovieListener {
/**
* Called when the movie's current frame changed.
- *
+ *
* @param movie
* @param previousFrame
*/
@@ -87,7 +87,7 @@ public interface MovieListener {
/**
* Called when the movie's looping property changed.
- *
+ *
* @param movie
*/
public void loopingChanged(Movie movie);
@@ -96,23 +96,23 @@ public interface MovieListener {
* Called when the movie begins playing. The frame at which the movie is
* starting can be obtained via <tt>getCurrentFrame()</tt> (it is not
* guaranteed to be positioned before the first frame when it is started).
- *
+ *
* @param movie
*/
public void movieStarted(Movie movie);
/**
- * Called when the movie stops playing. The frame at which the movie
- * stopped can be obtained via <tt>getCurrentFrame()</tt> (it is not
- * guaranteed to have completed the last frame when it is stopped).
- *
+ * Called when the movie stops playing. The frame at which the movie stopped
+ * can be obtained via <tt>getCurrentFrame()</tt> (it is not guaranteed to
+ * have completed the last frame when it is stopped).
+ *
* @param movie
*/
public void movieStopped(Movie movie);
/**
* Called when a region within a movie needs to be repainted.
- *
+ *
* @param movie
* @param x
* @param y
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java Fri Oct 4 23:45:40 2013
@@ -30,9 +30,7 @@ public class Picture extends Image {
* Enum defining the algorithms to apply when resizing a picture.
*/
public enum Interpolation {
- NEAREST_NEIGHBOR,
- BILINEAR,
- BICUBIC
+ NEAREST_NEIGHBOR, BILINEAR, BICUBIC
}
private BufferedImage bufferedImage = null;
@@ -69,12 +67,12 @@ public class Picture extends Image {
int width = getWidth();
int height = getHeight();
- float aspectRatio = (float)width / (float)height;
+ float aspectRatio = (float) width / (float) height;
if (aspectRatio > 1) {
width = size;
- height = (int)(size / aspectRatio);
+ height = (int) (size / aspectRatio);
} else {
- width = (int)(size * aspectRatio);
+ width = (int) (size * aspectRatio);
height = size;
}
@@ -93,15 +91,14 @@ public class Picture extends Image {
int previousWidth = getWidth();
int previousHeight = getHeight();
- if (previousWidth != width
- || previousHeight != height) {
+ if (previousWidth != width || previousHeight != height) {
int type = bufferedImage.getType();
- float scaleX = ((float)width / (float)previousWidth);
- float scaleY = ((float)height / (float)previousHeight);
+ float scaleX = ((float) width / (float) previousWidth);
+ float scaleY = ((float) height / (float) previousHeight);
java.awt.image.BufferedImage bufferedImageLocal = new BufferedImage(width, height, type);
- Graphics2D bufferedImageGraphics = (Graphics2D)bufferedImageLocal.getGraphics();
+ Graphics2D bufferedImageGraphics = (Graphics2D) bufferedImageLocal.getGraphics();
// Clear the background
if (this.bufferedImage.getTransparency() != Transparency.OPAQUE) {
@@ -131,7 +128,8 @@ public class Picture extends Image {
}
}
- bufferedImageGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, interpolationHint);
+ bufferedImageGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
+ interpolationHint);
// Draw the image
bufferedImageGraphics.scale(scaleX, scaleY);
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ActivityIndicatorSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ActivityIndicatorSkin.java?rev=1529349&r1=1529348&r2=1529349&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ActivityIndicatorSkin.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ActivityIndicatorSkin.java Fri Oct 4 23:45:40 2013
@@ -23,13 +23,13 @@ import org.apache.pivot.wtk.Component;
/**
* Abstract base class for activity indicator skins.
*/
-public abstract class ActivityIndicatorSkin extends ComponentSkin
- implements ActivityIndicatorListener {
+public abstract class ActivityIndicatorSkin extends ComponentSkin implements
+ ActivityIndicatorListener {
@Override
public void install(Component component) {
super.install(component);
- ActivityIndicator activityIndicator = (ActivityIndicator)component;
+ ActivityIndicator activityIndicator = (ActivityIndicator) component;
activityIndicator.getActivityIndicatorListeners().add(this);
}