aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/itmill/toolkit/demo/features/FeatureBrowser.java')
-rw-r--r--src/com/itmill/toolkit/demo/features/FeatureBrowser.java197
1 files changed, 103 insertions, 94 deletions
diff --git a/src/com/itmill/toolkit/demo/features/FeatureBrowser.java b/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
index bc65afe654..c267bfb596 100644
--- a/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
+++ b/src/com/itmill/toolkit/demo/features/FeatureBrowser.java
@@ -1,55 +1,60 @@
/* *************************************************************************
- IT Mill Toolkit
+ IT Mill Toolkit
- Development of Browser User Interfaces Made Easy
+ Development of Browser User Interfaces Made Easy
- Copyright (C) 2000-2006 IT Mill Ltd
-
- *************************************************************************
+ Copyright (C) 2000-2006 IT Mill Ltd
+
+ *************************************************************************
- This product is distributed under commercial license that can be found
- from the product package on license.pdf. Use of this product might
- require purchasing a commercial license from IT Mill Ltd. For guidelines
- on usage, see licensing-guidelines.html
+ This product is distributed under commercial license that can be found
+ from the product package on license.pdf. Use of this product might
+ require purchasing a commercial license from IT Mill Ltd. For guidelines
+ on usage, see licensing-guidelines.html
- *************************************************************************
-
- For more information, contact:
-
- IT Mill Ltd phone: +358 2 4802 7180
- Ruukinkatu 2-4 fax: +358 2 4802 7181
- 20540, Turku email: info@itmill.com
- Finland company www: www.itmill.com
-
- Primary source for information and releases: www.itmill.com
+ *************************************************************************
+
+ For more information, contact:
+
+ IT Mill Ltd phone: +358 2 4802 7180
+ Ruukinkatu 2-4 fax: +358 2 4802 7181
+ 20540, Turku email: info@itmill.com
+ Finland company www: www.itmill.com
+
+ Primary source for information and releases: www.itmill.com
- ********************************************************************** */
+ ********************************************************************** */
package com.itmill.toolkit.demo.features;
import java.util.Iterator;
import java.util.StringTokenizer;
-import quicktime.streaming.SettingsDialog;
-
import com.itmill.toolkit.data.*;
import com.itmill.toolkit.terminal.ClassResource;
import com.itmill.toolkit.ui.*;
-public class FeatureBrowser
- extends CustomComponent
- implements Property.ValueChangeListener {
+public class FeatureBrowser extends CustomComponent implements
+ Property.ValueChangeListener {
private Tree features;
+
private Feature currentFeature = null;
- private GridLayout layout;
+
+ private OrderedLayout layout;
+
+ private OrderedLayout right;
+
+ private PropertyPanel properties;
+
private Component welcome;
+
private boolean initialized = false;
+
private Select themeSelector = new Select("Theme");
- private static final String WELCOME_TEXT =
- "<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) {