01: /* *************************************************************************
02:
03: Millstone(TM)
04: Open Sourced User Interface Library for
05: Internet Development with Java
06:
07: Millstone is a registered trademark of IT Mill Ltd
08: Copyright (C) 2000-2005 IT Mill Ltd
09:
10: *************************************************************************
11:
12: This library is free software; you can redistribute it and/or
13: modify it under the terms of the GNU Lesser General Public
14: license version 2.1 as published by the Free Software Foundation.
15:
16: This library is distributed in the hope that it will be useful,
17: but WITHOUT ANY WARRANTY; without even the implied warranty of
18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19: Lesser General Public License for more details.
20:
21: You should have received a copy of the GNU Lesser General Public
22: License along with this library; if not, write to the Free Software
23: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24:
25: *************************************************************************
26:
27: For more information, contact:
28:
29: IT Mill Ltd phone: +358 2 4802 7180
30: Ruukinkatu 2-4 fax: +358 2 4802 7181
31: 20540, Turku email: info@itmill.com
32: Finland company www: www.itmill.com
33:
34: Primary source for MillStone information and releases: www.millstone.org
35:
36: ********************************************************************** */
37:
38: package org.millstone.examples.features;
39:
40: import org.millstone.base.ui.*;
41:
42: public class FeatureTextField extends Feature {
43:
44: public FeatureTextField() {
45: super ();
46: }
47:
48: protected Component getDemoComponent() {
49:
50: OrderedLayout l = new OrderedLayout();
51:
52: // Test component
53: TextField tf = new TextField("Caption");
54: Panel test = new Panel("TextField Component Demo");
55: test.addComponent(tf);
56: l.addComponent(test);
57:
58: // Properties
59: PropertyPanel p = new PropertyPanel(tf);
60: l.addComponent(p);
61: Form f = p.createBeanPropertySet(new String[] { "columns",
62: "rows", "wordwrap", "writeThrough", "readThrough",
63: "nullRepresentation", "nullSettingAllowed", "secret" });
64: p.addProperties("Text field properties", f);
65:
66: return l;
67: }
68:
69: protected String getExampleSrc() {
70: return "TextField tf = new TextField(\"Caption\");\n"
71: + "tf.setValue(\"Contents\");";
72: }
73:
74: /**
75: * @see org.millstone.examples.features.Feature#getDescriptionXHTML()
76: */
77: protected String getDescriptionXHTML() {
78: return "<p>Millstone combines the logic of both the single line text-entry field and the multi-line "
79: + "text-area into one component. "
80: + "As with all Data-components of Millstone, the Textfield can also be bound to an "
81: + "underlying data source, both directly or in a buffered (asynchronous) "
82: + "mode. In buffered mode its background color will change to indicate "
83: + "that the value has changed but is not committed.</p>"
84: + "<p>Furthermore a validators may be bound to the component to "
85: + "check and validate the given input before it is actually commited."
86: + "</p>"
87: + "<p>On the demo tab you can try out how the different properties affect the "
88: + "presentation of the component.</p>";
89: }
90:
91: protected String getImage() {
92: return "textfield.gif";
93: }
94:
95: protected String getTitle() {
96: return "TextField";
97: }
98:
99: }
|