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-2002 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 FeatureButton extends Feature {
43:
44: public FeatureButton() {
45: super ();
46: }
47:
48: protected Component getDemoComponent() {
49:
50: OrderedLayout l = new OrderedLayout();
51:
52: // Example panel
53: Panel show = new Panel("Button component");
54: Button b = new Button("Caption");
55: show.addComponent(b);
56: l.addComponent(show);
57:
58: // Properties
59: PropertyPanel p = new PropertyPanel(b);
60: Select themes = (Select) p.getField("style");
61: themes.addItem("link").getItemProperty(
62: themes.getItemCaptionPropertyId()).setValue("link");
63: Form ap = p
64: .createBeanPropertySet(new String[] { "switchMode" });
65: p.addProperties("Button Properties", ap);
66: l.addComponent(p);
67:
68: return l;
69: }
70:
71: protected String getExampleSrc() {
72: return "Button b = new Button(\"Caption\");\n";
73:
74: }
75:
76: /**
77: * @see org.millstone.examples.features.Feature#getDescriptionXHTML()
78: */
79: protected String getDescriptionXHTML() {
80: return "In Millstone, boolean input values are represented by buttons. "
81: + "Buttons may function either as a push buttons or switches. (checkboxes)<br/><br/>"
82: + "Button can be directly connected to any method of an object, which "
83: + "is an easy way to trigger events: <code> new Button(\"Play\", myPiano \"playIt\")</code>. "
84: + "Or in checkbox-mode they can be bound to a boolean proterties and create "
85: + " simple selectors.<br /><br /> "
86: + "See the demo and try out how the different properties affect "
87: + "the presentation of the component.";
88: }
89:
90: protected String getImage() {
91: return "button.jpg";
92: }
93:
94: protected String getTitle() {
95: return "Button";
96: }
97:
98: }
|