MAJOR restructuring of the engine code to get the execution environment info
separated from the internal objects (as well as separating the internal interfaces), some prep work for modularizing the SIG-to-service interface so it'll be easier to add chat and stuff. Also fixed up a display issue with 1-character CDTextFormFields.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is the Venice Web Community System.
|
||||
* The Original Code is the Venice Web Communities System.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||
@@ -22,6 +22,11 @@ import com.silverwrist.venice.ValidationException;
|
||||
|
||||
public class CDEmailAddressFormField extends CDTextFormField
|
||||
{
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public CDEmailAddressFormField(String name, String caption, String caption2, boolean required,
|
||||
int size, int maxlength)
|
||||
{
|
||||
@@ -35,13 +40,24 @@ public class CDEmailAddressFormField extends CDTextFormField
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class CDTextFormField
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected void validateContents(String value) throws ValidationException
|
||||
{
|
||||
super.validateContents(value);
|
||||
if (!IDUtils.isValidEmailAddress(value))
|
||||
throw new ValidationException("The value of '" + getCaption() + "' must be a correct Internet address.");
|
||||
|
||||
} // end validateContents
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface CDFormField
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public Object clone()
|
||||
{
|
||||
return new CDEmailAddressFormField(this);
|
||||
|
||||
@@ -94,6 +94,7 @@ public class CDIntegerFormField extends CDTextFormField
|
||||
|
||||
protected void validateContents(String value) throws ValidationException
|
||||
{
|
||||
super.validateContents(value);
|
||||
try
|
||||
{ // convert to an integer and check against range
|
||||
int x = Integer.parseInt(value);
|
||||
|
||||
@@ -30,6 +30,7 @@ public class CDTextFormField extends CDBaseFormField
|
||||
|
||||
private int size;
|
||||
private int maxlength;
|
||||
private int real_maxlength;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
@@ -40,8 +41,9 @@ public class CDTextFormField extends CDBaseFormField
|
||||
int size, int maxlength)
|
||||
{
|
||||
super(name,caption,caption2,required);
|
||||
this.size = size;
|
||||
this.maxlength = maxlength;
|
||||
this.size = Math.max(size,2);
|
||||
this.maxlength = Math.max(maxlength,2);
|
||||
this.real_maxlength = maxlength;
|
||||
|
||||
} // end constructor
|
||||
|
||||
@@ -50,6 +52,7 @@ public class CDTextFormField extends CDBaseFormField
|
||||
super(other);
|
||||
this.size = other.size;
|
||||
this.maxlength = other.maxlength;
|
||||
this.real_maxlength = other.real_maxlength;
|
||||
|
||||
} // end constructor
|
||||
|
||||
@@ -73,7 +76,11 @@ public class CDTextFormField extends CDBaseFormField
|
||||
} // end renderActualField
|
||||
|
||||
protected void validateContents(String value) throws ValidationException
|
||||
{ // this is a do-nothing value
|
||||
{
|
||||
if (value.length()>real_maxlength)
|
||||
throw new ValidationException("The value of the '" + getCaption() + "' field must be no longer than "
|
||||
+ real_maxlength + " characters.");
|
||||
|
||||
} // end validateContents
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
|
||||
@@ -47,12 +47,18 @@ public class CDVeniceIDFormField extends CDTextFormField
|
||||
|
||||
protected void validateContents(String value) throws ValidationException
|
||||
{
|
||||
super.validateContents(value);
|
||||
if (!IDUtils.isValidVeniceID(value))
|
||||
throw new ValidationException("There is an invalid character in the '" + getCaption() + "'field. "
|
||||
+ "Valid characters are letters, digits, -, _, !, ~, *, ', and $.");
|
||||
|
||||
} // end validateContents
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Implementations from interface CDFormField
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public CDFormField duplicate()
|
||||
{
|
||||
return new CDVeniceIDFormField(this);
|
||||
|
||||
Reference in New Issue
Block a user