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 006package fc.web.forms; 007 008import javax.servlet.*; 009import javax.servlet.http.*; 010import java.io.*; 011import java.util.*; 012 013import fc.jdbc.*; 014import fc.io.*; 015import fc.util.*; 016 017/** 018Represents an HTML field that accepts a 'maxlength' html 019attribute 020**/ 021public abstract class MaxSizable extends AbstractText 022{ 023protected int size = 0; 024protected int maxlen = 0; 025 026protected MaxSizable(String name) 027 { 028 this(name, ""); 029 } 030 031protected MaxSizable(String name, String value) 032 { 033 super(name, value); 034 } 035 036 037/** 038Specifies the size of this text box. This value (if set) is 039rendered as the html <tt>SIZE</tt> tag. 040 041@return this object for method chaining convenience 042**/ 043public MaxSizable setSize(int size) { 044 this.size = size; 045 return this; 046 } 047 048/** 049Specifies the maximum number of characters a text box can accept. 050This value (if set) is rendered as the html <tt>MAXLENGTH</tt> tag. 051 052@return this object for method chaining convenience 053**/ 054public MaxSizable setMaxSize(int maxlen) { 055 this.maxlen = maxlen; 056 return this; 057 } 058 059} //~class MaxSize