001 // Copyright (c) 2001 Hursh Jain (http://www.mollypages.org) 002 // The Molly framework is freely distributable under the terms of an 003 // MIT-style license. For details, see the molly pages web site at: 004 // http://www.mollypages.org/. Use, modify, have fun ! 005 006 package fc.web.forms; 007 008 import javax.servlet.*; 009 import javax.servlet.http.*; 010 import java.io.*; 011 import java.util.*; 012 013 import fc.jdbc.*; 014 import fc.io.*; 015 import fc.util.*; 016 017 /** 018 Represents an HTML field that accepts a 'maxlength' html 019 attribute 020 **/ 021 public abstract class MaxSizable extends AbstractText 022 { 023 protected int size = 0; 024 protected int maxlen = 0; 025 026 protected MaxSizable(String name) 027 { 028 this(name, ""); 029 } 030 031 protected MaxSizable(String name, String value) 032 { 033 super(name, value); 034 } 035 036 037 /** 038 Specifies the size of this text box. This value (if set) is 039 rendered as the html <tt>SIZE</tt> tag. 040 041 @return this object for method chaining convenience 042 **/ 043 public MaxSizable setSize(int size) { 044 this.size = size; 045 return this; 046 } 047 048 /** 049 Specifies the maximum number of characters a text box can accept. 050 This value (if set) is rendered as the html <tt>MAXLENGTH</tt> tag. 051 052 @return this object for method chaining convenience 053 **/ 054 public MaxSizable setMaxSize(int maxlen) { 055 this.maxlen = maxlen; 056 return this; 057 } 058 059 } //~class MaxSize