01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.uilib.form.control;
16:
17: /**
18: * This class represents a textarea control.
19: *
20: * @author Jevgeni Kabanov (ekabanov <i>at</i> araneaframework <i>dot</i> org)
21: *
22: */
23: public class TextareaControl extends StringValueControl {
24:
25: /**
26: * Empty.
27: */
28: public TextareaControl() {
29: //Empty
30: }
31:
32: /**
33: * Makes a text control with specific type and minimum and maximum length constraints.
34: *
35: * @param minLength minimum permitted length.
36: * @param maxLength maximum permitted length.
37: */
38: public TextareaControl(Long minLength, Long maxLength) {
39: setMinLength(minLength);
40: setMaxLength(maxLength);
41: }
42:
43: /**
44: * Makes a text control with specific type and minimum and maximum length constraints.
45: *
46: * @param minLength minimum permitted length.
47: * @param maxLength maximum permitted length.
48: * @param trimValue whether the value from request will be trimmed.
49: */
50: public TextareaControl(Long minLength, Long maxLength,
51: boolean trimValue) {
52: setMinLength(minLength);
53: setMaxLength(maxLength);
54: setTrimValue(trimValue);
55: }
56:
57: //*********************************************************************
58: //* INTERNAL INTERFACE
59: //*********************************************************************
60:
61: /**
62: * Takes away <cr> added by Intenet Explorer.
63: */
64: protected String preprocessRequestParameter(String parameterValue) {
65: String super Processed = super
66: .preprocessRequestParameter(parameterValue);
67:
68: if (super Processed == null)
69: return null;
70:
71: StringBuffer stripped = new StringBuffer(super Processed);
72: int lastCr = stripped.toString().lastIndexOf("\r");
73: while (lastCr != -1) {
74: stripped.delete(lastCr, lastCr + 1);
75: lastCr = stripped.toString().lastIndexOf("\r");
76: }
77: return stripped.toString();
78: }
79: }
|