aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/demo/features/FeatureForm.java
diff options
context:
space:
mode:
authorJani Laakso <jani.laakso@itmill.com>2007-10-18 11:48:52 +0000
committerJani Laakso <jani.laakso@itmill.com>2007-10-18 11:48:52 +0000
commite426fde1d12a0baaa9786048d85591dfcd701ee3 (patch)
tree55085d61638a21736f96404c25e610a324e365b6 /src/com/itmill/toolkit/demo/features/FeatureForm.java
parent09d0f5071efeed61ad85c6cb3b3d4c2513d87e62 (diff)
downloadvaadin-framework-e426fde1d12a0baaa9786048d85591dfcd701ee3.tar.gz
vaadin-framework-e426fde1d12a0baaa9786048d85591dfcd701ee3.zip
Removed old Feature Browser from demo package, simpler but better functioning demo will be added soon.
svn changeset:2549/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/demo/features/FeatureForm.java')
-rw-r--r--src/com/itmill/toolkit/demo/features/FeatureForm.java191
1 files changed, 0 insertions, 191 deletions
diff --git a/src/com/itmill/toolkit/demo/features/FeatureForm.java b/src/com/itmill/toolkit/demo/features/FeatureForm.java
deleted file mode 100644
index 52bdc589da..0000000000
--- a/src/com/itmill/toolkit/demo/features/FeatureForm.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/* *************************************************************************
-
- IT Mill Toolkit
-
- Development of Browser User Interfaces Made Easy
-
- Copyright (C) 2000-2006 IT Mill Ltd
-
- *************************************************************************
-
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might
- require purchasing a commercial license from IT Mill Ltd. For guidelines
- on usage, see licensing-guidelines.html
-
- *************************************************************************
-
- For more information, contact:
-
- IT Mill Ltd phone: +358 2 4802 7180
- Ruukinkatu 2-4 fax: +358 2 4802 7181
- 20540, Turku email: info@itmill.com
- Finland company www: www.itmill.com
-
- Primary source for information and releases: www.itmill.com
-
- ********************************************************************** */
-
-package com.itmill.toolkit.demo.features;
-
-import java.util.Date;
-
-import com.itmill.toolkit.data.Property;
-import com.itmill.toolkit.ui.*;
-
-public class FeatureForm extends Feature implements
- Property.ValueChangeListener {
-
- OrderedLayout demo = null;
-
- Form test;
-
- Layout formLayout = null;
-
- Select addField = new Select("Add field");
-
- Select resetLayout = new Select("Restart");
-
- protected Component getDemoComponent() {
-
- if (demo == null) {
- demo = new OrderedLayout();
- createDemo();
- }
-
- setJavadocURL("ui/Form.html");
-
- return demo;
- }
-
- private void createDemo() {
-
- demo.removeAllComponents();
-
- // Test form
- if (formLayout == null)
- test = new Form();
- else
- test = new Form(formLayout);
-
- demo.addComponent(test);
- OrderedLayout actions = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- demo.addComponent(actions);
-
- // form adder
- addField.setImmediate(true);
- addField.addItem("Add field");
- addField.setNullSelectionItemId("Add field");
- addField.addItem("Text field");
- addField.addItem("Time");
- addField.addItem("Option group");
- addField.addItem("Calendar");
- addField.addListener(this);
- actions.addComponent(addField);
-
- // Layout reset
- resetLayout.setImmediate(true);
- resetLayout.addItem("Select layout example");
- resetLayout.setNullSelectionItemId("Select layout example");
- resetLayout.addItem("Vertical form (OrderedLayout form-style)");
- resetLayout.addItem("Two columns (2x1 GridLayout)");
- resetLayout.addItem("Flow (OrderedLayout flow-orientation)");
- resetLayout.addListener(this);
- actions.addComponent(resetLayout);
-
- // Properties
- propertyPanel = new PropertyPanel(test);
- propertyPanel.addProperties("Form special properties", new Form());
- }
-
- public void valueChange(Property.ValueChangeEvent event) {
-
- if (event.getProperty() == resetLayout) {
-
- String value = (String) resetLayout.getValue();
-
- if (value != null) {
- formLayout = null;
-
- if (value.equals("Two columns (2x1 GridLayout)"))
- formLayout = new GridLayout(2, 1);
- if (value.equals("Horizontal (OrderedLayout)"))
- formLayout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
-
- createDemo();
- resetLayout.setValue(null);
- }
- }
-
- if (event.getProperty() == addField) {
-
- String value = (String) addField.getValue();
-
- if (value != null) {
- if (value.equals("Text field"))
- test.addField(new Object(), new TextField("Test field"));
- if (value.equals("Time")) {
- DateField d = new DateField("Time", new Date());
- d
- .setDescription("This is a DateField-component with text-style");
- d.setResolution(DateField.RESOLUTION_MIN);
- d.setStyle("text");
- test.addField(new Object(), d);
- }
- if (value.equals("Calendar")) {
- DateField c = new DateField("Calendar", new Date());
- c
- .setDescription("DateField-component with calendar-style and day-resolution");
- c.setStyle("calendar");
- c.setResolution(DateField.RESOLUTION_DAY);
- test.addField(new Object(), c);
- }
- if (value.equals("Option group")) {
- Select s = new Select("Options");
- s.setDescription("Select-component with optiongroup-style");
- s.addItem("Linux");
- s.addItem("Windows");
- s.addItem("Solaris");
- s.addItem("Symbian");
- s.setStyle("optiongroup");
-
- test.addField(new Object(), s);
- }
-
- addField.setValue(null);
- }
- }
- }
-
- protected String getDescriptionXHTML() {
- return "Form is a flexible, yet simple container for fields. "
- + " It provides support for any layouts and provides buffering interface for"
- + " easy connection of commit- and discard buttons. All the form"
- + " fields can be customized by adding validators, setting captions and icons, "
- + " setting immediateness, etc. Also direct mechanism for replacing existing"
- + " fields with selections is given."
- + " <br /><br />Form provides customizable editor for classes implementing"
- + " Item-interface. Also the form itself"
- + " implements this interface for easier connectivity to other items."
- + " To use the form as editor for an item, just connect the item to"
- + " form.After the item has been connected to the form,"
- + " the automatically created fields can be customized and new fields can"
- + " be added. If you need to connect a class that does not implement"
- + " Item-interface, most properties of any"
- + " class following bean pattern, can be accessed trough"
- + " BeanItem."
- + " <br /><br />The best example of Form usage is the this feature browser itself; "
- + " all the Property-panels in demos are composed of Form-components.";
- }
-
- protected String getTitle() {
- return "Form";
- }
-
- protected String getImage() {
- return "icon_demo.png";
- }
-
-}