From: Jani Laakso 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. 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. 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." + title + "
" + desc,
+ gl.addComponent(new Embedded("", new ClassResource(getImage(),
+ this.getApplication())));
+ gl.addComponent(new Label("" + title + "
" + desc,
Label.CONTENT_XHTML));
ts.addTab(gl, "Description", null);
}
- // Demo
- Component demo = getDemoComponent();
- if (demo != null)
- ts.addTab(demo, "Demo", null);
-
- // Example source
+ // Code Sample
String example = getExampleSrc();
if (example != null) {
OrderedLayout l = new OrderedLayout();
- l.addComponent(
- new Label(
- "" + getTitle() + " example
",
+ l.addComponent(new Label("" + getTitle() + " example
",
Label.CONTENT_XHTML));
l.addComponent(new Label(example, Label.CONTENT_PREFORMATTED));
ts.addTab(l, "Code Sample", null);
}
+
+ // Javadoc
+ Label javadocPlaceholder = new Label(
+ "This is a placeholder for Javadoc");
+ ts.addTab(javadocPlaceholder, "Javadoc", null);
+
+ // Properties tab
+ // if (properties != null)
+ // ts.addTab(properties, "Properties", null);
}
/** Get the desctiption of the feature as XHTML fragment */
@@ -110,13 +124,18 @@ public class Feature extends CustomComponent {
/** Get the feature demo component */
protected Component getDemoComponent() {
- return null;
+ return null;
}
-
+
/** Get sample icon resource */
protected Resource getSampleIcon() {
- if (sampleIcon == null) sampleIcon = new ClassResource("m.gif",this.getApplication());
- return sampleIcon;
+ if (sampleIcon == null)
+ sampleIcon = new ClassResource("m.gif", this.getApplication());
+ return sampleIcon;
+ }
+
+ public PropertyPanel getPropertyPanel() {
+ return propertyPanel;
}
}
\ No newline at end of file
diff --git a/src/com/itmill/toolkit/demo/features/FeatureBrowser.java b/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
index bc65afe654..c267bfb596 100644
--- a/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
+++ b/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
@@ -1,55 +1,60 @@
/* *************************************************************************
- IT Mill Toolkit
+ IT Mill Toolkit
- Development of Browser User Interfaces Made Easy
+ Development of Browser User Interfaces Made Easy
- Copyright (C) 2000-2006 IT Mill Ltd
-
- *************************************************************************
+ 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
+ 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
+ *************************************************************************
+
+ For more information, contact:
+
+ IT Mill Ltd phone: +358 2 4802 7180
+ Ruukinkatu 2-4 fax: +358 2 4802 7181
+ 20540, Turku email: info@itmill.com
+ Finland company www: www.itmill.com
+
+ Primary source for information and releases: www.itmill.com
- ********************************************************************** */
+ ********************************************************************** */
package com.itmill.toolkit.demo.features;
import java.util.Iterator;
import java.util.StringTokenizer;
-import quicktime.streaming.SettingsDialog;
-
import com.itmill.toolkit.data.*;
import com.itmill.toolkit.terminal.ClassResource;
import com.itmill.toolkit.ui.*;
-public class FeatureBrowser
- extends CustomComponent
- implements Property.ValueChangeListener {
+public class FeatureBrowser extends CustomComponent implements
+ Property.ValueChangeListener {
private Tree features;
+
private Feature currentFeature = null;
- private GridLayout layout;
+
+ private OrderedLayout layout;
+
+ private OrderedLayout right;
+
+ private PropertyPanel properties;
+
private Component welcome;
+
private boolean initialized = false;
+
private Select themeSelector = new Select("Theme");
- private static final String WELCOME_TEXT =
- "Welcome to the IT Mill Toolkit feature tour!
"
+ private static final String WELCOME_TEXT = "Welcome to the IT Mill Toolkit feature tour!
"
+ "In this application you may view and play with some features of IT Mill Toolkit.
"
+ "Most of the features can be tested online and include simple example of their "
+ "usage associated with it.
"
@@ -73,23 +78,26 @@ public class FeatureBrowser
features.setImmediate(true);
// Configure component layout
- layout = new GridLayout(2, 1);
+ layout = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
setCompositionRoot(layout);
- OrderedLayout left = new OrderedLayout();
+ OrderedLayout left = new OrderedLayout(
+ OrderedLayout.ORIENTATION_VERTICAL);
left.addComponent(features);
- layout.addComponent(left, 0, 0, 0, 0);
- Label greeting = new Label(WELCOME_TEXT, Label.CONTENT_XHTML);
- OrderedLayout welcomePanel = new OrderedLayout();
- welcome =
- new Embedded(
- "",
- new ClassResource(
- getClass(),
- "itmill.gif",
- getApplication()));
- welcomePanel.addComponent(welcome);
- welcomePanel.addComponent(greeting);
- layout.addComponent(welcomePanel, 1, 0, 1, 0);
+ layout.addComponent(left);
+
+ // Welcome temporarily disabled
+ // Label greeting = new Label(WELCOME_TEXT, Label.CONTENT_XHTML);
+ // OrderedLayout welcomePanel = new OrderedLayout();
+ // welcome =
+ // new Embedded(
+ // "",
+ // new ClassResource(
+ // getClass(),
+ // "itmill.gif",
+ // getApplication()));
+ // welcomePanel.addComponent(welcome);
+ // welcomePanel.addComponent(greeting);
+ // layout.addComponent(welcomePanel);
// Theme selector
left.addComponent(themeSelector);
@@ -98,70 +106,68 @@ public class FeatureBrowser
themeSelector.addListener(this);
themeSelector.select("corporate");
themeSelector.setImmediate(true);
-
+
// Restart button
Button close = new Button("restart", getApplication(), "close");
left.addComponent(close);
close.setStyle("link");
// Test component
- registerFeature(
- "/UI Components",
- new UIComponents());
- registerFeature(
- "/UI Components/Basic/Text Field",
- new FeatureTextField());
- registerFeature(
- "/UI Components/Basic/Date Field",
- new FeatureDateField());
+ registerFeature("/UI Components", new UIComponents());
+ 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/Select",
- new FeatureSelect());
- registerFeature(
- "/UI Components/Item Containers/Table",
- new FeatureTable());
- registerFeature(
- "/UI Components/Item Containers/Tree",
- new FeatureTree());
- 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/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/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/Tab Sheet",
+ new FeatureTabSheet());
registerFeature("/UI Components/Layouts/Window", new FeatureWindow());
- registerFeature(
- "/UI Components/Layouts/Frame Window",
- new FeatureFrameWindow());
- registerFeature(
- "/UI Components/Data handling/Embedded Objects",
- new FeatureEmbedded());
- registerFeature(
- "/UI Components/Data handling/Upload",
- new FeatureUpload());
+ registerFeature("/UI Components/Layouts/Frame Window",
+ new FeatureFrameWindow());
+ registerFeature("/UI Components/Data handling/Embedded Objects",
+ new FeatureEmbedded());
+ registerFeature("/UI Components/Data handling/Upload",
+ new FeatureUpload());
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/Parameters and URI Handling",
- new FeatureParameters());
+ registerFeature("/Terminal/Parameters and URI Handling",
+ new FeatureParameters());
// Pre-open all menus
- for (Iterator i=features.getItemIds().iterator(); i.hasNext();)
+ for (Iterator i = features.getItemIds().iterator(); i.hasNext();)
features.expandItem(i.next());
+
+ // Add demo component and tabs
+ currentFeature = new FeatureButton();
+ layout.addComponent(currentFeature);
+
+ // Add properties
+ right = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
+ layout.addComponent(right);
+
+ Select propertiesSelect = new Select("Show properties");
+ right.addComponent(propertiesSelect);
+ properties = currentFeature.getPropertyPanel();
+ right.addComponent(properties);
}
public void registerFeature(String path, Feature feature) {
@@ -197,14 +203,17 @@ public class FeatureBrowser
Property p = features.getContainerProperty(id, "feature");
Feature feature = p != null ? ((Feature) p.getValue()) : null;
if (feature != null) {
- if (currentFeature != null)
- layout.removeComponent(currentFeature);
+ layout.replaceComponent(currentFeature, feature);
currentFeature = feature;
- layout.removeComponent(1, 0);
- layout.addComponent(currentFeature, 1, 0);
- getWindow().setCaption(
- "IT Mill Toolkit Features / "
- + features.getContainerProperty(id, "name"));
+ right.replaceComponent(properties, feature
+ .getPropertyPanel());
+ properties = feature.getPropertyPanel();
+
+ getWindow()
+ .setCaption(
+ "IT Mill Toolkit Features / "
+ + features.getContainerProperty(id,
+ "name"));
}
}
} else if (event.getProperty() == themeSelector) {
diff --git a/src/com/itmill/toolkit/demo/features/FeatureButton.java b/src/com/itmill/toolkit/demo/features/FeatureButton.java
index bacef57be4..7b7514af1a 100644
--- a/src/com/itmill/toolkit/demo/features/FeatureButton.java
+++ b/src/com/itmill/toolkit/demo/features/FeatureButton.java
@@ -1,30 +1,30 @@
/* *************************************************************************
- IT Mill Toolkit
+ IT Mill Toolkit
- Development of Browser User Interfaces Made Easy
+ Development of Browser User Interfaces Made Easy
- Copyright (C) 2000-2006 IT Mill Ltd
-
- *************************************************************************
+ 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
+ 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
+ *************************************************************************
+
+ For more information, contact:
+
+ IT Mill Ltd phone: +358 2 4802 7180
+ Ruukinkatu 2-4 fax: +358 2 4802 7181
+ 20540, Turku email: info@itmill.com
+ Finland company www: www.itmill.com
+
+ Primary source for information and releases: www.itmill.com
- ********************************************************************** */
+ ********************************************************************** */
package com.itmill.toolkit.demo.features;
@@ -47,15 +47,13 @@ public class FeatureButton extends Feature {
l.addComponent(show);
// Properties
- PropertyPanel p = new PropertyPanel(b);
- Select themes = (Select) p.getField("style");
- themes
- .addItem("link")
- .getItemProperty(themes.getItemCaptionPropertyId())
- .setValue("link");
- Form ap = p.createBeanPropertySet(new String[] { "switchMode" });
- p.addProperties("Button Properties", ap);
- l.addComponent(p);
+ 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);
return l;
}
@@ -70,13 +68,13 @@ public class FeatureButton extends Feature {
*/
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)
"
- + "Button can be directly connected to any method of an object, which "
- + "is an easy way to trigger events: new Button(\"Play\", myPiano \"playIt\")
. "
- + "Or in checkbox-mode they can be bound to a boolean proterties and create "
- + " simple selectors.
"
- + "See the demo and try out how the different properties affect "
- + "the presentation of the component.";
+ + "Buttons may function either as a push buttons or switches. (checkboxes)
"
+ + "Button can be directly connected to any method of an object, which "
+ + "is an easy way to trigger events: new Button(\"Play\", myPiano \"playIt\")
. "
+ + "Or in checkbox-mode they can be bound to a boolean proterties and create "
+ + " simple selectors.
"
+ + "See the demo and try out how the different properties affect "
+ + "the presentation of the component.";
}
protected String getImage() {
diff --git a/src/com/itmill/toolkit/demo/features/FeatureContainers.java b/src/com/itmill/toolkit/demo/features/FeatureContainers.java
index 04c8d7e0c3..255c5e06c4 100644
--- a/src/com/itmill/toolkit/demo/features/FeatureContainers.java
+++ b/src/com/itmill/toolkit/demo/features/FeatureContainers.java
@@ -1,30 +1,30 @@
/* *************************************************************************
- IT Mill Toolkit
+ IT Mill Toolkit
- Development of Browser User Interfaces Made Easy
+ Development of Browser User Interfaces Made Easy
- Copyright (C) 2000-2006 IT Mill Ltd
-
- *************************************************************************
+ 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
+ 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
+ *************************************************************************
+
+ For more information, contact:
+
+ IT Mill Ltd phone: +358 2 4802 7180
+ Ruukinkatu 2-4 fax: +358 2 4802 7181
+ 20540, Turku email: info@itmill.com
+ Finland company www: www.itmill.com
+
+ Primary source for information and releases: www.itmill.com
- ********************************************************************** */
+ ********************************************************************** */
package com.itmill.toolkit.demo.features;
@@ -36,26 +36,26 @@ public class FeatureContainers extends Feature {
protected String getDescriptionXHTML() {
return "
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.
" + + "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.
"; } protected String getImage() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureCustomLayout.java b/src/com/itmill/toolkit/demo/features/FeatureCustomLayout.java index 80364abc9c..4e182e2577 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureCustomLayout.java +++ b/src/com/itmill/toolkit/demo/features/FeatureCustomLayout.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -38,23 +38,23 @@ public class FeatureCustomLayout extends Feature { protected String getDescriptionXHTML() { return "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.
" - + "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 as XLS-template with for given style.
" - + "The default theme handles the styles that are not defined by just drawing " - + "the subcomponents with flowlayout.
"; + + "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." + + "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 as XLS-template with for given style.
" + + "The default theme handles the styles that are not defined by just drawing " + + "the subcomponents with flowlayout.
"; } protected String getExampleSrc() { return "CustomLayout c = new CustomLayout(\"style-name\");\n" - + "c.addComponent(new Label(\"foo\"),\"foo-location\");\n" - + "c.addComponent(new Label(\"bar\"),\"bar-location\");\n"; + + "c.addComponent(new Label(\"foo\"),\"foo-location\");\n" + + "c.addComponent(new Label(\"bar\"),\"bar-location\");\n"; } protected String getImage() { @@ -68,13 +68,13 @@ public class FeatureCustomLayout extends Feature { protected Component getDemoComponent() { OrderedLayout l = new OrderedLayout(); - l.addComponent( - new Label( - "For demonstration, see GO-Game example application. All of the "+ - "layouting done in the aplication is handled by CustomLayout with \"goroom\"-style "+ - "that is defined in \"gogame\"-theme. The theme is simply created by exteding "+ - "default theme trough theme-inheritance and adding couple of xsl-templates
", - Label.CONTENT_UIDL)); + l + .addComponent(new Label( + "For demonstration, see GO-Game example application. All of the " + + "layouting done in the aplication is handled by CustomLayout with \"goroom\"-style " + + "that is defined in \"gogame\"-theme. The theme is simply created by exteding " + + "default theme trough theme-inheritance and adding couple of xsl-templates
", + Label.CONTENT_UIDL)); URL goUrl = null; try { diff --git a/src/com/itmill/toolkit/demo/features/FeatureDateField.java b/src/com/itmill/toolkit/demo/features/FeatureDateField.java index 17aab1685f..f1c0f74ff6 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureDateField.java +++ b/src/com/itmill/toolkit/demo/features/FeatureDateField.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -42,8 +42,8 @@ public class FeatureDateField extends Feature { localeContainer.addContainerProperty("name", String.class, ""); Locale[] locales = Locale.getAvailableLocales(); for (int i = 0; i < locales.length; i++) - localeContainer.addItem(locales[i]).getItemProperty("name").setValue( - locales[i].getDisplayName()); + localeContainer.addItem(locales[i]).getItemProperty("name") + .setValue(locales[i].getDisplayName()); } public FeatureDateField() { @@ -62,71 +62,59 @@ public class FeatureDateField extends Feature { l.addComponent(show); // Create locale selector - /* Hide locale selector, until this bug #244 - Select selector = new Select("Application Locale",localeContainer); - selector.setItemCaptionPropertyId("name"); - selector.setImmediate(true); - selector.setPropertyDataSource( - new MethodProperty(this.getApplication(), "locale")); - l.addComponent(selector); - */ - + /* + * Hide locale selector, until this bug #244 Select selector = new + * Select("Application Locale",localeContainer); + * selector.setItemCaptionPropertyId("name"); + * selector.setImmediate(true); selector.setPropertyDataSource( new + * MethodProperty(this.getApplication(), "locale")); + * l.addComponent(selector); + */ + // Properties PropertyPanel p = new PropertyPanel(df); Form ap = p.createBeanPropertySet(new String[] { "resolution" }); - ap.replaceWithSelect( - "resolution", - new Object[] { + 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", + new Integer(DateField.RESOLUTION_MSEC) }, new Object[] { + "Year", "Month", "Day", "Hour", "Minute", "Second", "Millisecond" }); - ap.getField("resolution").setValue(new Integer(DateField.RESOLUTION_DAY)); + ap.getField("resolution").setValue( + new Integer(DateField.RESOLUTION_DAY)); Select themes = (Select) p.getField("style"); - themes - .addItem("text") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("text"); - themes - .addItem("calendar") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("calendar"); + themes.addItem("text").getItemProperty( + themes.getItemCaptionPropertyId()).setValue("text"); + themes.addItem("calendar").getItemProperty( + themes.getItemCaptionPropertyId()).setValue("calendar"); df.setStyle("calendar"); p.addProperties("DateField Properties", ap); - l.addComponent(p); return l; } protected String getExampleSrc() { return "DateField df = new DateField(\"Caption\");\n" - + "df.setValue(new java.util.Date());\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 userinterfaces. IT Mill Toolkit provides a DateField " - + "component that is intuitive to use and yet controllable through " - + "its properties.
" - + "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.
" - + "On the demo tab you can try out how the different properties affect the " - + "presentation of the component.
"; + + "or enter some specific date and/or time is an typical need in " + + "data-entry userinterfaces. IT Mill Toolkit provides a DateField " + + "component that is intuitive to use and yet controllable through " + + "its properties." + + "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.
" + + "On the demo tab you can try out how the different properties affect the " + + "presentation of the component.
"; } protected String getImage() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureEmbedded.java b/src/com/itmill/toolkit/demo/features/FeatureEmbedded.java index 31dfbba7f1..d3c5fc0bf0 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureEmbedded.java +++ b/src/com/itmill/toolkit/demo/features/FeatureEmbedded.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -57,28 +57,15 @@ public class FeatureEmbedded extends Feature { l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(emb); - Form ap = - p.createBeanPropertySet( - new String[] { - "type", - "source", - "width", - "height", - "widthUnits", - "heightUnits", - "codebase", - "codetype", - "archive", - "mimeType", - "standby", - "classId" }); - ap.replaceWithSelect( - "type", - new Object[] { + 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" }); + 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++) { @@ -87,37 +74,35 @@ public class FeatureEmbedded extends Feature { } ap.replaceWithSelect("heightUnits", units, symbols); ap.replaceWithSelect("widthUnits", units, symbols); - ap.replaceWithSelect( - "source", - new Object[] { - null, - new ClassResource("m-bullet-blue.gif", getApplication())}, - new Object[] { "null", "IT Mill (m)" }); - p.addProperties("Embedded Properties", ap); - p.getField("standby").setDescription( - "The text to display while loading the object."); - p.getField("codebase").setDescription( - "root-path used to access resources with relative paths."); - p.getField("codetype").setDescription( - "MIME-type of the code."); - p.getField("classId").setDescription( - "Unique object id. This can be used for example to identify windows components."); - l.addComponent(p); + ap.replaceWithSelect("source", new Object[] { null, + new ClassResource("m-bullet-blue.gif", getApplication()) }, + new Object[] { "null", "IT Mill (m)" }); + 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."); 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()));"; + + "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.
"; + + "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() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureForm.java b/src/com/itmill/toolkit/demo/features/FeatureForm.java index 64e792e075..d02f9a7c73 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureForm.java +++ b/src/com/itmill/toolkit/demo/features/FeatureForm.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -33,14 +33,17 @@ import java.util.Date; import com.itmill.toolkit.data.Property; import com.itmill.toolkit.ui.*; -public class FeatureForm - extends Feature - implements Property.ValueChangeListener { +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() { @@ -65,8 +68,8 @@ public class FeatureForm test = new Form(formLayout); testPanel.addComponent(test); demo.addComponent(testPanel); - OrderedLayout actions = - new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); + OrderedLayout actions = new OrderedLayout( + OrderedLayout.ORIENTATION_HORIZONTAL); demo.addComponent(actions); // form adder @@ -91,9 +94,8 @@ public class FeatureForm actions.addComponent(resetLayout); // Properties - PropertyPanel p = new PropertyPanel(test); - p.addProperties("Form special properties", new Form()); - demo.addComponent(p); + propertyPanel = new PropertyPanel(test); + propertyPanel.addProperties("Form special properties", new Form()); } public void valueChange(Property.ValueChangeEvent event) { @@ -108,8 +110,8 @@ public class FeatureForm if (value.equals("Two columns (2x1 GridLayout)")) formLayout = new GridLayout(2, 1); if (value.equals("Horizontal (OrderedLayout)")) - formLayout = - new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); + formLayout = new OrderedLayout( + OrderedLayout.ORIENTATION_HORIZONTAL); createDemo(); resetLayout.setValue(null); @@ -125,16 +127,16 @@ public class FeatureForm 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 + .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 + .setDescription("DateField-component with calendar-style and day-resolution"); c.setStyle("calendar"); c.setResolution(DateField.RESOLUTION_DAY); test.addField(new Object(), c); @@ -157,8 +159,7 @@ public class FeatureForm } protected String getDescriptionXHTML() { - return - "Form is a flexible, yet simple container for fields. " + 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, " @@ -176,9 +177,8 @@ public class FeatureForm + " BeanItem.
" + "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"; } @@ -186,5 +186,5 @@ public class FeatureForm protected String getImage() { return "form.jpg"; } - + } diff --git a/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java b/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java index 5b0e742f64..2e68ae38f2 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java +++ b/src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -34,63 +34,61 @@ import java.util.List; import com.itmill.toolkit.ui.*; import com.itmill.toolkit.ui.Button.ClickEvent; -public class FeatureFrameWindow - extends Feature - implements Button.ClickListener { +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 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())); + demoWindow.getFrameset() + .newFrame(createFrame(demoWindow.getFrameset())); // Example panel Panel show = new Panel("Test Window Control"); - ((OrderedLayout) show.getLayout()).setOrientation( - OrderedLayout.ORIENTATION_HORIZONTAL); + ((OrderedLayout) show.getLayout()) + .setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL); show.addComponent(addButton); show.addComponent(removeButton); updateWinStatus(); l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(demoWindow); - p.dependsOn(addButton); - p.dependsOn(removeButton); - Form ap = - p.createBeanPropertySet( - new String[] { "width", "height", "name", "border", "theme" }); - ap.replaceWithSelect( - "border", - new Object[] { + 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" }); + new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default", + "None", "Minimal" }); - p.addProperties("FrameWindow Properties", ap); - l.addComponent(p); + propertyPanel.addProperties("FrameWindow Properties", ap); return l; } protected String getDescriptionXHTML() { return "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.
"; + + "Each frame can contain a web-page, window or a set of frames that divides the space " + + "horizontally or vertically."; } protected String getExampleSrc() { return "FrameWindow f = new FrameWindow(\"Frame example\");\n" - + "f.getFrameset().newFrame(window);\n" - + "f.getFrameset().newFrame(resource,\"targetName\");\n"; + + "f.getFrameset().newFrame(window);\n" + + "f.getFrameset().newFrame(resource,\"targetName\");\n"; } protected String getImage() { @@ -125,10 +123,10 @@ public class FeatureFrameWindow if (event.getButton().getCaption().equals("Remove")) { Window w = event.getButton().getWindow(); - FrameWindow.Frameset fs = - (FrameWindow.Frameset) windowToFramesetMap.get(w); + FrameWindow.Frameset fs = (FrameWindow.Frameset) windowToFramesetMap + .get(w); if (fs == demoWindow.getFrameset() && fs.size() <= 1) { - // Do not remove the last frame + // Do not remove the last frame } else if (fs.size() > 1) { fs.removeFrame(fs.getFrame(w.getName())); windowToFramesetMap.remove(w); @@ -143,8 +141,8 @@ public class FeatureFrameWindow if (event.getButton().getCaption().equals("Split")) { Window w = event.getButton().getWindow(); - FrameWindow.Frameset fs = - (FrameWindow.Frameset) windowToFramesetMap.get(w); + FrameWindow.Frameset fs = (FrameWindow.Frameset) windowToFramesetMap + .get(w); int index = 0; List l = fs.getFrames(); while (index < l.size() && fs.getFrame(index).getWindow() != w) @@ -161,8 +159,8 @@ public class FeatureFrameWindow private Window createFrame(FrameWindow.Frameset fs) { Window w = new Window(); - w.addComponent( - new Label("Frame: " + (++count) + "", Label.CONTENT_UIDL)); + w.addComponent(new Label("Frame: " + (++count) + "", + Label.CONTENT_UIDL)); w.addComponent(new Button("Split", this)); w.addComponent(new Button("Remove", this)); windowToFramesetMap.put(w, fs); diff --git a/src/com/itmill/toolkit/demo/features/FeatureGridLayout.java b/src/com/itmill/toolkit/demo/features/FeatureGridLayout.java index 9513171fa1..db40c9e7bf 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureGridLayout.java +++ b/src/com/itmill/toolkit/demo/features/FeatureGridLayout.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -45,41 +45,43 @@ public class FeatureGridLayout extends Feature { // Example panel Panel show = new Panel("GridLayout component"); GridLayout gl = new GridLayout(3, 3); - DateField cal = new DateField("Test component 1",new Date()); + DateField cal = new DateField("Test component 1", new Date()); cal.setStyle("calendar"); - gl.addComponent(cal, 1,0,2,1); + gl.addComponent(cal, 1, 0, 2, 1); for (int i = 2; i < 7; i++) gl.addComponent(new TextField("Test component " + i)); show.addComponent(gl); l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(gl); - Form ap = p.createBeanPropertySet(new String[] { "width", "height" }); + 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")); - p.addProperties("GridLayout Features", ap); - p.getField("height").dependsOn(p.getField("add component")); - l.addComponent(p); + propertyPanel.addProperties("GridLayout Features", ap); + propertyPanel.getField("height").dependsOn( + propertyPanel.getField("add component")); 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"; + + "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.demo.features.Feature#getDescriptionXHTML() */ protected String getDescriptionXHTML() { return "This feature provides a container that lays out components " - + "into a grid of given width and height.
" - + "On the demo tab you can try out how the different " - + "properties affect the presentation of the component.
"; + + "into a grid of given width and height." + + "On the demo tab you can try out how the different " + + "properties affect the presentation of the component.
"; } protected String getImage() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureItems.java b/src/com/itmill/toolkit/demo/features/FeatureItems.java index f938b50853..ec97350db4 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureItems.java +++ b/src/com/itmill/toolkit/demo/features/FeatureItems.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -36,16 +36,16 @@ public class FeatureItems extends Feature { protected String getDescriptionXHTML() { return "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.
" - + "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.
"; + + "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." + + "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.
"; } protected String getImage() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureLabel.java b/src/com/itmill/toolkit/demo/features/FeatureLabel.java index a312b83340..9fb75080ba 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureLabel.java +++ b/src/com/itmill/toolkit/demo/features/FeatureLabel.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -47,25 +47,19 @@ public class FeatureLabel extends Feature { l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(lab); - Form ap = - p.createBeanPropertySet(new String[] { "contentMode", "value" }); - ap.replaceWithSelect( - "contentMode", - new Object[] { + 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)" }); - p.addProperties("Label Properties", ap); - l.addComponent(p); + 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); return l; } @@ -73,21 +67,22 @@ public class FeatureLabel extends Feature { protected String getExampleSrc() { return "Label l = new Label(\"Caption\");\n"; } + /** * @see com.itmill.toolkit.demo.features.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." - + "IT Mill Toolkti 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 singe data object " - + "that can be getted and setted. A property is always typed, but can optionally " - + "support data type conversions. Optionally properties can provide " - + "value change events for following the state changes.
" - + "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.
" - + "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.
" - + "Many of the UI components also imlement Property interface and allow " - + "setting of other components as their data-source. These UI-components " - + "include TextField, DateField, Select, Table, Button, " - + "Label and Tree.
"; + + "in the library and Property-interface is the base of that " + + "model. Property provides standardized API for a singe data object " + + "that can be getted and setted. A property is always typed, but can optionally " + + "support data type conversions. Optionally properties can provide " + + "value change events for following the state changes." + + "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.
" + + "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.
" + + "Many of the UI components also imlement Property interface and allow " + + "setting of other components as their data-source. These UI-components " + + "include TextField, DateField, Select, Table, Button, " + + "Label and Tree.
"; } /** diff --git a/src/com/itmill/toolkit/demo/features/FeatureSelect.java b/src/com/itmill/toolkit/demo/features/FeatureSelect.java index 463cb06b11..68d2aa8839 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureSelect.java +++ b/src/com/itmill/toolkit/demo/features/FeatureSelect.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -32,45 +32,16 @@ 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", + 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" }; - + + 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(); } @@ -82,52 +53,47 @@ public class FeatureSelect extends Feature { // Example panel Panel show = new Panel("Select component"); Select s = new Select("Select Person"); - for (int i=0; i<1000; i++) - s.addItem(firstnames[(int) (Math.random() * (firstnames.length-1))] + " " + - lastnames[(int) (Math.random() * (lastnames.length-1))]); + for (int i = 0; i < 1000; i++) + s + .addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))] + + " " + + lastnames[(int) (Math.random() * (lastnames.length - 1))]); show.addComponent(s); l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(s); - Select themes = (Select) p.getField("style"); - themes - .addItem("optiongroup") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("optiongroup"); - themes - .addItem("twincol") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("twincol"); - l.addComponent(p); - + 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"); + 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"; + 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.demo.features.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." - + "The Table component is designed for displaying large volumes of tabular data, " - + "in multiple pages whenever needed.
" - + "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.
"
- + "Table may be connected to any datasource implementing the Container
interface."
- + "This way data found in external datasources can be directly presented in the table component."
- + "
" - + "Table implements a number of features and you can test most of them in the table demo tab.
"; + + "in multiple pages whenever needed. " + + "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.
"
+ + "Table may be connected to any datasource implementing the Container
interface."
+ + "This way data found in external datasources can be directly presented in the table component."
+ + "
" + + "Table implements a number of features and you can test most of them in the table demo tab.
"; } protected String getImage() { @@ -219,7 +180,9 @@ public class FeatureTable extends Feature implements Action.Handler { } 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 }; @@ -229,12 +192,8 @@ public class FeatureTable extends Feature implements Action.Handler { } public void handleAction(Action action, Object sender, Object target) { - t.setDescription( - "Last action clicked was '" - + action.getCaption() - + "' on item '" - + t.getItem(target).toString() - + "'"); + t.setDescription("Last action clicked was '" + action.getCaption() + + "' on item '" + t.getItem(target).toString() + "'"); } } diff --git a/src/com/itmill/toolkit/demo/features/FeatureTextField.java b/src/com/itmill/toolkit/demo/features/FeatureTextField.java index 00aebc99e3..a92b155a62 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureTextField.java +++ b/src/com/itmill/toolkit/demo/features/FeatureTextField.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -38,7 +38,8 @@ public class FeatureTextField extends Feature { protected Component getDemoComponent() { - OrderedLayout l = new OrderedLayout(); + OrderedLayout l = new OrderedLayout( + OrderedLayout.ORIENTATION_HORIZONTAL); // Test component TextField tf = new TextField("Caption"); @@ -47,43 +48,35 @@ public class FeatureTextField extends Feature { l.addComponent(test); // Properties - PropertyPanel p = new PropertyPanel(tf); - l.addComponent(p); - Form f = - p.createBeanPropertySet( - new String[] { - "columns", - "rows", - "wordwrap", - "writeThrough", - "readThrough", - "nullRepresentation", - "nullSettingAllowed", - "secret" }); - p.addProperties("Text field properties", f); + propertyPanel = new PropertyPanel(tf); + Form f = propertyPanel.createBeanPropertySet(new String[] { "columns", + "rows", "wordwrap", "writeThrough", "readThrough", + "nullRepresentation", "nullSettingAllowed", "secret" }); + propertyPanel.addProperties("Text field properties", f); return l; } protected String getExampleSrc() { return "TextField tf = new TextField(\"Caption\");\n" - + "tf.setValue(\"Contents\");"; + + "tf.setValue(\"Contents\");"; } + /** * @see com.itmill.toolkit.demo.features.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.
" - + "Furthermore a validators may be bound to the component to " - + "check and validate the given input before it is actually commited." - + "
" - + "On the demo tab you can try out how the different properties affect the " - + "presentation of the component.
"; + + "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." + + "Furthermore a validators may be bound to the component to " + + "check and validate the given input before it is actually commited." + + "
" + + "On the demo tab you can try out how the different properties affect the " + + "presentation of the component.
"; } protected String getImage() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureTree.java b/src/com/itmill/toolkit/demo/features/FeatureTree.java index 6ff609e715..4269b45a1d 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureTree.java +++ b/src/com/itmill/toolkit/demo/features/FeatureTree.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -35,35 +35,19 @@ 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", + 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"); + + private Button actionHandlerSwitch = new Button("Activate actions", this, + "toggleActions"); public FeatureTree() { super(); @@ -82,17 +66,17 @@ public class FeatureTree extends Feature implements Action.Handler { } public void expandAll() { - for (Iterator i = t.rootItemIds().iterator();i.hasNext();) { + for (Iterator i = t.rootItemIds().iterator(); i.hasNext();) { t.expandItemsRecursively(i.next()); } } - + public void collapseAll() { - for (Iterator i = t.rootItemIds().iterator();i.hasNext();) { + for (Iterator i = t.rootItemIds().iterator(); i.hasNext();) { t.collapseItemsRecursively(i.next()); - } + } } - + protected Component getDemoComponent() { OrderedLayout l = new OrderedLayout(); @@ -101,8 +85,7 @@ public class FeatureTree extends Feature implements Action.Handler { Panel show = new Panel("Tree component"); String[] names = new String[100]; for (int i = 0; i < names.length; i++) - names[i] = - firstnames[(int) (Math.random() * (firstnames.length - 1))] + names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))] + " " + lastnames[(int) (Math.random() * (lastnames.length - 1))]; @@ -125,56 +108,54 @@ public class FeatureTree extends Feature implements Action.Handler { // 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")); + + // Expand and Collapse buttons + l.addComponent(new Button("Expand All", this, "expandAll")); + l.addComponent(new Button("Collapse All", this, "collapseAll")); // Properties - PropertyPanel p = new PropertyPanel(t); - Form ap = p.createBeanPropertySet(new String[] { "selectable" }); - Select themes = (Select) p.getField("style"); - themes - .addItem("menu") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("menu"); - p.addProperties("Tree Properties", ap); - l.addComponent(p); + 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); return l; } protected String getExampleSrc() { return "// Create tree\n" - + "t = new Tree(\"Family Tree\");\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"; + + "t = new Tree(\"Family Tree\");\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... family trees. IT Mill Toolkit features a versatile " - + "and powerful Tree component that works much like the tree components " - + "of most modern operating systems.
" - + "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.
" - + "The tree component uses Container
"
- + "datasources much like the Table component, "
- + "with the addition that it also utilizes the hierarchy "
- + "information maintained by the container.
On " - + "the demo tab you can try out how the different properties " - + "affect the presentation of the tree component.
"; + + " hierarchical relationships, such as filesystems, message " + + "threads or... family trees. IT Mill Toolkit features a versatile " + + "and powerful Tree component that works much like the tree components " + + "of most modern operating systems. " + + "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.
" + + "The tree component uses Container
"
+ + "datasources much like the Table component, "
+ + "with the addition that it also utilizes the hierarchy "
+ + "information maintained by the container.
On " + + "the demo tab you can try out how the different properties " + + "affect the presentation of the tree component.
"; } protected String getImage() { @@ -186,7 +167,9 @@ public class FeatureTree extends Feature implements Action.Handler { } 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 }; @@ -196,11 +179,7 @@ public class FeatureTree extends Feature implements Action.Handler { } public void handleAction(Action action, Object sender, Object target) { - t.setDescription( - "Last action clicked was '" - + action.getCaption() - + "' on item '" - + target - + "'"); + t.setDescription("Last action clicked was '" + action.getCaption() + + "' on item '" + target + "'"); } } diff --git a/src/com/itmill/toolkit/demo/features/FeatureUpload.java b/src/com/itmill/toolkit/demo/features/FeatureUpload.java index 544921fa59..e27e550737 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureUpload.java +++ b/src/com/itmill/toolkit/demo/features/FeatureUpload.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -42,9 +42,7 @@ 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 { +public class FeatureUpload extends Feature implements Upload.FinishedListener { Buffer buffer = new Buffer(); @@ -70,29 +68,26 @@ public class FeatureUpload l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(up); - l.addComponent(p); + propertyPanel = new PropertyPanel(up); - return l; + 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" - + " }"; + + "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 example-tab on the other hand stores the file to disk and binds the link to that file.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.
"+ - "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.
"; + return "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.
" + + "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.
"; } protected String getImage() { diff --git a/src/com/itmill/toolkit/demo/features/FeatureWindow.java b/src/com/itmill/toolkit/demo/features/FeatureWindow.java index 015e760669..d06e099b0b 100644 --- a/src/com/itmill/toolkit/demo/features/FeatureWindow.java +++ b/src/com/itmill/toolkit/demo/features/FeatureWindow.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -32,8 +32,11 @@ import com.itmill.toolkit.ui.*; public class FeatureWindow extends Feature { Button addButton = new Button("Add to application", this, "addWin"); + Button removeButton = new Button("Remove from application", this, "delWin"); + Window demoWindow; + Form windowProperties; public FeatureWindow() { @@ -47,53 +50,42 @@ public class FeatureWindow extends Feature { // Example panel Panel show = new Panel("Test Window Control"); - ((OrderedLayout) show.getLayout()).setOrientation( - OrderedLayout.ORIENTATION_HORIZONTAL); + ((OrderedLayout) show.getLayout()) + .setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL); show.addComponent(addButton); show.addComponent(removeButton); updateWinStatus(); l.addComponent(show); // Properties - PropertyPanel p = new PropertyPanel(demoWindow); - p.dependsOn(addButton); - p.dependsOn(removeButton); - windowProperties = - p.createBeanPropertySet( - new String[] { - "width", - "height", - "name", - "border", - "theme", - "scrollable", - "scrollOffsetX", - "scrollOffsetY" }); - windowProperties.replaceWithSelect( - "border", - new Object[] { + propertyPanel = new PropertyPanel(demoWindow); + propertyPanel.dependsOn(addButton); + propertyPanel.dependsOn(removeButton); + windowProperties = propertyPanel.createBeanPropertySet(new String[] { + "width", "height", "name", "border", "theme", "scrollable", + "scrollOffsetX", "scrollOffsetY" }); + 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" }); - p.addProperties("Window Properties", windowProperties); - l.addComponent(p); + new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default", + "None", "Minimal" }); + propertyPanel.addProperties("Window Properties", windowProperties); return l; } protected String getExampleSrc() { return "Window win = new Window();\n" - + "getApplication().addWindow(win);\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."; + + "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() { diff --git a/src/com/itmill/toolkit/demo/features/FeaturesApplication.java b/src/com/itmill/toolkit/demo/features/FeaturesApplication.java index 1e477b2c5a..4157ede80f 100644 --- a/src/com/itmill/toolkit/demo/features/FeaturesApplication.java +++ b/src/com/itmill/toolkit/demo/features/FeaturesApplication.java @@ -1,37 +1,36 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; import com.itmill.toolkit.ui.*; -public class FeaturesApplication - extends com.itmill.toolkit.Application { +public class FeaturesApplication extends com.itmill.toolkit.Application { public void init() { Window main = new Window("IT Mill Toolkit Features Tour"); diff --git a/src/com/itmill/toolkit/demo/features/PropertyPanel.java b/src/com/itmill/toolkit/demo/features/PropertyPanel.java index e7f6099617..810d7efc33 100644 --- a/src/com/itmill/toolkit/demo/features/PropertyPanel.java +++ b/src/com/itmill/toolkit/demo/features/PropertyPanel.java @@ -1,30 +1,30 @@ /* ************************************************************************* - IT Mill Toolkit + IT Mill Toolkit - Development of Browser User Interfaces Made Easy + Development of Browser User Interfaces Made Easy - Copyright (C) 2000-2006 IT Mill Ltd - - ************************************************************************* + 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 + 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 + ************************************************************************* + + For more information, contact: + + IT Mill Ltd phone: +358 2 4802 7180 + Ruukinkatu 2-4 fax: +358 2 4802 7181 + 20540, Turku email: info@itmill.com + Finland company www: www.itmill.com + + Primary source for information and releases: www.itmill.com - ********************************************************************** */ + ********************************************************************** */ package com.itmill.toolkit.demo.features; @@ -43,21 +43,27 @@ 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 { +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 Button showAllProperties = - new Button("List of All Properties", this); + + private Button showAllProperties = new Button("List of All Properties", + 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) { @@ -72,8 +78,8 @@ public class PropertyPanel config = new BeanItem(objectToConfigure); // Control buttons - OrderedLayout buttons = - new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); + OrderedLayout buttons = new OrderedLayout( + OrderedLayout.ORIENTATION_VERTICAL); buttons.addComponent(setButton); buttons.addComponent(discardButton); addComponent(buttons); @@ -83,11 +89,10 @@ public class PropertyPanel if (objectToConfigure instanceof Select) addSelectProperties(); if (objectToConfigure instanceof AbstractField - && !(objectToConfigure instanceof Table - || objectToConfigure instanceof Tree)) + && !(objectToConfigure instanceof Table || objectToConfigure instanceof Tree)) addFieldProperties(); if ((objectToConfigure instanceof AbstractComponentContainer) - && !(objectToConfigure instanceof FrameWindow)) + && !(objectToConfigure instanceof FrameWindow)) addComponentContainerProperties(); // The list of all properties @@ -98,12 +103,8 @@ public class PropertyPanel 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.setColumnAlignments(new String[] { Table.ALIGN_LEFT, + Table.ALIGN_LEFT, Table.ALIGN_CENTER, Table.ALIGN_CENTER }); allProperties.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID); updatePropertyList(); addComponent(allProperties); @@ -111,10 +112,9 @@ public class PropertyPanel /** 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.setWidth(600); p.setCaption(propertySetCaption); p.setStyle("light"); p.addComponent(properties); @@ -137,19 +137,19 @@ public class PropertyPanel // Commit all changed on all forms if (event.getButton() == setButton) { for (Iterator i = forms.iterator(); i.hasNext();) - ((Form) i.next()).commit(); + ((Form) i.next()).commit(); } // Discard all changed on all forms if (event.getButton() == discardButton) { for (Iterator i = forms.iterator(); i.hasNext();) - ((Form) i.next()).discard(); + ((Form) i.next()).discard(); } // Show property list if (event.getButton() == showAllProperties) { - allProperties.setVisible( - ((Boolean) showAllProperties.getValue()).booleanValue()); + allProperties.setVisible(((Boolean) showAllProperties.getValue()) + .booleanValue()); } } @@ -174,13 +174,10 @@ public class PropertyPanel // Fill the table for (int i = 0; i < pd.length; i++) { - allProperties.addItem( - new Object[] { - pd[i].getName(), + 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]); + (listed.contains(pd[i].getName()) ? "x" : "") }, pd[i]); } } @@ -188,24 +185,14 @@ public class PropertyPanel private void addBasicComponentProperties() { // Set of properties - Form set = - createBeanPropertySet( - new String[] { - "caption", - "icon", - "componentError", - "description", - "enabled", - "visible", - "style", - "readOnly", - "immediate" }); + 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" }); + set.replaceWithSelect("icon", new Object[] { null, + new ThemeResource("icon/files/file.gif") }, new Object[] { + "No icon", "Sample icon" }); // Component error Throwable sampleException; @@ -214,84 +201,93 @@ public class PropertyPanel } catch (NullPointerException e) { sampleException = e; } - set.replaceWithSelect( - "componentError", - new Object[] { - null, - new UserError("Sample text error message."), - new UserError( - "Error messages can " - + "contain any UIDL formatting, like:
Error messages can " + + "contain any UIDL formatting, like: