You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/10/29 18:49:09 UTC
svn commit: r708953 -
/wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.java
Author: ivaynberg
Date: Wed Oct 29 10:49:09 2008
New Revision: 708953
URL: http://svn.apache.org/viewvc?rev=708953&view=rev
Log:
WICKET-1901
Modified:
wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.java
Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.java?rev=708953&r1=708952&r2=708953&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/captcha/CaptchaImageResource.java Wed Oct 29 10:49:09 2008
@@ -54,12 +54,12 @@
private static final class CharAttributes implements IClusterable
{
private static final long serialVersionUID = 1L;
- private char c;
- private String name;
- private int rise;
- private double rotation;
- private double shearX;
- private double shearY;
+ private final char c;
+ private final String name;
+ private final int rise;
+ private final double rotation;
+ private final double shearX;
+ private final double shearY;
CharAttributes(char c, String name, double rotation, int rise, double shearX, double shearY)
{
@@ -118,10 +118,10 @@
return new String(b);
}
- private String challengeId;
+ private final String challengeId;
private final List charAttsList;
- private List fontNames = Arrays.asList(new String[] { "Helventica", "Arial", "Courier" });
+ private final List fontNames = Arrays.asList(new String[] { "Helvetica", "Arial", "Courier" });
private final int fontSize;
private final int fontStyle;
@@ -166,11 +166,11 @@
public CaptchaImageResource(String challengeId, int fontSize, int margin)
{
this.challengeId = challengeId;
- this.fontStyle = 1;
+ fontStyle = 1;
this.fontSize = fontSize;
this.margin = margin;
- this.width = this.margin * 2;
- this.height = this.margin * 2;
+ width = this.margin * 2;
+ height = this.margin * 2;
char[] chars = challengeId.toCharArray();
charAttsList = new ArrayList();
TextLayout text;
@@ -185,18 +185,18 @@
double shearX = ran.nextDouble() * 0.2;
double shearY = ran.nextDouble() * 0.2;
CharAttributes cf = new CharAttributes(chars[i], fontName, rotation, rise, shearX,
- shearY);
+ shearY);
charAttsList.add(cf);
text = new TextLayout(chars[i] + "", getFont(fontName), new FontRenderContext(null,
- false, false));
+ false, false));
textAt = new AffineTransform();
textAt.rotate(rotation);
textAt.shear(shearX, shearY);
shape = text.getOutline(textAt);
- this.width += (int)shape.getBounds2D().getWidth();
- if (this.height < (int)shape.getBounds2D().getHeight() + rise)
+ width += (int)shape.getBounds2D().getWidth();
+ if (height < (int)shape.getBounds2D().getHeight() + rise)
{
- this.height = (int)shape.getBounds2D().getHeight() + rise;
+ height = (int)shape.getBounds2D().getHeight() + rise;
}
}
}
@@ -262,8 +262,8 @@
for (int i = 0; i < charAttsList.size(); i++)
{
CharAttributes cf = (CharAttributes)charAttsList.get(i);
- TextLayout text = new TextLayout(cf.getChar() + "", getFont(cf.getName()), gfx
- .getFontRenderContext());
+ TextLayout text = new TextLayout(cf.getChar() + "", getFont(cf.getName()),
+ gfx.getFontRenderContext());
AffineTransform textAt = new AffineTransform();
textAt.translate(curWidth, height - cf.getRise());
textAt.rotate(cf.getRotation());