[Comsuite-svn] SF.net SVN: comsuite: [192] trunk/code/CSAdminPanel/JavaSource/org/ commsuite/web/v
Brought to you by:
zduniak
|
From: <sku...@us...> - 2006-10-03 16:29:23
|
Revision: 192
http://svn.sourceforge.net/comsuite/?rev=192&view=rev
Author: skuzniak
Date: 2006-10-03 09:29:05 -0700 (Tue, 03 Oct 2006)
Log Message:
-----------
missing class
Added Paths:
-----------
trunk/code/CSAdminPanel/JavaSource/org/commsuite/web/validator/EnormousLenghtValidator.java
Added: trunk/code/CSAdminPanel/JavaSource/org/commsuite/web/validator/EnormousLenghtValidator.java
===================================================================
--- trunk/code/CSAdminPanel/JavaSource/org/commsuite/web/validator/EnormousLenghtValidator.java (rev 0)
+++ trunk/code/CSAdminPanel/JavaSource/org/commsuite/web/validator/EnormousLenghtValidator.java 2006-10-03 16:29:05 UTC (rev 192)
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.commsuite.web.validator;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.commsuite.web.beans.LanguageSelectionBean;
+
+/**
+ * @author simon
+ *
+ */
+public class EnormousLenghtValidator implements Validator {
+
+ private static final int MAX_LENGTH = 1000;
+
+ private static final String MESSAGE_TO_LONG = "MESSAGE_ERROR_LONG";
+
+ private static final String BUNDLE_NAME = "org.commsuite.web.locale.Locale";
+
+ public void validate(FacesContext context, UIComponent component, Object value)
+ throws ValidatorException {
+ if (MAX_LENGTH < value.toString().length()) {
+ String message = LanguageSelectionBean.getDisplayString(BUNDLE_NAME, MESSAGE_TO_LONG, null,
+ FacesContext.getCurrentInstance().getViewRoot().getLocale());
+ throw new ValidatorException(new FacesMessage(message));
+ }
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|