diff options
53 files changed, 0 insertions, 4570 deletions
diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/favicon.ico b/WebContent/VAADIN/themes/tests-featurebrowser/favicon.ico Binary files differdeleted file mode 100644 index e58158c02c..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/favicon.ico +++ /dev/null diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/featurebrowser-mainlayout.html b/WebContent/VAADIN/themes/tests-featurebrowser/layouts/featurebrowser-mainlayout.html deleted file mode 100644 index 52eec9f64f..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/featurebrowser-mainlayout.html +++ /dev/null @@ -1,252 +0,0 @@ -<html> -<head> -<link REL="stylesheet" TYPE="text/css"> -</head> - -<body><div id="_UID_main" style="display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%;"><img src="img/header.png" /> - - <div id="_UID_features" style="top: 62px; width: 200px; position: absolute; overflow: auto; left: 0;" location="tree"> - <div style="width: 100%; height: 100%; border: 1px solid red;">tree</div> - </div> - - <div id="_UID_demo" style="overflow: auto; position: absolute; top: 62px; left: 215px; "> - <table width="100%" height="100%" cellspacing="0" cellpadding="0" - border="0"> - <tbody> - <tr> - <td valign="middle" align="center"> - <table style="width:100%" cellspacing="0" cellpadding="0" - border="0"> - <tbody> - <tr> - <td style="text-align: left;" location="demo"> - <div style="width: 100%; height: 100%; border: 1px solid red;">demo</div> - </td> - </tr> - </tbody> - </table> - </td> - </tr> - </tbody> - </table> - </div> - - <div id="_UID_tabs" style="overflow: hidden; position: absolute; left: 215px;" location="tabsheet"> - <div style="width: 100%; height: 100%; border: 1px solid red;">tabsheet</div> - </div> - - <img id="_UID_prop-toggle" src="img/show_properties.png" style=" top: 23px; position: absolute;"/> - - <div id="_UID_props" style="overflow: hidden; position: absolute; top: 23px; width: 0px;" location="properties"> - <div style="width: 100%; height: 100%; border: 1px solid red;">properties</div> - </div> - - <div id="_UID_cntr" - style="overflow: hidden; position: absolute; bottom: 10px; left: 0pt; width: 200px; height: 50px;"> - <table width="100%" height="100%" border="0"> - <tbody> - <tr> - <td width="50%" valign="middle" align="center" id="_UID_cntr-left" location="themes">themes</td> - <td width="50%" valign="middle" align="center" id="_UID_cntr-right" location="restart">restart</td> - </tr> - </tbody> - </table> - </div> - - <img id="_UID_divider" src="img/tab_handle.png" style="position: absolute;" /> - -</div> - - -<script type="text/javascript"> - -/** Recalculate tabs content width */ -_UID_updateTabs = function() { - try { - var tabsDiv = document.getElementById("_UID_tabs"); - var tabsComponent = itmill.themes.Demo.prototype._UID_elemByIndex(tabsDiv.childNodes,0); - if (tabsComponent == null) return; - var tabs = itmill.themes.Demo.prototype._UID_elemByIndex(tabsComponent.childNodes,0); - if (tabs == null) return; - var content = itmill.themes.Demo.prototype._UID_elemByIndex(tabsComponent.childNodes,1); - if (content == null) return; - content.style.height="" + (tabsDiv.offsetHeight - tabs.offsetHeight-13) + "px"; - content.style.borderBottom="0"; - content.style.overflow='auto'; - var iframe = content.getElementsByTagName("iframe").item(0); - if (iframe != null) { - content.style.overflow='hidden'; - content.style.padding='0'; - content.style.height="" + (tabsDiv.offsetHeight - tabs.offsetHeight) + "px"; - iframe.height=content.style.height; - iframe.style.border='0'; - } - } catch (e) {} -}; - -/** Helper method. Get element from node array by index */ -_UID_elemByIndex = function(nodeArray, index) { - if (typeof nodeArray == 'undefined' || nodeArray == null) return null; - var i=0; - while (index>=0 && i < nodeArray.length) { - while(i < nodeArray.length && nodeArray[i].nodeType != Node.ELEMENT_NODE) i++; - if (index == 0) return nodeArray[i]; - index--; i++; - } - return null; -} - -_UID_dividerUpdate = function() { - var dividerDiv = document.getElementById("_UID_divider"); - var div = document.getElementById("_UID_main"); - dividerDiv.isActive = true; - div.onmouseup = function() { - dividerDiv.isActive = false; - div.onmouseup = null; - div.onmousemove = null; - } - div.onmousemove = function(e) { - dividerDiv.mouseY = typeof e != 'undefined' ? e.clientY : window.event.clientY; - _UID_layout(); - } - return false; -}; - -/** Recalculate feature browser main layout dimensions for all components */ -_UID_layout = function() { - - // Then animations are needed, this will be reset to true - var animationNeeded = false; - - // References to all elements - var mainDiv = document.getElementById("_UID_main"); - if (mainDiv == null) { alert("maindiv is null"); return;} - var featuresDiv = document.getElementById("_UID_features"); - var demoDiv = document.getElementById("_UID_demo"); - var tabsDiv = document.getElementById("_UID_tabs"); - var propertiesDiv = document.getElementById("_UID_props"); - var controlDiv = document.getElementById("_UID_cntr"); - var dividerDiv = document.getElementById("_UID_divider"); - - // Logobar height - var logoBarHeight = 62; - - // Get whole window contents size - document.body.style.padding = 0; - document.body.style.margin = 0; - document.body.style.position = "absolute"; - document.body.style.height = "100%"; - document.body.style.width = "100%"; - var width = document.body.offsetWidth; - var height = document.body.offsetHeight; - mainDiv.style.height = height + "px"; - mainDiv.style.width = width + "px"; - mainDiv.style.display = ""; - - // Recalc features div dimensions - var featuresWidth = 200; - var controlHeight = 50; - featuresDiv.style.top="" + logoBarHeight + "px"; - featuresDiv.style.width="" + featuresWidth + "px"; - featuresDiv.style.height="" + (height-controlHeight-logoBarHeight) + "px"; - - // Recalc properties div dimensions - if (typeof propertiesDiv.targetWidth == 'undefined') propertiesDiv.targetWidth = 0; - var propWidth = Math.floor((propertiesDiv.offsetWidth + propertiesDiv.targetWidth)/2); - if (Math.abs(propWidth - propertiesDiv.targetWidth) <= 1) propWidth = propertiesDiv.targetWidth; - if (propWidth >width-featuresWidth) propWidth = width-featuresWidth; - if (propWidth < 0) propWidth = 0; - if ((propWidth+1) != (propertiesDiv.targetWidth+1)) animationNeeded=true; - var centerWidth = width - propWidth - featuresWidth - 40; - propertiesDiv.style.position="absolute"; - propertiesDiv.style.overflow="hidden"; - propertiesDiv.style.top="" + 23 + "px"; - propertiesDiv.style.left="" + (centerWidth + featuresWidth + 40) + "px"; - propertiesDiv.style.width=propWidth + "px"; - propertiesDiv.style.height="" + (height - 23) + "px"; - var buttonDiv = document.getElementById("_UID_prop-toggle"); - buttonDiv.style.left = "" + (centerWidth + featuresWidth - 20 + 40) + "px" - if (propWidth == 0) { //buttonDiv.src = buttonDiv.showPng; - buttonDiv.style.height = "92px"; } - if (propWidth == propertiesDiv.maxWidth) { //buttonDiv.src = buttonDiv.hidePng; - buttonDiv.style.height = "23px"; } - buttonDiv.onclick = function() { - var propertiesDiv = document.getElementById("_UID_props"); - propertiesDiv.targetWidth = propertiesDiv.targetWidth == 0 ? 265 : 0; - _UID_layout(); - }; - - // Recalc divider div dimensions - if (typeof dividerDiv.demoHeight == 'undefined') dividerDiv.demoHeight = Math.floor(height/2); - if (dividerDiv.isActive) { - dividerDiv.demoHeight = dividerDiv.mouseY-10 - logoBarHeight; - if (dividerDiv.demoHeight < 0) dividerDiv.demoHeight = 0; - } else { - if (dividerDiv.demoHeight + logoBarHeight > height - 20) dividerDiv.demoHeight = height - 20 - logoBarHeight; - if (dividerDiv.demoHeight < 0) dividerDiv.demoHeight = 0; - } - var dividerHeight = 17; - dividerDiv.style.position="absolute"; - dividerDiv.style.overflow="hidden"; - dividerDiv.style.top="" + (dividerDiv.demoHeight + logoBarHeight)+ "px"; - dividerDiv.style.left="" + (15+featuresWidth+Math.round((centerWidth-137)/2)) +"px"; - dividerDiv.style.width="" + 137 + "px"; - dividerDiv.style.height="" + dividerHeight + "px"; - - // Recalc tabs div dimensions - tabsDiv.style.position="absolute"; - tabsDiv.style.overflow="hidden"; - tabsDiv.style.top="" + (dividerDiv.demoHeight + dividerHeight + logoBarHeight) + "px"; - tabsDiv.style.left="" + (featuresWidth + 15) + "px"; - tabsDiv.style.width="" + centerWidth + "px"; - tabsDiv.style.height="" + (height - dividerDiv.demoHeight - dividerHeight - logoBarHeight) + "px"; - _UID_updateTabs(); - - // Recalc demo div dimensions - demoDiv.style.position="absolute"; - demoDiv.style.overflow="auto"; - demoDiv.style.top="" + logoBarHeight + "px"; - demoDiv.style.left="" + (featuresWidth + 15) + "px"; - demoDiv.style.width="" + centerWidth + "px"; - demoDiv.style.height="" + dividerDiv.demoHeight + "px"; - - // Recalc control div dimensions - // TODO, make floating - controlDiv.style.position="absolute"; - controlDiv.style.overflow="hidden"; - controlDiv.style.top="" + (height - controlHeight) + "px"; - controlDiv.style.left="0"; - controlDiv.style.width="" + featuresWidth + "px"; - controlDiv.style.height="" + controlHeight + "px"; - - if (animationNeeded) { - setTimeout("_UID_layout()",30); - } - - /* call custom layouts bridge to notify sub components */ - mainDiv.notifyChildrenOfSizeChange(); -}; - - -_UID_initFeatureBrowserLayout = function() { - var dividerDiv = document.getElementById("_UID_divider"); - if (dividerDiv == null) alert("no divider div"); - dividerDiv.isActive = false; - dividerDiv.onmousedown = _UID_dividerUpdate; - - var mainDiv = document.getElementById("_UID_main"); - - /* this will be called by custom layout when its containers size has changed */ - mainDiv.iLayoutJS = function() { - _UID_layout(); - }; - -// _UID_layout(); -}; - -_UID_initFeatureBrowserLayout(); - -</script> - -</body> -</html>
\ No newline at end of file diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/header.png b/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/header.png Binary files differdeleted file mode 100644 index bf64ac4e17..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/header.png +++ /dev/null diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/hide_properties.png b/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/hide_properties.png Binary files differdeleted file mode 100644 index 0069db75d9..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/hide_properties.png +++ /dev/null diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/m_bg.png b/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/m_bg.png Binary files differdeleted file mode 100644 index 2d37f7ffae..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/m_bg.png +++ /dev/null diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/show_properties.png b/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/show_properties.png Binary files differdeleted file mode 100644 index 6427452419..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/show_properties.png +++ /dev/null diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/tab_handle.png b/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/tab_handle.png Binary files differdeleted file mode 100644 index ed0c34cabb..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/layouts/img/tab_handle.png +++ /dev/null diff --git a/WebContent/VAADIN/themes/tests-featurebrowser/styles.css b/WebContent/VAADIN/themes/tests-featurebrowser/styles.css deleted file mode 100644 index f9a998c3ba..0000000000 --- a/WebContent/VAADIN/themes/tests-featurebrowser/styles.css +++ /dev/null @@ -1,8 +0,0 @@ -@import url(../runo/styles.css); - -body, html {
- background: #e9eced;
- margin: 0;
- padding: 0;
- height: 100%;
-}
\ No newline at end of file diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index d065ef00a3..41c4b963e5 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -160,15 +160,6 @@ </servlet>
<servlet>
- <servlet-name>FeaturesApplication</servlet-name>
- <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
- <init-param>
- <param-name>application</param-name>
- <param-value>com.vaadin.tests.featurebrowser.FeaturesApplication</param-value>
- </init-param>
- </servlet>
-
- <servlet>
<servlet-name>Parameters</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
@@ -321,11 +312,6 @@ </servlet-mapping>
<servlet-mapping>
- <servlet-name>FeaturesApplication</servlet-name>
- <url-pattern>/FeaturesApplication/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
<servlet-name>Parameters</servlet-name>
<url-pattern>/Parameters/*</url-pattern>
</servlet-mapping>
diff --git a/build/build.xml b/build/build.xml index 7090e3a198..f4e5a9ea1b 100644 --- a/build/build.xml +++ b/build/build.xml @@ -550,8 +550,6 @@ <!-- TODO check what is necessary --> <!-- These are needed for running tests, but are copied during testing. --> <exclude name="VAADIN/themes/tests*"/> - <exclude name="VAADIN/themes/tests-magi/**/*" /> - <exclude name="VAADIN/themes/tests-featurebrowser/**/*" /> <exclude name="VAADIN/themes/tests*/**/*"/> <include name="demo/**/*" /> diff --git a/tests/src/com/vaadin/tests/featurebrowser/Feature.java b/tests/src/com/vaadin/tests/featurebrowser/Feature.java deleted file mode 100644 index 01ad8934fc..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/Feature.java +++ /dev/null @@ -1,197 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.Resource; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.VerticalLayout; - -public abstract class Feature extends CustomComponent { - - private static final String PROP_REMINDER_TEXT = "" - + "<br /><br />Note: Use <b>Properties</b> panel located at the top" - + " right corner to try out how different properties affect" - + " the presentation or functionality of currently selected component."; - - private boolean propsReminder = true; - - private final VerticalLayout layout; - - private TabSheet ts; - - private boolean initialized = false; - - private static Resource sampleIcon; - - protected PropertyPanel propertyPanel; - - private Label javadoc; - - private Label description; - - /** Constuctor for the feature component */ - public Feature() { - layout = new VerticalLayout(); - setCompositionRoot(layout); - } - - /** - * Actual URL consists of "http://www.vaadin.com/api/com/vaadin/"+url - * - * @param url - */ - public void setJavadocURL(String url) { - javadoc.setValue("<iframe width=\"100%\" src=\"http://www.vaadin.com/api/com/vaadin/" - + url + "\"></iframe>"); - } - - /** - * Feature component initialization is lazily done when the feature is - * attached to application - */ - @Override - public void attach() { - super.attach(); - - // Check if the feature is already initialized - if (initialized) { - return; - } - initialized = true; - - // Javadoc - javadoc = new Label(); - javadoc.setContentMode(Label.CONTENT_XHTML); - - // Demo - final Component demo = getDemoComponent(); - if (demo != null) { - layout.addComponent(demo); - } - - ts = new TabSheet(); - - ts.setSizeFull(); - - // Description tab - final String title = getTitle(); - if (getDescriptionXHTML() != null) { - final VerticalLayout mainLayout = new VerticalLayout(); - final HorizontalLayout layout = new HorizontalLayout(); - mainLayout.addComponent(layout); - if (getImage() != null) { - layout.addComponent(new Embedded("", new ClassResource( - getImage(), getApplication()))); - } - String label = ""; - label += getDescriptionXHTML(); - if (propsReminder) { - label += PROP_REMINDER_TEXT; - } - if (title != null) { - layout.addComponent(new Label("<h3>" + title + "</h3>", - Label.CONTENT_XHTML)); - } - description = new Label(label, Label.CONTENT_XHTML); - mainLayout.addComponent(description); - mainLayout.setMargin(true); - - ts.addTab(mainLayout, "Description", null); - } - - // Properties table tab - ts.addTab(getPropertyPanel().getAllProperties(), "Properties", null); - - // Javadoc tab - if (!javadoc.getValue().equals("")) { - ts.addTab(javadoc, "Javadoc", null); - } - - // Code Sample tab - final String example = getExampleSrc(); - if (example != null) { - final VerticalLayout l = new VerticalLayout(); - if (getTitle() != null) { - l.addComponent(new Label( - "<b>// " + getTitle() + " example</b>", - Label.CONTENT_XHTML)); - } - l.addComponent(new Label(example, Label.CONTENT_PREFORMATTED)); - ts.addTab(l, "Code Sample", null); - } - - } - - /** Get the desctiption of the feature as XHTML fragment */ - protected String getDescriptionXHTML() { - return "<h2>Feature description is under construction</h2>"; - } - - /** Get the title of the feature */ - protected String getTitle() { - return getClass().getName(); - } - - public TabSheet getTabSheet() { - return ts; - } - - /** Get the name of the image file that will be put on description page */ - protected String getImage() { - return null; - } - - /** Get the example application source code */ - protected String getExampleSrc() { - return null; - } - - /** Get the feature demo component */ - protected Component getDemoComponent() { - return null; - } - - /** Get sample icon resource */ - protected Resource getSampleIcon() { - if (sampleIcon == null) { - sampleIcon = new ClassResource("m.gif", getApplication()); - } - return sampleIcon; - } - - public PropertyPanel getPropertyPanel() { - return propertyPanel; - } - - public void setPropsReminder(boolean propsReminder) { - this.propsReminder = propsReminder; - } - - public void updateDescription() { - String label = ""; - label += getDescriptionXHTML(); - if (propsReminder) { - label += PROP_REMINDER_TEXT; - } - description.setValue(label); - } - - // Fix for #512 - @Override - public String getDescription() { - if (description != null && description.getValue() != null) { - return description.getValue().toString(); - } else { - return null; - } - } - -}
\ No newline at end of file diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureBrowser.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureBrowser.java deleted file mode 100644 index 2f1e111b99..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureBrowser.java +++ /dev/null @@ -1,355 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.util.Iterator; -import java.util.StringTokenizer; - -import com.vaadin.data.Property; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Select; -import com.vaadin.ui.Tree; - -public class FeatureBrowser extends CustomComponent implements - Property.ValueChangeListener, ClickListener, Layout { - - private Tree features; - - private Feature currentFeature = null; - - private CustomLayout mainlayout; - - private PropertyPanel properties; - - private boolean initialized = false; - - private final Select themeSelector = new Select(); - - @Override - public void attach() { - - if (initialized) { - return; - } - initialized = true; - - // Configure tree - features = new Tree(); - features.addContainerProperty("name", String.class, ""); - features.addContainerProperty("feature", Feature.class, null); - features.setItemCaptionPropertyId("name"); - features.addListener(this); - features.setImmediate(true); - features.setStyleName("menu"); - - // Configure component layout - mainlayout = new CustomLayout("featurebrowser-mainlayout"); - setCompositionRoot(mainlayout); - mainlayout.addComponent(features, "tree"); - - // Theme selector - mainlayout.addComponent(themeSelector, "themes"); - themeSelector.addItem("tests-featurebrowser"); - - themeSelector.addListener(this); - themeSelector.select("tests-featurebrowser"); - themeSelector.setImmediate(true); - - // Restart button - final Button close = new Button("restart", getApplication(), "close"); - close.setStyleName("link"); - mainlayout.addComponent(close, "restart"); - - // Test component - registerFeature("/Welcome", new IntroWelcome()); - registerFeature("/UI Components", new IntroComponents()); - registerFeature("/UI Components/Basic", new IntroBasic()); - registerFeature("/UI Components/Basic/Text Field", - new FeatureTextField()); - registerFeature("/UI Components/Basic/Date Field", - new FeatureDateField()); - registerFeature("/UI Components/Basic/Button", new FeatureButton()); - registerFeature("/UI Components/Basic/Form", new FeatureForm()); - registerFeature("/UI Components/Basic/Label", new FeatureLabel()); - registerFeature("/UI Components/Basic/Link", new FeatureLink()); - registerFeature("/UI Components/Item Containers", - new IntroItemContainers()); - registerFeature("/UI Components/Item Containers/Select", - new FeatureSelect()); - registerFeature("/UI Components/Item Containers/Table", - new FeatureTable()); - registerFeature("/UI Components/Item Containers/Tree", - new FeatureTree()); - registerFeature("/UI Components/Layouts", new IntroLayouts()); - registerFeature("/UI Components/Layouts/Ordered Layout", - new FeatureOrderedLayout()); - registerFeature("/UI Components/Layouts/Grid Layout", - new FeatureGridLayout()); - registerFeature("/UI Components/Layouts/Custom Layout", - new FeatureCustomLayout()); - registerFeature("/UI Components/Layouts/Panel", new FeaturePanel()); - registerFeature("/UI Components/Layouts/Tab Sheet", - new FeatureTabSheet()); - registerFeature("/UI Components/Layouts/Window", new FeatureWindow()); - // Disabled for now - // registerFeature("/UI Components/Layouts/Frame Window", - // new FeatureFrameWindow()); - registerFeature("/UI Components/Data handling", new IntroDataHandling()); - registerFeature("/UI Components/Data handling/Embedded Objects", - new FeatureEmbedded()); - registerFeature("/UI Components/Data handling/Upload", - new FeatureUpload()); - registerFeature("/Data Model", new IntroDataModel()); - registerFeature("/Data Model/Properties", new FeatureProperties()); - registerFeature("/Data Model/Items", new FeatureItems()); - registerFeature("/Data Model/Containers", new FeatureContainers()); - registerFeature("/Data Model/Validators", new FeatureValidators()); - registerFeature("/Data Model/Buffering", new FeatureBuffering()); - // registerFeature("/Terminal", new IntroTerminal()); - // registerFeature("/Terminal/Parameters and URI Handling", - // new FeatureParameters()); - - // Pre-open all menus - for (final Iterator<?> i = features.getItemIds().iterator(); i - .hasNext();) { - features.expandItem(i.next()); - } - - // Add demo component and tabs - currentFeature = new IntroWelcome(); - mainlayout.addComponent(currentFeature, "demo"); - mainlayout.addComponent(currentFeature.getTabSheet(), "tabsheet"); - - // Add properties - properties = currentFeature.getPropertyPanel(); - mainlayout.addComponent(properties, "properties"); - } - - public void registerFeature(String path, Feature feature) { - final StringTokenizer st = new StringTokenizer(path, "/"); - String id = ""; - String parentId = null; - while (st.hasMoreTokens()) { - final String token = st.nextToken(); - id += "/" + token; - if (!features.containsId(id)) { - features.addItem(id); - features.setChildrenAllowed(id, false); - } - features.getContainerProperty(id, "name").setValue(token); - if (parentId != null) { - features.setChildrenAllowed(parentId, true); - features.setParent(id, parentId); - } - if (!st.hasMoreTokens()) { - features.getContainerProperty(id, "feature").setValue(feature); - } - parentId = id; - } - } - - public void valueChange(Property.ValueChangeEvent event) { - - // FIXME: navigation statistics - try { - if ((event.getProperty().toString() == null) - && (event.getProperty() instanceof Tree)) { - // ignore tree initialization - } else { - FeatureUtil.debug( - getApplication().getUser().toString(), - "valueChange " - + event.getProperty().getClass() - .getSimpleName() + ", " - + event.getProperty()); - } - } catch (final Exception e) { - // ignored, should never happen - } - - // Change feature - if (event.getProperty() == features) { - final Object id = features.getValue(); - if (id != null) { - if (features.areChildrenAllowed(id)) { - features.expandItem(id); - } - final Property p = features.getContainerProperty(id, "feature"); - final Feature feature = p != null ? ((Feature) p.getValue()) - : null; - if (feature != null) { - mainlayout.removeComponent(currentFeature); - mainlayout.removeComponent(currentFeature.getTabSheet()); - mainlayout.addComponent(feature, "demo"); - mainlayout.addComponent(feature.getTabSheet(), "tabsheet"); - currentFeature = feature; - properties = feature.getPropertyPanel(); - if (properties != null) { - mainlayout.addComponent(properties, "properties"); - } - getWindow() - .setCaption( - "Vaadin Features / " - + features.getContainerProperty(id, - "name")); - } - } - } else if (event.getProperty() == themeSelector) { - getApplication().setTheme(themeSelector.toString()); - } - } - - public void buttonClick(ClickEvent event) { - // FIXME: navigation statistics - try { - FeatureUtil.debug(getApplication().getUser().toString(), - "buttonClick " - + event.getButton().getClass().getSimpleName() - + ", " + event.getButton().getCaption() + ", " - + event.getButton().getValue()); - } catch (final Exception e) { - // ignored, should never happen - } - - } - - @Override - public void addComponent(Component c) { - // TODO Auto-generated method stub - - } - - @Override - public void addListener(ComponentAttachListener listener) { - // TODO Auto-generated method stub - - } - - @Override - public void addListener(ComponentDetachListener listener) { - // TODO Auto-generated method stub - - } - - @Override - public Iterator<Component> getComponentIterator() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void moveComponentsFrom(ComponentContainer source) { - // TODO Auto-generated method stub - - } - - @Override - public void removeAllComponents() { - // TODO Auto-generated method stub - - } - - @Override - public void removeComponent(Component c) { - // TODO Auto-generated method stub - - } - - @Override - public void removeListener(ComponentAttachListener listener) { - // TODO Auto-generated method stub - - } - - @Override - public void removeListener(ComponentDetachListener listener) { - // TODO Auto-generated method stub - - } - - @Override - public void replaceComponent(Component oldComponent, Component newComponent) { - // TODO Auto-generated method stub - - } - - public void setMargin(boolean enabled) { - // TODO Auto-generated method stub - - } - - public void setMargin(boolean top, boolean right, boolean bottom, - boolean left) { - // TODO Auto-generated method stub - - } - - @Override - public float getHeight() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getHeightUnits() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getWidth() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getWidthUnits() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void setHeight(float height) { - // TODO Auto-generated method stub - - } - - @Override - public void setHeightUnits(int units) { - // TODO Auto-generated method stub - - } - - @Override - public void setSizeFull() { - // TODO Auto-generated method stub - - } - - @Override - public void setSizeUndefined() { - // TODO Auto-generated method stub - - } - - @Override - public void setWidth(float width) { - // TODO Auto-generated method stub - - } - - @Override - public void setWidthUnits(int units) { - // TODO Auto-generated method stub - - } -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureBuffering.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureBuffering.java deleted file mode 100644 index 7428f8d8d5..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureBuffering.java +++ /dev/null @@ -1,93 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureBuffering extends Feature { - - private static final String INTRO_TEXT = "" - + "Vaadin data model provides interface for implementing " - + "buffering in data components. The basic idea is that a component " - + "reading their state from data source can implement " - + "Buffered-interface, for storing the value internally. " - + "Buffering provides transactional access " - + "for setting data: data can be put to a component's buffer and " - + "afterwards committed to or discarded by re-reding it from the data source. " - + "The buffering can be used for creating interactive interfaces " - + "as well as caching the data for performance reasons." - + "<br /><br />Buffered interface contains methods for committing and discarding " - + "changes to an object and support for controlling buffering mode " - + "with read-through and write-through modes. " - + "Read-through mode means that the value read from the buffered " - + "object is constantly up to date with the data source. " - + "Respectively the write-through mode means that all changes to the object are " - + "immediately updated to the data source."; - - public FeatureBuffering() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - final Panel panel = new Panel(); - panel.setCaption("Buffering"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/Buffered.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureButton.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureButton.java deleted file mode 100644 index 7dc3be661a..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureButton.java +++ /dev/null @@ -1,73 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureButton extends Feature { - - public FeatureButton() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Button b = new Button("Caption"); - l.addComponent(b); - - // Properties - propertyPanel = new PropertyPanel(b); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("link") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("link"); - final Form ap = propertyPanel - .createBeanPropertySet(new String[] { "switchMode" }); - propertyPanel.addProperties("Button Properties", ap); - - setJavadocURL("ui/Button.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "Button b = new Button(\"Caption\");\n"; - - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return "In Vaadin, 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."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Button"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureContainers.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureContainers.java deleted file mode 100644 index 5d4b09e722..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureContainers.java +++ /dev/null @@ -1,96 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureContainers extends Feature { - - private static final String INTRO_TEXT = "" - + "Container is the most advanced of the data " - + "model supported by Vaadin. It provides a very flexible " - + "way of managing set of items that share common properties. Each " - + "item is identified by an item id. " - + "Properties can be requested from container with item " - + "and property ids. Other way of accessing properties is to first " - + "request an item from container and then request its properties " - + "from it." - + "<br /><br />Container interface was designed with flexibility and " - + "efficiency in mind. It contains inner interfaces for ordering " - + "the items sequentially, indexing the items and accessing them " - + "hierarchically. Those ordering models provide basis for " - + "Table, Tree and Select UI components. As with other data " - + "models, the containers support events for notifying about the " - + "changes." - + "<br /><br />Set of utilities for converting between container models by " - + "adding external indexing or hierarchy into existing containers. " - + "In memory containers implementing indexed and hierarchical " - + "models provide easy to use tools for setting up in memory data " - + "storages. There is even a hierarchical container for direct " - + "file system access."; - - public FeatureContainers() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Containers"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/Container.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureCustomLayout.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureCustomLayout.java deleted file mode 100644 index 02e29f8ee3..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureCustomLayout.java +++ /dev/null @@ -1,84 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureCustomLayout extends Feature { - - private static final String INTRO_TEXT = "" - + "A container component with freely designed layout and style. The " - + "container consists of items with textually represented locations. Each " - + "item contains one sub-component. The adapter and theme are resposible " - + "for rendering the layout with given style by placing the items on the " - + "screen in defined locations." - + "<br /><br />The definition of locations is not fixed - the each style can define its " - + "locations in a way that is suitable for it. One typical example would be " - + "to create visual design for a website as a custom layout: the visual design " - + "could define locations for \"menu\", \"body\" and \"title\" for example. " - + "The layout would then be implemented e.g. as plain HTML file." - + "<br /><br />The default theme handles the styles that are not defined by just drawing " - + "the subcomponents with flowlayout."; - - @Override - protected Component getDemoComponent() { - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Custom Layout"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("ui/CustomLayout.html"); - - return l; - } - - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getExampleSrc() { - return "CustomLayout c = new CustomLayout(\"mystyle\");\n" - + "c.addComponent(new Label(\"Example description\"),\"label1-location\");\n" - + "c.addComponent(new Button(\"Example action\"),\"example-action-location\");\n"; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return "Custom Layout"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureDateField.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureDateField.java deleted file mode 100644 index ca81581153..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureDateField.java +++ /dev/null @@ -1,107 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.util.Locale; - -import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureDateField extends Feature { - - static private String[] localeNames; - static { - final Locale[] locales = Locale.getAvailableLocales(); - localeNames = new String[locales.length]; - for (int i = 0; i < locales.length; i++) { - localeNames[i] = locales[i].getDisplayName(); - } - } - - public FeatureDateField() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - l.addComponent(new Label("Your default locale is: " - + getApplication().getLocale().toString().replace('_', '-'))); - - final DateField df = new DateField(); - df.setValue(new java.util.Date()); - l.addComponent(df); - - // Properties - propertyPanel = new PropertyPanel(df); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "resolution", "locale" }); - ap.replaceWithSelect("resolution", new Object[] { - new Integer(DateField.RESOLUTION_YEAR), - new Integer(DateField.RESOLUTION_MONTH), - new Integer(DateField.RESOLUTION_DAY), - new Integer(DateField.RESOLUTION_HOUR), - new Integer(DateField.RESOLUTION_MIN), - new Integer(DateField.RESOLUTION_SEC), - new Integer(DateField.RESOLUTION_MSEC) }, new Object[] { - "Year", "Month", "Day", "Hour", "Minute", "Second", - "Millisecond" }); - ap.replaceWithSelect("locale", Locale.getAvailableLocales(), - localeNames); - ap.getField("resolution").setValue( - new Integer(DateField.RESOLUTION_DAY)); - ap.getField("locale").setValue(Locale.getDefault()); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("text") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("text"); - themes.addItem("calendar") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("calendar"); - propertyPanel.addProperties("DateField Properties", ap); - - setJavadocURL("ui/DateField.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "DateField df = new DateField(\"Caption\");\n" - + "df.setValue(new java.util.Date());\n"; - } - - @Override - protected String getDescriptionXHTML() { - return "Representing Dates and times and providing a way to select " - + "or enter some specific date and/or time is an typical need in " - + "data-entry user interfaces (UI). Vaadin provides a DateField " - + "component that is intuitive to use and yet controllable through " - + "its properties." - + "<br /><br />The calendar-style allows point-and-click selection " - + "of dates while text-style shows only minimalistic user interface." - + " Validators may be bound to the component to check and " - + "validate the given input." - + "<br /><br />On the demo tab you can try out how the different properties affect the " - + "presentation of the component."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "DateField"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureEmbedded.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureEmbedded.java deleted file mode 100644 index 8edaecee6d..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureEmbedded.java +++ /dev/null @@ -1,95 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.terminal.ClassResource; -import com.vaadin.ui.Component; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Form; -import com.vaadin.ui.VerticalLayout; - -public class FeatureEmbedded extends Feature { - - public FeatureEmbedded() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final ClassResource flashResource = new ClassResource( - "vaadin_spin.swf", getApplication()); - final Embedded emb = new Embedded("Embedded Caption", flashResource); - emb.setType(Embedded.TYPE_OBJECT); - emb.setMimeType("application/x-shockwave-flash"); - emb.setWidth("250px"); - emb.setHeight("100px"); - l.addComponent(emb); - - // Properties - propertyPanel = new PropertyPanel(emb); - final 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" }); - final Object[] units = new Object[Embedded.UNIT_SYMBOLS.length]; - final Object[] symbols = new Object[Embedded.UNIT_SYMBOLS.length]; - for (int i = 0; i < units.length; i++) { - units[i] = new Integer(i); - symbols[i] = Embedded.UNIT_SYMBOLS[i]; - } - ap.replaceWithSelect("heightUnits", units, symbols); - ap.replaceWithSelect("widthUnits", units, symbols); - ap.replaceWithSelect("source", new Object[] { flashResource }, - new Object[] { "vaadin_spin.swf" }); - propertyPanel.addProperties("Embedded Properties", ap); - propertyPanel.getField("standby").setDescription( - "The text to display while loading the object."); - propertyPanel.getField("codebase").setDescription( - "root-path used to access resources with relative paths."); - propertyPanel.getField("codetype").setDescription( - "MIME-type of the code."); - propertyPanel - .getField("classId") - .setDescription( - "Unique object id. This can be used for example to identify windows components."); - - setJavadocURL("ui/Embedded.html"); - - return l; - } - - @Override - 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()));"; - } - - @Override - protected String getDescriptionXHTML() { - return "The embedding feature allows for adding images, multimedia and other non-specified " - + "content to your application. " - + "The feature has provisions for embedding both applets and Active X controls. " - + "Actual support for embedded media types is left to the terminal."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Embedded"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureForm.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureForm.java deleted file mode 100644 index 0bb0a02530..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureForm.java +++ /dev/null @@ -1,179 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.util.Date; - -import com.vaadin.data.Property; -import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Form; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; - -public class FeatureForm extends Feature implements - Property.ValueChangeListener { - - VerticalLayout demo = null; - - Form test; - - Layout formLayout = null; - - Select addField = new Select("Add field"); - - Select resetLayout = new Select("Restart"); - - @Override - protected Component getDemoComponent() { - - if (demo == null) { - demo = new VerticalLayout(); - createDemo(); - } - - setJavadocURL("ui/Form.html"); - - return demo; - } - - private void createDemo() { - - demo.removeAllComponents(); - - // Test form - if (formLayout == null) { - test = new Form(); - } else { - test = new Form(formLayout); - } - - demo.addComponent(test); - final HorizontalLayout actions = new HorizontalLayout(); - demo.addComponent(actions); - - // form adder - addField.setImmediate(true); - addField.addItem("Add field"); - addField.setNullSelectionItemId("Add field"); - addField.addItem("Text field"); - addField.addItem("Time"); - addField.addItem("Option group"); - addField.addItem("Calendar"); - addField.addListener(this); - actions.addComponent(addField); - - // Layout reset - resetLayout.setImmediate(true); - resetLayout.addItem("Select layout example"); - resetLayout.setNullSelectionItemId("Select layout example"); - resetLayout.addItem("Vertical form (OrderedLayout form-style)"); - resetLayout.addItem("Two columns (2x1 GridLayout)"); - resetLayout.addItem("Flow (OrderedLayout flow-orientation)"); - resetLayout.addListener(this); - actions.addComponent(resetLayout); - - // Properties - propertyPanel = new PropertyPanel(test); - propertyPanel.addProperties("Form special properties", new Form()); - } - - public void valueChange(Property.ValueChangeEvent event) { - - if (event.getProperty() == resetLayout) { - - final String value = (String) resetLayout.getValue(); - - if (value != null) { - formLayout = null; - - if (value.equals("Two columns (2x1 GridLayout)")) { - formLayout = new GridLayout(2, 1); - } - if (value.equals("Horizontal (OrderedLayout)")) { - formLayout = new HorizontalLayout(); - } - - createDemo(); - resetLayout.setValue(null); - } - } - - if (event.getProperty() == addField) { - - final String value = (String) addField.getValue(); - - if (value != null) { - if (value.equals("Text field")) { - test.addField(new Object(), new TextField("Test field")); - } - if (value.equals("Time")) { - final DateField d = new DateField("Time", new Date()); - d.setDescription("This is a DateField-component with text-style"); - d.setResolution(DateField.RESOLUTION_MIN); - d.setStyleName("text"); - test.addField(new Object(), d); - } - if (value.equals("Calendar")) { - final DateField c = new DateField("Calendar", new Date()); - c.setDescription("DateField-component with calendar-style and day-resolution"); - c.setStyleName("calendar"); - c.setResolution(DateField.RESOLUTION_DAY); - test.addField(new Object(), c); - } - if (value.equals("Option group")) { - final Select s = new Select("Options"); - s.setDescription("Select-component with optiongroup-style"); - s.addItem("Linux"); - s.addItem("Windows"); - s.addItem("Solaris"); - s.addItem("Symbian"); - s.setStyleName("optiongroup"); - - test.addField(new Object(), s); - } - - addField.setValue(null); - } - } - } - - @Override - protected String getDescriptionXHTML() { - return "Form is a flexible, yet simple container for fields. " - + " It provides support for any layouts and provides buffering interface for" - + " easy connection of commit- and discard buttons. All the form" - + " fields can be customized by adding validators, setting captions and icons, " - + " setting immediateness, etc. Also direct mechanism for replacing existing" - + " fields with selections is given." - + " <br /><br />Form provides customizable editor for classes implementing" - + " Item-interface. Also the form itself" - + " implements this interface for easier connectivity to other items." - + " To use the form as editor for an item, just connect the item to" - + " form.After the item has been connected to the form," - + " the automatically created fields can be customized and new fields can" - + " be added. If you need to connect a class that does not implement" - + " Item-interface, most properties of any" - + " class following bean pattern, can be accessed trough" - + " BeanItem." - + " <br /><br />The best example of Form usage is the this feature browser itself; " - + " all the Property-panels in demos are composed of Form-components."; - } - - @Override - protected String getTitle() { - return "Form"; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureGridLayout.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureGridLayout.java deleted file mode 100644 index 4573b13248..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureGridLayout.java +++ /dev/null @@ -1,79 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.util.Date; - -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Form; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; - -public class FeatureGridLayout extends Feature { - - public FeatureGridLayout() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final GridLayout gl = new GridLayout(3, 3); - final DateField cal = new DateField("Test component 1", new Date()); - cal.setStyleName("calendar"); - gl.addComponent(cal, 1, 0, 2, 1); - for (int i = 2; i < 7; i++) { - gl.addComponent(new TextField("Test component " + i)); - } - l.addComponent(gl); - - // Properties - propertyPanel = new PropertyPanel(gl); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - ap.addField("new line", new Button("New Line", gl, "newLine")); - ap.addField("space", new Button("Space", gl, "space")); - propertyPanel.addProperties("GridLayout Features", ap); - - setJavadocURL("ui/GridLayout.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "GridLayout gl = new GridLayout(2,2);\n" - + "gl.addComponent(new Label(\"Label 1 in GridLayout\"));\n" - + "gl.addComponent(new Label(\"Label 2 in GridLayout\"));\n" - + "gl.addComponent(new Label(\"Label 3 in GridLayout\"));\n" - + "gl.addComponent(new Label(\"Label 4 in GridLayout\"));\n"; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return "This feature provides a container that lays out components " - + "into a grid of given width and height." - + "<br /><br />On the demo tab you can try out how the different " - + "properties affect the presentation of the component."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "GridLayout"; - } -}
\ No newline at end of file diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureItems.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureItems.java deleted file mode 100644 index e577861a49..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureItems.java +++ /dev/null @@ -1,89 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureItems extends Feature { - - private static final String INTRO_TEXT = "" - + "Item is an object, which contains a set of named " - + "properties. Each property is identified by an " - + "id and a reference to the property can be queried from the Item. " - + "Item defines inner-interfaces for maintaining the item property " - + "set and listening the item property set changes." - + "<br /><br />Items generally represent objects in the object-oriented " - + "model, but with the exception that they are configurable " - + "and provide an event mechanism. The simplest way of utilizing " - + "Item interface is to use existing Item implementations. " - + "Provided utility classes include configurable property set," - + " bean to item adapter and Form UI component."; - - public FeatureItems() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Items"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/Item.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Introduction of Data Model Item"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureLabel.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureLabel.java deleted file mode 100644 index 01d30f74e9..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureLabel.java +++ /dev/null @@ -1,77 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; - -public class FeatureLabel extends Feature { - - public FeatureLabel() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Label lab = new Label("Label text"); - l.addComponent(lab); - - // Properties - propertyPanel = new PropertyPanel(lab); - final 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_XHTML), - new Integer(Label.CONTENT_XML) }, new Object[] { - "Preformatted", "Text", "XHTML Fragment(Must be valid)", - "XML (Subtree with namespace)" }); - propertyPanel.addProperties("Label Properties", ap); - - setJavadocURL("ui/Label.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "Label l = new Label(\"Caption\");\n"; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - 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."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Label"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureLink.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureLink.java deleted file mode 100644 index 74e7eed7cf..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureLink.java +++ /dev/null @@ -1,68 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Link; -import com.vaadin.ui.VerticalLayout; - -public class FeatureLink extends Feature { - - public FeatureLink() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Link lnk = new Link("Link caption", new ExternalResource( - "http://www.vaadin.com")); - l.addComponent(lnk); - - // Properties - propertyPanel = new PropertyPanel(lnk); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "targetName", "targetWidth", "targetHeight", "targetBorder" }); - ap.replaceWithSelect("targetBorder", new Object[] { - new Integer(Link.TARGET_BORDER_DEFAULT), - new Integer(Link.TARGET_BORDER_MINIMAL), - new Integer(Link.TARGET_BORDER_NONE) }, new Object[] { - "Default", "Minimal", "None" }); - propertyPanel.addProperties("Link Properties", ap); - - setJavadocURL("ui/Link.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "Link link = new Link(\"Link caption\",new ExternalResource(\"http://www.vaadin.com\"));\n"; - } - - @Override - 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."; - - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Link"; - } -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureOrderedLayout.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureOrderedLayout.java deleted file mode 100644 index 06ab57f6ec..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureOrderedLayout.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; - -public class FeatureOrderedLayout extends Feature { - - public FeatureOrderedLayout() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final VerticalLayout ol = new VerticalLayout(); - for (int i = 1; i < 5; i++) { - ol.addComponent(new TextField("Test component " + i)); - } - l.addComponent(ol); - - // Properties - propertyPanel = new PropertyPanel(ol); - // final Form ap = propertyPanel.createBeanPropertySet(new String[] { - // "orientation" }); - // ap.replaceWithSelect("orientation", new Object[] { new - // Integer(AbstractOrderedLayout.ORIENTATION_HORIZONTAL), new - // Integer(AbstractOrderedLayout.ORIENTATION_VERTICAL) }, new Object[] { - // "Horizontal", "Vertical" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("form") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("form"); - // propertyPanel.addProperties("OrderedLayout Properties", ap); - - setJavadocURL("ui/OrderedLayout.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "OrderedLayout ol = new OrderedLayout(AbstractOrderedLayout.ORIENTATION_FLOW);\n" - + "ol.addComponent(new TextField(\"Textfield caption\"));\n" - + "ol.addComponent(new Label(\"Label\"));\n"; - - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return "This feature provides a container for laying out components either " - + "vertically, horizontally or flowingly. The orientation may be changed " - + "during runtime. It also defines a special style for themes to implement called \"form\"" - + "that is used for input forms where the components are laid-out side-by-side " - + "with their captions." - + "<br /><br />" - + "On the demo tab you can try out how the different properties " - + "affect the presentation of the component."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "OrderedLayout"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeaturePanel.java b/tests/src/com/vaadin/tests/featurebrowser/FeaturePanel.java deleted file mode 100644 index d1e1258e27..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeaturePanel.java +++ /dev/null @@ -1,74 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeaturePanel extends Feature { - - public FeaturePanel() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - // Example panel - final Panel show = new Panel("Panel caption"); - show.addComponent(new Label( - "This is an example Label component that is added into Panel.")); - l.addComponent(show); - - // Properties - propertyPanel = new PropertyPanel(show); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("ui/Panel.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "Panel show = new Panel(\"Panel caption\");\n" - + "show.addComponent(new Label(\"This is an example Label component that is added into Panel.\"));"; - - } - - @Override - protected String getDescriptionXHTML() { - return "Panel is a container for other components, by default it draws a frame around it's " - + "extremities and may have a caption to clarify the nature of the contained components' purpose." - + " Panel contains an layout where the actual contained components are added, " - + "this layout may be switched on the fly."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Panel"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureParameters.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureParameters.java deleted file mode 100644 index f37be2c372..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureParameters.java +++ /dev/null @@ -1,170 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.net.URL; -import java.util.Iterator; -import java.util.Map; - -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.terminal.ParameterHandler; -import com.vaadin.terminal.URIHandler; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; - -public class FeatureParameters extends Feature implements URIHandler, - ParameterHandler { - - private final Label context = new Label(); - - private final Label relative = new Label(); - - private final Table params = new Table(); - - public FeatureParameters() { - super(); - params.addContainerProperty("Values", String.class, ""); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final 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 { - final URL u1 = new URL(getApplication().getURL(), - "test/uri?test=1&test=2"); - final URL u2 = new URL(getApplication().getURL(), - "foo/bar?mary=john&count=3"); - - l.addComponent(new Link(u1.toString(), new ExternalResource(u1))); - l.addComponent(new Label("Or this: ")); - l.addComponent(new Link(u2.toString(), new ExternalResource(u2))); - } catch (final Exception e) { - System.out.println("Couldn't get hostname for this machine: " - + e.toString()); - e.printStackTrace(); - } - - // URI - final Panel p1 = new Panel("URI Handler"); - context.setCaption("Last URI handler context"); - p1.addComponent(context); - relative.setCaption("Last relative URI"); - p1.addComponent(relative); - l.addComponent(p1); - - // Parameters - final Panel p2 = new Panel("Parameter Handler"); - params.setCaption("Last parameters"); - params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID); - params.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); - p2.addComponent(params); - l.addComponent(p2); - - // Properties - propertyPanel = new PropertyPanel(p1); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("ui/Panel.html"); - - return l; - } - - @Override - 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."; - } - - @Override - protected String getImage() { - return "parameters.jpg"; - } - - @Override - protected String getTitle() { - return "Parameters"; - } - - /** - * Add URI and parametes handlers to window. - * - * @see com.vaadin.ui.Component#attach() - */ - @Override - public void attach() { - super.attach(); - getWindow().addURIHandler(this); - getWindow().addParameterHandler(this); - } - - /** - * Remove all handlers from window - * - * @see com.vaadin.ui.Component#detach() - */ - @Override - public void detach() { - super.detach(); - getWindow().removeURIHandler(this); - getWindow().removeParameterHandler(this); - } - - /** - * Update URI - * - * @see com.vaadin.terminal.URIHandler#handleURI(URL, String) - */ - public DownloadStream handleURI(URL context, String relativeUri) { - this.context.setValue(context.toString()); - relative.setValue(relativeUri); - return null; - } - - /** - * Update parameters table - * - * @see com.vaadin.terminal.ParameterHandler#handleParameters(Map) - */ - public void handleParameters(Map<String, String[]> parameters) { - params.removeAllItems(); - for (final Iterator<String> i = parameters.keySet().iterator(); i - .hasNext();) { - final String name = i.next(); - final String[] values = parameters.get(name); - String v = ""; - for (int j = 0; j < values.length; j++) { - if (v.length() > 0) { - v += ", "; - } - v += "'" + values[j] + "'"; - } - params.addItem(new Object[] { v }, name); - } - } -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureProperties.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureProperties.java deleted file mode 100644 index e314c574f6..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureProperties.java +++ /dev/null @@ -1,94 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureProperties extends Feature { - - private static final String INTRO_TEXT = "" - + "Vaadin data model is one of the core concepts " - + "in the library and Property-interface is the base of that " - + "model. Property provides standardized API for a single data object " - + "that can be read (get) and written (set). A property is always typed, but can optionally " - + "support data type conversions. Optionally properties can provide " - + "value change events for following the state changes." - + "<br /><br />The most important function of the Property as well as other " - + "data models is to connect classes implementing the interface directly to " - + "editor and viewer classes. Typically this is used to connect different " - + "data sources to UI components for editing and viewing their contents." - + "<br /><br />Properties can be utilized either by implementing the interface " - + "or by using some of the existing property implementations. Vaadin " - + "includes Property interface implementations for " - + "arbitrary function pairs or Bean-properties as well as simple object " - + "properties." - + "<br /><br />Many of the UI components also implement Property interface and allow " - + "setting of other components as their data-source. These UI-components " - + "include TextField, DateField, Select, Table, Button, " - + "Label and Tree."; - - public FeatureProperties() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Data Model"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/Property.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureSelect.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureSelect.java deleted file mode 100644 index 2ea564476b..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureSelect.java +++ /dev/null @@ -1,91 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureSelect extends Feature { - - private static final String[] firstnames = new String[] { "John", "Mary", - "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Robert", "Paula", - "Lenny", "Kenny", "Nathan", "Nicole", "Laura", "Jos", "Josie", - "Linus" }; - - private static final String[] lastnames = new String[] { "Torvalds", - "Smith", "Adams", "Black", "Wilson", "Richards", "Thompson", - "McGoff", "Halas", "Jones", "Beck", "Sheridan", "Picard", "Hill", - "Fielding", "Einstein" }; - - public FeatureSelect() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Select s = new Select("Select employee"); - for (int i = 0; i < 50; i++) { - s.addItem(firstnames[(int) (Math.random() * (firstnames.length - 1))] - + " " - + lastnames[(int) (Math.random() * (lastnames.length - 1))]); - } - l.addComponent(s); - - // Properties - propertyPanel = new PropertyPanel(s); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("optiongroup") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("optiongroup"); - themes.addItem("twincol") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("twincol"); - - setJavadocURL("ui/Select.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "Select s = new Select(\"Select Car\");\n" - + "s.addItem(\"Audi\");\n" + "s.addItem(\"BMW\");\n" - + "s.addItem(\"Chrysler\");\n" + "s.addItem(\"Volvo\");\n"; - - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - 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."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Select"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureTabSheet.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureTabSheet.java deleted file mode 100644 index 46d8e0f974..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureTabSheet.java +++ /dev/null @@ -1,72 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.VerticalLayout; - -public class FeatureTabSheet extends Feature { - - public FeatureTabSheet() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final TabSheet ts = new TabSheet(); - ts.addTab( - new Label( - "This is an example Label component that is added into Tab 1."), - "Tab 1 caption", null); - ts.addTab( - new Label( - "This is an example Label component that is added into Tab 2."), - "Tab 2 caption", null); - ts.addTab( - new Label( - "This is an example Label component that is added into Tab 3."), - "Tab 3 caption", null); - l.addComponent(ts); - - // Properties - propertyPanel = new PropertyPanel(ts); - - setJavadocURL("ui/TabSheet.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "TabSheet ts = new TabSheet();\n" - + "ts.addTab(new Label(\"This is an example Label component that is added into Tab 1.\"),\"Tab 1 caption\",null);\n" - + "ts.addTab(new Label(\"This is an example Label component that is added into Tab 2.\"),\"Tab 2 caption\",null);\n" - + "ts.addTab(new Label(\"This is an example Label component that is added into Tab 3.\"),\"Tab 3 caption\",null);"; - } - - @Override - 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."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "TabSheet"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureTable.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureTable.java deleted file mode 100644 index 928b7e3f88..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureTable.java +++ /dev/null @@ -1,196 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.event.Action; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Select; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; - -public class FeatureTable extends Feature implements Action.Handler { - - private static final String[] firstnames = new String[] { "John", "Mary", - "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" }; - - private static final String[] lastnames = new String[] { "Torvalds", - "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding", - "Einstein" }; - - private static final String[] title = new String[] { "Project Manager", - "Marketing Manager", "Sales Manager", "Trainer", "IT Support", - "Account Manager", "Customer Support", "Testing Engineer", - "Software Designer", "Programmer", "Consultant" }; - - private static final String[] unit = new String[] { "Tokyo", "Mexico City", - "Seoul", "New York", "Sao Paulo", "Bombay", "Delhi", "Shanghai", - "Los Angeles", "London", "Bangalore", "Hong Kong", "Madrid", - "Milano", "Beijing", "Paris", "Moscow", "Helsinki" }; - - private Table t; - - private boolean actionsActive = false; - - private final Button actionHandlerSwitch = new Button("Activate actions", - this, "toggleActions"); - - public void toggleActions() { - if (actionsActive) { - t.removeActionHandler(this); - actionsActive = false; - actionHandlerSwitch.setCaption("Activate Actions"); - } else { - t.addActionHandler(this); - actionsActive = true; - actionHandlerSwitch.setCaption("Deactivate Actions"); - } - } - - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - // Sample table - t = new Table("Corporate Employees"); - t.setPageLength(10); - l.addComponent(t); - - // Add columns to table - t.addContainerProperty("Firstname", String.class, ""); - t.addContainerProperty("Lastname", String.class, ""); - t.addContainerProperty("Title", String.class, ""); - t.addContainerProperty("Unit", String.class, ""); - - // set alignments to demonstrate features - t.setColumnAlignment("Title", Table.ALIGN_CENTER); - t.setColumnAlignment("Unit", Table.ALIGN_RIGHT); - - // Add random rows to table - for (int j = 0; j < 300; j++) { - t.addItem( - new Object[] { - firstnames[(int) (Math.random() * (firstnames.length - 1))], - lastnames[(int) (Math.random() * (lastnames.length - 1))], - title[(int) (Math.random() * title.length)], - unit[(int) (Math.random() * unit.length)] }, - new Integer(j)); - } - - // Actions - l.addComponent(actionHandlerSwitch); - - // Properties - propertyPanel = new PropertyPanel(t); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "pageLength", "rowHeaderMode", "selectable", - "columnHeaderMode", "columnCollapsingAllowed", - "columnReorderingAllowed", "width", "height" }); - ap.replaceWithSelect("columnHeaderMode", new Object[] { - new Integer(Table.COLUMN_HEADER_MODE_EXPLICIT), - new Integer(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID), - new Integer(Table.COLUMN_HEADER_MODE_HIDDEN), - new Integer(Table.COLUMN_HEADER_MODE_ID) }, new Object[] { - "Explicit", "Explicit defaults ID", "Hidden", "ID" }); - ap.replaceWithSelect("rowHeaderMode", new Object[] { - new Integer(Table.ROW_HEADER_MODE_EXPLICIT), - new Integer(Table.ROW_HEADER_MODE_EXPLICIT_DEFAULTS_ID), - new Integer(Table.ROW_HEADER_MODE_HIDDEN), - new Integer(Table.ROW_HEADER_MODE_ICON_ONLY), - new Integer(Table.ROW_HEADER_MODE_ID), - new Integer(Table.ROW_HEADER_MODE_INDEX), - new Integer(Table.ROW_HEADER_MODE_ITEM), - new Integer(Table.ROW_HEADER_MODE_PROPERTY) }, new Object[] { - "Explicit", "Explicit defaults ID", "Hidden", "Icon only", - "ID", "Index", "Item", "Property" }); - - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("list") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("list"); - themes.addItem("paging") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("paging"); - - propertyPanel.addProperties("Table Properties", ap); - - // Set first name as item caption propertyId in cas somebody - // selecs it - t.setItemCaptionPropertyId("Firstname"); - - // this overrides previous - t.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX); - t.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID); - - t.setColumnCollapsingAllowed(true); - t.setColumnReorderingAllowed(true); - t.setSelectable(true); - - setJavadocURL("ui/Table.html"); - - return l; - } - - protected String getExampleSrc() { - return "// Sample table\n" - + "t = new Table(\"Corporate Employees\");\n" - + "t.setPageLength(10);\n\n" - + "// Add columns to table\n" - + "t.addContainerProperty(\"Firstname\", String.class, \"\");\n" - + "t.addContainerProperty(\"Lastname\", String.class, \"\");\n" - + "t.addContainerProperty(\"Age\", String.class, \"\");\n" - + "t.addContainerProperty(\"Title\", String.class, \"\");\n" - + "t.addContainerProperty(\"Unit\", String.class, \"\");\n\n" - + "// Add random rows to table\n" - + "for (int j = 0; j < 50; j++) {\n" + " t.addItem(\n" - + " new Object[] {\n" - + " firstnames[(int) (Math.random() * 9)],\n" - + " lastnames[(int) (Math.random() * 9)],\n" - + " title[(int) (Math.random() * title.length)],\n" - + " unit[(int) (Math.random() * unit.length)] },\n" - + " new Integer(j));\n" + "}\n"; - } - - protected String getDescriptionXHTML() { - - return "The Table component is designed for displaying large volumes of tabular data, " - + "in multiple pages whenever needed." - + "<br /><br />Selection of the displayed data is supported both in selecting exclusively one row " - + "or multiple rows at the same time. For each row, there may be a set of actions associated, " - + "depending on the theme these actions may be displayed either as a drop-down " - + "menu for each row or a set of command buttons." - + "<br /><br />Table may be connected to any datasource implementing the <code>Container</code> interface." - + "This way data found in external datasources can be directly presented in the table component." - + "<br /><br />" - + "Table implements a number of features and you can test most of them in the table demo tab."; - } - - protected String getImage() { - return "icon_demo.png"; - } - - protected String getTitle() { - return "Table"; - } - - private final Action ACTION1 = new Action("Action 1"); - - private final Action ACTION2 = new Action("Action 2"); - - private final Action ACTION3 = new Action("Action 3"); - - private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 }; - - public Action[] getActions(Object target, Object sender) { - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - t.setDescription("Last action clicked was '" + action.getCaption() - + "' on item '" + t.getItem(target).toString() + "'"); - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureTextField.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureTextField.java deleted file mode 100644 index eef09b23d0..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureTextField.java +++ /dev/null @@ -1,71 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.TextField; - -public class FeatureTextField extends Feature { - - public FeatureTextField() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final HorizontalLayout l = new HorizontalLayout(); - // Test component - final TextField tf = new TextField("Caption"); - l.addComponent(tf); - - // Properties - propertyPanel = new PropertyPanel(tf); - final Form f = propertyPanel.createBeanPropertySet(new String[] { - "columns", "rows", "wordwrap", "writeThrough", "readThrough", - "nullRepresentation", "nullSettingAllowed", "secret" }); - propertyPanel.addProperties("Text field properties", f); - - setJavadocURL("ui/TextField.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "TextField tf = new TextField(\"Caption\");\n" - + "tf.setValue(\"Contents\");"; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return "TextField combines the logic of both the single line text-entry field and the multi-line " - + "text-area into one component. " - + "As with all Data-components of Vaadin, the TextField can also be bound to an " - + "underlying data source, both directly or in a buffered (asynchronous) " - + "mode. In buffered mode its background color will change to indicate " - + "that the value has changed but is not committed." - + "<br /><br />Furthermore a validators may be bound to the component to " - + "check and validate the given input before it is actually committed." - + "<br /><br />On the demo tab you can try out how the different properties affect the " - + "presentation of the component."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "TextField"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureTree.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureTree.java deleted file mode 100644 index 82a8b77b65..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureTree.java +++ /dev/null @@ -1,175 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.util.Iterator; - -import com.vaadin.event.Action; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Select; -import com.vaadin.ui.Tree; -import com.vaadin.ui.VerticalLayout; - -public class FeatureTree extends Feature implements Action.Handler { - - private static final String[] firstnames = new String[] { "John", "Mary", - "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" }; - - private static final String[] lastnames = new String[] { "Torvalds", - "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding", - "Einstein" }; - - private Tree t; - - private boolean actionsActive = false; - - private final Button actionHandlerSwitch = new Button("Activate actions", - this, "toggleActions"); - - public FeatureTree() { - super(); - } - - public void toggleActions() { - if (actionsActive) { - t.removeActionHandler(this); - actionsActive = false; - actionHandlerSwitch.setCaption("Activate Actions"); - } else { - t.addActionHandler(this); - actionsActive = true; - actionHandlerSwitch.setCaption("Deactivate Actions"); - } - } - - public void expandAll() { - for (final Iterator<?> i = t.rootItemIds().iterator(); i.hasNext();) { - t.expandItemsRecursively(i.next()); - } - } - - public void collapseAll() { - for (final Iterator<?> i = t.rootItemIds().iterator(); i.hasNext();) { - t.collapseItemsRecursively(i.next()); - } - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final String[] names = new String[100]; - for (int i = 0; i < names.length; i++) { - names[i] = firstnames[(int) (Math.random() * (firstnames.length - 1))] - + " " - + lastnames[(int) (Math.random() * (lastnames.length - 1))]; - } - - // Create tree - t = new Tree("Organization Structure"); - for (int i = 0; i < 100; i++) { - t.addItem(names[i]); - final String parent = names[(int) (Math.random() * (names.length - 1))]; - if (t.containsId(parent)) { - t.setParent(names[i], parent); - } - } - - // Forbid childless people to have children (makes them leaves) - for (int i = 0; i < 100; i++) { - if (!t.hasChildren(names[i])) { - t.setChildrenAllowed(names[i], false); - } - } - - l.addComponent(t); - - // Actions - l.addComponent(actionHandlerSwitch); - - // Expand and Collapse buttons - l.addComponent(new Button("Expand All", this, "expandAll")); - l.addComponent(new Button("Collapse All", this, "collapseAll")); - - // Properties - propertyPanel = new PropertyPanel(t); - final Form ap = propertyPanel - .createBeanPropertySet(new String[] { "selectable" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("menu") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("menu"); - propertyPanel.addProperties("Tree Properties", ap); - - setJavadocURL("ui/Tree.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return "// Create tree\n" - + "t = new Tree(\"Organization Structure\");\n" - + "for (int i = 0; i < 100; i++) {\n" - + " t.addItem(names[i]);\n" - + " String parent = names[(int) (Math.random() * (names.length - 1))];\n" - + " if (t.containsId(parent)) \n" - + " t.setParent(names[i],parent);\n" - + "}\n\n" - + "// Forbid childless people to have children (makes them leaves)\n" - + "for (int i = 0; i < 100; i++)\n" - + " if (!t.hasChildren(names[i]))\n" - + " t.setChildrenAllowed(names[i], false);\n"; - } - - @Override - protected String getDescriptionXHTML() { - return "A tree is a natural way to represent datasets that have" - + " hierarchical relationships, such as filesystems, message " - + "threads or, as in this example, organization structure. Vaadin features a versatile " - + "and powerful Tree component that works much like the tree components " - + "of most modern operating systems." - + "<br /><br />The most prominent use of the Tree component is to " - + "use it for displaying a hierachical menu, like the " - + "menu on the left side of the screen for instance " - + "or to display filesystems or other hierarchical datasets." - + "<br /><br />The tree component uses <code>Container</code> " - + "datasources much like the Table component, " - + "with the addition that it also utilizes the hierarchy " - + "information maintained by the container." - + "<br /><br />On the demo tab you can try out how the different properties " - + "affect the presentation of the tree component."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Tree"; - } - - private final Action ACTION1 = new Action("Action 1"); - - private final Action ACTION2 = new Action("Action 2"); - - private final Action ACTION3 = new Action("Action 3"); - - private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 }; - - public Action[] getActions(Object target, Object sender) { - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - t.setDescription("Last action clicked was '" + action.getCaption() - + "' on item '" + target + "'"); - } -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureUpload.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureUpload.java deleted file mode 100644 index fdd51e7efd..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureUpload.java +++ /dev/null @@ -1,148 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.OutputStream; - -import com.vaadin.terminal.StreamResource; -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Upload.FinishedEvent; -import com.vaadin.ui.VerticalLayout; - -public class FeatureUpload extends Feature implements Upload.FinishedListener { - Buffer buffer = new Buffer(); - - Panel status = new Panel("Uploaded file:"); - - public FeatureUpload() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Upload up = new Upload("Upload", buffer); - up.setImmediate(true); - up.addListener(this); - - status.setVisible(false); - - l.addComponent(up); - l.addComponent(status); - - // Properties - propertyPanel = new PropertyPanel(up); - - setJavadocURL("ui/Upload.html"); - - return l; - } - - @Override - 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" + " }"; - - } - - @Override - protected String getDescriptionXHTML() { - return "This demonstrates the use of the Upload component together with the Link component. " - + "This implementation does not actually store the file to disk, it only keeps it in a buffer. " - + "The example given on the <em>Code Sample</em>-tab on the other hand stores the file to disk and binds the link to that file."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Upload"; - } - - public void uploadFinished(FinishedEvent event) { - status.removeAllComponents(); - if (buffer.getStream() == null) { - status.addComponent(new Label( - "Upload finished, but output buffer is null!!")); - } else { - status.addComponent(new Label( - "<b>Name:</b> " + event.getFilename(), Label.CONTENT_XHTML)); - status.addComponent(new Label("<b>Mimetype:</b> " - + event.getMIMEType(), Label.CONTENT_XHTML)); - status.addComponent(new Label("<b>Size:</b> " + event.getLength() - + " bytes.", Label.CONTENT_XHTML)); - - status.addComponent(new Link("Download " + buffer.getFileName(), - new StreamResource(buffer, buffer.getFileName(), - getApplication()))); - - status.setVisible(true); - } - } - - public class Buffer implements StreamResource.StreamSource, Upload.Receiver { - ByteArrayOutputStream outputBuffer = null; - - String mimeType; - - String fileName; - - public Buffer() { - - } - - public InputStream getStream() { - if (outputBuffer == null) { - return null; - } - return new ByteArrayInputStream(outputBuffer.toByteArray()); - } - - /** - * @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, String) - */ - public OutputStream receiveUpload(String filename, String MIMEType) { - fileName = filename; - mimeType = MIMEType; - outputBuffer = new ByteArrayOutputStream(); - return outputBuffer; - } - - /** - * Returns the fileName. - * - * @return String - */ - public String getFileName() { - return fileName; - } - - /** - * Returns the mimeType. - * - * @return String - */ - public String getMimeType() { - return mimeType; - } - - } -}
\ No newline at end of file diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureUtil.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureUtil.java deleted file mode 100644 index 077ee4fbe5..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.text.SimpleDateFormat; -import java.util.Date; - -public class FeatureUtil { - - private static boolean statistics = false; - - public static final SimpleDateFormat format = new SimpleDateFormat( - "yyyyMMdd HHmmss"); - - public static void debug(String userIdentity, String msg) { - if (statistics) { - System.out.println("[" + userIdentity + "] " + msg); - } - } - - public static String getTimestamp() { - if (statistics) { - try { - return format.format(new Date()); - } catch (final Exception e) { - // ignored, should never happen - } - } - return ""; - } - - public static void setStatistics(boolean statistics) { - FeatureUtil.statistics = statistics; - } -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureValidators.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureValidators.java deleted file mode 100644 index 6d28163c12..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureValidators.java +++ /dev/null @@ -1,89 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class FeatureValidators extends Feature { - - private static final String INTRO_TEXT = "" - + "Vaadin contains simple, yet powerful validation interface, " - + "that consists of two parts: Validator and Validatable. Validator is " - + "any class that can check validity of an Object. Validatable is " - + "a class with configurable validation. " - + "Validation errors are passed as special exceptions that implement " - + "ErrorMessage interface. This way the validation errors can be " - + "automatically added to components." - + "<br /><br />Utilities for simple string and null validation are provided, as " - + "well as combinative validators. The validation interface can also " - + "be easily implemented by the applications for more complex " - + "validation needs."; - - public FeatureValidators() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Validators"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/Validator.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeatureWindow.java b/tests/src/com/vaadin/tests/featurebrowser/FeatureWindow.java deleted file mode 100644 index 760ca5211a..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeatureWindow.java +++ /dev/null @@ -1,146 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.CloseEvent; - -public class FeatureWindow extends Feature implements Window.CloseListener { - - private final Button addButton = new Button("Add window", this, "addWin"); - - private final Button removeButton = new Button("Remove window", this, - "delWin"); - - private Window demoWindow; - - private Form windowProperties; - - public FeatureWindow() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout layoutRoot = new VerticalLayout(); - final VerticalLayout layoutUpper = new VerticalLayout(); - final VerticalLayout layoutLower = new VerticalLayout(); - - demoWindow = new Window("Feature Test Window"); - demoWindow.addListener(this); - demoWindow.setWidth("400px"); - demoWindow.setHeight("200px"); - demoWindow.setTheme("runo"); - - layoutUpper.addComponent(addButton); - layoutUpper.addComponent(removeButton); - - updateWinStatus(); - - // Properties - propertyPanel = new PropertyPanel(demoWindow); - windowProperties = propertyPanel.createBeanPropertySet(new String[] { - "width", "height", "name", "theme", "border", "scrollable", }); - windowProperties.replaceWithSelect("border", new Object[] { - new Integer(Window.BORDER_DEFAULT), - new Integer(Window.BORDER_NONE), - new Integer(Window.BORDER_MINIMAL) }, new Object[] { "Default", - "None", "Minimal" }); - // Disabled, not applicable for default theme - windowProperties.getField("border").setEnabled(false); - windowProperties.getField("scrollable").setEnabled(false); - - propertyPanel.addProperties("Window Properties", windowProperties); - windowProperties.getField("width").setDescription( - "Minimum width is 100"); - windowProperties.getField("height").setDescription( - "Minimum height is 100"); - - setJavadocURL("ui/Window.html"); - - layoutRoot.addComponent(layoutUpper); - layoutRoot.addComponent(layoutLower); - return layoutRoot; - } - - @Override - protected String getExampleSrc() { - return "Window win = new Window();\n" - + "getApplication().addWindow(win);\n"; - - } - - @Override - protected String getDescriptionXHTML() { - return "The window support in Vaadin 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."; - } - - @Override - protected String getImage() { - return "icon_demo.png"; - } - - @Override - protected String getTitle() { - return "Window"; - } - - public void addWin() { - - propertyPanel.commit(); - - getApplication().getMainWindow().addWindow(demoWindow); - - demoWindow.removeAllComponents(); - - demoWindow - .addComponent(new Label( - "<br /><br />This is a new window created by " - + "<em>Add window</em>" - + " button's event.<br /><br />You may simply" - + " close this window or select " - + "<em>Remove window</em> from the Feature Browser window.", - Label.CONTENT_XHTML)); - // prevent user to change window name tag (after window is - // created) - windowProperties.getField("name").setEnabled(false); - windowProperties.getField("name").setReadOnly(true); - demoWindow.setVisible(true); - updateWinStatus(); - } - - public void delWin() { - getApplication().getMainWindow().removeWindow(demoWindow); - // allow user to change window name tag (before window is - // created) - windowProperties.getField("name").setEnabled(true); - windowProperties.getField("name").setReadOnly(false); - updateWinStatus(); - } - - private void updateWinStatus() { - if (demoWindow.getApplication() == null) { - addButton.setEnabled(true); - removeButton.setEnabled(false); - } else { - addButton.setEnabled(false); - removeButton.setEnabled(true); - } - } - - public void windowClose(CloseEvent e) { - delWin(); - } -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/FeaturesApplication.java b/tests/src/com/vaadin/tests/featurebrowser/FeaturesApplication.java deleted file mode 100644 index 8bbbad5d31..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/FeaturesApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Window; - -public class FeaturesApplication extends com.vaadin.Application { - - @Override - public void init() { - if (getProperty("statistics") != null) { - FeatureUtil.setStatistics(true); - } - setUser(new Long(System.currentTimeMillis()).toString()); - final Window main = new Window("Vaadin Features Tour"); - setMainWindow(main); - - main.setContent(new FeatureBrowser()); - } - - /** - * ErrorEvents are printed to default error stream and not in GUI. - */ - @Override - public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) { - final Throwable e = event.getThrowable(); - FeatureUtil.debug(getUser().toString(), - "terminalError: " + e.toString()); - e.printStackTrace(); - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroBasic.java b/tests/src/com/vaadin/tests/featurebrowser/IntroBasic.java deleted file mode 100644 index ae16c5c0cc..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroBasic.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroBasic extends Feature { - - private static final String INTRO_TEXT = "" - + "Text Field, Date Field, Button, Form, Label and Link components are provided as samples" - + " for basic UI components." - + "<br /><br />See the API documentation of respective components for more information."; - - public IntroBasic() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Basic UI components"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("ui/package-summary.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return "Introduction of basic UI components"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroComponents.java b/tests/src/com/vaadin/tests/featurebrowser/IntroComponents.java deleted file mode 100644 index 46dad74ad7..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroComponents.java +++ /dev/null @@ -1,85 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.terminal.ClassResource; -import com.vaadin.ui.Component; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroComponents extends Feature { - - private static final String INTRO_TEXT = "" - + "This picture summarizes the relations between different user interface (UI) components." - + "<br /><br />See API documentation below for more information."; - - public IntroComponents() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("UI component diagram"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - panel.addComponent(new Embedded("", new ClassResource("components.png", - getApplication()))); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("ui/package-summary.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroDataHandling.java b/tests/src/com/vaadin/tests/featurebrowser/IntroDataHandling.java deleted file mode 100644 index 384404a75a..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroDataHandling.java +++ /dev/null @@ -1,80 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroDataHandling extends Feature { - - private static final String INTRO_TEXT = "" - + "Embedded Objects and Upload components are provided as samples" - + " for data handling section." - + "<br /><br />See the API documentation of respective components for more information."; - - public IntroDataHandling() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Data Handling"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final 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; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return "Please select <em>Embedded Objects</em> or <em>Upload</em>" - + " from the menu for more information."; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroDataModel.java b/tests/src/com/vaadin/tests/featurebrowser/IntroDataModel.java deleted file mode 100644 index 4b9d208d7e..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroDataModel.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroDataModel extends Feature { - - private static final String INTRO_TEXT = "" - + "This section introduces main concepts of data model in Vaadin." - + " It contains brief introduction to Properties, Items, Containers, Validators and" - + " Buffering classes." - + "<br /><br />See the API documentation of respective area for more information."; - - public IntroDataModel() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Data Model"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/package-summary.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroItemContainers.java b/tests/src/com/vaadin/tests/featurebrowser/IntroItemContainers.java deleted file mode 100644 index 024f05fabd..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroItemContainers.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroItemContainers extends Feature { - - private static final String INTRO_TEXT = "" - + "Select, Table and Tree components are provided as samples" - + " for item containers section." - + "<br /><br />See the API documentation of respective components for more information."; - - public IntroItemContainers() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Item Containers"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("data/Container.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroLayouts.java b/tests/src/com/vaadin/tests/featurebrowser/IntroLayouts.java deleted file mode 100644 index 724d2c2ee2..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroLayouts.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroLayouts extends Feature { - - private static final String INTRO_TEXT = "" - + "Layouts are required to place components to specific place in the UI." - + " You can use plain Java to accomplish sophisticated component layouting." - + " Other option is to use Custom Layout and let the web page designers" - + " to take responsibility of component layouting using their own set of tools." - + "<br /><br />See API documentation below for more information."; - - public IntroLayouts() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Panel panel = new Panel(); - panel.setCaption("Layouts"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(INTRO_TEXT); - - // Properties - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("ui/Layout.html"); - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return null; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return null; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroTerminal.java b/tests/src/com/vaadin/tests/featurebrowser/IntroTerminal.java deleted file mode 100644 index 177f8bcb53..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroTerminal.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; - -public class IntroTerminal extends Feature { - - public IntroTerminal() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - final Label lab = new Label(); - lab.setStyleName("featurebrowser-none"); - l.addComponent(lab); - - // Properties - propertyPanel = null; - - return l; - } - - @Override - protected String getExampleSrc() { - return null; - } - - /** - * @see com.vaadin.tests.featurebrowser.Feature#getDescriptionXHTML() - */ - @Override - protected String getDescriptionXHTML() { - return ""; - } - - @Override - protected String getImage() { - return null; - } - - @Override - protected String getTitle() { - return "Introduction for terminals (TODO)"; - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/IntroWelcome.java b/tests/src/com/vaadin/tests/featurebrowser/IntroWelcome.java deleted file mode 100644 index b0dbc22232..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/IntroWelcome.java +++ /dev/null @@ -1,176 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.net.URL; -import java.util.Date; -import java.util.Iterator; -import java.util.Map; - -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.ParameterHandler; -import com.vaadin.terminal.URIHandler; -import com.vaadin.terminal.gwt.server.ApplicationServlet; -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; - -public class IntroWelcome extends Feature implements URIHandler, - ParameterHandler { - - Panel panel = new Panel(); - - private static final String WELCOME_TEXT_UPPER = "" - + "This application lets you view and play with some features of " - + "Vaadin. Use menu on the left to select component." - + "<br /><br />Note the <b>Properties selection</b> on the top " - + "right corner. Click it open to access component properties and" - + " feel free to edit properties at any time." - + "<br /><br />The area that you are now reading is the component" - + " demo area. Lower area from here contains component description, API" - + " documentation and optional code sample. Note that not all selections" - + " contain demo, only description and API documentation is shown." - + "<br /><br />You may also change application's theme from below the menu." - + " This example application is designed to work best with" - + " <em>Demo</em> theme, other themes are for demonstration purposes only." - + "<br /><br />Vaadin enables you to construct complex Web" - + " applications using plain Java, no knowledge of other Web technologies" - + " such as XML, HTML, DOM, JavaScript or browser differences is required." - + "<br /><br />For more information, point your browser to" - + " <a href=\"http://www.vaadin.com\" target=\"_new\">www.vaadin.com</a>."; - - private static final String WELCOME_TEXT_LOWER = "" - + "This area contains the selected component's description, list of properties, javadoc" - + " and optional code sample. " - + "Start your tour now by selecting features from the list" - + " on the left and remember to experiment with the <b>Properties panel</b>" - + " located at the top right corner area."; - - // TODO Add browser agent string - private final String description = WELCOME_TEXT_LOWER - + "<br /><br />Vaadin version: " + ApplicationServlet.VERSION; - - public IntroWelcome() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final VerticalLayout l = new VerticalLayout(); - - panel.setCaption("Welcome to the Vaadin feature tour!"); - l.addComponent(panel); - - final Label label = new Label(); - panel.addComponent(label); - - label.setContentMode(Label.CONTENT_XHTML); - label.setValue(WELCOME_TEXT_UPPER); - - propertyPanel = new PropertyPanel(panel); - final Form ap = propertyPanel.createBeanPropertySet(new String[] { - "width", "height" }); - final Select themes = (Select) propertyPanel.getField("style"); - themes.addItem("light") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("light"); - themes.addItem("strong") - .getItemProperty(themes.getItemCaptionPropertyId()) - .setValue("strong"); - propertyPanel.addProperties("Panel Properties", ap); - - setJavadocURL("package-summary.html"); - - setPropsReminder(false); - - return l; - } - - @Override - protected String getExampleSrc() { - return "" + "package com.vaadin.demo;\n" - + "import com.vaadin.ui.*;\n\n" - + "public class HelloWorld extends com.vaadin.Application {\n" - + " public void init() {\n" - + " Window main = new Window(\"Hello window\");\n" - + " setMainWindow(main);\n" - + " main.addComponent(new Label(\"Hello World!\"));\n" - + " }\n" + "}\n"; - } - - // not ready yet to give description, see paint instead - @Override - protected String getDescriptionXHTML() { - return description; - } - - @Override - protected String getImage() { - return "icon_intro.png"; - } - - @Override - protected String getTitle() { - return "Welcome"; - } - - /** - * Add URI and parametes handlers to window. - * - * @see com.vaadin.ui.Component#attach() - */ - @Override - public void attach() { - super.attach(); - getWindow().addURIHandler(this); - getWindow().addParameterHandler(this); - } - - /** - * Remove all handlers from window - * - * @see com.vaadin.ui.Component#detach() - */ - @Override - public void detach() { - super.detach(); - getWindow().removeURIHandler(this); - getWindow().removeParameterHandler(this); - } - - /** - * Update URI - * - * @see com.vaadin.terminal.URIHandler#handleURI(URL, String) - */ - public DownloadStream handleURI(URL context, String relativeUri) { - return null; - } - - /** - * Show system status if systemStatus is given on URL - * - * @see com.vaadin.terminal.ParameterHandler#handleParameters(Map) - */ - public void handleParameters(Map<String, String[]> parameters) { - for (final Iterator<String> i = parameters.keySet().iterator(); i - .hasNext();) { - final String name = i.next(); - if (name.equals("systemStatus")) { - String status = ""; - status += "timestamp=" + new Date() + " "; - status += "free=" + Runtime.getRuntime().freeMemory() + ", "; - status += "total=" + Runtime.getRuntime().totalMemory() + ", "; - status += "max=" + Runtime.getRuntime().maxMemory() + "\n"; - System.out.println(status); - } - } - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/PropertyPanel.java b/tests/src/com/vaadin/tests/featurebrowser/PropertyPanel.java deleted file mode 100644 index 32cef16e22..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/PropertyPanel.java +++ /dev/null @@ -1,501 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.util.Date; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; - -import com.vaadin.data.Property; -import com.vaadin.data.util.BeanItem; -import com.vaadin.terminal.ErrorMessage; -import com.vaadin.terminal.SystemError; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.AbstractComponentContainer; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Field; -import com.vaadin.ui.Form; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Tree; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.themes.Reindeer; - -public class PropertyPanel extends Panel implements Button.ClickListener, - Property.ValueChangeListener { - - private Select addComponent; - - private final VerticalLayout formsLayout = new VerticalLayout(); - - private final LinkedList<Form> forms = new LinkedList<Form>(); - - private final Button setButton = new Button("Set", this); - - private final Button discardButton = new Button("Discard changes", this); - - private final Table allProperties = new Table(); - - private final Object objectToConfigure; - - private final BeanItem<Object> config; - - protected static final int COLUMNS = 3; - - /** Contruct new property panel for configuring given object. */ - public PropertyPanel(Object objectToConfigure) { - super(); - ((Layout) getContent()).setMargin(false); - - // Layout - setCaption("Properties"); - addComponent(formsLayout); - - setSizeFull(); - - // Target object - this.objectToConfigure = objectToConfigure; - config = new BeanItem<Object>(objectToConfigure); - - // Control buttons - final HorizontalLayout buttons = new HorizontalLayout(); - buttons.setMargin(false, true, true, true); - buttons.addComponent(setButton); - buttons.addComponent(discardButton); - addComponent(buttons); - - // Add default properties - addBasicComponentProperties(); - if (objectToConfigure instanceof Select) { - addSelectProperties(); - } - if (objectToConfigure instanceof AbstractField - && !(objectToConfigure instanceof Table || objectToConfigure instanceof Tree)) { - addFieldProperties(); - } - if ((objectToConfigure instanceof AbstractComponentContainer)) { - addComponentContainerProperties(); - } - - // The list of all properties - allProperties.addContainerProperty("Name", String.class, ""); - allProperties.addContainerProperty("Type", String.class, ""); - allProperties.addContainerProperty("R/W", String.class, ""); - allProperties.addContainerProperty("Demo", String.class, ""); - allProperties.setColumnAlignments(new String[] { Table.ALIGN_LEFT, - Table.ALIGN_LEFT, Table.ALIGN_CENTER, Table.ALIGN_CENTER }); - allProperties.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID); - allProperties.setPageLength(0); - allProperties.setSizeFull(); - updatePropertyList(); - - } - - /** Add a formful of properties to property panel */ - public void addProperties(String propertySetCaption, Form properties) { - - // Create new panel containing the form - final Panel p = new Panel(); - p.setCaption(propertySetCaption); - p.setStyleName(Reindeer.PANEL_LIGHT); - p.addComponent(properties); - formsLayout.addComponent(p); - - // Setup buffering - properties.setWriteThrough(false); - // TODO change this to false, and test it is suitable for FeatureBrowser - // demo - properties.setReadThrough(true); - - // Maintain property lists - forms.add(properties); - updatePropertyList(); - } - - /** Recreate property list contents */ - public void updatePropertyList() { - - allProperties.removeAllItems(); - - // Collect demoed properties - final HashSet<Object> listed = new HashSet<Object>(); - for (final Iterator<Form> i = forms.iterator(); i.hasNext();) { - listed.addAll(i.next().getItemPropertyIds()); - } - - // Resolve all properties - BeanInfo info; - try { - info = Introspector.getBeanInfo(objectToConfigure.getClass()); - } catch (final IntrospectionException e) { - throw new RuntimeException(e.toString()); - } - final PropertyDescriptor[] pd = info.getPropertyDescriptors(); - - // Fill the table - for (int i = 0; i < pd.length; i++) { - allProperties.addItem( - new Object[] { pd[i].getName(), - pd[i].getPropertyType().getName(), - (pd[i].getWriteMethod() == null ? "R" : "R/W"), - (listed.contains(pd[i].getName()) ? "x" : "") }, - pd[i]); - } - } - - /** Add basic properties implemented most often by abstract component */ - private void addBasicComponentProperties() { - - // Set of properties - final Form set = createBeanPropertySet(new String[] { "caption", - "icon", "componentError", "description", "enabled", "visible", - "style", "readOnly", "immediate" }); - - // Icon - set.replaceWithSelect("icon", new Object[] { null, - new ThemeResource("icon/files/file.gif") }, new Object[] { - "No icon", "Sample icon" }); - - // Component error - Throwable sampleException; - try { - throw new NullPointerException("sample exception"); - } catch (final NullPointerException e) { - sampleException = e; - } - set.replaceWithSelect( - "componentError", - new Object[] { - null, - new UserError("Sample text error message."), - new UserError( - "<h3>Error message formatting</h3><p>Error messages can " - + "contain any UIDL formatting, like: <ul><li><b>Bold" - + "</b></li><li><i>Italic</i></li></ul></p>", - UserError.CONTENT_UIDL, - ErrorMessage.INFORMATION), - new SystemError( - "This is an example of exception error reposting", - sampleException) }, new Object[] { "No error", - "Sample text error", "Sample Formatted error", - "Sample System Error" }); - - // Style - final String currentStyle = ((Component) objectToConfigure) - .getStyleName(); - if (currentStyle == null) { - set.replaceWithSelect("style", new Object[] { null }, - new Object[] { "Default" }).setNewItemsAllowed(true); - } else { - set.replaceWithSelect("style", new Object[] { null, currentStyle }, - new Object[] { "Default", currentStyle }) - .setNewItemsAllowed(true); - } - - // Set up descriptions - set.getField("caption") - .setDescription( - "Component caption is the title of the component. Usage of the caption is optional and the " - + "exact behavior of the propery is defined by the component. Setting caption null " - + "or empty disables the caption."); - set.getField("enabled") - .setDescription( - "Enabled property controls the usage of the component. If the component is disabled (enabled=false)," - + " it can not receive any events from the terminal. In most cases it makes the usage" - + " of the component easier, if the component visually looks disbled (for example is grayed), " - + "when it can not be used."); - set.getField("icon") - .setDescription( - "Icon of the component selects the main icon of the component. The usage of the icon is identical " - + "to caption and in most components caption and icon are kept together. Icons can be " - + "loaded from any resources (see Terminal/Resources for more information). Some components " - + "contain more than just the captions icon. Those icons are controlled through their " - + "own properties."); - set.getField("visible") - .setDescription( - "Visibility property says if the component is renreded or not. Invisible components are implicitly " - + "disabled, as there is no visible user interface to send event."); - set.getField("description") - .setDescription( - "Description is designed to allow easy addition of short tooltips, like this. Like the caption," - + " setting description null or empty disables the description."); - set.getField("readOnly") - .setDescription( - "Those components that have internal state that can be written are settable to readOnly-mode," - + " where the object can only be read, not written."); - set.getField("componentError") - .setDescription( - "Vaadin supports extensive error reporting. One part of the error reporting are component" - + " errors that can be controlled by the programmer. This example only contains couple of " - + "sample errors; to get the full picture, read browse ErrorMessage-interface implementors " - + "API documentation."); - set.getField("immediate") - .setDescription( - "Not all terminals can send the events immediately to server from all action. Web is the most " - + "typical environment where many events (like textfield changed) are not sent to server, " - + "before they are explicitly submitted. Setting immediate property true (by default this " - + "is false for most components), the programmer can assure that the application is" - + " notified as soon as possible about the value change in this component."); - set.getField("style") - .setDescription( - "Themes specify the overall looks of the user interface. In addition component can have a set of " - + "styles, that can be visually very different (like datefield calendar- and text-styles), " - + "but contain the same logical functionality. As a rule of thumb, theme specifies if a " - + "component is blue or yellow and style determines how the component is used."); - - // Add created fields to property panel - addProperties("Component Basics", set); - - // Customization for Window component - if (objectToConfigure instanceof Window) { - disableField(set.getField("enabled"), Boolean.TRUE); - disableField(set.getField("visible"), Boolean.TRUE); - disableField(set.getField("componentError")); - disableField(set.getField("icon")); - } - } - - /** Add properties for selecting */ - private void addSelectProperties() { - final Form set = createBeanPropertySet(new String[] { - "newItemsAllowed", "lazyLoading", "multiSelect" }); - addProperties("Select Properties", set); - - set.getField("multiSelect").setDescription( - "Specified if multiple items can be selected at once."); - set.getField("newItemsAllowed") - .setDescription( - "Select component (but not Tree or Table) can allow the user to directly " - + "add new items to set of options. The new items are constrained to be " - + "strings and thus feature only applies to simple lists."); - /* - * Button ll = (Button) set.getField("lazyLoading"); ll - * .setDescription("In Ajax rendering mode select supports lazy loading - * and filtering of options."); ll.addListener((ValueChangeListener) - * this); ll.setImmediate(true); if (((Boolean) - * ll.getValue()).booleanValue()) { - * set.getField("multiSelect").setVisible(false); - * set.getField("newItemsAllowed").setVisible(false); } - */ - if (objectToConfigure instanceof Tree - || objectToConfigure instanceof Table) { - set.removeItemProperty("newItemsAllowed"); - set.removeItemProperty("lazyLoading"); - } - } - - /** Field special properties */ - private void addFieldProperties() { - // Set of properties - final Form set = createBeanPropertySet(new String[] { "required" }); - - set.addField("focus", new Button("Focus", objectToConfigure, "focus")); - set.getField("focus").setDescription( - "Focus the cursor to this field. Not all " - + "components and/or terminals support this feature."); - - addProperties("Field Features", set); - - } - - /** - * Add and remove some miscellaneous example component to/from component - * container - */ - private void addComponentContainerProperties() { - final Form set = new Form(new VerticalLayout()); - - addComponent = new Select(); - addComponent.setImmediate(true); - addComponent.addItem("Add component to container"); - addComponent.setNullSelectionItemId("Add component to container"); - addComponent.addItem("Text field"); - addComponent.addItem("Option group"); - addComponent.addListener(this); - - set.addField("component adder", addComponent); - set.addField("remove all components", new Button( - "Remove all components", objectToConfigure, - "removeAllComponents")); - - addProperties("ComponentContainer Features", set); - } - - /** Value change listener for listening selections */ - public void valueChange(Property.ValueChangeEvent event) { - - // FIXME: navigation statistics - try { - FeatureUtil.debug(getApplication().getUser().toString(), - "valueChange " - + event.getProperty().getClass().getSimpleName() - + ", " + event.getProperty()); - } catch (final Exception e) { - // ignored, should never happen - } - - // Adding components to component container - if (event.getProperty() == addComponent) { - final String value = (String) addComponent.getValue(); - - if (value != null) { - // TextField component - if (value.equals("Text field")) { - ((AbstractComponentContainer) objectToConfigure) - .addComponent(new TextField("Test field")); - } - - // DateField time style - if (value.equals("Time")) { - final DateField d = new DateField("Time", new Date()); - d.setDescription("This is a DateField-component with text-style"); - d.setResolution(DateField.RESOLUTION_MIN); - d.setStyleName("text"); - ((AbstractComponentContainer) objectToConfigure) - .addComponent(d); - } - - // Date field calendar style - if (value.equals("Calendar")) { - final DateField c = new DateField("Calendar", new Date()); - c.setDescription("DateField-component with calendar-style and day-resolution"); - c.setStyleName("calendar"); - c.setResolution(DateField.RESOLUTION_DAY); - ((AbstractComponentContainer) objectToConfigure) - .addComponent(c); - } - - // Select option group style - if (value.equals("Option group")) { - final OptionGroup s = new OptionGroup("Options"); - s.setDescription("Select-component with optiongroup-style"); - s.addItem("Linux"); - s.addItem("Windows"); - s.addItem("Solaris"); - s.addItem("Symbian"); - - ((AbstractComponentContainer) objectToConfigure) - .addComponent(s); - } - - addComponent.setValue(null); - } - } else if (event.getProperty() == getField("lazyLoading")) { - final boolean newValue = ((Boolean) event.getProperty().getValue()) - .booleanValue(); - final Field multiselect = getField("multiSelect"); - final Field newitems = getField("newItemsAllowed"); - if (newValue) { - newitems.setValue(Boolean.FALSE); - newitems.setVisible(false); - multiselect.setValue(Boolean.FALSE); - multiselect.setVisible(false); - } else { - newitems.setVisible(true); - multiselect.setVisible(true); - } - } - } - - /** Handle all button clicks for this panel */ - public void buttonClick(Button.ClickEvent event) { - // FIXME: navigation statistics - try { - FeatureUtil.debug(getApplication().getUser().toString(), - "buttonClick " - + event.getButton().getClass().getSimpleName() - + ", " + event.getButton().getCaption() + ", " - + event.getButton().getValue()); - } catch (final Exception e) { - // ignored, should never happen - } - // Commit all changed on all forms - if (event.getButton() == setButton) { - commit(); - } - - // Discard all changed on all forms - if (event.getButton() == discardButton) { - for (final Iterator<Form> i = forms.iterator(); i.hasNext();) { - i.next().discard(); - } - } - - } - - /** - * Helper function for creating forms from array of propety names. - */ - protected Form createBeanPropertySet(String names[]) { - - final Form set = new Form(new VerticalLayout()); - - for (int i = 0; i < names.length; i++) { - final Property p = config.getItemProperty(names[i]); - if (p != null) { - set.addItemProperty(names[i], p); - final Field f = set.getField(names[i]); - if (f instanceof TextField) { - if (Integer.class.equals(p.getType())) { - ((TextField) f).setColumns(4); - } else { - ((TextField) f).setNullSettingAllowed(true); - ((TextField) f).setColumns(17); - } - } - } - } - - return set; - } - - /** Find a field from all forms */ - public Field getField(Object propertyId) { - for (final Iterator<Form> i = forms.iterator(); i.hasNext();) { - final Form f = i.next(); - final Field af = f.getField(propertyId); - if (af != null) { - return af; - } - } - return null; - } - - public Table getAllProperties() { - return allProperties; - } - - protected void commit() { - for (final Iterator<Form> i = forms.iterator(); i.hasNext();) { - i.next().commit(); - } - } - - private void disableField(Field field) { - field.setEnabled(false); - field.setReadOnly(true); - } - - private void disableField(Field field, Object value) { - field.setValue(value); - disableField(field); - } - -} diff --git a/tests/src/com/vaadin/tests/featurebrowser/components.png b/tests/src/com/vaadin/tests/featurebrowser/components.png Binary files differdeleted file mode 100644 index e5681d4d37..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/components.png +++ /dev/null diff --git a/tests/src/com/vaadin/tests/featurebrowser/icon_demo.png b/tests/src/com/vaadin/tests/featurebrowser/icon_demo.png Binary files differdeleted file mode 100644 index 6a5c295d6a..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/icon_demo.png +++ /dev/null diff --git a/tests/src/com/vaadin/tests/featurebrowser/icon_intro.png b/tests/src/com/vaadin/tests/featurebrowser/icon_intro.png Binary files differdeleted file mode 100644 index 032712985c..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/icon_intro.png +++ /dev/null diff --git a/tests/src/com/vaadin/tests/featurebrowser/itmill.gif b/tests/src/com/vaadin/tests/featurebrowser/itmill.gif Binary files differdeleted file mode 100644 index b1c3e053f0..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/itmill.gif +++ /dev/null diff --git a/tests/src/com/vaadin/tests/featurebrowser/m-bullet-blue.gif b/tests/src/com/vaadin/tests/featurebrowser/m-bullet-blue.gif Binary files differdeleted file mode 100644 index fa6b38b4c9..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/m-bullet-blue.gif +++ /dev/null diff --git a/tests/src/com/vaadin/tests/featurebrowser/m.gif b/tests/src/com/vaadin/tests/featurebrowser/m.gif Binary files differdeleted file mode 100644 index 2201bdfc1c..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/m.gif +++ /dev/null diff --git a/tests/src/com/vaadin/tests/featurebrowser/vaadin_spin.swf b/tests/src/com/vaadin/tests/featurebrowser/vaadin_spin.swf Binary files differdeleted file mode 100644 index 9e58ce29c6..0000000000 --- a/tests/src/com/vaadin/tests/featurebrowser/vaadin_spin.swf +++ /dev/null |