Source Code Cross Referenced for FeatureForm.java in  » Web-Framework » Millstone » org » millstone » examples » features » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » Millstone » org.millstone.examples.features 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* *************************************************************************
002:         
003:                                        Millstone(TM) 
004:                           Open Sourced User Interface Library for
005:                               Internet Development with Java
006:
007:                     Millstone is a registered trademark of IT Mill Ltd
008:                          Copyright (C) 2000-2005 IT Mill Ltd
009:                             
010:         *************************************************************************
011:
012:           This library is free software; you can redistribute it and/or
013:           modify it under the terms of the GNU Lesser General Public
014:           license version 2.1 as published by the Free Software Foundation.
015:
016:           This library is distributed in the hope that it will be useful,
017:           but WITHOUT ANY WARRANTY; without even the implied warranty of
018:           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019:           Lesser General Public License for more details.
020:
021:           You should have received a copy of the GNU Lesser General Public
022:           License along with this library; if not, write to the Free Software
023:           Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:
025:         *************************************************************************
026:           
027:           For more information, contact:
028:           
029:           IT Mill Ltd                           phone: +358 2 4802 7180
030:           Ruukinkatu 2-4                        fax:  +358 2 4802 7181
031:           20540, Turku                          email: info@itmill.com
032:           Finland                               company www: www.itmill.com
033:           
034:           Primary source for MillStone information and releases: www.millstone.org
035:
036:         ********************************************************************** */
037:
038:        package org.millstone.examples.features;
039:
040:        import java.util.Date;
041:
042:        import org.millstone.base.ui.*;
043:        import org.millstone.base.data.Property;
044:
045:        public class FeatureForm extends Feature implements 
046:                Property.ValueChangeListener {
047:
048:            OrderedLayout demo = null;
049:            Form test;
050:            Layout formLayout = null;
051:            Select addField = new Select("Add field");
052:            Select resetLayout = new Select("Restart");
053:
054:            protected Component getDemoComponent() {
055:
056:                if (demo == null) {
057:                    demo = new OrderedLayout();
058:                    createDemo();
059:                }
060:
061:                return demo;
062:            }
063:
064:            private void createDemo() {
065:
066:                demo.removeAllComponents();
067:
068:                // Test form
069:                Panel testPanel = new Panel("Form component");
070:                if (formLayout == null)
071:                    test = new Form();
072:                else
073:                    test = new Form(formLayout);
074:                testPanel.addComponent(test);
075:                demo.addComponent(testPanel);
076:                OrderedLayout actions = new OrderedLayout(
077:                        OrderedLayout.ORIENTATION_HORIZONTAL);
078:                demo.addComponent(actions);
079:
080:                // form adder
081:                addField.setImmediate(true);
082:                addField.addItem("Add field");
083:                addField.setNullSelectionItemId("Add field");
084:                addField.addItem("Text field");
085:                addField.addItem("Time");
086:                addField.addItem("Option group");
087:                addField.addItem("Calendar");
088:                addField.addListener(this );
089:                actions.addComponent(addField);
090:
091:                // Layout reset
092:                resetLayout.setImmediate(true);
093:                resetLayout.addItem("Select layout example");
094:                resetLayout.setNullSelectionItemId("Select layout example");
095:                resetLayout.addItem("Vertical form (OrderedLayout form-style)");
096:                resetLayout.addItem("Two columns (2x1 GridLayout)");
097:                resetLayout.addItem("Flow (OrderedLayout flow-orientation)");
098:                resetLayout.addListener(this );
099:                actions.addComponent(resetLayout);
100:
101:                // Properties
102:                PropertyPanel p = new PropertyPanel(test);
103:                p.addProperties("Form special properties", new Form());
104:                demo.addComponent(p);
105:            }
106:
107:            public void valueChange(Property.ValueChangeEvent event) {
108:
109:                if (event.getProperty() == resetLayout) {
110:
111:                    String value = (String) resetLayout.getValue();
112:
113:                    if (value != null) {
114:                        formLayout = null;
115:
116:                        if (value.equals("Two columns (2x1 GridLayout)"))
117:                            formLayout = new GridLayout(2, 1);
118:                        if (value.equals("Horizontal (OrderedLayout)"))
119:                            formLayout = new OrderedLayout(
120:                                    OrderedLayout.ORIENTATION_HORIZONTAL);
121:
122:                        createDemo();
123:                        resetLayout.setValue(null);
124:                    }
125:                }
126:
127:                if (event.getProperty() == addField) {
128:
129:                    String value = (String) addField.getValue();
130:
131:                    if (value != null) {
132:                        if (value.equals("Text field"))
133:                            test.addField(new Object(), new TextField(
134:                                    "Test field"));
135:                        if (value.equals("Time")) {
136:                            DateField d = new DateField("Time", new Date());
137:                            d
138:                                    .setDescription("This is a DateField-component with text-style");
139:                            d.setResolution(DateField.RESOLUTION_MIN);
140:                            d.setStyle("text");
141:                            test.addField(new Object(), d);
142:                        }
143:                        if (value.equals("Calendar")) {
144:                            DateField c = new DateField("Calendar", new Date());
145:                            c
146:                                    .setDescription("DateField-component with calendar-style and day-resolution");
147:                            c.setStyle("calendar");
148:                            c.setResolution(DateField.RESOLUTION_DAY);
149:                            test.addField(new Object(), c);
150:                        }
151:                        if (value.equals("Option group")) {
152:                            Select s = new Select("Options");
153:                            s
154:                                    .setDescription("Select-component with optiongroup-style");
155:                            s.addItem("Linux");
156:                            s.addItem("Windows");
157:                            s.addItem("Solaris");
158:                            s.addItem("Symbian");
159:                            s.setStyle("optiongroup");
160:
161:                            test.addField(new Object(), s);
162:                        }
163:
164:                        addField.setValue(null);
165:                    }
166:                }
167:            }
168:
169:            protected String getDescriptionXHTML() {
170:                return "<p>Form is a flexible, yet simple container for fields. "
171:                        + " It provides support for any layouts and provides buffering interface for"
172:                        + " easy connection of commit- and discard buttons. All the form"
173:                        + " fields can be customized by adding validators, setting captions and icons, "
174:                        + " setting immediateness, etc. Also direct mechanism for replacing existing"
175:                        + " fields with selections is given.</p>"
176:                        + " <p>Form provides customizable editor for classes implementing"
177:                        + " Item-interface. Also the form itself"
178:                        + " implements this interface for easier connectivity to other items."
179:                        + " To use the form as editor for an item, just connect the item to"
180:                        + " form.After the item has been connected to the form,"
181:                        + " the automatically created fields can be customized and new fields can"
182:                        + " be added. If you need to connect a class that does not implement"
183:                        + " Item-interface, most properties of any"
184:                        + " class following bean pattern, can be accessed trough"
185:                        + " BeanItem.</p>"
186:                        + " <p>The best example of Form usage is the this feature browser itself; "
187:                        + " all the Property-panels in demos are composed of Form-components.</p>";
188:            }
189:
190:            protected String getTitle() {
191:                return "Form";
192:            }
193:
194:            protected String getImage() {
195:                return "form.jpg";
196:            }
197:
198:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.