aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/itmill/toolkit/tests')
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/Feature.java206
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureBrowser.java282
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureBuffering.java110
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureButton.java87
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureContainers.java113
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureCustomLayout.java96
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureDateField.java126
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureEmbedded.java112
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureForm.java191
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureFrameWindow.java166
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureGridLayout.java93
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureItems.java106
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureLabel.java95
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureLink.java84
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureOrderedLayout.java95
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeaturePanel.java87
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureParameters.java177
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureProperties.java111
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureSelect.java106
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureTabSheet.java91
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureTable.java218
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureTextField.java89
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureTree.java184
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureUpload.java168
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java31
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureValidators.java106
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeatureWindow.java159
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/FeaturesApplication.java56
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroBasic.java98
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroComponents.java102
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroDataHandling.java97
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroDataModel.java99
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroItemContainers.java98
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroLayouts.java100
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroTerminal.java74
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/IntroWelcome.java217
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/PropertyPanel.java516
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/components.pngbin0 -> 184749 bytes
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/icon_demo.pngbin0 -> 2428 bytes
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/icon_intro.pngbin0 -> 2465 bytes
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/itmill.gifbin0 -> 6110 bytes
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/itmill_spin.swfbin0 -> 2991 bytes
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/m-bullet-blue.gifbin0 -> 8417 bytes
-rw-r--r--src/com/itmill/toolkit/tests/featurebrowser/m.gifbin0 -> 1036 bytes
44 files changed, 4946 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/Feature.java b/src/com/itmill/toolkit/tests/featurebrowser/Feature.java
new file mode 100644
index 0000000000..02bbff2e1f
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/Feature.java
@@ -0,0 +1,206 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.terminal.ClassResource;
+import com.itmill.toolkit.terminal.Resource;
+import com.itmill.toolkit.ui.*;
+
+public abstract class Feature extends CustomComponent {
+
+ private static final String PROP_REMINDER_TEXT = ""
+ + "<br /><br />Note: Use <b>Properties</b> panel located at the top"
+ + " right corner to try out how different properties affect"
+ + " the presentation or functionality of currently selected component.";
+
+ private boolean propsReminder = true;
+
+ private OrderedLayout layout;
+
+ private TabSheet ts;
+
+ private boolean initialized = false;
+
+ private static Resource sampleIcon;
+
+ protected PropertyPanel propertyPanel;
+
+ private Label javadoc;
+
+ private Label description;
+
+ /** Constuctor for the feature component */
+ public Feature() {
+ layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ setCompositionRoot(layout);
+ }
+
+ /**
+ * Actual URL consists of "/doc/api/com/itmill/toolkit/"+url
+ *
+ * @param url
+ */
+ public void setJavadocURL(String url) {
+ javadoc
+ .setValue("<iframe width=\"100%\" src=\"../doc/api/com/itmill/toolkit/"
+ + url + "\"></iframe>");
+ }
+
+ /**
+ * Feature component initialization is lazily done when the feature is
+ * attached to application
+ */
+ public void attach() {
+ super.attach();
+
+ // Check if the feature is already initialized
+ if (initialized)
+ return;
+ initialized = true;
+
+ // Javadoc
+ javadoc = new Label();
+ javadoc.setContentMode(Label.CONTENT_XHTML);
+
+ // Demo
+ Component demo = getDemoComponent();
+ if (demo != null)
+ layout.addComponent(demo);
+
+ ts = new TabSheet();
+
+ ts.setWidth(100);
+ ts.setWidthUnits(TabSheet.UNITS_PERCENTAGE);
+ ts.setHeight(100);
+ ts.setHeightUnits(TabSheet.UNITS_PERCENTAGE);
+
+ // Description tab
+ String title = getTitle();
+ if (getDescriptionXHTML() != null) {
+ OrderedLayout mainLayout = new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
+ OrderedLayout layout = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+ mainLayout.addComponent(layout);
+ if (getImage() != null)
+ layout.addComponent(new Embedded("", new ClassResource(
+ getImage(), this.getApplication())));
+ String label = "";
+ label += getDescriptionXHTML();
+ if (propsReminder)
+ label += PROP_REMINDER_TEXT;
+ if (title != null) {
+ layout.addComponent(new Label("<h3>" + title + "</h3>",
+ Label.CONTENT_XHTML));
+ }
+ description = new Label(label, Label.CONTENT_XHTML);
+ mainLayout.addComponent(description);
+
+ ts.addTab(mainLayout, "Description", null);
+ }
+
+ // Properties table tab
+ ts.addTab(getPropertyPanel().getAllProperties(), "Properties", null);
+
+ // Javadoc tab
+ if (!javadoc.getValue().equals(""))
+ ts.addTab(javadoc, "Javadoc", null);
+
+ // Code Sample tab
+ String example = getExampleSrc();
+ if (example != null) {
+ OrderedLayout l = new OrderedLayout();
+ if (getTitle() != null)
+ l.addComponent(new Label(
+ "<b>// " + getTitle() + " example</b>",
+ Label.CONTENT_XHTML));
+ l.addComponent(new Label(example, Label.CONTENT_PREFORMATTED));
+ ts.addTab(l, "Code Sample", null);
+ }
+
+ }
+
+ /** Get the desctiption of the feature as XHTML fragment */
+ protected String getDescriptionXHTML() {
+ return "<h2>Feature description is under construction</h2>";
+ }
+
+ /** Get the title of the feature */
+ protected String getTitle() {
+ return this.getClass().getName();
+ }
+
+ public TabSheet getTabSheet() {
+ return ts;
+ }
+
+ /** Get the name of the image file that will be put on description page */
+ protected String getImage() {
+ return null;
+ }
+
+ /** Get the example application source code */
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /** Get the feature demo component */
+ protected Component getDemoComponent() {
+ return null;
+ }
+
+ /** Get sample icon resource */
+ protected Resource getSampleIcon() {
+ if (sampleIcon == null)
+ sampleIcon = new ClassResource("m.gif", this.getApplication());
+ return sampleIcon;
+ }
+
+ public PropertyPanel getPropertyPanel() {
+ return propertyPanel;
+ }
+
+ public void setPropsReminder(boolean propsReminder) {
+ this.propsReminder = propsReminder;
+ }
+
+ public void updateDescription() {
+ String label = "";
+ label += getDescriptionXHTML();
+ if (propsReminder)
+ label += PROP_REMINDER_TEXT;
+ description.setValue(label);
+ }
+
+ // Fix for #512
+ public Label getDescription() {
+ return description;
+ }
+
+} \ No newline at end of file
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureBrowser.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureBrowser.java
new file mode 100644
index 0000000000..e7c1014a57
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureBrowser.java
@@ -0,0 +1,282 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import com.itmill.toolkit.data.*;
+import com.itmill.toolkit.ui.*;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+import com.itmill.toolkit.ui.Button.ClickListener;
+
+public class FeatureBrowser extends CustomComponent implements
+ Property.ValueChangeListener, ClickListener, Layout {
+
+ private Tree features;
+
+ private Feature currentFeature = null;
+
+ private CustomLayout mainlayout;
+
+ private PropertyPanel properties;
+
+ private boolean initialized = false;
+
+ private Select themeSelector = new Select();
+
+ public void attach() {
+
+ if (initialized)
+ return;
+ initialized = true;
+
+ // Configure tree
+ features = new Tree();
+ features.addContainerProperty("name", String.class, "");
+ features.addContainerProperty("feature", Feature.class, null);
+ features.setItemCaptionPropertyId("name");
+ features.addListener(this);
+ features.setImmediate(true);
+ features.setStyle("menu");
+
+ // Configure component layout
+ mainlayout = new CustomLayout("featurebrowser-mainlayout");
+ setCompositionRoot(mainlayout);
+ mainlayout.addComponent(features, "tree");
+
+ // Theme selector
+ mainlayout.addComponent(themeSelector, "themes");
+ themeSelector.addItem("demo");
+
+ themeSelector.addListener(this);
+ themeSelector.select("demo");
+ themeSelector.setImmediate(true);
+
+ // Restart button
+ Button close = new Button("restart", getApplication(), "close");
+ close.setStyle("link");
+ mainlayout.addComponent(close, "restart");
+
+ // Test component
+ registerFeature("/Welcome", new IntroWelcome());
+ registerFeature("/UI Components", new IntroComponents());
+ registerFeature("/UI Components/Basic", new IntroBasic());
+ registerFeature("/UI Components/Basic/Text Field",
+ new FeatureTextField());
+ registerFeature("/UI Components/Basic/Date Field",
+ new FeatureDateField());
+ registerFeature("/UI Components/Basic/Button", new FeatureButton());
+ registerFeature("/UI Components/Basic/Form", new FeatureForm());
+ registerFeature("/UI Components/Basic/Label", new FeatureLabel());
+ registerFeature("/UI Components/Basic/Link", new FeatureLink());
+ registerFeature("/UI Components/Item Containers",
+ new IntroItemContainers());
+ registerFeature("/UI Components/Item Containers/Select",
+ new FeatureSelect());
+ registerFeature("/UI Components/Item Containers/Table",
+ new FeatureTable());
+ registerFeature("/UI Components/Item Containers/Tree",
+ new FeatureTree());
+ registerFeature("/UI Components/Layouts", new IntroLayouts());
+ registerFeature("/UI Components/Layouts/Ordered Layout",
+ new FeatureOrderedLayout());
+ registerFeature("/UI Components/Layouts/Grid Layout",
+ new FeatureGridLayout());
+ registerFeature("/UI Components/Layouts/Custom Layout",
+ new FeatureCustomLayout());
+ registerFeature("/UI Components/Layouts/Panel", new FeaturePanel());
+ registerFeature("/UI Components/Layouts/Tab Sheet",
+ new FeatureTabSheet());
+ registerFeature("/UI Components/Layouts/Window", new FeatureWindow());
+ // Disabled for now
+ // registerFeature("/UI Components/Layouts/Frame Window",
+ // new FeatureFrameWindow());
+ registerFeature("/UI Components/Data handling", new IntroDataHandling());
+ registerFeature("/UI Components/Data handling/Embedded Objects",
+ new FeatureEmbedded());
+ registerFeature("/UI Components/Data handling/Upload",
+ new FeatureUpload());
+ registerFeature("/Data Model", new IntroDataModel());
+ registerFeature("/Data Model/Properties", new FeatureProperties());
+ registerFeature("/Data Model/Items", new FeatureItems());
+ registerFeature("/Data Model/Containers", new FeatureContainers());
+ registerFeature("/Data Model/Validators", new FeatureValidators());
+ registerFeature("/Data Model/Buffering", new FeatureBuffering());
+ // registerFeature("/Terminal", new IntroTerminal());
+ // registerFeature("/Terminal/Parameters and URI Handling",
+ // new FeatureParameters());
+
+ // Pre-open all menus
+ for (Iterator i = features.getItemIds().iterator(); i.hasNext();)
+ features.expandItem(i.next());
+
+ // Add demo component and tabs
+ currentFeature = new IntroWelcome();
+ mainlayout.addComponent(currentFeature, "demo");
+ mainlayout.addComponent(currentFeature.getTabSheet(), "tabsheet");
+
+ // Add properties
+ properties = currentFeature.getPropertyPanel();
+ mainlayout.addComponent(properties, "properties");
+ }
+
+ public void registerFeature(String path, Feature feature) {
+ StringTokenizer st = new StringTokenizer(path, "/");
+ String id = "";
+ String parentId = null;
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ id += "/" + token;
+ if (!features.containsId(id)) {
+ features.addItem(id);
+ features.setChildrenAllowed(id, false);
+ }
+ features.getContainerProperty(id, "name").setValue(token);
+ if (parentId != null) {
+ features.setChildrenAllowed(parentId, true);
+ features.setParent(id, parentId);
+ }
+ if (!st.hasMoreTokens())
+ features.getContainerProperty(id, "feature").setValue(feature);
+ parentId = id;
+ }
+ }
+
+ public void valueChange(Property.ValueChangeEvent event) {
+
+ // FIXME: navigation statistics
+ try {
+ if ((event.getProperty().toString() == null)
+ && ((AbstractComponent) event.getProperty()).getTag()
+ .equals("tree")) {
+ // ignore tree initialization
+ } else {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "valueChange "
+ + ((AbstractComponent) event.getProperty())
+ .getTag() + ", " + event.getProperty());
+ }
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+
+ // Change feature
+ if (event.getProperty() == features) {
+ Object id = features.getValue();
+ if (id != null) {
+ if (features.areChildrenAllowed(id))
+ features.expandItem(id);
+ Property p = features.getContainerProperty(id, "feature");
+ Feature feature = p != null ? ((Feature) p.getValue()) : null;
+ if (feature != null) {
+ mainlayout.removeComponent(currentFeature);
+ mainlayout.removeComponent(currentFeature.getTabSheet());
+ mainlayout.addComponent(feature, "demo");
+ mainlayout.addComponent(feature.getTabSheet(), "tabsheet");
+ currentFeature = feature;
+ properties = feature.getPropertyPanel();
+ if (properties != null) {
+ mainlayout.addComponent(properties, "properties");
+ }
+ getWindow()
+ .setCaption(
+ "IT Mill Toolkit Features / "
+ + features.getContainerProperty(id,
+ "name"));
+ }
+ }
+ } else if (event.getProperty() == themeSelector) {
+ getApplication().setTheme(themeSelector.toString());
+ }
+ }
+
+ public void buttonClick(ClickEvent event) {
+ // FIXME: navigation statistics
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "buttonClick " + event.getButton().getTag() + ", "
+ + event.getButton().getCaption() + ", "
+ + event.getButton().getValue());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+
+ }
+
+ public void addComponent(Component c) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addListener(ComponentAttachListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addListener(ComponentDetachListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Iterator getComponentIterator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void moveComponentsFrom(ComponentContainer source) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeAllComponents() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeComponent(Component c) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeListener(ComponentAttachListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeListener(ComponentDetachListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void replaceComponent(Component oldComponent, Component newComponent) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureBuffering.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureBuffering.java
new file mode 100644
index 0000000000..a2e2ed8429
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureBuffering.java
@@ -0,0 +1,110 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class FeatureBuffering extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "IT Mill Toolkit data model provides interface for implementing "
+ + "buffering in data components. The basic idea is that a component "
+ + "reading their state from data source can implement "
+ + "Buffered-interface, for storing the value internally. "
+ + "Buffering provides transactional access "
+ + "for setting data: data can be put to a component's buffer and "
+ + "afterwards committed to or discarded by re-reding it from the data source. "
+ + "The buffering can be used for creating interactive interfaces "
+ + "as well as caching the data for performance reasons."
+ + "<br /><br />Buffered interface contains methods for committing and discarding "
+ + "changes to an object and support for controlling buffering mode "
+ + "with read-through and write-through modes. "
+ + "Read-through mode means that the value read from the buffered "
+ + "object is constantly up to date with the data source. "
+ + "Respectively the write-through mode means that all changes to the object are "
+ + "immediately updated to the data source.";
+
+ public FeatureBuffering() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+ Panel panel = new Panel();
+ panel.setCaption("Buffering");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/Buffered.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureButton.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureButton.java
new file mode 100644
index 0000000000..b572870be1
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureButton.java
@@ -0,0 +1,87 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureButton extends Feature {
+
+ public FeatureButton() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Button b = new Button("Caption");
+ l.addComponent(b);
+
+ // Properties
+ propertyPanel = new PropertyPanel(b);
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("link").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("link");
+ Form ap = propertyPanel
+ .createBeanPropertySet(new String[] { "switchMode" });
+ propertyPanel.addProperties("Button Properties", ap);
+
+ setJavadocURL("ui/Button.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "Button b = new Button(\"Caption\");\n";
+
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "In IT Mill Toolkit, boolean input values are represented by buttons. "
+ + "Buttons may function either as a push buttons or switches. (checkboxes)<br/><br/>"
+ + "Button can be directly connected to any method of an object, which "
+ + "is an easy way to trigger events: <code> new Button(\"Play\", myPiano \"playIt\")</code>. "
+ + "Or in checkbox-mode they can be bound to a boolean proterties and create "
+ + " simple selectors.<br /><br /> "
+ + "See the demo and try out how the different properties affect "
+ + "the presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Button";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureContainers.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureContainers.java
new file mode 100644
index 0000000000..4f02c5313b
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureContainers.java
@@ -0,0 +1,113 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class FeatureContainers extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "Container is the most advanced of the data "
+ + "model supported by IT Mill Toolkit. It provides a very flexible "
+ + "way of managing set of items that share common properties. Each "
+ + "item is identified by an item id. "
+ + "Properties can be requested from container with item "
+ + "and property ids. Other way of accessing properties is to first "
+ + "request an item from container and then request its properties "
+ + "from it."
+ + "<br /><br />Container interface was designed with flexibility and "
+ + "efficiency in mind. It contains inner interfaces for ordering "
+ + "the items sequentially, indexing the items and accessing them "
+ + "hierarchically. Those ordering models provide basis for "
+ + "Table, Tree and Select UI components. As with other data "
+ + "models, the containers support events for notifying about the "
+ + "changes."
+ + "<br /><br />Set of utilities for converting between container models by "
+ + "adding external indexing or hierarchy into existing containers. "
+ + "In memory containers implementing indexed and hierarchical "
+ + "models provide easy to use tools for setting up in memory data "
+ + "storages. There is even a hierarchical container for direct "
+ + "file system access.";
+
+ public FeatureContainers() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Containers");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/Container.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureCustomLayout.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureCustomLayout.java
new file mode 100644
index 0000000000..979a8f0fdf
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureCustomLayout.java
@@ -0,0 +1,96 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureCustomLayout extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "A container component with freely designed layout and style. The "
+ + "container consists of items with textually represented locations. Each "
+ + "item contains one sub-component. The adapter and theme are resposible "
+ + "for rendering the layout with given style by placing the items on the "
+ + "screen in defined locations."
+ + "<br /><br />The definition of locations is not fixed - the each style can define its "
+ + "locations in a way that is suitable for it. One typical example would be "
+ + "to create visual design for a website as a custom layout: the visual design "
+ + "could define locations for \"menu\", \"body\" and \"title\" for example. "
+ + "The layout would then be implemented e.g. as plain HTML file."
+ + "<br /><br />The default theme handles the styles that are not defined by just drawing "
+ + "the subcomponents with flowlayout.";
+
+ protected Component getDemoComponent() {
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Custom Layout");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("ui/CustomLayout.html");
+
+ return l;
+ }
+
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getExampleSrc() {
+ return "CustomLayout c = new CustomLayout(\"mystyle\");\n"
+ + "c.addComponent(new Label(\"Example description\"),\"label1-location\");\n"
+ + "c.addComponent(new Button(\"Example action\"),\"example-action-location\");\n";
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return "Custom Layout";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureDateField.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureDateField.java
new file mode 100644
index 0000000000..2b6317304b
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureDateField.java
@@ -0,0 +1,126 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.util.Locale;
+
+import com.itmill.toolkit.data.util.IndexedContainer;
+import com.itmill.toolkit.data.util.MethodProperty;
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.DateField;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Select;
+
+public class FeatureDateField extends Feature {
+
+ static private String[] localeNames;
+ static {
+ Locale[] locales = Locale.getAvailableLocales();
+ localeNames = new String[locales.length];
+ for (int i = 0; i < locales.length; i++)
+ localeNames[i] = locales[i].getDisplayName();
+ }
+
+ public FeatureDateField() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ l.addComponent(new Label("Your default locale is: "
+ + this.getApplication().getLocale().toString()
+ .replace('_', '-')));
+
+ DateField df = new DateField();
+ df.setValue(new java.util.Date());
+ l.addComponent(df);
+
+ // Properties
+ propertyPanel = new PropertyPanel(df);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] {
+ "resolution", "locale" });
+ ap.replaceWithSelect("resolution", new Object[] {
+ new Integer(DateField.RESOLUTION_YEAR),
+ new Integer(DateField.RESOLUTION_MONTH),
+ new Integer(DateField.RESOLUTION_DAY),
+ new Integer(DateField.RESOLUTION_HOUR),
+ new Integer(DateField.RESOLUTION_MIN),
+ new Integer(DateField.RESOLUTION_SEC),
+ new Integer(DateField.RESOLUTION_MSEC) }, new Object[] {
+ "Year", "Month", "Day", "Hour", "Minute", "Second",
+ "Millisecond" });
+ ap.replaceWithSelect("locale", Locale.getAvailableLocales(),
+ localeNames);
+ ap.getField("resolution").setValue(
+ new Integer(DateField.RESOLUTION_DAY));
+ ap.getField("locale").setValue(Locale.getDefault());
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("text").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("text");
+ themes.addItem("calendar").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("calendar");
+ propertyPanel.addProperties("DateField Properties", ap);
+
+ setJavadocURL("ui/DateField.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "DateField df = new DateField(\"Caption\");\n"
+ + "df.setValue(new java.util.Date());\n";
+ }
+
+ protected String getDescriptionXHTML() {
+ return "Representing Dates and times and providing a way to select "
+ + "or enter some specific date and/or time is an typical need in "
+ + "data-entry user interfaces (UI). IT Mill Toolkit provides a DateField "
+ + "component that is intuitive to use and yet controllable through "
+ + "its properties."
+ + "<br /><br />The calendar-style allows point-and-click selection "
+ + "of dates while text-style shows only minimalistic user interface."
+ + " Validators may be bound to the component to check and "
+ + "validate the given input."
+ + "<br /><br />On the demo tab you can try out how the different properties affect the "
+ + "presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "DateField";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureEmbedded.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureEmbedded.java
new file mode 100644
index 0000000000..008e25531d
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureEmbedded.java
@@ -0,0 +1,112 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.terminal.ClassResource;
+import com.itmill.toolkit.terminal.Sizeable;
+import com.itmill.toolkit.ui.*;
+
+public class FeatureEmbedded extends Feature {
+
+ public FeatureEmbedded() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ ClassResource flashResource = new ClassResource("itmill_spin.swf",
+ getApplication());
+ Embedded emb = new Embedded("Embedded Caption", flashResource);
+ emb.setType(Embedded.TYPE_OBJECT);
+ emb.setMimeType("application/x-shockwave-flash");
+ emb.setWidth(250);
+ emb.setHeight(100);
+ l.addComponent(emb);
+
+ // Properties
+ propertyPanel = new PropertyPanel(emb);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "type",
+ "source", "width", "height", "widthUnits", "heightUnits",
+ "codebase", "codetype", "archive", "mimeType", "standby",
+ "classId" });
+ ap.replaceWithSelect("type", new Object[] {
+ new Integer(Embedded.TYPE_IMAGE),
+ new Integer(Embedded.TYPE_OBJECT) }, new Object[] { "Image",
+ "Object" });
+ Object[] units = new Object[Sizeable.UNIT_SYMBOLS.length];
+ Object[] symbols = new Object[Sizeable.UNIT_SYMBOLS.length];
+ for (int i = 0; i < units.length; i++) {
+ units[i] = new Integer(i);
+ symbols[i] = Sizeable.UNIT_SYMBOLS[i];
+ }
+ ap.replaceWithSelect("heightUnits", units, symbols);
+ ap.replaceWithSelect("widthUnits", units, symbols);
+ ap.replaceWithSelect("source", new Object[] { flashResource },
+ new Object[] { "itmill_spin.swf" });
+ propertyPanel.addProperties("Embedded Properties", ap);
+ propertyPanel.getField("standby").setDescription(
+ "The text to display while loading the object.");
+ propertyPanel.getField("codebase").setDescription(
+ "root-path used to access resources with relative paths.");
+ propertyPanel.getField("codetype").setDescription(
+ "MIME-type of the code.");
+ propertyPanel
+ .getField("classId")
+ .setDescription(
+ "Unique object id. This can be used for example to identify windows components.");
+
+ setJavadocURL("ui/Embedded.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "// Load image from jpg-file, that is in the same package with the application\n"
+ + "Embedded e = new Embedded(\"Image title\",\n"
+ + " new ClassResource(\"image.jpg\", getApplication()));";
+ }
+
+ protected String getDescriptionXHTML() {
+ return "The embedding feature allows for adding images, multimedia and other non-specified "
+ + "content to your application. "
+ + "The feature has provisions for embedding both applets and Active X controls. "
+ + "Actual support for embedded media types is left to the terminal.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Embedded";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureForm.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureForm.java
new file mode 100644
index 0000000000..e84dfa22dd
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureForm.java
@@ -0,0 +1,191 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+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";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureFrameWindow.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureFrameWindow.java
new file mode 100644
index 0000000000..62bd3bd9a0
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureFrameWindow.java
@@ -0,0 +1,166 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.util.HashMap;
+import java.util.List;
+
+import com.itmill.toolkit.ui.*;
+import com.itmill.toolkit.ui.Button.ClickEvent;
+
+public class FeatureFrameWindow extends Feature implements Button.ClickListener {
+
+ private Button addButton = new Button("Add to application", this, "addWin");
+
+ private Button removeButton = new Button("Remove from application", this,
+ "delWin");
+
+ private FrameWindow demoWindow;
+
+ private HashMap windowToFramesetMap = new HashMap();
+
+ private int count = 0;
+
+ protected Component getDemoComponent() {
+ OrderedLayout l = new OrderedLayout();
+ demoWindow = new FrameWindow("Feature Test Window");
+ demoWindow.getFrameset()
+ .newFrame(createFrame(demoWindow.getFrameset()));
+
+ l.addComponent(addButton);
+ l.addComponent(removeButton);
+ updateWinStatus();
+
+ // Properties
+ propertyPanel = new PropertyPanel(demoWindow);
+ propertyPanel.dependsOn(addButton);
+ propertyPanel.dependsOn(removeButton);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height", "name", "border", "theme" });
+ ap.replaceWithSelect("border", new Object[] {
+ new Integer(Window.BORDER_DEFAULT),
+ new Integer(Window.BORDER_NONE),
+ new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default",
+ "None", "Minimal" });
+
+ propertyPanel.addProperties("FrameWindow Properties", ap);
+
+ setJavadocURL("ui/FrameWindow.html");
+
+ return l;
+ }
+
+ protected String getDescriptionXHTML() {
+ return "<p>This component implements a window that contains a hierarchical set of frames. "
+ + "Each frame can contain a web-page, window or a set of frames that divides the space "
+ + "horizontally or vertically.</p>";
+ }
+
+ protected String getExampleSrc() {
+ return "FrameWindow f = new FrameWindow(\"Frame example\");\n"
+ + "f.getFrameset().newFrame(window);\n"
+ + "f.getFrameset().newFrame(resource,\"targetName\");\n";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "FrameWindow";
+ }
+
+ public void addWin() {
+ getApplication().addWindow(demoWindow);
+ updateWinStatus();
+ }
+
+ public void delWin() {
+ getApplication().removeWindow(demoWindow);
+ updateWinStatus();
+ }
+
+ private void updateWinStatus() {
+ if (demoWindow.getApplication() == null) {
+ addButton.setEnabled(true);
+ removeButton.setEnabled(false);
+ } else {
+ addButton.setEnabled(false);
+ removeButton.setEnabled(true);
+ }
+ }
+
+ public void buttonClick(ClickEvent event) {
+
+ if (event.getButton().getCaption().equals("Remove")) {
+ Window w = event.getButton().getWindow();
+ FrameWindow.Frameset fs = (FrameWindow.Frameset) windowToFramesetMap
+ .get(w);
+ if (fs == demoWindow.getFrameset() && fs.size() <= 1) {
+ // Do not remove the last frame
+ } else if (fs.size() > 1) {
+ fs.removeFrame(fs.getFrame(w.getName()));
+ windowToFramesetMap.remove(w);
+ } else {
+ FrameWindow.Frameset p = fs.getParentFrameset();
+ if (p != demoWindow.getFrameset() || p.size() > 1)
+ p.removeFrame(fs);
+ if (p.size() == 0)
+ p.newFrame(createFrame(p));
+ }
+ }
+
+ if (event.getButton().getCaption().equals("Split")) {
+ Window w = event.getButton().getWindow();
+ FrameWindow.Frameset fs = (FrameWindow.Frameset) windowToFramesetMap
+ .get(w);
+ int index = 0;
+ List l = fs.getFrames();
+ while (index < l.size() && fs.getFrame(index).getWindow() != w)
+ index++;
+ fs.removeFrame(fs.getFrame(w.getName()));
+ windowToFramesetMap.remove(w);
+ if (index > fs.size())
+ index = fs.size();
+ fs = fs.newFrameset((Math.random() > 0.5), index);
+ for (int i = 2 + (int) (Math.random() * 2.0); i > 0; i--)
+ fs.newFrame(createFrame(fs));
+ }
+ }
+
+ private Window createFrame(FrameWindow.Frameset fs) {
+ Window w = new Window();
+ w.addComponent(new Label("<b>Frame: " + (++count) + "</b>",
+ Label.CONTENT_UIDL));
+ w.addComponent(new Button("Split", this));
+ w.addComponent(new Button("Remove", this));
+ windowToFramesetMap.put(w, fs);
+ return w;
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureGridLayout.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureGridLayout.java
new file mode 100644
index 0000000000..0165f617d2
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureGridLayout.java
@@ -0,0 +1,93 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.util.Date;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureGridLayout extends Feature {
+
+ public FeatureGridLayout() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ GridLayout gl = new GridLayout(3, 3);
+ DateField cal = new DateField("Test component 1", new Date());
+ cal.setStyle("calendar");
+ gl.addComponent(cal, 1, 0, 2, 1);
+ for (int i = 2; i < 7; i++)
+ gl.addComponent(new TextField("Test component " + i));
+ l.addComponent(gl);
+
+ // Properties
+ propertyPanel = new PropertyPanel(gl);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ ap.addField("new line", new Button("New Line", gl, "newLine"));
+ ap.addField("space", new Button("Space", gl, "space"));
+ propertyPanel.addProperties("GridLayout Features", ap);
+ propertyPanel.getField("height").dependsOn(
+ propertyPanel.getField("add component"));
+
+ setJavadocURL("ui/GridLayout.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "GridLayout gl = new GridLayout(2,2);\n"
+ + "gl.addComponent(new Label(\"Label 1 in GridLayout\"));\n"
+ + "gl.addComponent(new Label(\"Label 2 in GridLayout\"));\n"
+ + "gl.addComponent(new Label(\"Label 3 in GridLayout\"));\n"
+ + "gl.addComponent(new Label(\"Label 4 in GridLayout\"));\n";
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "This feature provides a container that lays out components "
+ + "into a grid of given width and height."
+ + "<br /><br />On the demo tab you can try out how the different "
+ + "properties affect the presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "GridLayout";
+ }
+} \ No newline at end of file
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureItems.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureItems.java
new file mode 100644
index 0000000000..45406d5584
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureItems.java
@@ -0,0 +1,106 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class FeatureItems extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "Item is an object, which contains a set of named "
+ + "properties. Each property is identified by an "
+ + "id and a reference to the property can be queried from the Item. "
+ + "Item defines inner-interfaces for maintaining the item property "
+ + "set and listening the item property set changes."
+ + "<br /><br />Items generally represent objects in the object-oriented "
+ + "model, but with the exception that they are configurable "
+ + "and provide an event mechanism. The simplest way of utilizing "
+ + "Item interface is to use existing Item implementations. "
+ + "Provided utility classes include configurable property set,"
+ + " bean to item adapter and Form UI component.";
+
+ public FeatureItems() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Items");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/Item.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Introduction of Data Model Item";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureLabel.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureLabel.java
new file mode 100644
index 0000000000..7afb65604b
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureLabel.java
@@ -0,0 +1,95 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureLabel extends Feature {
+
+ public FeatureLabel() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Label lab = new Label("Label text");
+ l.addComponent(lab);
+
+ // Properties
+ propertyPanel = new PropertyPanel(lab);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] {
+ "contentMode", "value" });
+ ap.replaceWithSelect("contentMode", new Object[] {
+ new Integer(Label.CONTENT_PREFORMATTED),
+ new Integer(Label.CONTENT_TEXT),
+ new Integer(Label.CONTENT_UIDL),
+ new Integer(Label.CONTENT_XHTML),
+ new Integer(Label.CONTENT_XML) },
+ new Object[] { "Preformatted", "Text", "UIDL (Must be valid)",
+ "XHTML Fragment(Must be valid)",
+ "XML (Subtree with namespace)" });
+ propertyPanel.addProperties("Label Properties", ap);
+
+ setJavadocURL("ui/Label.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "Label l = new Label(\"Caption\");\n";
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "Labels components are for captions and plain text. "
+ + "By default, it is a light-weight component for presenting "
+ + "text content in application, but it can be also used to present "
+ + "formatted information and even XML."
+ + "<br /><br />"
+ + "Label can also be directly associated with data property to display "
+ + "information from different data sources automatically. This makes it "
+ + "trivial to present the current user in the corner of applications main window. "
+ + "<br /><br />"
+ + "On the demo tab you can try out how the different properties affect "
+ + "the presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Label";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureLink.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureLink.java
new file mode 100644
index 0000000000..798df0b15e
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureLink.java
@@ -0,0 +1,84 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.terminal.ExternalResource;
+import com.itmill.toolkit.ui.*;
+
+public class FeatureLink extends Feature {
+
+ public FeatureLink() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Link lnk = new Link("Link caption", new ExternalResource(
+ "http://www.itmill.com"));
+ l.addComponent(lnk);
+
+ // Properties
+ propertyPanel = new PropertyPanel(lnk);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] {
+ "targetName", "targetWidth", "targetHeight", "targetBorder" });
+ ap.replaceWithSelect("targetBorder", new Object[] {
+ new Integer(Link.TARGET_BORDER_DEFAULT),
+ new Integer(Link.TARGET_BORDER_MINIMAL),
+ new Integer(Link.TARGET_BORDER_NONE) }, new Object[] {
+ "Default", "Minimal", "None" });
+ propertyPanel.addProperties("Link Properties", ap);
+
+ setJavadocURL("ui/Link.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "Link link = new Link(\"Link caption\",new ExternalResource(\"http://www.itmill.com\"));\n";
+ }
+
+ protected String getDescriptionXHTML() {
+ return "The link feature allows for making refences to both internal and external resources. "
+ + "The link can open the new resource in a new window, allowing for control of the newly "
+ + "opened windows attributes, such as size and border. "
+ + "<br /><br />"
+ + " For example you can create an application pop-up or create link to external resources.";
+
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Link";
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureOrderedLayout.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureOrderedLayout.java
new file mode 100644
index 0000000000..5d18cd8870
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureOrderedLayout.java
@@ -0,0 +1,95 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureOrderedLayout extends Feature {
+
+ public FeatureOrderedLayout() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ OrderedLayout ol = new OrderedLayout();
+ for (int i = 1; i < 5; i++)
+ ol.addComponent(new TextField("Test component " + i));
+ l.addComponent(ol);
+
+ // Properties
+ propertyPanel = new PropertyPanel(ol);
+ Form ap = propertyPanel
+ .createBeanPropertySet(new String[] { "orientation" });
+ ap.replaceWithSelect("orientation", new Object[] {
+ new Integer(OrderedLayout.ORIENTATION_HORIZONTAL),
+ new Integer(OrderedLayout.ORIENTATION_VERTICAL) },
+ new Object[] { "Horizontal", "Vertical" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("form").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("form");
+ propertyPanel.addProperties("OrderedLayout Properties", ap);
+
+ setJavadocURL("ui/OrderedLayout.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_FLOW);\n"
+ + "ol.addComponent(new TextField(\"Textfield caption\"));\n"
+ + "ol.addComponent(new Label(\"Label\"));\n";
+
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "This feature provides a container for laying out components either "
+ + "vertically, horizontally or flowingly. The orientation may be changed "
+ + "during runtime. It also defines a special style for themes to implement called \"form\""
+ + "that is used for input forms where the components are laid-out side-by-side "
+ + "with their captions."
+ + "<br /><br />"
+ + "On the demo tab you can try out how the different properties "
+ + "affect the presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "OrderedLayout";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeaturePanel.java b/src/com/itmill/toolkit/tests/featurebrowser/FeaturePanel.java
new file mode 100644
index 0000000000..efadad36c4
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeaturePanel.java
@@ -0,0 +1,87 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeaturePanel extends Feature {
+
+ public FeaturePanel() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ // Example panel
+ Panel show = new Panel("Panel caption");
+ show
+ .addComponent(new Label(
+ "This is an example Label component that is added into Panel."));
+ l.addComponent(show);
+
+ // Properties
+ propertyPanel = new PropertyPanel(show);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("ui/Panel.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "Panel show = new Panel(\"Panel caption\");\n"
+ + "show.addComponent(new Label(\"This is an example Label component that is added into Panel.\"));";
+
+ }
+
+ protected String getDescriptionXHTML() {
+ return "Panel is a container for other components, by default it draws a frame around it's "
+ + "extremities and may have a caption to clarify the nature of the contained components' purpose."
+ + " Panel contains an layout where the actual contained components are added, "
+ + "this layout may be switched on the fly.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Panel";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureParameters.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureParameters.java
new file mode 100644
index 0000000000..18a2a9bef6
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureParameters.java
@@ -0,0 +1,177 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+
+import com.itmill.toolkit.terminal.DownloadStream;
+import com.itmill.toolkit.terminal.ExternalResource;
+import com.itmill.toolkit.terminal.ParameterHandler;
+import com.itmill.toolkit.terminal.URIHandler;
+import com.itmill.toolkit.ui.*;
+
+public class FeatureParameters extends Feature implements URIHandler,
+ ParameterHandler {
+
+ private Label context = new Label();
+
+ private Label relative = new Label();
+
+ private Table params = new Table();
+
+ public FeatureParameters() {
+ super();
+ params.addContainerProperty("Values", String.class, "");
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Label info = new Label("To test this feature, try to "
+ + "add some get parameters to URL. For example if you have "
+ + "the feature browser installed in your local host, try url: ");
+ info.setCaption("Usage info");
+ l.addComponent(info);
+ try {
+ URL u1 = new URL(getApplication().getURL(),
+ "test/uri?test=1&test=2");
+ URL u2 = new URL(getApplication().getURL(),
+ "foo/bar?mary=john&count=3");
+
+ l.addComponent(new Link(u1.toString(), new ExternalResource(u1)));
+ l.addComponent(new Label("Or this: "));
+ l.addComponent(new Link(u2.toString(), new ExternalResource(u2)));
+ } catch (Exception e) {
+ System.out.println("Couldn't get hostname for this machine: "
+ + e.toString());
+ e.printStackTrace();
+ }
+
+ // URI
+ Panel p1 = new Panel("URI Handler");
+ context.setCaption("Last URI handler context");
+ p1.addComponent(context);
+ relative.setCaption("Last relative URI");
+ p1.addComponent(relative);
+ l.addComponent(p1);
+
+ // Parameters
+ Panel p2 = new Panel("Parameter Handler");
+ params.setCaption("Last parameters");
+ params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
+ params.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
+ p2.addComponent(params);
+ l.addComponent(p2);
+
+ // Properties
+ propertyPanel = new PropertyPanel(p1);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("ui/Panel.html");
+
+ return l;
+ }
+
+ protected String getDescriptionXHTML() {
+ return "This is a demonstration of how URL parameters can be recieved and handled."
+ + "Parameters and URL:s can be received trough the windows by registering "
+ + "URIHandler and ParameterHandler classes window.";
+ }
+
+ protected String getImage() {
+ return "parameters.jpg";
+ }
+
+ protected String getTitle() {
+ return "Parameters";
+ }
+
+ /**
+ * Add URI and parametes handlers to window.
+ *
+ * @see com.itmill.toolkit.ui.Component#attach()
+ */
+ public void attach() {
+ super.attach();
+ getWindow().addURIHandler(this);
+ getWindow().addParameterHandler(this);
+ }
+
+ /**
+ * Remove all handlers from window
+ *
+ * @see com.itmill.toolkit.ui.Component#detach()
+ */
+ public void detach() {
+ super.detach();
+ getWindow().removeURIHandler(this);
+ getWindow().removeParameterHandler(this);
+ }
+
+ /**
+ * Update URI
+ *
+ * @see com.itmill.toolkit.terminal.URIHandler#handleURI(URL, String)
+ */
+ public DownloadStream handleURI(URL context, String relativeUri) {
+ this.context.setValue(context.toString());
+ this.relative.setValue(relativeUri);
+ return null;
+ }
+
+ /**
+ * Update parameters table
+ *
+ * @see com.itmill.toolkit.terminal.ParameterHandler#handleParameters(Map)
+ */
+ public void handleParameters(Map parameters) {
+ params.removeAllItems();
+ for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ String[] values = (String[]) parameters.get(name);
+ String v = "";
+ for (int j = 0; j < values.length; j++) {
+ if (v.length() > 0)
+ v += ", ";
+ v += "'" + values[j] + "'";
+ }
+ params.addItem(new Object[] { v }, name);
+ }
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureProperties.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureProperties.java
new file mode 100644
index 0000000000..b3c8a55c67
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureProperties.java
@@ -0,0 +1,111 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class FeatureProperties extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "IT Mill Toolkit data model is one of the core concepts "
+ + "in the library and Property-interface is the base of that "
+ + "model. Property provides standardized API for a single data object "
+ + "that can be read (get) and written (set). A property is always typed, but can optionally "
+ + "support data type conversions. Optionally properties can provide "
+ + "value change events for following the state changes."
+ + "<br /><br />The most important function of the Property as well as other "
+ + "data models is to connect classes implementing the interface directly to "
+ + "editor and viewer classes. Typically this is used to connect different "
+ + "data sources to UI components for editing and viewing their contents."
+ + "<br /><br />Properties can be utilized either by implementing the interface "
+ + "or by using some of the existing property implementations. IT Mill Toolkit "
+ + "includes Property interface implementations for "
+ + "arbitrary function pairs or Bean-properties as well as simple object "
+ + "properties."
+ + "<br /><br />Many of the UI components also implement Property interface and allow "
+ + "setting of other components as their data-source. These UI-components "
+ + "include TextField, DateField, Select, Table, Button, "
+ + "Label and Tree.";
+
+ public FeatureProperties() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Data Model");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/Property.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureSelect.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureSelect.java
new file mode 100644
index 0000000000..0e8fd5400d
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureSelect.java
@@ -0,0 +1,106 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureSelect extends Feature {
+
+ private static final String[] firstnames = new String[] { "John", "Mary",
+ "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Robert", "Paula",
+ "Lenny", "Kenny", "Nathan", "Nicole", "Laura", "Jos", "Josie",
+ "Linus" };
+
+ private static final String[] lastnames = new String[] { "Torvalds",
+ "Smith", "Adams", "Black", "Wilson", "Richards", "Thompson",
+ "McGoff", "Halas", "Jones", "Beck", "Sheridan", "Picard", "Hill",
+ "Fielding", "Einstein" };
+
+ public FeatureSelect() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Select s = new Select("Select employee");
+ for (int i = 0; i < 50; i++)
+ s
+ .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))]
+ + " "
+ + lastnames[(int) (Math.random() * (lastnames.length - 1))]);
+ l.addComponent(s);
+
+ // Properties
+ propertyPanel = new PropertyPanel(s);
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("optiongroup").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("optiongroup");
+ themes.addItem("twincol").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("twincol");
+
+ setJavadocURL("ui/Select.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "Select s = new Select(\"Select Car\");\n"
+ + "s.addItem(\"Audi\");\n" + "s.addItem(\"BMW\");\n"
+ + "s.addItem(\"Chrysler\");\n" + "s.addItem(\"Volvo\");\n";
+
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "The select component combines two different modes of item selection. "
+ + "Firstly it presents the single selection mode, which is usually represented as "
+ + "either a drop-down menu or a radio-group of switches, secondly it "
+ + "allows for multiple item selection, this is usually represented as either a "
+ + "listbox of selectable items or as a group of checkboxes."
+ + "<br/><br/>"
+ + "Data source can be associated both with selected item and the list of selections. "
+ + "This way you can easily present a selection based on items specified elsewhere in application. "
+ + "<br/><br/>"
+ + "On the demo tab you can try out how the different properties affect the"
+ + " presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Select";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureTabSheet.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTabSheet.java
new file mode 100644
index 0000000000..2059f37845
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTabSheet.java
@@ -0,0 +1,91 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureTabSheet extends Feature {
+
+ public FeatureTabSheet() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ TabSheet ts = new TabSheet();
+ ts
+ .addTab(
+ new Label(
+ "This is an example Label component that is added into Tab 1."),
+ "Tab 1 caption", null);
+ ts
+ .addTab(
+ new Label(
+ "This is an example Label component that is added into Tab 2."),
+ "Tab 2 caption", null);
+ ts
+ .addTab(
+ new Label(
+ "This is an example Label component that is added into Tab 3."),
+ "Tab 3 caption", null);
+ l.addComponent(ts);
+
+ // Properties
+ propertyPanel = new PropertyPanel(ts);
+
+ setJavadocURL("ui/TabSheet.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "TabSheet ts = new TabSheet();\n"
+ + "ts.addTab(new Label(\"This is an example Label component that is added into Tab 1.\"),\"Tab 1 caption\",null);\n"
+ + "ts.addTab(new Label(\"This is an example Label component that is added into Tab 2.\"),\"Tab 2 caption\",null);\n"
+ + "ts.addTab(new Label(\"This is an example Label component that is added into Tab 3.\"),\"Tab 3 caption\",null);";
+ }
+
+ protected String getDescriptionXHTML() {
+ return "A multicomponent container with tabs for switching between them.<br/>"
+ + "In the normal case, one would place a layout component on each tab.<br/><br />"
+ + "On the demo tab you can try out how the different properties affect "
+ + "the presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "TabSheet";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureTable.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTable.java
new file mode 100644
index 0000000000..c042614a79
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTable.java
@@ -0,0 +1,218 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.event.Action;
+import com.itmill.toolkit.ui.Button;
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Select;
+import com.itmill.toolkit.ui.Table;
+
+public class FeatureTable extends Feature implements Action.Handler {
+
+ private static final String[] firstnames = new String[] { "John", "Mary",
+ "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+
+ private static final String[] lastnames = new String[] { "Torvalds",
+ "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
+ "Einstein" };
+
+ private static final String[] title = new String[] { "Project Manager",
+ "Marketing Manager", "Sales Manager", "Trainer", "IT Support",
+ "Account Manager", "Customer Support", "Testing Engineer",
+ "Software Designer", "Programmer", "Consultant" };
+
+ private static final String[] unit = new String[] { "Tokyo", "Mexico City",
+ "Seoul", "New York", "Sao Paulo", "Bombay", "Delhi", "Shanghai",
+ "Los Angeles", "London", "Bangalore", "Hong Kong", "Madrid",
+ "Milano", "Beijing", "Paris", "Moscow", "Helsinki" };
+
+ private Table t;
+
+ private boolean actionsActive = false;
+
+ private Button actionHandlerSwitch = new Button("Activate actions", this,
+ "toggleActions");
+
+ public void toggleActions() {
+ if (actionsActive) {
+ t.removeActionHandler(this);
+ actionsActive = false;
+ actionHandlerSwitch.setCaption("Activate Actions");
+ } else {
+ t.addActionHandler(this);
+ actionsActive = true;
+ actionHandlerSwitch.setCaption("Deactivate Actions");
+ }
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ // Sample table
+ t = new Table("Corporate Employees");
+ t.setPageLength(10);
+ l.addComponent(t);
+
+ // Add columns to table
+ t.addContainerProperty("Firstname", String.class, "");
+ t.addContainerProperty("Lastname", String.class, "");
+ t.addContainerProperty("Title", String.class, "");
+ t.addContainerProperty("Unit", String.class, "");
+
+ // set alignments to demonstrate features
+ t.setColumnAlignment("Title", Table.ALIGN_CENTER);
+ t.setColumnAlignment("Unit", Table.ALIGN_RIGHT);
+
+ // Add random rows to table
+ for (int j = 0; j < 300; j++) {
+ t
+ .addItem(
+ new Object[] {
+ firstnames[(int) (Math.random() * (firstnames.length - 1))],
+ lastnames[(int) (Math.random() * (lastnames.length - 1))],
+ title[(int) (Math.random() * title.length)],
+ unit[(int) (Math.random() * unit.length)] },
+ new Integer(j));
+ }
+
+ // Actions
+ l.addComponent(this.actionHandlerSwitch);
+
+ // Properties
+ propertyPanel = new PropertyPanel(t);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] {
+ "pageLength", "rowHeaderMode", "selectable",
+ "columnHeaderMode", "columnCollapsingAllowed",
+ "columnReorderingAllowed", "width", "height" });
+ ap.replaceWithSelect("columnHeaderMode", new Object[] {
+ new Integer(Table.COLUMN_HEADER_MODE_EXPLICIT),
+ new Integer(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID),
+ new Integer(Table.COLUMN_HEADER_MODE_HIDDEN),
+ new Integer(Table.COLUMN_HEADER_MODE_ID) }, new Object[] {
+ "Explicit", "Explicit defaults ID", "Hidden", "ID" });
+ ap.replaceWithSelect("rowHeaderMode", new Object[] {
+ new Integer(Table.ROW_HEADER_MODE_EXPLICIT),
+ new Integer(Table.ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID),
+ new Integer(Table.ROW_HEADER_MODE_HIDDEN),
+ new Integer(Table.ROW_HEADER_MODE_ICON_ONLY),
+ new Integer(Table.ROW_HEADER_MODE_ID),
+ new Integer(Table.ROW_HEADER_MODE_INDEX),
+ new Integer(Table.ROW_HEADER_MODE_ITEM),
+ new Integer(Table.ROW_HEADER_MODE_PROPERTY) }, new Object[] {
+ "Explicit", "Explicit defaults ID", "Hidden", "Icon only",
+ "ID", "Index", "Item", "Property" });
+
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("list").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("list");
+ themes.addItem("paging").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("paging");
+
+ propertyPanel.addProperties("Table Properties", ap);
+
+ // Set first name as item caption propertyId in cas somebody selecs it
+ t.setItemCaptionPropertyId("Firstname");
+
+ // this overrides previous
+ t.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
+ t.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID);
+
+ t.setColumnCollapsingAllowed(true);
+ t.setColumnReorderingAllowed(true);
+ t.setSelectable(true);
+
+ setJavadocURL("ui/Table.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "// Sample table\n"
+ + "t = new Table(\"Corporate Employees\");\n"
+ + "t.setPageLength(10);\n\n"
+ + "// Add columns to table\n"
+ + "t.addContainerProperty(\"Firstname\", String.class, \"\");\n"
+ + "t.addContainerProperty(\"Lastname\", String.class, \"\");\n"
+ + "t.addContainerProperty(\"Age\", String.class, \"\");\n"
+ + "t.addContainerProperty(\"Title\", String.class, \"\");\n"
+ + "t.addContainerProperty(\"Unit\", String.class, \"\");\n\n"
+ + "// Add random rows to table\n"
+ + "for (int j = 0; j < 50; j++) {\n" + " t.addItem(\n"
+ + " new Object[] {\n"
+ + " firstnames[(int) (Math.random() * 9)],\n"
+ + " lastnames[(int) (Math.random() * 9)],\n"
+ + " title[(int) (Math.random() * title.length)],\n"
+ + " unit[(int) (Math.random() * unit.length)] },\n"
+ + " new Integer(j));\n" + "}\n";
+ }
+
+ protected String getDescriptionXHTML() {
+
+ return "The Table component is designed for displaying large volumes of tabular data, "
+ + "in multiple pages whenever needed."
+ + "<br /><br />Selection of the displayed data is supported both in selecting exclusively one row "
+ + "or multiple rows at the same time. For each row, there may be a set of actions associated, "
+ + "depending on the theme these actions may be displayed either as a drop-down "
+ + "menu for each row or a set of command buttons."
+ + "<br /><br />Table may be connected to any datasource implementing the <code>Container</code> interface."
+ + "This way data found in external datasources can be directly presented in the table component."
+ + "<br /><br />"
+ + "Table implements a number of features and you can test most of them in the table demo tab.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Table";
+ }
+
+ private Action ACTION1 = new Action("Action 1");
+
+ private Action ACTION2 = new Action("Action 2");
+
+ private Action ACTION3 = new Action("Action 3");
+
+ private Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
+
+ public Action[] getActions(Object target, Object sender) {
+ return actions;
+ }
+
+ public void handleAction(Action action, Object sender, Object target) {
+ t.setDescription("Last action clicked was '" + action.getCaption()
+ + "' on item '" + t.getItem(target).toString() + "'");
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureTextField.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTextField.java
new file mode 100644
index 0000000000..cc6ac13794
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTextField.java
@@ -0,0 +1,89 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeatureTextField extends Feature {
+
+ public FeatureTextField() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+
+ // Test component
+ TextField tf = new TextField("Caption");
+ l.addComponent(tf);
+
+ // Properties
+ propertyPanel = new PropertyPanel(tf);
+ Form f = propertyPanel.createBeanPropertySet(new String[] { "columns",
+ "rows", "wordwrap", "writeThrough", "readThrough",
+ "nullRepresentation", "nullSettingAllowed", "secret" });
+ propertyPanel.addProperties("Text field properties", f);
+
+ setJavadocURL("ui/TextField.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "TextField tf = new TextField(\"Caption\");\n"
+ + "tf.setValue(\"Contents\");";
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "TextField combines the logic of both the single line text-entry field and the multi-line "
+ + "text-area into one component. "
+ + "As with all Data-components of IT Mill Toolkit, the TextField can also be bound to an "
+ + "underlying data source, both directly or in a buffered (asynchronous) "
+ + "mode. In buffered mode its background color will change to indicate "
+ + "that the value has changed but is not committed."
+ + "<br /><br />Furthermore a validators may be bound to the component to "
+ + "check and validate the given input before it is actually committed."
+ + "<br /><br />On the demo tab you can try out how the different properties affect the "
+ + "presentation of the component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "TextField";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureTree.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTree.java
new file mode 100644
index 0000000000..160fdfe6a4
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureTree.java
@@ -0,0 +1,184 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.util.Iterator;
+
+import com.itmill.toolkit.event.Action;
+import com.itmill.toolkit.ui.*;
+
+public class FeatureTree extends Feature implements Action.Handler {
+
+ private static final String[] firstnames = new String[] { "John", "Mary",
+ "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };
+
+ private static final String[] lastnames = new String[] { "Torvalds",
+ "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
+ "Einstein" };
+
+ private Tree t;
+
+ private boolean actionsActive = false;
+
+ private Button actionHandlerSwitch = new Button("Activate actions", this,
+ "toggleActions");
+
+ public FeatureTree() {
+ super();
+ }
+
+ public void toggleActions() {
+ if (actionsActive) {
+ t.removeActionHandler(this);
+ actionsActive = false;
+ actionHandlerSwitch.setCaption("Activate Actions");
+ } else {
+ t.addActionHandler(this);
+ actionsActive = true;
+ actionHandlerSwitch.setCaption("Deactivate Actions");
+ }
+ }
+
+ public void expandAll() {
+ for (Iterator i = t.rootItemIds().iterator(); i.hasNext();) {
+ t.expandItemsRecursively(i.next());
+ }
+ }
+
+ public void collapseAll() {
+ for (Iterator i = t.rootItemIds().iterator(); i.hasNext();) {
+ t.collapseItemsRecursively(i.next());
+ }
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ String[] names = new String[100];
+ for (int i = 0; i < names.length; i++)
+ names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))]
+ + " "
+ + lastnames[(int) (Math.random() * (lastnames.length - 1))];
+
+ // Create tree
+ t = new Tree("Organization Structure");
+ for (int i = 0; i < 100; i++) {
+ t.addItem(names[i]);
+ String parent = names[(int) (Math.random() * (names.length - 1))];
+ if (t.containsId(parent))
+ t.setParent(names[i], parent);
+ }
+
+ // Forbid childless people to have children (makes them leaves)
+ for (int i = 0; i < 100; i++)
+ if (!t.hasChildren(names[i]))
+ t.setChildrenAllowed(names[i], false);
+
+ l.addComponent(t);
+
+ // Actions
+ l.addComponent(this.actionHandlerSwitch);
+
+ // Expand and Collapse buttons
+ l.addComponent(new Button("Expand All", this, "expandAll"));
+ l.addComponent(new Button("Collapse All", this, "collapseAll"));
+
+ // Properties
+ propertyPanel = new PropertyPanel(t);
+ Form ap = propertyPanel
+ .createBeanPropertySet(new String[] { "selectable" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("menu").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("menu");
+ propertyPanel.addProperties("Tree Properties", ap);
+
+ setJavadocURL("ui/Tree.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "// Create tree\n"
+ + "t = new Tree(\"Organization Structure\");\n"
+ + "for (int i = 0; i < 100; i++) {\n"
+ + " t.addItem(names[i]);\n"
+ + " String parent = names[(int) (Math.random() * (names.length - 1))];\n"
+ + " if (t.containsId(parent)) \n"
+ + " t.setParent(names[i],parent);\n"
+ + "}\n\n"
+ + "// Forbid childless people to have children (makes them leaves)\n"
+ + "for (int i = 0; i < 100; i++)\n"
+ + " if (!t.hasChildren(names[i]))\n"
+ + " t.setChildrenAllowed(names[i], false);\n";
+ }
+
+ protected String getDescriptionXHTML() {
+ return "A tree is a natural way to represent datasets that have"
+ + " hierarchical relationships, such as filesystems, message "
+ + "threads or, as in this example, organization structure. IT Mill Toolkit features a versatile "
+ + "and powerful Tree component that works much like the tree components "
+ + "of most modern operating systems."
+ + "<br /><br />The most prominent use of the Tree component is to "
+ + "use it for displaying a hierachical menu, like the "
+ + "menu on the left side of the screen for instance "
+ + "or to display filesystems or other hierarchical datasets."
+ + "<br /><br />The tree component uses <code>Container</code> "
+ + "datasources much like the Table component, "
+ + "with the addition that it also utilizes the hierarchy "
+ + "information maintained by the container."
+ + "<br /><br />On the demo tab you can try out how the different properties "
+ + "affect the presentation of the tree component.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Tree";
+ }
+
+ private Action ACTION1 = new Action("Action 1");
+
+ private Action ACTION2 = new Action("Action 2");
+
+ private Action ACTION3 = new Action("Action 3");
+
+ private Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 };
+
+ public Action[] getActions(Object target, Object sender) {
+ return actions;
+ }
+
+ public void handleAction(Action action, Object sender, Object target) {
+ t.setDescription("Last action clicked was '" + action.getCaption()
+ + "' on item '" + target + "'");
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureUpload.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureUpload.java
new file mode 100644
index 0000000000..b4178d55eb
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureUpload.java
@@ -0,0 +1,168 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import com.itmill.toolkit.terminal.StreamResource;
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.Link;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Upload;
+import com.itmill.toolkit.ui.Upload.FinishedEvent;
+
+public class FeatureUpload extends Feature implements Upload.FinishedListener {
+ Buffer buffer = new Buffer();
+
+ Panel status = new Panel("Uploaded file:");
+
+ public FeatureUpload() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Upload up = new Upload("Upload", buffer);
+ up.setImmediate(true);
+ up.addListener(this);
+
+ status.setVisible(false);
+
+ l.addComponent(up);
+ l.addComponent(status);
+
+ // Properties
+ propertyPanel = new PropertyPanel(up);
+
+ setJavadocURL("ui/Upload.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return "Upload u = new Upload(\"Upload a file:\", uploadReceiver);\n\n"
+ + "public class uploadReceiver \n"
+ + "implements Upload.receiver, Upload.FinishedListener { \n"
+ + "\n" + " java.io.File file;\n"
+ + " java.io.FileOutputStream fos;\n"
+ + " public uploadReceiver() {\n" + " }";
+
+ }
+
+ protected String getDescriptionXHTML() {
+ return "This demonstrates the use of the Upload component together with the Link component. "
+ + "This implementation does not actually store the file to disk, it only keeps it in a buffer. "
+ + "The example given on the <em>Code Sample</em>-tab on the other hand stores the file to disk and binds the link to that file.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Upload";
+ }
+
+ public void uploadFinished(FinishedEvent event) {
+ status.removeAllComponents();
+ if (buffer.getStream() == null)
+ status.addComponent(new Label(
+ "Upload finished, but output buffer is null!!"));
+ else {
+ status
+ .addComponent(new Label("<b>Name:</b> "
+ + event.getFilename(), Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Mimetype:</b> "
+ + event.getMIMEType(), Label.CONTENT_XHTML));
+ status.addComponent(new Label("<b>Size:</b> " + event.getLength()
+ + " bytes.", Label.CONTENT_XHTML));
+
+ status.addComponent(new Link("Download " + buffer.getFileName(),
+ new StreamResource(buffer, buffer.getFileName(),
+ getApplication())));
+
+ status.setVisible(true);
+ }
+ }
+
+ public class Buffer implements StreamResource.StreamSource, Upload.Receiver {
+ ByteArrayOutputStream outputBuffer = null;
+
+ String mimeType;
+
+ String fileName;
+
+ public Buffer() {
+
+ }
+
+ public InputStream getStream() {
+ if (outputBuffer == null)
+ return null;
+ return new ByteArrayInputStream(outputBuffer.toByteArray());
+ }
+
+ /**
+ * @see com.itmill.toolkit.ui.Upload.Receiver#receiveUpload(String,
+ * String)
+ */
+ public OutputStream receiveUpload(String filename, String MIMEType) {
+ fileName = filename;
+ mimeType = MIMEType;
+ outputBuffer = new ByteArrayOutputStream();
+ return outputBuffer;
+ }
+
+ /**
+ * Returns the fileName.
+ *
+ * @return String
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Returns the mimeType.
+ *
+ * @return String
+ */
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ }
+} \ No newline at end of file
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java
new file mode 100644
index 0000000000..14743c14d1
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureUtil.java
@@ -0,0 +1,31 @@
+package com.itmill.toolkit.tests.featurebrowser;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class FeatureUtil {
+
+ private static boolean statistics = false;
+
+ public static final SimpleDateFormat format = new SimpleDateFormat(
+ "yyyyMMdd HHmmss");
+
+ public static void debug(String userIdentity, String msg) {
+ if (statistics)
+ System.out.println("[" + userIdentity + "] " + msg);
+ }
+
+ public static String getTimestamp() {
+ if (statistics)
+ try {
+ return format.format(new Date());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+ return "";
+ }
+
+ public static void setStatistics(boolean statistics) {
+ FeatureUtil.statistics = statistics;
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureValidators.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureValidators.java
new file mode 100644
index 0000000000..caa1c9b865
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureValidators.java
@@ -0,0 +1,106 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class FeatureValidators extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "IT Mill Toolkit contains simple, yet powerful validation interface, "
+ + "that consists of two parts: Validator and Validatable. Validator is "
+ + "any class that can check validity of an Object. Validatable is "
+ + "a class with configurable validation. "
+ + "Validation errors are passed as special exceptions that implement "
+ + "ErrorMessage interface. This way the validation errors can be "
+ + "automatically added to components."
+ + "<br /><br />Utilities for simple string and null validation are provided, as "
+ + "well as combinative validators. The validation interface can also "
+ + "be easily implemented by the applications for more complex "
+ + "validation needs.";
+
+ public FeatureValidators() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Validators");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/Validator.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeatureWindow.java b/src/com/itmill/toolkit/tests/featurebrowser/FeatureWindow.java
new file mode 100644
index 0000000000..b3a6fa65c8
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeatureWindow.java
@@ -0,0 +1,159 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+import com.itmill.toolkit.ui.Window.CloseEvent;
+
+public class FeatureWindow extends Feature implements Window.CloseListener {
+
+ private Button addButton = new Button("Add window", this, "addWin");
+
+ private Button removeButton = new Button("Remove window", this, "delWin");
+
+ private Window demoWindow;
+
+ private Form windowProperties;
+
+ public FeatureWindow() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout layoutRoot = new OrderedLayout();
+ OrderedLayout layoutUpper = new OrderedLayout();
+ OrderedLayout layoutLower = new OrderedLayout();
+
+ demoWindow = new Window("Feature Test Window");
+ demoWindow.addListener(this);
+ demoWindow.setWidth(400);
+ demoWindow.setHeight(200);
+ demoWindow.setTheme("default");
+
+ layoutUpper.addComponent(addButton);
+ layoutUpper.addComponent(removeButton);
+
+ updateWinStatus();
+
+ // Properties
+ propertyPanel = new PropertyPanel(demoWindow);
+ propertyPanel.dependsOn(addButton);
+ propertyPanel.dependsOn(removeButton);
+ windowProperties = propertyPanel.createBeanPropertySet(new String[] {
+ "width", "height", "name", "theme", "border", "scrollable", });
+ windowProperties.replaceWithSelect("border", new Object[] {
+ new Integer(Window.BORDER_DEFAULT),
+ new Integer(Window.BORDER_NONE),
+ new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default",
+ "None", "Minimal" });
+ // Disabled, not applicable for default theme
+ windowProperties.getField("border").setEnabled(false);
+ windowProperties.getField("scrollable").setEnabled(false);
+
+ propertyPanel.addProperties("Window Properties", windowProperties);
+ windowProperties.getField("width").setDescription(
+ "Minimum width is 100");
+ windowProperties.getField("height").setDescription(
+ "Minimum height is 100");
+
+ setJavadocURL("ui/Window.html");
+
+ layoutRoot.addComponent(layoutUpper);
+ layoutRoot.addComponent(layoutLower);
+ return layoutRoot;
+ }
+
+ protected String getExampleSrc() {
+ return "Window win = new Window();\n"
+ + "getApplication().addWindow(win);\n";
+
+ }
+
+ protected String getDescriptionXHTML() {
+ return "The window support in IT Mill Toolkit allows for opening and closing windows, "
+ + "refreshing one window from another (for asynchronous terminals), "
+ + "resizing windows and scrolling window content. "
+ + "There are also a number of preset window border styles defined by "
+ + "this feature.";
+ }
+
+ protected String getImage() {
+ return "icon_demo.png";
+ }
+
+ protected String getTitle() {
+ return "Window";
+ }
+
+ public void addWin() {
+
+ propertyPanel.commit();
+
+ getApplication().getMainWindow().addWindow(demoWindow);
+
+ demoWindow.removeAllComponents();
+
+ demoWindow
+ .addComponent(new Label(
+ "<br /><br />This is a new window created by "
+ + "<em>Add window</em>"
+ + " button's event.<br /><br />You may simply"
+ + " close this window or select "
+ + "<em>Remove window</em> from the Feature Browser window.",
+ Label.CONTENT_XHTML));
+ // prevent user to change window name tag (after window is created)
+ windowProperties.getField("name").setEnabled(false);
+ windowProperties.getField("name").setReadOnly(true);
+ demoWindow.setVisible(true);
+ updateWinStatus();
+ }
+
+ public void delWin() {
+ getApplication().getMainWindow().removeWindow(demoWindow);
+ // allow user to change window name tag (before window is created)
+ windowProperties.getField("name").setEnabled(true);
+ windowProperties.getField("name").setReadOnly(false);
+ updateWinStatus();
+ }
+
+ private void updateWinStatus() {
+ if (demoWindow.getApplication() == null) {
+ addButton.setEnabled(true);
+ removeButton.setEnabled(false);
+ } else {
+ addButton.setEnabled(false);
+ removeButton.setEnabled(true);
+ }
+ }
+
+ public void windowClose(CloseEvent e) {
+ delWin();
+ }
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/FeaturesApplication.java b/src/com/itmill/toolkit/tests/featurebrowser/FeaturesApplication.java
new file mode 100644
index 0000000000..335d583a6d
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/FeaturesApplication.java
@@ -0,0 +1,56 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.*;
+
+public class FeaturesApplication extends com.itmill.toolkit.Application {
+
+ public void init() {
+ if (getProperty("statistics") != null)
+ FeatureUtil.setStatistics(true);
+ setUser(new Long(System.currentTimeMillis()).toString());
+ Window main = new Window("IT Mill Toolkit Features Tour");
+ setMainWindow(main);
+
+ main.setLayout(new FeatureBrowser());
+ }
+
+ /**
+ * ErrorEvents are printed to default error stream and not in GUI.
+ */
+ public void terminalError(
+ com.itmill.toolkit.terminal.Terminal.ErrorEvent event) {
+ Throwable e = event.getThrowable();
+ FeatureUtil.debug(getUser().toString(), "terminalError: "
+ + e.toString());
+ e.printStackTrace();
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroBasic.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroBasic.java
new file mode 100644
index 0000000000..fae31d029b
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroBasic.java
@@ -0,0 +1,98 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroBasic extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "Text Field, Date Field, Button, Form, Label and Link components are provided as samples"
+ + " for basic UI components."
+ + "<br /><br />See the API documentation of respective components for more information.";
+
+ public IntroBasic() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Basic UI components");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("ui/package-summary.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return "Introduction of basic UI components";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroComponents.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroComponents.java
new file mode 100644
index 0000000000..8f796a74fb
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroComponents.java
@@ -0,0 +1,102 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.terminal.ClassResource;
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Embedded;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroComponents extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "This picture summarizes the relations between different user interface (UI) components."
+ + "<br /><br />See API documentation below for more information.";
+
+ public IntroComponents() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("UI component diagram");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ panel.addComponent(new Embedded("", new ClassResource("components.png",
+ this.getApplication())));
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("ui/package-summary.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroDataHandling.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroDataHandling.java
new file mode 100644
index 0000000000..b96c1c155c
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroDataHandling.java
@@ -0,0 +1,97 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroDataHandling extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "Embedded Objects and Upload components are provided as samples"
+ + " for data handling section."
+ + "<br /><br />See the API documentation of respective components for more information.";
+
+ public IntroDataHandling() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Data Handling");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "Please select <em>Embedded Objects</em> or <em>Upload</em>"
+ + " from the menu for more information.";
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroDataModel.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroDataModel.java
new file mode 100644
index 0000000000..b46501f6c8
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroDataModel.java
@@ -0,0 +1,99 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroDataModel extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "This section introduces main concepts of data model in IT Mill Toolkit."
+ + " It contains brief introduction to Properties, Items, Containers, Validators and"
+ + " Buffering classes."
+ + "<br /><br />See the API documentation of respective area for more information.";
+
+ public IntroDataModel() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Data Model");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/package-summary.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroItemContainers.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroItemContainers.java
new file mode 100644
index 0000000000..97c17101b3
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroItemContainers.java
@@ -0,0 +1,98 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroItemContainers extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "Select, Table and Tree components are provided as samples"
+ + " for item containers section."
+ + "<br /><br />See the API documentation of respective components for more information.";
+
+ public IntroItemContainers() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Item Containers");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("data/Container.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroLayouts.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroLayouts.java
new file mode 100644
index 0000000000..7c4a4b21bb
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroLayouts.java
@@ -0,0 +1,100 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroLayouts extends Feature {
+
+ private static final String INTRO_TEXT = ""
+ + "Layouts are required to place components to specific place in the UI."
+ + " You can use plain Java to accomplish sophisticated component layouting."
+ + " Other option is to use Custom Layout and let the web page designers"
+ + " to take responsibility of component layouting using their own set of tools."
+ + "<br /><br />See API documentation below for more information.";
+
+ public IntroLayouts() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Panel panel = new Panel();
+ panel.setCaption("Layouts");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(INTRO_TEXT);
+
+ // Properties
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("ui/Layout.html");
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return null;
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return null;
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroTerminal.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroTerminal.java
new file mode 100644
index 0000000000..84ac477c9c
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroTerminal.java
@@ -0,0 +1,74 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+
+public class IntroTerminal extends Feature {
+
+ public IntroTerminal() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ Label lab = new Label();
+ lab.setStyle("featurebrowser-none");
+ l.addComponent(lab);
+
+ // Properties
+ propertyPanel = null;
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return null;
+ }
+
+ /**
+ * @see com.itmill.toolkit.tests.featurebrowser.Feature#getDescriptionXHTML()
+ */
+ protected String getDescriptionXHTML() {
+ return "";
+ }
+
+ protected String getImage() {
+ return null;
+ }
+
+ protected String getTitle() {
+ return "Introduction for terminals (TODO)";
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/IntroWelcome.java b/src/com/itmill/toolkit/tests/featurebrowser/IntroWelcome.java
new file mode 100644
index 0000000000..fb77b16231
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/IntroWelcome.java
@@ -0,0 +1,217 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.net.URL;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+
+import com.itmill.toolkit.terminal.DownloadStream;
+import com.itmill.toolkit.terminal.PaintException;
+import com.itmill.toolkit.terminal.PaintTarget;
+import com.itmill.toolkit.terminal.ParameterHandler;
+import com.itmill.toolkit.terminal.URIHandler;
+import com.itmill.toolkit.terminal.gwt.server.ApplicationServlet;
+import com.itmill.toolkit.terminal.gwt.server.WebBrowser;
+import com.itmill.toolkit.ui.Component;
+import com.itmill.toolkit.ui.Form;
+import com.itmill.toolkit.ui.Label;
+import com.itmill.toolkit.ui.OrderedLayout;
+import com.itmill.toolkit.ui.Panel;
+import com.itmill.toolkit.ui.Select;
+
+public class IntroWelcome extends Feature implements URIHandler,
+ ParameterHandler {
+
+ private WebBrowser webBrowser = null;
+
+ Panel panel = new Panel();
+
+ private static final String WELCOME_TEXT_UPPER = ""
+ + "This application lets you view and play with some features of "
+ + "IT Mill Toolkit. Use menu on the left to select component."
+ + "<br /><br />Note the <b>Properties selection</b> on the top "
+ + "right corner. Click it open to access component properties and"
+ + " feel free to edit properties at any time."
+ + "<br /><br />The area that you are now reading is the component"
+ + " demo area. Lower area from here contains component description, API"
+ + " documentation and optional code sample. Note that not all selections"
+ + " contain demo, only description and API documentation is shown."
+ + "<br /><br />You may also change application's theme from below the menu."
+ + " This example application is designed to work best with"
+ + " <em>Demo</em> theme, other themes are for demonstration purposes only."
+ + "<br /><br />IT Mill Toolkit enables you to construct complex Web"
+ + " applications using plain Java, no knowledge of other Web technologies"
+ + " such as XML, HTML, DOM, JavaScript or browser differences is required."
+ + "<br /><br />For more information, point your browser to"
+ + " <a href=\"http://www.itmill.com\" target=\"_new\">www.itmill.com</a>.";
+
+ private static final String WELCOME_TEXT_LOWER = ""
+ + "This area contains the selected component's description, list of properties, javadoc"
+ + " and optional code sample. "
+ + "Start your tour now by selecting features from the list"
+ + " on the left and remember to experiment with the <b>Properties panel</b>"
+ + " located at the top right corner area.";
+
+ private String description = WELCOME_TEXT_LOWER
+ + "<br /><br />IT Mill Toolkit version: "
+ + ApplicationServlet.VERSION;
+
+ public IntroWelcome() {
+ super();
+ }
+
+ protected Component getDemoComponent() {
+
+ OrderedLayout l = new OrderedLayout();
+
+ panel.setCaption("Welcome to the IT Mill Toolkit feature tour!");
+ l.addComponent(panel);
+
+ Label label = new Label();
+ panel.addComponent(label);
+
+ label.setContentMode(Label.CONTENT_XHTML);
+ label.setValue(WELCOME_TEXT_UPPER);
+
+ propertyPanel = new PropertyPanel(panel);
+ Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
+ "height" });
+ Select themes = (Select) propertyPanel.getField("style");
+ themes.addItem("light").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("light");
+ themes.addItem("strong").getItemProperty(
+ themes.getItemCaptionPropertyId()).setValue("strong");
+ propertyPanel.addProperties("Panel Properties", ap);
+
+ setJavadocURL("package-summary.html");
+
+ setPropsReminder(false);
+
+ return l;
+ }
+
+ protected String getExampleSrc() {
+ return ""
+ + "package com.itmill.toolkit.demo;\n"
+ + "import com.itmill.toolkit.ui.*;\n\n"
+ + "public class HelloWorld extends com.itmill.toolkit.Application {\n"
+ + " public void init() {\n"
+ + " Window main = new Window(\"Hello window\");\n"
+ + " setMainWindow(main);\n"
+ + " main.addComponent(new Label(\"Hello World!\"));\n"
+ + " }\n" + "}\n";
+ }
+
+ // not ready yet to give description, see paint instead
+ protected String getDescriptionXHTML() {
+ return description;
+ }
+
+ // Hack for #512: set description right (WebBrowser now exists)
+ public void paint(PaintTarget target) throws PaintException {
+ if (webBrowser == null) {
+ webBrowser = (WebBrowser) getWindow().getTerminal();
+ if (webBrowser != null) {
+ super.getDescription().setValue(
+ description + "<br />Browser: "
+ + webBrowser.getBrowserApplication());
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "timestamp=[" + FeatureUtil.getTimestamp()
+ + "] userAgent=["
+ + webBrowser.getBrowserApplication() + "]");
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+ }
+ }
+ super.paint(target);
+ }
+
+ protected String getImage() {
+ return "icon_intro.png";
+ }
+
+ protected String getTitle() {
+ return "Welcome";
+ }
+
+ /**
+ * Add URI and parametes handlers to window.
+ *
+ * @see com.itmill.toolkit.ui.Component#attach()
+ */
+ public void attach() {
+ super.attach();
+ getWindow().addURIHandler(this);
+ getWindow().addParameterHandler(this);
+ }
+
+ /**
+ * Remove all handlers from window
+ *
+ * @see com.itmill.toolkit.ui.Component#detach()
+ */
+ public void detach() {
+ super.detach();
+ getWindow().removeURIHandler(this);
+ getWindow().removeParameterHandler(this);
+ }
+
+ /**
+ * Update URI
+ *
+ * @see com.itmill.toolkit.terminal.URIHandler#handleURI(URL, String)
+ */
+ public DownloadStream handleURI(URL context, String relativeUri) {
+ return null;
+ }
+
+ /**
+ * Show system status if systemStatus is given on URL
+ *
+ * @see com.itmill.toolkit.terminal.ParameterHandler#handleParameters(Map)
+ */
+ public void handleParameters(Map parameters) {
+ for (Iterator i = parameters.keySet().iterator(); i.hasNext();) {
+ String name = (String) i.next();
+ if (name.equals("systemStatus")) {
+ String status = "";
+ status += "timestamp=" + new Date() + " ";
+ status += "free=" + Runtime.getRuntime().freeMemory() + ", ";
+ status += "total=" + Runtime.getRuntime().totalMemory() + ", ";
+ status += "max=" + Runtime.getRuntime().maxMemory() + "\n";
+ System.out.println(status);
+ }
+ }
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/PropertyPanel.java b/src/com/itmill/toolkit/tests/featurebrowser/PropertyPanel.java
new file mode 100644
index 0000000000..63cc57cffa
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/PropertyPanel.java
@@ -0,0 +1,516 @@
+/* *************************************************************************
+
+ 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.tests.featurebrowser;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import com.itmill.toolkit.data.*;
+import com.itmill.toolkit.data.Property.ValueChangeListener;
+import com.itmill.toolkit.data.util.*;
+import com.itmill.toolkit.terminal.*;
+import com.itmill.toolkit.ui.*;
+
+public class PropertyPanel extends Panel implements Button.ClickListener,
+ Property.ValueChangeListener {
+
+ private Select addComponent;
+
+ private OrderedLayout formsLayout = new OrderedLayout();
+
+ private LinkedList forms = new LinkedList();
+
+ private Button setButton = new Button("Set", this);
+
+ private Button discardButton = new Button("Discard changes", this);
+
+ private Table allProperties = new Table();
+
+ private Object objectToConfigure;
+
+ private BeanItem config;
+
+ protected static final int COLUMNS = 3;
+
+ /** Contruct new property panel for configuring given object. */
+ public PropertyPanel(Object objectToConfigure) {
+ super();
+
+ // Layout
+ setCaption("Properties");
+ addComponent(formsLayout);
+ addStyleName(Panel.STYLE_NO_PADDING);
+
+ setWidth(100);
+ setWidthUnits(Table.UNITS_PERCENTAGE);
+ setHeight(100);
+ setHeightUnits(Table.UNITS_PERCENTAGE);
+
+ // Target object
+ this.objectToConfigure = objectToConfigure;
+ config = new BeanItem(objectToConfigure);
+
+ // Control buttons
+ OrderedLayout buttons = new OrderedLayout(
+ OrderedLayout.ORIENTATION_HORIZONTAL);
+ buttons.addComponent(setButton);
+ buttons.addComponent(discardButton);
+ addComponent(buttons);
+
+ // Add default properties
+ addBasicComponentProperties();
+ if (objectToConfigure instanceof Select)
+ addSelectProperties();
+ if (objectToConfigure instanceof AbstractField
+ && !(objectToConfigure instanceof Table || objectToConfigure instanceof Tree))
+ addFieldProperties();
+ if ((objectToConfigure instanceof AbstractComponentContainer)
+ && !(objectToConfigure instanceof FrameWindow))
+ addComponentContainerProperties();
+
+ // The list of all properties
+ allProperties.addContainerProperty("Name", String.class, "");
+ allProperties.addContainerProperty("Type", String.class, "");
+ allProperties.addContainerProperty("R/W", String.class, "");
+ allProperties.addContainerProperty("Demo", String.class, "");
+ allProperties.setColumnAlignments(new String[] { Table.ALIGN_LEFT,
+ Table.ALIGN_LEFT, Table.ALIGN_CENTER, Table.ALIGN_CENTER });
+ allProperties.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID);
+ allProperties.setPageLength(0);
+ allProperties.setWidth(100);
+ allProperties.setWidthUnits(Table.UNITS_PERCENTAGE);
+ allProperties.setHeight(100);
+ allProperties.setHeightUnits(Table.UNITS_PERCENTAGE);
+ updatePropertyList();
+
+ }
+
+ /** Add a formful of properties to property panel */
+ public void addProperties(String propertySetCaption, Form properties) {
+
+ // Create new panel containing the form
+ Panel p = new Panel();
+ p.setCaption(propertySetCaption);
+ p.setStyle("light");
+ p.addComponent(properties);
+ formsLayout.addComponent(p);
+
+ // Setup buffering
+ setButton.dependsOn(properties);
+ discardButton.dependsOn(properties);
+ properties.setWriteThrough(false);
+ // TODO change this to false, and test it is suitable for FeatureBrowser
+ // demo
+ properties.setReadThrough(true);
+
+ // Maintain property lists
+ forms.add(properties);
+ updatePropertyList();
+ }
+
+ /** Recreate property list contents */
+ public void updatePropertyList() {
+
+ allProperties.removeAllItems();
+
+ // Collect demoed properties
+ HashSet listed = new HashSet();
+ for (Iterator i = forms.iterator(); i.hasNext();)
+ listed.addAll(((Form) i.next()).getItemPropertyIds());
+
+ // Resolve all properties
+ BeanInfo info;
+ try {
+ info = Introspector.getBeanInfo(objectToConfigure.getClass());
+ } catch (IntrospectionException e) {
+ throw new RuntimeException(e.toString());
+ }
+ PropertyDescriptor[] pd = info.getPropertyDescriptors();
+
+ // Fill the table
+ for (int i = 0; i < pd.length; i++) {
+ allProperties.addItem(new Object[] { pd[i].getName(),
+ pd[i].getPropertyType().getName(),
+ (pd[i].getWriteMethod() == null ? "R" : "R/W"),
+ (listed.contains(pd[i].getName()) ? "x" : "") }, pd[i]);
+ }
+ }
+
+ /** Add basic properties implemented most often by abstract component */
+ private void addBasicComponentProperties() {
+
+ // Set of properties
+ Form set = createBeanPropertySet(new String[] { "caption", "icon",
+ "componentError", "description", "enabled", "visible", "style",
+ "readOnly", "immediate" });
+
+ // Icon
+ set.replaceWithSelect("icon", new Object[] { null,
+ new ThemeResource("icon/files/file.gif") }, new Object[] {
+ "No icon", "Sample icon" });
+
+ // Component error
+ Throwable sampleException;
+ try {
+ throw new NullPointerException("sample exception");
+ } catch (NullPointerException e) {
+ sampleException = e;
+ }
+ set
+ .replaceWithSelect(
+ "componentError",
+ new Object[] {
+ null,
+ new UserError("Sample text error message."),
+ new UserError(
+ "<h3>Error message formatting</h3><p>Error messages can "
+ + "contain any UIDL formatting, like: <ul><li><b>Bold"
+ + "</b></li><li><i>Italic</i></li></ul></p>",
+ UserError.CONTENT_UIDL,
+ ErrorMessage.INFORMATION),
+ new SystemError(
+ "This is an example of exception error reposting",
+ sampleException) },
+ new Object[] { "No error", "Sample text error",
+ "Sample Formatted error", "Sample System Error" });
+
+ // Style
+ String currentStyle = ((Component) objectToConfigure).getStyle();
+ if (currentStyle == null)
+ set.replaceWithSelect("style", new Object[] { null },
+ new Object[] { "Default" }).setNewItemsAllowed(true);
+ else
+ set.replaceWithSelect("style", new Object[] { null, currentStyle },
+ new Object[] { "Default", currentStyle })
+ .setNewItemsAllowed(true);
+
+ // Set up descriptions
+ set
+ .getField("caption")
+ .setDescription(
+ "Component caption is the title of the component. Usage of the caption is optional and the "
+ + "exact behavior of the propery is defined by the component. Setting caption null "
+ + "or empty disables the caption.");
+ set
+ .getField("enabled")
+ .setDescription(
+ "Enabled property controls the usage of the component. If the component is disabled (enabled=false),"
+ + " it can not receive any events from the terminal. In most cases it makes the usage"
+ + " of the component easier, if the component visually looks disbled (for example is grayed), "
+ + "when it can not be used.");
+ set
+ .getField("icon")
+ .setDescription(
+ "Icon of the component selects the main icon of the component. The usage of the icon is identical "
+ + "to caption and in most components caption and icon are kept together. Icons can be "
+ + "loaded from any resources (see Terminal/Resources for more information). Some components "
+ + "contain more than just the captions icon. Those icons are controlled through their "
+ + "own properties.");
+ set
+ .getField("visible")
+ .setDescription(
+ "Visibility property says if the component is renreded or not. Invisible components are implicitly "
+ + "disabled, as there is no visible user interface to send event.");
+ set
+ .getField("description")
+ .setDescription(
+ "Description is designed to allow easy addition of short tooltips, like this. Like the caption,"
+ + " setting description null or empty disables the description.");
+ set
+ .getField("readOnly")
+ .setDescription(
+ "Those components that have internal state that can be written are settable to readOnly-mode,"
+ + " where the object can only be read, not written.");
+ set
+ .getField("componentError")
+ .setDescription(
+ "IT Mill Toolkit supports extensive error reporting. One part of the error reporting are component"
+ + " errors that can be controlled by the programmer. This example only contains couple of "
+ + "sample errors; to get the full picture, read browse ErrorMessage-interface implementors "
+ + "API documentation.");
+ set
+ .getField("immediate")
+ .setDescription(
+ "Not all terminals can send the events immediately to server from all action. Web is the most "
+ + "typical environment where many events (like textfield changed) are not sent to server, "
+ + "before they are explicitly submitted. Setting immediate property true (by default this "
+ + "is false for most components), the programmer can assure that the application is"
+ + " notified as soon as possible about the value change in this component.");
+ set
+ .getField("style")
+ .setDescription(
+ "Themes specify the overall looks of the user interface. In addition component can have a set of "
+ + "styles, that can be visually very different (like datefield calendar- and text-styles), "
+ + "but contain the same logical functionality. As a rule of thumb, theme specifies if a "
+ + "component is blue or yellow and style determines how the component is used.");
+
+ // Add created fields to property panel
+ addProperties("Component Basics", set);
+
+ // Customization for Window component
+ if (objectToConfigure instanceof Window) {
+ disableField(set.getField("enabled"), new Boolean(true));
+ disableField(set.getField("visible"), new Boolean(true));
+ disableField(set.getField("componentError"));
+ disableField(set.getField("icon"));
+ }
+ }
+
+ /** Add properties for selecting */
+ private void addSelectProperties() {
+ Form set = createBeanPropertySet(new String[] { "newItemsAllowed",
+ "lazyLoading", "multiSelect" });
+ addProperties("Select Properties", set);
+
+ set.getField("multiSelect").setDescription(
+ "Specified if multiple items can be selected at once.");
+ set
+ .getField("newItemsAllowed")
+ .setDescription(
+ "Select component (but not Tree or Table) can allow the user to directly "
+ + "add new items to set of options. The new items are constrained to be "
+ + "strings and thus feature only applies to simple lists.");
+ Button ll = (Button) set.getField("lazyLoading");
+ ll
+ .setDescription("In Ajax rendering mode select supports lazy loading and filtering of options.");
+ ll.addListener((ValueChangeListener) this);
+ ll.setImmediate(true);
+ if (((Boolean) ll.getValue()).booleanValue()) {
+ set.getField("multiSelect").setVisible(false);
+ set.getField("newItemsAllowed").setVisible(false);
+ }
+ if (objectToConfigure instanceof Tree
+ || objectToConfigure instanceof Table) {
+ set.removeItemProperty("newItemsAllowed");
+ set.removeItemProperty("lazyLoading");
+ }
+ }
+
+ /** Field special properties */
+ private void addFieldProperties() {
+ // TODO bug #211 states that setFocus works only for Button and
+ // Textfield UI components
+ Form set = new Form(new GridLayout(COLUMNS, 1));
+ set.addField("focus", new Button("Focus", objectToConfigure, "focus"));
+ set.getField("focus").setDescription(
+ "Focus the cursor to this field. Not all "
+ + "components and/or terminals support this feature.");
+ addProperties("Field Features", set);
+ }
+
+ /**
+ * Add and remove some miscellaneous example component to/from component
+ * container
+ */
+ private void addComponentContainerProperties() {
+ Form set = new Form(new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL));
+
+ addComponent = new Select();
+ addComponent.setImmediate(true);
+ addComponent.addItem("Add component to container");
+ addComponent.setNullSelectionItemId("Add component to container");
+ addComponent.addItem("Text field");
+ addComponent.addItem("Option group");
+ addComponent.addListener(this);
+
+ set.addField("component adder", addComponent);
+ set.addField("remove all components", new Button(
+ "Remove all components", objectToConfigure,
+ "removeAllComponents"));
+
+ addProperties("ComponentContainer Features", set);
+ }
+
+ /** Value change listener for listening selections */
+ public void valueChange(Property.ValueChangeEvent event) {
+
+ // FIXME: navigation statistics
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "valueChange "
+ + ((AbstractComponent) event.getProperty())
+ .getTag() + ", " + event.getProperty());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+
+ // Adding components to component container
+ if (event.getProperty() == addComponent) {
+ String value = (String) addComponent.getValue();
+
+ if (value != null) {
+ // TextField component
+ if (value.equals("Text field"))
+ ((AbstractComponentContainer) objectToConfigure)
+ .addComponent(new TextField("Test field"));
+
+ // DateField time style
+ 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");
+ ((AbstractComponentContainer) objectToConfigure)
+ .addComponent(d);
+ }
+
+ // Date field calendar style
+ 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);
+ ((AbstractComponentContainer) objectToConfigure)
+ .addComponent(c);
+ }
+
+ // Select option group style
+ 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");
+
+ ((AbstractComponentContainer) objectToConfigure)
+ .addComponent(s);
+ }
+
+ addComponent.setValue(null);
+ }
+ } else if (event.getProperty() == getField("lazyLoading")) {
+ boolean newValue = ((Boolean) event.getProperty().getValue())
+ .booleanValue();
+ Field multiselect = getField("multiSelect");
+ Field newitems = getField("newItemsAllowed");
+ if (newValue) {
+ newitems.setValue(Boolean.FALSE);
+ newitems.setVisible(false);
+ multiselect.setValue(Boolean.FALSE);
+ multiselect.setVisible(false);
+ } else {
+ newitems.setVisible(true);
+ multiselect.setVisible(true);
+ }
+ }
+ }
+
+ /** Handle all button clicks for this panel */
+ public void buttonClick(Button.ClickEvent event) {
+ // FIXME: navigation statistics
+ try {
+ FeatureUtil.debug(getApplication().getUser().toString(),
+ "buttonClick " + event.getButton().getTag() + ", "
+ + event.getButton().getCaption() + ", "
+ + event.getButton().getValue());
+ } catch (Exception e) {
+ // ignored, should never happen
+ }
+ // Commit all changed on all forms
+ if (event.getButton() == setButton) {
+ commit();
+ }
+
+ // Discard all changed on all forms
+ if (event.getButton() == discardButton) {
+ for (Iterator i = forms.iterator(); i.hasNext();)
+ ((Form) i.next()).discard();
+ }
+
+ }
+
+ /**
+ * Helper function for creating forms from array of propety names.
+ */
+ protected Form createBeanPropertySet(String names[]) {
+
+ Form set = new Form(new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL));
+
+ for (int i = 0; i < names.length; i++) {
+ Property p = config.getItemProperty(names[i]);
+ if (p != null) {
+ set.addItemProperty(names[i], p);
+ Field f = set.getField(names[i]);
+ if (f instanceof TextField) {
+ if (Integer.class.equals(p.getType()))
+ ((TextField) f).setColumns(4);
+ else {
+ ((TextField) f).setNullSettingAllowed(true);
+ ((TextField) f).setColumns(24);
+ }
+ }
+ }
+ }
+
+ return set;
+ }
+
+ /** Find a field from all forms */
+ public Field getField(Object propertyId) {
+ for (Iterator i = forms.iterator(); i.hasNext();) {
+ Form f = (Form) i.next();
+ Field af = f.getField(propertyId);
+ if (af != null)
+ return af;
+ }
+ return null;
+ }
+
+ public Table getAllProperties() {
+ return allProperties;
+ }
+
+ protected void commit() {
+ for (Iterator i = forms.iterator(); i.hasNext();)
+ ((Form) i.next()).commit();
+ }
+
+ private void disableField(Field field) {
+ field.setEnabled(false);
+ field.setReadOnly(true);
+ }
+
+ private void disableField(Field field, Object value) {
+ field.setValue(value);
+ disableField(field);
+ }
+
+}
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/components.png b/src/com/itmill/toolkit/tests/featurebrowser/components.png
new file mode 100644
index 0000000000..e5681d4d37
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/components.png
Binary files differ
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/icon_demo.png b/src/com/itmill/toolkit/tests/featurebrowser/icon_demo.png
new file mode 100644
index 0000000000..6a5c295d6a
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/icon_demo.png
Binary files differ
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/icon_intro.png b/src/com/itmill/toolkit/tests/featurebrowser/icon_intro.png
new file mode 100644
index 0000000000..032712985c
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/icon_intro.png
Binary files differ
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/itmill.gif b/src/com/itmill/toolkit/tests/featurebrowser/itmill.gif
new file mode 100644
index 0000000000..b1c3e053f0
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/itmill.gif
Binary files differ
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/itmill_spin.swf b/src/com/itmill/toolkit/tests/featurebrowser/itmill_spin.swf
new file mode 100644
index 0000000000..9e58ce29c6
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/itmill_spin.swf
Binary files differ
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/m-bullet-blue.gif b/src/com/itmill/toolkit/tests/featurebrowser/m-bullet-blue.gif
new file mode 100644
index 0000000000..fa6b38b4c9
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/m-bullet-blue.gif
Binary files differ
diff --git a/src/com/itmill/toolkit/tests/featurebrowser/m.gif b/src/com/itmill/toolkit/tests/featurebrowser/m.gif
new file mode 100644
index 0000000000..2201bdfc1c
--- /dev/null
+++ b/src/com/itmill/toolkit/tests/featurebrowser/m.gif
Binary files differ