Browse Source

Indentation changes.

Layout changed.

svn changeset:426/svn branch:toolkit
tags/6.7.0.beta1
Jani Laakso 17 years ago
parent
commit
341e214a31
28 changed files with 1428 additions and 1581 deletions
  1. 65
    46
      src/com/itmill/toolkit/demo/features/Feature.java
  2. 103
    94
      src/com/itmill/toolkit/demo/features/FeatureBrowser.java
  3. 34
    36
      src/com/itmill/toolkit/demo/features/FeatureButton.java
  4. 40
    40
      src/com/itmill/toolkit/demo/features/FeatureContainers.java
  5. 40
    40
      src/com/itmill/toolkit/demo/features/FeatureCustomLayout.java
  6. 51
    63
      src/com/itmill/toolkit/demo/features/FeatureDateField.java
  7. 47
    62
      src/com/itmill/toolkit/demo/features/FeatureEmbedded.java
  8. 40
    40
      src/com/itmill/toolkit/demo/features/FeatureForm.java
  9. 51
    53
      src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java
  10. 36
    34
      src/com/itmill/toolkit/demo/features/FeatureGridLayout.java
  11. 30
    30
      src/com/itmill/toolkit/demo/features/FeatureItems.java
  12. 40
    45
      src/com/itmill/toolkit/demo/features/FeatureLabel.java
  13. 33
    43
      src/com/itmill/toolkit/demo/features/FeatureLink.java
  14. 42
    46
      src/com/itmill/toolkit/demo/features/FeatureOrderedLayout.java
  15. 36
    42
      src/com/itmill/toolkit/demo/features/FeaturePanel.java
  16. 51
    44
      src/com/itmill/toolkit/demo/features/FeatureParameters.java
  17. 38
    38
      src/com/itmill/toolkit/demo/features/FeatureProperties.java
  18. 55
    89
      src/com/itmill/toolkit/demo/features/FeatureSelect.java
  19. 35
    36
      src/com/itmill/toolkit/demo/features/FeatureTabSheet.java
  20. 93
    134
      src/com/itmill/toolkit/demo/features/FeatureTable.java
  21. 39
    46
      src/com/itmill/toolkit/demo/features/FeatureTextField.java
  22. 74
    95
      src/com/itmill/toolkit/demo/features/FeatureTree.java
  23. 53
    62
      src/com/itmill/toolkit/demo/features/FeatureUpload.java
  24. 31
    32
      src/com/itmill/toolkit/demo/features/FeatureValidators.java
  25. 40
    48
      src/com/itmill/toolkit/demo/features/FeatureWindow.java
  26. 21
    22
      src/com/itmill/toolkit/demo/features/FeaturesApplication.java
  27. 185
    196
      src/com/itmill/toolkit/demo/features/PropertyPanel.java
  28. 25
    25
      src/com/itmill/toolkit/demo/features/UIComponents.java

+ 65
- 46
src/com/itmill/toolkit/demo/features/Feature.java View File

@@ -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,58 +34,72 @@ import com.itmill.toolkit.ui.*;

public class Feature extends CustomComponent {

private OrderedLayout layout;

private TabSheet ts;

private boolean initialized = false;

private static Resource sampleIcon;

protected PropertyPanel propertyPanel;

/** Constuctor for the feature component */
public Feature() {
ts = new TabSheet();
setCompositionRoot(ts);
layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
setCompositionRoot(layout);
}

/** Feature component initialization is lazily done when the
* feature is attached to application */
/**
* Feature component initialization is lazily done when the feature is
* attached to application
*/
public void attach() {

// Check if the feature is already initialized
if (initialized) return;
if (initialized)
return;
initialized = true;

// Optional description with image
// Demo
Component demo = getDemoComponent();
if (demo != null)
layout.addComponent(demo);

ts = new TabSheet();
layout.addComponent(ts);

// Description
String desc = getDescriptionXHTML();
String title = getTitle();
if (desc != null && title != null) {
GridLayout gl = new GridLayout(2, 1);
if (getImage() != null)
gl.addComponent(
new Embedded(
"", new ClassResource(getImage(), this.getApplication())));
gl.addComponent(
new Label(
"<h2>" + title + "</h2>" + desc,
gl.addComponent(new Embedded("", new ClassResource(getImage(),
this.getApplication())));
gl.addComponent(new Label("<h2>" + title + "</h2>" + 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(
"<h2>" + getTitle() + " example</h2>",
l.addComponent(new Label("<h2>" + getTitle() + " example</h2>",
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;
}

}

+ 103
- 94
src/com/itmill/toolkit/demo/features/FeatureBrowser.java View File

@@ -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 =
"<h3>Welcome to the IT Mill Toolkit feature tour!</h3>"
private static final String WELCOME_TEXT = "<h3>Welcome to the IT Mill Toolkit feature tour!</h3>"
+ "In this application you may view and play with some features of IT Mill Toolkit.<br/>"
+ "Most of the features can be tested online and include simple example of their "
+ "usage associated with it.<br/><br/>"
@@ -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) {

+ 34
- 36
src/com/itmill/toolkit/demo/features/FeatureButton.java View File

@@ -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)<br/><br/>"
+ "Button can be directly connected to any method of an object, which "
+ "is an easy way to trigger events: <code> new Button(\"Play\", myPiano \"playIt\")</code>. "
+ "Or in checkbox-mode they can be bound to a boolean proterties and create "
+ " simple selectors.<br /><br /> "
+ "See the demo and try out how the different properties affect "
+ "the presentation of the component.";
+ "Buttons may function either as a push buttons or switches. (checkboxes)<br/><br/>"
+ "Button can be directly connected to any method of an object, which "
+ "is an easy way to trigger events: <code> new Button(\"Play\", myPiano \"playIt\")</code>. "
+ "Or in checkbox-mode they can be bound to a boolean proterties and create "
+ " simple selectors.<br /><br /> "
+ "See the demo and try out how the different properties affect "
+ "the presentation of the component.";
}

protected String getImage() {

+ 40
- 40
src/com/itmill/toolkit/demo/features/FeatureContainers.java View File

@@ -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 "<p>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. </p>"
+ "<p>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.</p>"
+ "<p>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.</p>";
+ "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. </p>"
+ "<p>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.</p>"
+ "<p>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.</p>";
}

protected String getImage() {

+ 40
- 40
src/com/itmill/toolkit/demo/features/FeatureCustomLayout.java View File

@@ -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 "<p>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.</p>"
+ "<p>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.</p>"
+ "<p>The default theme handles the styles that are not defined by just drawing "
+ "the subcomponents with flowlayout.</p>";
+ "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.</p>"
+ "<p>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.</p>"
+ "<p>The default theme handles the styles that are not defined by just drawing "
+ "the subcomponents with flowlayout.</p>";
}

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(
"<p>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</p>",
Label.CONTENT_UIDL));
l
.addComponent(new Label(
"<p>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</p>",
Label.CONTENT_UIDL));

URL goUrl = null;
try {

+ 51
- 63
src/com/itmill/toolkit/demo/features/FeatureDateField.java View File

@@ -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 "<p>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.</p>"
+ "<p>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.</p>"
+ "<p>On the demo tab you can try out how the different properties affect the "
+ "presentation of the component.</p>";
+ "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.</p>"
+ "<p>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.</p>"
+ "<p>On the demo tab you can try out how the different properties affect the "
+ "presentation of the component.</p>";
}

protected String getImage() {

+ 47
- 62
src/com/itmill/toolkit/demo/features/FeatureEmbedded.java View File

@@ -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 "<p>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.</p>";
+ "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.</p>";
}

protected String getImage() {

+ 40
- 40
src/com/itmill/toolkit/demo/features/FeatureForm.java View File

@@ -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
"<p>Form is a flexible, yet simple container for fields. "
return "<p>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.</p>"
+ " <p>The best example of Form usage is the this feature browser itself; "
+ " all the Property-panels in demos are composed of Form-components.</p>";
}
}

protected String getTitle() {
return "Form";
}
@@ -186,5 +186,5 @@ public class FeatureForm
protected String getImage() {
return "form.jpg";
}
}

+ 51
- 53
src/com/itmill/toolkit/demo/features/FeatureFrameWindow.java View File

@@ -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 "<p>This component implements a window that contains a hierarchical set of frames. "
+ "Each frame can contain a web-page, window or a set of frames that divides the space "
+ "horizontally or vertically.</p>";
+ "Each frame can contain a web-page, window or a set of frames that divides the space "
+ "horizontally or vertically.</p>";
}

protected String getExampleSrc() {
return "FrameWindow f = new FrameWindow(\"Frame example\");\n"
+ "f.getFrameset().newFrame(window);\n"
+ "f.getFrameset().newFrame(resource,\"targetName\");\n";
+ "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("<b>Frame: " + (++count) + "</b>", Label.CONTENT_UIDL));
w.addComponent(new Label("<b>Frame: " + (++count) + "</b>",
Label.CONTENT_UIDL));
w.addComponent(new Button("Split", this));
w.addComponent(new Button("Remove", this));
windowToFramesetMap.put(w, fs);

+ 36
- 34
src/com/itmill/toolkit/demo/features/FeatureGridLayout.java View File

@@ -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 "<p>This feature provides a container that lays out components "
+ "into a grid of given width and height.</p>"
+ "<p>On the demo tab you can try out how the different "
+ "properties affect the presentation of the component.</p>";
+ "into a grid of given width and height.</p>"
+ "<p>On the demo tab you can try out how the different "
+ "properties affect the presentation of the component.</p>";
}

protected String getImage() {

+ 30
- 30
src/com/itmill/toolkit/demo/features/FeatureItems.java View File

@@ -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 "<p>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.</p>"
+ "<p>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.</p>";
+ "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.</p>"
+ "<p>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.</p>";
}

protected String getImage() {

+ 40
- 45
src/com/itmill/toolkit/demo/features/FeatureLabel.java View File

@@ -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."
+ "<br /><br />"
+ "Label can also be directly associated with data property to display "
+ "information from different data sources automatically. This makes it "
+ "trivial to present the current user in the corner of applications main window. "
+ "<br /><br />"
+ "On the demo tab you can try out how the different properties affect "
+ "the presentation of the component.";
+ "By default, it is a light-weight component for presenting "
+ "text content in application, but it can be also used to present "
+ "formatted information and even XML."
+ "<br /><br />"
+ "Label can also be directly associated with data property to display "
+ "information from different data sources automatically. This makes it "
+ "trivial to present the current user in the corner of applications main window. "
+ "<br /><br />"
+ "On the demo tab you can try out how the different properties affect "
+ "the presentation of the component.";
}

protected String getImage() {

+ 33
- 43
src/com/itmill/toolkit/demo/features/FeatureLink.java View File

@@ -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,31 +43,21 @@ public class FeatureLink extends Feature {

// Example panel
Panel show = new Panel("Link component");
Link lnk =
new Link(
"Link caption",
new ExternalResource("http://www.itmill.com"));
Link lnk = new Link("Link caption", new ExternalResource(
"http://www.itmill.com"));
show.addComponent(lnk);
l.addComponent(show);

// Properties
PropertyPanel p = new PropertyPanel(lnk);
Form ap =
p.createBeanPropertySet(
new String[] {
"targetName",
"targetWidth",
"targetHeight",
"targetBorder" });
ap.replaceWithSelect(
"targetBorder",
new Object[] {
propertyPanel = new PropertyPanel(lnk);
Form ap = propertyPanel.createBeanPropertySet(new String[] {
"targetName", "targetWidth", "targetHeight", "targetBorder" });
ap.replaceWithSelect("targetBorder", new Object[] {
new Integer(Link.TARGET_BORDER_DEFAULT),
new Integer(Link.TARGET_BORDER_MINIMAL),
new Integer(Link.TARGET_BORDER_NONE)},
new Object[] { "Default", "Minimal", "None" });
p.addProperties("Link Properties", ap);
l.addComponent(p);
new Integer(Link.TARGET_BORDER_NONE) }, new Object[] {
"Default", "Minimal", "None" });
propertyPanel.addProperties("Link Properties", ap);

return l;
}
@@ -78,10 +68,10 @@ public class FeatureLink extends Feature {

protected String getDescriptionXHTML() {
return "The link feature allows for making refences to both internal and external resources. "
+ "The link can open the new resource in a new window, allowing for control of the newly "
+ "opened windows attributes, such as size and border. "
+ "<br /><br />"
+ " For example you can create an application pop-up or create link to external resources.";
+ "The link can open the new resource in a new window, allowing for control of the newly "
+ "opened windows attributes, such as size and border. "
+ "<br /><br />"
+ " For example you can create an application pop-up or create link to external resources.";

}


+ 42
- 46
src/com/itmill/toolkit/demo/features/FeatureOrderedLayout.java View File

@@ -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,50 +43,46 @@ public class FeatureOrderedLayout extends Feature {
// Example panel
Panel show = new Panel("OrderedLayout component");
OrderedLayout ol = new OrderedLayout();
for (int i=1;i<5; i++) ol.addComponent(new TextField("Test component "+i));
for (int i = 1; i < 5; i++)
ol.addComponent(new TextField("Test component " + i));
show.addComponent(ol);
l.addComponent(show);

// Properties
PropertyPanel p = new PropertyPanel(ol);
Form ap = p.createBeanPropertySet(new String[] { "orientation" });
ap.replaceWithSelect(
"orientation",
new Object[] {
propertyPanel = new PropertyPanel(ol);
Form ap = propertyPanel
.createBeanPropertySet(new String[] { "orientation" });
ap.replaceWithSelect("orientation", new Object[] {
new Integer(OrderedLayout.ORIENTATION_HORIZONTAL),
new Integer(OrderedLayout.ORIENTATION_VERTICAL)},
new Object[] {
"Horizontal",
"Vertical"});
Select themes = (Select) p.getField("style");
themes
.addItem("form")
.getItemProperty(themes.getItemCaptionPropertyId())
.setValue("form");
p.addProperties("OrderedLayout Properties", ap);
l.addComponent(p);
new Integer(OrderedLayout.ORIENTATION_VERTICAL) },
new Object[] { "Horizontal", "Vertical" });
Select themes = (Select) propertyPanel.getField("style");
themes.addItem("form").getItemProperty(
themes.getItemCaptionPropertyId()).setValue("form");
propertyPanel.addProperties("OrderedLayout Properties", ap);

return l;
}

protected String getExampleSrc() {
return "OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_FLOW);\n"
+ "ol.addComponent(new TextField(\"Textfield caption\"));\n"
+ "ol.addComponent(new Label(\"Label\"));\n";
+ "ol.addComponent(new TextField(\"Textfield caption\"));\n"
+ "ol.addComponent(new Label(\"Label\"));\n";

}

/**
* @see com.itmill.toolkit.demo.features.Feature#getDescriptionXHTML()
*/
protected String getDescriptionXHTML() {
return "This feature provides a container for laying out components either "
+ "vertically, horizontally or flowingly. The orientation may be changed "
+ "during runtime. It also defines a special style for themes to implement called \"form\""
+ "that is used for input forms where the components are layed-out side-by-side "
+ "with their captions."
+ "<br/><br/>"
+ "On the demo tab you can try out how the different properties "
+ "affect the presentation of the component.";
+ "vertically, horizontally or flowingly. The orientation may be changed "
+ "during runtime. It also defines a special style for themes to implement called \"form\""
+ "that is used for input forms where the components are layed-out side-by-side "
+ "with their captions."
+ "<br/><br/>"
+ "On the demo tab you can try out how the different properties "
+ "affect the presentation of the component.";
}

protected String getImage() {

+ 36
- 42
src/com/itmill/toolkit/demo/features/FeaturePanel.java View File

@@ -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;

@@ -46,39 +46,34 @@ public class FeaturePanel extends Feature {
l.addComponent(show);

// Properties
PropertyPanel p = new PropertyPanel(show);
Form ap = p.createBeanPropertySet(new String[] { "width", "height" });
Select themes = (Select) p.getField("style");
themes
.addItem("light")
.getItemProperty(themes.getItemCaptionPropertyId())
.setValue("light");
themes
.addItem("strong")
.getItemProperty(themes.getItemCaptionPropertyId())
.setValue("strong");
p.addProperties("Panel Properties", ap);
l.addComponent(p);
propertyPanel = new PropertyPanel(show);
Form ap = propertyPanel.createBeanPropertySet(new String[] { "width",
"height" });
Select themes = (Select) propertyPanel.getField("style");
themes.addItem("light").getItemProperty(
themes.getItemCaptionPropertyId()).setValue("light");
themes.addItem("strong").getItemProperty(
themes.getItemCaptionPropertyId()).setValue("strong");
propertyPanel.addProperties("Panel Properties", ap);

return l;
}

protected String getExampleSrc() {
return "Panel show = new Panel(\"Panel caption\");\n"
+ "show.addComponent(new Label(\"Label in Panel\"));";
+ "show.addComponent(new Label(\"Label in Panel\"));";

}

protected String getDescriptionXHTML() {
return "The Panel is a container for other components, it usually draws a frame around it's "+
"extremities and may have a caption to clarify the nature of the contained components purpose."+
"A panel always contains firstly a layout onto which the actual contained components are added, "+
"this layout may be switched on the fly. <br/><br/>"+
"On the demo tab you can try out how the different properties "+
"affect the presentation of the component.";
return "The Panel is a container for other components, it usually draws a frame around it's "
+ "extremities and may have a caption to clarify the nature of the contained components purpose."
+ "A panel always contains firstly a layout onto which the actual contained components are added, "
+ "this layout may be switched on the fly. <br/><br/>"
+ "On the demo tab you can try out how the different properties "
+ "affect the presentation of the component.";
}


protected String getImage() {
return "panel.jpg";
}
@@ -88,4 +83,3 @@ public class FeaturePanel extends Feature {
}

}


+ 51
- 44
src/com/itmill/toolkit/demo/features/FeatureParameters.java View File

@@ -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,12 +38,13 @@ import com.itmill.toolkit.terminal.ParameterHandler;
import com.itmill.toolkit.terminal.URIHandler;
import com.itmill.toolkit.ui.*;

public class FeatureParameters
extends Feature
implements URIHandler, ParameterHandler {
public class FeatureParameters extends Feature implements URIHandler,
ParameterHandler {

private Label context = new Label();

private Label relative = new Label();

private Table params = new Table();

public FeatureParameters() {
@@ -55,29 +56,27 @@ public class FeatureParameters

OrderedLayout l = new OrderedLayout();

Label info =
new Label(
"To test this feature, try to "
+ "add some get parameters to URL. For example if you have "
+ "the feature browser installed in your local host, try url: ");
Label info = new Label("To test this feature, try to "
+ "add some get parameters to URL. For example if you have "
+ "the feature browser installed in your local host, try url: ");
info.setCaption("Usage info");
l.addComponent(info);
try {
URL u1 = new URL(getApplication().getURL(),"test/uri?test=1&test=2");
URL u2 = new URL(getApplication().getURL(),"foo/bar?mary=john&count=3");
l.addComponent(
new Link(u1.toString(),new ExternalResource(u1)));
URL u1 = new URL(getApplication().getURL(),
"test/uri?test=1&test=2");
URL u2 = new URL(getApplication().getURL(),
"foo/bar?mary=john&count=3");

l.addComponent(new Link(u1.toString(), new ExternalResource(u1)));
l.addComponent(new Label("Or this: "));
l.addComponent(
new Link(u2.toString(),new ExternalResource(u2)));
l.addComponent(new Link(u2.toString(), new ExternalResource(u2)));
} catch (Exception e) {
System.out.println(
"Couldn't get hostname for this machine: " + e.toString());
System.out.println("Couldn't get hostname for this machine: "
+ e.toString());
e.printStackTrace();
}

// URI
// URI
Panel p1 = new Panel("URI Handler");
context.setCaption("Last URI handler context");
p1.addComponent(context);
@@ -98,8 +97,8 @@ public class FeatureParameters

protected String getDescriptionXHTML() {
return "This is a demonstration of how URL parameters can be recieved and handled."
+ "Parameters and URL:s can be received trough the windows by registering "
+ "URIHandler and ParameterHandler classes window.";
+ "Parameters and URL:s can be received trough the windows by registering "
+ "URIHandler and ParameterHandler classes window.";
}

protected String getImage() {
@@ -110,7 +109,9 @@ public class FeatureParameters
return "Parameters";
}

/** Add URI and parametes handlers to window.
/**
* Add URI and parametes handlers to window.
*
* @see com.itmill.toolkit.ui.Component#attach()
*/
public void attach() {
@@ -119,7 +120,9 @@ public class FeatureParameters
getWindow().addParameterHandler(this);
}

/** Remove all handlers from window
/**
* Remove all handlers from window
*
* @see com.itmill.toolkit.ui.Component#detach()
*/
public void detach() {
@@ -128,7 +131,9 @@ public class FeatureParameters
getWindow().removeParameterHandler(this);
}

/** Update URI
/**
* Update URI
*
* @see com.itmill.toolkit.terminal.URIHandler#handleURI(URL, String)
*/
public DownloadStream handleURI(URL context, String relativeUri) {
@@ -137,7 +142,9 @@ public class FeatureParameters
return null;
}

/** Update parameters table
/**
* Update parameters table
*
* @see com.itmill.toolkit.terminal.ParameterHandler#handleParameters(Map)
*/
public void handleParameters(Map parameters) {

+ 38
- 38
src/com/itmill/toolkit/demo/features/FeatureProperties.java View File

@@ -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;

@@ -40,24 +40,24 @@ public class FeatureProperties extends Feature {

protected String getDescriptionXHTML() {
return "<p>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.</p>"
+ "<p>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.</p>"
+ "<p>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.</p>"
+ "<p>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.</p>";
+ "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.</p>"
+ "<p>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.</p>"
+ "<p>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.</p>"
+ "<p>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.</p>";
}

/**

+ 55
- 89
src/com/itmill/toolkit/demo/features/FeatureSelect.java View File

@@ -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."
+ "<br/><br/>"
+ "Data source can be associated both with selected item and the list of selections. "+
"This way you can easily present a selection based on items specified elsewhere in application. "
+ "<br/><br/>"
+ "On the demo tab you can try out how the different properties affect the"
+ " presentation of the component.";
+ "Firstly it presents the single selection mode, which is usually represented as "
+ "either a drop-down menu or a radio-group of switches, secondly it "
+ "allows for multiple item selection, this is usually represented as either a "
+ "listbox of selectable items or as a group of checkboxes."
+ "<br/><br/>"
+ "Data source can be associated both with selected item and the list of selections. "
+ "This way you can easily present a selection based on items specified elsewhere in application. "
+ "<br/><br/>"
+ "On the demo tab you can try out how the different properties affect the"
+ " presentation of the component.";
}

protected String getImage() {

+ 35
- 36
src/com/itmill/toolkit/demo/features/FeatureTabSheet.java View File

@@ -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,36 +42,35 @@ public class FeatureTabSheet extends Feature {

// Example panel
Panel show = new Panel("TabSheet component");
TabSheet ts = new TabSheet();
ts.addTab(new Label("Tab 1 Body"),"Tab 1 caption",null);
ts.addTab(new Label("Tab 2 Body"),"Tab 2 caption",null);
ts.addTab(new Label("Tab 3 Body"),"Tab 3 caption",null);
ts.addTab(new Label("Tab 1 Body"), "Tab 1 caption", null);
ts.addTab(new Label("Tab 2 Body"), "Tab 2 caption", null);
ts.addTab(new Label("Tab 3 Body"), "Tab 3 caption", null);
show.addComponent(ts);
l.addComponent(show);

// Properties
PropertyPanel p = new PropertyPanel(ts);
l.addComponent(p);
propertyPanel = new PropertyPanel(ts);

return l;
}

protected String getExampleSrc() {
return "TabSheet ts = new TabSheet();"+
"ts.addTab(new Label(\"Tab 1 Body\"),\"Tab 1 caption\",null);"+
"ts.addTab(new Label(\"Tab 2 Body\"),\"Tab 2 caption\",null);"+
"ts.addTab(new Label(\"Tab 3 Body\"),\"Tab 3 caption\",null);";
return "TabSheet ts = new TabSheet();"
+ "ts.addTab(new Label(\"Tab 1 Body\"),\"Tab 1 caption\",null);"
+ "ts.addTab(new Label(\"Tab 2 Body\"),\"Tab 2 caption\",null);"
+ "ts.addTab(new Label(\"Tab 3 Body\"),\"Tab 3 caption\",null);";
}

protected String getDescriptionXHTML() {
return "A multicomponent container with tabs for switching between them.<br/>"+
"In the normal case, one would place a layout component on each tab.<br/><br />"+
"On the demo tab you can try out how the different properties affect "+
"the presentation of the component.";
return "A multicomponent container with tabs for switching between them.<br/>"
+ "In the normal case, one would place a layout component on each tab.<br/><br />"
+ "On the demo tab you can try out how the different properties affect "
+ "the presentation of the component.";
}
protected String getImage() {
return "tabsheet.jpg";
}

+ 93
- 134
src/com/itmill/toolkit/demo/features/FeatureTable.java View File

@@ -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,38 +33,25 @@ import com.itmill.toolkit.ui.*;

public class FeatureTable extends Feature implements Action.Handler {

private static final String[] firstnames =
new String[] {
"John",
"Mary",
"Joe",
"Sarah",
"Jeff",
"Jane",
"Peter",
"Marc",
"Josie",
"Linus" };
private static final String[] lastnames =
new String[] {
"Torvalds",
"Smith",
"Jones",
"Beck",
"Sheridan",
"Picard",
"Hill",
"Fielding",
private static final String[] firstnames = new String[] { "John", "Mary",
"Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" };

private static final String[] lastnames = new String[] { "Torvalds",
"Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding",
"Einstein" };
private static final String[] eyecolors =
new String[] { "Blue", "Green", "Brown" };
private static final String[] haircolors =
new String[] { "Brown", "Black", "Red", "Blonde" };

private static final String[] eyecolors = new String[] { "Blue", "Green",
"Brown" };

private static final String[] haircolors = new String[] { "Brown", "Black",
"Red", "Blonde" };

private Table t;

private boolean actionsActive = false;
private Button actionHandlerSwitch =
new Button("Activate actions", this, "toggleActions");

private Button actionHandlerSwitch = new Button("Activate actions", this,
"toggleActions");

public void toggleActions() {
if (actionsActive) {
@@ -96,45 +83,33 @@ public class FeatureTable extends Feature implements Action.Handler {

// Add random rows to table
for (int j = 0; j < 500; j++) {
Object id = t.addItem(
new Object[] {
firstnames[(int) (Math.random() * (firstnames.length-1))],
lastnames[(int) (Math.random() * (lastnames.length-1))],
new Integer((int) (Math.random() * 80)),
eyecolors[(int) (Math.random() * 3)],
haircolors[(int) (Math.random() * 4)] },
new Integer(j));
Object id = t
.addItem(
new Object[] {
firstnames[(int) (Math.random() * (firstnames.length - 1))],
lastnames[(int) (Math.random() * (lastnames.length - 1))],
new Integer((int) (Math.random() * 80)),
eyecolors[(int) (Math.random() * 3)],
haircolors[(int) (Math.random() * 4)] },
new Integer(j));
}

// Actions
l.addComponent(this.actionHandlerSwitch);

// Properties
PropertyPanel p = new PropertyPanel(t);
Form ap =
p.createBeanPropertySet(
new String[] {
"pageLength",
"rowHeaderMode",
"selectable",
"columnHeaderMode",
"columnCollapsingAllowed",
"columnReorderingAllowed"});
ap.replaceWithSelect(
"columnHeaderMode",
new Object[] {
propertyPanel = new PropertyPanel(t);
Form ap = propertyPanel.createBeanPropertySet(new String[] {
"pageLength", "rowHeaderMode", "selectable",
"columnHeaderMode", "columnCollapsingAllowed",
"columnReorderingAllowed" });
ap.replaceWithSelect("columnHeaderMode", new Object[] {
new Integer(Table.COLUMN_HEADER_MODE_EXPLICIT),
new Integer(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID),
new Integer(Table.COLUMN_HEADER_MODE_HIDDEN),
new Integer(Table.COLUMN_HEADER_MODE_ID)},
new Object[] {
"Explicit",
"Explicit defaults ID",
"Hidden",
"ID" });
ap.replaceWithSelect(
"rowHeaderMode",
new Object[] {
new Integer(Table.COLUMN_HEADER_MODE_ID) }, new Object[] {
"Explicit", "Explicit defaults ID", "Hidden", "ID" });
ap.replaceWithSelect("rowHeaderMode", new Object[] {
new Integer(Table.ROW_HEADER_MODE_EXPLICIT),
new Integer(Table.ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID),
new Integer(Table.ROW_HEADER_MODE_HIDDEN),
@@ -142,72 +117,58 @@ public class FeatureTable extends Feature implements Action.Handler {
new Integer(Table.ROW_HEADER_MODE_ID),
new Integer(Table.ROW_HEADER_MODE_INDEX),
new Integer(Table.ROW_HEADER_MODE_ITEM),
new Integer(Table.ROW_HEADER_MODE_PROPERTY)},
new Object[] {
"Explicit",
"Explicit defaults ID",
"Hidden",
"Icon only",
"ID",
"Index",
"Item",
"Property" });
Select themes = (Select) p.getField("style");
themes
.addItem("list")
.getItemProperty(themes.getItemCaptionPropertyId())
.setValue("list");
themes
.addItem("paging")
.getItemProperty(themes.getItemCaptionPropertyId())
.setValue("paging");
p.addProperties("Table Properties", ap);
l.addComponent(p);
new Integer(Table.ROW_HEADER_MODE_PROPERTY) }, new Object[] {
"Explicit", "Explicit defaults ID", "Hidden", "Icon only",
"ID", "Index", "Item", "Property" });
Select themes = (Select) propertyPanel.getField("style");
themes.addItem("list").getItemProperty(
themes.getItemCaptionPropertyId()).setValue("list");
themes.addItem("paging").getItemProperty(
themes.getItemCaptionPropertyId()).setValue("paging");
propertyPanel.addProperties("Table Properties", ap);

t.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
t.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID);
t.setColumnCollapsingAllowed(true);
t.setColumnReorderingAllowed(true);
t.setSelectable(true);

return l;
}

protected String getExampleSrc() {
return "// Sample table\n"
+ "t = new Table(\"Most Wanted Persons List\");\n"
+ "t.setPageLength(10);\n\n"
+ "// Add columns to table\n"
+ "t.addContainerProperty(\"Firstname\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Lastname\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Age\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Eyecolor\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Haircolor\", String.class, \"\");\n\n"
+ "// Add random rows to table\n"
+ "for (int j = 0; j < 50; j++) {\n"
+ " t.addItem(\n"
+ " new Object[] {\n"
+ " firstnames[(int) (Math.random() * 9)],\n"
+ " lastnames[(int) (Math.random() * 9)],\n"
+ " new Integer((int) (Math.random() * 80)),\n"
+ " eyecolors[(int) (Math.random() * 3)],\n"
+ " haircolors[(int) (Math.random() * 4)] },\n"
+ " new Integer(j));\n"
+ "}\n";
+ "t = new Table(\"Most Wanted Persons List\");\n"
+ "t.setPageLength(10);\n\n"
+ "// Add columns to table\n"
+ "t.addContainerProperty(\"Firstname\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Lastname\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Age\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Eyecolor\", String.class, \"\");\n"
+ "t.addContainerProperty(\"Haircolor\", String.class, \"\");\n\n"
+ "// Add random rows to table\n"
+ "for (int j = 0; j < 50; j++) {\n" + " t.addItem(\n"
+ " new Object[] {\n"
+ " firstnames[(int) (Math.random() * 9)],\n"
+ " lastnames[(int) (Math.random() * 9)],\n"
+ " new Integer((int) (Math.random() * 80)),\n"
+ " eyecolors[(int) (Math.random() * 3)],\n"
+ " haircolors[(int) (Math.random() * 4)] },\n"
+ " new Integer(j));\n" + "}\n";
}

protected String getDescriptionXHTML() {

return "<p>The Table component is designed for displaying large volumes of tabular data, "
+ "in multiple pages whenever needed.</p> "
+ "<p>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.</p><p>"
+ "Table may be connected to any datasource implementing the <code>Container</code> interface."
+ "This way data found in external datasources can be directly presented in the table component."
+ "</p><p>"
+ "Table implements a number of features and you can test most of them in the table demo tab.</p>";
+ "in multiple pages whenever needed.</p> "
+ "<p>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.</p><p>"
+ "Table may be connected to any datasource implementing the <code>Container</code> interface."
+ "This way data found in external datasources can be directly presented in the table component."
+ "</p><p>"
+ "Table implements a number of features and you can test most of them in the table demo tab.</p>";
}

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() + "'");
}

}

+ 39
- 46
src/com/itmill/toolkit/demo/features/FeatureTextField.java View File

@@ -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 "<p>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.</p>"
+ "<p>Furthermore a validators may be bound to the component to "
+ "check and validate the given input before it is actually commited."
+ "</p>"
+ "<p>On the demo tab you can try out how the different properties affect the "
+ "presentation of the component.</p>";
+ "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.</p>"
+ "<p>Furthermore a validators may be bound to the component to "
+ "check and validate the given input before it is actually commited."
+ "</p>"
+ "<p>On the demo tab you can try out how the different properties affect the "
+ "presentation of the component.</p>";
}

protected String getImage() {

+ 74
- 95
src/com/itmill/toolkit/demo/features/FeatureTree.java View File

@@ -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 "<p>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. </p>"
+ "<p>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.</p>"
+ "<p>The tree component uses <code>Container</code> "
+ "datasources much like the Table component, "
+ "with the addition that it also utilizes the hierarchy "
+ "information maintained by the container. </p><p>On "
+ "the demo tab you can try out how the different properties "
+ "affect the presentation of the tree component.</p>";
+ " 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. </p>"
+ "<p>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.</p>"
+ "<p>The tree component uses <code>Container</code> "
+ "datasources much like the Table component, "
+ "with the addition that it also utilizes the hierarchy "
+ "information maintained by the container. </p><p>On "
+ "the demo tab you can try out how the different properties "
+ "affect the presentation of the tree component.</p>";
}

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 + "'");
}
}

+ 53
- 62
src/com/itmill/toolkit/demo/features/FeatureUpload.java View File

@@ -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.<br/>"
+ "<br/>On the demo tab you can try out how the different properties affect the presentation of the 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.<br/>"
+ "<br/>On the demo tab you can try out how the different properties affect the presentation of the component.";
}

protected String getImage() {
@@ -106,43 +101,36 @@ public class FeatureUpload
public void uploadFinished(FinishedEvent event) {
status.removeAllComponents();
if (buffer.getStream() == null)
status.addComponent(
new Label("Upload finished, but output buffer is null!!"));
status.addComponent(new Label(
"Upload finished, but output buffer is null!!"));
else {
status.addComponent(
new Label(
"<b>Name:</b> " + event.getFilename(),
Label.CONTENT_XHTML));
status.addComponent(
new Label(
"<b>Mimetype:</b> " + event.getMIMEType(),
Label.CONTENT_XHTML));
status.addComponent(
new Label(
"<b>Size:</b> " + event.getLength() + " bytes.",
Label.CONTENT_XHTML));

status.addComponent(
new Link(
"Download " + buffer.getFileName(),
new StreamResource(
buffer,
buffer.getFileName(),
getApplication())));
status
.addComponent(new Label("<b>Name:</b> "
+ event.getFilename(), Label.CONTENT_XHTML));
status.addComponent(new Label("<b>Mimetype:</b> "
+ event.getMIMEType(), Label.CONTENT_XHTML));
status.addComponent(new Label("<b>Size:</b> " + event.getLength()
+ " bytes.", Label.CONTENT_XHTML));

status.addComponent(new Link("Download " + buffer.getFileName(),
new StreamResource(buffer, buffer.getFileName(),
getApplication())));

status.setVisible(true);
}
}

public class Buffer
implements StreamResource.StreamSource, Upload.Receiver {
public class Buffer implements StreamResource.StreamSource, Upload.Receiver {
ByteArrayOutputStream outputBuffer = null;

String mimeType;

String fileName;

public Buffer() {

}

public InputStream getStream() {
if (outputBuffer == null)
return null;
@@ -150,7 +138,8 @@ public class FeatureUpload
}

/**
* @see com.itmill.toolkit.ui.Upload.Receiver#receiveUpload(String, String)
* @see com.itmill.toolkit.ui.Upload.Receiver#receiveUpload(String,
* String)
*/
public OutputStream receiveUpload(String filename, String MIMEType) {
fileName = filename;
@@ -161,6 +150,7 @@ public class FeatureUpload

/**
* Returns the fileName.
*
* @return String
*/
public String getFileName() {
@@ -169,6 +159,7 @@ public class FeatureUpload

/**
* Returns the mimeType.
*
* @return String
*/
public String getMimeType() {

+ 31
- 32
src/com/itmill/toolkit/demo/features/FeatureValidators.java View File

@@ -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;

@@ -39,18 +39,17 @@ public class FeatureValidators extends Feature {
}

protected String getDescriptionXHTML() {
return
"<p>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.</p>"+
"<p>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.</p>";
return "<p>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.</p>"
+ "<p>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.</p>";
}

protected String getImage() {

+ 40
- 48
src/com/itmill/toolkit/demo/features/FeatureWindow.java View File

@@ -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() {

+ 21
- 22
src/com/itmill/toolkit/demo/features/FeaturesApplication.java View File

@@ -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");

+ 185
- 196
src/com/itmill/toolkit/demo/features/PropertyPanel.java View File

@@ -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(
"<h3>Error message formatting</h3><p>Error messages can "
+ "contain any UIDL formatting, like: <ul><li><b>Bold"
+ "</b></li><li><i>Italic</i></li></ul></p>",
UserError.CONTENT_UIDL,
ErrorMessage.INFORMATION),
new SystemError(
"This is an example of exception error reposting",
sampleException)},
new Object[] {
"No error",
"Sample text error",
"Sample Formatted error",
"Sample System Error" });
set
.replaceWithSelect(
"componentError",
new Object[] {
null,
new UserError("Sample text error message."),
new UserError(
"<h3>Error message formatting</h3><p>Error messages can "
+ "contain any UIDL formatting, like: <ul><li><b>Bold"
+ "</b></li><li><i>Italic</i></li></ul></p>",
UserError.CONTENT_UIDL,
ErrorMessage.INFORMATION),
new SystemError(
"This is an example of exception error reposting",
sampleException) },
new Object[] { "No error", "Sample text error",
"Sample Formatted error", "Sample System Error" });

// Style
String currentStyle = ((Component)objectToConfigure).getStyle();
String currentStyle = ((Component) objectToConfigure).getStyle();
if (currentStyle == null)
set
.replaceWithSelect(
"style",
new Object[] { null },
new Object[] { "Default" })
.setNewItemsAllowed(true);
set.replaceWithSelect("style", new Object[] { null },
new Object[] { "Default" }).setNewItemsAllowed(true);
else
set
.replaceWithSelect(
"style",
new Object[] { null, currentStyle },
new Object[] { "Default", currentStyle })
.setNewItemsAllowed(true);
set.replaceWithSelect("style", new Object[] { null, currentStyle },
new Object[] { "Default", currentStyle })
.setNewItemsAllowed(true);

// Set up descriptions
set.getField("caption").setDescription(
"Component caption is the title of the component. Usage of the caption is optional and the "
+ "exact behavior of the propery is defined by the component. Setting caption null "
+ "or empty disables the caption.");
set.getField("enabled").setDescription(
"Enabled property controls the usage of the component. If the component is disabled (enabled=false),"
+ " it can not receive any events from the terminal. In most cases it makes the usage"
+ " of the component easier, if the component visually looks disbled (for example is grayed), "
+ "when it can not be used.");
set.getField("icon").setDescription(
"Icon of the component selects the main icon of the component. The usage of the icon is identical "
+ "to caption and in most components caption and icon are kept together. Icons can be "
+ "loaded from any resources (see Terminal/Resources for more information). Some components "
+ "contain more than just the captions icon. Those icons are controlled through their "
+ "own properties.");
set.getField("visible").setDescription(
"Visibility property says if the component is renreded or not. Invisible components are implicitly "
+ "disabled, as there is no visible user interface to send event.");
set.getField("description").setDescription(
"Description is designed to allow easy addition of short tooltips, like this. Like the caption,"
+ " setting description null or empty disables the description.");
set.getField("readOnly").setDescription(
"Those components that have internal state that can be written are settable to readOnly-mode,"
+ " where the object can only be read, not written.");
set.getField("componentError").setDescription(
"IT Mill Toolkit supports extensive error reporting. One part of the error reporting are component"
+ " errors that can be controlled by the programmer. This example only contains couple of "
+ "sample errors; to get the full picture, read browse ErrorMessage-interface implementors "
+ "API documentation.");
set.getField("immediate").setDescription(
"Not all terminals can send the events immediately to server from all action. Web is the most "
+ "typical environment where many events (like textfield changed) are not sent to server, "
+ "before they are explicitly submitted. Setting immediate property true (by default this "
+ "is false for most components), the programmer can assure that the application is"
+ " notified as soon as possible about the value change in this component.");
set.getField("style").setDescription(
"Themes specify the overall looks of the user interface. In addition component can have a set of "
+ "styles, that can be visually very different (like datefield calendar- and text-styles), "
+ "but contain the same logical functionality. As a rule of thumb, theme specifies if a "
+ "component is blue or yellow and style determines how the component is used.");
set
.getField("caption")
.setDescription(
"Component caption is the title of the component. Usage of the caption is optional and the "
+ "exact behavior of the propery is defined by the component. Setting caption null "
+ "or empty disables the caption.");
set
.getField("enabled")
.setDescription(
"Enabled property controls the usage of the component. If the component is disabled (enabled=false),"
+ " it can not receive any events from the terminal. In most cases it makes the usage"
+ " of the component easier, if the component visually looks disbled (for example is grayed), "
+ "when it can not be used.");
set
.getField("icon")
.setDescription(
"Icon of the component selects the main icon of the component. The usage of the icon is identical "
+ "to caption and in most components caption and icon are kept together. Icons can be "
+ "loaded from any resources (see Terminal/Resources for more information). Some components "
+ "contain more than just the captions icon. Those icons are controlled through their "
+ "own properties.");
set
.getField("visible")
.setDescription(
"Visibility property says if the component is renreded or not. Invisible components are implicitly "
+ "disabled, as there is no visible user interface to send event.");
set
.getField("description")
.setDescription(
"Description is designed to allow easy addition of short tooltips, like this. Like the caption,"
+ " setting description null or empty disables the description.");
set
.getField("readOnly")
.setDescription(
"Those components that have internal state that can be written are settable to readOnly-mode,"
+ " where the object can only be read, not written.");
set
.getField("componentError")
.setDescription(
"IT Mill Toolkit supports extensive error reporting. One part of the error reporting are component"
+ " errors that can be controlled by the programmer. This example only contains couple of "
+ "sample errors; to get the full picture, read browse ErrorMessage-interface implementors "
+ "API documentation.");
set
.getField("immediate")
.setDescription(
"Not all terminals can send the events immediately to server from all action. Web is the most "
+ "typical environment where many events (like textfield changed) are not sent to server, "
+ "before they are explicitly submitted. Setting immediate property true (by default this "
+ "is false for most components), the programmer can assure that the application is"
+ " notified as soon as possible about the value change in this component.");
set
.getField("style")
.setDescription(
"Themes specify the overall looks of the user interface. In addition component can have a set of "
+ "styles, that can be visually very different (like datefield calendar- and text-styles), "
+ "but contain the same logical functionality. As a rule of thumb, theme specifies if a "
+ "component is blue or yellow and style determines how the component is used.");

// Add created fields to property panel
addProperties("Component Basics", set);
@@ -299,29 +295,31 @@ public class PropertyPanel

/** Add properties for selecting */
private void addSelectProperties() {
Form set =
createBeanPropertySet(
new String[] { "newItemsAllowed", "lazyLoading" ,"multiSelect"});
Form set = createBeanPropertySet(new String[] { "newItemsAllowed",
"lazyLoading", "multiSelect" });
addProperties("Select Properties", set);

set.getField("multiSelect").setDescription(
"Specified if multiple items can be selected at once.");
set.getField("newItemsAllowed").setDescription(
"Select component (but not Tree or Table) can allow the user to directly "
+ "add new items to set of options. The new items are constrained to be "
+ "strings and thus feature only applies to simple lists.");
"Specified if multiple items can be selected at once.");
set
.getField("newItemsAllowed")
.setDescription(
"Select component (but not Tree or Table) can allow the user to directly "
+ "add new items to set of options. The new items are constrained to be "
+ "strings and thus feature only applies to simple lists.");
Button ll = (Button) set.getField("lazyLoading");
ll.setDescription("In Ajax rendering mode select supports lazy loading and filtering of options.");
ll.addListener((ValueChangeListener)this);
ll
.setDescription("In Ajax rendering mode select supports lazy loading and filtering of options.");
ll.addListener((ValueChangeListener) this);
ll.setImmediate(true);
if (((Boolean)ll.getValue()).booleanValue()) {
if (((Boolean) ll.getValue()).booleanValue()) {
set.getField("multiSelect").setVisible(false);
set.getField("newItemsAllowed").setVisible(false);
}
if (objectToConfigure instanceof Tree
|| objectToConfigure instanceof Table) {
set.removeItemProperty("newItemsAllowed");
set.removeItemProperty("lazyLoading");
set.removeItemProperty("newItemsAllowed");
set.removeItemProperty("lazyLoading");
}
}

@@ -329,18 +327,21 @@ public class PropertyPanel
private void addFieldProperties() {
// TODO This is temporarily disabled, until bug #211 is fixed
/*
Form set = new Form(new GridLayout(COLUMNS, 1));
set.addField("focus", new Button("Focus", objectToConfigure, "focus"));
set.getField("focus").setDescription(
"Focus the cursor to this field. Not all "
+ "components and/or terminals support this feature.");
addProperties("Field Features", set);
*/
* Form set = new Form(new GridLayout(COLUMNS, 1));
* set.addField("focus", new Button("Focus", objectToConfigure,
* "focus")); set.getField("focus").setDescription( "Focus the cursor to
* this field. Not all " + "components and/or terminals support this
* feature."); addProperties("Field Features", set);
*/
}

/** Add and remove some miscellaneous example component to/from component container */
/**
* Add and remove some miscellaneous example component to/from component
* container
*/
private void addComponentContainerProperties() {
Form set = new Form(new GridLayout(COLUMNS, 1));
Form set = new Form(new OrderedLayout(
OrderedLayout.ORIENTATION_VERTICAL));

addComponent = new Select();
addComponent.setImmediate(true);
@@ -353,11 +354,8 @@ public class PropertyPanel
addComponent.addListener(this);

set.addField("component adder", addComponent);
set.addField(
"remove all components",
new Button(
"Remove all components",
objectToConfigure,
set.addField("remove all components", new Button(
"Remove all components", objectToConfigure,
"removeAllComponents"));

addProperties("ComponentContainer Features", set);
@@ -373,38 +371,29 @@ public class PropertyPanel
if (value != null) {
// TextField component
if (value.equals("Text field"))
(
(
AbstractComponentContainer) objectToConfigure)
.addComponent(
new TextField("Test field"));
((AbstractComponentContainer) objectToConfigure)
.addComponent(new TextField("Test field"));

// DateField time style
// DateField time style
if (value.equals("Time")) {
DateField d = new DateField("Time", new Date());
d.setDescription(
"This is a DateField-component with text-style");
d
.setDescription("This is a DateField-component with text-style");
d.setResolution(DateField.RESOLUTION_MIN);
d.setStyle("text");
(
(
AbstractComponentContainer) objectToConfigure)
.addComponent(
d);
((AbstractComponentContainer) objectToConfigure)
.addComponent(d);
}

// Date field calendar style
if (value.equals("Calendar")) {
DateField c = new DateField("Calendar", new Date());
c.setDescription(
"DateField-component with calendar-style and day-resolution");
c
.setDescription("DateField-component with calendar-style and day-resolution");
c.setStyle("calendar");
c.setResolution(DateField.RESOLUTION_DAY);
(
(
AbstractComponentContainer) objectToConfigure)
.addComponent(
c);
((AbstractComponentContainer) objectToConfigure)
.addComponent(c);
}

// Select option group style
@@ -417,17 +406,15 @@ public class PropertyPanel
s.addItem("Symbian");
s.setStyle("optiongroup");

(
(
AbstractComponentContainer) objectToConfigure)
.addComponent(
s);
((AbstractComponentContainer) objectToConfigure)
.addComponent(s);
}

addComponent.setValue(null);
}
} else if (event.getProperty() == getField("lazyLoading")) {
boolean newValue = ((Boolean)event.getProperty().getValue()).booleanValue();
boolean newValue = ((Boolean) event.getProperty().getValue())
.booleanValue();
Field multiselect = getField("multiSelect");
Field newitems = getField("newItemsAllowed");
if (newValue) {
@@ -442,11 +429,13 @@ public class PropertyPanel
}
}

/** Helper function for creating forms from array of propety names.
/**
* Helper function for creating forms from array of propety names.
*/
protected Form createBeanPropertySet(String names[]) {

Form set = new Form(new GridLayout(COLUMNS, 1));
Form set = new Form(new OrderedLayout(
OrderedLayout.ORIENTATION_VERTICAL));

for (int i = 0; i < names.length; i++) {
Property p = config.getItemProperty(names[i]);
@@ -454,13 +443,13 @@ public class PropertyPanel
set.addItemProperty(names[i], p);
Field f = set.getField(names[i]);
if (f instanceof TextField) {
if (Integer.class.equals(p.getType()))
((TextField)f).setColumns(4);
if (Integer.class.equals(p.getType()))
((TextField) f).setColumns(4);
else {
((TextField)f).setNullSettingAllowed(true);
((TextField)f).setColumns(24);
((TextField) f).setNullSettingAllowed(true);
((TextField) f).setColumns(24);
}
}
}
}
}


+ 25
- 25
src/com/itmill/toolkit/demo/features/UIComponents.java View File

@@ -1,30 +1,30 @@
/* *************************************************************************
IT Mill Toolkit
Development of Browser User Interfaces Made Easy
Copyright (C) 2000-2006 IT Mill Ltd
*************************************************************************
This product is distributed under commercial license that can be found
from the product package on license.pdf. Use of this product might
require purchasing a commercial license from IT Mill Ltd. For guidelines
on usage, see licensing-guidelines.html
*************************************************************************
For more information, contact:
IT Mill Ltd phone: +358 2 4802 7180
Ruukinkatu 2-4 fax: +358 2 4802 7181
20540, Turku email: info@itmill.com
Finland company www: www.itmill.com
Primary source for information and releases: www.itmill.com
********************************************************************** */
IT Mill Toolkit
Development of Browser User Interfaces Made Easy
Copyright (C) 2000-2006 IT Mill Ltd
*************************************************************************
This product is distributed under commercial license that can be found
from the product package on license.pdf. Use of this product might
require purchasing a commercial license from IT Mill Ltd. For guidelines
on usage, see licensing-guidelines.html
*************************************************************************
For more information, contact:
IT Mill Ltd phone: +358 2 4802 7180
Ruukinkatu 2-4 fax: +358 2 4802 7181
20540, Turku email: info@itmill.com
Finland company www: www.itmill.com
Primary source for information and releases: www.itmill.com
********************************************************************** */

package com.itmill.toolkit.demo.features;


Loading…
Cancel
Save