You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:58:25 UTC
svn commit: r673833 [2/18] - in /myfaces/tomahawk/trunk:
core/src/main/java/org/apache/myfaces/component/
core/src/main/java/org/apache/myfaces/component/html/ext/
core/src/main/java/org/apache/myfaces/component/html/util/
core/src/main/java/org/apache...
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/CAPTCHARenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/CAPTCHARenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/CAPTCHARenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/CAPTCHARenderer.java Thu Jul 3 14:58:05 2008
@@ -61,16 +61,16 @@
public class CAPTCHARenderer extends Renderer implements ResourceLoader {
public void encodeBegin(FacesContext context, UIComponent component)
- throws IOException {
+ throws IOException {
- CAPTCHAComponent captchaComponent = (CAPTCHAComponent) component;
+ CAPTCHAComponent captchaComponent = (CAPTCHAComponent) component;
- generateImageTag(context, captchaComponent);
+ generateImageTag(context, captchaComponent);
}
public void encodeEnd(FacesContext context, UIComponent component)
- throws IOException {
- super.encodeEnd(context, component);
+ throws IOException {
+ super.encodeEnd(context, component);
}
/*
@@ -78,52 +78,52 @@
* use the (AddResource) to generate the url of the generated image.
*/
private void generateImageTag(FacesContext context,
- CAPTCHAComponent component) throws IOException {
+ CAPTCHAComponent component) throws IOException {
- AddResource addResource;
- ResponseWriter writer = context.getResponseWriter();
- Map params = HtmlComponentUtils.getParameterMap(component);
- String url;
- String captchaSessionKeyName = component.getCaptchaSessionKeyName();
- String width = component.getImageWidth();
- String height = component.getImageHeight();
-
- // determine width and height of the generated image.
- if(width == null)
- {
- width = CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH + "";
- }
-
- if(height == null)
- {
- height = CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT + "";
- }
-
- writer.startElement(HTML.IMG_ELEM, component);
-
- // constructing the parameter map to be passed to the (AddResource).
- if (captchaSessionKeyName != null)
- {
- params.put(CAPTCHAComponent.ATTRIBUTE_CAPTCHA_SESSION_KEY_NAME,
- captchaSessionKeyName);
- }
-
- // write the url to trigger the (AddResource).
- addResource = AddResourceFactory.getInstance(context);
-
- url = context.getExternalContext().encodeResourceURL(
- addResource.getResourceUri(context,
- new ParameterResourceHandler(this.getClass(), params)));
-
-
- writer.writeAttribute(HTML.SRC_ATTR, url, null);
-
- // write rest of attributes.
- writer.writeAttribute(HTML.WIDTH_ATTR, width, null);
-
- writer.writeAttribute(HTML.HEIGHT_ATTR, height, null);
-
- writer.endElement(HTML.IMG_ELEM);
+ AddResource addResource;
+ ResponseWriter writer = context.getResponseWriter();
+ Map params = HtmlComponentUtils.getParameterMap(component);
+ String url;
+ String captchaSessionKeyName = component.getCaptchaSessionKeyName();
+ String width = component.getImageWidth();
+ String height = component.getImageHeight();
+
+ // determine width and height of the generated image.
+ if(width == null)
+ {
+ width = CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH + "";
+ }
+
+ if(height == null)
+ {
+ height = CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT + "";
+ }
+
+ writer.startElement(HTML.IMG_ELEM, component);
+
+ // constructing the parameter map to be passed to the (AddResource).
+ if (captchaSessionKeyName != null)
+ {
+ params.put(CAPTCHAComponent.ATTRIBUTE_CAPTCHA_SESSION_KEY_NAME,
+ captchaSessionKeyName);
+ }
+
+ // write the url to trigger the (AddResource).
+ addResource = AddResourceFactory.getInstance(context);
+
+ url = context.getExternalContext().encodeResourceURL(
+ addResource.getResourceUri(context,
+ new ParameterResourceHandler(this.getClass(), params)));
+
+
+ writer.writeAttribute(HTML.SRC_ATTR, url, null);
+
+ // write rest of attributes.
+ writer.writeAttribute(HTML.WIDTH_ATTR, width, null);
+
+ writer.writeAttribute(HTML.HEIGHT_ATTR, height, null);
+
+ writer.endElement(HTML.IMG_ELEM);
}
/*
@@ -131,39 +131,39 @@
* It wraps the CAPTCHA image generation.
*/
public void serveResource(ServletContext servletContext,
- HttpServletRequest request, HttpServletResponse response,
- String resourceUri) throws IOException {
+ HttpServletRequest request, HttpServletResponse response,
+ String resourceUri) throws IOException {
- // get the FacesContext from the ServletContext.
- FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder
- .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
- LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
- .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
- Lifecycle lifecycle = lifecycleFactory.getLifecycle(HtmlComponentUtils
- .getLifecycleId(servletContext));
- FacesContext facesContext = facesContextFactory.getFacesContext(
- servletContext, request, response, lifecycle);
- facesContext.setResponseStream(new CAPTCHAResponseStream(response
- .getOutputStream()));
-
- // render the CAPTCHA.
- try
- {
- try
- {
- renderCAPTCHA(facesContext);
- }
- catch (IOException e)
- {
- throw new FacesException("Could not render the CAPTCHA : "
- + e.getMessage(), e);
- }
- facesContext.getResponseStream().close();
- }
- finally
- {
- facesContext.release();
- }
+ // get the FacesContext from the ServletContext.
+ FacesContextFactory facesContextFactory = (FacesContextFactory) FactoryFinder
+ .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ Lifecycle lifecycle = lifecycleFactory.getLifecycle(HtmlComponentUtils
+ .getLifecycleId(servletContext));
+ FacesContext facesContext = facesContextFactory.getFacesContext(
+ servletContext, request, response, lifecycle);
+ facesContext.setResponseStream(new CAPTCHAResponseStream(response
+ .getOutputStream()));
+
+ // render the CAPTCHA.
+ try
+ {
+ try
+ {
+ renderCAPTCHA(facesContext);
+ }
+ catch (IOException e)
+ {
+ throw new FacesException("Could not render the CAPTCHA : "
+ + e.getMessage(), e);
+ }
+ facesContext.getResponseStream().close();
+ }
+ finally
+ {
+ facesContext.release();
+ }
}
/*
@@ -171,42 +171,42 @@
*/
protected void renderCAPTCHA(FacesContext facesContext) throws IOException {
- // getting CAPTCHA attributes.
- HttpServletResponse response = (HttpServletResponse) facesContext
- .getExternalContext().getResponse();
- ResponseStream out = facesContext.getResponseStream();
- Map requestMap = facesContext.getExternalContext()
- .getRequestParameterMap();
- HttpServletRequest request = (HttpServletRequest) facesContext
- .getExternalContext().getRequest();
- String captchaSessionKeyName = requestMap.get(
- CAPTCHAComponent.ATTRIBUTE_CAPTCHA_SESSION_KEY_NAME).toString();
-
- // construct the CAPTCHA image generator object.
- CAPTCHAImageGenerator captchaImageGenerator = new CAPTCHAImageGenerator();
-
- try
- {
- String captchaText;
- Color endingColor = ColorGenerator.generateRandomColor(null);
- Color startingColor = ColorGenerator.generateRandomColor(endingColor);
-
- // Generate random CAPTCHA text.
- captchaText = CAPTCHATextGenerator.generateRandomText();
-
- // Generate the image, the BG color is randomized from starting to ending colors.
+ // getting CAPTCHA attributes.
+ HttpServletResponse response = (HttpServletResponse) facesContext
+ .getExternalContext().getResponse();
+ ResponseStream out = facesContext.getResponseStream();
+ Map requestMap = facesContext.getExternalContext()
+ .getRequestParameterMap();
+ HttpServletRequest request = (HttpServletRequest) facesContext
+ .getExternalContext().getRequest();
+ String captchaSessionKeyName = requestMap.get(
+ CAPTCHAComponent.ATTRIBUTE_CAPTCHA_SESSION_KEY_NAME).toString();
+
+ // construct the CAPTCHA image generator object.
+ CAPTCHAImageGenerator captchaImageGenerator = new CAPTCHAImageGenerator();
+
+ try
+ {
+ String captchaText;
+ Color endingColor = ColorGenerator.generateRandomColor(null);
+ Color startingColor = ColorGenerator.generateRandomColor(endingColor);
+
+ // Generate random CAPTCHA text.
+ captchaText = CAPTCHATextGenerator.generateRandomText();
+
+ // Generate the image, the BG color is randomized from starting to ending colors.
captchaImageGenerator.generateImage(response, captchaText,
- startingColor, endingColor);
+ startingColor, endingColor);
- // Set the generated text in the user session.
- request.getSession().setAttribute(captchaSessionKeyName,
- captchaText);
-
- }
- finally
- {
- out.close();
- facesContext.responseComplete();
- }
+ // Set the generated text in the user session.
+ request.getSession().setAttribute(captchaSessionKeyName,
+ captchaText);
+
+ }
+ finally
+ {
+ out.close();
+ facesContext.responseComplete();
+ }
}
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAConstants.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAConstants.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAConstants.java Thu Jul 3 14:58:05 2008
@@ -22,9 +22,9 @@
* This interface holds all the CAPTCHA related constants.
*/
public interface CAPTCHAConstants {
- public static final int DEFAULT_CAPTCHA_WIDTH = 290;
- public static final int DEFAULT_CAPTCHA_HEIGHT = 81;
- public static final double PI = 3.1415926535897932384626433832795;
- public static final int TEXT_X_COORDINATE = 50;
- public static final int TEXT_Y_COORDINATE = 60;
+ public static final int DEFAULT_CAPTCHA_WIDTH = 290;
+ public static final int DEFAULT_CAPTCHA_HEIGHT = 81;
+ public static final double PI = 3.1415926535897932384626433832795;
+ public static final int TEXT_X_COORDINATE = 50;
+ public static final int TEXT_Y_COORDINATE = 60;
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAImageGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAImageGenerator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAImageGenerator.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAImageGenerator.java Thu Jul 3 14:58:05 2008
@@ -47,41 +47,41 @@
*/
private void drawTextOnImage(Graphics2D graphics, String captchaText) {
- Font font;
- TextLayout textLayout;
- double currentFontStatus = Math.random();
-
- // Generate random font status.
- if (currentFontStatus >= 0.5)
- {
- font = new Font("Arial", Font.PLAIN, 60);
- }
- else
- {
- font = new Font("Arial", Font.BOLD, 60);
- }
-
- graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- textLayout = new TextLayout(captchaText, font, graphics
- .getFontRenderContext());
+ Font font;
+ TextLayout textLayout;
+ double currentFontStatus = Math.random();
+
+ // Generate random font status.
+ if (currentFontStatus >= 0.5)
+ {
+ font = new Font("Arial", Font.PLAIN, 60);
+ }
+ else
+ {
+ font = new Font("Arial", Font.BOLD, 60);
+ }
+
+ graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ textLayout = new TextLayout(captchaText, font, graphics
+ .getFontRenderContext());
- textLayout.draw(graphics, CAPTCHAConstants.TEXT_X_COORDINATE,
- CAPTCHAConstants.TEXT_Y_COORDINATE);
+ textLayout.draw(graphics, CAPTCHAConstants.TEXT_X_COORDINATE,
+ CAPTCHAConstants.TEXT_Y_COORDINATE);
}
/*
* A helper method to apply noise on the generated image.
*/
private void applyNoiseOnImage(Graphics2D graphics, int bufferedImageWidth,
- int bufferedImageHeight, Color startingColor, Color endingColor) {
+ int bufferedImageHeight, Color startingColor, Color endingColor) {
- // Applying shear.
- applyShear(graphics, bufferedImageWidth, bufferedImageHeight,
- startingColor, endingColor);
+ // Applying shear.
+ applyShear(graphics, bufferedImageWidth, bufferedImageHeight,
+ startingColor, endingColor);
- // Drawing a broken line on the image.
- drawBrokenLineOnImage(graphics);
+ // Drawing a broken line on the image.
+ drawBrokenLineOnImage(graphics);
}
/*
@@ -89,12 +89,12 @@
* Graphics2D object.
*/
private static void applyCurrentGradientPaint(Graphics2D graphics,
- int width, int height, Color startingColor, Color endingColor) {
+ int width, int height, Color startingColor, Color endingColor) {
- GradientPaint gradientPaint = new GradientPaint(0, 0, startingColor,
- width, height, endingColor);
+ GradientPaint gradientPaint = new GradientPaint(0, 0, startingColor,
+ width, height, endingColor);
- graphics.setPaint(gradientPaint);
+ graphics.setPaint(gradientPaint);
}
@@ -107,82 +107,82 @@
* @throws IOException
*/
public void generateImage(HttpServletResponse response, String captchaText,
- Color startingColor, Color endingColor) throws IOException {
+ Color startingColor, Color endingColor) throws IOException {
- BufferedImage bufferedImage;
- Graphics2D graphics;
- PNGEncodeParam param;
- PNGImageEncoder captchaPNGImage;
-
- // Create the CAPTCHA Image.
- bufferedImage = new BufferedImage(CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH, CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT,
- BufferedImage.TYPE_BYTE_INDEXED);
+ BufferedImage bufferedImage;
+ Graphics2D graphics;
+ PNGEncodeParam param;
+ PNGImageEncoder captchaPNGImage;
+
+ // Create the CAPTCHA Image.
+ bufferedImage = new BufferedImage(CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH, CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT,
+ BufferedImage.TYPE_BYTE_INDEXED);
- // Setup the graphics object.
- graphics = bufferedImage.createGraphics();
+ // Setup the graphics object.
+ graphics = bufferedImage.createGraphics();
- applyCurrentGradientPaint(graphics, bufferedImage.getWidth(),
- bufferedImage.getHeight(), startingColor, endingColor);
+ applyCurrentGradientPaint(graphics, bufferedImage.getWidth(),
+ bufferedImage.getHeight(), startingColor, endingColor);
- graphics.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage
- .getHeight());
+ graphics.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage
+ .getHeight());
- graphics.setColor(Color.black);
+ graphics.setColor(Color.black);
- // Draw text on the CAPTCHA image.
- drawTextOnImage(graphics, captchaText);
+ // Draw text on the CAPTCHA image.
+ drawTextOnImage(graphics, captchaText);
- // Apply noise on the CAPTCHA image.
- applyNoiseOnImage(graphics, bufferedImage.getWidth(), bufferedImage
- .getHeight(), startingColor, endingColor);
+ // Apply noise on the CAPTCHA image.
+ applyNoiseOnImage(graphics, bufferedImage.getWidth(), bufferedImage
+ .getHeight(), startingColor, endingColor);
- // Draw the image border.
- drawBorders(graphics, bufferedImage.getWidth(), bufferedImage
- .getHeight());
+ // Draw the image border.
+ drawBorders(graphics, bufferedImage.getWidth(), bufferedImage
+ .getHeight());
- // Set the reponse content type to jpeg.
- response.setContentType("image/jpg");
+ // Set the reponse content type to jpeg.
+ response.setContentType("image/jpg");
- param = PNGEncodeParam.getDefaultEncodeParam(bufferedImage);
- captchaPNGImage = new PNGImageEncoder(response.getOutputStream(), param);
+ param = PNGEncodeParam.getDefaultEncodeParam(bufferedImage);
+ captchaPNGImage = new PNGImageEncoder(response.getOutputStream(), param);
- captchaPNGImage.encode(bufferedImage);
+ captchaPNGImage.encode(bufferedImage);
}
/*
* This helper method is used for drawing a thick line on the image.
*/
private void drawThickLineOnImage(Graphics graphics, int x1, int y1,
- int x2, int y2) {
+ int x2, int y2) {
- int dX = x2 - x1;
- int dY = y2 - y1;
- int xPoints[] = new int[4];
- int yPoints[] = new int[4];
- int thickness = 2;
-
- double lineLength = Math.sqrt(dX * dX + dY * dY);
- double scale = (double) (thickness) / (2 * lineLength);
- double ddx = -scale * (double) dY;
- double ddy = scale * (double) dX;
-
- graphics.setColor(Color.black);
-
- ddx += (ddx > 0) ? 0.5 : -0.5;
- ddy += (ddy > 0) ? 0.5 : -0.5;
- dX = (int) ddx;
- dY = (int) ddy;
-
- xPoints[0] = x1 + dX;
- yPoints[0] = y1 + dY;
- xPoints[1] = x1 - dX;
- yPoints[1] = y1 - dY;
- xPoints[2] = x2 - dX;
- yPoints[2] = y2 - dY;
- xPoints[3] = x2 + dX;
- yPoints[3] = y2 + dY;
+ int dX = x2 - x1;
+ int dY = y2 - y1;
+ int xPoints[] = new int[4];
+ int yPoints[] = new int[4];
+ int thickness = 2;
+
+ double lineLength = Math.sqrt(dX * dX + dY * dY);
+ double scale = (double) (thickness) / (2 * lineLength);
+ double ddx = -scale * (double) dY;
+ double ddy = scale * (double) dX;
+
+ graphics.setColor(Color.black);
+
+ ddx += (ddx > 0) ? 0.5 : -0.5;
+ ddy += (ddy > 0) ? 0.5 : -0.5;
+ dX = (int) ddx;
+ dY = (int) ddy;
+
+ xPoints[0] = x1 + dX;
+ yPoints[0] = y1 + dY;
+ xPoints[1] = x1 - dX;
+ yPoints[1] = y1 - dY;
+ xPoints[2] = x2 - dX;
+ yPoints[2] = y2 - dY;
+ xPoints[3] = x2 + dX;
+ yPoints[3] = y2 + dY;
- graphics.fillPolygon(xPoints, yPoints, 4);
+ graphics.fillPolygon(xPoints, yPoints, 4);
}
/*
@@ -190,32 +190,32 @@
*/
private void drawBrokenLineOnImage(Graphics2D graphics) {
- int yPoint1;
- int yPoint2;
- int yPoint3;
- int yPoint4;
- int yPoint5;
- Random random = new Random();
-
- // Random Y Points.
- yPoint1 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
- yPoint2 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
- yPoint3 = CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT / 2;
- yPoint4 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
- yPoint5 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
-
- // Draw the random broken line.
- drawThickLineOnImage(graphics, 0, yPoint1,
- CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint2);
- drawThickLineOnImage(graphics,
- CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint2,
- CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 2, yPoint3);
- drawThickLineOnImage(graphics,
- CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 2, yPoint3,
- 3 * CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint4);
- drawThickLineOnImage(graphics,
- 3 * CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint4,
- CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH, yPoint5);
+ int yPoint1;
+ int yPoint2;
+ int yPoint3;
+ int yPoint4;
+ int yPoint5;
+ Random random = new Random();
+
+ // Random Y Points.
+ yPoint1 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
+ yPoint2 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
+ yPoint3 = CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT / 2;
+ yPoint4 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
+ yPoint5 = random.nextInt(CAPTCHAConstants.DEFAULT_CAPTCHA_HEIGHT);
+
+ // Draw the random broken line.
+ drawThickLineOnImage(graphics, 0, yPoint1,
+ CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint2);
+ drawThickLineOnImage(graphics,
+ CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint2,
+ CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 2, yPoint3);
+ drawThickLineOnImage(graphics,
+ CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 2, yPoint3,
+ 3 * CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint4);
+ drawThickLineOnImage(graphics,
+ 3 * CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH / 4, yPoint4,
+ CAPTCHAConstants.DEFAULT_CAPTCHA_WIDTH, yPoint5);
}
/*
@@ -223,55 +223,55 @@
* equation.
*/
private double getDelta(int period, double i, double phase, double frames) {
- return (double) (period / 2)
- * Math.sin(i / (double) period
- + (2 * CAPTCHAConstants.PI * phase) / frames);
+ return (double) (period / 2)
+ * Math.sin(i / (double) period
+ + (2 * CAPTCHAConstants.PI * phase) / frames);
}
/*
* This helper method is used for applying shear on the image.
*/
private void applyShear(Graphics2D graphics, int bufferedImageWidth,
- int bufferedImageHeight, Color startingColor, Color endingColor) {
+ int bufferedImageHeight, Color startingColor, Color endingColor) {
- int periodValue = 20;
- int numberOfFrames = 15;
- int phaseNumber = 7;
- double deltaX;
- double deltaY;
-
- applyCurrentGradientPaint(graphics, bufferedImageWidth,
- bufferedImageHeight, startingColor, endingColor);
-
- for (int i = 0; i < bufferedImageWidth; ++i)
- {
- deltaX = getDelta(periodValue, i, phaseNumber, numberOfFrames);
- graphics.copyArea(i, 0, 1, bufferedImageHeight, 0, (int) deltaX);
- graphics.drawLine(i, (int) deltaX, i, 0);
- graphics.drawLine(i, (int) deltaX + bufferedImageHeight, i,
- bufferedImageHeight);
- }
-
- for (int i = 0; i < bufferedImageHeight; ++i)
- {
- deltaY = getDelta(periodValue, i, phaseNumber, numberOfFrames);
- graphics.copyArea(0, i, bufferedImageWidth, 1, (int) deltaY, 0);
- graphics.drawLine((int) deltaY, i, 0, i);
- graphics.drawLine((int) deltaY + bufferedImageWidth, i,
- bufferedImageWidth, i);
- }
+ int periodValue = 20;
+ int numberOfFrames = 15;
+ int phaseNumber = 7;
+ double deltaX;
+ double deltaY;
+
+ applyCurrentGradientPaint(graphics, bufferedImageWidth,
+ bufferedImageHeight, startingColor, endingColor);
+
+ for (int i = 0; i < bufferedImageWidth; ++i)
+ {
+ deltaX = getDelta(periodValue, i, phaseNumber, numberOfFrames);
+ graphics.copyArea(i, 0, 1, bufferedImageHeight, 0, (int) deltaX);
+ graphics.drawLine(i, (int) deltaX, i, 0);
+ graphics.drawLine(i, (int) deltaX + bufferedImageHeight, i,
+ bufferedImageHeight);
+ }
+
+ for (int i = 0; i < bufferedImageHeight; ++i)
+ {
+ deltaY = getDelta(periodValue, i, phaseNumber, numberOfFrames);
+ graphics.copyArea(0, i, bufferedImageWidth, 1, (int) deltaY, 0);
+ graphics.drawLine((int) deltaY, i, 0, i);
+ graphics.drawLine((int) deltaY + bufferedImageWidth, i,
+ bufferedImageWidth, i);
+ }
}
/*
* This helper method is used for drawing the borders the image.
*/
private void drawBorders(Graphics2D graphics, int width, int height) {
- graphics.setColor(Color.black);
+ graphics.setColor(Color.black);
- graphics.drawLine(0, 0, 0, width - 1);
- graphics.drawLine(0, 0, width - 1, 0);
- graphics.drawLine(0, height - 1, width, height - 1);
- graphics.drawLine(width - 1, height - 1, width - 1, 0);
+ graphics.drawLine(0, 0, 0, width - 1);
+ graphics.drawLine(0, 0, width - 1, 0);
+ graphics.drawLine(0, height - 1, width, height - 1);
+ graphics.drawLine(width - 1, height - 1, width - 1, 0);
}
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAResponseStream.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAResponseStream.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAResponseStream.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHAResponseStream.java Thu Jul 3 14:58:05 2008
@@ -27,30 +27,30 @@
* response stream.
*/
public final class CAPTCHAResponseStream extends ResponseStream {
- private final OutputStream _out;
+ private final OutputStream _out;
- public CAPTCHAResponseStream(OutputStream out) {
- _out = out;
- }
-
- public void close() throws IOException {
- _out.flush();
- _out.close();
- }
-
- public void flush() throws IOException {
- _out.flush();
- }
-
- public void write(byte[] b, int off, int len) throws IOException {
- _out.write(b, off, len);
- }
-
- public void write(byte[] b) throws IOException {
- _out.write(b);
- }
-
- public void write(int b) throws IOException {
- _out.write(b);
- }
+ public CAPTCHAResponseStream(OutputStream out) {
+ _out = out;
+ }
+
+ public void close() throws IOException {
+ _out.flush();
+ _out.close();
+ }
+
+ public void flush() throws IOException {
+ _out.flush();
+ }
+
+ public void write(byte[] b, int off, int len) throws IOException {
+ _out.write(b, off, len);
+ }
+
+ public void write(byte[] b) throws IOException {
+ _out.write(b);
+ }
+
+ public void write(int b) throws IOException {
+ _out.write(b);
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHATextGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHATextGenerator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHATextGenerator.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/CAPTCHATextGenerator.java Thu Jul 3 14:58:05 2008
@@ -25,39 +25,39 @@
* CAPTCHA text.
*/
public class CAPTCHATextGenerator {
-
- /* CAPTCHA possible characters */
- private final static char[] CAPTCHA_POSSIBLE_CHARS = new char[] { 'a', 'b',
- 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
- 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2',
- '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
- 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
-
- /**
- * generateRandomText() generates the CAPTCHA text
- * @return the random generated text.
- */
- public static String generateRandomText() {
-
- int totalPossibleCharacters = CAPTCHA_POSSIBLE_CHARS.length - 1;
- String captchaText = "";
- Random random = new Random();
- int captchaTextLength = 5;
- int randomNumber = random.nextInt(10);
-
- // Determine the CAPTCHA Length whether it is five or six.
- if(randomNumber >= 5) {
- captchaTextLength = 6;
- }
-
- // Generate the random String.
- for (int i = 0; i < captchaTextLength; ++i) {
- captchaText += CAPTCHA_POSSIBLE_CHARS[random
- .nextInt(totalPossibleCharacters) + 1];
- }
-
- return captchaText;
- }
-
+
+ /* CAPTCHA possible characters */
+ private final static char[] CAPTCHA_POSSIBLE_CHARS = new char[] { 'a', 'b',
+ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2',
+ '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
+ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
+ 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
+
+ /**
+ * generateRandomText() generates the CAPTCHA text
+ * @return the random generated text.
+ */
+ public static String generateRandomText() {
+
+ int totalPossibleCharacters = CAPTCHA_POSSIBLE_CHARS.length - 1;
+ String captchaText = "";
+ Random random = new Random();
+ int captchaTextLength = 5;
+ int randomNumber = random.nextInt(10);
+
+ // Determine the CAPTCHA Length whether it is five or six.
+ if(randomNumber >= 5) {
+ captchaTextLength = 6;
+ }
+
+ // Generate the random String.
+ for (int i = 0; i < captchaTextLength; ++i) {
+ captchaText += CAPTCHA_POSSIBLE_CHARS[random
+ .nextInt(totalPossibleCharacters) + 1];
+ }
+
+ return captchaText;
+ }
+
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/ColorGenerator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/ColorGenerator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/ColorGenerator.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/captcha/util/ColorGenerator.java Thu Jul 3 14:58:05 2008
@@ -34,44 +34,44 @@
* @return the new color.
*/
public static Color generateRandomColor(Color startFrom) {
-
- /* if the startingFrom color is null, then generate a new random color. */
- if (startFrom == null)
- {
- return new Color((int) (Math.random() * COLOR_DEGREES), (int) (Math
- .random() * COLOR_DEGREES),
- (int) (Math.random() * COLOR_DEGREES));
- }
+
+ /* if the startingFrom color is null, then generate a new random color. */
+ if (startFrom == null)
+ {
+ return new Color((int) (Math.random() * COLOR_DEGREES), (int) (Math
+ .random() * COLOR_DEGREES),
+ (int) (Math.random() * COLOR_DEGREES));
+ }
- /* try to avoid the startFrom color. */
- int startingRed = (startFrom.getRed() >= 128) ? 0 : 128;
- int startingGreen = (startFrom.getGreen() >= 128) ? 0 : 128;
- int startingBlue = (startFrom.getBlue() >= 128) ? 0 : 128;
-
- // generate the new random colors.
- int newRandomRed = (int) (Math.random() * (startingRed + COLOR_GENERATOR_DELTA));
- int newRandomGreen = (int) (Math.random() * (startingGreen + COLOR_GENERATOR_DELTA));
- int newRandomBlue = (int) (Math.random() * (startingBlue + COLOR_GENERATOR_DELTA));
-
- /*
- * If the newly generated color is less than the starting color
- * then add the starting color to it.
- */
- if (newRandomRed < startingRed)
- {
- newRandomRed += startingRed;
- }
+ /* try to avoid the startFrom color. */
+ int startingRed = (startFrom.getRed() >= 128) ? 0 : 128;
+ int startingGreen = (startFrom.getGreen() >= 128) ? 0 : 128;
+ int startingBlue = (startFrom.getBlue() >= 128) ? 0 : 128;
+
+ // generate the new random colors.
+ int newRandomRed = (int) (Math.random() * (startingRed + COLOR_GENERATOR_DELTA));
+ int newRandomGreen = (int) (Math.random() * (startingGreen + COLOR_GENERATOR_DELTA));
+ int newRandomBlue = (int) (Math.random() * (startingBlue + COLOR_GENERATOR_DELTA));
+
+ /*
+ * If the newly generated color is less than the starting color
+ * then add the starting color to it.
+ */
+ if (newRandomRed < startingRed)
+ {
+ newRandomRed += startingRed;
+ }
- if (newRandomGreen < startingGreen)
- {
- newRandomGreen += startingGreen;
- }
-
- if (newRandomBlue < startingBlue)
- {
- newRandomBlue += startingBlue;
- }
+ if (newRandomGreen < startingGreen)
+ {
+ newRandomGreen += startingGreen;
+ }
+
+ if (newRandomBlue < startingBlue)
+ {
+ newRandomBlue += startingBlue;
+ }
- return new Color(newRandomRed, newRandomGreen, newRandomBlue);
+ return new Color(newRandomRed, newRandomGreen, newRandomBlue);
}
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java Thu Jul 3 14:58:05 2008
@@ -61,7 +61,7 @@
*
* @JSFProperty
*/
- public abstract Object getGroupByValue();
+ public abstract Object getGroupByValue();
/**
* This attribute tells the datatable to make this column the
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/creditcardvalidator/AbstractCreditCardValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/creditcardvalidator/AbstractCreditCardValidator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/creditcardvalidator/AbstractCreditCardValidator.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/creditcardvalidator/AbstractCreditCardValidator.java Thu Jul 3 14:58:05 2008
@@ -42,93 +42,93 @@
*/
public abstract class AbstractCreditCardValidator extends ValidatorBase {
- /**
- * <p>The standard converter id for this converter.</p>
- */
- public static final String VALIDATOR_ID = "org.apache.myfaces.validator.CreditCard";
-
- /**
- * <p>The message identifier of the {@link FacesMessage} to be created if
- * the creditcard check fails.</p>
- */
- public static final String CREDITCARD_MESSAGE_ID = "org.apache.myfaces.Creditcard.INVALID";
-
- public AbstractCreditCardValidator(){
- }
-
- //Field, to init the desired Validator
- private int _initSum = 0;
-
- private org.apache.commons.validator.CreditCardValidator creditCardValidator = null;
-
- /**
- *
- */
- public void validate(
- FacesContext facesContext,
- UIComponent uiComponent,
- Object value)
- throws ValidatorException {
-
- if (facesContext == null) throw new NullPointerException("facesContext");
- if (uiComponent == null) throw new NullPointerException("uiComponent");
-
- if (value == null)
- {
- return;
- }
- initValidator();
- if (!this.creditCardValidator.isValid(value.toString())){
- Object[] args = {value.toString()};
+ /**
+ * <p>The standard converter id for this converter.</p>
+ */
+ public static final String VALIDATOR_ID = "org.apache.myfaces.validator.CreditCard";
+
+ /**
+ * <p>The message identifier of the {@link FacesMessage} to be created if
+ * the creditcard check fails.</p>
+ */
+ public static final String CREDITCARD_MESSAGE_ID = "org.apache.myfaces.Creditcard.INVALID";
+
+ public AbstractCreditCardValidator(){
+ }
+
+ //Field, to init the desired Validator
+ private int _initSum = 0;
+
+ private org.apache.commons.validator.CreditCardValidator creditCardValidator = null;
+
+ /**
+ *
+ */
+ public void validate(
+ FacesContext facesContext,
+ UIComponent uiComponent,
+ Object value)
+ throws ValidatorException {
+
+ if (facesContext == null) throw new NullPointerException("facesContext");
+ if (uiComponent == null) throw new NullPointerException("uiComponent");
+
+ if (value == null)
+ {
+ return;
+ }
+ initValidator();
+ if (!this.creditCardValidator.isValid(value.toString())){
+ Object[] args = {value.toString()};
throw new ValidatorException(getFacesMessage(CREDITCARD_MESSAGE_ID, args));
- }
- }
+ }
+ }
- // -------------------------------------------------------- Private Methods
+ // -------------------------------------------------------- Private Methods
- /**
- * <p>initializes the desired validator.</p>
- */
-
- private void initValidator() {
- if(isNone()){
- //no cardtypes are allowed
- creditCardValidator = new org.apache.commons.validator.CreditCardValidator(org.apache.commons.validator.CreditCardValidator.NONE);
- }
- else{
- computeValidators();
- creditCardValidator = new org.apache.commons.validator.CreditCardValidator(_initSum);
- }
- }
-
- /**
- * private methode, that counts the desired creditCards
- */
- private void computeValidators(){
- if(isAmex()){
- this._initSum= org.apache.commons.validator.CreditCardValidator.AMEX + _initSum;
- }
- if(isVisa()){
- this._initSum= org.apache.commons.validator.CreditCardValidator.VISA+ _initSum;
- }
- if(isMastercard()){
- this._initSum= org.apache.commons.validator.CreditCardValidator.MASTERCARD+ _initSum;
- }
- if(isDiscover()){
- this._initSum= org.apache.commons.validator.CreditCardValidator.DISCOVER+ _initSum;
- }
- }
-
- //GETTER & SETTER
-
- /**
- * american express cards
- *
- * @JSFProperty
- * defaultValue = "true"
- */
- public abstract boolean isAmex();
+ /**
+ * <p>initializes the desired validator.</p>
+ */
+
+ private void initValidator() {
+ if(isNone()){
+ //no cardtypes are allowed
+ creditCardValidator = new org.apache.commons.validator.CreditCardValidator(org.apache.commons.validator.CreditCardValidator.NONE);
+ }
+ else{
+ computeValidators();
+ creditCardValidator = new org.apache.commons.validator.CreditCardValidator(_initSum);
+ }
+ }
+
+ /**
+ * private methode, that counts the desired creditCards
+ */
+ private void computeValidators(){
+ if(isAmex()){
+ this._initSum= org.apache.commons.validator.CreditCardValidator.AMEX + _initSum;
+ }
+ if(isVisa()){
+ this._initSum= org.apache.commons.validator.CreditCardValidator.VISA+ _initSum;
+ }
+ if(isMastercard()){
+ this._initSum= org.apache.commons.validator.CreditCardValidator.MASTERCARD+ _initSum;
+ }
+ if(isDiscover()){
+ this._initSum= org.apache.commons.validator.CreditCardValidator.DISCOVER+ _initSum;
+ }
+ }
+
+ //GETTER & SETTER
+
+ /**
+ * american express cards
+ *
+ * @JSFProperty
+ * defaultValue = "true"
+ */
+ public abstract boolean isAmex();
/**
* validation for discover
@@ -136,7 +136,7 @@
* @JSFProperty
* defaultValue = "true"
*/
- public abstract boolean isDiscover();
+ public abstract boolean isDiscover();
/**
* validation for mastercard
@@ -144,7 +144,7 @@
* @JSFProperty
* defaultValue = "true"
*/
- public abstract boolean isMastercard();
+ public abstract boolean isMastercard();
/**
* none of the given cardtypes is allowed.
@@ -152,7 +152,7 @@
* @JSFProperty
* defaultValue = "false"
*/
- public abstract boolean isNone();
+ public abstract boolean isNone();
/**
* validation for visa
@@ -160,16 +160,16 @@
* @JSFProperty
* defaultValue = "true"
*/
- public abstract boolean isVisa();
+ public abstract boolean isVisa();
- public abstract void setAmex(boolean b);
+ public abstract void setAmex(boolean b);
- public abstract void setDiscover(boolean b);
+ public abstract void setDiscover(boolean b);
- public abstract void setMastercard(boolean b);
+ public abstract void setMastercard(boolean b);
- public abstract void setNone(boolean b);
+ public abstract void setNone(boolean b);
- public abstract void setVisa(boolean b);
+ public abstract void setVisa(boolean b);
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datalist/AbstractHtmlDataList.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datalist/AbstractHtmlDataList.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datalist/AbstractHtmlDataList.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datalist/AbstractHtmlDataList.java Thu Jul 3 14:58:05 2008
@@ -51,7 +51,7 @@
public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlDataList";
private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.List";
- private static Log log = LogFactory.getLog(AbstractHtmlDataList.class);
+ private static Log log = LogFactory.getLog(AbstractHtmlDataList.class);
private static final int PROCESS_DECODES = 1;
private static final int PROCESS_VALIDATORS = 2; // not currently in use
private static final int PROCESS_UPDATES = 3; // not currently in use
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/HtmlDataScrollerRenderer.java Thu Jul 3 14:58:05 2008
@@ -262,15 +262,15 @@
}
if (scroller.isPaginator())
{
- if(!scroller.isSingleElementLayout())
- {
- writeScrollerElementStart(writer, scroller);
- }
+ if(!scroller.isSingleElementLayout())
+ {
+ writeScrollerElementStart(writer, scroller);
+ }
renderPaginator(facesContext, scroller);
- if(!scroller.isSingleElementLayout())
- {
- writeScrollerElementEnd(writer, scroller);
- }
+ if(!scroller.isSingleElementLayout())
+ {
+ writeScrollerElementEnd(writer, scroller);
+ }
}
facetComp = scroller.getNext();
if (facetComp != null)
@@ -339,15 +339,15 @@
protected void renderFacet(FacesContext facesContext, HtmlDataScroller scroller,
UIComponent facetComp, String facetName) throws IOException
{
- String onclick = scroller.getOnclick();
- String ondblclick = scroller.getOndblclick();
+ String onclick = scroller.getOnclick();
+ String ondblclick = scroller.getOndblclick();
- HtmlCommandLink link = getLink(facesContext, scroller, facetName);
+ HtmlCommandLink link = getLink(facesContext, scroller, facetName);
if(onclick != null){
- link.setOnclick(onclick);
+ link.setOnclick(onclick);
}
if(ondblclick != null){
- link.setOndblclick(ondblclick);
+ link.setOndblclick(ondblclick);
}
link.encodeBegin(facesContext);
@@ -416,7 +416,7 @@
}
String onclick = scroller.getOnclick();
- String ondblclick = scroller.getOndblclick();
+ String ondblclick = scroller.getOndblclick();
for (int i = start, size = start + pages; i < size; i++)
{
@@ -503,7 +503,7 @@
Application application = facesContext.getApplication();
- // See Jira Issue TOMAHAWK-117 http://issues.apache.org/jira/browse/TOMAHAWK-117
+ // See Jira Issue TOMAHAWK-117 http://issues.apache.org/jira/browse/TOMAHAWK-117
// and http://issues.apache.org/jira/browse/MYFACES-1809
HtmlCommandLink link = new org.apache.myfaces.component.html.ext.HtmlCommandLink();
@@ -534,7 +534,7 @@
{
Application application = facesContext.getApplication();
- // See Jira Issue TOMAHAWK-117 http://issues.apache.org/jira/browse/TOMAHAWK-117
+ // See Jira Issue TOMAHAWK-117 http://issues.apache.org/jira/browse/TOMAHAWK-117
// and http://issues.apache.org/jira/browse/MYFACES-1809
HtmlCommandLink link = new org.apache.myfaces.component.html.ext.HtmlCommandLink();
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/ScrollerActionEvent.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/ScrollerActionEvent.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/ScrollerActionEvent.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/datascroller/ScrollerActionEvent.java Thu Jul 3 14:58:05 2008
@@ -30,60 +30,60 @@
*/
public class ScrollerActionEvent extends ActionEvent
{
- private static final long serialVersionUID = -5692343289423906802L;
+ private static final long serialVersionUID = -5692343289423906802L;
- private final String mScrollerfacet;
+ private final String mScrollerfacet;
- private final int mPageIndex;
+ private final int mPageIndex;
- /**
+ /**
* An event representing a user's choice of navigation option
* <i>except</i> jumping to a specific page.
* <o>
* Param scrollerFacet contains the name of the operation performed,
* which matches one of the public HtmlDataScroller.FACET_* constants.
- */
- public ScrollerActionEvent(UIComponent component, String scrollerfacet)
- {
- super(component);
- mScrollerfacet = scrollerfacet;
- mPageIndex = -1;
- }
+ */
+ public ScrollerActionEvent(UIComponent component, String scrollerfacet)
+ {
+ super(component);
+ mScrollerfacet = scrollerfacet;
+ mPageIndex = -1;
+ }
- /**
- * An event representing a user's choice to jump straight to page
+ /**
+ * An event representing a user's choice to jump straight to page
* #pageIndex of the available pages of data.
*
* @param component is the DataScroller component
* @param pageIndex is in the range 0..(nPages-1), where nPages
* is (rowsOfDataAvailable/rowsPerPage).
- */
- public ScrollerActionEvent(UIComponent component, int pageIndex)
- {
- super(component);
- if (pageIndex < 0)
- {
- throw new IllegalArgumentException("wrong pageindex");
- }
- mPageIndex = pageIndex;
- mScrollerfacet = null;
- }
+ */
+ public ScrollerActionEvent(UIComponent component, int pageIndex)
+ {
+ super(component);
+ if (pageIndex < 0)
+ {
+ throw new IllegalArgumentException("wrong pageindex");
+ }
+ mPageIndex = pageIndex;
+ mScrollerfacet = null;
+ }
- /**
+ /**
* Returns a string which matches one of the HtmlDataScroller.FACET_*
* public constants, or null if the user chose a page# navigation option.
- */
- public String getScrollerfacet()
- {
- return mScrollerfacet;
- }
+ */
+ public String getScrollerfacet()
+ {
+ return mScrollerfacet;
+ }
- /**
+ /**
* Return the page of data the user wants to see, or -1 if the
* user didn't choose a page# navigation option.
- */
- public int getPageIndex()
- {
- return mPageIndex;
- }
+ */
+ public int getPageIndex()
+ {
+ return mPageIndex;
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/AbstractHtmlInputDate.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/AbstractHtmlInputDate.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/AbstractHtmlInputDate.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/AbstractHtmlInputDate.java Thu Jul 3 14:58:05 2008
@@ -308,15 +308,15 @@
* @JSFProperty
* defaultValue = "\"\""
*/
- public abstract String getEmptyMonthSelection();
-
+ public abstract String getEmptyMonthSelection();
+
/**
* Label to be used when displaying an empty ampm selection
*
* @JSFProperty
* defaultValue = "\"\""
- */
- public abstract String getEmptyAmpmSelection();
+ */
+ public abstract String getEmptyAmpmSelection();
/**
* HTML: When true, indicates that this component cannot be modified by the user.
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java Thu Jul 3 14:58:05 2008
@@ -54,13 +54,13 @@
* @version $Revision$ $Date$
*/
public class HtmlDateRenderer extends HtmlRenderer {
- /**
- * <p>The message identifier of the {@link FacesMessage} to be created if
- * the input is not a valid date.</p>
- */
- public static final String DATE_MESSAGE_ID = "org.apache.myfaces.Date.INVALID";
+ /**
+ * <p>The message identifier of the {@link FacesMessage} to be created if
+ * the input is not a valid date.</p>
+ */
+ public static final String DATE_MESSAGE_ID = "org.apache.myfaces.Date.INVALID";
- private static final String ID_DAY_POSTFIX = ".day";
+ private static final String ID_DAY_POSTFIX = ".day";
private static final String ID_MONTH_POSTFIX = ".month";
private static final String ID_YEAR_POSTFIX = ".year";
private static final String ID_HOURS_POSTFIX = ".hours";
@@ -70,7 +70,7 @@
static public String getClientIdForDaySubcomponent(String clientId)
{
- return clientId + ID_DAY_POSTFIX;
+ return clientId + ID_DAY_POSTFIX;
}
protected boolean isDisabled(FacesContext facesContext, HtmlInputDate inputDate) {
@@ -93,7 +93,7 @@
String clientId = uiComponent.getClientId(facesContext);
boolean disabled = isDisabled(facesContext, inputDate);
- boolean readonly = inputDate.isReadonly();
+ boolean readonly = inputDate.isReadonly();
ResponseWriter writer = facesContext.getResponseWriter();
@@ -103,24 +103,24 @@
writer.writeAttribute(HTML.ID_ATTR, clientId, null);
if( ! (type.equals("time") || type.equals("short_time"))){
- encodeInputDay(inputDate, writer, clientId, userData, disabled, readonly);
- encodeInputMonth(inputDate, writer, clientId, userData, currentLocale, disabled, readonly);
- encodeInputYear(inputDate, writer, clientId, userData, disabled, readonly);
+ encodeInputDay(inputDate, writer, clientId, userData, disabled, readonly);
+ encodeInputMonth(inputDate, writer, clientId, userData, currentLocale, disabled, readonly);
+ encodeInputYear(inputDate, writer, clientId, userData, disabled, readonly);
- if( inputDate.isPopupCalendar() && ! disabled && ! readonly )
- encodePopupCalendarButton(facesContext, uiComponent, writer, clientId, currentLocale);
+ if( inputDate.isPopupCalendar() && ! disabled && ! readonly )
+ encodePopupCalendarButton(facesContext, uiComponent, writer, clientId, currentLocale);
}
if( type.equals("both") || type.equals("full")){
writer.write(" ");
}
if( ! type.equals("date")){
- encodeInputHours(uiComponent, writer, clientId, userData, disabled, readonly);
- writer.write(":");
- encodeInputMinutes(uiComponent, writer, clientId, userData, disabled, readonly);
- if (type.equals("full")|| type.equals("time")) {
- writer.write(":");
- encodeInputSeconds(uiComponent, writer, clientId, userData, disabled, readonly);
- }
+ encodeInputHours(uiComponent, writer, clientId, userData, disabled, readonly);
+ writer.write(":");
+ encodeInputMinutes(uiComponent, writer, clientId, userData, disabled, readonly);
+ if (type.equals("full")|| type.equals("time")) {
+ writer.write(":");
+ encodeInputSeconds(uiComponent, writer, clientId, userData, disabled, readonly);
+ }
if (ampm) {
encodeInputAmpm(uiComponent, writer, clientId, userData, disabled, readonly, currentLocale);
}
@@ -130,32 +130,32 @@
}
protected void encodeInputField(UIComponent uiComponent, ResponseWriter writer, String id,
- String value, int size, boolean disabled, boolean readonly) throws IOException {
+ String value, int size, boolean disabled, boolean readonly) throws IOException {
writer.startElement(HTML.INPUT_ELEM, uiComponent);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.INPUT_ATTRIBUTES);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
- if (disabled) {
- writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
- }
- if( readonly ) {
- writer.writeAttribute(HTML.READONLY_ATTR, Boolean.TRUE, null);
- }
-
- writer.writeAttribute(HTML.ID_ATTR, id, null);
- writer.writeAttribute(HTML.NAME_ATTR, id, null);
- writer.writeAttribute(HTML.SIZE_ATTR, Integer.toString(size), null);
- writer.writeAttribute(HTML.MAXLENGTH_ATTR, Integer.toString(size), null);
- if (value != null) {
- writer.writeAttribute(HTML.VALUE_ATTR, value, null);
- }
- writer.endElement(HTML.INPUT_ELEM);
+ if (disabled) {
+ writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
+ }
+ if( readonly ) {
+ writer.writeAttribute(HTML.READONLY_ATTR, Boolean.TRUE, null);
+ }
+
+ writer.writeAttribute(HTML.ID_ATTR, id, null);
+ writer.writeAttribute(HTML.NAME_ATTR, id, null);
+ writer.writeAttribute(HTML.SIZE_ATTR, Integer.toString(size), null);
+ writer.writeAttribute(HTML.MAXLENGTH_ATTR, Integer.toString(size), null);
+ if (value != null) {
+ writer.writeAttribute(HTML.VALUE_ATTR, value, null);
+ }
+ writer.endElement(HTML.INPUT_ELEM);
}
protected void encodeInputDay(UIComponent uiComponent, ResponseWriter writer, String clientId,
- UserData userData, boolean disabled, boolean readonly) throws IOException {
+ UserData userData, boolean disabled, boolean readonly) throws IOException {
encodeInputField(uiComponent, writer, getClientIdForDaySubcomponent(clientId), userData.getDay(), 2, disabled, readonly);
}
@@ -202,38 +202,38 @@
}
protected void encodeEmptyInputMonthSelection(UIComponent component, ResponseWriter writer, int selectedMonth) throws IOException{
- writer.startElement(HTML.OPTION_ELEM, component);
+ writer.startElement(HTML.OPTION_ELEM, component);
writer.writeAttribute(HTML.VALUE_ATTR, "-1", null);
if(selectedMonth == -1)
- writer.writeAttribute(HTML.SELECTED_ATTR, HTML.SELECTED_ATTR, null);
+ writer.writeAttribute(HTML.SELECTED_ATTR, HTML.SELECTED_ATTR, null);
writer.writeText(((HtmlInputDate)component).getEmptyMonthSelection(), null);
writer.endElement(HTML.OPTION_ELEM);
}
protected void encodeInputYear(UIComponent uiComponent, ResponseWriter writer, String clientId,
- UserData userData, boolean disabled, boolean readonly) throws IOException {
+ UserData userData, boolean disabled, boolean readonly) throws IOException {
encodeInputField(uiComponent, writer, clientId + ID_YEAR_POSTFIX, userData.getYear(), 4, disabled, readonly);
}
protected void encodeInputHours(UIComponent uiComponent, ResponseWriter writer, String clientId,
- UserData userData, boolean disabled, boolean readonly) throws IOException {
+ UserData userData, boolean disabled, boolean readonly) throws IOException {
encodeInputField(uiComponent, writer, clientId + ID_HOURS_POSTFIX, userData.getHours(), 2, disabled, readonly);
}
protected void encodeInputMinutes(UIComponent uiComponent, ResponseWriter writer, String clientId,
- UserData userData, boolean disabled, boolean readonly) throws IOException {
+ UserData userData, boolean disabled, boolean readonly) throws IOException {
encodeInputField(uiComponent, writer, clientId + ID_MINUTES_POSTFIX, userData.getMinutes(), 2, disabled, readonly);
}
protected void encodeInputSeconds(UIComponent uiComponent, ResponseWriter writer, String clientId,
- UserData userData, boolean disabled, boolean readonly) throws IOException {
+ UserData userData, boolean disabled, boolean readonly) throws IOException {
encodeInputField(uiComponent, writer, clientId + ID_SECONDS_POSTFIX, userData.getSeconds(), 2, disabled, readonly);
}
protected void encodeAmpmChoice(DateFormatSymbols symbols, UIComponent uiComponent, ResponseWriter writer, int calendar_ampm, int selected) throws IOException {
- String[] ampm_choices = symbols.getAmPmStrings();
+ String[] ampm_choices = symbols.getAmPmStrings();
writer.write("\t\t");
writer.startElement(HTML.OPTION_ELEM, uiComponent);
writer.writeAttribute(HTML.VALUE_ATTR, new Integer(calendar_ampm), null);
@@ -244,7 +244,7 @@
}
protected void encodeInputAmpm(UIComponent uiComponent, ResponseWriter writer, String clientId,
- UserData userData, boolean disabled, boolean readonly, Locale currentLocale) throws IOException {
+ UserData userData, boolean disabled, boolean readonly, Locale currentLocale) throws IOException {
writer.startElement(HTML.SELECT_ELEM, uiComponent);
writer.writeAttribute(HTML.ID_ATTR, clientId + ID_AMPM_POSTFIX, null);
writer.writeAttribute(HTML.NAME_ATTR, clientId + ID_AMPM_POSTFIX, null);
@@ -274,11 +274,11 @@
}
protected void encodeEmtypAmpmChoice(UIComponent component, ResponseWriter writer, int selectedAmpm) throws IOException{
- writer.startElement(HTML.OPTION_ELEM, component);
+ writer.startElement(HTML.OPTION_ELEM, component);
writer.writeAttribute(HTML.VALUE_ATTR, "-1", null);
if(selectedAmpm == -1)
- writer.writeAttribute(HTML.SELECTED_ATTR, HTML.SELECTED_ATTR, null);
+ writer.writeAttribute(HTML.SELECTED_ATTR, HTML.SELECTED_ATTR, null);
writer.writeText(((HtmlInputDate)component).getEmptyAmpmSelection(), null);
writer.endElement(HTML.OPTION_ELEM);
@@ -295,8 +295,8 @@
String dateFormat = CalendarDateTimeConverter.createJSPopupFormat(facesContext, null);
String localizedLanguageScript = HtmlCalendarRenderer.getLocalizedLanguageScript(facesContext,
- symbols,Calendar.getInstance(currentLocale).getFirstDayOfWeek(),
- uiComponent,calendarVar);
+ symbols,Calendar.getInstance(currentLocale).getFirstDayOfWeek(),
+ uiComponent,calendarVar);
writer.startElement(HTML.SPAN_ELEM,uiComponent);
writer.writeAttribute(HTML.ID_ATTR,uiComponent.getClientId(facesContext)+"Span",
@@ -313,7 +313,7 @@
writer.endElement(HTML.SCRIPT_ELEM);
- HtmlCalendarRenderer.getScriptBtn(writer, facesContext, uiComponent,
+ HtmlCalendarRenderer.getScriptBtn(writer, facesContext, uiComponent,
dateFormat,"...",new FunctionCallProvider(){
public String getFunctionCall(FacesContext facesContext, UIComponent uiComponent, String dateFormat)
{
@@ -354,10 +354,10 @@
userData.setHours( (String) requestMap.get(clientId + ID_HOURS_POSTFIX) );
userData.setMinutes( (String) requestMap.get(clientId + ID_MINUTES_POSTFIX) );
if (type.equals("full") || type.equals("time"))
- userData.setSeconds( (String) requestMap.get(clientId + ID_SECONDS_POSTFIX) );
+ userData.setSeconds( (String) requestMap.get(clientId + ID_SECONDS_POSTFIX) );
if (inputDate.isAmpm()) {
- userData.setAmpm( (String) requestMap.get(clientId + ID_AMPM_POSTFIX) );
+ userData.setAmpm( (String) requestMap.get(clientId + ID_AMPM_POSTFIX) );
}
}
inputDate.setSubmittedValue( userData );
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocument.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocument.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocument.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocument.java Thu Jul 3 14:58:05 2008
@@ -33,63 +33,63 @@
*/
public class AbstractDocument extends UIComponentBase
{
- private String _state = null;
+ private String _state = null;
- public static final String COMPONENT_FAMILY = "javax.faces.Data";
+ public static final String COMPONENT_FAMILY = "javax.faces.Data";
- public AbstractDocument(String renderType)
- {
- setRendererType(renderType);
- }
-
- public String getFamily()
- {
- return COMPONENT_FAMILY;
- }
-
- public void setState(String state)
- {
- _state = state;
- }
-
- /**
- * state="start|end". Used to demarkate the document boundaries
- *
- * @JSFProperty
- * literalOnly = "true"
- */
- public String getState()
- {
- return _state;
- }
-
- public boolean hasState()
- {
- return isStartState() || isEndState();
- }
-
- public boolean isStartState()
- {
- return "start".equals(getState());
- }
-
- public boolean isEndState()
- {
- return "end".equals(getState());
- }
-
- public Object saveState(FacesContext context)
- {
- Object values[] = new Object[2];
- values[0] = super.saveState(context);
- values[1] = _state;
- return values;
- }
-
- public void restoreState(FacesContext context, Object state)
- {
- Object values[] = (Object[]) state;
- super.restoreState(context, values[0]);
- _state = (String) values[1];
- }
+ public AbstractDocument(String renderType)
+ {
+ setRendererType(renderType);
+ }
+
+ public String getFamily()
+ {
+ return COMPONENT_FAMILY;
+ }
+
+ public void setState(String state)
+ {
+ _state = state;
+ }
+
+ /**
+ * state="start|end". Used to demarkate the document boundaries
+ *
+ * @JSFProperty
+ * literalOnly = "true"
+ */
+ public String getState()
+ {
+ return _state;
+ }
+
+ public boolean hasState()
+ {
+ return isStartState() || isEndState();
+ }
+
+ public boolean isStartState()
+ {
+ return "start".equals(getState());
+ }
+
+ public boolean isEndState()
+ {
+ return "end".equals(getState());
+ }
+
+ public Object saveState(FacesContext context)
+ {
+ Object values[] = new Object[2];
+ values[0] = super.saveState(context);
+ values[1] = _state;
+ return values;
+ }
+
+ public void restoreState(FacesContext context, Object state)
+ {
+ Object values[] = (Object[]) state;
+ super.restoreState(context, values[0]);
+ _state = (String) values[1];
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocumentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocumentRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocumentRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/AbstractDocumentRenderer.java Thu Jul 3 14:58:05 2008
@@ -35,56 +35,56 @@
*/
public abstract class AbstractDocumentRenderer extends Renderer
{
- protected abstract String getHtmlTag();
- protected abstract Class getDocumentClass();
+ protected abstract String getHtmlTag();
+ protected abstract Class getDocumentClass();
- public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
- throws IOException
- {
- RendererUtils.checkParamValidity(facesContext, uiComponent,
- getDocumentClass());
-
- AbstractDocument document = (AbstractDocument) uiComponent;
-
- ResponseWriter writer = facesContext.getResponseWriter();
-
- if (document.hasState() && document.isEndState())
- {
- closeTag(facesContext, writer);
- }
- else
- {
- openTag(writer, uiComponent);
- }
- }
-
- protected void openTag(ResponseWriter writer, UIComponent uiComponent)
- throws IOException
- {
- writer.startElement(getHtmlTag(), uiComponent);
- }
-
- protected void closeTag(FacesContext facesContext, ResponseWriter writer)
- throws IOException
- {
- writeBeforeEnd(facesContext);
- writer.endElement(getHtmlTag());
- }
-
- public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
- throws IOException
- {
- AbstractDocument document = (AbstractDocument) uiComponent;
-
- ResponseWriter writer = facesContext.getResponseWriter();
-
- if (!document.hasState())
- {
- closeTag(facesContext, writer);
- }
- }
-
- protected void writeBeforeEnd(FacesContext facesContext) throws IOException
- {
- }
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ RendererUtils.checkParamValidity(facesContext, uiComponent,
+ getDocumentClass());
+
+ AbstractDocument document = (AbstractDocument) uiComponent;
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ if (document.hasState() && document.isEndState())
+ {
+ closeTag(facesContext, writer);
+ }
+ else
+ {
+ openTag(writer, uiComponent);
+ }
+ }
+
+ protected void openTag(ResponseWriter writer, UIComponent uiComponent)
+ throws IOException
+ {
+ writer.startElement(getHtmlTag(), uiComponent);
+ }
+
+ protected void closeTag(FacesContext facesContext, ResponseWriter writer)
+ throws IOException
+ {
+ writeBeforeEnd(facesContext);
+ writer.endElement(getHtmlTag());
+ }
+
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+ throws IOException
+ {
+ AbstractDocument document = (AbstractDocument) uiComponent;
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ if (!document.hasState())
+ {
+ closeTag(facesContext, writer);
+ }
+ }
+
+ protected void writeBeforeEnd(FacesContext facesContext) throws IOException
+ {
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/Document.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/Document.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/Document.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/Document.java Thu Jul 3 14:58:05 2008
@@ -33,11 +33,11 @@
*/
public class Document extends AbstractDocument
{
- public static final String COMPONENT_TYPE = "org.apache.myfaces.Document";
- private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Document";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.Document";
+ private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Document";
- public Document()
- {
- super(DEFAULT_RENDERER_TYPE);
- }
+ public Document()
+ {
+ super(DEFAULT_RENDERER_TYPE);
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentBodyRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentBodyRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentBodyRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentBodyRenderer.java Thu Jul 3 14:58:05 2008
@@ -39,33 +39,33 @@
*/
public class DocumentBodyRenderer extends AbstractDocumentRenderer
{
- public static final String RENDERER_TYPE = "org.apache.myfaces.DocumentBody";
- private String BODY_ELEM = "body";
- private String[] ATTRS = new String[] {"onload", "onunload", "onresize", "onkeypress", "style", "styleClass", "id"};
+ public static final String RENDERER_TYPE = "org.apache.myfaces.DocumentBody";
+ private String BODY_ELEM = "body";
+ private String[] ATTRS = new String[] {"onload", "onunload", "onresize", "onkeypress", "style", "styleClass", "id"};
- protected String getHtmlTag()
- {
- return BODY_ELEM;
- }
+ protected String getHtmlTag()
+ {
+ return BODY_ELEM;
+ }
- protected Class getDocumentClass()
- {
- return DocumentBody.class;
- }
+ protected Class getDocumentClass()
+ {
+ return DocumentBody.class;
+ }
- protected void openTag(ResponseWriter writer, UIComponent uiComponent)
- throws IOException
- {
- super.openTag(writer, uiComponent);
+ protected void openTag(ResponseWriter writer, UIComponent uiComponent)
+ throws IOException
+ {
+ super.openTag(writer, uiComponent);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, ATTRS);
- }
+ }
- protected void writeBeforeEnd(FacesContext facesContext) throws IOException
- {
- super.writeBeforeEnd(facesContext);
- ExtensionsPhaseListener.writeCodeBeforeBodyEnd(facesContext);
+ protected void writeBeforeEnd(FacesContext facesContext) throws IOException
+ {
+ super.writeBeforeEnd(facesContext);
+ ExtensionsPhaseListener.writeCodeBeforeBodyEnd(facesContext);
- // fake string, so the ExtensionsPhaseListener will not create the javascript again
- facesContext.getExternalContext().getRequestMap().put(ExtensionsPhaseListener.ORG_APACHE_MYFACES_MY_FACES_JAVASCRIPT, "");
- }
+ // fake string, so the ExtensionsPhaseListener will not create the javascript again
+ facesContext.getExternalContext().getRequestMap().put(ExtensionsPhaseListener.ORG_APACHE_MYFACES_MY_FACES_JAVASCRIPT, "");
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHead.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHead.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHead.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHead.java Thu Jul 3 14:58:05 2008
@@ -32,11 +32,11 @@
*/
public class DocumentHead extends AbstractDocument
{
- public static final String COMPONENT_TYPE = "org.apache.myfaces.DocumentHead";
- private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.DocumentHead";
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.DocumentHead";
+ private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.DocumentHead";
- public DocumentHead()
- {
- super(DEFAULT_RENDERER_TYPE);
- }
+ public DocumentHead()
+ {
+ super(DEFAULT_RENDERER_TYPE);
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHeadRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHeadRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHeadRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentHeadRenderer.java Thu Jul 3 14:58:05 2008
@@ -40,26 +40,26 @@
*/
public class DocumentHeadRenderer extends AbstractDocumentRenderer
{
- public static final String RENDERER_TYPE = "org.apache.myfaces.DocumentHead";
+ public static final String RENDERER_TYPE = "org.apache.myfaces.DocumentHead";
- protected String getHtmlTag()
- {
- return "head";
- }
+ protected String getHtmlTag()
+ {
+ return "head";
+ }
- protected Class getDocumentClass()
- {
- return DocumentHead.class;
- }
+ protected Class getDocumentClass()
+ {
+ return DocumentHead.class;
+ }
- protected void writeBeforeEnd(FacesContext facesContext) throws IOException
- {
- super.writeBeforeEnd(facesContext);
-
- AddResource addResource = AddResourceFactory.getInstance(facesContext);
- if (addResource instanceof StreamingAddResource)
- {
- ((StreamingAddResource) addResource).addStyleLoaderHere(facesContext, DocumentHead.class);
- }
- }
+ protected void writeBeforeEnd(FacesContext facesContext) throws IOException
+ {
+ super.writeBeforeEnd(facesContext);
+
+ AddResource addResource = AddResourceFactory.getInstance(facesContext);
+ if (addResource instanceof StreamingAddResource)
+ {
+ ((StreamingAddResource) addResource).addStyleLoaderHere(facesContext, DocumentHead.class);
+ }
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentRenderer.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/document/DocumentRenderer.java Thu Jul 3 14:58:05 2008
@@ -32,15 +32,15 @@
*/
public class DocumentRenderer extends AbstractDocumentRenderer
{
- public static final String RENDERER_TYPE = "org.apache.myfaces.Document";
+ public static final String RENDERER_TYPE = "org.apache.myfaces.Document";
- protected String getHtmlTag()
- {
- return "html";
- }
+ protected String getHtmlTag()
+ {
+ return "html";
+ }
- protected Class getDocumentClass()
- {
- return Document.class;
- }
+ protected Class getDocumentClass()
+ {
+ return Document.class;
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/dojo/DojoUtils.java Thu Jul 3 14:58:05 2008
@@ -189,15 +189,15 @@
renderWidgetInitializationCode(writer, component, DEBUG_CONSOLE_TYPE, attributeMap, MYFACES_DOJO_DEBUGCONSOLE_ID, true);
}
- /**
- * check if dojo is going to be used
- */
- public static boolean isDojoInitialized(FacesContext facesContext)
- {
- return isInlineScriptCheck(facesContext, DJCONFIG_INITKEY);
- }
+ /**
+ * check if dojo is going to be used
+ */
+ public static boolean isDojoInitialized(FacesContext facesContext)
+ {
+ return isInlineScriptCheck(facesContext, DJCONFIG_INITKEY);
+ }
- public static void addMainInclude(FacesContext facesContext, UIComponent component, String javascriptLocation, DojoConfig config) throws IOException {
+ public static void addMainInclude(FacesContext facesContext, UIComponent component, String javascriptLocation, DojoConfig config) throws IOException {
AddResource addResource = AddResourceFactory.getInstance(facesContext);
@@ -446,19 +446,19 @@
return true;
}
- /**
- * check if the script with the given inlineScript-name has been added
- */
- public static boolean isInlineScriptCheck(FacesContext context, String inlineScript)
- {
- // TODO move this non neutral code into the resource handler
- HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
- Set set = getBodyScriptInfos(request);
+ /**
+ * check if the script with the given inlineScript-name has been added
+ */
+ public static boolean isInlineScriptCheck(FacesContext context, String inlineScript)
+ {
+ // TODO move this non neutral code into the resource handler
+ HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
+ Set set = getBodyScriptInfos(request);
- return set.contains(inlineScript);
- }
+ return set.contains(inlineScript);
+ }
- /**
+ /**
* please, instead of using standard dojo taglib mechanisms use this code
* for initialisation it will render a clean and proper javascript
* initialisation instead. There are issues with ADF and the dojo taglib
@@ -540,8 +540,8 @@
if (!first)
writer.write(",");
writer.write(entry.getKey().toString());
- writer.write(":"); // only real string values should be within
- // ambersants, dojo req
+ writer.write(":"); // only real string values should be within
+ // ambersants, dojo req
boolean isString = value instanceof String;
if (isString)
{
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/emailvalidator/EmailValidator.java Thu Jul 3 14:58:05 2008
@@ -42,42 +42,42 @@
*/
public class EmailValidator extends ValidatorBase {
- /**
- * <p>The standard converter id for this converter.</p>
- */
- public static final String VALIDATOR_ID = "org.apache.myfaces.validator.Email";
- /**
- * <p>The message identifier of the {@link FacesMessage} to be created if
- * the maximum length check fails.</p>
- */
- public static final String EMAIL_MESSAGE_ID = "org.apache.myfaces.Email.INVALID";
-
- public EmailValidator(){
- }
-
- /**
- * methode that validates an email-address.
- * it uses the commons-validator
- */
- public void validate(
- FacesContext facesContext,
- UIComponent uiComponent,
- Object value)
- throws ValidatorException {
-
-
- if (facesContext == null) throw new NullPointerException("facesContext");
- if (uiComponent == null) throw new NullPointerException("uiComponent");
-
- if (value == null)
- {
- return;
- }
- if (!GenericValidator.isEmail(value.toString().trim())) {
- Object[] args = {value.toString()};
- throw new ValidatorException(getFacesMessage(EMAIL_MESSAGE_ID, args));
- }
+ /**
+ * <p>The standard converter id for this converter.</p>
+ */
+ public static final String VALIDATOR_ID = "org.apache.myfaces.validator.Email";
+ /**
+ * <p>The message identifier of the {@link FacesMessage} to be created if
+ * the maximum length check fails.</p>
+ */
+ public static final String EMAIL_MESSAGE_ID = "org.apache.myfaces.Email.INVALID";
+
+ public EmailValidator(){
+ }
+
+ /**
+ * methode that validates an email-address.
+ * it uses the commons-validator
+ */
+ public void validate(
+ FacesContext facesContext,
+ UIComponent uiComponent,
+ Object value)
+ throws ValidatorException {
+
+
+ if (facesContext == null) throw new NullPointerException("facesContext");
+ if (uiComponent == null) throw new NullPointerException("uiComponent");
+
+ if (value == null)
+ {
+ return;
+ }
+ if (!GenericValidator.isEmail(value.toString().trim())) {
+ Object[] args = {value.toString()};
+ throw new ValidatorException(getFacesMessage(EMAIL_MESSAGE_ID, args));
+ }
- }
+ }
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/equalvalidator/AbstractEqualValidator.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/equalvalidator/AbstractEqualValidator.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/equalvalidator/AbstractEqualValidator.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/equalvalidator/AbstractEqualValidator.java Thu Jul 3 14:58:05 2008
@@ -52,34 +52,34 @@
public abstract class AbstractEqualValidator extends ValidatorBase {
- /**
- * <p>The standard converter id for this converter.</p>
- */
- public static final String VALIDATOR_ID = "org.apache.myfaces.validator.Equal";
-
- /**
- * <p>The message identifier of the {@link FacesMessage} to be created if
- * the equal_for check fails.</p>
- */
- public static final String EQUAL_MESSAGE_ID = "org.apache.myfaces.Equal.INVALID";
+ /**
+ * <p>The standard converter id for this converter.</p>
+ */
+ public static final String VALIDATOR_ID = "org.apache.myfaces.validator.Equal";
+
+ /**
+ * <p>The message identifier of the {@link FacesMessage} to be created if
+ * the equal_for check fails.</p>
+ */
+ public static final String EQUAL_MESSAGE_ID = "org.apache.myfaces.Equal.INVALID";
- public AbstractEqualValidator(){
- }
+ public AbstractEqualValidator(){
+ }
// -------------------------------------------------------- ValidatorIF
- public void validate(
- FacesContext facesContext,
- UIComponent uiComponent,
- Object value)
- throws ValidatorException {
+ public void validate(
+ FacesContext facesContext,
+ UIComponent uiComponent,
+ Object value)
+ throws ValidatorException {
- if (facesContext == null) throw new NullPointerException("facesContext");
+ if (facesContext == null) throw new NullPointerException("facesContext");
if (uiComponent == null) throw new NullPointerException("uiComponent");
- if (value == null)
- {
- return;
- }
+ if (value == null)
+ {
+ return;
+ }
UIComponent foreignComp = uiComponent.getParent().findComponent(getFor());
if(foreignComp==null)
@@ -124,14 +124,14 @@
}
- Object[] args = {value.toString(),(foreignValue==null) ? foreignComp.getId():foreignValue.toString()};
+ Object[] args = {value.toString(),(foreignValue==null) ? foreignComp.getId():foreignValue.toString()};
- if(foreignEditableValueHolder.getValue()==null || !foreignValue.toString().equals(value.toString()) )
+ if(foreignEditableValueHolder.getValue()==null || !foreignValue.toString().equals(value.toString()) )
{
throw new ValidatorException(getFacesMessage(EQUAL_MESSAGE_ID, args));
}
- }
+ }
// ---------------- Borrowed to convert foreign submitted values
@@ -214,18 +214,18 @@
return componentValueObject;
}
- // -------------------------------------------------------- GETTER & SETTER
+ // -------------------------------------------------------- GETTER & SETTER
- /**
- * the id of the foreign component, which is needed for the validation
- *
- * @JSFProperty
- * @return the foreign component_id, on which a value should be validated
- */
- public abstract String getFor();
-
- /**
- * @param string the foreign component_id, on which a value should be validated
- */
- public abstract void setFor(String string);
+ /**
+ * the id of the foreign component, which is needed for the validation
+ *
+ * @JSFProperty
+ * @return the foreign component_id, on which a value should be validated
+ */
+ public abstract String getFor();
+
+ /**
+ * @param string the foreign component_id, on which a value should be validated
+ */
+ public abstract void setFor(String string);
}
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/AbstractHtmlInputFileUpload.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/AbstractHtmlInputFileUpload.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/AbstractHtmlInputFileUpload.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/fileupload/AbstractHtmlInputFileUpload.java Thu Jul 3 14:58:05 2008
@@ -72,7 +72,7 @@
/**
* @JSFProperty
*/
- public abstract String getStorage();
+ public abstract String getStorage();
/**
* @JSFProperty
*/