01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20: package com.salmonllc.forms;
21:
22: /////////////////////////
23: //$Archive: /SOFIA/SourceCode/com/salmonllc/forms/DateRange.java $
24: //$Author: Srufle $
25: //$Revision: 10 $
26: //$Modtime: 4/15/03 2:24p $
27: /////////////////////////
28: import com.salmonllc.html.HtmlText;
29: import com.salmonllc.html.HtmlTextEdit;
30:
31: /**
32: * Encapsulates a range of dates with two entry fields.
33: */
34: public class DateRange extends com.salmonllc.html.HtmlContainer {
35: private HtmlTextEdit _hteFrom;
36: private HtmlTextEdit _hteTo;
37:
38: /**
39: * DateRange constructor comment.
40: * @param name java.lang.String
41: * @param p com.salmonllc.html.HtmlPage
42: */
43: public DateRange(String name, com.salmonllc.html.HtmlPage p) {
44: super (name, p);
45: HtmlTextEdit hte;
46: add(new HtmlText("From:", HtmlText.FONT_COLUMN_CAPTION, p));
47: hte = _hteFrom = new HtmlTextEdit(name + "_from", p);
48: hte.setMaxLength(25);
49: hte.setSize(15);
50: add(hte);
51: add(new HtmlText("To:", HtmlText.FONT_COLUMN_CAPTION, p));
52: hte = _hteTo = new HtmlTextEdit(name + "_to", p);
53: hte.setMaxLength(25);
54: hte.setSize(15);
55: add(hte);
56: }
57:
58: /**
59: * This method was gets the from date string .
60: * @return java.lang.String
61: */
62: public String getFromDate() {
63: String s = _hteFrom.getValue();
64: if (s != null)
65: if (s.trim().length() == 0)
66: s = null;
67: return s;
68: }
69:
70: /**
71: * This method was gets the to date string .
72: * @return java.lang.String
73: */
74: public String getToDate() {
75: String s = _hteTo.getValue();
76: if (s != null)
77: if (s.trim().length() == 0)
78: s = null;
79: return s;
80: }
81: }
|