diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-10-27 07:57:12 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-10-27 07:57:12 +0000 |
commit | 6a3c715dae922edd723c9423b4308d5d7948b74e (patch) | |
tree | 46a007274681a9803afccf135ace5554f3e01e3a /src/com/vaadin/tests | |
parent | 931d75fef69deb9b738fad97001cf5621de9f43e (diff) | |
download | vaadin-framework-6a3c715dae922edd723c9423b4308d5d7948b74e.tar.gz vaadin-framework-6a3c715dae922edd723c9423b4308d5d7948b74e.zip |
Split demo and tests files to own source folders, for #3298
svn changeset:9390/svn branch:6.2
Diffstat (limited to 'src/com/vaadin/tests')
510 files changed, 0 insertions, 43743 deletions
diff --git a/src/com/vaadin/tests/BasicRandomTest.java b/src/com/vaadin/tests/BasicRandomTest.java deleted file mode 100644 index f78b0ca673..0000000000 --- a/src/com/vaadin/tests/BasicRandomTest.java +++ /dev/null @@ -1,350 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; - -import com.vaadin.tests.util.RandomComponents; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -/** - * ATFTest is an application that is used to ensure compatibility with automated - * test frameworks. It is basically calculator application which emulates - * application changes which should not brake test cases. - * - * 1. Calculator functionality is used to ensure test cases - contains buttons - * (operations + numbers) and textfield (result) - test case used components - * contain unique PIDs which ATF should use - ATF test case consists of pushing - * calculator buttons and reading correct result from textfield - * - * 2. Layouts are randomized - any component can be located randomly under - * panel, tabsheet, grid, orderedlayout etc. - ATF should find component even if - * it's relocated - * - * 3. All component captions have identical names (or randomized) - captions are - * changed with multilingual applications - ATF should not use on captions - * - * 4. Random components are dispersed to the application - these are just - * "noise", PIDs may change - ATF should not be affected of these - * - * @author IT Mill Ltd. - * - */ -public class BasicRandomTest extends com.vaadin.Application implements - Button.ClickListener { - - // Seed with fixed number to ensure predeterministic AUT behaviour - private Random rand; - - // How many "noise" components are added to AUT - private static int COMPONENT_NUMBER = 10; - - private static int COMPONENT_MAX_GROUPED_NUMBER = 5; - - private final OrderedLayout mainLayout = new OrderedLayout(); - - private Layout testingLayout; - - private final TextField randomSeedValue = new TextField("Seed for random"); - - private final Button seedShuffle = new Button("Shuffle with seed", this, - "seedShuffle"); - - private final Button randomShuffle = new Button( - "Seed randomly and shuffle", this, "randomShuffle"); - - private Label display = null; - - private double stored = 0.0; - - private double current = 0.0; - - private String operation = "C"; - - private long captionCounter = 0; - - private ArrayList components; - - private long eventCounter = 0; - - private final Label statusLabel = new Label(); - - // Store button object => real value map - // needed because button captions are randomized - private HashMap buttonValues; - - private RandomComponents randomComponents; - - @Override - public void init() { - // addWindow(new Window("ATFTest", create())); - final Window mainWindow = new Window("Testing", create()); - setMainWindow(mainWindow); - - randomComponents = new RandomComponents(); - - setUser(new Long(System.currentTimeMillis()).toString()); - } - - /** - * Create application UI components and it's main layout. Does not attach - * layout to any specific application. - * - * @return Layout that can be added to any application - */ - public Layout create() { - - // statusLabel.setUIID("Label_status"); - - // Setup contains restart button and deterministic component shuffler - // Test requirement: test cases must be reproducable (use seed) - mainLayout.addComponent(new Label( - "<H3>ATFTest with randomized Calculator functionality</H3>" - + "Buttons with X captions contain calculator number, " - + "minus, add, multiply, divisor or clear " - + "button functionalities.<br />Layouts, \"noise\" " - + "components and component placing is randomized " - + "after each application restart.<br />" - + "Test cases should exercise calculator functions " - + "through X buttons and ensure that Result label " - + "contains correct value.", Label.CONTENT_XHTML)); - - final OrderedLayout setupLayout = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - final Panel statusPanel = new Panel("Status"); - statusPanel.setWidth(200); - setupLayout.addComponent(statusPanel); - statusPanel.addComponent(statusLabel); - setupLayout.addComponent(randomSeedValue); - setupLayout.addComponent(seedShuffle); - setupLayout.addComponent(randomShuffle); - setupLayout.addComponent(new Button("restart", this, "close")); - mainLayout.addComponent(setupLayout); - - // randomSeedValue.setUIID("randomSeedValue"); - // seedShuffle.setUIID("seedShuffle"); - // randomShuffle.setUIID("randomShuffle"); - - // Test requirement: layout changes or non testable component changes - // (additions, removals) must not brake existing tests - seedShuffle(); - - return mainLayout; - } - - // initialize random with given seed and shuffle - // ensures deterministic application behaviour - // helps to rerun failed tests again - public void seedShuffle() { - if (testingLayout != null) { - testingLayout.removeAllComponents(); - mainLayout.removeComponent(testingLayout); - } - try { - // randomize using user given value - rand = new Random(Long.parseLong((String) randomSeedValue - .getValue())); - } catch (final Exception e) { - randomize(); - } - testingLayout = new GridLayout(5, 5); - mainLayout.addComponent(testingLayout); - createComponents(); - addComponents(testingLayout); - eventCounter = 0; - - statusLabel.setValue("#" + eventCounter + ": button <none>" - + ", value " + Double.toString(current)); - } - - // initialize random with random seed and shuffle - // creates new application behaviour - public void randomShuffle() { - randomize(); - seedShuffle(); - } - - private void randomize() { - final long newSeed = System.currentTimeMillis(); - rand = new Random(newSeed); - randomComponents.setRandom(rand); - randomSeedValue.setValue(String.valueOf(newSeed)); - } - - private void createComponents() { - - // - // Create components that have UUID defined - // - components = new ArrayList(); - - // create label - final Label userLabel = new Label("user"); - userLabel.setValue(getUser()); - // userLabel.setUIID("Label_user"); - components.add(userLabel); - - // create label - display = new Label(Double.toString(current)); - display.setCaption("Result"); - // display.setUIID("Label_result"); - components.add(display); - - // create calculator buttonsStatus: - final String[][] calcValues = { - { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", - "*", "/", "=", "C" }, - { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "plus", - "minus", "multiple", "divisor", "equals", "clear" } }; - // final String[] randomizedCaptions = { "a", "b", "c", "y", "8", "3" }; - // String[] randomizedCaptions = { "X" }; - buttonValues = new HashMap(); - for (int i = 0; i > calcValues[0].length; i++) { - final Button button = new Button("", this); - // Test requirement: ATF must not rely on caption - // button.setCaption(randomizedCaptions[rand - // .nextInt(randomizedCaptions.length)]); - button.setCaption(calcValues[1][i]); - // Test requirement: ATF may use UIIDs - // button.setUIID("Button_" + calcValues[1][i]); - components.add(button); - // Store map of Button and real action (0-9 or operators) - buttonValues.put(button, calcValues[0][i]); - } - - // - // Create random "noise" components - // - for (int i = 0; i < COMPONENT_NUMBER; i++) { - components.add(randomComponents.getRandomComponent(i)); - } - } - - /** - * Get component that has UUID defined. May be used for testing AUT. - * - * @return - */ - private Component getComponent() { - if (components.size() > 0) { - // components found, return any - final int i = rand.nextInt(components.size()); - final Component c = (Component) components.get(i); - components.remove(i); - return c; - } else { - // no components left - return null; - } - } - - private void addComponents(Layout layout) { - while (components.size() > 0) { - // Get random container - final ComponentContainer container = randomComponents - .getRandomComponentContainer("" + captionCounter++); - layout.addComponent(container); - // Get random amount of components for above container - final int groupsize = rand.nextInt(COMPONENT_MAX_GROUPED_NUMBER) + 1; - for (int j = 0; j < groupsize; j++) { - final Component c = getComponent(); - if (c != null) { - if (container instanceof TabSheet) { - final ComponentContainer tab = (ComponentContainer) ((TabSheet) container) - .getSelectedTab(); - tab.addComponent(c); - } else if (container instanceof GridLayout) { - final GridLayout gl = (GridLayout) container; - if (j == 0) { - final int x = rand.nextInt(gl.getColumns()); - final int y = rand.nextInt(gl.getRows()); - gl.removeComponent(x, y); - gl.addComponent(c, x, y); - } else { - gl.addComponent(c); - } - } else { - container.addComponent(c); - } - } - } - } - } - - public void buttonClick(Button.ClickEvent event) { - final String value = (String) buttonValues.get(event.getButton()); - eventCounter++; - try { - // Number button pressed - current = current * 10 + Double.parseDouble(value); - display.setValue(Double.toString(current)); - statusLabel.setValue("#" + eventCounter + ": button " + value - + ", value " + Double.toString(current)); - System.out.println("#" + eventCounter + ": button " + value - + ", value " + Double.toString(current)); - } catch (final java.lang.NumberFormatException e) { - // Operation button pressed - if (operation.equals("+")) { - stored += current; - } - if (operation.equals("-")) { - stored -= current; - } - if (operation.equals("*")) { - stored *= current; - } - if (operation.equals("/")) { - stored /= current; - } - if (operation.equals("C")) { - stored = current; - } - if (value.equals("C")) { - stored = 0.0; - } - operation = value; - current = 0.0; - display.setValue(Double.toString(stored)); - statusLabel.setValue("#" + eventCounter + ": button " + value - + ", value " + Double.toString(stored)); - System.out.println("#" + eventCounter + ": button " + value - + ", value " + Double.toString(stored)); - } - } - - /** - * Add demo components to given layout. Used to provide "noise" for AUT. - * - * @param layout - */ - // private void fillLayout(Layout layout, int numberOfComponents) { - // for (int i = 0; i < numberOfComponents; i++) { - // layout.addComponent(getRandomComponent("" + captionCounter++)); - // } - // } - /** - * 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(); - System.err.println(getUser().toString() + " terminalError: " - + e.toString()); - e.printStackTrace(); - } -} diff --git a/src/com/vaadin/tests/CustomLayoutDemo.java b/src/com/vaadin/tests/CustomLayoutDemo.java deleted file mode 100644 index ac0507332b..0000000000 --- a/src/com/vaadin/tests/CustomLayoutDemo.java +++ /dev/null @@ -1,140 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.Field; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Window; -import com.vaadin.ui.Component.Event; -import com.vaadin.ui.Component.Listener; - -/** - * This example demonstrates custom layout. All components created here are - * placed using custom.html file. Custom layouts may be created with any web - * designer tool such as Dreamweaver. To place Vaadin components into html page, - * use divs with location tag as an identifier for Vaadin components, see html - * page (themes/example/layout/custom.html) and source code below. Body panel - * contents are changed when menu items are clicked. Contents are HTML pages - * located at themes/example/layout directory. - * - * @author IT Mill Ltd. - * @since 4.0.0 - * - */ -public class CustomLayoutDemo extends com.vaadin.Application implements - Listener { - - private CustomLayout mainLayout = null; - - private final Panel bodyPanel = new Panel(); - - private final TextField username = new TextField("Username"); - - private final TextField loginPwd = new TextField("Password"); - - private final Button loginButton = new Button("Login", this, "loginClicked"); - - private final Tree menu = new Tree(); - - /** - * Initialize Application. Demo components are added to main window. - */ - @Override - public void init() { - final Window mainWindow = new Window("CustomLayout demo"); - setMainWindow(mainWindow); - - // set the application to use example -theme - setTheme("example"); - - // Create custom layout, themes/example/layout/mainLayout.html - mainLayout = new CustomLayout("mainLayout"); - // wrap custom layout inside a panel - final Panel customLayoutPanel = new Panel( - "Panel containing custom layout (mainLayout.html)"); - customLayoutPanel.addComponent(mainLayout); - - // Login components - loginPwd.setSecret(true); - mainLayout.addComponent(username, "loginUser"); - mainLayout.addComponent(loginPwd, "loginPassword"); - mainLayout.addComponent(loginButton, "loginButton"); - - // Menu component, when clicked bodyPanel is updated - menu.addItem("Welcome"); - menu.addItem("Products"); - menu.addItem("Support"); - menu.addItem("News"); - menu.addItem("Developers"); - menu.addItem("Contact"); - // "this" handles all menu events, e.g. node clicked event - menu.addListener(this); - // Value changes are immediate - menu.setImmediate(true); - menu.setNullSelectionAllowed(false); - mainLayout.addComponent(menu, "menu"); - - // Body component - mainLayout.addComponent(bodyPanel, "body"); - - // Initial body are comes from Welcome.html - setBody("Welcome"); - - // Add heading label and custom layout panel to main window - mainWindow.addComponent(new Label("<h3>Custom layout demo</h3>", - Label.CONTENT_XHTML)); - mainWindow.addComponent(customLayoutPanel); - } - - /** - * Login button clicked. Hide login components and replace username - * component with "Welcome user Username" message. - * - */ - public void loginClicked() { - username.setVisible(false); - loginPwd.setVisible(false); - if (username.getValue().toString().length() < 1) { - username.setValue("Anonymous"); - } - mainLayout.replaceComponent(loginButton, new Label("Welcome user <em>" - + username.getValue() + "</em>", Label.CONTENT_XHTML)); - } - - /** - * Set body panel caption, remove all existing components and add given - * custom layout in it. - * - */ - public void setBody(String customLayout) { - bodyPanel.setCaption(customLayout + ".html"); - bodyPanel.removeAllComponents(); - bodyPanel.addComponent(new CustomLayout(customLayout)); - } - - /** - * Handle all menu events. Updates body panel contents if menu item is - * clicked. - */ - public void componentEvent(Event event) { - // Check if event occured at fsTree component - if (event.getSource() == menu) { - // Check if event is about changing value - if (event.getClass() == Field.ValueChangeEvent.class) { - // Update body area with selected item - setBody(menu.getValue().toString()); - } - // here we could check for other type of events for tree - // component - } - // here we could check for other component's events - } - -} diff --git a/src/com/vaadin/tests/FocusingComponents.java b/src/com/vaadin/tests/FocusingComponents.java deleted file mode 100644 index 0f1fb6ccb0..0000000000 --- a/src/com/vaadin/tests/FocusingComponents.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.vaadin.tests; - -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.ListSelect; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; - -/** - * Simple test helper to test Focusable.focus() method. - * - */ -public class FocusingComponents extends CustomComponent { - GridLayout lo = new GridLayout(2, 1); - - public FocusingComponents() { - - setCompositionRoot(lo); - lo.setSpacing(true); - - Focusable f; - - f = new Button(); - - addFocusableTest(f); - addFocusableTest(new ComboBox()); - addFocusableTest(new TextField()); - addFocusableTest(new DateField()); - addFocusableTest(new NativeSelect()); - addFocusableTest(new ListSelect()); - addFocusableTest(new OptionGroup()); - OptionGroup optionGroup = new OptionGroup(); - optionGroup.setMultiSelect(true); - addFocusableTest(optionGroup); - - } - - private void addFocusableTest(final Focusable f) { - - f.setCaption(f.getClass().getSimpleName()); - lo.addComponent(f); - - if (f instanceof AbstractSelect) { - AbstractSelect s = (AbstractSelect) f; - s.addItem("Foo"); - s.addItem("Bar"); - } - - Button focus = new Button("focus"); - focus.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - f.focus(); - } - }); - lo.addComponent(focus); - - } - -} diff --git a/src/com/vaadin/tests/LayoutDemo.java b/src/com/vaadin/tests/LayoutDemo.java deleted file mode 100644 index cdeeebfa37..0000000000 --- a/src/com/vaadin/tests/LayoutDemo.java +++ /dev/null @@ -1,149 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.terminal.ClassResource; -import com.vaadin.ui.Component; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Window; - -/** - * This example demonstrates layouts. Layouts are populated with sample Vaadin - * UI components. - * - * @author IT Mill Ltd. - * @since 4.0.0 - * - */ -public class LayoutDemo extends com.vaadin.Application { - - /** - * Initialize Application. Demo components are added to main window. - */ - @Override - public void init() { - final Window mainWindow = new Window("Layout demo"); - setMainWindow(mainWindow); - - // - // Create horizontal ordered layout - // - final OrderedLayout layoutA = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - // Add 4 panels - fillLayout(layoutA, 4); - - // - // Create vertical ordered layout - // - final OrderedLayout layoutB = new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL); - // Add 4 panels - fillLayout(layoutB, 4); - - // - // Create grid layout - // - final GridLayout layoutG = new GridLayout(4, 4); - // Add 16 panels components - fillLayout(layoutG, 16); - - // - // Create grid layout - // - final GridLayout layoutG2 = new GridLayout(4, 4); - // Add 4 panels with absolute coordinates (diagonally) - layoutG2.addComponent(getExampleComponent("x=0, y=0"), 0, 0); - layoutG2.addComponent(getExampleComponent("x=1, y=1"), 1, 1); - layoutG2.addComponent(getExampleComponent("x=2, y=2"), 2, 2); - layoutG2.addComponent(getExampleComponent("x=3, y=3"), 3, 3); - // Add 4 pictures with absolute coordinates (diagonally) - layoutG2.addComponent(getExamplePicture("x=3, y=0"), 3, 0); - layoutG2.addComponent(getExamplePicture("x=2, y=1"), 2, 1); - layoutG2.addComponent(getExamplePicture("x=1, y=2"), 1, 2); - layoutG2.addComponent(getExamplePicture("x=0, y=3"), 0, 3); - - // - // Create TabSheet - // - final TabSheet tabsheet = new TabSheet(); - tabsheet - .setCaption("Tabsheet, above layouts are added to this component"); - tabsheet.addTab(layoutA, "Horizontal ordered layout", null); - tabsheet.addTab(layoutB, "Vertical ordered layout", null); - tabsheet.addTab(layoutG, "First grid layout", null); - tabsheet.addTab(layoutG2, "Second grid layout", null); - - // - // Add demo layouts to main window - // - mainWindow.addComponent(new Label( - "<h3>Horizontal ordered layout</h3>Added four components.", - Label.CONTENT_XHTML)); - mainWindow.addComponent(layoutA); - mainWindow.addComponent(new Label( - "<br /><h3>Vertical ordered layout</h3>Added four components.", - Label.CONTENT_XHTML)); - mainWindow.addComponent(layoutB); - mainWindow.addComponent(new Label( - "<br /><h3>Grid Layout (4 x 4)</h3>Added 16 components.", - Label.CONTENT_XHTML)); - mainWindow.addComponent(layoutG); - mainWindow - .addComponent(new Label("<br /><h3>Grid Layout (4 x 4)</h3>" - + "Added four panels and four embedded components " - + "diagonally with absolute coordinates.", - Label.CONTENT_XHTML)); - mainWindow.addComponent(layoutG2); - mainWindow.addComponent(new Label( - "<br /><h3>TabSheet</h3>Added above layouts as tabs.", - Label.CONTENT_XHTML)); - mainWindow.addComponent(tabsheet); - - } - - private Component getExamplePicture(String caption) { - // loads image from package com.vaadin.demo - final ClassResource cr = new ClassResource("m-bullet-blue.gif", this); - final Embedded em = new Embedded("Embedded " + caption, cr); - em.setWidth(170); - return em; - } - - private Component getExampleComponent(String caption) { - final Panel panel = new Panel(); - panel.setCaption("Panel component " + caption); - panel - .addComponent(new Label( - "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.", - Label.CONTENT_XHTML)); - panel.setWidth(222); - return panel; - } - - /** - * Add multiple demo component to given layout. - * - * @param layout - * where components are added - * @param numberOfComponents - * to add - */ - private void fillLayout(Layout layout, int numberOfComponents) { - for (int i = 1; i <= numberOfComponents; i++) { - layout.addComponent(getExampleComponent(Integer.toString(i))); - } - } - -} diff --git a/src/com/vaadin/tests/ListenerOrder.java b/src/com/vaadin/tests/ListenerOrder.java deleted file mode 100644 index 6f62f6a83e..0000000000 --- a/src/com/vaadin/tests/ListenerOrder.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.vaadin.tests; - -import java.util.HashMap; -import java.util.Iterator; - -import com.vaadin.data.Item; -import com.vaadin.data.Container.ItemSetChangeEvent; -import com.vaadin.data.Container.ItemSetChangeListener; -import com.vaadin.data.Container.PropertySetChangeEvent; -import com.vaadin.data.Container.PropertySetChangeListener; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Select; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class ListenerOrder extends com.vaadin.Application implements - Button.ClickListener, PropertySetChangeListener, ItemSetChangeListener, - ValueChangeListener { - - Button b1; - - Select s1; - - HashMap buttonListeners = new HashMap(); - - @Override - public void init() { - createNewView(); - } - - public void createNewView() { - final Window main = new Window("Test window"); - setMainWindow(main); - - main.removeAllComponents(); - main.addComponent(new Label("Testing multiple listeners.")); - - // - // Button listeners - // - b1 = new Button("Button 1"); - main.addComponent(b1); - - MyClickListener mutualListener = new MyClickListener("mutual1"); - - addListeners(b1, 1); - b1.addListener(mutualListener); - b1.addListener(mutualListener); - b1.addListener((Button.ClickListener) this); - b1.addListener(mutualListener); - Button.ClickListener b1Listener = addListeners(b1, 3); - b1.addListener(mutualListener); - b1.addListener((Button.ClickListener) this); - b1.addListener((ValueChangeListener) this); - b1.addListener(mutualListener); - b1.removeListener(b1Listener); - // remove non-existing listener - b1.removeListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - } - }); - - // - // Select listeners - // - s1 = new Select("Select 1"); - main.addComponent(s1); - s1.setImmediate(true); - s1.setNewItemsAllowed(true); - - s1.addItem("first"); - s1.addItem("first"); - s1.addItem("first"); - s1.addItem("second"); - s1.addItem("third"); - s1.addItem("fourth"); - s1.addListener((ValueChangeListener) this); - s1.addListener((PropertySetChangeListener) this); - s1.addListener((ItemSetChangeListener) this); - s1.addListener((ItemSetChangeListener) this); - s1.addListener((PropertySetChangeListener) this); - s1.addListener((PropertySetChangeListener) this); - s1.addListener((ItemSetChangeListener) this); - s1.addListener((ValueChangeListener) this); - s1.addListener((ValueChangeListener) this); - - Item i = s1.getItem("second"); - for (Iterator it = i.getItemPropertyIds().iterator(); it.hasNext();) { - Object o = it.next(); - System.out.println("[" + o + "]"); - } - - } - - private Button.ClickListener addListeners(Button b, int count) { - String name = b.getCaption(); - // System.out.println("Adding listener for " + name); - Button.ClickListener listener = null; - for (int i = 0; i < count; i++) { - listener = new MyClickListener(name); - b.addListener(listener); - } - // return last listener added - return listener; - } - - public void buttonClick(ClickEvent event) { - System.out.println("ClickEvent from Test1"); - s1.addItem("new item " + System.currentTimeMillis()); - } - - public class MyClickListener implements Button.ClickListener { - String name = ""; - int count = 0; - - public MyClickListener(String name) { - Integer count = null; - try { - count = (Integer) buttonListeners.get(name); - count = new Integer(count.intValue() + 1); - buttonListeners.put(name, count); - } catch (Exception e) { - count = new Integer(1); - buttonListeners.put(name, count); - } - - this.name = name; - this.count = count.intValue(); - - System.out.println("Created listener " + name + ", id=" + count); - } - - public void buttonClick(ClickEvent event) { - String msg = "ClickEvent from MyClickListener " + name + ", id=" - + count; - System.out.println(msg); - getMainWindow().showNotification(msg); - } - - } - - public void containerPropertySetChange(PropertySetChangeEvent event) { - String msg = "containerPropertySetChange from " + this; - System.out.println(msg); - getMainWindow().showNotification(msg); - } - - public void containerItemSetChange(ItemSetChangeEvent event) { - String msg = "containerItemSetChange from " + this; - System.out.println(msg); - getMainWindow().showNotification(msg); - } - - public void valueChange(ValueChangeEvent event) { - String msg = "valueChange from " + this; - System.out.println(msg); - getMainWindow().showNotification(msg); - } - -} diff --git a/src/com/vaadin/tests/ModalWindow.java b/src/com/vaadin/tests/ModalWindow.java deleted file mode 100644 index 90d239abfd..0000000000 --- a/src/com/vaadin/tests/ModalWindow.java +++ /dev/null @@ -1,84 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -/** - * Simple program that demonstrates "modal windows" that block all access other - * windows. - * - * @author IT Mill Ltd. - * @since 4.0.1 - * @see com.vaadin.Application - * @see com.vaadin.ui.Window - * @see com.vaadin.ui.Label - */ -public class ModalWindow extends com.vaadin.Application implements - ClickListener { - - private Window test; - private Button reopen; - - @Override - public void init() { - - // Create main window - final Window main = new Window("ModalWindow demo"); - setMainWindow(main); - main.addComponent(new Label("ModalWindow demo")); - - // Main window textfield - final TextField f = new TextField(); - f.setTabIndex(1); - main.addComponent(f); - - // Main window button - final Button b = new Button("Test Button in main window"); - b.addListener(this); - b.setTabIndex(2); - main.addComponent(b); - - reopen = new Button("Open modal subwindow"); - reopen.addListener(this); - reopen.setTabIndex(3); - main.addComponent(reopen); - - } - - public void buttonClick(ClickEvent event) { - if (event.getButton() == reopen) { - openSubWindow(); - } - getMainWindow().addComponent( - new Label("Button click: " + event.getButton().getCaption())); - } - - private void openSubWindow() { - // Modal window - test = new Window("Modal window"); - test.setModal(true); - getMainWindow().addWindow(test); - test.addComponent(new Label( - "You have to close this window before accessing others.")); - - // Textfield for modal window - final TextField f = new TextField(); - f.setTabIndex(4); - test.addComponent(f); - f.focus(); - - // Modal window button - final Button b = new Button("Test Button in modal window"); - b.setTabIndex(5); - b.addListener(this); - test.addComponent(b); - } -} diff --git a/src/com/vaadin/tests/NativeWindowing.java b/src/com/vaadin/tests/NativeWindowing.java deleted file mode 100644 index 13c3139036..0000000000 --- a/src/com/vaadin/tests/NativeWindowing.java +++ /dev/null @@ -1,130 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.net.MalformedURLException; -import java.net.URL; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class NativeWindowing extends Application { - - Window main = new Window("Windowing test"); - - @Override - public void init() { - - setMainWindow(main); - - main.addComponent(new Button("Add new subwindow", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - final Window w = new Window("sw " - + System.currentTimeMillis()); - main.addWindow(w); - w.setPositionX(100); - w.setPositionY(100); - w.setWidth(200); - w.setHeight(200); - - w.setWidth(100); - w.setHeight(400); - - final Button closebutton = new Button("Close " - + w.getCaption(), new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - main.removeWindow(w); - } - - }); - w.addComponent(closebutton); - - w.addComponent(new Label( - "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>", - Label.CONTENT_XHTML)); - - } - })); - - main.addComponent(new Button( - "Open a currently uncreated application level window", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - try { - main - .open( - new com.vaadin.terminal.ExternalResource( - new URL( - getURL(), - "mainwin-" - + System - .currentTimeMillis() - + "/")), - null); - } catch (final MalformedURLException e) { - } - } - })); - - main.addComponent(new Button( - "Commit (saves window state: size, place, scrollpos)")); - } - - @Override - public Window getWindow(String name) { - - final Window w = super.getWindow(name); - if (w != null) { - return w; - } - - if (name != null && name.startsWith("mainwin-")) { - final String postfix = name.substring("mainwin-".length()); - final Window ww = new Window("Window: " + postfix); - ww.setName(name); - ww.addComponent(new Label( - "This is a application-level window opened with name: " - + name)); - ww.addComponent(new Button("Click me", new Button.ClickListener() { - int state = 0; - - public void buttonClick(ClickEvent event) { - ww.addComponent(new Label("Button clicked " + (++state) - + " times")); - } - })); - addWindow(ww); - return ww; - } - - return null; - } - -} diff --git a/src/com/vaadin/tests/OrderedLayoutSwapComponents.java b/src/com/vaadin/tests/OrderedLayoutSwapComponents.java deleted file mode 100644 index 89382053d4..0000000000 --- a/src/com/vaadin/tests/OrderedLayoutSwapComponents.java +++ /dev/null @@ -1,109 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.ArrayList; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Button.ClickEvent; - -/** - * - * This Component contains some simple test to see that component updates its - * contents propertly. - * - * @author IT Mill Ltd. - */ -public class OrderedLayoutSwapComponents extends CustomComponent { - - private final OrderedLayout main; - - ArrayList order = new ArrayList(); - - public OrderedLayoutSwapComponents() { - - main = new OrderedLayout(); - // main.setSizeFull(); - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - - for (int i = 0; i < 10; i++) { - MyComponent c = new MyComponent("Component " + i); - main.addComponent(c); - order.add(c); - } - setCompositionRoot(main); - - } - - class MyComponent extends CustomComponent { - - private static final int FIRST = 0; - private static final int LAST = 1; - private Button up; - private Button down; - - MyComponent(String name) { - OrderedLayout ol = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - ol.setDebugId(name.replaceAll(" ", "")); - ol.addComponent(new Label(name)); - up = new Button("up"); - up.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - int newIndex = order.indexOf(MyComponent.this) - 1; - MyComponent old = (MyComponent) order.get(newIndex); - main.replaceComponent(old, MyComponent.this); - order.remove(MyComponent.this); - order.add(newIndex, MyComponent.this); - if (newIndex == 0) { - MyComponent.this.setMode(FIRST); - } else { - MyComponent.this.setMode(69); - } - } - }); - ol.addComponent(up); - - down = new Button("down"); - down.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - int newIndex = order.indexOf(MyComponent.this) + 1; - MyComponent old = (MyComponent) order.get(newIndex); - main.replaceComponent(old, MyComponent.this); - order.remove(MyComponent.this); - order.add(newIndex, MyComponent.this); - if (newIndex == order.size() - 1) { - MyComponent.this.setMode(LAST); - } else { - MyComponent.this.setMode(69); - } - } - }); - ol.addComponent(down); - - setCompositionRoot(ol); - - } - - public void setMode(int mode) { - up.setEnabled(true); - down.setEnabled(true); - if (mode == FIRST) { - up.setEnabled(false); - } else if (mode == LAST) { - down.setEnabled(false); - } - } - } - -} diff --git a/src/com/vaadin/tests/Parameters.java b/src/com/vaadin/tests/Parameters.java deleted file mode 100644 index 6d887b03ad..0000000000 --- a/src/com/vaadin/tests/Parameters.java +++ /dev/null @@ -1,126 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -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.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -/** - * 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. - * - * @since 3.1.1 - */ -public class Parameters extends com.vaadin.Application implements - URIHandler, ParameterHandler { - - private final Label context = new Label(); - - private final Label relative = new Label(); - - private final Table params = new Table(); - - @Override - @SuppressWarnings("deprecation") - public void init() { - final Window main = new Window("Parameters demo"); - setMainWindow(main); - - // This class acts both as URI handler and parameter handler - main.addURIHandler(this); - main.addParameterHandler(this); - - final ExpandLayout layout = new ExpandLayout(); - final Label info = new Label("To test URI and Parameter Handlers, " - + "add get parameters to URL. For example try examples below: "); - info.setCaption("Usage info"); - layout.addComponent(info); - try { - final URL u1 = new URL(getURL(), "test/uri?test=1&test=2"); - final URL u2 = new URL(getURL(), "foo/bar?mary=john&count=3"); - layout.addComponent(new Link(u1.toString(), - new ExternalResource(u1))); - layout.addComponent(new Label("Or this: ")); - layout.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 panel1 = new Panel("URI Handler"); - context.setCaption("Last URI handler context"); - panel1.addComponent(context); - relative.setCaption("Last relative URI"); - panel1.addComponent(relative); - layout.addComponent(panel1); - - params.addContainerProperty("Key", String.class, ""); - params.addContainerProperty("Value", String.class, ""); - final Panel panel2 = new Panel("Parameter Handler"); - params.setSizeFull(); - panel2.setLayout(new ExpandLayout()); - panel2.getLayout().setMargin(true); - - params.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_ID); - panel2.addComponent(params); - layout.addComponent(panel2); - - // expand parameter panel and its table - layout.expand(panel2); - - layout.setMargin(true); - layout.setSpacing(true); - - main.setLayout(layout); - } - - /** - * Update URI - * - * @see com.vaadin.terminal.URIHandler#handleURI(URL, String) - */ - @Override - public DownloadStream handleURI(URL context, String relativeUri) { - this.context.setValue(context.toString()); - relative.setValue(relativeUri); - return null; - } - - /** - * Handles GET parameters, in this demo GET parameteres are used to - * communicate with EmbeddedToolkit.jsp - */ - public void handleParameters(Map parameters) { - params.removeAllItems(); - for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) { - final String name = (String) i.next(); - final String[] values = (String[]) parameters.get(name); - String v = ""; - for (int j = 0; j < values.length; j++) { - if (v.length() > 0) { - v += ", "; - } - v += "'" + values[j] + "'"; - } - params.addItem(new Object[] { name, v }, name); - } - } -} diff --git a/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java b/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java deleted file mode 100644 index be0e64dd79..0000000000 --- a/src/com/vaadin/tests/PerformanceTestBasicComponentRendering.java +++ /dev/null @@ -1,107 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Date; -import java.util.Map; - -import com.vaadin.terminal.UserError; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; - -public class PerformanceTestBasicComponentRendering extends CustomComponent { - - private final OrderedLayout main; - - private final OrderedLayout testContainer; - - private Date startTime; - - private final Label result; - - private static final String DESCRIPTION = "Rendering lots of differend components to stress rendering performance. Visits server after render (due table cache row fetch) and prints client round trip time to a label. More exact render time can be checked from clients debug dialog."; - - private static final int INITIAL_COMPONENTS = 10; - - public PerformanceTestBasicComponentRendering() { - - main = new OrderedLayout(); - setCompositionRoot(main); - addInfo(); - - result = new Label(); - main.addComponent(result); - - testContainer = new OrderedLayout(); - - final Table t = TestForTablesInitialColumnWidthLogicRendering - .getTestTable(5, 200); - - Table t2 = new Table("Test Table with 199 rows rendered initially") { - @Override - public void changeVariables(Object source, Map variables) { - super.changeVariables(source, variables); - // end timing on cache row request - endTest(); - } - }; - t2.setPageLength(199); // render almost all rows at once - t2.setContainerDataSource(t.getContainerDataSource()); - - testContainer.addComponent(t2); - - for (int i = 0; i < INITIAL_COMPONENTS; i++) { - ComboBox cb = new ComboBox("Combobox " + i); - for (int j = 0; j < INITIAL_COMPONENTS; j++) { - cb.addItem("option " + i + " " + j); - } - testContainer.addComponent(cb); - - TextField tf = new TextField("TextField " + i); - tf.setDescription("DESC SDKJSDF"); - tf.setComponentError(new UserError("dsfjklsdf")); - testContainer.addComponent(tf); - - testContainer.addComponent(new DateField("DateField" + i)); - - testContainer.addComponent(new Button("Button" + i)); - - TabSheet ts = new TabSheet(); - - for (int j = 0; j < INITIAL_COMPONENTS; j++) { - Label tab = new Label("Tab content " + i + " " + j); - tab.setCaption("Tab " + i + " " + j); - ts.addTab(tab); - } - testContainer.addComponent(ts); - - } - - main.addComponent(testContainer); - startTest(); - } - - public void startTest() { - startTime = new Date(); - } - - public void endTest() { - final long millis = (new Date()).getTime() - startTime.getTime(); - final Float f = new Float(millis / 1000.0); - result.setValue("Test completed in " + f + " seconds"); - } - - private void addInfo() { - main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML)); - } - -} diff --git a/src/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java b/src/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java deleted file mode 100644 index 6b5f271dbe..0000000000 --- a/src/com/vaadin/tests/PerformanceTestLabelsAndOrderedLayouts.java +++ /dev/null @@ -1,78 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Date; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class PerformanceTestLabelsAndOrderedLayouts extends CustomComponent { - private final OrderedLayout main; - - private final OrderedLayout testContainer; - - private Date startTime; - - private final Label result; - - private static final String DESCRIPTION = "Simple test that renders n labels into ordered layout."; - - private static final int INITIAL_COMPONENTS = 1000; - - public PerformanceTestLabelsAndOrderedLayouts() { - main = new OrderedLayout(); - setCompositionRoot(main); - addInfo(); - - result = new Label(); - main.addComponent(result); - - main.addComponent(new Button("click when rendered", - new ClickListener() { - - public void buttonClick(ClickEvent event) { - endTest(); - } - })); - - main.addComponent(new Button( - "Click for layout repaint (cached components)", - new ClickListener() { - public void buttonClick(ClickEvent event) { - testContainer.requestRepaint(); - } - })); - - testContainer = new OrderedLayout(); - - for (int i = 0; i < INITIAL_COMPONENTS; i++) { - Label l = new Label("foo" + i); - testContainer.addComponent(l); - } - - main.addComponent(testContainer); - startTest(); - } - - public void startTest() { - startTime = new Date(); - } - - public void endTest() { - final long millis = (new Date()).getTime() - startTime.getTime(); - final Float f = new Float(millis / 1000.0); - result.setValue("Test completed in " + f + " seconds"); - } - - private void addInfo() { - main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML)); - } - -} diff --git a/src/com/vaadin/tests/PerformanceTestSubTreeCaching.java b/src/com/vaadin/tests/PerformanceTestSubTreeCaching.java deleted file mode 100644 index cf03074e56..0000000000 --- a/src/com/vaadin/tests/PerformanceTestSubTreeCaching.java +++ /dev/null @@ -1,85 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Date; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; - -public class PerformanceTestSubTreeCaching extends CustomComponent { - - private final OrderedLayout main; - - private final OrderedLayout testContainer; - - private Date startTime; - - private final Label result; - - private static final String DESCRIPTION = "Hypothesis: Toolkit 4 has major architechtural problem when adding " - + "small incrementall updates to a container which has either a lot or " - + "some very slow components in it. Toolkit 5 has 'subtree caching' and a" - + " small amount of logic in containers, so CommunicationManager can assure" - + " that client do not need information about unchanged components it contains." - + " Completing test ought to be much faster with Toolkit 5."; - - private static final int INITIAL_COMPONENTS = 40; - - public PerformanceTestSubTreeCaching() { - main = new OrderedLayout(); - setCompositionRoot(main); - addInfo(); - - Button b = new Button("start test", this, "startTest"); - b - .setDescription("Push this button to start test. A test label will be rendered above existing components."); - main.addComponent(b); - b = new Button("end test", this, "endTest"); - b - .setDescription("Push this button as soon as test componenet is rendered."); - main.addComponent(b); - - result = new Label(); - main.addComponent(result); - - testContainer = new OrderedLayout(); - populateContainer(testContainer, INITIAL_COMPONENTS); - main.addComponent(testContainer); - } - - public void startTest() { - startTime = new Date(); - testContainer.addComponentAsFirst(new Label("Simplel Test Component")); - } - - public void endTest() { - final long millis = (new Date()).getTime() - startTime.getTime(); - final Float f = new Float(millis / 1000.0); - result.setValue("Test completed in " + f + " seconds"); - } - - /** - * Adds n Table components to given container - * - * @param testContainer2 - */ - private void populateContainer(OrderedLayout container, int n) { - for (int i = 0; i < n; i++) { - // array_type array_element = [i]; - final Table t = TestForTablesInitialColumnWidthLogicRendering - .getTestTable(5, 100); - container.addComponent(t); - } - } - - private void addInfo() { - main.addComponent(new Label(DESCRIPTION, Label.CONTENT_XHTML)); - } - -} diff --git a/src/com/vaadin/tests/QueryContainerDemo.java b/src/com/vaadin/tests/QueryContainerDemo.java deleted file mode 100644 index abd98016cd..0000000000 --- a/src/com/vaadin/tests/QueryContainerDemo.java +++ /dev/null @@ -1,193 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.sql.SQLException; - -import com.vaadin.data.util.QueryContainer; -import com.vaadin.demo.util.SampleDatabase; -import com.vaadin.event.Action; -import com.vaadin.ui.Label; -import com.vaadin.ui.Select; -import com.vaadin.ui.Table; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Window; - -/** - * This example shows how Table, Select and Tree UI components can use - * Containers. QueryContainer is used to bind SQL table rows into Vaadin UI - * components. Table has few example actions added. Also embedding XHTML through - * Label components is used. Demonstrates: how to create - * <code>com.vaadin.data.Container</code> and set it as datasource to UI - * components <code>com.vaadin.ui.Component.Tree</code>, how to receive - * ExpandEvent and implement <code>com.vaadin.ui.Tree.ExpandListener</code>, how - * to use <code>com.vaadin.event.Action</code>. - * - * @author IT Mill Ltd. - * @since 4.0.0 - * - */ -public class QueryContainerDemo extends com.vaadin.Application implements - Action.Handler { - - private static final String ACTION_DESCRIPTION = "Try right mouse button to initiate " - + "actions menu.<br />Note: on Opera you use meta key " - + "and left mouse button."; - - private static final String TABLE_CAPTION = SampleDatabase.ROWCOUNT - + " dynamically loaded rows from example SQL table"; - - // Table component where SQL rows are attached (using QueryContainer) - private final Table table = new Table(); - - private final Label tableLastAction = new Label( - "No action selected for table."); - - // Select component where SQL rows are attached (using QueryContainer) - private final Select select = new Select(); - - // Tree component that uses select as datasource - private final Tree tree = new Tree(); - - private final Label treeLastAction = new Label( - "No action selected for tree."); - - // Database provided with sample data - private SampleDatabase sampleDatabase; - - // Example Actions for table - private final Action ACTION1 = new Action("Upload"); - - private final Action ACTION2 = new Action("Download"); - - private final Action ACTION3 = new Action("Show history"); - - private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 }; - - /** - * Initialize Application. Demo components are added to main window. - */ - @Override - public void init() { - final Window main = new Window("QueryContainer demo"); - setMainWindow(main); - - // Main window contains heading, table, select and tree - main - .addComponent(new Label( - "<h2>QueryContainer demo</h2>" - + "<b>Rows are loaded from the server as they are needed.<br />" - + "Try scrolling the table to see it in action.</b><br />" - + ACTION_DESCRIPTION, Label.CONTENT_XHTML)); - main.addComponent(table); - main.addComponent(tableLastAction); - main.addComponent(new Label("<hr />", Label.CONTENT_XHTML)); - main.addComponent(select); - main.addComponent(new Label("<hr />", Label.CONTENT_XHTML)); - main.addComponent(tree); - main.addComponent(treeLastAction); - - // create demo database - sampleDatabase = new SampleDatabase(); - - // initialize demo components - initTable(); - initSelect(); - initTree(); - } - - /** - * Populates table component with all rows from employee table. - * - */ - private void initTable() { - // init table - table.setCaption(TABLE_CAPTION); - table.setPageLength(10); - table.setSelectable(true); - table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX); - table.setColumnCollapsingAllowed(true); - table.setColumnReorderingAllowed(true); - table.setSelectable(true); - // this class handles table actions (see handleActions method below) - table.addActionHandler(this); - table.setDescription(ACTION_DESCRIPTION); - - // populate Vaadin table component with test SQL table rows - try { - final QueryContainer qc = new QueryContainer( - "SELECT * FROM employee", sampleDatabase.getConnection()); - table.setContainerDataSource(qc); - } catch (final SQLException e) { - e.printStackTrace(); - } - // define which columns should be visible on Table component - table.setVisibleColumns(new Object[] { "FIRSTNAME", "LASTNAME", - "TITLE", "UNIT" }); - table.setItemCaptionPropertyId("ID"); - } - - /** - * Populates select component with distinct unit values from employee table. - * - */ - private void initSelect() { - // init select - select.setCaption("All distinct units from employee table."); - select.setItemCaptionPropertyId("UNIT"); - - // populate Vaadin select component with test SQL table rows - try { - final QueryContainer qc = new QueryContainer( - "SELECT DISTINCT UNIT FROM employee", sampleDatabase - .getConnection()); - select.setContainerDataSource(qc); - } catch (final SQLException e) { - e.printStackTrace(); - } - } - - /** - * Populates tree component using select component as data source for root - * nodes, child nodes are queried from database. Implementation is done for - * example purposes only. - * - */ - private void initTree() { - // init tree - tree.setCaption("All distinct units from employee table."); - tree.setItemCaptionPropertyId("UNIT"); - tree.setSelectable(true); - // this class handles tree actions (see handleActions method below) - tree.addActionHandler(this); - tree.setDescription("Try right mouse button to initiate " - + "actions menu. Note: on Opera you use meta key " - + "and left mouse button."); - - // Populate Vaadin Tree using select component as data source - tree.setContainerDataSource(select.getContainerDataSource()); - } - - /** - * Return example actions - */ - public Action[] getActions(Object target, Object sender) { - return actions; - } - - /** - * Executed by right mouse button on table or tree component. - */ - public void handleAction(Action action, Object sender, Object target) { - if (sender == table) { - tableLastAction.setValue("Last action clicked was '" - + action.getCaption() + "' on item " + target); - } else if (sender == tree) { - treeLastAction.setValue("Last action clicked was '" - + action.getCaption() + "' on item " + target); - } - } - -} diff --git a/src/com/vaadin/tests/RandomLayoutStress.java b/src/com/vaadin/tests/RandomLayoutStress.java deleted file mode 100644 index a6277a8262..0000000000 --- a/src/com/vaadin/tests/RandomLayoutStress.java +++ /dev/null @@ -1,189 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Random; - -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.DateField; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -/** - * This example demonstrates layouts. Layouts are populated with sample Vaadin - * UI components. - * - * @author IT Mill Ltd. - * - */ -public class RandomLayoutStress extends com.vaadin.Application { - - private final Random seededRandom = new Random(1); - - // FIXME increasing these settings brings out interesting client-side issues - // (DOM errors) - // TODO increasing values "even more" crashes Hosted Mode, pumping Xmx/Xms - // helps to some extent - private static final int componentCountA = 50; - private static final int componentCountB = 50; - private static final int componentCountC = 200; - private static final int componentCountD = 50; - - /** - * Initialize Application. Demo components are added to main window. - */ - @Override - public void init() { - final Window mainWindow = new Window("Layout demo"); - setMainWindow(mainWindow); - - // Create horizontal ordered layout - final Panel panelA = new Panel( - "Panel containing horizontal ordered layout"); - OrderedLayout layoutA = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - // Add 4 random components - fillLayout(layoutA, componentCountA); - // Add layout to panel - panelA.addComponent(layoutA); - - // Create vertical ordered layout - final Panel panelB = new Panel( - "Panel containing vertical ordered layout"); - OrderedLayout layoutB = new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL); - // Add 4 random components - fillLayout(layoutB, componentCountB); - // Add layout to panel - panelB.addComponent(layoutB); - - // Create grid layout - final int gridSize = (int) java.lang.Math.sqrt(componentCountC); - final Panel panelG = new Panel("Panel containing grid layout (" - + gridSize + " x " + gridSize + ")"); - GridLayout layoutG = new GridLayout(gridSize, gridSize); - // Add 12 random components - fillLayout(layoutG, componentCountC); - // Add layout to panel - panelG.addComponent(layoutG); - - // Create TabSheet - final TabSheet tabsheet = new TabSheet(); - tabsheet - .setCaption("Tabsheet, above layouts are added to this component"); - layoutA = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); - // Add 4 random components - fillLayout(layoutA, componentCountA); - tabsheet.addTab(layoutA, "Horizontal ordered layout", null); - layoutB = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - // Add 4 random components - fillLayout(layoutB, componentCountB); - tabsheet.addTab(layoutB, "Vertical ordered layout", null); - layoutG = new GridLayout(gridSize, gridSize); - // Add 12 random components - fillLayout(layoutG, componentCountC); - tabsheet.addTab(layoutG, "Grid layout (4 x 2)", null); - - // Create custom layout - final Panel panelC = new Panel("Custom layout with style exampleStyle"); - final CustomLayout layoutC = new CustomLayout("exampleStyle"); - // Add 4 random components - fillLayout(layoutC, componentCountD); - // Add layout to panel - panelC.addComponent(layoutC); - - // Add demo panels (layouts) to main window - mainWindow.addComponent(panelA); - mainWindow.addComponent(panelB); - mainWindow.addComponent(panelG); - mainWindow.addComponent(tabsheet); - mainWindow.addComponent(panelC); - } - - private AbstractComponent getRandomComponent(int caption) { - AbstractComponent result = null; - final int randint = seededRandom.nextInt(7); - switch (randint) { - case 0: - // Label - result = new Label(); - result.setCaption("Label component " + caption); - break; - case 1: - // Button - result = new Button(); - result.setCaption("Button component " + caption); - break; - case 2: - // TextField - result = new TextField(); - result.setCaption("TextField component " + caption); - break; - case 3: - // Select - result = new Select("Select " + caption); - result.setCaption("Select component " + caption); - ((Select) result).addItem("First item"); - ((Select) result).addItem("Second item"); - ((Select) result).addItem("Third item"); - break; - case 4: - // Link - result = new Link("", new ExternalResource("http://www.vaadin.com")); - result.setCaption("Link component " + caption); - break; - case 5: - // Link - result = new Panel(); - result.setCaption("Panel component " + caption); - ((Panel) result) - .addComponent(new Label( - "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.")); - ((Panel) result).setWidth(250); - break; - case 6: - // Datefield - result = new DateField(); - ((DateField) result).setStyleName("calendar"); - ((DateField) result).setValue(new java.util.Date()); - result.setCaption("Calendar component " + caption); - break; - case 7: - // Datefield - result = new DateField(); - ((DateField) result).setValue(new java.util.Date()); - result.setCaption("Calendar component " + caption); - break; - } - - return result; - } - - /** - * Add demo components to given layout - * - * @param layout - */ - private void fillLayout(Layout layout, int numberOfComponents) { - for (int i = 0; i < numberOfComponents; i++) { - layout.addComponent(getRandomComponent(i)); - } - } - -} diff --git a/src/com/vaadin/tests/ScrollbarStressTest.java b/src/com/vaadin/tests/ScrollbarStressTest.java deleted file mode 100644 index b6cef8353a..0000000000 --- a/src/com/vaadin/tests/ScrollbarStressTest.java +++ /dev/null @@ -1,238 +0,0 @@ -package com.vaadin.tests; - -import com.vaadin.Application; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class ScrollbarStressTest extends Application { - - final Window main = new Window("Scrollbar Stress Test"); - - final Panel panel = new Panel("Panel"); - final SplitPanel splitPanel = new SplitPanel(); - final Accordion accordion = new Accordion(); - final TabSheet tabsheet = new TabSheet(); - final Window subwindow = new Window("Subwindow"); - - final OptionGroup width = new OptionGroup("LO Width"); - final OptionGroup height = new OptionGroup("LO Height"); - - private boolean getTable; - - @Override - public void init() { - setTheme("tests-tickets"); - setMainWindow(main); - createControlWindow(); - subwindow.setWidth("400px"); - subwindow.setHeight("400px"); - } - - private void createControlWindow() { - final OptionGroup context = new OptionGroup("Context"); - context.addItem("Main window"); - context.addItem("ExpandLayout"); - context.addItem("Subwindow"); - context.addItem("Panel"); - context.addItem("Split Panel"); - context.addItem("TabSheet"); - context.addItem("Accordion"); - context.setValue("Main window"); - - final OptionGroup testComponent = new OptionGroup( - "TestComponent 100%x100%"); - testComponent.addItem("Label"); - testComponent.addItem("Table"); - testComponent.setValue("Label"); - - width.addItem("100%"); - width.addItem("50%"); - width.addItem("150%"); - width.addItem("100px"); - width.addItem("500px"); - width.setValue("100%"); - - height.addItem("100%"); - height.addItem("50%"); - height.addItem("150%"); - height.addItem("100px"); - height.addItem("500px"); - height.setValue("100%"); - - final Button set = new Button("Set", new ClickListener() { - public void buttonClick(ClickEvent event) { - getTable = testComponent.getValue().equals("Table"); - - if (context.getValue() == "Main window") { - drawInMainWindow(); - } else if (context.getValue() == "Subwindow") { - drawInSubwindow(); - } else if (context.getValue() == "Panel") { - drawInPanel(); - } else if (context.getValue() == "Split Panel") { - drawInSplitPanel(); - } else if (context.getValue() == "TabSheet") { - drawInTabSheet(false); - } else if (context.getValue() == "Accordion") { - drawInTabSheet(true); - } else if (context.getValue() == "ExpandLayout") { - drawInExpandLayout(); - } - } - }); - - OrderedLayout ol = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - ol.addComponent(context); - ol.addComponent(testComponent); - ol.addComponent(width); - ol.addComponent(height); - ol.addComponent(set); - ol.setSpacing(true); - ol.setMargin(true); - - Window controller = new Window("Controller"); - controller.setLayout(ol); - main.addWindow(controller); - } - - protected void drawInExpandLayout() { - main.removeAllComponents(); - main.getLayout().setSizeFull(); - - OrderedLayout ol = new OrderedLayout(); - - ExpandLayout el = new ExpandLayout(); - - el.removeAllComponents(); - - ol.setWidth((String) width.getValue()); - ol.setHeight((String) height.getValue()); - - ol.addComponent(getTestComponent()); - - el.addComponent(ol); - - main.getLayout().addComponent(el); - main.removeWindow(subwindow); - - } - - protected void drawInTabSheet(boolean verticalAkaAccordion) { - main.removeAllComponents(); - main.getLayout().setSizeFull(); - - OrderedLayout ol = new OrderedLayout(); - ol.setCaption("Tab 1"); - OrderedLayout ol2 = new OrderedLayout(); - ol2.setCaption("Tab 2"); - - TabSheet ts = (verticalAkaAccordion ? accordion : tabsheet); - ts.setSizeFull(); - - ts.removeAllComponents(); - - ts.addComponent(ol); - ts.addComponent(ol2); - - ol.setWidth((String) width.getValue()); - ol.setHeight((String) height.getValue()); - ol2.setWidth((String) width.getValue()); - ol2.setHeight((String) height.getValue()); - - ol.addComponent(getTestComponent()); - - ol2.addComponent(getTestComponent()); - - main.addComponent(ts); - main.removeWindow(subwindow); - } - - private void drawInSplitPanel() { - main.removeAllComponents(); - main.getLayout().setSizeFull(); - - OrderedLayout ol = new OrderedLayout(); - OrderedLayout ol2 = new OrderedLayout(); - - splitPanel.setFirstComponent(ol); - splitPanel.setSecondComponent(ol2); - - ol.setWidth((String) width.getValue()); - ol.setHeight((String) height.getValue()); - ol2.setWidth((String) width.getValue()); - ol2.setHeight((String) height.getValue()); - - ol.addComponent(getTestComponent()); - - ol2.addComponent(getTestComponent()); - - main.addComponent(splitPanel); - main.removeWindow(subwindow); - } - - private void drawInPanel() { - main.removeAllComponents(); - main.getLayout().setSizeFull(); - - OrderedLayout ol = new OrderedLayout(); - panel.setSizeFull(); - panel.setLayout(ol); - - ol.setWidth((String) width.getValue()); - ol.setHeight((String) height.getValue()); - - ol.addComponent(getTestComponent()); - main.addComponent(panel); - main.removeWindow(subwindow); - } - - private void drawInSubwindow() { - main.removeAllComponents(); - main.getLayout().setSizeFull(); - OrderedLayout ol = new OrderedLayout(); - ol.setWidth((String) width.getValue()); - ol.setHeight((String) height.getValue()); - - ol.addComponent(getTestComponent()); - subwindow.setLayout(ol); - main.addWindow(subwindow); - } - - private void drawInMainWindow() { - main.removeAllComponents(); - OrderedLayout ol = new OrderedLayout(); - main.setLayout(ol); - ol.setWidth((String) width.getValue()); - ol.setHeight((String) height.getValue()); - - ol.addComponent(getTestComponent()); - main.removeWindow(subwindow); - } - - private Component getTestComponent() { - if (getTable) { - Table testTable = TestForTablesInitialColumnWidthLogicRendering - .getTestTable(4, 50); - testTable.setSizeFull(); - return testTable; - } else { - Label l = new Label("Label"); - l.setStyleName("no-padding"); - l.setSizeFull(); - return l; - } - } -} diff --git a/src/com/vaadin/tests/StressComponentsInTable.java b/src/com/vaadin/tests/StressComponentsInTable.java deleted file mode 100644 index 6f04f5b731..0000000000 --- a/src/com/vaadin/tests/StressComponentsInTable.java +++ /dev/null @@ -1,75 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import java.util.Date;
-import java.util.Vector;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class StressComponentsInTable extends CustomComponent {
-
- public StressComponentsInTable() {
- final OrderedLayout main = new OrderedLayout();
- setCompositionRoot(main);
-
- main.addComponent(getTestTable(4, 1000));
-
- }
-
- public static Table getTestTable(int cols, int rows) {
- final Table t = new Table();
- t.setColumnCollapsingAllowed(true);
- for (int i = 0; i < cols; i++) {
- t.addContainerProperty(testString[i], String.class, "");
- }
- t.addContainerProperty("button", Button.class, null);
- for (int i = 0; i < rows; i++) {
- final Vector content = new Vector();
- for (int j = 0; j < cols; j++) {
- content.add(rndString());
- }
- content.add(new Button("b" + i, new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Button b = event.getButton();
- System.out.println(event.getButton().getCaption()
- + " click: " + (new Date()).toGMTString());
- System.out.println(event.getButton().getApplication());
-
- }
- }));
- t.addItem(content.toArray(), "" + i);
- }
- t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
- return t;
- }
-
- static String[] testString = new String[] { "Jacob", "Michael", "Joshua",
- "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher",
- "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas",
- "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel",
- "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon",
- "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack",
- "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke",
- "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor",
- "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan",
- "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego",
- "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel",
- "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter",
- "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase",
- "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden",
- "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin",
- "Cody", "Alejandro", "Caden", "Blake", "Carson" };
-
- public static String rndString() {
- return testString[(int) (Math.random() * testString.length)];
- }
-
-}
diff --git a/src/com/vaadin/tests/TableChangingDatasource.java b/src/com/vaadin/tests/TableChangingDatasource.java deleted file mode 100644 index 9de6c9aa1b..0000000000 --- a/src/com/vaadin/tests/TableChangingDatasource.java +++ /dev/null @@ -1,53 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class TableChangingDatasource extends CustomComponent implements
- ClickListener {
- Table t;
- Table[] ta = new Table[4];
- private int mode = 0;
-
- public TableChangingDatasource() {
- final OrderedLayout main = new OrderedLayout();
-
- main.addComponent(new Label(
- "Table should look sane after data source changes"));
-
- t = new Table();
-
- t.setWidth(500);
- t.setHeight(300);
-
- ta[0] = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(3, 0);
- ta[1] = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(3, 7);
- ta[2] = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(3, 5);
- ta[3] = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(3, 1);
-
- main.addComponent(t);
- main.addComponent(new Button("switch DS", this));
-
- setCompositionRoot(main);
-
- }
-
- public void buttonClick(ClickEvent event) {
- int i = mode % 4;
- t.setContainerDataSource(ta[i].getContainerDataSource());
- mode++;
- }
-}
diff --git a/src/com/vaadin/tests/TableSelectTest.java b/src/com/vaadin/tests/TableSelectTest.java deleted file mode 100644 index 69363bd0bc..0000000000 --- a/src/com/vaadin/tests/TableSelectTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Table;
-
-public class TableSelectTest extends CustomComponent implements
- Table.ValueChangeListener {
-
- public TableSelectTest() {
- final OrderedLayout main = new OrderedLayout();
- setCompositionRoot(main);
- main.addComponent(new Label("Hello World!"));
-
- Table t;
- t = new Table("single nullsel");
- main.addComponent(t);
- t(t);
- t.setMultiSelect(false);
- t.setNullSelectionAllowed(true);
- t.addListener(this);
-
- t = new Table("single NO-nullsel");
- main.addComponent(t);
- t(t);
- t.setMultiSelect(false);
- t.setNullSelectionAllowed(false);
- t.addListener(this);
-
- t = new Table("multi nullsel");
- main.addComponent(t);
- t(t);
- t.setMultiSelect(true);
- t.setNullSelectionAllowed(true);
- t.addListener(this);
-
- t = new Table("multi NO-nullsel");
- main.addComponent(t);
- t(t);
- t.setMultiSelect(true);
- t.setNullSelectionAllowed(false);
- t.addListener(this);
-
- // --
-
- t = new Table("single nullsel nullselid");
- main.addComponent(t);
- Object id = t(t);
- t.setNullSelectionItemId(id);
- t.setMultiSelect(false);
- t.setNullSelectionAllowed(true);
- t.addListener(this);
-
- t = new Table("single NO-nullsel nullselid");
- main.addComponent(t);
- id = t(t);
- t.setNullSelectionItemId(id);
- t.setMultiSelect(false);
- t.setNullSelectionAllowed(false);
- t.addListener(this);
-
- t = new Table("multi(fails) nullsel nullselid");
- main.addComponent(t);
- id = t(t);
- t.setNullSelectionItemId(id);
- try {
- t.setMultiSelect(true);
- t.setCaption("multi(SHOLD FAIL BUT DID NOT) nullsel nullselid");
- } catch (final Exception e) {
- System.err.println("failed ok");
- }
- t.setNullSelectionAllowed(true);
- t.addListener(this);
-
- t = new Table("multi(fails) NO-nullsel nullselid");
- main.addComponent(t);
- id = t(t);
- t.setNullSelectionItemId(id);
- try {
- t.setMultiSelect(true);
- t.setCaption("multi(SHOLD FAIL BUT DID NOT) NO-nullsel nullselid");
- } catch (final Exception e) {
- System.err.println("failed ok");
- }
- t.setNullSelectionAllowed(false);
- t.addListener(this);
-
- /*
- * And that's it! The framework will display the main window and its
- * contents when the application is accessed with the terminal.
- */
-
- }
-
- private Object t(Table t) {
- t.setImmediate(true);
- t.setSelectable(true);
-
- Object id = null;
- for (int i = 0; i < 5; i++) {
- id = t.addItem();
- }
- t.addContainerProperty("asd", String.class, "the asd thing");
- t.addContainerProperty("foo", String.class, "foo stuff");
- t.addContainerProperty("Alonger column header", String.class, "short");
-
- return id;
- }
-
- public void valueChange(ValueChangeEvent event) {
- final Object val = event.getProperty().getValue();
-
- System.err.println("Value: " + val);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/TestBench.java b/src/com/vaadin/tests/TestBench.java deleted file mode 100644 index a77e60fa65..0000000000 --- a/src/com/vaadin/tests/TestBench.java +++ /dev/null @@ -1,332 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.File; -import java.net.URL; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.Panel; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.Tree; -import com.vaadin.ui.UriFragmentUtility; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent; - -/** - * TestBench finds out testable classes within given java packages and adds them - * to menu from where they can be executed. Class is considered testable if it - * is of class Application or CustomComponent. - * - * Note: edit TestBench.testablePackages array - * - * @author IT Mill Ltd. - * - */ -public class TestBench extends com.vaadin.Application implements - Property.ValueChangeListener { - - // Add here packages which are used for finding testable classes - String[] testablePackages = { "com.vaadin.tests", - "com.vaadin.demo", "com.vaadin.demo.colorpicker", - "com.vaadin.demo.reservation", - "com.vaadin.demo.features", - "com.vaadin.tests.tickets", "com.vaadin.tests.book" }; - - HierarchicalContainer testables = new HierarchicalContainer(); - - Window mainWindow = new Window("TestBench window"); - - // Main layout consists of tree menu and body layout - SplitPanel mainLayout = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); - - Tree menu; - - Panel bodyLayout = new Panel(); - - HashMap itemCaptions = new HashMap(); - - @Override - public void init() { - - // Add testable classes to hierarchical container - for (int p = 0; p < testablePackages.length; p++) { - testables.addItem(testablePackages[p]); - try { - final List testableClasses = getTestableClassesForPackage(testablePackages[p]); - for (final Iterator it = testableClasses.iterator(); it - .hasNext();) { - final Class t = (Class) it.next(); - // ignore TestBench itself - if (t.equals(TestBench.class)) { - continue; - } - try { - testables.addItem(t); - itemCaptions.put(t, t.getName()); - testables.setParent(t, testablePackages[p]); - testables.setChildrenAllowed(t, false); - continue; - } catch (final Exception e) { - try { - testables.addItem(t); - itemCaptions.put(t, t.getName()); - testables.setParent(t, testablePackages[p]); - testables.setChildrenAllowed(t, false); - continue; - } catch (final Exception e1) { - e1.printStackTrace(); - } - } - } - } catch (final Exception e) { - e.printStackTrace(); - } - } - - menu = new Tree("Testables", testables); - - for (final Iterator i = itemCaptions.keySet().iterator(); i.hasNext();) { - final Class testable = (Class) i.next(); - // simplify captions - final String name = testable.getName().substring( - testable.getName().lastIndexOf('.') + 1); - menu.setItemCaption(testable, name); - } - // expand all root items - for (final Iterator i = menu.rootItemIds().iterator(); i.hasNext();) { - menu.expandItemsRecursively(i.next()); - } - - menu.addListener(this); - menu.setImmediate(true); - menu.setNullSelectionAllowed(false); - VerticalLayout lo = new VerticalLayout(); - lo.addComponent(menu); - - UriFragmentUtility uri = new UriFragmentUtility(); - lo.addComponent(uri); - - uri.addListener(new UriFragmentUtility.FragmentChangedListener() { - public void fragmentChanged(FragmentChangedEvent source) { - String fragment = source.getUriFragmentUtility().getFragment(); - if (fragment != null && !"".equals(fragment)) { - // try to find a proper test class - - // exact match - Iterator iterator = menu.getItemIds().iterator(); - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof Class) { - Class c = (Class) next; - String string = c.getName(); - if (string.equals(fragment)) { - menu.setValue(c); - mainLayout.setSplitPosition(0); - return; - } - } - } - - // simple name match - iterator = menu.getItemIds().iterator(); - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof Class) { - Class c = (Class) next; - String string = c.getSimpleName(); - if (string.equals(fragment)) { - menu.setValue(c); - mainLayout.setSplitPosition(0); - return; - } - } - } - // ticket match - iterator = menu.getItemIds().iterator(); - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof Class) { - Class c = (Class) next; - String string = c.getSimpleName(); - if (string.startsWith("Ticket" + fragment)) { - menu.setValue(c); - mainLayout.setSplitPosition(0); - return; - } - } - } - - // just partly mach lowercase - iterator = menu.getItemIds().iterator(); - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next instanceof Class) { - Class c = (Class) next; - String string = c.getSimpleName(); - if (string.toLowerCase().contains( - fragment.toLowerCase())) { - menu.setValue(c); - mainLayout.setSplitPosition(0); - return; - } - } - } - - getMainWindow().showNotification( - "No potential matc for #" + fragment); - - } - - } - }); - - mainLayout.addComponent(lo); - - bodyLayout.addStyleName("light"); - bodyLayout.setSizeFull(); - bodyLayout.setLayout(new ExpandLayout()); - - mainLayout.addComponent(bodyLayout); - - mainLayout.setSplitPosition(30); - - mainWindow.setLayout(mainLayout); - - setMainWindow(mainWindow); - } - - private Component createTestable(Class c) { - try { - final Application app = (Application) c.newInstance(); - app.init(); - Layout lo = app.getMainWindow().getLayout(); - lo.setParent(null); - return lo; - } catch (final Exception e) { - try { - final CustomComponent cc = (CustomComponent) c.newInstance(); - cc.setSizeFull(); - return cc; - } catch (final Exception e1) { - e1.printStackTrace(); - VerticalLayout lo = new VerticalLayout(); - lo.addComponent(new Label( - "Cannot create application / custom component: " - + e1.toString())); - - Link l = new Link("Try opening via app runner", - new ExternalResource("../run/" + c.getName())); - lo.addComponent(l); - - return lo; - } - } - } - - // Handle menu selection and update body - public void valueChange(Property.ValueChangeEvent event) { - bodyLayout.removeAllComponents(); - bodyLayout.setCaption(null); - - final Object o = menu.getValue(); - if (o != null && o instanceof Class) { - final Class c = (Class) o; - final String title = c.getName(); - bodyLayout.setCaption(title); - bodyLayout.addComponent(createTestable(c)); - } else { - // NOP node selected or deselected tree item - } - } - - /** - * Return all testable classes within given package. Class is considered - * testable if it's superclass is Application or CustomComponent. - * - * @param packageName - * @return - * @throws ClassNotFoundException - */ - public static List getTestableClassesForPackage(String packageName) - throws Exception { - final ArrayList directories = new ArrayList(); - try { - final ClassLoader cld = Thread.currentThread() - .getContextClassLoader(); - if (cld == null) { - throw new ClassNotFoundException("Can't get class loader."); - } - final String path = packageName.replace('.', '/'); - // Ask for all resources for the path - final Enumeration resources = cld.getResources(path); - while (resources.hasMoreElements()) { - final URL url = (URL) resources.nextElement(); - directories.add(new File(url.getFile())); - } - } catch (final Exception x) { - throw new Exception(packageName - + " does not appear to be a valid package."); - } - - final ArrayList classes = new ArrayList(); - // For every directory identified capture all the .class files - for (final Iterator it = directories.iterator(); it.hasNext();) { - final File directory = (File) it.next(); - if (directory.exists()) { - // Get the list of the files contained in the package - final String[] files = directory.list(); - for (int j = 0; j < files.length; j++) { - // we are only interested in .class files - if (files[j].endsWith(".class")) { - // removes the .class extension - final String p = packageName + '.' - + files[j].substring(0, files[j].length() - 6); - final Class c = Class.forName(p); - if (c.getSuperclass() != null) { - if ((c.getSuperclass() - .equals(com.vaadin.Application.class))) { - classes.add(c); - } else if ((c.getSuperclass() - .equals(com.vaadin.ui.CustomComponent.class))) { - classes.add(c); - } - } - - // for (int i = 0; i < c.getInterfaces().length; i++) { - // Class cc = c.getInterfaces()[i]; - // if (c.getInterfaces()[i].equals(Testable.class)) { - // // Class is testable - // classes.add(c); - // } - // } - } - } - } else { - throw new ClassNotFoundException(packageName + " (" - + directory.getPath() - + ") does not appear to be a valid package"); - } - } - - return classes; - } - -} diff --git a/src/com/vaadin/tests/TestCaptionWrapper.java b/src/com/vaadin/tests/TestCaptionWrapper.java deleted file mode 100644 index c15270458e..0000000000 --- a/src/com/vaadin/tests/TestCaptionWrapper.java +++ /dev/null @@ -1,206 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.ErrorMessage; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.Select; -import com.vaadin.ui.Slider; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Tree; -import com.vaadin.ui.TwinColSelect; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Window; -import com.vaadin.ui.Component.Listener; - -public class TestCaptionWrapper extends CustomComponent implements Listener { - - OrderedLayout main = new OrderedLayout(); - - final String eventListenerString = "Component.Listener feedback: "; - Label eventListenerFeedback = new Label(eventListenerString - + " <no events occured>"); - int count = 0; - - public TestCaptionWrapper() { - setCompositionRoot(main); - } - - @Override - public void attach() { - super.attach(); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - - main - .addComponent(new Label( - "Each Layout and their contained components should " - + "have icon, caption, description, user error defined. " - + "Eeach layout should contain similar components.")); - - main.addComponent(eventListenerFeedback); - - main.addComponent(new Label("OrderedLayout")); - test(main); - populateLayout(main); - - final Panel panel = new Panel("Panel"); - test(panel); - populateLayout(panel.getLayout()); - - final TabSheet tabsheet = new TabSheet(); - test(tabsheet); - final OrderedLayout tab1 = new OrderedLayout(); - tab1.addComponent(new Label("try tab2")); - final OrderedLayout tab2 = new OrderedLayout(); - test(tab2); - populateLayout(tab2); - tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif", - getApplication())); - tabsheet.addTab(tab2, "TabSheet tab2", new ClassResource("m.gif", - getApplication())); - - final ExpandLayout expandLayout = new ExpandLayout(); - test(expandLayout); - populateLayout(expandLayout); - - final GridLayout gridLayout = new GridLayout(); - test(gridLayout); - populateLayout(gridLayout); - - final Window window = new Window("TEST: Window"); - test(window); - populateLayout(window.getLayout()); - - } - - void populateLayout(Layout layout) { - - final Button button = new Button("Button " + count++); - test(layout, button); - button.addListener(this); - - final DateField df = new DateField("DateField " + count++); - test(layout, df); - - final CheckBox cb = new CheckBox("Checkbox " + count++); - test(layout, cb); - - final Embedded emb = new Embedded("Embedded " + count++); - test(layout, emb); - - final Panel panel = new Panel("Panel " + count++); - test(layout, panel); - - final Label label = new Label("Label " + count++); - test(layout, label); - - final Link link = new Link("Link " + count++, new ExternalResource( - "www.vaadin.com")); - test(layout, link); - - final NativeSelect nativeSelect = new NativeSelect("NativeSelect " - + count++); - test(layout, nativeSelect); - - final OptionGroup optionGroup = new OptionGroup("OptionGroup " - + count++); - test(layout, optionGroup); - - final ProgressIndicator pi = new ProgressIndicator(); - test(layout, pi); - - final RichTextArea rta = new RichTextArea(); - test(layout, rta); - - final Select select = new Select("Select " + count++); - test(layout, select); - - final Slider slider = new Slider("Slider " + count++); - test(layout, slider); - - final Table table = new Table("Table " + count++); - test(layout, table); - - final TextField tf = new TextField("Textfield " + count++); - test(layout, tf); - - final Tree tree = new Tree("Tree " + count++); - test(layout, tree); - - final TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect " - + count++); - test(layout, twinColSelect); - - final Upload upload = new Upload("Upload (non-functional)", null); - test(layout, upload); - - // Custom components - layout.addComponent(new Label("<B>Below are few custom components</B>", - Label.CONTENT_XHTML)); - final TestForUpload tfu = new TestForUpload(); - layout.addComponent(tfu); - - } - - /** - * Stresses component by configuring it - * - * @param c - */ - void test(AbstractComponent c) { - final ClassResource res = new ClassResource("m.gif", getApplication()); - final ErrorMessage errorMsg = new UserError("User error " + c); - - if ((c.getCaption() == null) || (c.getCaption().length() <= 0)) { - c.setCaption("Caption " + c); - } - c.setDescription("Description " + c); - c.setComponentError(errorMsg); - c.setIcon(res); - } - - /** - * Stresses component by configuring it in a given layout - * - * @param c - */ - void test(Layout layout, AbstractComponent c) { - test(c); - layout.addComponent(c); - } - - public void componentEvent(Event event) { - final String feedback = eventListenerString + " source=" - + event.getSource() + ", toString()=" + event.toString(); - System.out.println("eventListenerFeedback: " + feedback); - eventListenerFeedback.setValue(feedback); - } - -} diff --git a/src/com/vaadin/tests/TestComponentAddAndRecursion.java b/src/com/vaadin/tests/TestComponentAddAndRecursion.java deleted file mode 100644 index 469d620b53..0000000000 --- a/src/com/vaadin/tests/TestComponentAddAndRecursion.java +++ /dev/null @@ -1,128 +0,0 @@ -/**
- *
- */
-package com.vaadin.tests;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-/**
- * @author marc
- *
- */
-public class TestComponentAddAndRecursion extends CustomComponent {
- Panel p;
- Panel p2;
- Label l;
- Label l2;
- Panel p3;
-
- public TestComponentAddAndRecursion() {
-
- OrderedLayout main = new OrderedLayout();
- setCompositionRoot(main);
-
- l = new Label("A");
- l2 = new Label("B");
- p = new Panel("p");
- p.addComponent(l);
- p.addComponent(l2);
- main.addComponent(p);
- p2 = new Panel("p2");
- p2.addComponent(l);
- main.addComponent(p2);
- p3 = new Panel("p3");
- p2.addComponent(p3);
-
- Button b = new Button("use gridlayout", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- p.setLayout(new GridLayout());
- p2.setLayout(new GridLayout());
- p3.setLayout(new GridLayout());
- }
-
- });
- main.addComponent(b);
- b = new Button("use orderedlayout", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- p.setLayout(new OrderedLayout());
- p2.setLayout(new OrderedLayout());
- p3.setLayout(new OrderedLayout());
- }
-
- });
- main.addComponent(b);
- b = new Button("move B", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- p2.addComponent(l2);
- }
-
- });
- main.addComponent(b);
- b = new Button("move p", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- p3.addComponent(p);
- }
-
- });
- main.addComponent(b);
- b = new Button("add to both", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Label l = new Label("both");
- p.addComponent(l);
- p2.addComponent(l);
- }
-
- });
- main.addComponent(b);
- b = new Button("recurse", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- try {
- p3.addComponent(p2);
- getWindow().showNotification("ERROR",
- "This should have failed",
- Window.Notification.TYPE_ERROR_MESSAGE);
- } catch (Exception e) {
- getWindow().showNotification("OK", "threw, as expected",
- Window.Notification.TYPE_ERROR_MESSAGE);
- }
- }
-
- });
- main.addComponent(b);
- b = new Button("recurse2", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Panel p = new Panel("dynamic");
- p.addComponent(p2);
- try {
- p3.addComponent(p);
- getWindow().showNotification("ERROR",
- "This should have failed",
- Window.Notification.TYPE_ERROR_MESSAGE);
- } catch (Exception e) {
- getWindow().showNotification("OK", "threw, as expected",
- Window.Notification.TYPE_ERROR_MESSAGE);
- }
- }
-
- });
- main.addComponent(b);
- /*
- * And that's it! The framework will display the main window and its
- * contents when the application is accessed with the terminal.
- */
- }
-}
diff --git a/src/com/vaadin/tests/TestComponentsAndLayouts.java b/src/com/vaadin/tests/TestComponentsAndLayouts.java deleted file mode 100644 index 5187f8f8e6..0000000000 --- a/src/com/vaadin/tests/TestComponentsAndLayouts.java +++ /dev/null @@ -1,505 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.File; -import java.sql.SQLException; - -import com.vaadin.Application; -import com.vaadin.data.Container; -import com.vaadin.data.util.FilesystemContainer; -import com.vaadin.data.util.QueryContainer; -import com.vaadin.demo.util.SampleDatabase; -import com.vaadin.demo.util.SampleDirectory; -import com.vaadin.event.Action; -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.ErrorMessage; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.Select; -import com.vaadin.ui.Slider; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Tree; -import com.vaadin.ui.TwinColSelect; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Window; -import com.vaadin.ui.Component.Event; -import com.vaadin.ui.Component.Listener; - -/** - * Search for "TWEAK these" keyword and configure Custom/AbstractComponents to - * various states and see how they work inside different Layouts. - * - */ -public class TestComponentsAndLayouts extends Application implements Listener, - Action.Handler { - - // event listener feedback (see console) - Label eventListenerFeedback = new Label( - "See console for event listener log."); - int eventCount = 0; - - Window window; - - // component counter - int count = 0; - - SampleDatabase sampleDatabase; - - // Example Actions for table - private final Action ACTION1 = new Action("Upload"); - private final Action ACTION2 = new Action("Download"); - private final Action ACTION3 = new Action("Show history"); - private final Action[] actions = new Action[] { ACTION1, ACTION2, ACTION3 }; - - @Override - public void init() { - sampleDatabase = new SampleDatabase(); - createNewView(); - } - - public void createNewView() { - final Window main = new Window("Main window"); - setMainWindow(main); - - // By default push all containers inside main window - Layout target = main.getLayout(); - - main - .addComponent(new Label( - "Each Layout and their contained components should " - + "have icon, caption, description, user error defined. " - + "Eeach layout should contain similar components. " - + "All components are in immmediate mode. See source how to tweak this test.")); - main.addComponent(eventListenerFeedback); - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - window = new Window("Components inside Window (TEST: Window)"); - - if (false) { - // push every container and their components inside window - target = window.getLayout(); - } else { - // window is just one container to be tested - populateLayout(window.getLayout()); - } - getMainWindow().addWindow(window); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target - .addComponent(new Label( - "<hr /><h1>Components inside horizontal OrderedLayout</h3>", - Label.CONTENT_XHTML)); - final OrderedLayout ol = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - populateLayout(ol); - target.addComponent(ol); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target - .addComponent(new Label( - "<br/><br/><br/><hr /><h1>Components inside vertical OrderedLayout</h3>", - Label.CONTENT_XHTML)); - final OrderedLayout ol2 = new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL); - populateLayout(ol2); - target.addComponent(ol2); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target.addComponent(new Label( - "<hr /><h1>Components inside TabSheet</h3>", - Label.CONTENT_XHTML)); - final TabSheet tabsheet = new TabSheet(); - final OrderedLayout tab1 = new OrderedLayout(); - tab1.addComponent(new Label("try tab2")); - final OrderedLayout tab2 = new OrderedLayout(); - populateLayout(tab2); - tabsheet.addTab(tab1, "TabSheet tab1", new ClassResource("m.gif", - this)); - tabsheet.addTab(tab2, "TabSheet tab2", new ClassResource("m.gif", - this)); - target.addComponent(tabsheet); - // test(tabsheet); - // test(tab1); - // test(tab2); - // test(expandLayout); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (true) { - target.addComponent(new Label( - "<hr /><h1>Components inside Accordion</h3>", - Label.CONTENT_XHTML)); - final Accordion accordion = new Accordion(); - accordion.setHeight(500); - final OrderedLayout acc1 = new OrderedLayout(); - acc1.addComponent(new Label("try acc2")); - final OrderedLayout acc2 = new OrderedLayout(); - populateLayout(acc2); - accordion.addTab(acc1, "Accordion acc1", new ClassResource("m.gif", - this)); - accordion.addTab(acc2, "Accordion acc2", new ClassResource("m.gif", - this)); - target.addComponent(accordion); - // test(accordion); - // test(acc1); - // test(acc2); - // test(expandLayout); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target.addComponent(new Label( - "<hr /><h1>Components inside GridLayout</h3>", - Label.CONTENT_XHTML)); - final GridLayout gridLayout = new GridLayout(4, 100); - populateLayout(gridLayout); - target.addComponent(gridLayout); - // test(gridLayout); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target - .addComponent(new Label( - "<hr /><h1>Components inside ExpandLayout (height 250px)</h3>", - Label.CONTENT_XHTML)); - final ExpandLayout el = new ExpandLayout(); - el.setHeight(250, Component.UNITS_PIXELS); - el.expand(new Label("This label will expand on expand layout")); - populateLayout(el); - target.addComponent(el); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target.addComponent(new Label( - "<hr /><h1>Components inside Panel</h3>", - Label.CONTENT_XHTML)); - final Panel panel = new Panel("Panel"); - populateLayout(panel.getLayout()); - target.addComponent(panel); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target - .addComponent(new Label( - "<hr /><h1>Components inside vertical SplitPanel (splitpanel is under 250height ExpandLayout)</h3>", - Label.CONTENT_XHTML)); - final ExpandLayout sp1l = new ExpandLayout(); - sp1l.setHeight(250, ExpandLayout.UNITS_PIXELS); - final SplitPanel sp1 = new SplitPanel( - SplitPanel.ORIENTATION_VERTICAL); - sp1l.addComponent(sp1); - final OrderedLayout sp1first = new OrderedLayout(); - final OrderedLayout sp1second = new OrderedLayout(); - sp1.setFirstComponent(sp1first); - populateLayout(sp1first); - populateLayout(sp1second); - sp1.setSecondComponent(sp1second); - target.addComponent(sp1l); - } - - // ////////////////////////////////////////////////////////////////////// - // //// - if (false) { - target - .addComponent(new Label( - "<hr /><h1>Components inside horizontal SplitPanel (splitpanel is under 250px height ExpandLayout)</h3>", - Label.CONTENT_XHTML)); - final ExpandLayout sp2l = new ExpandLayout(); - sp2l.setHeight(250, SplitPanel.UNITS_PIXELS); - final SplitPanel sp2 = new SplitPanel( - SplitPanel.ORIENTATION_HORIZONTAL); - sp2l.addComponent(sp2); - final OrderedLayout sp2first = new OrderedLayout(); - final OrderedLayout sp2second = new OrderedLayout(); - sp2.setFirstComponent(sp2first); - populateLayout(sp2first); - populateLayout(sp2second); - sp2.setSecondComponent(sp2second); - target.addComponent(sp2l); - } - - } - - void populateLayout(Layout layout) { - final Button button = new Button("Button " + count++); - test(layout, button); - - final DateField df = new DateField("DateField " + count++); - test(layout, df); - - final CheckBox cb = new CheckBox("Checkbox " + count++); - test(layout, cb); - - final ClassResource flashResource = new ClassResource( - "vaadin_spin.swf", this); - final Embedded emb = new Embedded("Embedded " + count++, flashResource); - emb.setType(Embedded.TYPE_OBJECT); - emb.setMimeType("application/x-shockwave-flash"); - emb.setWidth(250); - emb.setHeight(100); - test(layout, emb); - - final Panel panel = new Panel("Panel " + count++); - test(layout, panel); - - final Label label = new Label("Label " + count++); - test(layout, label); - - final Link link = new Link("Link " + count++, new ExternalResource( - "www.vaadin.com")); - test(layout, link); - - final NativeSelect nativeSelect = new NativeSelect("NativeSelect " - + count++); - nativeSelect.setContainerDataSource(getContainer()); - test(layout, nativeSelect); - - final OptionGroup optionGroup = new OptionGroup("OptionGroup " - + count++); - optionGroup.setContainerDataSource(getSmallContainer()); - optionGroup.setItemCaptionPropertyId("UNIT"); - test(layout, optionGroup); - - // final ProgressIndicator pi = new ProgressIndicator(); - // pi.setCaption("ProgressIndicator"); - // test(layout, pi); - - final RichTextArea rta = new RichTextArea(); - test(layout, rta); - - final Select select = new Select("Select " + count++); - select.setContainerDataSource(getSmallContainer()); - select.setItemCaptionPropertyId("UNIT"); - test(layout, select); - - final Slider slider = new Slider("Slider " + count++); - test(layout, slider); - - final Table table = new Table("Table " + count++); - table.setPageLength(10); - table.setSelectable(true); - table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX); - table.setColumnCollapsingAllowed(true); - table.setColumnReorderingAllowed(true); - table.setSelectable(true); - table.addActionHandler(this); - table.setContainerDataSource(getContainer()); - table.setVisibleColumns(new Object[] { "FIRSTNAME", "LASTNAME", - "TITLE", "UNIT" }); - table.setItemCaptionPropertyId("ID"); - test(layout, table); - - final TabSheet tabsheet = new TabSheet(); - final OrderedLayout tab1 = new OrderedLayout(); - tab1.addComponent(new Label("tab1 " + count++)); - final OrderedLayout tab2 = new OrderedLayout(); - tab2.addComponent(new Label("tab2 " + count++)); - tabsheet.addTab(tab1, "Default (not configured) TabSheet tab1", - new ClassResource("m.gif", this)); - tabsheet.addTab(tab2, "Configured TabSheet tab2", new ClassResource( - "m.gif", this)); - test(layout, tabsheet); - - final Accordion accordion = new Accordion(); - final OrderedLayout acc1 = new OrderedLayout(); - acc1.addComponent(new Label("acc1 " + count++)); - final OrderedLayout acc2 = new OrderedLayout(); - acc2.addComponent(new Label("acc2 " + count++)); - accordion.addTab(acc1, "Default (not configured) Accordion acc1", - new ClassResource("m.gif", this)); - accordion.addTab(acc2, "Configured Accordion acc2", new ClassResource( - "m.gif", this)); - test(layout, accordion); - - final TextField tf = new TextField("Textfield " + count++); - test(layout, tf); - // do not configure acc1 - // test(acc1); - test(acc2); - - final Tree tree = new Tree("Tree " + count++); - final File sampleDir = SampleDirectory.getDirectory(this); - final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true); - tree.setContainerDataSource(fsc); - test(layout, tree); - - final TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect " - + count++); - twinColSelect.setContainerDataSource(getSmallContainer()); - twinColSelect.setItemCaptionPropertyId("UNIT"); - test(layout, twinColSelect); - - final Upload upload = new Upload("Upload (non-functional)", null); - test(layout, upload); - - // Custom components - layout.addComponent(new Label("<B>Below are few custom components</B>", - Label.CONTENT_XHTML)); - final TestForUpload tfu = new TestForUpload(); - layout.addComponent(tfu); - layout.addComponent(new Label("<br/><b>----------<br/></p>", - Label.CONTENT_XHTML)); - test(tfu); - - // DISABLED - // TableSelectTest tst = new TableSelectTest(); - // layout.addComponent(tst); - // test(tst); - // layout.addComponent(new Label("<HR />", Label.CONTENT_XHTML)); - - } - - Container getContainer() { - // populate container with test SQL table rows - try { - return new QueryContainer("SELECT * FROM employee", sampleDatabase - .getConnection()); - } catch (final SQLException e) { - e.printStackTrace(); - } - return null; - } - - Container getSmallContainer() { - // populate container with test SQL table rows - try { - return new QueryContainer( - "SELECT DISTINCT UNIT AS UNIT FROM employee", - sampleDatabase.getConnection()); - } catch (final SQLException e) { - e.printStackTrace(); - } - return null; - } - - // common component configuration - void setComponentProperties(Component c) { - // TWEAK these - // c.setEnabled(false); - // c.setVisible(false); - // c.setStyleName("testStyleName"); - // c.setReadOnly(true); - - // try to add listener - try { - c.addListener(this); - } catch (final Exception e) { - System.err.println("Could not add listener for component " + c - + ", count was " + count); - } - } - - /** - * Stresses component by configuring it - * - * @param c - */ - void test(AbstractComponent c) { - // configure common component properties - // setComponentProperties(c); - - // AbstractComponent specific configuration - final ClassResource res = new ClassResource("m.gif", this); - final ErrorMessage errorMsg = new UserError("User error " + c); - if ((c.getCaption() == null) || (c.getCaption().length() <= 0)) { - c.setCaption("Caption " + c); - } - - // TWEAK these - // c.setComponentError(errorMsg); - // c.setIcon(res); - // c.setImmediate(true); - // c.addStyleName("addedTestStyleName"); - // c.setStyleName("singleTestStyleName"); - // c.setDescription("Description here.."); - } - - void test(CustomComponent c) { - // configure common component properties - setComponentProperties(c); - - // CustomComponent specific configuration - // TWEAK these - // c.setComponentType("foo"); - c.addStyleName("addedTestStyleName"); - } - - /** - * Stresses component by configuring it in a given layout - * - * @param c - */ - void test(Layout layout, AbstractComponent c) { - test(c); - layout.addComponent(c); - // add separator - if (!(layout instanceof GridLayout)) { - layout.addComponent(new Label("<br/><b>NEXT<br/></p>", - Label.CONTENT_XHTML)); - } - } - - public void componentEvent(Event event) { - eventCount++; - final String feedback = "eventCount=" + eventCount + ", class=" - + event.getClass() + ", source=" + event.getSource() - + ", toString()=" + event.toString(); - System.out.println("eventListenerFeedback: " + feedback); - eventListenerFeedback.setValue("Events: " + eventCount); - } - - // For sample actions - public Action[] getActions(Object target, Object sender) { - return actions; - } - - // For sample actions - public void handleAction(Action action, Object sender, Object target) { - System.out.println("ACTION: " + action.getCaption() + " on item " - + target); - } - -} diff --git a/src/com/vaadin/tests/TestContainerChanges.java b/src/com/vaadin/tests/TestContainerChanges.java deleted file mode 100644 index af27484834..0000000000 --- a/src/com/vaadin/tests/TestContainerChanges.java +++ /dev/null @@ -1,212 +0,0 @@ -/**
- *
- */
-package com.vaadin.tests;
-
-import com.vaadin.data.Container;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.util.ContainerHierarchicalWrapper;
-import com.vaadin.data.util.ContainerOrderedWrapper;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.ListSelect;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Tree;
-import com.vaadin.ui.Button.ClickEvent;
-
-/**
- * @author marc
- *
- */
-public class TestContainerChanges extends CustomComponent {
- Container cont = new IndexedContainer();
- Container hierarchical = new ContainerHierarchicalWrapper(cont);
- Container ordered = new ContainerOrderedWrapper(cont);
-
- int cnt = 0;
- Table tbl;
-
- public TestContainerChanges() {
-
- cont.addContainerProperty("Asd", String.class, "qwe");
- cont.addContainerProperty("Bar", String.class, "foo");
-
- OrderedLayout main = new OrderedLayout();
- setCompositionRoot(main);
-
- main
- .addComponent(new Label(
- "The same IndexedContainer is wrapped in a ordered/hierarchical wrapper and is set as data source for all components . The buttons only affect the 'original' IndexedContainer."));
-
- OrderedLayout h = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
-
- main.addComponent(h);
-
- OrderedLayout v = new OrderedLayout();
- h.addComponent(v);
- tbl = new Table();
- tbl.setHeight(200);
- tbl.setWidth(300);
- v.addComponent(tbl);
- tbl.setSelectable(true);
- tbl.setMultiSelect(false);
- tbl.setImmediate(true);
- tbl.setEditable(true);
- tbl.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
- // Original container
- tbl.setContainerDataSource(hierarchical);
-
- Table tbl2 = new Table();
- tbl2.setHeight(200);
- tbl2.setWidth(300);
- v.addComponent(tbl2);
- tbl2.setSelectable(true);
- tbl2.setMultiSelect(false);
- tbl2.setImmediate(true);
- tbl2.addListener(new Table.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- System.err.println("Value now "
- + event.getProperty().getValue());
-
- }
- });
- tbl2.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
- // non-ordered container will get wrapped
- tbl2.setContainerDataSource(hierarchical);
-
- OrderedLayout buttons = new OrderedLayout();
- v.addComponent(buttons);
-
- Button b = new Button("table.commit()", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- tbl.commit();
- }
-
- });
- buttons.addComponent(b);
-
- b = new Button("indexedcontainer.addItem()",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- cont.addItem(new Integer(cnt++));
- }
-
- });
- buttons.addComponent(b);
- b = new Button("indexedcontainer.addItem(null)",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- cont.addItem(null);
- }
-
- });
- buttons.addComponent(b);
- b = new Button("indexedcontainer.removeItem(table.lastItemId()",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- cont.removeItem(tbl.lastItemId());
- }
-
- });
- buttons.addComponent(b);
-
- b = new Button("indexedcontainer.addContainerProperty()",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- cont.addContainerProperty("prop" + cnt, String.class,
- "#" + cnt++);
- }
-
- });
- buttons.addComponent(b);
-
- b = new Button("indexedcontainer.clear()", new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- cont.removeAllItems();
- }
-
- });
- buttons.addComponent(b);
- b = new Button("table.setContainerDataSource(indexedcontainer)",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- tbl.setContainerDataSource(cont);
- }
-
- });
- buttons.addComponent(b);
- b = new Button("table.setContainerDataSource(orderedwrapper)",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- tbl.setContainerDataSource(ordered);
- }
-
- });
- buttons.addComponent(b);
- b = new Button("table.setContainerDataSource(hierarchicalwrapper)",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- tbl.setContainerDataSource(hierarchical);
- }
-
- });
- buttons.addComponent(b);
-
- Panel p = new Panel("Tree");
- p.setStyleName(Panel.STYLE_LIGHT);
- h.addComponent(p);
- Tree tree = new Tree("ITEM_CAPTION_MODE_PROPERTY");
- tree.setContainerDataSource(ordered);
- tree.setItemCaptionPropertyId("Asd");
- tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_PROPERTY);
- p.addComponent(tree);
- tree = new Tree("ITEM_CAPTION_MODE_ITEM");
- // nonhierarchical container will get wrapped
- tree.setContainerDataSource(ordered);
- tree.setItemCaptionMode(Tree.ITEM_CAPTION_MODE_ITEM);
- p.addComponent(tree);
-
- p = new Panel("ComboBox");
- p.setStyleName(Panel.STYLE_LIGHT);
- h.addComponent(p);
- ComboBox c = new ComboBox("ITEM_CAPTION_MODE_PROPERTY");
- c.setImmediate(true);
- c.setContainerDataSource(cont);
- c.setItemCaptionPropertyId("Asd");
- c.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY);
- p.addComponent(c);
- c = new ComboBox("ITEM_CAPTION_MODE_ITEM");
- c.setImmediate(true);
- c.setContainerDataSource(cont);
- c.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM);
- p.addComponent(c);
-
- p = new Panel("ListBox");
- p.setStyleName(Panel.STYLE_LIGHT);
- h.addComponent(p);
- ListSelect l = new ListSelect("ITEM_CAPTION_MODE_PROPERTY");
- l.setContainerDataSource(cont);
- l.setItemCaptionPropertyId("Asd");
- l.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_PROPERTY);
- p.addComponent(l);
- l = new ListSelect("ITEM_CAPTION_MODE_ITEM");
- l.setContainerDataSource(cont);
- l.setItemCaptionMode(ComboBox.ITEM_CAPTION_MODE_ITEM);
- p.addComponent(l);
- }
-}
diff --git a/src/com/vaadin/tests/TestDateField.java b/src/com/vaadin/tests/TestDateField.java deleted file mode 100644 index 39621b0b8e..0000000000 --- a/src/com/vaadin/tests/TestDateField.java +++ /dev/null @@ -1,74 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import java.util.Locale;
-
-import com.vaadin.terminal.ClassResource;
-import com.vaadin.terminal.ErrorMessage;
-import com.vaadin.terminal.UserError;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-
-/**
- *
- * @author IT Mill Ltd.
- */
-public class TestDateField extends CustomComponent {
-
- OrderedLayout main = new OrderedLayout();
-
- DateField df;
-
- public TestDateField() {
- setCompositionRoot(main);
- createNewView();
- }
-
- public void createNewView() {
- main.removeAllComponents();
- main.addComponent(new Label("DateField"));
-
- df = new DateField();
- main.addComponent(df);
-
- final ErrorMessage errorMsg = new UserError("User error " + df);
- df.setCaption("DateField caption " + df);
- df.setDescription("DateField description " + df);
- df.setComponentError(errorMsg);
- df.setImmediate(true);
- // FIXME: bug #1138 this makes datefield to render with unknown
- // component (UIDL tree debug)
- df.addStyleName("thisShouldBeHarmless");
-
- // Another test: locale
- final DateField df1 = new DateField("US locale");
- main.addComponent(df1);
- df1.setLocale(new Locale("en", "US"));
-
- final DateField df2 = new DateField("DE locale");
- main.addComponent(df2);
- df2.setLocale(new Locale("de", "DE"));
-
- final DateField df3 = new DateField("RU locale");
- main.addComponent(df3);
- df3.setLocale(new Locale("ru", "RU"));
-
- final DateField df4 = new DateField("FI locale");
- main.addComponent(df4);
- df4.setLocale(new Locale("fi", "FI"));
- }
-
- @Override
- public void attach() {
- final ClassResource res = new ClassResource("m.gif", super
- .getApplication());
- df.setIcon(res);
- super.attach();
- }
-
-}
diff --git a/src/com/vaadin/tests/TestForAlignments.java b/src/com/vaadin/tests/TestForAlignments.java deleted file mode 100644 index d8c7c0d59c..0000000000 --- a/src/com/vaadin/tests/TestForAlignments.java +++ /dev/null @@ -1,66 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; - -public class TestForAlignments extends CustomComponent { - - public TestForAlignments() { - - final OrderedLayout main = new OrderedLayout(); - - final Button b1 = new Button("Right"); - final Button b2 = new Button("Left"); - final Button b3 = new Button("Bottom"); - final Button b4 = new Button("Top"); - final TextField t1 = new TextField("Right aligned"); - final TextField t2 = new TextField("Bottom aligned"); - final DateField d1 = new DateField("Center aligned"); - final DateField d2 = new DateField("Center aligned"); - - final OrderedLayout vert = new OrderedLayout(); - vert.addComponent(b1); - vert.addComponent(b2); - vert.addComponent(t1); - vert.addComponent(d1); - // vert.getSize().setWidth(500); - vert.setComponentAlignment(b1, OrderedLayout.ALIGNMENT_RIGHT, - OrderedLayout.ALIGNMENT_TOP); - vert.setComponentAlignment(b2, OrderedLayout.ALIGNMENT_LEFT, - OrderedLayout.ALIGNMENT_TOP); - vert.setComponentAlignment(t1, OrderedLayout.ALIGNMENT_RIGHT, - OrderedLayout.ALIGNMENT_TOP); - vert.setComponentAlignment(d1, - OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, - OrderedLayout.ALIGNMENT_TOP); - final OrderedLayout hori = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - hori.addComponent(b3); - hori.addComponent(b4); - hori.addComponent(t2); - hori.addComponent(d2); - // hori.getSize().setHeight(200); - hori.setComponentAlignment(b3, OrderedLayout.ALIGNMENT_LEFT, - OrderedLayout.ALIGNMENT_BOTTOM); - hori.setComponentAlignment(b4, OrderedLayout.ALIGNMENT_LEFT, - OrderedLayout.ALIGNMENT_TOP); - hori.setComponentAlignment(t2, OrderedLayout.ALIGNMENT_LEFT, - OrderedLayout.ALIGNMENT_BOTTOM); - hori.setComponentAlignment(d2, OrderedLayout.ALIGNMENT_LEFT, - OrderedLayout.ALIGNMENT_VERTICAL_CENTER); - - main.addComponent(vert); - main.addComponent(hori); - - setCompositionRoot(main); - - } - -} diff --git a/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java b/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java deleted file mode 100644 index 6de6d3c046..0000000000 --- a/src/com/vaadin/tests/TestForApplicationLayoutThatUsesWholeBrosersSpace.java +++ /dev/null @@ -1,64 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.Application; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class TestForApplicationLayoutThatUsesWholeBrosersSpace extends - Application { - - Window main = new Window("Windowing test"); - - ExpandLayout rootLayout; - - SplitPanel firstLevelSplit; - - @Override - public void init() { - setMainWindow(main); - - rootLayout = new ExpandLayout(); - main.setLayout(rootLayout); - - rootLayout.addComponent(new Label("header")); - - firstLevelSplit = new SplitPanel(); - - final SplitPanel secondSplitPanel = new SplitPanel( - SplitPanel.ORIENTATION_HORIZONTAL); - secondSplitPanel.setFirstComponent(new Label("left")); - - final ExpandLayout topRight = new ExpandLayout(); - topRight.addComponent(new Label("topright header")); - - final Table t = TestForTablesInitialColumnWidthLogicRendering - .getTestTable(4, 100); - t.setSizeFull(); - topRight.addComponent(t); - topRight.expand(t); - - topRight.addComponent(new Label("topright footer")); - - secondSplitPanel.setSecondComponent(topRight); - - final ExpandLayout el = new ExpandLayout(); - el.addComponent(new Label("B��")); - - firstLevelSplit.setFirstComponent(secondSplitPanel); - firstLevelSplit.setSecondComponent(el); - - rootLayout.addComponent(firstLevelSplit); - rootLayout.expand(firstLevelSplit); - - rootLayout.addComponent(new Label("footer")); - - } - -} diff --git a/src/com/vaadin/tests/TestForBasicApplicationLayout.java b/src/com/vaadin/tests/TestForBasicApplicationLayout.java deleted file mode 100644 index b6cd1d28a9..0000000000 --- a/src/com/vaadin/tests/TestForBasicApplicationLayout.java +++ /dev/null @@ -1,100 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import java.util.Locale;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.SplitPanel;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class TestForBasicApplicationLayout extends CustomComponent {
-
- private final Button click;
- private final Button click2;
- private final TabSheet tab;
-
- public TestForBasicApplicationLayout() {
-
- click = new Button("Set height -1", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- tab.setHeight(-1);
- }
-
- });
-
- click2 = new Button("Set height 100%", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- tab.setHeight(100, TabSheet.UNITS_PERCENTAGE);
- }
-
- });
-
- final SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
- sp.setSplitPosition(290, SplitPanel.UNITS_PIXELS);
-
- final SplitPanel sp2 = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL);
- sp2.setSplitPosition(255, SplitPanel.UNITS_PIXELS);
-
- final Panel p = new Panel("Accordion Panel");
- p.setSizeFull();
-
- tab = new TabSheet();
- tab.setSizeFull();
-
- final Panel report = new Panel("Monthly Program Runs",
- new ExpandLayout());
- final OrderedLayout controls = new OrderedLayout();
- controls.setMargin(true);
- controls.addComponent(new Label("Report tab"));
- controls.addComponent(click);
- controls.addComponent(click2);
- report.addComponent(controls);
- final DateField cal = new DateField();
- cal.setResolution(DateField.RESOLUTION_DAY);
- cal.setLocale(new Locale("en", "US"));
- report.addComponent(cal);
- ((ExpandLayout) report.getLayout()).expand(controls);
- report.addStyleName(Panel.STYLE_LIGHT);
- report.setHeight(100, SplitPanel.UNITS_PERCENTAGE);
-
- sp2.setFirstComponent(report);
-
- final Table table = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(5, 200);
- table.setPageLength(15);
- table.setSelectable(true);
- table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
- table.setColumnCollapsingAllowed(true);
- table.setColumnReorderingAllowed(true);
- table.setSortDisabled(false);
- table.setSizeFull();
- table.addStyleName("table-inline");
- sp2.setSecondComponent(table);
-
- tab.addTab(new Label("Tab1"), "Summary", null);
- tab.addTab(sp2, "Reports", null);
- tab.addTab(new Label("Tab 3"), "Statistics", null);
- tab.addTab(new Label("Tab 4"), "Error Tracking", null);
- tab.setSelectedTab(sp2);
-
- sp.setFirstComponent(p);
- sp.setSecondComponent(tab);
-
- setCompositionRoot(sp);
- }
-
-}
diff --git a/src/com/vaadin/tests/TestForChildComponentRendering.java b/src/com/vaadin/tests/TestForChildComponentRendering.java deleted file mode 100644 index 9b5d02e945..0000000000 --- a/src/com/vaadin/tests/TestForChildComponentRendering.java +++ /dev/null @@ -1,95 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.ArrayList; -import java.util.Iterator; - -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; - -/** - * - * This Component contains some simple test to see that component updates its - * contents propertly. - * - * @author IT Mill Ltd. - */ -public class TestForChildComponentRendering extends CustomComponent { - - private final OrderedLayout main; - - public TestForChildComponentRendering() { - - main = new OrderedLayout(); - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main.addComponent(new Label("SDFGFHFHGJGFDSDSSSGFDD")); - - final Link l = new Link(); - l.setCaption("Siirry Vaadiniin"); - l.setResource(new ExternalResource("http://www.vaadin.com/")); - l.setTargetHeight(200); - l.setTargetWidth(500); - l.setTargetBorder(Link.TARGET_BORDER_MINIMAL); - main.addComponent(l); - - final Select se = new Select(); - se.setCaption("VALITSET TÄSTÄ"); - se.addItem("valinta1"); - se.addItem("Valinta 2"); - - Button b = new Button("refresh view", this, "createNewView"); - main.addComponent(b); - - b = new Button("reorder view", this, "randomReorder"); - main.addComponent(b); - - b = new Button("remove randomly one component", this, - "removeRandomComponent"); - main.addComponent(b); - - } - - public void randomReorder() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); - while (it.hasNext()) { - components.add(it.next()); - } - - final OrderedLayout v = main; - v.removeAllComponents(); - - for (int i = components.size(); i > 0; i--) { - final int index = (int) (Math.random() * i); - v.addComponent((Component) components.get(index)); - components.remove(index); - } - } - - public void removeRandomComponent() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); - while (it.hasNext()) { - components.add(it.next()); - } - final int size = components.size(); - final int index = (int) (Math.random() * size); - main.removeComponent((Component) components.get(index)); - - } - -} diff --git a/src/com/vaadin/tests/TestForContainerFilterable.java b/src/com/vaadin/tests/TestForContainerFilterable.java deleted file mode 100644 index 7c261f1017..0000000000 --- a/src/com/vaadin/tests/TestForContainerFilterable.java +++ /dev/null @@ -1,94 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; - -public class TestForContainerFilterable extends CustomComponent { - - OrderedLayout lo = new OrderedLayout(); - IndexedContainer ic = new IndexedContainer(); - Table t = new Table(); - private static String parts[] = { "Neo", "Sa", "rem", "the", "adi", "za", - "tre", "day", "Ca", "re", "cen", "ter", "mi", "nal" }; - TextField fooFilter = new TextField("foo-filter"); - TextField barFilter = new TextField("bar-filter"); - Button filterButton = new Button("Filter"); - Label count = new Label(); - - public TestForContainerFilterable() { - setCompositionRoot(lo); - - // Init datasource - ic.addContainerProperty("foo", String.class, ""); - ic.addContainerProperty("bar", String.class, ""); - for (int i = 0; i < 1000; i++) { - final Object id = ic.addItem(); - ic.getContainerProperty(id, "foo").setValue(randomWord()); - ic.getContainerProperty(id, "bar").setValue(randomWord()); - } - - // Init filtering view - final Panel filterPanel = new Panel("Filter", new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL)); - filterPanel.setWidth(100, Panel.UNITS_PERCENTAGE); - lo.addComponent(filterPanel); - filterPanel.addComponent(fooFilter); - filterPanel.addComponent(barFilter); - filterPanel.addComponent(filterButton); - fooFilter - .setDescription("Filters foo column in case-sensitive contains manner."); - barFilter - .setDescription("Filters bar column in case-insensitive prefix manner."); - filterPanel.addComponent(count); - - // Table - lo.addComponent(t); - t.setPageLength(12); - t.setWidth(100, Table.UNITS_PERCENTAGE); - t.setContainerDataSource(ic); - - // Handler - filterButton.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - ic.removeAllContainerFilters(); - if (fooFilter.toString().length() > 0) { - ic.addContainerFilter("foo", fooFilter.toString(), false, - false); - } - if (barFilter.toString().length() > 0) { - ic.addContainerFilter("bar", barFilter.toString(), true, - true); - } - count.setValue("Rows in table: " + ic.size()); - } - }); - - // Resetbutton - lo.addComponent(new Button("Rebind table datasource", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - t.setContainerDataSource(ic); - } - })); - } - - private String randomWord() { - int len = (int) (Math.random() * 4); - final StringBuffer buf = new StringBuffer(); - while (len-- >= 0) { - buf.append(parts[(int) (Math.random() * parts.length)]); - } - return buf.toString(); - } -} diff --git a/src/com/vaadin/tests/TestForExpandLayout.java b/src/com/vaadin/tests/TestForExpandLayout.java deleted file mode 100644 index e58ec24161..0000000000 --- a/src/com/vaadin/tests/TestForExpandLayout.java +++ /dev/null @@ -1,55 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-
-/**
- *
- * @author IT Mill Ltd.
- */
-public class TestForExpandLayout extends CustomComponent {
-
- ExpandLayout main = new ExpandLayout();
-
- DateField df;
-
- public TestForExpandLayout() {
- setCompositionRoot(main);
- createNewView();
- }
-
- public void createNewView() {
- main.removeAllComponents();
- for (int i = 0; i < 6; i++) {
- final ExpandLayout el = new ExpandLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- for (int j = 0; j < i + 3; j++) {
- final Label l = new Label("label" + i + ":" + j);
- el.addComponent(l);
- }
- if (i > 0) {
- // el.setMargin(true);
- el.setSizeUndefined();
- el.setWidth("100%");
- if (i % 2 == 0) {
- el.setHeight("8em");
- Panel p = new Panel("tp");
- p.addComponent(new Label("panelc"));
- p.setHeight("100%");
- p.setWidth("100px");
- el.addComponent(p);
- }
- }
- main.addComponent(el);
- }
-
- }
-}
diff --git a/src/com/vaadin/tests/TestForExpandLayout2.java b/src/com/vaadin/tests/TestForExpandLayout2.java deleted file mode 100644 index 5c6ff7955b..0000000000 --- a/src/com/vaadin/tests/TestForExpandLayout2.java +++ /dev/null @@ -1,64 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Panel;
-
-/**
- *
- * @author IT Mill Ltd.
- */
-public class TestForExpandLayout2 extends CustomComponent {
-
- ExpandLayout main;
-
- public TestForExpandLayout2() {
- createNewView();
- setCompositionRoot(main);
- }
-
- public void createNewView() {
- main = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
-
- Panel left = new Panel("Left column");
- left.setHeight(100, Panel.UNITS_PERCENTAGE);
- left.setWidth(150);
- main.addComponent(left);
-
- ExpandLayout center = new ExpandLayout();
- center.addComponent(new Label("header"));
- Panel mainContent = new Panel();
- center.addComponent(mainContent);
- center.expand(mainContent);
- mainContent.setSizeFull();
-
- ExpandLayout buttons = new ExpandLayout(
- ExpandLayout.ORIENTATION_HORIZONTAL);
- buttons.setHeight(30, ExpandLayout.UNITS_PIXELS);
- Button b1 = new Button("Save");
- Button b2 = new Button("Cancel");
- Button b3 = new Button("Logout");
- buttons.addComponent(b1);
- buttons.setComponentAlignment(b1, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_TOP);
- buttons.addComponent(b2);
- buttons.addComponent(b3);
- center.addComponent(buttons);
-
- main.addComponent(center);
- main.expand(center);
-
- Panel right = new Panel("Right column");
- right.setHeight(100, Panel.UNITS_PERCENTAGE);
- right.setWidth(200);
-
- main.addComponent(right);
-
- }
-}
diff --git a/src/com/vaadin/tests/TestForExpandLayout3.java b/src/com/vaadin/tests/TestForExpandLayout3.java deleted file mode 100644 index ae4adfcfaa..0000000000 --- a/src/com/vaadin/tests/TestForExpandLayout3.java +++ /dev/null @@ -1,79 +0,0 @@ -/*
-@ITMillApache2LicenseForJavaFiles@
- */
-
-package com.vaadin.tests;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.ExpandLayout;
-
-/**
- *
- * @author IT Mill Ltd.
- */
-public class TestForExpandLayout3 extends CustomComponent {
-
- ExpandLayout main = new ExpandLayout();
-
- DateField df;
-
- public TestForExpandLayout3() {
- setCompositionRoot(main);
- createNewView();
- }
-
- public void createNewView() {
- main.removeAllComponents();
-
- ExpandLayout el;
- Button b;
- Button b2;
-
- el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
-
- b = new Button("SDFS");
- b2 = new Button("DSFSDFDFSSDF");
-
- el.addComponent(b);
- el.addComponent(b2);
-
- el.expand(b);
- el.setComponentAlignment(b, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
- main.addComponent(el);
-
- el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
-
- b = new Button("SDFS");
- b2 = new Button("DSFSDFDFSSDF");
-
- el.addComponent(b);
- el.addComponent(b2);
-
- el.expand(b);
- el.setComponentAlignment(b, ExpandLayout.ALIGNMENT_HORIZONTAL_CENTER,
- ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
- el.setHeight(60, ExpandLayout.UNITS_PIXELS);
- el.setMargin(true);
- main.addComponent(el);
-
- el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
-
- b = new Button("SDFS");
- b2 = new Button("DSFSDFDFSSDF");
-
- el.addComponent(b);
- el.addComponent(b2);
-
- el.expand(b);
- el.setComponentAlignment(b, ExpandLayout.ALIGNMENT_RIGHT,
- ExpandLayout.ALIGNMENT_BOTTOM);
- el.setHeight(100, ExpandLayout.UNITS_PIXELS);
- el.setSpacing(true);
-
- main.addComponent(el);
-
- }
-}
diff --git a/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java b/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java deleted file mode 100644 index 9ff23e62ca..0000000000 --- a/src/com/vaadin/tests/TestForGridLayoutChildComponentRendering.java +++ /dev/null @@ -1,103 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.ArrayList; -import java.util.Iterator; - -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.Select; - -/** - * - * This Component contains some simple test to see that component updates its - * contents propertly. - * - * @author IT Mill Ltd. - */ -public class TestForGridLayoutChildComponentRendering extends CustomComponent { - - private final GridLayout main = new GridLayout(2, 3); - - public TestForGridLayoutChildComponentRendering() { - - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main.addComponent(new Label("SDFGFHFHGJGFDSDSSSGFDD")); - - final Link l = new Link(); - l.setCaption("Siirry Vaadiniin"); - l.setResource(new ExternalResource("http://www.vaadin.com/")); - l.setTargetHeight(200); - l.setTargetWidth(500); - l.setTargetBorder(Link.TARGET_BORDER_MINIMAL); - main.addComponent(l); - - final Select se = new Select("Tästä valitaan"); - se.setCaption("Whattaa select"); - se.addItem("valinta1"); - se.addItem("Valinta 2"); - - main.addComponent(se, 0, 1, 1, 1); - - Button b = new Button("refresh view", this, "createNewView"); - main.addComponent(b); - - b = new Button("reorder view", this, "randomReorder"); - main.addComponent(b); - - b = new Button("remove randomly one component", this, - "removeRandomComponent"); - main.addComponent(b); - - } - - public void randomReorder() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); - while (it.hasNext()) { - components.add(it.next()); - } - - main.removeAllComponents(); - - final int size = components.size(); - final int colspanIndex = ((int) (Math.random() * size) / 2) * 2 + 2; - - for (int i = components.size(); i > 0; i--) { - final int index = (int) (Math.random() * i); - if (i == colspanIndex) { - main.addComponent((Component) components.get(index), 0, - (size - i) / 2, 1, (size - i) / 2); - } else { - main.addComponent((Component) components.get(index)); - } - components.remove(index); - } - } - - public void removeRandomComponent() { - final Iterator it = main.getComponentIterator(); - final ArrayList components = new ArrayList(); - while (it.hasNext()) { - components.add(it.next()); - } - final int size = components.size(); - final int index = (int) (Math.random() * size); - main.removeComponent((Component) components.get(index)); - - } - -} diff --git a/src/com/vaadin/tests/TestForMultipleStyleNames.java b/src/com/vaadin/tests/TestForMultipleStyleNames.java deleted file mode 100644 index a0facecd56..0000000000 --- a/src/com/vaadin/tests/TestForMultipleStyleNames.java +++ /dev/null @@ -1,97 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TwinColSelect; - -/** - * TODO: Note you need to add Theme under WebContent/VAADIN/Themes/mytheme in - * order to see actual visible results on the browser. Currently changes are - * visible only by inspecting DOM. - * - * @author IT Mill Ltd. - */ -public class TestForMultipleStyleNames extends CustomComponent implements - ValueChangeListener { - - private final OrderedLayout main = new OrderedLayout(); - - private Label l; - - private final TwinColSelect s = new TwinColSelect(); - - private ArrayList styleNames2; - - public TestForMultipleStyleNames() { - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main.addComponent(new Label( - "TK5 supports multiple stylenames for components.")); - main.addComponent(new Label("Note you need to add Theme under" - + " WebContent/VAADIN/Themes/mytheme" - + " in order to see actual visible results" - + " on the browser. Currently changes are" - + " visible only by inspecting DOM.")); - - styleNames2 = new ArrayList(); - - styleNames2.add("red"); - styleNames2.add("bold"); - styleNames2.add("italic"); - - s.setContainerDataSource(new IndexedContainer(styleNames2)); - s.addListener(this); - s.setImmediate(true); - main.addComponent(s); - - l = new Label("Test labele"); - main.addComponent(l); - - } - - public void valueChange(ValueChangeEvent event) { - - final String currentStyle = l.getStyle(); - final String[] tmp = currentStyle.split(" "); - final ArrayList curStyles = new ArrayList(); - for (int i = 0; i < tmp.length; i++) { - if (tmp[i] != "") { - curStyles.add(tmp[i]); - } - } - - final Collection styles = (Collection) s.getValue(); - - for (final Iterator iterator = styles.iterator(); iterator.hasNext();) { - final String styleName = (String) iterator.next(); - if (curStyles.contains(styleName)) { - // already added - curStyles.remove(styleName); - } else { - l.addStyleName(styleName); - } - } - for (final Iterator iterator2 = curStyles.iterator(); iterator2 - .hasNext();) { - final String object = (String) iterator2.next(); - l.removeStyleName(object); - } - } - -} diff --git a/src/com/vaadin/tests/TestForNativeWindowing.java b/src/com/vaadin/tests/TestForNativeWindowing.java deleted file mode 100644 index 8311a2e955..0000000000 --- a/src/com/vaadin/tests/TestForNativeWindowing.java +++ /dev/null @@ -1,130 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.net.MalformedURLException; -import java.net.URL; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class TestForNativeWindowing extends Application { - - Window main = new Window("Windowing test"); - - @Override - public void init() { - - setMainWindow(main); - - main.addComponent(new Button("Add new subwindow", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - final Window w = new Window("sw " - + System.currentTimeMillis()); - main.addWindow(w); - w.setPositionX(100); - w.setPositionY(100); - w.setWidth(200); - w.setHeight(200); - - w.setWidth(100); - w.setHeight(400); - - final Button closebutton = new Button("Close " - + w.getCaption(), new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - main.removeWindow(w); - } - - }); - w.addComponent(closebutton); - - w.addComponent(new Label( - "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>" - + "<p>Lorem ipsum dolor sit amet.</p>", - Label.CONTENT_XHTML)); - - } - })); - - main.addComponent(new Button( - "Open a currently uncreated application level window", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - try { - main - .open( - new com.vaadin.terminal.ExternalResource( - new URL( - getURL(), - "mainwin-" - + System - .currentTimeMillis() - + "/")), - null); - } catch (final MalformedURLException e) { - } - } - })); - - main.addComponent(new Button( - "Commit (saves window state: size, place, scrollpos)")); - } - - @Override - public Window getWindow(String name) { - - final Window w = super.getWindow(name); - if (w != null) { - return w; - } - - if (name != null && name.startsWith("mainwin-")) { - final String postfix = name.substring("mainwin-".length()); - final Window ww = new Window("Window: " + postfix); - ww.setName(name); - ww.addComponent(new Label( - "This is a application-level window opened with name: " - + name)); - ww.addComponent(new Button("Click me", new Button.ClickListener() { - int state = 0; - - public void buttonClick(ClickEvent event) { - ww.addComponent(new Label("Button clicked " + (++state) - + " times")); - } - })); - addWindow(ww); - return ww; - } - - return null; - } - -} diff --git a/src/com/vaadin/tests/TestForPreconfiguredComponents.java b/src/com/vaadin/tests/TestForPreconfiguredComponents.java deleted file mode 100644 index fa153fcda7..0000000000 --- a/src/com/vaadin/tests/TestForPreconfiguredComponents.java +++ /dev/null @@ -1,186 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.event.Action; -import com.vaadin.event.Action.Handler; -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Tree; -import com.vaadin.ui.TwinColSelect; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -/** - * @author IT Mill Ltd. - */ -public class TestForPreconfiguredComponents extends CustomComponent implements - 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 final OrderedLayout main = new OrderedLayout(); - - private final Action[] actions = new Action[] { new Action("edit"), - new Action("delete") }; - - private Panel al; - - private Tree contextTree; - - public TestForPreconfiguredComponents() { - - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main - .addComponent(new Label( - "In Toolkit 5 we introduce new components. Previously we" - + " usually used setStyle or some other methods on possibly " - + "multiple steps to configure component for ones needs. These new " - + "server side components are mostly just classes that in constructor " - + "set base class to state that programmer wants.")); - - main.addComponent(new Button("commit")); - - Panel test = createTestBench(new CheckBox()); - test.setCaption("CheckBox (configured from button)"); - main.addComponent(test); - - AbstractSelect s = new TwinColSelect(); - fillSelect(s, 20); - test = createTestBench(s); - test.setCaption("TwinColSelect (configured from select)"); - main.addComponent(test); - - s = new NativeSelect(); - fillSelect(s, 20); - test = createTestBench(s); - test.setCaption("Native (configured from select)"); - main.addComponent(test); - - s = new OptionGroup(); - fillSelect(s, 20); - test = createTestBench(s); - test.setCaption("OptionGroup (configured from select)"); - main.addComponent(test); - - s = new OptionGroup(); - fillSelect(s, 20); - s.setMultiSelect(true); - test = createTestBench(s); - test - .setCaption("OptionGroup + multiselect manually (configured from select)"); - main.addComponent(test); - - final Button b = new Button("refresh view", this, "createNewView"); - main.addComponent(b); - - } - - public static void fillSelect(AbstractSelect s, int items) { - for (int i = 0; i < items; i++) { - final String name = firstnames[(int) (Math.random() * (firstnames.length - 1))] - + " " - + lastnames[(int) (Math.random() * (lastnames.length - 1))]; - s.addItem(name); - } - } - - public Tree createTestTree() { - Tree t = new Tree("Tree"); - 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); - } - } - return t; - } - - public Panel createTestBench(Component t) { - final Panel ol = new Panel(); - ol.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL)); - - ol.addComponent(t); - - final OrderedLayout ol2 = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - final Panel status = new Panel("Events"); - final Button clear = new Button("clear event log"); - clear.addListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - status.removeAllComponents(); - status.addComponent(ol2); - } - }); - ol2.addComponent(clear); - final Button commit = new Button("commit changes"); - ol2.addComponent(commit); - status.addComponent(ol2); - - status.setHeight(300); - status.setWidth(400); - - ol.addComponent(status); - - t.addListener(new Listener() { - public void componentEvent(Event event) { - status.addComponent(new Label(event.getClass().getName())); - status.addComponent(new Label("selected: " - + event.getSource().toString())); - } - }); - - return ol; - } - - public Action[] getActions(Object target, Object sender) { - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - if (action == actions[1]) { - al.addComponent(new Label("Delete selected on " + target)); - contextTree.removeItem(target); - - } else { - al.addComponent(new Label("Edit selected on " + target)); - } - } -} diff --git a/src/com/vaadin/tests/TestForRichTextEditor.java b/src/com/vaadin/tests/TestForRichTextEditor.java deleted file mode 100644 index 7ac97ce882..0000000000 --- a/src/com/vaadin/tests/TestForRichTextEditor.java +++ /dev/null @@ -1,66 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.Button.ClickEvent; - -/** - * - * @author IT Mill Ltd. - */ -public class TestForRichTextEditor extends CustomComponent implements - ValueChangeListener { - - private final OrderedLayout main = new OrderedLayout(); - - private Label l; - - private RichTextArea rte; - - public TestForRichTextEditor() { - - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main.addComponent(new Label( - "RTE uses google richtextArea and their examples toolbar.")); - - rte = new RichTextArea(); - rte.addListener(this); - - main.addComponent(rte); - - main.addComponent(new Button("commit content to label below")); - - l = new Label("", Label.CONTENT_XHTML); - main.addComponent(l); - - Button b = new Button("enabled"); - b.setSwitchMode(true); - b.setImmediate(true); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - rte.setEnabled(!rte.isEnabled()); - } - }); - main.addComponent(b); - - } - - public void valueChange(ValueChangeEvent event) { - l.setValue(rte.getValue()); - } - -} diff --git a/src/com/vaadin/tests/TestForStyledUpload.java b/src/com/vaadin/tests/TestForStyledUpload.java deleted file mode 100644 index 0e4933d2b9..0000000000 --- a/src/com/vaadin/tests/TestForStyledUpload.java +++ /dev/null @@ -1,288 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.management.ManagementFactory; -import java.lang.management.MemoryMXBean; - -import com.vaadin.Application; -import com.vaadin.terminal.StreamResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.Panel; -import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.Upload; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Upload.FailedEvent; -import com.vaadin.ui.Upload.FailedListener; -import com.vaadin.ui.Upload.FinishedEvent; -import com.vaadin.ui.Upload.FinishedListener; -import com.vaadin.ui.Upload.StartedEvent; -import com.vaadin.ui.Upload.StartedListener; -import com.vaadin.ui.Upload.SucceededEvent; -import com.vaadin.ui.Upload.SucceededListener; - -public class TestForStyledUpload extends Application implements - Upload.FinishedListener, FailedListener, SucceededListener, - StartedListener { - - Layout main = new VerticalLayout(); - - TmpFileBuffer buffer = new TmpFileBuffer(); - - Panel status = new Panel("Uploaded file:"); - - private final Upload up; - - private final Label l; - - private final Label transferred = new Label(""); - - private final ProgressIndicator pi = new ProgressIndicator(); - - private final Label memoryStatus; - - public TestForStyledUpload() { - main - .addComponent(new Label( - "Clicking on button b updates information about upload components status or same with garbage collector.")); - - up = new Upload(null, buffer); - up.setButtonCaption("Select file"); - up.setImmediate(true); - up.addListener((FinishedListener) this); - up.addListener((FailedListener) this); - up.addListener((SucceededListener) this); - up.addListener((StartedListener) this); - - up.addListener(new Upload.ProgressListener() { - - public void updateProgress(long readBytes, long contentLenght) { - pi.setValue(new Float(readBytes / (float) contentLenght)); - - refreshMemUsage(); - - transferred.setValue("Transferred " + readBytes + " of " - + contentLenght); - } - - }); - - final Button b = new Button("Update status", this, "readState"); - - final Button c = new Button("Update status with gc", this, "gc"); - - main.addComponent(up); - l = new Label("Idle"); - main.addComponent(l); - - pi.setVisible(false); - pi.setPollingInterval(300); - main.addComponent(pi); - main.addComponent(transferred); - - memoryStatus = new Label(); - main.addComponent(memoryStatus); - - status.setVisible(false); - main.addComponent(status); - - Button cancel = new Button("Cancel current upload"); - cancel.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - buffer.cancel(); - } - }); - - main.addComponent(cancel); - - final Button restart = new Button("Restart demo application"); - restart.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - TestForStyledUpload.this.close(); - } - }); - main.addComponent(restart); - main.addComponent(b); - main.addComponent(c); - - } - - public void gc() { - Runtime.getRuntime().gc(); - readState(); - } - - public void readState() { - final StringBuffer sb = new StringBuffer(); - - if (up.isUploading()) { - sb.append("Uploading..."); - sb.append(up.getBytesRead()); - sb.append("/"); - sb.append(up.getUploadSize()); - sb.append(" "); - sb.append(Math.round(100 * up.getBytesRead() - / (double) up.getUploadSize())); - sb.append("%"); - } else { - sb.append("Idle"); - } - l.setValue(sb.toString()); - refreshMemUsage(); - } - - public void uploadFinished(FinishedEvent event) { - status.removeAllComponents(); - final InputStream stream = buffer.getStream(); - if (stream == 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(), this))); - - status.setVisible(true); - } - } - - public interface Buffer extends StreamResource.StreamSource, - Upload.Receiver { - - String getFileName(); - } - - public class TmpFileBuffer implements Buffer { - String mimeType; - - String fileName; - - private File file; - - private FileInputStream stream; - - public TmpFileBuffer() { - final String tempFileName = "upload_tmpfile_" - + System.currentTimeMillis(); - try { - file = File.createTempFile(tempFileName, null); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public void cancel() { - up.interruptUpload(); - } - - public InputStream getStream() { - if (file == null) { - return null; - } - try { - stream = new FileInputStream(file); - return stream; - } catch (final FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - /** - * @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, String) - */ - public OutputStream receiveUpload(String filename, String MIMEType) { - fileName = filename; - mimeType = MIMEType; - try { - return new FileOutputStream(file); - } catch (final FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - /** - * Returns the fileName. - * - * @return String - */ - public String getFileName() { - return fileName; - } - - /** - * Returns the mimeType. - * - * @return String - */ - public String getMimeType() { - return mimeType; - } - - } - - public void uploadFailed(FailedEvent event) { - pi.setVisible(false); - l.setValue("Upload was interrupted"); - } - - public void uploadSucceeded(SucceededEvent event) { - pi.setVisible(false); - l.setValue("Finished upload, idle"); - System.out.println(event); - } - - private void refreshMemUsage() { - // memoryStatus.setValue("Not available in Java 1.4"); - StringBuffer mem = new StringBuffer(); - MemoryMXBean mmBean = ManagementFactory.getMemoryMXBean(); - mem.append("Heap (M):"); - mem.append(mmBean.getHeapMemoryUsage().getUsed() / 1048576); - mem.append(" | Non-Heap (M):"); - mem.append(mmBean.getNonHeapMemoryUsage().getUsed() / 1048576); - memoryStatus.setValue(mem.toString()); - - } - - public void uploadStarted(StartedEvent event) { - pi.setVisible(true); - l.setValue("Started uploading file " + event.getFilename()); - } - - @Override - public void init() { - Window w = new Window(); - w.setTheme("runo"); - w.addComponent(main); - setMainWindow(w); - - } - -} diff --git a/src/com/vaadin/tests/TestForTabSheet.java b/src/com/vaadin/tests/TestForTabSheet.java deleted file mode 100644 index f53faabfcb..0000000000 --- a/src/com/vaadin/tests/TestForTabSheet.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vaadin.tests; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; - -public class TestForTabSheet extends CustomComponent implements - Button.ClickListener, TabSheet.SelectedTabChangeListener { - TabSheet tabsheet = new TabSheet(); - Button tab1_root = new Button("Push this button"); - Label tab2_root = new Label("Contents of Second Tab"); - Label tab3_root = new Label("Contents of Third Tab"); - - TestForTabSheet() { - setCompositionRoot(tabsheet); - - tabsheet.addListener(this); - - /* Listen for button click events. */ - tab1_root.addListener(this); - tabsheet.addTab(tab1_root, "First Tab", null); - - /* A tab that is initially disabled. */ - tab2_root.setEnabled(false); - tabsheet.addTab(tab2_root, "Second Tab", null); - - /* A tab that is initially disabled. */ - tab3_root.setEnabled(false); - tabsheet.addTab(tab3_root, "Third tab", null); - } - - public void buttonClick(ClickEvent event) { - System.out.println("tab2=" + tab2_root.isEnabled() + " tab3=" - + tab3_root.isEnabled()); - tab2_root.setEnabled(true); - tab3_root.setEnabled(true); - } - - public void selectedTabChange(SelectedTabChangeEvent event) { - /* - * Cast to a TabSheet. This isn't really necessary in this example, as - * we have only one TabSheet component, but would be useful if there - * were multiple TabSheets. - */ - TabSheet source = (TabSheet) event.getSource(); - if (source == tabsheet) { - /* If the first tab was selected. */ - if (source.getSelectedTab() == tab1_root) { - System.out.println("foo"); - tab2_root.setEnabled(false); - tab3_root.setEnabled(false); - } - } - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java b/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java deleted file mode 100644 index adde3f8c0e..0000000000 --- a/src/com/vaadin/tests/TestForTablesInitialColumnWidthLogicRendering.java +++ /dev/null @@ -1,162 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Iterator; -import java.util.Vector; - -import com.vaadin.terminal.UserError; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Button.ClickEvent; - -/** - * - * This Component contains some simple test to see that component updates its - * contents propertly. - * - * @author IT Mill Ltd. - */ -public class TestForTablesInitialColumnWidthLogicRendering extends - CustomComponent { - - private final OrderedLayout main = new OrderedLayout(); - - public TestForTablesInitialColumnWidthLogicRendering() { - - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main - .addComponent(new Label( - "Below are same tables that all should render somewhat nice. Also when testing, you might want to try resizing window.")); - - Table t; - - Layout lo = new OrderedLayout(); - lo.setWidth("600px"); - lo.setHeight("250px"); - - t = getTestTable(4, 50); - t.setSizeFull(); - lo.setCaption("Fullsize table insize 400x250px layout"); - lo.addComponent(t); - main.addComponent(lo); - - // t = new Table("Empty table"); - // main.addComponent(t); - - t = getTestTable(5, 0); - t.setCaption("Table with only headers"); - // main.addComponent(t); - - t = getTestTable(5, 200); - t.setCaption("Table with some cols and lot of rows"); - main.addComponent(t); - - t = getTestTable(5, 5); - t - .setCaption("Table with some cols and rows rows, some col widths fixed"); - - Iterator it = t.getContainerPropertyIds().iterator(); - it.next(); - it.next(); - t.setColumnWidth(it.next(), 30); - t.setColumnWidth(it.next(), 30); - t.setWidth("700px"); - main.addComponent(t); - - t = getTestTable(12, 4); - t.setCaption("Table with some rows and lot of columns"); - main.addComponent(t); - - t = getTestTable(3, 40); - t - .setCaption("Table with some columns and wide explicit width. (Ought to widen columns to use all space)"); - t.setWidth(1000); - main.addComponent(t); - - t = getTestTable(12, 4); - t.setCaption("Table with some rows and lot of columns, width == 100%"); - t.setWidth(100, Table.UNITS_PERCENTAGE); - main.addComponent(t); - - t = getTestTable(12, 100); - t - .setCaption("Table with lot of rows and lot of columns, width == 50%"); - t.setWidth(50, Table.UNITS_PERCENTAGE); - main.addComponent(t); - - t = getTestTable(5, 100); - t.setCaption("Table with 40 rows"); - // main.addComponent(t); - - t = getTestTable(4, 4); - t.setCaption("Table with some rows and width = 200px"); - - t.setWidth(200); - main.addComponent(t); - - final Button b = new Button("refresh view", this, "createNewView"); - main.addComponent(b); - - } - - public static Table getTestTable(int cols, int rows) { - final Table t = new Table(); - t.setColumnCollapsingAllowed(true); - for (int i = 0; i < cols; i++) { - t.addContainerProperty(testString[i], String.class, ""); - } - t.addContainerProperty("button", Button.class, null); - for (int i = 0; i < rows; i++) { - final Vector content = new Vector(); - for (int j = 0; j < cols; j++) { - content.add(rndString()); - } - Button button = new Button("b", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - System.out.println("b click"); - - } - }); - button.setDescription("Yep yep"); - button.setComponentError(new UserError("Error")); - content.add(button); - t.addItem(content.toArray(), "" + i); - } - return t; - } - - static String[] testString = new String[] { "Jacob", "Michael", "Joshua", - "Matthew", "Ethan", "Andrew", "Daniel", "Anthony", "Christopher", - "Joseph", "William", "Alexander", "Ryan", "David", "Nicholas", - "Tyler", "James", "John", "Jonathan", "Nathan", "Samuel", - "Christian", "Noah", "Dylan", "Benjamin", "Logan", "Brandon", - "Gabriel", "Zachary", "Jose", "Elijah", "Angel", "Kevin", "Jack", - "Caleb", "Justin", "Austin", "Evan", "Robert", "Thomas", "Luke", - "Mason", "Aidan", "Jackson", "Isaiah", "Jordan", "Gavin", "Connor", - "Aiden", "Isaac", "Jason", "Cameron", "Hunter", "Jayden", "Juan", - "Charles", "Aaron", "Lucas", "Luis", "Owen", "Landon", "Diego", - "Brian", "Adam", "Adrian", "Kyle", "Eric", "Ian", "Nathaniel", - "Carlos", "Alex", "Bryan", "Jesus", "Julian", "Sean", "Carter", - "Hayden", "Jeremiah", "Cole", "Brayden", "Wyatt", "Chase", - "Steven", "Timothy", "Dominic", "Sebastian", "Xavier", "Jaden", - "Jesse", "Devin", "Seth", "Antonio", "Richard", "Miguel", "Colin", - "Cody", "Alejandro", "Caden", "Blake", "Carson" }; - - public static String rndString() { - return testString[(int) (Math.random() * testString.length)]; - } - -} diff --git a/src/com/vaadin/tests/TestForTrees.java b/src/com/vaadin/tests/TestForTrees.java deleted file mode 100644 index f0f326c304..0000000000 --- a/src/com/vaadin/tests/TestForTrees.java +++ /dev/null @@ -1,166 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.event.Action; -import com.vaadin.event.Action.Handler; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -/** - * Some test cases for trees. Events panel logs events that happen server side. - * - * @author IT Mill Ltd. - */ -public class TestForTrees extends CustomComponent implements 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 final OrderedLayout main = new OrderedLayout(); - - private final Action[] actions = new Action[] { new Action("edit"), - new Action("delete") }; - - private Panel al; - - private Tree contextTree; - - public TestForTrees() { - - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main - .addComponent(new Label( - "Some test cases for trees. Events panel logs events that happen server side.")); - - main.addComponent(new Button("commit")); - - Tree t; - - t = createTestTree(); - t.setCaption("Default settings"); - main.addComponent(createTestBench(t)); - - t = createTestTree(); - t.setCaption("Multiselect settings"); - t.setMultiSelect(true); - main.addComponent(createTestBench(t)); - - t = createTestTree(); - t.setCaption("Multiselect and immediate"); - t.setImmediate(true); - t.setMultiSelect(true); - main.addComponent(createTestBench(t)); - - t = createTestTree(); - t.setCaption("immediate"); - t.setImmediate(true); - main.addComponent(createTestBench(t)); - - t = createTestTree(); - t.setCaption("with actions"); - t.setImmediate(true); - t.addActionHandler(this); - final OrderedLayout ol = (OrderedLayout) createTestBench(t); - al = new Panel("action log"); - ol.addComponent(al); - main.addComponent(ol); - contextTree = t; - - final Button b = new Button("refresh view", this, "createNewView"); - main.addComponent(b); - - } - - public Tree createTestTree() { - Tree t = new Tree("Tree"); - 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); - } - } - return t; - } - - public Component createTestBench(Tree t) { - final OrderedLayout ol = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - - ol.addComponent(t); - - final Panel status = new Panel("Events"); - final Button clear = new Button("c"); - clear.addListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - status.removeAllComponents(); - status.addComponent(clear); - } - }); - status.addComponent(clear); - - status.setHeight("300px"); - status.setWidth("400px"); - - ol.addComponent(status); - - t.addListener(new Listener() { - public void componentEvent(Event event) { - status.addComponent(new Label(event.getClass().getName())); - status.addComponent(new Label("selected: " - + event.getSource().toString())); - } - }); - - return ol; - } - - public Action[] getActions(Object target, Object sender) { - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - if (action == actions[1]) { - al.addComponent(new Label("Delete selected on " + target)); - contextTree.removeItem(target); - - } else { - al.addComponent(new Label("Edit selected on " + target)); - } - } -} diff --git a/src/com/vaadin/tests/TestForUpload.java b/src/com/vaadin/tests/TestForUpload.java deleted file mode 100644 index 351a590b26..0000000000 --- a/src/com/vaadin/tests/TestForUpload.java +++ /dev/null @@ -1,375 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.terminal.StreamResource; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Link; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Upload.FailedEvent; -import com.vaadin.ui.Upload.FailedListener; -import com.vaadin.ui.Upload.FinishedEvent; -import com.vaadin.ui.Upload.FinishedListener; -import com.vaadin.ui.Upload.StartedEvent; -import com.vaadin.ui.Upload.StartedListener; -import com.vaadin.ui.Upload.SucceededEvent; -import com.vaadin.ui.Upload.SucceededListener; - -public class TestForUpload extends CustomComponent implements - Upload.FinishedListener, FailedListener, SucceededListener, - Upload.ProgressListener, StartedListener { - - Layout main = new OrderedLayout(); - - Buffer buffer = new MemoryBuffer(); - - Panel status = new Panel("Uploaded file:"); - - private final Upload up; - - private final Label l; - - private final ProgressIndicator pi = new ProgressIndicator(); - private final ProgressIndicator pi2 = new ProgressIndicator(); - - private final Label memoryStatus; - - private final Select uploadBufferSelector; - - private TextField textField; - - private Label textFieldValue; - - public TestForUpload() { - setCompositionRoot(main); - main.addComponent(new Label( - "This is a simple test for upload application. " - + "Upload should work with big files and concurrent " - + "requests should not be blocked. Button 'b' reads " - + "current state into label below it. Memory receiver " - + "streams upload contents into memory. You may track" - + "consumption." - + "tempfile receiver writes upload to file and " - + "should have low memory consumption.")); - - main - .addComponent(new Label( - "Clicking on button b updates information about upload components status or same with garbage collector.")); - - textField = new TextField("Test field"); - textFieldValue = new Label(); - main.addComponent(textField); - main.addComponent(textFieldValue); - - up = new Upload("Upload", buffer); - up.setImmediate(true); - up.addListener((FinishedListener) this); - up.addListener((FailedListener) this); - up.addListener((SucceededListener) this); - up.addListener((StartedListener) this); - - up.setProgressListener(this); - up.addListener(new Upload.ProgressListener() { - - public void updateProgress(long readBytes, long contentLenght) { - pi2.setValue(new Float(readBytes / (float) contentLenght)); - - refreshMemUsage(); - } - - }); - - final Button b = new Button("b", this, "readState"); - - final Button c = new Button("b with gc", this, "gc"); - - main.addComponent(b); - main.addComponent(c); - - uploadBufferSelector = new Select("Receiver type"); - uploadBufferSelector.setImmediate(true); - uploadBufferSelector.addItem("memory"); - uploadBufferSelector.setValue("memory"); - uploadBufferSelector.addItem("tempfile"); - uploadBufferSelector - .addListener(new AbstractField.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - setBuffer(); - } - }); - main.addComponent(uploadBufferSelector); - - main.addComponent(up); - l = new Label("Idle"); - main.addComponent(l); - - pi.setVisible(false); - pi.setPollingInterval(1000); - main.addComponent(pi); - - pi2.setVisible(false); - pi2.setPollingInterval(1000); - main.addComponent(pi2); - - memoryStatus = new Label(); - main.addComponent(memoryStatus); - - status.setVisible(false); - main.addComponent(status); - - final Button restart = new Button("R"); - restart.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - getApplication().close(); - } - }); - main.addComponent(restart); - - } - - private void setBuffer() { - final String id = (String) uploadBufferSelector.getValue(); - if ("memory".equals(id)) { - buffer = new MemoryBuffer(); - } else if ("tempfile".equals(id)) { - buffer = new TmpFileBuffer(); - } - up.setReceiver(buffer); - } - - public void gc() { - Runtime.getRuntime().gc(); - readState(); - } - - public void readState() { - final StringBuffer sb = new StringBuffer(); - - if (up.isUploading()) { - sb.append("Uploading..."); - sb.append(up.getBytesRead()); - sb.append("/"); - sb.append(up.getUploadSize()); - sb.append(" "); - sb.append(Math.round(100 * up.getBytesRead() - / (double) up.getUploadSize())); - sb.append("%"); - } else { - sb.append("Idle"); - } - l.setValue(sb.toString()); - refreshMemUsage(); - } - - public void uploadFinished(FinishedEvent event) { - status.removeAllComponents(); - final InputStream stream = buffer.getStream(); - if (stream == 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 interface Buffer extends StreamResource.StreamSource, - Upload.Receiver { - - String getFileName(); - } - - public class MemoryBuffer implements Buffer { - ByteArrayOutputStream outputBuffer = null; - - String mimeType; - - String fileName; - - public MemoryBuffer() { - - } - - 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; - } - - } - - public class TmpFileBuffer implements Buffer { - String mimeType; - - String fileName; - - private File file; - - public TmpFileBuffer() { - final String tempFileName = "upload_tmpfile_" - + System.currentTimeMillis(); - try { - file = File.createTempFile(tempFileName, null); - } catch (final IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public InputStream getStream() { - if (file == null) { - return null; - } - try { - return new FileInputStream(file); - } catch (final FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - /** - * @see com.vaadin.ui.Upload.Receiver#receiveUpload(String, - * String) - */ - public OutputStream receiveUpload(String filename, String MIMEType) { - fileName = filename; - mimeType = MIMEType; - try { - return new FileOutputStream(file); - } catch (final FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - /** - * Returns the fileName. - * - * @return String - */ - public String getFileName() { - return fileName; - } - - /** - * Returns the mimeType. - * - * @return String - */ - public String getMimeType() { - return mimeType; - } - - } - - public void uploadFailed(FailedEvent event) { - System.out.println(event); - - System.out.println(event.getSource()); - - } - - public void uploadSucceeded(SucceededEvent event) { - pi.setVisible(false); - pi2.setVisible(false); - l.setValue("Finished upload, idle"); - System.out.println(event); - setBuffer(); - } - - public void updateProgress(long readBytes, long contentLenght) { - pi.setValue(new Float(readBytes / (float) contentLenght)); - - refreshMemUsage(); - } - - private void refreshMemUsage() { - memoryStatus.setValue("Not available in Java 1.4"); - /* - * StringBuffer mem = new StringBuffer(); MemoryMXBean mmBean = - * ManagementFactory.getMemoryMXBean(); mem.append("Heap (M):"); - * mem.append(mmBean.getHeapMemoryUsage().getUsed() / 1048576); - * mem.append(" |�Non-Heap (M):"); - * mem.append(mmBean.getNonHeapMemoryUsage().getUsed() / 1048576); - * memoryStatus.setValue(mem.toString()); - */ - } - - public void uploadStarted(StartedEvent event) { - pi.setVisible(true); - pi2.setVisible(true); - l.setValue("Started uploading file " + event.getFilename()); - textFieldValue.setValue(" TestFields value at the upload start is:" - + textField.getValue()); - } - -} diff --git a/src/com/vaadin/tests/TestForWindowOpen.java b/src/com/vaadin/tests/TestForWindowOpen.java deleted file mode 100644 index d6cd6fcc95..0000000000 --- a/src/com/vaadin/tests/TestForWindowOpen.java +++ /dev/null @@ -1,59 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Button.ClickEvent; - -public class TestForWindowOpen extends CustomComponent { - - public TestForWindowOpen() { - - final OrderedLayout main = new OrderedLayout(); - setCompositionRoot(main); - - main.addComponent(new Button("Open in this window", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - final ExternalResource r = new ExternalResource( - "http://www.google.com"); - getApplication().getMainWindow().open(r); - - } - - })); - - main.addComponent(new Button("Open in target \"mytarget\"", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - final ExternalResource r = new ExternalResource( - "http://www.google.com"); - getApplication().getMainWindow().open(r, "mytarget"); - - } - - })); - - main.addComponent(new Button("Open in target \"secondtarget\"", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - final ExternalResource r = new ExternalResource( - "http://www.google.com"); - getApplication().getMainWindow() - .open(r, "secondtarget"); - - } - - })); - - } - -} diff --git a/src/com/vaadin/tests/TestForWindowing.java b/src/com/vaadin/tests/TestForWindowing.java deleted file mode 100644 index 9fb3ea19ea..0000000000 --- a/src/com/vaadin/tests/TestForWindowing.java +++ /dev/null @@ -1,99 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.Slider; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class TestForWindowing extends CustomComponent { - - private Select s2; - - public TestForWindowing() { - - final OrderedLayout main = new OrderedLayout(); - - main.addComponent(new Label( - "Click the button to create a new inline window.")); - - final CheckBox asModal = new CheckBox("As modal"); - main.addComponent(asModal); - - final Button create = new Button("Create a new window", - new ClickListener() { - - public void buttonClick(ClickEvent event) { - Window w = new Window("Testing Window"); - - if (((Boolean) asModal.getValue()).booleanValue()) { - w.setModal(true); - } - - AbstractSelect s1 = new OptionGroup(); - s1.setCaption("1. Select output format"); - s1.addItem("Excel sheet"); - s1.addItem("CSV plain text"); - s1.setValue("Excel sheet"); - s1.setImmediate(true); - - s2 = new Select(); - s2.addItem("Separate by comma (,)"); - s2.addItem("Separate by colon (:)"); - s2.addItem("Separate by semicolon (;)"); - s2.setEnabled(false); - - s1.addListener(new ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - String v = (String) event.getProperty() - .getValue(); - if (v.equals("CSV plain text")) { - s2.setEnabled(true); - } else { - s2.setEnabled(false); - } - } - - }); - - w.addComponent(s1); - w.addComponent(s2); - - Slider s = new Slider(); - s.setCaption("Volume"); - s.setMax(13); - s.setMin(12); - s.setResolution(2); - s.setImmediate(true); - // s.setOrientation(Slider.ORIENTATION_VERTICAL); - // s.setArrows(false); - - w.addComponent(s); - - getApplication().getMainWindow().addWindow(w); - - } - - }); - - main.addComponent(create); - - setCompositionRoot(main); - - } - -} diff --git a/src/com/vaadin/tests/TestIFrames.java b/src/com/vaadin/tests/TestIFrames.java deleted file mode 100644 index 6719820c44..0000000000 --- a/src/com/vaadin/tests/TestIFrames.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; - -public class TestIFrames extends CustomComponent { - - OrderedLayout main = new OrderedLayout(); - - public TestIFrames() { - setCompositionRoot(main); - createNewView(); - } - - public void createNewView() { - main.removeAllComponents(); - main.addComponent(createEmbedded("../Reservr/")); - main.addComponent(createEmbedded("../colorpicker")); - // main.addComponent(createEmbedded("../TestForNativeWindowing")); - main - .addComponent(createEmbedded("http://toolkit.itmill.com/demo/FeaturesApplication")); - main - .addComponent(createEmbedded("http://toolkit.itmill.com/demo/TableDemo")); - } - - private Label createEmbedded(String URL) { - final int width = 600; - final int height = 250; - final String iFrame = "<iframe height=\"" + height + "\" width=\"" - + width + "\" src=\"" + URL + "\" />"; - return new Label(iFrame, Label.CONTENT_XHTML); - } - -} diff --git a/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java b/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java deleted file mode 100644 index b85c629295..0000000000 --- a/src/com/vaadin/tests/TestSelectAndDatefieldInDeepLayouts.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Collection; -import java.util.Vector; - -import com.vaadin.ui.AbstractLayout; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.DateField; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -/** - * This test has a somewhat deep layout within one page. At the bottom, Select - * and Datefield render their popups incorrectly. Popus tend to be "left behind" - * from the actual components. When the page is even bigger or longer, the - * popups are eventually rendered outside the visual parts of the page. - * - * @author Ville Ingman - * - */ -public class TestSelectAndDatefieldInDeepLayouts extends CustomComponent { - - public TestSelectAndDatefieldInDeepLayouts() { - final OrderedLayout root = (OrderedLayout) getOrderedLayout(); - setCompositionRoot(root); - - root.addComponent(getSelect()); - root.addComponent(getDateField()); - root.addComponent(getSelect()); - root.addComponent(getDateField()); - - final Panel p1 = getPanel(); - root.addComponent(p1); - - p1.addComponent(getSelect()); - p1.addComponent(getDateField()); - p1.addComponent(getSelect()); - p1.addComponent(getDateField()); - - final OrderedLayout l1 = (OrderedLayout) getOrderedLayout(); - p1.addComponent(l1); - - l1.addComponent(getSelect()); - l1.addComponent(getDateField()); - l1.addComponent(getSelect()); - l1.addComponent(getDateField()); - - final Panel p2 = getPanel(); - l1.addComponent(p2); - - p2.addComponent(getSelect()); - p2.addComponent(getDateField()); - p2.addComponent(getSelect()); - p2.addComponent(getDateField()); - - } - - AbstractLayout getOrderedLayout() { - final OrderedLayout l = new OrderedLayout(); - l.setCaption(getCaption("orderedlayout")); - return l; - } - - Panel getPanel() { - final Panel panel = new Panel(); - panel.setCaption(getCaption("panel")); - return panel; - } - - Component getSelect() { - return new Select(getCaption("select"), getSelectOptions()); - } - - Component getDateField() { - return new DateField(getCaption("datefield")); - } - - private Collection getSelectOptions() { - final Collection opts = new Vector(3); - opts.add(getCaption("opt 1")); - opts.add(getCaption("opt 2")); - opts.add(getCaption("opt 3")); - return opts; - } - - private String getCaption(String string) { - return string + (Math.random() * 99999.9); - // This is Java 5 code: - // return string + " " + UUID.randomUUID().toString().substring(0, 5); - } - -} diff --git a/src/com/vaadin/tests/TestSerialization.java b/src/com/vaadin/tests/TestSerialization.java deleted file mode 100644 index 1ee7f3c1ac..0000000000 --- a/src/com/vaadin/tests/TestSerialization.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.vaadin.tests; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - -import junit.framework.TestCase; - -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.data.validator.RegexpValidator; -import com.vaadin.ui.Form; - -public class TestSerialization extends TestCase { - - public void testValidators() throws Exception { - RegexpValidator validator = new RegexpValidator(".*", "Error"); - validator.isValid("aaa"); - RegexpValidator validator2 = (RegexpValidator) serializeAndDeserialize(validator); - validator2.isValid("aaa"); - } - - public void testForm() throws Exception { - Form f = new Form(); - String propertyId = "My property"; - f.addItemProperty(propertyId, new MethodProperty(new Data(), - "dummyGetterAndSetter")); - f.replaceWithSelect(propertyId, new Object[] { "a", "b", null }, - new String[] { "Item a", "ITem b", "Null item" }); - - serializeAndDeserialize(f); - - } - - public void testIndedexContainerItemIds() throws Exception { - IndexedContainer ic = new IndexedContainer(); - ic.addContainerProperty("prop1", String.class, null); - Object id = ic.addItem(); - ic.getItem(id).getItemProperty("prop1").setValue("1"); - - Item item2 = ic.addItem("item2"); - item2.getItemProperty("prop1").setValue("2"); - - serializeAndDeserialize(ic); - } - - public void testMethodPropertyGetter() throws Exception { - MethodProperty mp = new MethodProperty(new Data(), "dummyGetter"); - serializeAndDeserialize(mp); - } - - public void testMethodPropertyGetterAndSetter() throws Exception { - MethodProperty mp = new MethodProperty(new Data(), - "dummyGetterAndSetter"); - serializeAndDeserialize(mp); - } - - public void testMethodPropertyInt() throws Exception { - MethodProperty mp = new MethodProperty(new Data(), "dummyInt"); - serializeAndDeserialize(mp); - } - - private static Serializable serializeAndDeserialize(Serializable s) - throws IOException, ClassNotFoundException { - // Serialize and deserialize - - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(bs); - out.writeObject(s); - byte[] data = bs.toByteArray(); - ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream( - data)); - Serializable s2 = (Serializable) in.readObject(); - - if (s.equals(s2)) { - System.out.println(s + " equals " + s2); - } else { - System.out.println(s + " does NOT equal " + s2); - } - - return s2; - } - - public static class Data implements Serializable { - private String dummyGetter; - private String dummyGetterAndSetter; - private int dummyInt; - - public String getDummyGetterAndSetter() { - return dummyGetterAndSetter; - } - - public void setDummyGetterAndSetter(String dummyGetterAndSetter) { - this.dummyGetterAndSetter = dummyGetterAndSetter; - } - - public int getDummyInt() { - return dummyInt; - } - - public void setDummyInt(int dummyInt) { - this.dummyInt = dummyInt; - } - - public String getDummyGetter() { - return dummyGetter; - } - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/TestSetVisibleAndCaching.java b/src/com/vaadin/tests/TestSetVisibleAndCaching.java deleted file mode 100644 index 4e7132b3c8..0000000000 --- a/src/com/vaadin/tests/TestSetVisibleAndCaching.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class TestSetVisibleAndCaching extends com.vaadin.Application { - - Panel panelA = new Panel("Panel A"); - Panel panelB = new Panel("Panel B"); - Panel panelC = new Panel("Panel C"); - - Button buttonNextPanel = new Button("Show next panel"); - - int selectedPanel = 0; - - @Override - public void init() { - final Window mainWindow = new Window("TestSetVisibleAndCaching"); - setMainWindow(mainWindow); - - panelA.addComponent(new Label( - "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")); - panelB.addComponent(new Label( - "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")); - panelC.addComponent(new Label( - "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")); - - mainWindow - .addComponent(new Label( - "Inspect transfered data from server to " - + "client using firebug (http request / response cycles)." - + " See how widgets are re-used," - + " after each panel is once shown in GUI then" - + " their contents are not resend.")); - mainWindow.addComponent(buttonNextPanel); - mainWindow.addComponent(panelA); - mainWindow.addComponent(panelB); - mainWindow.addComponent(panelC); - - selectPanel(selectedPanel); - - buttonNextPanel.addListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - selectedPanel++; - if (selectedPanel > 2) { - selectedPanel = 0; - } - selectPanel(selectedPanel); - } - }); - - } - - private void selectPanel(int selectedPanel) { - System.err.println("Selecting panel " + selectedPanel); - switch (selectedPanel) { - case 0: - panelA.setVisible(true); - panelB.setVisible(false); - panelC.setVisible(false); - break; - case 1: - panelA.setVisible(false); - panelB.setVisible(true); - panelC.setVisible(false); - break; - case 2: - panelA.setVisible(false); - panelB.setVisible(false); - panelC.setVisible(true); - break; - } - } -} diff --git a/src/com/vaadin/tests/TestSizeableIncomponents.java b/src/com/vaadin/tests/TestSizeableIncomponents.java deleted file mode 100644 index 7c9788e640..0000000000 --- a/src/com/vaadin/tests/TestSizeableIncomponents.java +++ /dev/null @@ -1,320 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.File; -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; - -import com.vaadin.Application; -import com.vaadin.data.Container; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class TestSizeableIncomponents extends Application { - - private IndexedContainer cont; - private ComboBox select; - private Button prev; - private Button next; - private Panel testPanel; - - @Override - public void init() { - - initComponentList(); - - Window w = new Window(); - setMainWindow(w); - w.setTheme("demo"); - - final ExpandLayout main = new ExpandLayout(); - w.setLayout(main); - - select = new ComboBox(); - select.setImmediate(true); - select.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); - select.setWidth("400px"); - - prev = new Button("<<-|"); - prev.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Object cur = select.getValue(); - Testable prev = (Testable) cont.prevItemId(cur); - if (prev == null) { - getMainWindow().showNotification("No more test cases"); - } else { - getMainWindow().showNotification( - "Selected test:" + prev.getTestableName()); - select.setValue(prev); - select.requestRepaint(); - } - } - }); - next = new Button("|->>"); - next.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Object cur = select.getValue(); - Testable next = (Testable) cont.nextItemId(cur); - if (next == null) { - getMainWindow().showNotification("No more test cases"); - } else { - getMainWindow().showNotification( - "Selected test:" + next.getTestableName()); - select.setValue(next); - select.requestRepaint(); - } - } - }); - - OrderedLayout controllers = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - controllers.addComponent(prev); - controllers.addComponent(select); - controllers.addComponent(next); - main.addComponent(controllers); - - select.setContainerDataSource(cont); - select.addListener(new ComboBox.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - Testable t = (Testable) select.getValue(); - if (t != null) { - testPanel.removeAllComponents(); - try { - Component c = t.getComponent(); - if (c != null) { - testPanel.addComponent(c); - } - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - }); - - testPanel = new Panel(); - testPanel.setSizeFull(); - testPanel.setLayout(new ExpandLayout()); - testPanel.setStyleName("testable"); - main.addComponent(testPanel); - main.expand(testPanel); - - } - - private void initComponentList() { - cont = new IndexedContainer(); - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - - URL dir = cl.getResource("com/vaadin/ui"); - - String[] list2 = (new File(dir.getFile())).list(); - for (int i = 0; i < list2.length; i++) { - String f = list2[i]; - if (f.endsWith(".class") && (f.indexOf("CustomComponent") == -1) - && (f.indexOf("Window") == -1)) { - f = f.replaceAll(".class", ""); - String className = "com.vaadin.ui." + f; - Class c; - try { - c = Class.forName(className); - Object o = c.newInstance(); - if (o instanceof Component) { - Testable t = new Testable(c); - cont.addItem(t); - t = new Testable(c); - t.addConfiguration(new Configuration("100px*100px") { - @Override - void configure(Component c) { - c.setWidth(60); - c.setHeight(60); - } - }); - t = new Testable(c); - t.addConfiguration(new Configuration("Width 50em") { - @Override - void configure(Component c) { - c.setWidth("50em"); - } - }); - cont.addItem(t); - t = new Testable(c); - t.addConfiguration(new Configuration("Height 7cm") { - @Override - void configure(Component c) { - c.setHeight("7cm"); - } - }); - cont.addItem(t); - t = new Testable(c) { - @Override - public Component getComponent() - throws InstantiationException, - IllegalAccessException { - - Component c = super.getComponent(); - - Panel p = new Panel( - "Wrapper panel (400px*400px)"); - p.setLayout(new ExpandLayout()); - p.setWidth("400px"); - p.setHeight("400px"); - p.addComponent(c); - p.addStyleName("testablew"); - p.addStyleName("testable"); - return p; - } - - }; - t.addConfiguration(new Configuration("100%*100%") { - @Override - void configure(Component c) { - c.setSizeFull(); - } - - }); - cont.addItem(t); - } - - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - // e.printStackTrace(); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - // e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - // e.printStackTrace(); - } - } - } - - } - - class Testable { - - private Class classToTest; - private ArrayList configurations = new ArrayList(); - - Testable(Class c) { - classToTest = c; - } - - public void addConfiguration(Configuration conf) { - configurations.add(conf); - } - - public String getTestableName() { - StringBuffer sb = new StringBuffer(); - sb.append(classToTest.getName().replaceAll("com.vaadin.ui.", "")); - sb.append("["); - for (Iterator i = configurations.iterator(); i.hasNext();) { - sb.append(((Configuration) i.next()).getDescription()); - if (i.hasNext()) { - sb.append(","); - } - } - sb.append("]"); - - return sb.toString(); - } - - /** - * Instantiates and populates component with test data to be ready for - * testing. - * - * @return - * @throws InstantiationException - * @throws IllegalAccessException - */ - public Component getComponent() throws InstantiationException, - IllegalAccessException { - Component c = (Component) classToTest.newInstance(); - - if (c instanceof Button) { - ((AbstractComponent) c).setCaption("test"); - } - if (AbstractSelect.class.isAssignableFrom(c.getClass())) { - if (c instanceof Table) { - Table new_name = (Table) c; - new_name - .setContainerDataSource(TestForTablesInitialColumnWidthLogicRendering - .getTestTable(5, 100) - .getContainerDataSource()); - - } else { - AbstractSelect new_name = (AbstractSelect) c; - Container cont = TestForTablesInitialColumnWidthLogicRendering - .getTestTable(2, 8).getContainerDataSource(); - new_name.setContainerDataSource(cont); - new_name.setItemCaptionPropertyId(cont - .getContainerPropertyIds().iterator().next()); - - } - } else if (c instanceof ComponentContainer) { - ComponentContainer new_name = (ComponentContainer) c; - new_name - .addComponent(new Label("component 1 in test container")); - new_name.addComponent(new Button("component 2")); - } else if (c instanceof Embedded) { - Embedded em = (Embedded) c; - em.setSource(new ThemeResource("test.png")); - } else if (c instanceof Label) { - ((Label) c).setValue("Test label"); - } - - for (Iterator i = configurations.iterator(); i.hasNext();) { - Configuration conf = (Configuration) i.next(); - conf.configure(c); - } - return c; - } - - @Override - public String toString() { - return getTestableName(); - } - } - - public abstract class Configuration { - - private String description = ""; - - Configuration(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - abstract void configure(Component c); - - @Override - public String toString() { - return getDescription(); - } - - } -} diff --git a/src/com/vaadin/tests/TestSplitPanel.java b/src/com/vaadin/tests/TestSplitPanel.java deleted file mode 100644 index 628fec96d2..0000000000 --- a/src/com/vaadin/tests/TestSplitPanel.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import com.vaadin.ui.Label; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.Window; - -public class TestSplitPanel extends com.vaadin.Application { - - // SplitPanel verticalSplit = new - // SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); - SplitPanel verticalSplit = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL); - - @Override - public void init() { - final Window mainWindow = new Window("Feature Browser"); - setMainWindow(mainWindow); - - verticalSplit.setFirstComponent(new Label("vertical first")); - verticalSplit.setSecondComponent(new Label("vertical second")); - - mainWindow.setLayout(verticalSplit); - - } - -} diff --git a/src/com/vaadin/tests/TreeFilesystem.java b/src/com/vaadin/tests/TreeFilesystem.java deleted file mode 100644 index 202338cd50..0000000000 --- a/src/com/vaadin/tests/TreeFilesystem.java +++ /dev/null @@ -1,106 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.File; - -import com.vaadin.data.Item; -import com.vaadin.demo.util.SampleDirectory; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Window; -import com.vaadin.ui.Tree.ExpandEvent; - -/** - * Browsable file explorer using Vaadin Tree component. Demonstrates: how to add - * items hierarchically into <code>com.vaadin.ui.Component.Tree</code>, how to - * receive ExpandEvent and implement - * <code>com.vaadin.ui.Tree.ExpandListener</code>. - * - * @since 4.0.0 - * - */ -public class TreeFilesystem extends com.vaadin.Application implements - Tree.ExpandListener { - - // Filesystem explorer panel and it's components - private final Panel explorerPanel = new Panel("Filesystem explorer"); - - private final Tree tree = new Tree(); - - @Override - public void init() { - final Window main = new Window("Tree filesystem demo"); - setMainWindow(main); - - // Main window contains heading and panel - main.addComponent(new Label("<h2>Tree demo</h2>", Label.CONTENT_XHTML)); - - // configure file structure panel - main.addComponent(explorerPanel); - explorerPanel.addComponent(tree); - explorerPanel.setHeight(400); - - // "this" handles tree's expand event - tree.addListener(this); - - // Get sample directory - final File sampleDir = SampleDirectory.getDirectory(this); - // populate tree's root node with example directory - if (sampleDir != null) { - populateNode(sampleDir.getAbsolutePath(), null); - } - } - - /** - * Handle tree expand event, populate expanded node's childs with new files - * and directories. - */ - public void nodeExpand(ExpandEvent event) { - final Item i = tree.getItem(event.getItemId()); - if (!tree.hasChildren(i)) { - // populate tree's node which was expanded - populateNode(event.getItemId().toString(), event.getItemId()); - } - } - - /** - * Populates files to tree as items. In this example items are of String - * type that consist of file path. New items are added to tree and item's - * parent and children properties are updated. - * - * @param file - * path which contents are added to tree - * @param parent - * for added nodes, if null then new nodes are added to root node - */ - private void populateNode(String file, Object parent) { - final File subdir = new File(file); - final File[] files = subdir.listFiles(); - for (int x = 0; x < files.length; x++) { - try { - // add new item (String) to tree - final String path = files[x].getCanonicalPath().toString(); - tree.addItem(path); - // set parent if this item has one - if (parent != null) { - tree.setParent(path, parent); - } - // check if item is a directory and read access exists - if (files[x].isDirectory() && files[x].canRead()) { - // yes, childrens therefore exists - tree.setChildrenAllowed(path, true); - } else { - // no, childrens therefore do not exists - tree.setChildrenAllowed(path, false); - } - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - } - -} diff --git a/src/com/vaadin/tests/TreeFilesystemContainer.java b/src/com/vaadin/tests/TreeFilesystemContainer.java deleted file mode 100644 index 52154fbe22..0000000000 --- a/src/com/vaadin/tests/TreeFilesystemContainer.java +++ /dev/null @@ -1,103 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.io.File; - -import com.vaadin.data.util.FilesystemContainer; -import com.vaadin.data.util.FilesystemContainer.FileItem; -import com.vaadin.demo.util.SampleDirectory; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Field; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Window; -import com.vaadin.ui.Component.Event; -import com.vaadin.ui.Component.Listener; - -/** - * Browsable file explorer using Vaadin Tree component. Demonstrates: how to use - * <code>com.vaadin.ui.Component.Tree</code> datasource container, how to create - * <code>com.vaadin.data.util.FilesystemContainer</code>, how to read - * <code>com.vaadin.ui.Component.Event</code> objects, how to receive and handle - * any event by implementing <code>com.vaadin.ui.Component.Listener</code>. - * - * @since 4.0.0 - * - */ -public class TreeFilesystemContainer extends com.vaadin.Application implements - Listener { - - // Filesystem explorer panel and it's components - private final Panel explorerPanel = new Panel("Filesystem explorer"); - - private final Tree filesystem = new Tree(); - - // File properties panel and it's components - private final Panel propertyPanel = new Panel("File properties"); - - private final Label fileProperties = new Label(); - - @Override - public void init() { - final Window w = new Window("Tree FilesystemContainer demo"); - setMainWindow(w); - final ExpandLayout main = new ExpandLayout(); - w.setLayout(main); - main.setMargin(true); - main.setSpacing(true); - - propertyPanel.setHeight(120); - main.addComponent(propertyPanel); - explorerPanel.setHeight(100); - explorerPanel.setHeightUnits(Panel.UNITS_PERCENTAGE); - main.addComponent(explorerPanel); - main.expand(explorerPanel); - - // Explorer panel contains tree - explorerPanel.addComponent(filesystem); - - // Property panel contains label - propertyPanel.addComponent(fileProperties); - fileProperties.setCaption("No file selected."); - propertyPanel.setEnabled(false); - - // Get sample directory - final File sampleDir = SampleDirectory.getDirectory(this); - // Populate tree with FilesystemContainer - final FilesystemContainer fsc = new FilesystemContainer(sampleDir, true); - filesystem.setContainerDataSource(fsc); - // "this" handles all filesystem events - // e.g. node clicked, expanded etc. - filesystem.addListener(this); - // Value changes are immediate - filesystem.setImmediate(true); - } - - /** - * Listener for any component events. This class has been registered as an - * listener for component fsTree. - */ - public void componentEvent(Event event) { - // Check if event occured at fsTree component - if (event.getSource() == filesystem) { - // Check if event is about changing value - if (event.getClass() == Field.ValueChangeEvent.class) { - // Update property panel contents - final FileItem fileItem = (FileItem) filesystem - .getItem(filesystem.getValue()); - fileProperties.setIcon(fileItem.getIcon()); - fileProperties.setCaption(fileItem.getName() + ", size " - + fileItem.getSize() + " bytes."); - propertyPanel.setEnabled(true); - } - // here we could check for other type of events for filesystem - // component - } - // here we could check for other component's events - } - -} diff --git a/src/com/vaadin/tests/UpgradingSample.java b/src/com/vaadin/tests/UpgradingSample.java deleted file mode 100644 index 3819b33a3c..0000000000 --- a/src/com/vaadin/tests/UpgradingSample.java +++ /dev/null @@ -1,171 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -// -// Millstone imports were replaced -// -// import org.millstone.base.Application; -// import org.millstone.base.ui.*; -// import org.millstone.base.data.*; -// -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Window; - -/** - * <p> - * Example application demonstrating simple user login. This example is from - * MillStone 3.1.1 examples section. Upgrading from 3.1.1 to 4.0.0 was done by - * updating imports, also setTheme("corporate") call was added to application - * init method. - * </p> - * - * @since 3.1.1 - * @author IT Mill Ltd. - */ -public class UpgradingSample extends Application implements - Property.ValueChangeListener { - - /* Menu for navigating inside the application. */ - private final Tree menu = new Tree(); - - /* Contents of the website */ - private final String[][] pages = { - { "Welcome", "Welcome to our website..." }, - { "Products", "Public product information." }, - { "Contact", "Public contact information." }, - { "CRM", "CRM Database requiring login." }, - { "Intranet", "Internal information database." } }; - - /* Application layout */ - private final GridLayout layout = new GridLayout(2, 1); - - /* Initialize the application */ - @Override - public void init() { - - // Create the main window of the application - final Window main = new Window("Login example", layout); - setMainWindow(main); - - // Add menu and loginbox to the application - final OrderedLayout l = new OrderedLayout(); - layout.addComponent(l, 0, 0); - l.addComponent(menu); - l.addComponent(new LoginBox()); - - // Setup menu - menu.setStyleName("menu"); - menu.addListener(this); - menu.setImmediate(true); - addToMenu(new String[] { "Welcome", "Products", "Contact" }); - } - - // Overriding usetUser method is a simple way of updating application - // privileges when the user is changed - @Override - public void setUser(Object user) { - super.setUser(user); - if (user != null) { - addToMenu(new String[] { "CRM", "Intranet" }); - } - } - - public void addToMenu(String[] items) { - for (int i = 0; i < items.length; i++) { - menu.addItem(items[i]); - menu.setChildrenAllowed(items[i], false); - } - if (menu.getValue() == null) { - menu.setValue(items[0]); - } - } - - // Handle menu selection and update visible page - public void valueChange(Property.ValueChangeEvent event) { - layout.removeComponent(1, 0); - final String title = (String) menu.getValue(); - for (int i = 0; i < pages.length; i++) { - if (pages[i][0].equals(title)) { - final Panel p = new Panel(pages[i][0]); - p.addComponent(new Label(pages[i][1])); - p.setStyleName("strong"); - layout.addComponent(p, 1, 0); - } - } - } - - // Simple loginbox component for the application - public class LoginBox extends CustomComponent implements - Application.UserChangeListener { - - // The components this loginbox is composed of - private final TextField loginName = new TextField("Name"); - - private final Button loginButton = new Button("Enter", this, "login"); - - private final Panel loginPanel = new Panel("Login"); - - private final Panel statusPanel = new Panel(); - - private final Button logoutButton = new Button("Logout", - UpgradingSample.this, "close"); - - private final Label statusLabel = new Label(); - - // Initialize login component - public LoginBox() { - - // Initialize the component - loginPanel.addComponent(loginName); - loginPanel.addComponent(loginButton); - loginPanel.setStyleName("strong"); - loginName.setColumns(8); - statusPanel.addComponent(statusLabel); - statusPanel.addComponent(logoutButton); - - // Set the status of the loginbox and show correct - // components - updateStatus(); - - // Listen application user change events - UpgradingSample.this.addListener(this); - } - - // Login into application - public void login() { - final String name = (String) loginName.getValue(); - if (name != null && name.length() > 0) { - setUser(name); - } - loginName.setValue(""); - } - - // Update login status on application user change events - public void applicationUserChanged(Application.UserChangeEvent event) { - updateStatus(); - } - - // Update login status of the component by exposing correct - // components - private void updateStatus() { - statusLabel.setValue("User: " + getUser()); - if (getUser() != null) { - setCompositionRoot(statusPanel); - } else { - setCompositionRoot(loginPanel); - } - } - } -} diff --git a/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java b/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java deleted file mode 100644 index b54bd3d184..0000000000 --- a/src/com/vaadin/tests/UsingCustomNewItemHandlerInSelect.java +++ /dev/null @@ -1,65 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.Random; - -import com.vaadin.data.Item; -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class UsingCustomNewItemHandlerInSelect extends CustomComponent { - - private final Select select = new Select(); - - public static Random random = new Random(1); - - private static int sequence = 0; - - public UsingCustomNewItemHandlerInSelect() { - - final Panel panel = new Panel("Select demo"); - panel.addComponent(select); - - select.setCaption("Select component"); - select.setImmediate(true); - select.addContainerProperty("CAPTION", String.class, ""); - select.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); - select.setItemCaptionPropertyId("CAPTION"); - select.setNewItemsAllowed(true); - select.setNewItemHandler(new MyNewItemHandler()); - - populateSelect(); - - setCompositionRoot(panel); - } - - public void populateSelect() { - final String[] names = new String[] { "John", "Mary", "Joe", "Sarah", - "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" }; - for (int j = 0; j < 4; j++) { - Integer id = new Integer(sequence++); - Item item = select.addItem(id); - item.getItemProperty("CAPTION").setValue( - id.toString() + ": " - + names[random.nextInt() % names.length]); - } - } - - public class MyNewItemHandler implements AbstractSelect.NewItemHandler { - public void addNewItem(String newItemCaption) { - // here could be db insert or other backend operation - Integer id = new Integer(sequence++); - Item item = select.addItem(id); - item.getItemProperty("CAPTION").setValue( - id.toString() + ": " + newItemCaption); - select.setValue(id); - } - - } - -} diff --git a/src/com/vaadin/tests/UsingObjectsInSelect.java b/src/com/vaadin/tests/UsingObjectsInSelect.java deleted file mode 100644 index 2fc0fc5eac..0000000000 --- a/src/com/vaadin/tests/UsingObjectsInSelect.java +++ /dev/null @@ -1,115 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests; - -import java.util.LinkedList; -import java.util.Random; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.Window; - -public class UsingObjectsInSelect extends com.vaadin.Application implements - ValueChangeListener { - - private final Select select = new Select(); - private final Label selectedTask = new Label("Selected task", - Label.CONTENT_XHTML); - - public LinkedList exampleTasks = new LinkedList(); - - public static Random random = new Random(1); - - @Override - public void init() { - final Window main = new Window("Select demo"); - setMainWindow(main); - - final Panel panel = new Panel("Select demo"); - panel.addComponent(select); - final Panel panel2 = new Panel("Selection"); - panel2.addComponent(selectedTask); - - select.setCaption("Select component"); - select.addListener(this); - select.setImmediate(true); - - main.addComponent(panel); - main.addComponent(panel2); - - createExampleTasks(); - } - - public void createExampleTasks() { - final String[] assignedTo = new String[] { "John", "Mary", "Joe", - "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" }; - final String[] type = new String[] { "Enhancement", "Bugfix", - "Testing", "Task" }; - for (int j = 0; j < 100; j++) { - final Task task = new Task( - type[(int) (random.nextDouble() * (type.length - 1))], - assignedTo[(int) (random.nextDouble() * (assignedTo.length - 1))], - random.nextInt(100)); - select.addItem(task); - } - } - - public void valueChange(ValueChangeEvent event) { - final Task task = (Task) select.getValue(); - selectedTask.setValue("<b>Type:</b> " + task.getType() - + "<br /><b>Assigned to:</b> " + task.getAssignedTo() - + "<br /><b>Estimated hours: </b>" + task.getEstimatedHours()); - } - - /** - * Sample class which is bound to Vaadin components - * - */ - public class Task { - - private String type; - private String assignedTo; - private int estimatedHours; - - public Task(String type, String assignedTo, int estimatedHours) { - this.type = type; - this.assignedTo = assignedTo; - this.estimatedHours = estimatedHours; - } - - @Override - public String toString() { - return type + ", " + assignedTo; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getAssignedTo() { - return assignedTo; - } - - public void setAssignedTo(String assignedTo) { - this.assignedTo = assignedTo; - } - - public float getEstimatedHours() { - return estimatedHours; - } - - public void setEstimatedHours(int estimatedHours) { - this.estimatedHours = estimatedHours; - } - } - -} diff --git a/src/com/vaadin/tests/appengine/GAESyncTest.java b/src/com/vaadin/tests/appengine/GAESyncTest.java deleted file mode 100644 index a28da32c39..0000000000 --- a/src/com/vaadin/tests/appengine/GAESyncTest.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.vaadin.tests.appengine; - -import com.google.apphosting.api.DeadlineExceededException; -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.DownloadStream; -import com.vaadin.ui.Button; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window.Notification; - -public class GAESyncTest extends Application { - - /** - * - */ - private static final long serialVersionUID = -3724319151122707926l; - - @Override - public void init() { - setMainWindow(new IntrWindow(this)); - - } - - @Override - public void terminalError(com.vaadin.terminal.Terminal.ErrorEvent event) { - Throwable t = event.getThrowable(); - // Was this caused by a GAE timeout? - while (t != null) { - if (t instanceof DeadlineExceededException) { - getMainWindow().showNotification("Bugger!", - "Deadline Exceeded", Notification.TYPE_ERROR_MESSAGE); - return; - } - t = t.getCause(); - } - - super.terminalError(event); - - } - - private class IntrWindow extends Window { - private int n = 0; - private static final long serialVersionUID = -6521351715072191625l; - TextField tf; - Label l; - Application app; - GridLayout gl; - - private IntrWindow(Application app) { - - this.app = app; - tf = new TextField("Echo thingie"); - tf.setImmediate(true); - tf.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - IntrWindow.this.showNotification((String) event - .getProperty().getValue()); - - } - - }); - addComponent(tf); - - l = new Label("" + n); - addComponent(l); - - { - Button b = new Button("Slow", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - try { - Thread.sleep(15000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - }); - addComponent(b); - } - - { - Button b = new Button("Add", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - if (getWindow() == getApplication().getMainWindow()) { - getWindow().showNotification("main"); - try { - Thread.sleep((5000)); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - addImage(); - } - - }); - addComponent(b); - } - - gl = new GridLayout(30, 50); - addComponent(gl); - - } - - private void addImage() { - ClassResource res = new ClassResource("img1.png", app) { - - private static final long serialVersionUID = 1L; - - @Override - public DownloadStream getStream() { - try { - Thread.sleep((long) (Math.random() * 5000)); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return super.getStream(); - } - - }; - res.setCacheTime(0); - Embedded emb = new Embedded("" + n, res); - emb.setWidth("30px"); - emb.setHeight("5px"); - gl.addComponent(emb); - l.setValue("" + n++); - } - - } - - @Override - public Window getWindow(String name) { - Window w = super.getWindow(name); - if (w == null) { - w = new IntrWindow(this); - addWindow(w); - } - return w; - - } - -} diff --git a/src/com/vaadin/tests/appengine/img1.png b/src/com/vaadin/tests/appengine/img1.png Binary files differdeleted file mode 100644 index d249324e0c..0000000000 --- a/src/com/vaadin/tests/appengine/img1.png +++ /dev/null diff --git a/src/com/vaadin/tests/applicationservlet/NoMainWindow.java b/src/com/vaadin/tests/applicationservlet/NoMainWindow.java deleted file mode 100644 index 9097274236..0000000000 --- a/src/com/vaadin/tests/applicationservlet/NoMainWindow.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.vaadin.tests.applicationservlet;
-
-import com.vaadin.tests.components.AbstractTestCase;
-
-public class NoMainWindow extends AbstractTestCase {
-
- @Override
- protected String getDescription() {
- return "This should produce an stack trace with \"No window found. Did you remember to setMainWindow()?\"";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3349;
- }
-
- @Override
- public void init() {
-
- }
-
-}
diff --git a/src/com/vaadin/tests/applicationservlet/TestStaticFilesLocation.java b/src/com/vaadin/tests/applicationservlet/TestStaticFilesLocation.java deleted file mode 100644 index bf991d01cf..0000000000 --- a/src/com/vaadin/tests/applicationservlet/TestStaticFilesLocation.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.vaadin.tests.applicationservlet; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; - -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; - -import javax.servlet.http.HttpServletRequest; - -import junit.framework.TestCase; - -import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; -import com.vaadin.terminal.gwt.server.ApplicationServlet; - -public class TestStaticFilesLocation extends TestCase { - - ApplicationServlet servlet; - - private Method getStaticFilesLocationMethod; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - servlet = new ApplicationServlet(); - - getStaticFilesLocationMethod = AbstractApplicationServlet.class - .getDeclaredMethod( - "getStaticFilesLocation", - new Class[] { javax.servlet.http.HttpServletRequest.class }); - getStaticFilesLocationMethod.setAccessible(true); - - } - - public void testWidgetSetLocation() throws Exception { - String location; - - /* SERVLETS */ - // http://dummy.host:8080/contextpath/servlet - // should return /contextpath - location = testLocation("http://dummy.host:8080", "/contextpath", - "/servlet", ""); - assertEquals("/contextpath", location); - - // http://dummy.host:8080/servlet - // should return "" - location = testLocation("http://dummy.host:8080", "", "/servlet", ""); - assertEquals("", location); - - // http://dummy.host/contextpath/servlet/extra/stuff - // should return /contextpath - location = testLocation("http://dummy.host", "/contextpath", - "/servlet", "/extra/stuff"); - assertEquals("/contextpath", location); - - // http://dummy.host/context/path/servlet/extra/stuff - // should return /context/path - location = testLocation("http://dummy.host", "/context/path", - "/servlet", "/extra/stuff"); - assertEquals("/context/path", location); - - /* Include requests */ - location = testIncludedLocation("http://my.portlet.server", "/user", - "/tmpservletlocation1", ""); - assertEquals("/user", location); - - } - - private String testLocation(String base, String contextPath, - String servletPath, String pathInfo) throws Exception { - - HttpServletRequest request = createNonIncludeRequest(base, contextPath, - servletPath, pathInfo); - // Set request into replay mode - replay(request); - - String location = (String) getStaticFilesLocationMethod.invoke(servlet, - request); - return location; - } - - private String testIncludedLocation(String base, String portletContextPath, - String servletPath, String pathInfo) throws Exception { - - HttpServletRequest request = createIncludeRequest(base, - portletContextPath, servletPath, pathInfo); - // Set request into replay mode - replay(request); - - String location = (String) getStaticFilesLocationMethod.invoke(servlet, - request); - return location; - } - - private HttpServletRequest createIncludeRequest(String base, - String realContextPath, String realServletPath, String pathInfo) - throws Exception { - HttpServletRequest request = createRequest(base, "", "", pathInfo); - expect(request.getAttribute("javax.servlet.include.context_path")) - .andReturn(realContextPath).anyTimes(); - expect(request.getAttribute("javax.servlet.include.servlet_path")) - .andReturn(realServletPath).anyTimes(); - - return request; - } - - private HttpServletRequest createNonIncludeRequest(String base, - String realContextPath, String realServletPath, String pathInfo) - throws Exception { - HttpServletRequest request = createRequest(base, realContextPath, - realServletPath, pathInfo); - expect(request.getAttribute("javax.servlet.include.context_path")) - .andReturn(null).anyTimes(); - expect(request.getAttribute("javax.servlet.include.servlet_path")) - .andReturn(null).anyTimes(); - - return request; - } - - /** - * Creates a HttpServletRequest mock using the supplied parameters. - * - * @param base - * The base url, e.g. http://localhost:8080 - * @param contextPath - * The context path where the application is deployed, e.g. - * /mycontext - * @param servletPath - * The servlet path to the servlet we are testing, e.g. /myapp - * @param pathInfo - * Any text following the servlet path in the request, not - * including query parameters, e.g. /UIDL/ - * @return A mock HttpServletRequest object useful for testing - * @throws MalformedURLException - */ - private HttpServletRequest createRequest(String base, String contextPath, - String servletPath, String pathInfo) throws MalformedURLException { - URL url = new URL(base + contextPath + pathInfo); - HttpServletRequest request = createMock(HttpServletRequest.class); - expect(request.isSecure()).andReturn( - url.getProtocol().equalsIgnoreCase("https")).anyTimes(); - expect(request.getServerName()).andReturn(url.getHost()).anyTimes(); - expect(request.getServerPort()).andReturn(url.getPort()).anyTimes(); - expect(request.getRequestURI()).andReturn(url.getPath()).anyTimes(); - expect(request.getContextPath()).andReturn(contextPath).anyTimes(); - expect(request.getPathInfo()).andReturn(pathInfo).anyTimes(); - expect(request.getServletPath()).andReturn(servletPath).anyTimes(); - - return request; - } - -} diff --git a/src/com/vaadin/tests/book/BookTestApplication.java b/src/com/vaadin/tests/book/BookTestApplication.java deleted file mode 100644 index 6d3b653baf..0000000000 --- a/src/com/vaadin/tests/book/BookTestApplication.java +++ /dev/null @@ -1,1893 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import java.net.URL; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.Iterator; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import com.vaadin.data.Item; -import com.vaadin.data.Validator; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.QueryContainer; -import com.vaadin.data.validator.StringLengthValidator; -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.terminal.ParameterHandler; -import com.vaadin.terminal.Sizeable; -import com.vaadin.terminal.StreamResource; -import com.vaadin.terminal.URIHandler; -import com.vaadin.terminal.UserError; -import com.vaadin.terminal.gwt.server.WebApplicationContext; -import com.vaadin.ui.AbsoluteLayout; -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Form; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.MenuBar; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.Panel; -import com.vaadin.ui.PopupDateField; -import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.Select; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TabSheet; -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.Button.ClickEvent; -import com.vaadin.ui.Layout.AlignmentHandler; -import com.vaadin.ui.MenuBar.MenuItem; - -public class BookTestApplication extends com.vaadin.Application { - Window main = new Window("Application window"); - - TheButton butts1; - TheButtons butts2; - TheButtons2 butts3; - - Label mylabel1; - Label mylabel2; - Label mylabel3; - - StreamResource strres; - VerticalLayout ol; - int getwincount = 0; - - @Override - public void init() { - setTheme("tests-book"); - - setMainWindow(main); - - main.getContent().setSizeFull(); - - // Demo the use of parameter and URI handlers - main.addParameterHandler(new MyParameterHandler()); - main.addURIHandler(new MyURIHandler()); - - MyDynamicResource myresource = new MyDynamicResource(); - main.addParameterHandler(myresource); - main.addURIHandler(myresource); - - main.addURIHandler(new BookTestURIHandler()); - } - - class MyParameterHandler implements ParameterHandler { - public void handleParameters(Map parameters) { - // Print out the parameters to standard output - for (Iterator it = parameters.keySet().iterator(); it.hasNext();) { - String key = (String) it.next(); - String value = ((String[]) parameters.get(key))[0]; - System.out.println("Key: " + key + ", value: " + value); - } - } - } - - class MyURIHandler implements URIHandler { - public DownloadStream handleURI(URL context, String relativeUri) { - System.out.println("Context: " + context.toString() - + ", relative: " + relativeUri); - return null; // Let the Application provide the response - } - } - - class BookTestURIHandler implements URIHandler { - public DownloadStream handleURI(URL context, String relativeUri) { - String example; - String param = null; - - final int slashPos = relativeUri.indexOf("/"); - if (slashPos > 0) { - example = relativeUri.substring(0, slashPos); - param = relativeUri.substring(slashPos + 1); - } else { - example = relativeUri; - } - - /* Remove existing components and windows. */ - main.removeAllComponents(); - final Set childwindows = main.getChildWindows(); - for (final Iterator cwi = childwindows.iterator(); cwi.hasNext();) { - final Window child = (Window) cwi.next(); - main.removeWindow(child); - } - - // The index is listed inside a grid layout - main.setLayout(new VerticalLayout()); - GridLayout grid = new GridLayout(4, 4); - grid.addStyleName("index"); - main.addComponent(grid); - - if (example.equals("index")) { - final String examples[] = { "defaultbutton", "label", - "labelcontent", "tree", "embedded", "textfield", - "textfieldvalidation", "datefield", "button", - "select/select", "select/native", "select/optiongroup", - "select/twincol", "filterselect", "validator", "table", - "table/select", "table/component", "table/paging", - "table/editable", "upload", "link", "gridlayout", - "orderedlayout", "formlayout", "form", "form/simple", - "form/layout", "panel", "expandlayout", - "expandlayout/root", "tabsheet", "alignment", - "alignment/grid", "window", "window/opener", - "window/multiple", "classresource", "usererror", - "progress/window", "progress/thread", "progress", - "customlayout", "spacing", "margin", "clientinfo", - "fillinform/templates", "notification", "print", - "richtextfield", "querycontainer", "menubar", - "absolutelayout", "layout/intro"}; - for (int i = 0; i < examples.length; i++) { - grid.addComponent(new Label("<a href='" - + context.toString() + examples[i] + "'>" - + examples[i] + "</a>", Label.CONTENT_XHTML)); - } - return null; - } - - if (example.equals("defaultbutton")) { - example_defaultButton(main, param); - } else if (example.equals("label")) { - example_Label(main, param); - } else if (example.equals("labelcontent")) { - example_LabelContent(main, param); - } else if (example.equals("tree")) { - example_Tree(main, param); - } else if (example.equals("embedded")) { - example_Embedded(main, param); - } else if (example.equals("textfield")) { - example_TextField(main, param); - } else if (example.equals("textfieldvalidation")) { - example_TextFieldValidation(main, param); - } else if (example.equals("usererror")) { - example_UserError(main, param); - } else if (example.equals("datefield")) { - example_DateField(main, param); - } else if (example.equals("button")) { - example_Button(main, param); - } else if (example.equals("checkbox")) { - example_CheckBox(main, param); - } else if (example.equals("select")) { - example_Select(main, param); - } else if (example.equals("filterselect")) { - example_FilterSelect(main, param); - } else if (example.equals("validator")) { - example_Validator(main, param); - } else if (example.equals("table")) { - example_Table(main, param); - } else if (example.equals("upload")) { - example_Upload(main, param); - } else if (example.equals("link")) { - example_Link(main, param); - } else if (example.equals("gridlayout")) { - example_GridLayout(main, param); - } else if (example.equals("orderedlayout")) { - example_OrderedLayout(main, param); - } else if (example.equals("formlayout")) { - example_FormLayout(main, param); - } else if (example.equals("form")) { - example_Form(main, param); - } else if (example.equals("tabsheet")) { - example_TabSheet(main, param); - } else if (example.equals("panel")) { - example_Panel(main, param); - } else if (example.equals("expandlayout")) { - example_ExpandLayout(main, param); - } else if (example.equals("alignment")) { - example_Alignment(main, param); - } else if (example.equals("window")) { - example_Window(main, param); - } else if (example.equals("classresource")) { - example_ClassResource(main, param); - } else if (example.equals("progress")) { - example_ProgressIndicator(main, param); - } else if (example.equals("customlayout")) { - example_CustomLayout(main, param); - } else if (example.equals("spacing")) { - example_Spacing(main, param); - } else if (example.equals("margin")) { - example_Margin(main, param); - } else if (example.equals("clientinfo")) { - example_ClientInfo(main, param); - } else if (example.equals("fillinform")) { - example_FillInForm(main, param); - } else if (example.equals("notification")) { - example_Notification(main, param); - } else if (example.equals("print")) { - example_Print(main, param); - } else if (example.equals("richtextfield")) { - example_RichTextArea(main, param); - } else if (example.equals("querycontainer")) { - example_QueryContainer(main, param); - } else if (example.equals("menubar")) { - example_MenuBar(main, param); - } else if (example.equals("absolutelayout")) { - example_AbsoluteLayout(main, param); - } else if (example.equals("layout")) { - example_Layout(main, param); - } else { - ; // main.addComponent(new - // Label("Unknown test '"+example+"'.")); - } - - return null; - } - } - - /* - * public Window getWindow(String name) { Window superwin = - * super.getWindow(name); if (superwin != null) return superwin; - * - * main.addComponent(new Label("Request 2 for window '"+name+"'.")); if - * (name.equals("panel")) { Window window = new Window("Other Window " + - * getwincount++); example_Panel(window, null); return window; } return - * null; } - */ - public void handleButton(Button.ClickEvent event) { - ol.addStyleName("myLayout2"); - } - - void example_defaultButton(Window main, String param) { - main.addComponent(new DefaultButtonExample()); - } - - void example_Label(Window main, String param) { - /* Some container for the Label. */ - final Panel panel = new Panel("Panel Containing a Label"); - main.addComponent(panel); - - panel.addComponent(new Label( - "This is a Label inside a Panel. There is enough " - + "text in the label to make the text wrap if it " - + "exceeds the width of the panel.")); - } - - void example_LabelContent(Window main, String param) { - final GridLayout labelgrid = new GridLayout(2, 1); - labelgrid.addStyleName("labelgrid"); - labelgrid.addComponent(new Label("CONTENT_DEFAULT")); - labelgrid.addComponent(new Label( - "This is a label in default mode: <plain text>", - Label.CONTENT_DEFAULT)); - labelgrid.addComponent(new Label("CONTENT_PREFORMATTED")); - labelgrid - .addComponent(new Label( - "This is a preformatted label.\nThe newline character \\n breaks the line.", - Label.CONTENT_PREFORMATTED)); - labelgrid.addComponent(new Label("CONTENT_RAW")); - labelgrid - .addComponent(new Label( - "This is a label in raw mode.<br>It can contain, for example, unbalanced markup.", - Label.CONTENT_RAW)); - labelgrid.addComponent(new Label("CONTENT_TEXT")); - labelgrid.addComponent(new Label( - "This is a label in (plain) text mode", Label.CONTENT_TEXT)); - labelgrid.addComponent(new Label("CONTENT_XHTML")); - labelgrid.addComponent(new Label( - "<i>This</i> is an <b>XHTML<b> formatted label", - Label.CONTENT_XHTML)); - labelgrid.addComponent(new Label("CONTENT_XML")); - labelgrid.addComponent(new Label( - "This is an <myelement>XML</myelement> formatted label", - Label.CONTENT_XML)); - main.addComponent(labelgrid); - - final ClassResource labelimage = new ClassResource("smiley.jpg", this); - main.addComponent(new Label("Here we have an image <img src=\"" - + getRelativeLocation(labelimage) + "\"/> within some text.", - Label.CONTENT_XHTML)); - } - - void example_Tree(Window main, String param) { - final Object[][] planets = new Object[][] { - new Object[] { "Mercury" }, - new Object[] { "Venus" }, - new Object[] { "Earth", "The Moon" }, - new Object[] { "Mars", "Phobos", "Deimos" }, - new Object[] { "Jupiter", "Io", "Europa", "Ganymedes", - "Callisto" }, - new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea", - "Iapetus" }, - new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel", - "Titania", "Oberon" }, - new Object[] { "Neptune", "Triton", "Proteus", "Nereid", - "Larissa" } }; - - final Tree tree = new Tree(); - - // Add planets as root items in the tree. - for (int i = 0; i < planets.length; i++) { - final String planet = (String) (planets[i][0]); - tree.addItem(planet); - - if (planets[i].length == 1) { - // The planet has no moons so make it a leaf. - tree.setChildrenAllowed(planet, false); - } else { - // Add children (moons) under the planets. - for (int j = 1; j < planets[i].length; j++) { - final String moon = (String) planets[i][j]; - - // Add the item as a regular item. - tree.addItem(moon); - - // Set it to be a child. - tree.setParent(moon, planet); - - // Make the moons look like leaves. - tree.setChildrenAllowed(moon, false); - } - - // Expand the subtree. - tree.expandItemsRecursively(planet); - } - } - - // Horizontal layout with the tree on the left and a details panel on - // the right. - final HorizontalLayout horlayout = new HorizontalLayout(); - horlayout.addStyleName("treeexample"); - horlayout.setSizeFull(); - - final Panel treepanel = new Panel("The Planets and Major Moons"); - treepanel.addComponent(tree); - horlayout.addComponent(treepanel); - - final Panel detailspanel = new Panel("Details"); - horlayout.addComponent(detailspanel); - horlayout.setExpandRatio(detailspanel, 1); - - final VerticalLayout detailslayout = new VerticalLayout(); - detailspanel.setLayout(detailslayout); - - // Allow null selection - this is the default actually. - tree.setNullSelectionAllowed(true); - - // When a tree item (planet or moon) is clicked, open the item in - // Details view. - tree.setImmediate(true); - tree.addListener(new ValueChangeListener() { - String lastselected = null; - - public void valueChange(ValueChangeEvent event) { - String planet = (String) tree.getValue(); - - // Reselect a selected item if it is unselected by clicking it. - if (planet == null) { - planet = lastselected; - tree.setValue(planet); - } - lastselected = planet; - - detailspanel.setCaption("Details on " + planet); - detailslayout.removeAllComponents(); - - // Put some stuff in the Details view. - detailslayout.addComponent(new Label("Where is the cat?")); - detailslayout.addComponent(new Label("The cat is in " + planet - + ".")); - - } - }); - - main.setLayout(horlayout); - } - - void example_Select(Window main, String param) { - final HorizontalLayout layout = new HorizontalLayout(); - layout.addStyleName("aligntop"); - - if (param.equals("twincol")) { - final SelectExample select1 = new SelectExample(this, param, - "Select some items", true); - layout.addComponent(select1); - } else if (param.equals("filter")) { - final SelectExample select1 = new SelectExample(this, param, - "Enter containing substring", false); - layout.addComponent(select1); - } else { - final SelectExample select1 = new SelectExample(this, param, - "Single Selection Mode", false); - final SelectExample select2 = new SelectExample(this, param, - "Multiple Selection Mode", true); - layout.addComponent(select1); - layout.addComponent(select2); - } - main.addComponent(layout); - } - - void example_FilterSelect(Window main, String param) { - final Select select = new Select("Enter containing substring"); - main.addComponent(select); - - select - .setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); - - /* Fill the component with some items. */ - final String[] planets = new String[] { "Mercury", "Venus", "Earth", - "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" }; - - for (int i = 0; i < planets.length; i++) { - for (int j = 0; j < planets.length; j++) { - select.addItem(planets[j] + " to " + planets[i]); - } - } - } - - void example_TextField(Window main, String param) { - /* Add a single-line text field. */ - final TextField subject = new TextField("Subject"); - subject.setColumns(40); - main.addComponent(subject); - - /* Add a multi-line text field. */ - final TextField message = new TextField("Message"); - message.setRows(7); - message.setColumns(40); - main.addComponent(message); - } - - void example_TextFieldValidation(Window main, String param) { - // Create a text field with a label - final TextField username = new TextField("Username"); - main.addComponent(username); - - // Set visible length to 16 characters - username.setColumns(16); - - // Set content length to minimum of 6 and maximum of 16 characters. - // The string also may not be null. - username.addValidator(new StringLengthValidator( - "Must be 6 to 16 characters long", 6, 16, false)); - - // Setting component immediate causes a ValueChangeEvent to occur - // when the TextField loses focus. - username.setImmediate(true); - - // Listen for ValueChangeEvents and handle them - username.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - // Get the source of the event - final TextField username = (TextField) (event.getProperty()); - - try { - // Validate the field value. - username.validate(); - } catch (final Validator.InvalidValueException e) { - // The value was not ok. The error was set. - } - } - }); - } - - void example_UserError(final Window main, String param) { - if (param != null) { - if (param.equals("form")) { - - final FormLayout layout = new FormLayout(); - main.addComponent(layout); - - final TextField textfield = new TextField("Enter code"); - layout.addComponent(textfield); - textfield.setComponentError(null); - - final Button button = new Button("Ok!"); - layout.addComponent(button); - - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (((String) textfield.getValue()).length() == 0) { - textfield.setComponentError(new UserError( - "Must be letters and numbers.")); - } else { - textfield.setComponentError(null); - } - } - }); - } - } else { - main.setLayout(new HorizontalLayout()); - - // Create a field. - final TextField textfield = new TextField("Enter code"); - main.addComponent(textfield); - - // Let the component error be initially clear. (It actually is by - // default.) - textfield.setComponentError(null); - - // Have a button right of the field (and align it properly). - final Button button = new Button("Ok!"); - main.addComponent(button); - ((HorizontalLayout) main.getLayout()).setComponentAlignment(button, - HorizontalLayout.ALIGNMENT_LEFT, - HorizontalLayout.ALIGNMENT_BOTTOM); - - // Handle button clicks - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - // If the field value is bad, set its error. - // (Here the content must be only alphanumeric characters.) - if (!((String) textfield.getValue()).matches("^\\w*$")) { - // Put the component in error state and set the error - // message. - textfield.setComponentError(new UserError( - "Must be letters and numbers")); - } else { - // Otherwise clear it. - textfield.setComponentError(null); - } - } - }); - } - } - - void example_DateField(Window main, String param) { - HorizontalLayout layout = new HorizontalLayout(); - - /* Create a DateField with the calendar style. */ - final DateField popupdate = new PopupDateField("Popup calendar field"); - - /* Set resolution of the date/time display. */ - popupdate.setResolution(DateField.RESOLUTION_MIN); - - /* Set the date and time to present. */ - popupdate.setValue(new java.util.Date()); - - /* Create a DateField with the calendar style. */ - final DateField inlinedate = new InlineDateField( - "Inline calendar field"); - - /* Set locale of the DateField to American English. */ - inlinedate.setLocale(new Locale("en", "US")); - - /* Set the date and time to present. */ - inlinedate.setValue(new java.util.Date()); - - /* Set resolution of the date/time display. */ - inlinedate.setResolution(DateField.RESOLUTION_MIN); - - layout.addComponent(popupdate); - layout.addComponent(inlinedate); - layout.setSpacing(true); - main.addComponent(layout); - } - - void example_Validator(Window main, String param) { - if (param != null && param.equals("required")) { - Form form = new Form(); - form.setCaption("My Form"); - form.setRequired(true); - main.addComponent(form); - - TextField text = new TextField("This is a required text field"); - text.setRequired(true); - text.setImmediate(true); - form.getLayout().addComponent(text); - return; - } - main.addComponent(new SSNField()); - } - // TODO add ClientWidget annotation if test is in use - class PagingTable extends Table { - } - - void example_Table(Window main, String param) { - if (param != null) { - if (param.equals("select")) { - main.addComponent(new TableExample2()); - } else if (param.equals("component")) { - main.addComponent(new TableExample3()); - } else if (param.equals("editable")) { - main.addComponent(new TableEditable()); - } else if (param.equals("bean")) { - main.addComponent(new TableEditableBean()); - } else if (param.equals("long")) { - main.addComponent(new TableExample()); - } else if (param.equals("cellstyle")) { - main.addComponent(new TableCellStyle()); - } else if (param.equals("huge")) { - main.addComponent(new TableHuge()); - } else if (param.equals("paging")) { - PagingTable table = new PagingTable(); - table.addContainerProperty("Column 1", String.class, null); - for (int i = 0; i < 100; i++) { - table.addItem(new Object[] { "Item " + i }, new Integer(i)); - } - main.addComponent(table); - } - } else { - main.addComponent(new TableExample1()); - } - } - - void example_Upload(Window main, String param) { - main.addComponent(new MyUploader()); - } - - void example_Link(Window main, String param) { - - /* Create a link that opens the popup window. */ - final Link alink = new Link(); - - /* Set the resource to be opened in the window. */ - alink.setResource(new ExternalResource("http://www.vaadin.com/")); - - main.addComponent(alink); - - final ClassResource mydocument = new ClassResource("mydocument.pdf", - this); - main.addComponent(new Link("The document (pdf)", mydocument)); - main.addComponent(new Link("link to a resource", new ExternalResource( - "http://www.vaadin.com/"))); - } - - void example_Button(Window main, String param) { - if (param != null) { - if (param.equals("buttons")) { - main.addComponent(new TheButton()); - } - return; - } - - // butts1 = new TheButton (); - // main.addComponent(butts1); - - // butts2 = new TheButtons (main); - // butts3 = new TheButtons2 (main); - - // Button checkbox = new Button ("This is a checkbox"); - - // main.addComponent(checkbox); - final Button button = new Button("My Button"); - main.addComponent(button); - } - - void example_CheckBox(Window main, String param) { - /* A check box with default state (not checked, i.e., false). */ - final CheckBox checkbox1 = new CheckBox("My CheckBox"); - checkbox1.addStyleName("mybox"); - main.addComponent(checkbox1); - - /* Another check box with explicitly set checked state. */ - final CheckBox checkbox2 = new CheckBox("Checked CheckBox"); - /* - * @TODO: Build fails here, why? checkbox2.setValue(true); - */ - main.addComponent(checkbox2); - - /* - * Make some application logic. We use anynymous listener classes here. - * The above references were defined as "final" to allow accessing them - * from inside anonymous classes. - */ - checkbox1.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - /* Copy the value to the other checkbox. */ - checkbox2.setValue(checkbox1.getValue()); - } - }); - checkbox2.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - /* Copy the value to the other checkbox. */ - checkbox1.setValue(checkbox2.getValue()); - } - }); - } - - void example_Panel(Window main, String param) { - // Create a panel with a caption. - final Panel panel = new Panel("Contact Information"); - - // Create a layout inside the panel - final FormLayout form = new FormLayout(); - - // Set the layout as the root layout of the panel - panel.setLayout(form); - - // Add some components - form.addComponent(new TextField("Name")); - form.addComponent(new TextField("Email")); - - // Add the panel to the main window - final ClassResource icon = new ClassResource("smiley.jpg", main - .getApplication()); - form.addComponent(new Embedded("Image", icon)); - panel.setIcon(icon); - panel.addComponent(form); - main.addComponent(panel); - } - - void example_GridLayout(Window main, String param) { - if (param.equals("embedded")) { - final GridLayout grid = new GridLayout(3, 3); - for (int i = 0; i < 3 * 3; i++) { - ClassResource img = new ClassResource("smiley.jpg", main - .getApplication()); - Embedded embedded = new Embedded("", img); - grid.addComponent(embedded); - } - main.addComponent(grid); - return; - } - /* Create a 4 by 4 grid layout. */ - final GridLayout grid = new GridLayout(4, 4); - grid.addStyleName("example-gridlayout"); - - /* Fill out the first row using the cursor. */ - grid.addComponent(new Button("R/C 1")); - for (int i = 0; i < 3; i++) { - grid.addComponent(new Button("Col " + (grid.getCursorX() + 1))); - } - - /* Fill out the first column using coordinates. */ - for (int i = 1; i < 4; i++) { - grid.addComponent(new Button("Row " + i), 0, i); - } - - /* Add some components of various shapes. */ - grid.addComponent(new Button("3x1 button"), 1, 1, 3, 1); - grid.addComponent(new Label("1x2 cell"), 1, 2, 1, 3); - final InlineDateField date = new InlineDateField("A 2x2 date field"); - date.setResolution(DateField.RESOLUTION_DAY); - grid.addComponent(date, 2, 2, 3, 3); - - main.addComponent(grid); - } - - void example_Alignment(Window main, String param) { - if (param.equals("grid")) { - /* Create a 3 by 3 grid layout. */ - final GridLayout layout = new GridLayout(3, 3); - // OrderedLayout layout = new - // OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - main.setLayout(layout); - layout.addStyleName("example-alignment"); - - layout.setWidth(400, Sizeable.UNITS_PIXELS); - layout.setHeight(400, Sizeable.UNITS_PIXELS); - - /* Define cells and their layouts to create. */ - - Object cells[][] = { - { new Button("Top Left"), - new Integer(AlignmentHandler.ALIGNMENT_LEFT), - new Integer(AlignmentHandler.ALIGNMENT_TOP) }, - { - new Label("Top Center"), - new Integer( - AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), - new Integer(AlignmentHandler.ALIGNMENT_TOP) }, - { new Label("Top Right"), - new Integer(AlignmentHandler.ALIGNMENT_RIGHT), - new Integer(AlignmentHandler.ALIGNMENT_TOP) }, - { - new Button("Center Left"), - new Integer(AlignmentHandler.ALIGNMENT_LEFT), - new Integer( - AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) }, - { - new Button("Center Center"), - new Integer( - AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), - new Integer( - AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) }, - { - new Button("Center Right"), - new Integer(AlignmentHandler.ALIGNMENT_RIGHT), - new Integer( - AlignmentHandler.ALIGNMENT_VERTICAL_CENTER) }, - { new Button("Bottom Left"), - new Integer(AlignmentHandler.ALIGNMENT_LEFT), - new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) }, - { - new Button("Bottom Center"), - new Integer( - AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER), - new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) }, - { new Button("Bottom Right"), - new Integer(AlignmentHandler.ALIGNMENT_RIGHT), - new Integer(AlignmentHandler.ALIGNMENT_BOTTOM) } }; - - for (int i = 0; i < 9; i++) { - HorizontalLayout celllayout = new HorizontalLayout(); - celllayout.addComponent((Component) cells[i][0]); - if (i == 0) { - celllayout.setExpandRatio((Component) cells[i][0], 1); - } - - celllayout.setComponentAlignment((Component) cells[i][0], - ((Integer) cells[i][1]).intValue(), - ((Integer) cells[i][2]).intValue()); - layout.addComponent(celllayout); - // layout.setComponentAlignment((Component)cells[i][0], - // ((Integer)cells[i][1]).intValue(), - // ((Integer)cells[i][2]).intValue()); - } - } else { - final Panel panel = new Panel("A Panel with a Layout"); - main.addComponent(panel); - - // panel.addComponent(new ) - } - } - - void example_OrderedLayout(Window main, String param) { - final VerticalLayout layout = new VerticalLayout(); - layout.addComponent(new TextField("Name")); - layout.addComponent(new TextField("Street address")); - layout.addComponent(new TextField("Postal code")); - main.addComponent(layout); - } - - void example_FormLayout(Window main, String param) { - final FormLayout layout = new FormLayout(); - layout.addComponent(new TextField("Text Field")); - layout.addComponent(new CheckBox("Check Box")); - layout.addComponent(new Select("Select")); - main.addComponent(layout); - } - - void example_Form(Window main, String param) { - if (param != null && param.equals("simple")) { - main.addComponent(new FormExample2()); - } else if (param != null && param.equals("layout")) { - Form form = new Form(); - form.setCaption("Form Caption"); - form - .setDescription("This is a description of the Form that is " - + "displayed in the upper part of the form. You normally enter some " - + "descriptive text about the form and its use here."); - - // Add a field directly to the layout. This field will not be bound - // to - // the data source Item of the form. - form.getLayout().addComponent(new TextField("A Field")); - - // Add a field and bind it to an named item property. - form.addField("another", new TextField("Another Field")); - - form.setComponentError(new UserError( - "This is the error indicator of the Form.")); - - // Set the footer layout and add some text. - form.setFooter(new VerticalLayout()); - form - .getFooter() - .addComponent( - new Label( - "This is the footer area of the Form. " - + "You can use any layout here. This is nice for buttons.")); - - // Add an Ok (commit), Reset (discard), and Cancel buttons for the - // form. - HorizontalLayout okbar = new HorizontalLayout(); - okbar.setHeight("25px"); - Button okbutton = new Button("OK", form, "commit"); - okbar.addComponent(okbutton); - okbar.setExpandRatio(okbutton, 1); - okbar.setComponentAlignment(okbutton, - AlignmentHandler.ALIGNMENT_RIGHT, - AlignmentHandler.ALIGNMENT_TOP); - okbar.addComponent(new Button("Reset", form, "discard")); - okbar.addComponent(new Button("Cancel")); - form.getFooter().addComponent(okbar); - - main.addComponent(form); - } else { - main.addComponent(new FormExample()); - } - } - - void example_ExpandLayout(Window main, String param) { - if (param != null && param.equals("centered")) { - Label widget = new Label("Here is text"); - - HorizontalLayout layout = new HorizontalLayout(); - layout.addComponent(widget); - layout.setExpandRatio(widget, 1); - layout.setComponentAlignment(widget, - AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, - AlignmentHandler.ALIGNMENT_VERTICAL_CENTER); - layout.setWidth(100, Sizeable.UNITS_PERCENTAGE); - layout.setHeight(100, Sizeable.UNITS_PERCENTAGE); - - main.setLayout(layout); - - return; - } else if (param != null && param.equals("window")) { - Window window = new Window("Progress"); - window.setHeight(100, Sizeable.UNITS_PIXELS); - window.setWidth(200, Sizeable.UNITS_PIXELS); - main.addWindow(window); - - ProgressIndicator progress = new ProgressIndicator(new Float(0.4)); - progress.addStyleName("fullwidth"); - progress.setPollingInterval(1000000); - progress.setIndeterminate(false); - - HorizontalLayout layout = new HorizontalLayout(); - layout.setHeight(100, Sizeable.UNITS_PERCENTAGE); - layout.setComponentAlignment(progress, - HorizontalLayout.ALIGNMENT_HORIZONTAL_CENTER, - HorizontalLayout.ALIGNMENT_VERTICAL_CENTER); - window.setLayout(layout); - window.addComponent(progress); - - return; - } else if (param != null && param.equals("root")) { - final Window mainwin = main; - - // Layout to switch to - final VerticalLayout expand2 = new VerticalLayout(); - expand2.addComponent(new Label("I am layout too.")); - - // Original layout - final VerticalLayout expand1 = new VerticalLayout(); - Button switchButton = new Button("Switch to other layout"); - switchButton.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - mainwin.setLayout(null); - mainwin.setLayout(expand2); - } - }); - expand1.addComponent(switchButton); - main.setLayout(expand1); - - return; - } else if (param != null && param.equals("size")) { - VerticalLayout layout = new VerticalLayout(); - layout.setSizeFull(); - main.setLayout(layout); - - Button button = new Button("This is a button in middle of nowhere"); - layout.addComponent(button); - layout.setComponentAlignment(button, - VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER, - VerticalLayout.ALIGNMENT_VERTICAL_CENTER); - layout.setExpandRatio(button, 1.0f); - return; - } - - for (int w = 0; w < 2; w++) { - final VerticalLayout layout = new VerticalLayout(); - - /* Set the expanding layout as the root layout of a child window. */ - final Window window = new Window("A Child Window", layout); - main.addWindow(window); - - /* Add some component above the expanding one. */ - layout.addComponent(new Label("Here be some component.")); - - /* Create the expanding component. */ - final Table table = new Table("My Ever-Expanding Table"); - /* - * FIXME Java 5 -> 1.4 for (int i=0; i<5; i++) - * table.addContainerProperty("col "+(i+1), Integer.class, 0); for - * (int j=0; j<20; j++) table.addItem(new Object[]{1j,2j,3j,4j,5j}, - * j); - */ - layout.addComponent(table); - - /* Designate the table to be the expanding component. */ - layout.setExpandRatio(table, 1.0f); - - /* Set it to use all available area. */ - table.setSizeFull(); - - /* Add some component below the expanding one. */ - final Button button2 = new Button("Ok"); - layout.addComponent(button2); - layout.setComponentAlignment(button2, - AlignmentHandler.ALIGNMENT_RIGHT, 0); - } - } - - void example_TabSheet(Window main, String param) { - if (param != null) { - if (param.equals("simple")) { - // Create an empty tab sheet. - TabSheet tabsheet = new TabSheet(); - - // Create a component to put in a tab and put - // some content in it. - VerticalLayout myTab = new VerticalLayout(); - myTab.addComponent(new Label("Hello, I am a Tab!")); - - // Add the component to the tab sheet as a new tab. - tabsheet.addTab(myTab); - - // Get the Tab holding the component and set its caption. - tabsheet.getTab(myTab).setCaption("My Tab"); - - } else if (param.equals("icon")) { - final TabSheet tabsheet = new TabSheet(); - - tabsheet.addTab(new Label("Contents of the first tab"), - "First Tab", new ClassResource("images/Mercury_small.png", - main.getApplication())); - tabsheet.addTab(new Label("Contents of the second tab"), - "Second Tab", new ClassResource("images/Venus_small.png", - this)); - tabsheet.addTab(new Label("Contents of the third tab"), - "Third tab", new ClassResource("images/Earth_small.png", - this)); - - main.addComponent(tabsheet); - // main.addComponent(new Embedded("Emb", new ClassResource - // ("images/Mercury_small.png", this))); - } else if (param.equals("expanding")) { - // Create the layout - VerticalLayout layout = new VerticalLayout(); - - // It is important to set the expanding layout as the root layout - // of the containing window, in this case the main window, and not - // use addComponent(), which would place the layout inside the - // default root layout. - main.setLayout(layout); - - // Create a tab sheet that fills the expanding layout - final TabSheet tabsheet = new TabSheet(); - tabsheet.addTab(new Label("Contents of the first tab"), - "First Tab", null); - tabsheet.addTab(new Label("Contents of the second tab"), - "Second Tab", null); - tabsheet.addTab(new Label("Contents of the third tab"), - "Third tab", null); - - // Set the tabsheet to scale to full size inside its container - tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE); - tabsheet.setHeight(100, Sizeable.UNITS_PERCENTAGE); - - // Add the tab sheet to the layout as usual - layout.addComponent(tabsheet); - - // Set the tab sheet to be the expanding component - layout.setExpandRatio(tabsheet, 1); - } else if (param.equals("ordered")) { - // Create the layout - VerticalLayout layout = new VerticalLayout(); - - // It is important to set the expanding layout as the root layout - // of the containing window, in this case the main window, and not - // use addComponent(), which would place the layout inside the - // default root layout. - main.setLayout(layout); - - // Create a tab sheet that fills the expanding layout - final TabSheet tabsheet = new TabSheet(); - tabsheet.addTab(new Label("Contents of the first tab"), - "First Tab", null); - tabsheet.addTab(new Label("Contents of the second tab"), - "Second Tab", null); - tabsheet.addTab(new Label("Contents of the third tab"), - "Third tab", null); - - // Set the tabsheet to scale to full size inside its container - tabsheet.setWidth(100, Sizeable.UNITS_PERCENTAGE); - // tabsheet().setHeight(100, Sizeable.UNITS_PERCENTAGE); - - // Add the tab sheet to the layout as usual - layout.addComponent(tabsheet); - } - } else { - main.addComponent(new TabSheetExample()); - } - } - - void example_Embedded(Window main, String param) { - final Embedded image = new Embedded("", new ClassResource("smiley.jpg", - this)); - image.addStyleName("omaimage"); - main.addComponent(image); - - final EmbeddedButton button = new EmbeddedButton(new ClassResource( - "smiley.jpg", this)); - main.addComponent(button); - } - - void example_Window(Window main, String param) { - if (param != null) { - if (param.equals("opener")) { - main.addComponent(new WindowOpener("Window Opener", main)); - } else if (param.equals("multiple")) { - /* Create a new window. */ - final Window mywindow = new Window("Second Window"); - mywindow.setName("mywindow"); - mywindow.addComponent(new Label("This is a second window.")); - - /* Add the window to the application. */ - main.getApplication().addWindow(mywindow); - - /* Add link to the second window in the main window. */ - main.addComponent(new Label("Second window: <a href='" - + mywindow.getURL() + "'>middle-click to open</a>", - Label.CONTENT_XHTML)); - main.addComponent(new Label( - "The second window can be accessed through URL: " - + mywindow.getURL())); - } - return; - } - - /* Create a new window. */ - final Window mywindow = new Window("My Window"); - mywindow.setName("mywindow"); - - /* Add some components in the window. */ - mywindow.addComponent(new Label("A text label in the window.")); - final Button okbutton = new Button("OK"); - mywindow.addComponent(okbutton); - - /* Set window size. */ - mywindow.setHeight("200px"); - mywindow.setWidth("400px"); - - /* Set window position. */ - mywindow.setPositionX(200); - mywindow.setPositionY(50); - - /* Add the window to the Application object. */ - main.addWindow(mywindow); - - } - - void example_ClassResource(Window main, String param) { - final DateField df = new DateField(); - main.addComponent(df); - df.setIcon(new ClassResource("smiley.jpg", main.getApplication())); - main.addComponent(new Embedded("This is Embedded", new ClassResource( - "smiley.jpg", main.getApplication()))); - } - - void example_ProgressIndicator(final Window main, String param) { - if (param != null) { - if (param.equals("thread")) { - - // Create the indicator - final ProgressIndicator indicator = new ProgressIndicator( - new Float(0.0)); - main.addComponent(indicator); - - // Set polling frequency to 0.5 seconds. - indicator.setPollingInterval(1000); - - // indicator.addStyleName("invisible"); - final Label text = new Label("-- Not running --"); - main.addComponent(text); - - // Add a button to start the progress - final Button button = new Button("Click to start"); - main.addComponent(button); - - // Another thread to do some work - class WorkThread extends Thread { - @Override - public void run() { - double current = 0.0; - while (true) { - // Do some "heavy work" - try { - sleep(50); // Sleep for 50 milliseconds - } catch (InterruptedException e) { - } - - // Grow the progress value until it reaches 1.0. - current += 0.01; - if (current > 1.0) { - indicator.setValue(new Float(1.0)); - } else { - indicator.setValue(new Float(current)); - } - - // After the progress is full for a while, stop. - if (current > 1.2) { - // Restore the state to initial. - indicator.setValue(new Float(0.0)); - button.setVisible(true); - break; - } - } - } - } - - // Clicking the button creates and runs a work thread - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - final WorkThread thread = new WorkThread(); - thread.start(); - - // The button hides until the work is done. - button.setVisible(false); - } - }); - } else if (param.equals("window")) { - // Create a table in the main window to hold items added in the - // second window - final Table table = new Table(); - table.setPageLength(5); - table.setWidth(100, Sizeable.UNITS_PERCENTAGE); - table.addContainerProperty("Name", String.class, ""); - main.addComponent(table); - - // Create the second window - final Window adderWindow = new Window("Add Items"); - adderWindow.setName("win-adder"); - main.getApplication().addWindow(adderWindow); - - // Create selection component to add items to the table - final NativeSelect select = new NativeSelect( - "Select item to add"); - select.setImmediate(true); - adderWindow.addComponent(select); - - // Add some items to the selection - String items[] = new String[] { "-- Select --", "Mercury", - "Venus", "Earth", "Mars", "Jupiter", "Saturn", - "Uranus", "Neptune" }; - for (int i = 0; i < items.length; i++) { - select.addItem(items[i]); - } - select.setNullSelectionItemId(items[0]); - - // When an item is selected in the second window, add - // table in the main window - select.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - // If the selected value is something else but null - // selection item. - if (select.getValue() != null) { - // Add the selected item to the table in the main - // window - table.addItem(new Object[] { select.getValue() }, - new Integer(table.size())); - } - } - }); - - // Link to open the selection window - Link link = new Link("Click to open second window", - new ExternalResource(adderWindow.getURL()), "_new", 50, - 200, Link.TARGET_BORDER_DEFAULT); - main.addComponent(link); - - // Enable polling to update the main window - ProgressIndicator poller = new ProgressIndicator(); - poller.addStyleName("invisible"); - main.addComponent(poller); - } else if (param.equals("centered")) { - /* - * GridLayout grid = new GridLayout(3,3); main.setLayout(grid); - * grid().setWidth(100, Sizeable.UNITS_PERCENTAGE); - * - * ExpandLayout layout2 = new - * ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL); - * layout2().setWidth(50, Sizeable.UNITS_PERCENTAGE); - * - * ProgressIndicator poller = new ProgressIndicator(new - * Float(0.4)); poller.setPollingInterval(1000000); - * poller.setIndeterminate(false); layout2.addComponent(poller); - * - * grid.addComponent(layout2, 1, 1); - */ - - // ExpandLayout layout2 = new - // ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL); - /* - * ProgressIndicator poller = new ProgressIndicator(new - * Float(0.4)); poller.setPollingInterval(1000000); - * poller.setIndeterminate(false); - */ - /* - * layout2.addComponent(poller); layout2().setWidth(50, - * Sizeable.UNITS_PERCENTAGE); - */ - - // layout.setComponentAlignment(poller, - // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, - // AlignmentHandler.ALIGNMENT_VERTICAL_CENTER); - /* - * GridLayout grid = new GridLayout(1,1); - * grid.addComponent(layout2, 0, 0); grid().setWidth(100, - * Sizeable.UNITS_PERCENTAGE); - */ - - /* - * GridLayout layout = new GridLayout(1,1); - * //OrderedLayout.ORIENTATION_HORIZONTAL); - * layout.addComponent(poller); //layout.expand(poller); - * layout.setComponentAlignment(poller, - * AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, - * AlignmentHandler.ALIGNMENT_VERTICAL_CENTER); - * layout().setWidth(100, Sizeable.UNITS_PERCENTAGE); - * layout().setHeight(100, Sizeable.UNITS_PERCENTAGE); - */ - - } - } else { - ProgressIndicator poller = new ProgressIndicator(new Float(0.0)); - poller.setPollingInterval(1000000); - poller.setIndeterminate(true); - main.addComponent(poller); - } - } - - void example_CustomLayout(final Window main, String param) { - Window sub = new Window("Login"); - sub.setModal(true); - main.addWindow(sub); - - // Create the custom layout and set it as the root layout of - // the containing window. - final CustomLayout custom = new CustomLayout("layoutname"); - sub.setLayout(custom); - - // Create components and bind them to the location tags - // in the custom layout. - TextField username = new TextField(); - custom.addComponent(username, "username"); - - TextField password = new TextField(); - custom.addComponent(password, "password"); - - final Button ok = new Button("Login"); - custom.addComponent(ok, "okbutton"); - - final Button deny = new Button("No can do!"); - - Button.ClickListener listener = new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - // Switch between ok and deny - if (custom.getComponent("okbutton") == ok) { - System.out.println("Changing to deny button."); - custom.addComponent(deny, "okbutton"); - } else { - System.out.println("Changing to ok button."); - custom.addComponent(ok, "okbutton"); - } - } - }; - - ok.addListener(listener); - deny.addListener(listener); - } - - void example_Spacing(final Window main, String param) { - VerticalLayout containinglayout = new VerticalLayout(); - main.setLayout(containinglayout); - - GridLayout grid = new GridLayout(4, 3); - grid.addStyleName("spacingexample"); - containinglayout.addComponent(grid); - grid.addComponent(new Label(""), 0, 0); - grid.addComponent(new Label(""), 1, 0); - - grid.addComponent(new Label("No spacing:"), 0, 1); - HorizontalLayout layout1 = new HorizontalLayout(); - grid.addComponent(layout1, 1, 1); - layout1.addStyleName("spacingexample"); - layout1.addComponent(new Button("Component 1")); - layout1.addComponent(new Button("Component 2")); - layout1.addComponent(new Button("Component 3")); - - grid.addComponent(new Label("Horizontal spacing:"), 0, 2); - HorizontalLayout layout2 = new HorizontalLayout(); - grid.addComponent(layout2, 1, 2); - layout2.addStyleName("spacingexample"); - layout2.setSpacing(true); - layout2.addComponent(new Button("Component 1")); - layout2.addComponent(new Button("Component 2")); - layout2.addComponent(new Button("Component 3")); - - grid.addComponent(new Label("No spacing:"), 2, 0); - VerticalLayout layout3 = new VerticalLayout(); - grid.addComponent(layout3, 2, 1, 2, 2); - layout3.addStyleName("spacingexample"); - layout3.addComponent(new Button("Component 1")); - layout3.addComponent(new Button("Component 2")); - layout3.addComponent(new Button("Component 3")); - - grid.addComponent(new Label("Vertical spacing:"), 3, 0); - VerticalLayout layout4 = new VerticalLayout(); - grid.addComponent(layout4, 3, 1, 3, 2); - layout4.addStyleName("spacingexample"); - layout4.setSpacing(true); - layout4.addComponent(new Button("Component 1")); - layout4.addComponent(new Button("Component 2")); - layout4.addComponent(new Button("Component 3")); - } - - void example_Margin(final Window main, String param) { - HorizontalLayout hor = new HorizontalLayout(); - main.setLayout(hor); - - VerticalLayout containinglayout = new VerticalLayout(); - hor.addComponent(containinglayout); - - VerticalLayout layout1 = new VerticalLayout(); - containinglayout.addComponent(new Label("Regular layout margins:")); - containinglayout.addComponent(layout1); - layout1.addStyleName("marginexample1"); - layout1.addComponent(new Button("Component 1")); - layout1.addComponent(new Button("Component 2")); - layout1.addComponent(new Button("Component 3")); - - // Create a layout - VerticalLayout layout2 = new VerticalLayout(); - containinglayout.addComponent(new Label( - "Layout with a special margin element:")); - containinglayout.addComponent(layout2); - - // Set style name for the layout to allow styling it - layout2.addStyleName("marginexample2"); - - // Have margin on all sides around the layout - layout2.setMargin(true); - - // Put something inside the layout - layout2.addComponent(new Button("Component 1")); - layout2.addComponent(new Button("Component 2")); - layout2.addComponent(new Button("Component 3")); - } - - void example_ClientInfo(final Window main, String param) { - // Get the client identification string - WebApplicationContext context2 = (WebApplicationContext) getContext(); - String browserApplication = context2.getBrowser() - .getBrowserApplication(); - - // Add a browser-dependent style name for the main window - if (browserApplication.indexOf("Firefox/2") != -1) { - main.addStyleName("firefox2"); - } - - // Display the client identification string - main.addComponent(new Label(browserApplication)); - } - - void example_FillInForm(final Window main, String param) { - if (param.equals("templates")) { - // Create a custom layout from the fill-in-form.html template. - CustomLayout fillinlayout = new CustomLayout("fill-in-form"); - - // The style will set the display to be "inline". - fillinlayout.addStyleName("fillinlayout"); - - // Create the fields that occur in the text. - TextField field1 = new TextField(); - TextField field2 = new TextField(); - fillinlayout.addComponent(field1, "q1"); - fillinlayout.addComponent(field2, "q2"); - - main.addComponent(fillinlayout); - } else { - String fillintext = "The <q1> is mightier than <q2>."; - int pos = 0; - while (pos < fillintext.length()) { - int nexttag = fillintext.indexOf("<", pos); - if (nexttag == -1) { - - } - } - } - } - - void example_Notification(final Window main, String param) { - // final Window sub1 = new Window(""); - // main.addWindow(sub1); - if (param.equals("example")) { - main.showNotification("This is the caption", - "This is the description"); - return; - } else if (param.equals("type")) { - main.showNotification("This is a warning", - "<br/>This is the <i>last</i> warning", - Window.Notification.TYPE_WARNING_MESSAGE); - return; - } else if (param.equals("pos")) { - // Create a notification with the default settings for a warning. - Window.Notification notif = new Window.Notification("Be warned!", - "This message lurks in the top-left corner!", - Window.Notification.TYPE_WARNING_MESSAGE); - - // Set the position. - notif.setPosition(Window.Notification.POSITION_TOP_LEFT); - - // Let it stay there until the user clicks it - notif.setDelayMsec(-1); - - // Show it in the main window. - main.showNotification(notif); - return; - } - - main.setLayout(new HorizontalLayout()); - - final Integer type_humanized = Window.Notification.TYPE_HUMANIZED_MESSAGE; - final Integer type_warning = Window.Notification.TYPE_WARNING_MESSAGE; - final Integer type_error = Window.Notification.TYPE_ERROR_MESSAGE; - final Integer type_tray = Window.Notification.TYPE_TRAY_NOTIFICATION; - final NativeSelect types = new NativeSelect(); - main.addComponent(types); - types.addItem(type_humanized); - types.addItem(type_warning); - types.addItem(type_error); - types.addItem(type_tray); - types.setItemCaption(type_humanized, "Humanized"); - types.setItemCaption(type_warning, "Warning"); - types.setItemCaption(type_error, "Error"); - types.setItemCaption(type_tray, "Tray"); - - Button show = new Button("Show Notification"); - main.addComponent(show); - - show.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - String caption = ""; - String description = ""; - switch (((Integer) types.getValue()).intValue()) { - case Window.Notification.TYPE_HUMANIZED_MESSAGE: - caption = "Humanized message"; - description = "<br/>For minimal annoyance"; - break; - case Window.Notification.TYPE_WARNING_MESSAGE: - caption = "Warning message"; - description = "<br/>For notifications of medium importance"; - break; - case Window.Notification.TYPE_ERROR_MESSAGE: - caption = "Error message"; - description = "<br/>For important notifications"; - break; - case Window.Notification.TYPE_TRAY_NOTIFICATION: - caption = "Tray notification"; - description = "<br/>Stays up longer - but away"; - } - // main.showNotification("The default notification"); - Window.Notification notif = new Window.Notification(caption, - description, (Integer) types.getValue()); - // notif.setPosition(Window.Notification.POSITION_TOP_LEFT); - notif.setDelayMsec(-1); - main.showNotification(notif); - } - }); - - // Notification notif = new Notification("Title"); - } - - void example_Print(final Window main, String param) { - if (param != null && param.equals("simple")) { - main - .addComponent(new Label( - "<input type='button' onClick='print()' value='Click to Print'/>", - Label.CONTENT_XHTML)); - return; - } - - // A button to open the printer-friendly page. - Button printButton = new Button("Click to Print"); - main.addComponent(printButton); - printButton.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - // Create a window that contains stuff you want to print. - Window printWindow = new Window("Window to Print"); - - // Have some content to print. - printWindow.addComponent(new Label( - "Here's some dynamic content.")); - - // To execute the print() JavaScript, we need to run it - // from a custom layout. - CustomLayout scriptLayout = new CustomLayout("printpage"); - printWindow.addComponent(scriptLayout); - - // Add the printing window as an application-level window. - main.getApplication().addWindow(printWindow); - - // Open the printing window as a new browser window - main.open(new ExternalResource(printWindow.getURL()), "_new"); - } - }); - - // main.addComponent(new - // Label("<p>Print this!</p>\n<script type='text/javascript'>print();</script>", - // Label.CONTENT_XHTML)); - } - - void example_RichTextArea(final Window main, String param) { - main.setLayout(new HorizontalLayout()); - - // Create a rich text area - final RichTextArea rtarea = new RichTextArea(); - rtarea.addStyleName("richtextexample"); - // rtarea.setCaption("My Rich Text Area"); - - // Set initial content as HTML - rtarea - .setValue("<h1>Hello</h1>\n<p>This rich text area contains some text.</p>"); - - // Show the text edited in the rich text area as HTML. - final Button show = new Button("Show HTML"); - final Label html = new Label((String) rtarea.getValue()); - show.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - html.setValue(rtarea.getValue()); - } - }); - - Panel rtPanel = new Panel("Rich Text Area"); - rtPanel.addComponent(rtarea); - rtPanel.addComponent(show); - - Panel valuePanel = new Panel("Value"); - valuePanel.addComponent(html); - - main.addComponent(rtPanel); - main.addComponent(valuePanel); - } - - void example_QueryContainer(final Window main, String param) { - try { - // Create a database connection - Class.forName("org.hsqldb.jdbcDriver"); - final Connection connection = DriverManager.getConnection( - "jdbc:hsqldb:mem:qcexample", "sa", ""); - - // Create an example table and put some data in it. - Statement st = connection.createStatement(); - st - .executeQuery("CREATE TABLE Prisoners (id INTEGER, name VARCHAR)"); - st.close(); - for (int i = 0; i < 100; i++) { - st = connection.createStatement(); - st.executeQuery("INSERT INTO Prisoners (id, name) VALUES (" + i - + ",'I am number " + (i + 1) + "')"); - st.close(); - } - - // Query the database - final QueryContainer qc = new QueryContainer( - "SELECT id,name FROM Prisoners", connection); - - // Create a component for selecting a query result item. - Select select = new Select("Select an item"); - - // The items shown in the selection component are obtained from the - // query. - select.setContainerDataSource(qc); - - // The item captions are obtained from a field in the query result. - select.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); - - // Set the name of the field from which the item captions are - // obtained. - select.setItemCaptionPropertyId("name"); - - // When selection changes, display the selected item. - select.setImmediate(true); - final Label selection = new Label("Currently selected: -"); - select.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - // Get the item id of the currently selected item - Integer itemId = (Integer) event.getProperty().getValue(); - - // Use the item ID to get the actual row from the query - // result. - Item qrItem = qc.getItem(itemId); - - // Display the item ID - selection.setValue("Currently selected: result row " - + itemId.intValue() + " (id=" - + qrItem.getItemProperty("id") + ", " + "name=" - + qrItem.getItemProperty("name") + ")"); - } - }); - - main.addComponent(select); - main.addComponent(selection); - } catch (SQLException e) { - e.printStackTrace(); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - } - - void example_MenuBar(final Window main, String param) { - // Create a menu bar - final MenuBar menubar = new MenuBar(); - main.addComponent(menubar); - - // A feedback component - final Label selection = new Label(""); - main.addComponent(selection); - - // Define a common menu command for all the menu items. - MenuBar.Command mycommand = new MenuBar.Command() { - public void menuSelected(MenuItem selectedItem) { - selection.setValue("Ordered a " + selectedItem.getText() - + " from menu."); - } - }; - - // Put some items in the menu hierarchically - MenuBar.MenuItem beverages = menubar.addItem("Beverages", null, null); - MenuBar.MenuItem hot_beverages = beverages.addItem("Hot", null, null); - hot_beverages.addItem("Tea", null, mycommand); - hot_beverages.addItem("Coffee", null, mycommand); - MenuBar.MenuItem cold_beverages = beverages.addItem("Cold", null, null); - cold_beverages.addItem("Milk", null, mycommand); - - // Another top-level item - MenuBar.MenuItem snacks = menubar.addItem("Snacks", null, null); - snacks.addItem("Weisswurst", null, mycommand); - snacks.addItem("Salami", null, mycommand); - - // Yet another top-level item - MenuBar.MenuItem services = menubar.addItem("Services", null, null); - services.addItem("Car Service", null, mycommand); - } - - void example_AbsoluteLayout(final Window main, String param) { - AbsoluteLayout layout = new AbsoluteLayout(); - layout.setWidth("400px"); - layout.setHeight("400px"); - main.setContent(layout); - - final Button button = new Button ("This could be anywhere"); - layout.addComponent(button, "top: 100px; left: 50px;"); - } - - void example_Layout(final Window main, String param) { - if (param.equals("intro")) { - // Set the root layout (VerticalLayout is actually the default). - VerticalLayout root = new VerticalLayout(); - main.setContent(root); - - // Add some components. - Label title = new Label("The Ultimate Cat Finder"); - main.addComponent(title); - - // Horizontal layout with selection tree on the left and - // a details panel on the right. - HorizontalLayout horlayout = new HorizontalLayout(); - main.addComponent(horlayout); - - // Layout for the left-hand side - VerticalLayout treeContainer = new VerticalLayout(); - horlayout.addComponent(treeContainer); - - // Add some instructions. - treeContainer.addComponent(new Label("The Planets and Major Moons")); - - // A selection tree, fill it later. - Tree tree = new Tree(); - treeContainer.addComponent(tree); - - // A panel for the right size area. - Panel detailspanel = new Panel("Details"); - detailspanel.setSizeFull(); - horlayout.addComponent(detailspanel); - - // Have a vertical layout in the Details panel. - VerticalLayout detailslayout = new VerticalLayout(); - detailspanel.setContent(detailslayout); - - // Put some stuff in the Details view. - detailslayout.addComponent(new Label("Where is the cat?")); - detailslayout.addComponent(new Label("I don't know!")); - - // // // // // // - - horlayout.setExpandRatio(detailspanel, 1); - horlayout.setExpandRatio(treeContainer, 0); - horlayout.setSizeFull(); - horlayout.setSpacing(true); - - root.addStyleName("layoutexample"); - root.setSizeFull(); - root.setExpandRatio(horlayout, 1); - - title.addStyleName("title"); - tree.setSizeUndefined(); - tree.setHeight("100%"); - treeContainer.addStyleName("treecontainer"); - treeContainer.setSizeUndefined(); - treeContainer.setHeight("100%"); - treeContainer.setExpandRatio(tree, 1); - detailspanel.addStyleName("light"); - - for (Iterator i = detailslayout.getComponentIterator(); i.hasNext();) { - Label c = (Label)i.next(); - detailslayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER); - c.setSizeUndefined(); - } - - final Object[][] planets = new Object[][] { - new Object[] { "Mercury" }, - new Object[] { "Venus" }, - new Object[] { "Earth", "The Moon" }, - new Object[] { "Mars", "Phobos", "Deimos" }, - new Object[] { "Jupiter", "Io", "Europa", "Ganymedes", - "Callisto" }, - new Object[] { "Saturn", "Titan", "Tethys", "Dione", "Rhea", - "Iapetus" }, - new Object[] { "Uranus", "Miranda", "Ariel", "Umbriel", - "Titania", "Oberon" }, - new Object[] { "Neptune", "Triton", "Proteus", "Nereid", - "Larissa" } }; - - // Add planets as root items in the tree. - for (int i = 0; i < planets.length; i++) { - final String planet = (String) (planets[i][0]); - tree.addItem(planet); - - if (planets[i].length == 1) { - // The planet has no moons so make it a leaf. - tree.setChildrenAllowed(planet, false); - } else { - // Add children (moons) under the planets. - for (int j = 1; j < planets[i].length; j++) { - final String moon = (String) planets[i][j]; - - // Add the item as a regular item. - tree.addItem(moon); - - // Set it to be a child. - tree.setParent(moon, planet); - - // Make the moons look like leaves. - tree.setChildrenAllowed(moon, false); - } - - // Expand the subtree. - tree.expandItemsRecursively(planet); - } - } - - - } - } -} diff --git a/src/com/vaadin/tests/book/ChatApplication.java b/src/com/vaadin/tests/book/ChatApplication.java deleted file mode 100644 index a70d9d450f..0000000000 --- a/src/com/vaadin/tests/book/ChatApplication.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.vaadin.tests.book; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class ChatApplication extends Application implements - Button.ClickListener { - /* - * ChatApplication instances of different users. Warning: a hack, not safe, - * because sessions can expire. - */ - static List users = new ArrayList(); - - /* Messages as a shared list. */ - static List messages = new ArrayList(); - int localSize = 0; - - /* User interface. */ - Table messageTable = new Table(); - TextField username = new TextField("Username:"); - TextField message = new TextField("Message:"); - - @Override - public void init() { - final Window main = new Window("Chat"); - setMainWindow(main); - setTheme("tests-magi"); - users.add(this); - - main.addComponent(username); - - main.addComponent(messageTable); - messageTable.addContainerProperty("Sender", String.class, ""); - messageTable.addContainerProperty("Message", String.class, ""); - updateTable(); - - main.addComponent(message); - - Button send = new Button("Send"); - send.addListener(this); - main.addComponent(send); - - // Poll for new messages once a second. - ProgressIndicator poller = new ProgressIndicator(); - poller.addStyleName("invisible"); - main.addComponent(poller); - } - - public void buttonClick(ClickEvent event) { - synchronized (users) { - // Create the new message in the shared list. - messages.add(new String[] { - new String((String) username.getValue()), - new String((String) message.getValue()) }); - - // Update the message tables for all users. - for (Iterator i = users.iterator(); i.hasNext();) { - ((ChatApplication) i.next()).updateTable(); - } - } - } - - void updateTable() { - if (localSize == messages.size()) { - return; // No updating needed - } - - // Add new messages to the table - while (localSize < messages.size()) { - messageTable.addItem((Object[]) messages.get(localSize++), - new Integer(localSize - 1)); - } - } -} diff --git a/src/com/vaadin/tests/book/DefaultButtonExample.java b/src/com/vaadin/tests/book/DefaultButtonExample.java deleted file mode 100644 index c3d96f1d16..0000000000 --- a/src/com/vaadin/tests/book/DefaultButtonExample.java +++ /dev/null @@ -1,94 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.event.Action; -import com.vaadin.event.ShortcutAction; -import com.vaadin.event.Action.Handler; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TextField; - -public class DefaultButtonExample extends CustomComponent implements Handler { - // Define and create user interface components - Panel panel = new Panel("Login"); - FormLayout formlayout = new FormLayout(); - TextField username = new TextField("Username"); - TextField password = new TextField("Password"); - HorizontalLayout buttons = new HorizontalLayout(); - - // Create buttons and define their listener methods. - Button ok = new Button("OK", this, "okHandler"); - Button cancel = new Button("Cancel", this, "cancelHandler"); - - // Have the unmodified Enter key cause an event - Action action_ok = new ShortcutAction("Default key", - ShortcutAction.KeyCode.ENTER, null); - - // Have the C key modified with Alt cause an event - Action action_cancel = new ShortcutAction("Alt+C", - ShortcutAction.KeyCode.C, - new int[] { ShortcutAction.ModifierKey.ALT }); - - public DefaultButtonExample() { - // Set up the user interface - setCompositionRoot(panel); - panel.addComponent(formlayout); - formlayout.addComponent(username); - formlayout.addComponent(password); - formlayout.addComponent(buttons); - buttons.addComponent(ok); - buttons.addComponent(cancel); - - // Set focus to username - username.focus(); - - // Set this object as the action handler - System.out.println("adding ah"); - panel.addActionHandler(this); - - System.out.println("start done."); - } - - /** - * Retrieve actions for a specific component. This method will be called for - * each object that has a handler; in this example just for login panel. The - * returned action list might as well be static list. - */ - public Action[] getActions(Object target, Object sender) { - System.out.println("getActions()"); - return new Action[] { action_ok, action_cancel }; - } - - /** - * Handle actions received from keyboard. This simply directs the actions to - * the same listener methods that are called with ButtonClick events. - */ - public void handleAction(Action action, Object sender, Object target) { - if (action == action_ok) { - okHandler(); - } - if (action == action_cancel) { - cancelHandler(); - } - } - - public void okHandler() { - // Do something: report the click - formlayout.addComponent(new Label("OK clicked. " + "User=" - + username.getValue() + ", password=" + password.getValue())); - // - } - - public void cancelHandler() { - // Do something: report the click - formlayout.addComponent(new Label("Cancel clicked. User=" - + username.getValue() + ", password=" + password.getValue())); - } -} diff --git a/src/com/vaadin/tests/book/EmbeddedButton.java b/src/com/vaadin/tests/book/EmbeddedButton.java deleted file mode 100644 index 2ed67f0305..0000000000 --- a/src/com/vaadin/tests/book/EmbeddedButton.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.terminal.Resource; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; - -public class EmbeddedButton extends CustomComponent implements - Button.ClickListener { - Button thebutton; - - public EmbeddedButton(Resource icon) { - /* Create a Button without a caption. */ - thebutton = new Button(); - - /* Set the icon of the button from a resource. */ - thebutton.setIcon(icon); - - /* - * Set the style to link; this leaves out the button frame so you just - * have the image in the link. - */ - thebutton.setStyle("link"); - - /* Listen for ClickEvents. */ - thebutton.addListener(this); - - setCompositionRoot(thebutton); - } - - /** Handle button click events from the button. */ - public void buttonClick(Button.ClickEvent event) { - thebutton.setIcon(null); - thebutton.setCaption("You successfully clicked on the icon"); - } -} diff --git a/src/com/vaadin/tests/book/FormExample.java b/src/com/vaadin/tests/book/FormExample.java deleted file mode 100644 index bd6cfc0e98..0000000000 --- a/src/com/vaadin/tests/book/FormExample.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.vaadin.tests.book; - -import java.util.Vector; - -import com.vaadin.data.Container; -import com.vaadin.data.Item; -import com.vaadin.data.Property; -import com.vaadin.data.Validator; -import com.vaadin.data.util.BeanItem; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Field; -import com.vaadin.ui.FieldFactory; -import com.vaadin.ui.Form; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; - -/** - * This example demonstrates the most important features of the Form component: - * binding Form to a JavaBean so that form fields are automatically generated - * from the bean properties, creation of fields with proper types for each bean - * properly using a FieldFactory, buffering (commit/discard), and validation. - * - * The Form is used with a FormLayout, which automatically lays the components - * out in a format typical for forms. - */ -public class FormExample extends CustomComponent { - /** Contact information data model. */ - public class Contact { - String name = ""; - String address = ""; - int postalCode = 20540; - String city; - } - - /** Bean wrapper for the data model. */ - public class ContactBean extends Contact { - public ContactBean() { - } - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getAddress() { - return address; - } - - public void setPostalCode(String postalCode) { - try { - if (postalCode != null) { - this.postalCode = Integer.parseInt(postalCode); - } else { - this.postalCode = 0; - } - } catch (NumberFormatException e) { - this.postalCode = 0; - } - } - - public String getPostalCode() { - if (postalCode > 0) { - return String.valueOf(postalCode); - } else { - return ""; - } - } - - public void setCity(String city) { - this.city = city; - } - - public String getCity() { - return city; - } - } - - /** - * Factory to create the proper type of field for each property type. We - * need to implement just one of the factory methods. - */ - class MyFieldFactory implements FieldFactory { - - public Field createField(Class type, Component uiContext) { - return null; - } - - public Field createField(Property property, Component uiContext) { - return null; - } - - public Field createField(Item item, Object propertyId, - Component uiContext) { - String pid = (String) propertyId; - - if (pid.equals("name")) { - return new TextField("Name"); - } - - if (pid.equals("address")) { - return new TextField("Street Address"); - } - - if (pid.equals("postalCode")) { - TextField field = new TextField("Postal Code"); - field.setColumns(5); - Validator postalCodeValidator = new Validator() { - - public boolean isValid(Object value) { - if (value == null || !(value instanceof String)) { - return false; - } - - return ((String) value).matches("[0-9]{5}"); - } - - public void validate(Object value) - throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException( - "Postal code must be a number 10000-99999."); - } - } - }; - field.addValidator(postalCodeValidator); - return field; - } - - if (pid.equals("city")) { - Select select = new Select("City"); - final String cities[] = new String[] { "Amsterdam", "Berlin", - "Helsinki", "Hong Kong", "London", "Luxemburg", - "New York", "Oslo", "Paris", "Rome", "Stockholm", - "Tokyo", "Turku" }; - for (int i = 0; i < cities.length; i++) { - select.addItem(cities[i]); - } - return select; - } - return null; - } - - public Field createField(Container container, Object itemId, - Object propertyId, Component uiContext) { - return null; - } - } - - public FormExample() { - // Create a form. It will use FormLayout as its layout by default. - final Form form = new Form(); - - // Set form caption and description texts. - form.setCaption("Contact Information"); - form - .setDescription("Please enter valid name and address. Fields marked with * are required."); - - // Use custom field factory to create the fields in the form. - form.setFieldFactory(new MyFieldFactory()); - - // Create the custom bean. - ContactBean bean = new ContactBean(); - - // Create a bean item that is bound to the bean. - BeanItem item = new BeanItem(bean); - - // Bind the bean item as the data source for the form. - form.setItemDataSource(item); - - // Set the order of the items in the form. - Vector order = new Vector(); - order.add("name"); - order.add("address"); - order.add("postalCode"); - order.add("city"); - form.setVisibleItemProperties(order); - - // Set required fields. The required error is displayed in - // the error indication are of the Form if a required - // field is empty. If it is not set, no error is displayed - // about an empty required field. - form.getField("name").setRequired(true); - form.getField("name").setRequiredError("Name is missing"); - form.getField("address").setRequired(true); // No error message - - // Set the form to act immediately on user input. This is - // necessary for the validation of the fields to occur immediately when - // the input focus changes and not just on commit. - form.setImmediate(true); - - // Set buffering so that commit() must be called for the form - // before input is written to the data. (Input is not written - // immediately through). - form.setWriteThrough(false); - form.setReadThrough(false); - - // Add Commit and Discard controls to the form. - ExpandLayout footer = new ExpandLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - - // The Commit button calls form.commit(). - Button commit = new Button("Commit", form, "commit"); - - // The Discard button calls form.discard(). - Button discard = new Button("Discard", form, "discard"); - footer.addComponent(commit); - footer.setComponentAlignment(commit, ExpandLayout.ALIGNMENT_RIGHT, - ExpandLayout.ALIGNMENT_TOP); - footer.setHeight("25px"); - footer.addComponent(discard); - form.setFooter(footer); - - OrderedLayout root = new OrderedLayout(); - root.setWidth(400, OrderedLayout.UNITS_PIXELS); - root.addComponent(form); - setCompositionRoot(root); - } -} diff --git a/src/com/vaadin/tests/book/FormExample2.java b/src/com/vaadin/tests/book/FormExample2.java deleted file mode 100644 index 2e7e09bdb2..0000000000 --- a/src/com/vaadin/tests/book/FormExample2.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.vaadin.tests.book; - -import java.util.Vector; - -import com.vaadin.data.Container; -import com.vaadin.data.Item; -import com.vaadin.data.Property; -import com.vaadin.data.util.BeanItem; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Field; -import com.vaadin.ui.FieldFactory; -import com.vaadin.ui.Form; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; - -/** - * This example demonstrates the most important features of the Form component: - * binding Form to a JavaBean so that form fields are automatically generated - * from the bean properties, creation of fields with proper types for each bean - * properly using a FieldFactory, buffering (commit/discard), and validation. - * - * The Form is used with a FormLayout, which automatically lays the components - * out in a format typical for forms. - */ -public class FormExample2 extends CustomComponent { - /** A simple JavaBean. */ - public class PersonBean { - String name = ""; - String city = ""; - - public void setName(String name) { - this.name = name; - } - - public String getName() { - return name; - } - - public void setCity(String city) { - this.city = city; - } - - public String getCity() { - return city; - } - } - - /** - * Factory to create the proper type of field for each property type. We - * need to implement just one of the factory methods. - */ - class MyFieldFactory implements FieldFactory { - - public Field createField(Class type, Component uiContext) { - return null; - } - - public Field createField(Property property, Component uiContext) { - return null; - } - - public Field createField(Item item, Object propertyId, - Component uiContext) { - String pid = (String) propertyId; - if (pid.equals("name")) { - return new TextField("Name"); - } else if (pid.equals("city")) { - Select select = new Select("City"); - select.addItem("Berlin"); - select.addItem("Helsinki"); - select.addItem("London"); - select.addItem("New York"); - select.addItem("Turku"); - select.setNewItemsAllowed(true); - return select; - } - return null; - } - - public Field createField(Container container, Object itemId, - Object propertyId, Component uiContext) { - return null; - } - } - - public FormExample2() { - // Create a form and use FormLayout as its layout. - final Form form = new Form(); - - // Set form caption and description texts - form.setCaption("Contact Information"); - form - .setDescription("Please specify name of the person and the city where the person lives in."); - - // Use the custom field factory to create the fields in the form. - form.setFieldFactory(new MyFieldFactory()); - - // Create the custom bean. - PersonBean bean = new PersonBean(); - - // Create a bean item that is bound to the bean. - BeanItem item = new BeanItem(bean); - - // Bind the bean item as the data source for the form. - form.setItemDataSource(item); - - // Set the order of the items in the form. - Vector order = new Vector(); - order.add("name"); - order.add("city"); - form.setVisibleItemProperties(order); - - form.getField("name").setRequired(true); - form.getField("name").setRequiredError("You must enter a name."); - form.getField("city").setRequired(true); - - OrderedLayout root = new OrderedLayout(); - root.setWidth(300, OrderedLayout.UNITS_PIXELS); - root.addComponent(form); - setCompositionRoot(root); - } -} diff --git a/src/com/vaadin/tests/book/MyDynamicResource.java b/src/com/vaadin/tests/book/MyDynamicResource.java deleted file mode 100644 index 9948bfe731..0000000000 --- a/src/com/vaadin/tests/book/MyDynamicResource.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.vaadin.tests.book; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.net.URL; -import java.util.Map; - -import javax.imageio.ImageIO; - -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.ParameterHandler; -import com.vaadin.terminal.URIHandler; - -/** - * Demonstrates handling URI parameters and the URI itself to create a dynamic - * resource. - */ -public class MyDynamicResource implements URIHandler, ParameterHandler { - String textToDisplay = "- no text given -"; - - /** - * Handle the URL parameters and store them for the URI handler to use. - */ - public void handleParameters(Map parameters) { - // Get and store the passed HTTP parameter. - if (parameters.containsKey("text")) { - textToDisplay = ((String[]) parameters.get("text"))[0]; - } - } - - /** - * Provides the dynamic resource if the URI matches the resource URI. The - * matching URI is "/myresource" under the application URI context. - * - * Returns null if the URI does not match. Otherwise returns a download - * stream that contains the response from the server. - */ - public DownloadStream handleURI(URL context, String relativeUri) { - // Catch the given URI that identifies the resource, otherwise let other - // URI handlers or the Application to handle the response. - if (!relativeUri.startsWith("myresource")) { - return null; - } - - // Create an image and draw some background on it. - BufferedImage image = new BufferedImage(200, 200, - BufferedImage.TYPE_INT_RGB); - Graphics drawable = image.getGraphics(); - drawable.setColor(Color.lightGray); - drawable.fillRect(0, 0, 200, 200); - drawable.setColor(Color.yellow); - drawable.fillOval(25, 25, 150, 150); - drawable.setColor(Color.blue); - drawable.drawRect(0, 0, 199, 199); - - // Use the parameter to create dynamic content. - drawable.setColor(Color.black); - drawable.drawString("Text: " + textToDisplay, 75, 100); - - try { - // Write the image to a buffer. - ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream(); - ImageIO.write(image, "png", imagebuffer); - - // Return a stream from the buffer. - ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer - .toByteArray()); - return new DownloadStream(istream, null, null); - } catch (IOException e) { - return null; - } - } -} diff --git a/src/com/vaadin/tests/book/MyUploader.java b/src/com/vaadin/tests/book/MyUploader.java deleted file mode 100644 index cc953e79cf..0000000000 --- a/src/com/vaadin/tests/book/MyUploader.java +++ /dev/null @@ -1,81 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.OutputStream; - -import com.vaadin.terminal.FileResource; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Upload; - -public class MyUploader extends CustomComponent implements - Upload.SucceededListener, Upload.FailedListener, Upload.Receiver { - Panel root; // Root element for contained components. - Panel imagePanel; // Panel that contains the uploaded image. - File file; // File to write to. - - MyUploader() { - root = new Panel("My Upload Component"); - setCompositionRoot(root); - - // Create the Upload component. - final Upload upload = new Upload("Upload the file here", this); - upload.setButtonCaption("Upload Now"); - - // Listen for Upload.SucceededEvent and FailedEvent events. - upload.addListener((Upload.SucceededListener) this); - upload.addListener((Upload.FailedListener) this); - - root.addComponent(upload); - root.addComponent(new Label( - "Click 'Browse' to select a file and then click 'Upload'.")); - - // Create a panel for displaying the uploaded file (image). - imagePanel = new Panel("Uploaded image"); - imagePanel.addComponent(new Label("No image uploaded yet")); - root.addComponent(imagePanel); - } - - // Callback method to begin receiving the upload. - public OutputStream receiveUpload(String filename, String MIMEType) { - FileOutputStream fos = null; // Output stream to write to. - file = new File("/tmp/uploads/" + filename); - try { - // Open the file for writing. - fos = new FileOutputStream(file); - } catch (final java.io.FileNotFoundException e) { - // Error while opening the file. Not reported here. - e.printStackTrace(); - return null; - } - - return fos; // Return the output stream to write to - } - - // This is called if the upload is finished successfully. - public void uploadSucceeded(Upload.SucceededEvent event) { - // Log the upload on screen. - root.addComponent(new Label("File " + event.getFilename() - + " of type '" + event.getMIMEType() + "' uploaded.")); - - // Display the uploaded file in the image panel. - final FileResource imageResource = new FileResource(file, - getApplication()); - imagePanel.removeAllComponents(); - imagePanel.addComponent(new Embedded("", imageResource)); - } - - // This is called if the upload fails. - public void uploadFailed(Upload.FailedEvent event) { - // Log the failure on screen. - root.addComponent(new Label("Uploading " + event.getFilename() - + " of type '" + event.getMIMEType() + "' failed.")); - } -} diff --git a/src/com/vaadin/tests/book/SSNField.java b/src/com/vaadin/tests/book/SSNField.java deleted file mode 100644 index aab6206b4b..0000000000 --- a/src/com/vaadin/tests/book/SSNField.java +++ /dev/null @@ -1,98 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.data.Property; -import com.vaadin.data.Validator; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; - -/* Finnish Social Security Number input field that validates the value. */ -public class SSNField extends CustomComponent implements - Property.ValueChangeListener { - OrderedLayout layout = new FormLayout(); - // new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); //;new - // FormLayout(); - TextField myfield; - Label myerror; - - /** Validator for Finnish Social Security Number. */ - class SSNValidator implements Validator { - - /** The isValid() is simply a wrapper for the validate() method. */ - public boolean isValid(Object value) { - try { - validate(value); - } catch (final InvalidValueException e) { - return false; - } - return true; - } - - /** Validate the given SSN. */ - public void validate(Object value) throws InvalidValueException { - final String ssn = (String) value; - if (ssn.length() == 0) { - return; - } - - if (ssn.length() != 11) { - throw new InvalidValueException("Invalid SSN length"); - } - - final String numbers = ssn.substring(0, 6) + ssn.substring(7, 10); - final int checksum = new Integer(numbers).intValue() % 31; - if (!ssn.substring(10).equals( - "0123456789ABCDEFHJKLMNPRSTUVWXY".substring(checksum, - checksum + 1))) { - throw new InvalidValueException("Invalid SSN checksum"); - } - } - } - - SSNField() { - setCompositionRoot(layout); - layout.setOrientation(FormLayout.ORIENTATION_VERTICAL); - - /* Create the text field for the SSN. */ - myfield = new TextField("Social Security Number"); - myfield.setColumns(11); - - /* Create and set the validator object for the field. */ - myfield.addValidator(new SSNValidator()); - - /* - * ValueChageEvent will be generated immediately when the component - * loses focus. - */ - myfield.setImmediate(true); - - /* Listen for ValueChangeEvent events. */ - myfield.addListener(this); - - layout.addComponent(myfield); - - /* The field will have an error label, normally invisible. */ - myerror = new Label(); - layout.addComponent(myerror); - } - - public void valueChange(ValueChangeEvent event) { - try { - /* Validate the field value. */ - myfield.validate(); - - /* The value was correct. */ - myerror.setValue("Ok"); - } catch (final Validator.InvalidValueException e) { - /* Report the error message to the user. */ - myerror.setValue(e.getMessage()); - } - } -} diff --git a/src/com/vaadin/tests/book/SelectExample.java b/src/com/vaadin/tests/book/SelectExample.java deleted file mode 100644 index f301e85c3f..0000000000 --- a/src/com/vaadin/tests/book/SelectExample.java +++ /dev/null @@ -1,119 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.ui.AbstractSelect; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.TwinColSelect; - -/* Let us add an implementation of the ValueChangeListener interface. */ -public class SelectExample extends CustomComponent implements - Property.ValueChangeListener { - - class Planet extends Object { - String planetName; - - Planet(String name) { - planetName = name; - } - - @Override - public String toString() { - return "The Planet " + planetName; - } - } - - /* Create the Select object with a caption. */ - AbstractSelect select; - - OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - Label status = new Label(""); - - SelectExample(Application application, String param, String caption, - boolean multiselect) { - if (param.equals("optiongroup")) { - select = new OptionGroup(caption); - select.setMultiSelect(multiselect); - } else if (param.equals("twincol")) { - select = new TwinColSelect(caption); - } else if (param.equals("native")) { - select = new NativeSelect(caption); - } else if (param.equals("filter")) { - select = new Select(caption); - ((Select) select) - .setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS); - } else { - select = new Select(caption); - select.setMultiSelect(multiselect); - } - - layout.addComponent(select); - setCompositionRoot(layout); - - /* Fill the component with some items. */ - final String[] planets = new String[] { "Mercury", "Venus", "Earth", - "Mars", "Jupiter", "Saturn", "Uranus", "Neptune" }; - - for (int i = 0; i < planets.length; i++) { - select.addItem(planets[i]); - - /* Create an item with an Integer as the Item ID. */ - // select.addItem(i); - // select.addItem(new Planet(planets[i])); - /* Set the visible caption of the item. */ - // select.setItemCaption(i, planets[i]); - /* - * ClassResource icon = new ClassResource - * ("images/"+planets[i]+"_symbol.png", application); - * layout.addComponent(new Embedded ("Icon", icon)); - * select.setItemIcon(i, icon); - */ - } - - /* - * By default, the change event is not triggered immediately when the - * selection changes. This enables it. - */ - select.setImmediate(true); - - /* Listen for changes in the selection. */ - select.addListener(this); - - // select.setStyle("twincol"); - // select.setMultiSelect(true); - // select.setNewItemsAllowed(true); - // int a=1; - - // select.setItemCaptionMode(Select.ITEM_CAPTION_MODE_ICON_ONLY); - // select.setNullSelectionItemId("-- select somethingd --"); - // select.setNullSelectionAllowed(false); - - layout.addComponent(status); - } - - /* Respond to change in the selection. */ - public void valueChange(Property.ValueChangeEvent event) { - /* - * The event.getProperty() returns the component. The currently selected - * item is the property of the component, retrievable with getValue(). - */ - if (false) { - status.setValue("Currently selected item ID: " - + event.getProperty().getValue() + "<br/>" - + "Class of the Item ID: " - + event.getProperty().getValue().getClass().getName() - + "<br/>" + "Caption: " - + select.getItemCaption(event.getProperty().getValue())); - status.setContentMode(Label.CONTENT_XHTML); - } - } -} diff --git a/src/com/vaadin/tests/book/TabSheetExample.java b/src/com/vaadin/tests/book/TabSheetExample.java deleted file mode 100644 index 9bc3c79823..0000000000 --- a/src/com/vaadin/tests/book/TabSheetExample.java +++ /dev/null @@ -1,70 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; - -public class TabSheetExample extends CustomComponent implements - Button.ClickListener, TabSheet.SelectedTabChangeListener { - TabSheet tabsheet = new TabSheet(); - Button tab1 = new Button("Push this button"); - Label tab2 = new Label("Contents of Second Tab"); - Label tab3 = new Label("Contents of Third Tab"); - - TabSheetExample() { - setCompositionRoot(tabsheet); - - // Listen for changes in tab selection. - tabsheet.addListener(this); - - // First tab contains a button, for which we - // listen button click events. - tab1.addListener(this); - - // This will cause a selectedTabChange() call. - tabsheet.addTab(tab1, "First Tab", null); - - // A tab that is initially invisible. - tabsheet.addTab(tab2, "Second Tab", null); - tabsheet.getTab(tab2).setVisible(false); - - // A tab that is initially disabled. - tabsheet.addTab(tab3, "Third tab", null); - tabsheet.getTab(tab3).setEnabled(false); - } - - public void buttonClick(ClickEvent event) { - // Enable the invisible and disabled tabs. - tabsheet.getTab(tab2).setVisible(true); - tabsheet.getTab(tab3).setEnabled(true); - - // Change selection automatically to second tab. - tabsheet.setSelectedTab(tab2); - } - - public void selectedTabChange(SelectedTabChangeEvent event) { - // Cast to a TabSheet. This isn't really necessary in - // this example, as we have only one TabSheet component, - // but would be useful if there were multiple TabSheets. - final TabSheet source = (TabSheet) event.getSource(); - - if (source == tabsheet) { - // If the first tab was selected. - if (source.getSelectedTab() == tab1) { - // The 2. and 3. tabs may not have been set yet. - if (tabsheet.getTab(tab2) != null - && tabsheet.getTab(tab3) != null) { - tabsheet.getTab(tab2).setVisible(false); - tabsheet.getTab(tab3).setEnabled(false); - } - } - } - } -} diff --git a/src/com/vaadin/tests/book/TableCellStyle.java b/src/com/vaadin/tests/book/TableCellStyle.java deleted file mode 100644 index 6f66653d79..0000000000 --- a/src/com/vaadin/tests/book/TableCellStyle.java +++ /dev/null @@ -1,62 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Table; - -public class TableCellStyle extends CustomComponent { - public TableCellStyle() { - Table table = new Table("Table with Cell Styles"); - table.addStyleName("checkerboard"); - - // Add some columns in the table. In this example, the property IDs - // of the container are integers so we can determine the column number - // easily. - table.addContainerProperty("0", String.class, null, "", null, null); // Row - // header - for (int i = 0; i < 8; i++) { - table.addContainerProperty("" + (i + 1), String.class, null, String - .valueOf((char) (65 + i)), null, null); - } - - // Add some items in the table. - table.addItem(new Object[] { "1", "R", "N", "B", "Q", "K", "B", "N", - "R" }, new Integer(0)); - table.addItem(new Object[] { "2", "P", "P", "P", "P", "P", "P", "P", - "P" }, new Integer(1)); - for (int i = 2; i < 6; i++) { - table.addItem(new Object[] { String.valueOf(i + 1), "", "", "", "", - "", "", "", "" }, new Integer(i)); - } - table.addItem(new Object[] { "7", "P", "P", "P", "P", "P", "P", "P", - "P" }, new Integer(6)); - table.addItem(new Object[] { "8", "R", "N", "B", "Q", "K", "B", "N", - "R" }, new Integer(7)); - table.setPageLength(8); - - // Set cell style generator - table.setCellStyleGenerator(new Table.CellStyleGenerator() { - public String getStyle(Object itemId, Object propertyId) { - int row = ((Integer) itemId).intValue(); - int col = Integer.parseInt((String) propertyId); - - // The first column. - if (col == 0) { - return "rowheader"; - } - - // Other cells. - if ((row + col) % 2 == 1) { - return "black"; - } else { - return "white"; - } - } - }); - - setCompositionRoot(table); - } -} diff --git a/src/com/vaadin/tests/book/TableEditable.java b/src/com/vaadin/tests/book/TableEditable.java deleted file mode 100644 index 78a4b808bd..0000000000 --- a/src/com/vaadin/tests/book/TableEditable.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; - -public class TableEditable extends CustomComponent { - /* A layout needed for the example. */ - OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - - TableEditable() { - setCompositionRoot(layout); - - // Create a table. It is by default not editable. - final Table table = new Table(); - - // Define the names and data types of columns. - table.addContainerProperty("Date", Date.class, null); - table.addContainerProperty("Work", Boolean.class, null); - table.addContainerProperty("Comments", String.class, null); - - // Add a few items in the table. - for (int i = 0; i < 100; i++) { - Calendar calendar = new GregorianCalendar(2008, 0, 1); - calendar.add(Calendar.DAY_OF_YEAR, i); - - // Create the table row. - table.addItem(new Object[] { calendar.getTime(), - new Boolean(false), "" }, new Integer(i)); // Item - // identifier - } - - table.setPageLength(8); - layout.addComponent(table); - - final CheckBox switchEditable = new CheckBox("Editable"); - switchEditable.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - table.setEditable(((Boolean) event.getProperty().getValue()) - .booleanValue()); - } - }); - switchEditable.setImmediate(true); - layout.addComponent(switchEditable); - } -} diff --git a/src/com/vaadin/tests/book/TableEditableBean.java b/src/com/vaadin/tests/book/TableEditableBean.java deleted file mode 100644 index 847ff3e935..0000000000 --- a/src/com/vaadin/tests/book/TableEditableBean.java +++ /dev/null @@ -1,242 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import java.util.Collection; -import java.util.Vector; - -import com.vaadin.data.Container; -import com.vaadin.data.Item; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.util.BeanItem; -import com.vaadin.ui.AbstractField; -import com.vaadin.ui.BaseFieldFactory; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Field; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; - -/** - * Shows how to bind a bean to a table and make it editable. - */ -public class TableEditableBean extends CustomComponent { - /** - * Let's have a simple example bean. - */ - public class MyBean { - boolean selected; - String text; - - public MyBean() { - selected = false; - text = ""; - } - - public boolean isSelected() { - System.out.println("isSelected() called: " + selected); - return selected; - } - - public void setSelected(boolean selected) { - this.selected = selected; - System.out.println("setSelected1(" + selected + ") called."); - } - - public String getText() { - System.out.println("getText() called: " + text); - return text; - } - - public void setText(String text) { - this.text = text; - System.out.println("setText(" + text + ") called."); - } - }; - - /** - * Custom field factory that sets the fields as immediate for debugging - * purposes. This is not normally necessary, unless you want to have some - * interaction that requires it. - */ - public class MyFieldFactory extends BaseFieldFactory { - @Override - public Field createField(Class type, Component uiContext) { - // Let the BaseFieldFactory create the fields - Field field = super.createField(type, uiContext); - - // ...and just set them as immediate - ((AbstractField) field).setImmediate(true); - - return field; - } - } - - /** - * This is a custom container that allows adding BeanItems inside it. The - * BeanItem objects must be bound to a MyBean object. The item ID is an - * Integer from 0 to 99. - * - * Most of the interface methods are implemented with just dummy - * implementations, as they are not needed in this example. - */ - public class MyContainer implements Container { - Item[] items; - int current = 0; - - public MyContainer() { - items = new Item[100]; // Yeah this is just a test - } - - public boolean addContainerProperty(Object propertyId, Class type, - Object defaultValue) throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public Item addItem(Object itemId) throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public Object addItem() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - /** - * This addItem method is specific for this container and allows adding - * BeanItem objects. The BeanItems must be bound to MyBean objects. - */ - public void addItem(BeanItem item) throws UnsupportedOperationException { - items[current++] = item; - } - - public boolean containsId(Object itemId) { - if (itemId instanceof Integer) { - int pos = ((Integer) itemId).intValue(); - if (pos >= 0 && pos < 100) { - return items[pos] != null; - } - } - return false; - } - - /** - * The Table will call this method to get the property objects for the - * columns. It uses the property objects to determine the data types of - * the columns. - */ - public Property getContainerProperty(Object itemId, Object propertyId) { - if (itemId instanceof Integer) { - int pos = ((Integer) itemId).intValue(); - if (pos >= 0 && pos < 100) { - Item item = items[pos]; - - // The BeanItem provides the property objects for the items. - return item.getItemProperty(propertyId); - } - } - return null; - } - - /** Table calls this to get the column names. */ - public Collection getContainerPropertyIds() { - // This container can contain only BeanItems bound to MyBeans. - Item item = new BeanItem(new MyBean()); - - // The BeanItem knows how to get the property names from the bean. - return item.getItemPropertyIds(); - } - - public Item getItem(Object itemId) { - if (itemId instanceof Integer) { - int pos = ((Integer) itemId).intValue(); - if (pos >= 0 && pos < 100) { - return items[pos]; - } - } - return null; - } - - public Collection getItemIds() { - Vector ids = new Vector(); - for (int i = 0; i < 100; i++) { - ids.add(Integer.valueOf(i)); - } - return ids; - } - - public Class getType(Object propertyId) { - return BeanItem.class; - } - - public boolean removeAllItems() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public boolean removeContainerProperty(Object propertyId) - throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public boolean removeItem(Object itemId) - throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public int size() { - return current; - } - - } - - TableEditableBean() { - /* A layout needed for the example. */ - OrderedLayout layout = new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL); - setCompositionRoot(layout); - - // Create a table. It is by default not editable. - final Table table = new Table(); - layout.addComponent(table); - table.setPageLength(8); - - // Use the custom container as the data source - MyContainer myContainer = new MyContainer(); - table.setContainerDataSource(myContainer); - - // Add a few items in the table. - for (int i = 0; i < 5; i++) { - // Create the bean - MyBean item = new MyBean(); - item.setText("MyBean " + i); - - // Have an Item that is bound to the bean - BeanItem bitem = new BeanItem(item); - - // Add the item directly to the container using the custom addItem() - // method. We could otherwise add it to the Table as well, but - // the Container interface of Table does not allow adding items - // as such, just item IDs. - myContainer.addItem(bitem); - } - - // Use custom field factory that sets the checkboxes in immediate mode. - // This is just for debugging purposes and is not normally necessary. - table.setFieldFactory(new MyFieldFactory()); - - // Have a check box to switch the table between normal and editable - // mode. - final CheckBox switchEditable = new CheckBox("Editable"); - switchEditable.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - table.setEditable(((Boolean) event.getProperty().getValue()) - .booleanValue()); - } - }); - switchEditable.setImmediate(true); - layout.addComponent(switchEditable); - } -} diff --git a/src/com/vaadin/tests/book/TableExample.java b/src/com/vaadin/tests/book/TableExample.java deleted file mode 100644 index a2cbaa45c2..0000000000 --- a/src/com/vaadin/tests/book/TableExample.java +++ /dev/null @@ -1,78 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; - -public class TableExample extends CustomComponent { - /* Create the table with a caption. */ - Table table = new Table("This is my Table"); - - /* A layout needed for the example. */ - OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - - /* Feedback for selecting items from the table. */ - Label current = new Label("Selected: -"); - - TableExample() { - setCompositionRoot(layout); - layout.addComponent(table); - - /* Define the names, data types, and default values of columns. */ - table.addContainerProperty("First Name", String.class, - "(no first name)"); - table.addContainerProperty("Last Name", String.class, "(no last name)"); - table.addContainerProperty("Year", Integer.class, null); - - /* We use these entries to generate random items in a table. */ - final String[] firstnames = new String[] { "Donald", "Patty", "Sally", - "Douglas" }; - final String[] lastnames = new String[] { "Smith", "Jones", "Adams", - "Knuth" }; - - /* Add some items in the table and assign them an Item ID (IID). */ - for (int i = 0; i < 1000; i++) { - /* Add a randomly generated item in the Table. */ - table - .addItem( - new Object[] { - firstnames[(int) (Math.random() * (firstnames.length - 0.01))], - lastnames[(int) (Math.random() * (lastnames.length - 0.01))], - new Integer( - (int) (1900 + Math.random() * 100)) }, - new Integer(i)); - } - - /* Set the number of items visible in the table. */ - table.setPageLength(10); - - /* Enable some UI features for the table. */ - table.setColumnReorderingAllowed(true); - table.setColumnCollapsingAllowed(true); - - /* Allow selecting items from the table. */ - table.setSelectable(true); - - /* - * When an item is selected, the selection is sent immediately to - * server. - */ - table.setImmediate(true); - - /* Handle selection change. */ - table.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - current.setValue("Selected: " + table.getValue().toString()); - } - }); - - layout.addComponent(current); - } -} diff --git a/src/com/vaadin/tests/book/TableExample1.java b/src/com/vaadin/tests/book/TableExample1.java deleted file mode 100644 index 62b189f4ff..0000000000 --- a/src/com/vaadin/tests/book/TableExample1.java +++ /dev/null @@ -1,48 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; - -public class TableExample1 extends CustomComponent { - /* A layout needed for the example. */ - OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - - TableExample1() { - setCompositionRoot(layout); - - /* Create the table with a caption. */ - Table table = new Table("This is my Table"); - - /* - * Define the names and data types of columns. The "default value" - * parameter is meaningless here. - */ - table.addContainerProperty("First Name", String.class, null); - table.addContainerProperty("Last Name", String.class, null); - table.addContainerProperty("Year", Integer.class, null); - - /* Add a few items in the table. */ - table.addItem(new Object[] { "Nicolaus", "Copernicus", - new Integer(1473) }, new Integer(1)); - table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) }, - new Integer(2)); - table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) }, - new Integer(3)); - table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) }, - new Integer(4)); - table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) }, - new Integer(5)); - table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) }, - new Integer(6)); - - /* Set number of visible rows. */ - table.setPageLength(5); - - layout.addComponent(table); - } -} diff --git a/src/com/vaadin/tests/book/TableExample2.java b/src/com/vaadin/tests/book/TableExample2.java deleted file mode 100644 index b2d8b2bc45..0000000000 --- a/src/com/vaadin/tests/book/TableExample2.java +++ /dev/null @@ -1,73 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; - -public class TableExample2 extends CustomComponent { - /* A layout needed for the example. */ - OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - - TableExample2() { - setCompositionRoot(layout); - - /* Create the table with a caption. */ - final Table table = new Table(); - - /* - * Define the names and data types of columns. The "default value" - * parameter is meaningless here. - */ - table.addContainerProperty("First Name", String.class, null); - table.addContainerProperty("Last Name", String.class, null); - table.addContainerProperty("Year", Integer.class, null); - - /* Add a few items in the table. */ - table.addItem(new Object[] { "Nicolaus", "Copernicus", - new Integer(1473) }, new Integer(1)); - table.addItem(new Object[] { "Tycho", "Brahe", new Integer(1546) }, - new Integer(2)); - table.addItem(new Object[] { "Giordano", "Bruno", new Integer(1548) }, - new Integer(3)); - table.addItem(new Object[] { "Galileo", "Galilei", new Integer(1564) }, - new Integer(4)); - table.addItem(new Object[] { "Johannes", "Kepler", new Integer(1571) }, - new Integer(5)); - table.addItem(new Object[] { "Isaac", "Newton", new Integer(1643) }, - new Integer(6)); - - /* Set number of visible rows. */ - table.setPageLength(5); - - /* Allow selecting items from the table. */ - table.setSelectable(true); - - /* - * When an item is selected, the selection is sent immediately to - * server. - */ - table.setImmediate(true); - - /* Feedback from selection. */ - final Label current = new Label("Selected: -"); - - /* Handle selection change. */ - table.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - current.setValue("Selected: " + table.getValue()); - } - }); - - table.setNullSelectionAllowed(false); - - layout.addComponent(table); - layout.addComponent(current); - } -} diff --git a/src/com/vaadin/tests/book/TableExample3.java b/src/com/vaadin/tests/book/TableExample3.java deleted file mode 100644 index 92ef890c33..0000000000 --- a/src/com/vaadin/tests/book/TableExample3.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; - -public class TableExample3 extends CustomComponent { - /* A layout needed for the example. */ - OrderedLayout layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - - TableExample3() { - setCompositionRoot(layout); - - // Create a table and add a style to allow setting the row height in - // theme. - final Table table = new Table(); - table.addStyleName("components-inside"); - - /* - * Define the names and data types of columns. The "default value" - * parameter is meaningless here. - */ - table.addContainerProperty("Sum", Label.class, null); - table.addContainerProperty("Is Transferred", CheckBox.class, null); - table.addContainerProperty("Comments", TextField.class, null); - table.addContainerProperty("Details", Button.class, null); - - /* Add a few items in the table. */ - for (int i = 0; i < 100; i++) { - // Create the fields for the current table row - Label sumField = new Label(String.format( - "Sum is <b>$%04.2f</b><br/><i>(VAT incl.)</i>", - new Object[] { new Double(Math.random() * 1000) }), - Label.CONTENT_XHTML); - CheckBox transferredField = new CheckBox("is transferred"); - - // Multiline text field. This required modifying the height of the - // table row. - TextField commentsField = new TextField(); - commentsField.setRows(3); - - // The Table item identifier for the row. - Integer itemId = new Integer(i); - - // Create a button and handle its click. A Button does not know - // the item it is contained in, so we have to store the item - // ID as user-defined data. - Button detailsField = new Button("show details"); - detailsField.setData(itemId); - detailsField.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - // Get the item identifier from the user-defined data. - Integer itemId = (Integer) event.getButton().getData(); - getWindow().showNotification( - "Link " + itemId.intValue() + " clicked."); - } - }); - detailsField.addStyleName("link"); - - // Create the table row. - table.addItem(new Object[] { sumField, transferredField, - commentsField, detailsField }, itemId); - } - - // Show just three rows because they are so high. - table.setPageLength(3); - - // Initially show the 50th item in the top of the table. - table.setCurrentPageFirstItemIndex(50); - // table.setCurrentPageFirstItemId(initial); - - layout.addComponent(table); - } -} diff --git a/src/com/vaadin/tests/book/TableHuge.java b/src/com/vaadin/tests/book/TableHuge.java deleted file mode 100644 index b3828a5a3b..0000000000 --- a/src/com/vaadin/tests/book/TableHuge.java +++ /dev/null @@ -1,197 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import java.util.Collection; -import java.util.Vector; - -import com.vaadin.data.Container; -import com.vaadin.data.Item; -import com.vaadin.data.Property; -import com.vaadin.data.Container.Indexed; -import com.vaadin.data.util.BeanItem; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.data.util.PropertysetItem; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Table; - -public class TableHuge extends CustomComponent { - - /** - * This is a virtual container that generates the items on the fly when - * requested. - */ - public class HugeContainer implements Container, Indexed { - int numberofitems; - - public HugeContainer(int numberofitems) { - this.numberofitems = numberofitems; - } - - public boolean addContainerProperty(Object propertyId, Class type, - Object defaultValue) throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public Item addItem(Object itemId) throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public Object addItem() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - /** - * This addItem method is specific for this container and allows adding - * BeanItem objects. The BeanItems must be bound to MyBean objects. - */ - public void addItem(BeanItem item) throws UnsupportedOperationException { - } - - public boolean containsId(Object itemId) { - if (itemId instanceof Integer) { - int pos = ((Integer) itemId).intValue(); - if (pos >= 0 && pos < numberofitems) { - return true; - } - } - return false; - } - - /** - * The Table will call this method to get the property objects for the - * columns. It uses the property objects to determine the data types of - * the columns. - */ - public Property getContainerProperty(Object itemId, Object propertyId) { - if (itemId instanceof Integer) { - int pos = ((Integer) itemId).intValue(); - if (pos >= 0 && pos < numberofitems) { - return new ObjectProperty("This is the item " + pos - + " in the huge table"); - } - } - return null; - } - - /** Table calls this to get the column names. */ - public Collection getContainerPropertyIds() { - Vector ids = new Vector(); - ids.add("id"); - return ids; - } - - public Item getItem(Object itemId) { - if (itemId instanceof Integer) { - int pos = ((Integer) itemId).intValue(); - if (pos >= 0 && pos < numberofitems) { - Item item = new PropertysetItem(); - item.addItemProperty("id", new ObjectProperty( - "This is the item " + pos + " in the huge table")); - return item; - } - } - return null; - } - - public Collection getItemIds() { - System.out.println("We can't do this."); - return null; - } - - public Class getType(Object propertyId) { - return PropertysetItem.class; - } - - public boolean removeAllItems() throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public boolean removeContainerProperty(Object propertyId) - throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public boolean removeItem(Object itemId) - throws UnsupportedOperationException { - throw new UnsupportedOperationException(); - } - - public int size() { - return numberofitems; - } - - public Object addItemAt(int index) throws UnsupportedOperationException { - // TODO Auto-generated method stub - return null; - } - - public Item addItemAt(int index, Object newItemId) - throws UnsupportedOperationException { - // TODO Auto-generated method stub - return null; - } - - public Object getIdByIndex(int index) { - return Integer.valueOf(index); - } - - public int indexOfId(Object itemId) { - return ((Integer) itemId).intValue(); - } - - public Object addItemAfter(Object previousItemId) - throws UnsupportedOperationException { - // TODO Auto-generated method stub - return null; - } - - public Item addItemAfter(Object previousItemId, Object newItemId) - throws UnsupportedOperationException { - // TODO Auto-generated method stub - return null; - } - - public Object firstItemId() { - return new Integer(0); - } - - public boolean isFirstId(Object itemId) { - return ((Integer) itemId).intValue() == 0; - } - - public boolean isLastId(Object itemId) { - return ((Integer) itemId).intValue() == (numberofitems - 1); - } - - public Object lastItemId() { - return new Integer(numberofitems - 1); - } - - public Object nextItemId(Object itemId) { - int pos = indexOfId(itemId); - if (pos >= numberofitems - 1) { - return null; - } - return getIdByIndex(pos + 1); - } - - public Object prevItemId(Object itemId) { - int pos = indexOfId(itemId); - if (pos <= 0) { - return null; - } - return getIdByIndex(pos - 1); - } - } - - public TableHuge() { - Table table = new Table("HUGE table, REALLY HUGE"); - table.setContainerDataSource(new HugeContainer(500000)); - table.setPageLength(20); - - setCompositionRoot(table); - } -} diff --git a/src/com/vaadin/tests/book/TheButton.java b/src/com/vaadin/tests/book/TheButton.java deleted file mode 100644 index 716aaa64d7..0000000000 --- a/src/com/vaadin/tests/book/TheButton.java +++ /dev/null @@ -1,27 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; - -public class TheButton extends CustomComponent implements Button.ClickListener { - Button thebutton; - - public TheButton() { - /* Create a Button with the given caption. */ - thebutton = new Button("Do not push this button"); - - /* Listen for ClickEvents. */ - thebutton.addListener(this); - - setCompositionRoot(thebutton); - } - - /** Handle button click events from the button. */ - public void buttonClick(Button.ClickEvent event) { - thebutton.setCaption("Do not push this button again"); - } -} diff --git a/src/com/vaadin/tests/book/TheButtons.java b/src/com/vaadin/tests/book/TheButtons.java deleted file mode 100644 index ed7ef00cc4..0000000000 --- a/src/com/vaadin/tests/book/TheButtons.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.AbstractComponentContainer; -import com.vaadin.ui.Button; - -public class TheButtons implements Button.ClickListener { - Button thebutton; - Button secondbutton; - - /** Creates two buttons into given container. */ - public TheButtons(AbstractComponentContainer container) { - thebutton = new Button("Do not push this button"); - thebutton.addListener(this); - container.addComponent(thebutton); - - secondbutton = new Button("I am a button too"); - secondbutton.addListener(this); - container.addComponent(secondbutton); - } - - /** Handle button click events from the two buttons. */ - public void buttonClick(Button.ClickEvent event) { - if (event.getButton() == thebutton) { - thebutton.setCaption("Do not push this button again"); - } else if (event.getButton() == secondbutton) { - secondbutton.setCaption("I am not a number"); - } - } -} diff --git a/src/com/vaadin/tests/book/TheButtons2.java b/src/com/vaadin/tests/book/TheButtons2.java deleted file mode 100644 index c96ed51773..0000000000 --- a/src/com/vaadin/tests/book/TheButtons2.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.AbstractComponentContainer; -import com.vaadin.ui.Button; - -public class TheButtons2 { - Button thebutton; - Button secondbutton; - - /** Creates two buttons in given container. */ - public TheButtons2(AbstractComponentContainer container) { - thebutton = new Button("Do not push this button"); - thebutton.addListener(Button.ClickEvent.class, this, "theButtonClick"); - container.addComponent(thebutton); - - secondbutton = new Button("I am a button too"); - secondbutton.addListener(Button.ClickEvent.class, this, - "secondButtonClick"); - container.addComponent(secondbutton); - } - - public void theButtonClick(Button.ClickEvent event) { - thebutton.setCaption("Do not push this button again"); - } - - public void secondButtonClick(Button.ClickEvent event) { - secondbutton.setCaption("I am not a number!"); - } -} diff --git a/src/com/vaadin/tests/book/TheButtons3.java b/src/com/vaadin/tests/book/TheButtons3.java deleted file mode 100644 index 9b77e7855a..0000000000 --- a/src/com/vaadin/tests/book/TheButtons3.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.AbstractComponentContainer; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; - -/** This example demonstrates the use of inline classes for event listeners. */ -public class TheButtons3 { - Button thebutton; /* This component is stored as a member variable. */ - - /** Creates two buttons in given container. */ - public TheButtons3(AbstractComponentContainer container) { - thebutton = new Button("Do not push this button"); - thebutton.addListener(new Button.ClickListener() { - /* - * Define the method in the local class to handle the click. - */ - public void buttonClick(ClickEvent event) { - thebutton.setCaption("Do not push this button again"); - } - }); - container.addComponent(thebutton); - - /* - * Have the second button as a local variable in the constructor. Only - * "final" local variables can be accessed from an anonymous class. - */ - final Button secondbutton = new Button("I am a button too"); - secondbutton.addListener(new Button.ClickListener() { - /* - * Define the method in the local class to handle the click. - */ - public void buttonClick(ClickEvent event) { - secondbutton.setCaption("I am not a number!"); - } - }); - container.addComponent(secondbutton); - } -} diff --git a/src/com/vaadin/tests/book/WindowOpener.java b/src/com/vaadin/tests/book/WindowOpener.java deleted file mode 100644 index f159c48b30..0000000000 --- a/src/com/vaadin/tests/book/WindowOpener.java +++ /dev/null @@ -1,80 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.book; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Label; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.CloseEvent; - -/** Component contains a button that allows opening a window. */ -public class WindowOpener extends CustomComponent implements - Window.CloseListener { - Window mainwindow; // Reference to main window - Window mywindow; // The window to be opened - Button openbutton; // Button for opening the window - Button closebutton; // A button in the window - Label explanation; // A descriptive text - - public WindowOpener(String label, Window main) { - mainwindow = main; - - /* The component consists of a button that opens the window. */ - final VerticalLayout layout = new VerticalLayout(); - - openbutton = new Button("Open Window", this, "openButtonClick"); - explanation = new Label("Explanation"); - layout.addComponent(openbutton); - layout.addComponent(explanation); - - setCompositionRoot(layout); - } - - /** Handle the clicks for the two buttons. */ - public void openButtonClick(Button.ClickEvent event) { - /* Create a new window. */ - mywindow = new Window("My Dialog"); - mywindow.setPositionX(200); - mywindow.setPositionY(100); - mywindow.getLayout().setSizeUndefined(); - - /* Add the window inside the main window. */ - mainwindow.addWindow(mywindow); - - /* Listen for close events for the window. */ - mywindow.addListener(this); - - /* Add components in the window. */ - mywindow.addComponent(new Label("A text label in the window.")); - closebutton = new Button("Close", this, "closeButtonClick"); - mywindow.addComponent(closebutton); - - /* Allow opening only one window at a time. */ - openbutton.setEnabled(false); - - explanation.setValue("Window opened"); - } - - /** Handle Close button click and close the window. */ - public void closeButtonClick(Button.ClickEvent event) { - /* Windows are managed by the application object. */ - mainwindow.removeWindow(mywindow); - - /* Return to initial state. */ - openbutton.setEnabled(true); - - explanation.setValue("Closed with button"); - } - - /** In case the window is closed otherwise. */ - public void windowClose(CloseEvent e) { - /* Return to initial state. */ - openbutton.setEnabled(true); - - explanation.setValue("Closed with window controls"); - } -} diff --git a/src/com/vaadin/tests/book/WindowTestApplication.java b/src/com/vaadin/tests/book/WindowTestApplication.java deleted file mode 100644 index 4e80122b96..0000000000 --- a/src/com/vaadin/tests/book/WindowTestApplication.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.vaadin.tests.book; - -import java.util.HashMap; - -import com.vaadin.Application; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.CloseEvent; - -public class WindowTestApplication extends Application { - Window anotherpage = null; - - // Storage for extra window objects - there could be many. - HashMap windows = new HashMap(); - - /* - * (non-Javadoc) - * - * @see com.vaadin.Application#init() - */ - @Override - public void init() { - final Window main = new Window("Window Test Application"); - setMainWindow(main); - setTheme("tests-book"); - - /* Create a new window. */ - final Window mywindow = new Window("Second Window"); - - /* Manually set the name of the window. */ - mywindow.setName("mywindow"); - - /* Add some content to the window. */ - mywindow.addComponent(new Label("This is a second window.")); - - /* Add the window to the application. */ - addWindow(mywindow); - - // /* Add a button to open a new window. */ - // main.addComponent(new Button("Click to open new window", - // new Button.ClickListener() { - // public void buttonClick(ClickEvent event) { - // // Open the window. - // main.open(new ExternalResource(mywindow.getURL()), - // "_new"); - // } - // })); - // - // /* Add a link to the second window. */ - // Link link = new Link("Click to open second window", - // new ExternalResource(mywindow.getURL())); - // link.setTargetName("_new"); - // main.addComponent(link); - // - // // Add the link manually inside a Label. - // main.addComponent(new Label("Second window: <a href='" - // + mywindow.getURL() + "' target='_new'>click to open</a>", - // Label.CONTENT_XHTML)); - // main.addComponent(new Label( - // "The second window can be accessed through URL: " - // + mywindow.getURL())); - - // Add links to windows that do not yet exist, but are created - // dynamically when the URL is called. - - main.addComponent(new Label("Click a link to open a new window:")); - - // Have some IDs for the separate windows. - final String[] items = new String[] { "mercury", "venus", "earth", - "mars", "jupiter", "saturn", "uranus", "neptune" }; - - // Create a list of links to each of the available window. - for (int i = 0; i < items.length; i++) { - // Create a URL for the window. - String windowUrl = getURL() + "planet-" + items[i]; - - // Create a link to the window URL. - // Using the window ID for the target also opens it in a new - // browser window (or tab). - main.addComponent(new Link("Open window about " + items[i], - new ExternalResource(windowUrl), items[i], -1, -1, - Window.BORDER_DEFAULT)); - } - } - - @Override - /* - * This method is called for every client request for this application. It - * needs to return the correct window for the given identifier. - */ - public Window getWindow(String name) { - // If a dynamically created window is requested, but it does - // not exist yet, create it. - if (name.startsWith("planet-") && super.getWindow(name) == null) { - System.out.println("New window " + name); - - String planetName = name.substring("planet-".length()); - - // Create the window object. - Window newWindow = new Window("Window about " + planetName); - - // We must set this explicitly or otherwise an automatically - // generated name is used. - newWindow.setName(name); - - // Put some content in it. - newWindow.addComponent(new Label( - "This window contains details about " + planetName + ".")); - - // Add it to the application as a regular application-level window. - addWindow(newWindow); - - newWindow.addListener(new Window.CloseListener() { - public void windowClose(CloseEvent e) { - System.out.println(e.getWindow().getName() + " was closed"); - getMainWindow().addComponent( - new Label("Window '" + e.getWindow().getName() - + "' was closed.")); - } - }); - - return newWindow; - } - - // Otherwise the Application object manages existing windows by their - // name. - return super.getWindow(name); - } -} diff --git a/src/com/vaadin/tests/book/images/Earth_small.png b/src/com/vaadin/tests/book/images/Earth_small.png Binary files differdeleted file mode 100644 index abe9227914..0000000000 --- a/src/com/vaadin/tests/book/images/Earth_small.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Earth_symbol.png b/src/com/vaadin/tests/book/images/Earth_symbol.png Binary files differdeleted file mode 100644 index 6060358883..0000000000 --- a/src/com/vaadin/tests/book/images/Earth_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Jupiter_symbol.png b/src/com/vaadin/tests/book/images/Jupiter_symbol.png Binary files differdeleted file mode 100644 index 7a973bec48..0000000000 --- a/src/com/vaadin/tests/book/images/Jupiter_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Mars_symbol.png b/src/com/vaadin/tests/book/images/Mars_symbol.png Binary files differdeleted file mode 100644 index 7ab7616c75..0000000000 --- a/src/com/vaadin/tests/book/images/Mars_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Mercury_small.png b/src/com/vaadin/tests/book/images/Mercury_small.png Binary files differdeleted file mode 100644 index ef69931a8f..0000000000 --- a/src/com/vaadin/tests/book/images/Mercury_small.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Mercury_symbol.png b/src/com/vaadin/tests/book/images/Mercury_symbol.png Binary files differdeleted file mode 100644 index 97c09d1b29..0000000000 --- a/src/com/vaadin/tests/book/images/Mercury_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Neptune_symbol.png b/src/com/vaadin/tests/book/images/Neptune_symbol.png Binary files differdeleted file mode 100644 index 2b84811c80..0000000000 --- a/src/com/vaadin/tests/book/images/Neptune_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Saturn_symbol.png b/src/com/vaadin/tests/book/images/Saturn_symbol.png Binary files differdeleted file mode 100644 index f4b7e5c6ca..0000000000 --- a/src/com/vaadin/tests/book/images/Saturn_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Uranus_symbol.png b/src/com/vaadin/tests/book/images/Uranus_symbol.png Binary files differdeleted file mode 100644 index 74f755fb97..0000000000 --- a/src/com/vaadin/tests/book/images/Uranus_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Venus_small.png b/src/com/vaadin/tests/book/images/Venus_small.png Binary files differdeleted file mode 100644 index 7bcac3fa4f..0000000000 --- a/src/com/vaadin/tests/book/images/Venus_small.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/images/Venus_symbol.png b/src/com/vaadin/tests/book/images/Venus_symbol.png Binary files differdeleted file mode 100644 index 6d08313e5d..0000000000 --- a/src/com/vaadin/tests/book/images/Venus_symbol.png +++ /dev/null diff --git a/src/com/vaadin/tests/book/smiley.jpg b/src/com/vaadin/tests/book/smiley.jpg Binary files differdeleted file mode 100644 index dc1a399c76..0000000000 --- a/src/com/vaadin/tests/book/smiley.jpg +++ /dev/null diff --git a/src/com/vaadin/tests/components/AbstractTestCase.java b/src/com/vaadin/tests/components/AbstractTestCase.java deleted file mode 100644 index 6653f0ca7f..0000000000 --- a/src/com/vaadin/tests/components/AbstractTestCase.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.tests.components;
-
-import com.vaadin.Application;
-
-public abstract class AbstractTestCase extends Application {
-
- protected abstract String getDescription();
-
- protected abstract Integer getTicketNumber();
-
-}
diff --git a/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java b/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java deleted file mode 100644 index 6b3daae539..0000000000 --- a/src/com/vaadin/tests/components/CustomComponentwithUndefinedSize.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.vaadin.tests.components; - -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class CustomComponentwithUndefinedSize extends TestBase { - - @Override - protected String getDescription() { - return "A custom component with no size definition should not prevent scrollbars from being shown when its contents is larger than its parent"; - } - - @Override - protected Integer getTicketNumber() { - return 2459; - } - - @Override - protected void setup() { - - TabSheet tabs = new TabSheet(); - tabs.setSizeFull(); - MyCustomComponent mcc = new MyCustomComponent(); - mcc.setSizeUndefined(); - - // Doesn't work - tabs.addTab(mcc, "Doesn't work (CustomComponent)", null); - - // Works: - tabs.addTab(mcc.buildLayout(), - "Works (no CustomComponent, same layout)", null); - - addComponent(tabs); - getLayout().setSizeFull(); - } - - private int step = 0; - - public class MyCustomComponent extends CustomComponent { - public MyCustomComponent() { - setCompositionRoot(buildLayout()); - } - - public Layout buildLayout() { - VerticalLayout layout = new VerticalLayout(); - final Panel widePanel = new Panel("too big"); - widePanel.setSizeUndefined(); - widePanel.setWidth("2000px"); - widePanel.setHeight("200px"); - layout.addComponent(widePanel); - Button button = new Button("Change panel size", - new ClickListener() { - - public void buttonClick(ClickEvent event) { - switch (step++ % 4) { - case 0: - widePanel.setWidth("200px"); - break; - case 1: - widePanel.setHeight("2000px"); - break; - case 2: - widePanel.setWidth("2000px"); - break; - case 3: - widePanel.setHeight("200px"); - break; - } - - } - }); - widePanel.addComponent(button); - layout.setSizeUndefined(); - return layout; - } - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/components/HierarchicalContainerSorting.java b/src/com/vaadin/tests/components/HierarchicalContainerSorting.java deleted file mode 100644 index 6f1352f164..0000000000 --- a/src/com/vaadin/tests/components/HierarchicalContainerSorting.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.vaadin.tests.components;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.HierarchicalContainer;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Tree;
-
-public class HierarchicalContainerSorting extends TestBase {
- IndexedContainer hierarchicalContainer = new HierarchicalContainer();
-
- IndexedContainer indexedContainer = new IndexedContainer();
-
- @Override
- public void setup() {
-
- populateContainer(indexedContainer);
- populateContainer(hierarchicalContainer);
-
- sort(indexedContainer);
- sort(hierarchicalContainer);
-
- HorizontalLayout hl = new HorizontalLayout();
-
- Tree tree1 = new Tree("Tree with IndexedContainer");
- tree1.setContainerDataSource(indexedContainer);
- tree1.setItemCaptionPropertyId("name");
- hl.addComponent(tree1);
-
- Tree tree2 = new Tree("Tree with HierarchicalContainer");
- tree2.setContainerDataSource(hierarchicalContainer);
- tree2.setItemCaptionPropertyId("name");
- for (Object id : tree2.rootItemIds()) {
- tree2.expandItemsRecursively(id);
- }
- hl.addComponent(tree2);
-
- addComponent(hl);
- }
-
- private static void sort(IndexedContainer container) {
- Object[] properties = new Object[1];
- properties[0] = "name";
-
- boolean[] ascending = new boolean[1];
- ascending[0] = true;
-
- container.sort(properties, ascending);
- }
-
- private static void populateContainer(IndexedContainer container) {
- container.addContainerProperty("name", String.class, null);
-
- addItem(container, "Games", null);
- addItem(container, "Call of Duty", "Games");
- addItem(container, "Might and Magic", "Games");
- addItem(container, "Fallout", "Games");
- addItem(container, "Red Alert", "Games");
-
- addItem(container, "Cars", null);
- addItem(container, "Toyota", "Cars");
- addItem(container, "Volvo", "Cars");
- addItem(container, "Audi", "Cars");
- addItem(container, "Ford", "Cars");
-
- addItem(container, "Natural languages", null);
- addItem(container, "Swedish", "Natural languages");
- addItem(container, "English", "Natural languages");
- addItem(container, "Finnish", "Natural languages");
-
- addItem(container, "Programming languages", null);
- addItem(container, "C++", "Programming languages");
- addItem(container, "PHP", "Programming languages");
- addItem(container, "Java", "Programming languages");
- addItem(container, "Python", "Programming languages");
-
- }
-
- private static int index = 0;
- private static Map<String, Integer> nameToId = new HashMap<String, Integer>();
-
- public static void addItem(IndexedContainer container, String string,
- String parent) {
- nameToId.put(string, index);
- Item item = container.addItem(index);
- item.getItemProperty("name").setValue(string);
-
- if (parent != null && container instanceof HierarchicalContainer) {
- ((HierarchicalContainer) container).setParent(index, nameToId
- .get(parent));
- }
-
- index++;
- }
-
- @Override
- protected String getDescription() {
- return "The two trees contain the same data, one uses IndexedContainer, one uses HierarchicalContainer. Both should be sorted, both the root nodes and the children.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3095;
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/components/MultipleDebugIds.java b/src/com/vaadin/tests/components/MultipleDebugIds.java deleted file mode 100644 index ebfa29b9e9..0000000000 --- a/src/com/vaadin/tests/components/MultipleDebugIds.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.vaadin.tests.components; - -import com.vaadin.ui.Button; -import com.vaadin.ui.TextField; - -public class MultipleDebugIds extends TestBase { - - @Override - protected String getDescription() { - return "An exception should be thrown if the same debugId is assigned to several components"; - } - - @Override - protected Integer getTicketNumber() { - return 2796; - } - - @Override - protected void setup() { - TextField textField = new TextField(); - TextField textField2 = new TextField(); - Button button = new Button(); - Button button2 = new Button(); - textField.setDebugId("textfield"); - button.setDebugId("button"); - textField2.setDebugId("textfield2"); - button2.setDebugId("textfield"); - - addComponent(textField); - addComponent(textField2); - addComponent(button); - addComponent(button2); - } - -} diff --git a/src/com/vaadin/tests/components/TestBase.java b/src/com/vaadin/tests/components/TestBase.java deleted file mode 100644 index 62368d1525..0000000000 --- a/src/com/vaadin/tests/components/TestBase.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.vaadin.tests.components;
-
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-public abstract class TestBase extends AbstractTestCase {
-
- @Override
- public final void init() {
- window = new Window(getClass().getName());
- setMainWindow(window);
- window.getContent().setSizeFull();
-
- Label label = new Label(getDescription(), Label.CONTENT_XHTML);
- label.setWidth("100%");
- window.getContent().addComponent(label);
-
- layout = new VerticalLayout();
- window.getContent().addComponent(layout);
- ((VerticalLayout) window.getContent()).setExpandRatio(layout, 1);
-
- setup();
- }
-
- private Window window;
- private Layout layout;
-
- public TestBase() {
-
- }
-
- protected Layout getLayout() {
- return layout;
- }
-
- protected abstract void setup();
-
- protected void addComponent(Component c) {
- getLayout().addComponent(c);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.html b/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.html deleted file mode 100644 index ff5c890abf..0000000000 --- a/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.html +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>AbsoluteLayoutClipping</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">AbsoluteLayoutClipping</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.absolutelayout.AbsoluteLayoutClipping</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java b/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java deleted file mode 100644 index f6bff579a3..0000000000 --- a/src/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutClipping.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.components.absolutelayout; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.AbsoluteLayout; -import com.vaadin.ui.Label; - -public class AbsoluteLayoutClipping extends TestBase { - - @Override - protected void setup() { - setTheme("tests-tickets"); - AbsoluteLayout abs = new AbsoluteLayout(); - abs.setStyleName("borders"); - abs.setWidth("100px"); - abs.setHeight("100px"); - - Label l = new Label("This should be clipped at 100px"); - l.setSizeUndefined(); - abs.addComponent(l, "top:50px;left:50px"); - - Label l2 = new Label("This should not be visible"); - l2.setSizeUndefined(); - abs.addComponent(l2, "top:80px;left:150px"); - - Label l3 = new Label("This should be clipped vertically at 100px"); - l3.setWidth("50px"); - abs.addComponent(l3, "top:20px;left:0px"); - - addComponent(abs); - } - - @Override - protected String getDescription() { - return "An AbsoluteLayout with fixed size should clip at its borders. Nothing outside the black square should be visible."; - } - - @Override - protected Integer getTicketNumber() { - return 2913; - } - -} diff --git a/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.html b/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.html deleted file mode 100644 index ef2c784e15..0000000000 --- a/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.html +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>AbstractFieldCommitWithInvalidValues</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">AbstractFieldCommitWithInvalidValues</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.abstractfield.AbstractFieldCommitWithInvalidValues</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldAbstractFieldCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>clickAt</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldAbstractFieldCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldAbstractFieldCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td> - <td>long</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsabstractfieldAbstractFieldCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java b/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java deleted file mode 100644 index 69705d4143..0000000000 --- a/src/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.vaadin.tests.components.abstractfield; - -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.data.validator.StringLengthValidator; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Window.Notification; - -public class AbstractFieldCommitWithInvalidValues extends TestBase { - - private TextField tf; - - @Override - protected String getDescription() { - return "Commiting a field with invalid values should throw an exception"; - } - - @Override - protected Integer getTicketNumber() { - return 2532; - } - - @Override - protected void setup() { - tf = new TextField("A field, must contain 1-2 chars", - new ObjectProperty("a")); - tf - .addValidator(new StringLengthValidator("Invalid length", 1, 2, - false)); - tf.setWriteThrough(false); - tf.setRequired(true); - - Button b = new Button("Commit", new ClickListener() { - - public void buttonClick(ClickEvent event) { - try { - tf.commit(); - if (tf.isValid()) { - getMainWindow().showNotification( - "OK! Form validated and no error was thrown", - Notification.TYPE_HUMANIZED_MESSAGE); - } else { - getMainWindow().showNotification( - "Form is invalid but no exception was thrown", - Notification.TYPE_ERROR_MESSAGE); - } - } catch (Exception e) { - if (tf.isValid()) { - getMainWindow().showNotification( - "Form is valid but an exception was thrown", - Notification.TYPE_ERROR_MESSAGE); - } else { - getMainWindow().showNotification( - "OK! Error was thrown for an invalid input", - Notification.TYPE_HUMANIZED_MESSAGE); - - } - } - } - - }); - - addComponent(tf); - addComponent(b); - } -} diff --git a/src/com/vaadin/tests/components/accordion/AccordionInactiveTabSize.java b/src/com/vaadin/tests/components/accordion/AccordionInactiveTabSize.java deleted file mode 100644 index c0172cfee0..0000000000 --- a/src/com/vaadin/tests/components/accordion/AccordionInactiveTabSize.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.components.accordion; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.TabSheet.Tab; - -public class AccordionInactiveTabSize extends TestBase { - - @Override - protected String getDescription() { - return "Select the second tab and move the splitter to the right. Both the inactive and the active tab should be resized."; - } - - @Override - protected Integer getTicketNumber() { - return 3065; - } - - @Override - protected void setup() { - SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); - sp.setSizeFull(); - - Accordion acc = new Accordion(); - - Tab tab1 = acc.addTab(new TextField("first field")); - tab1.setCaption("First tab"); - - Tab tab2 = acc.addTab(new TextField("second field")); - tab2.setCaption("Second tab"); - - acc.setSizeFull(); - - sp.addComponent(acc); - addComponent(sp); - - } -} diff --git a/src/com/vaadin/tests/components/accordion/RemoveTabs.html b/src/com/vaadin/tests/components/accordion/RemoveTabs.html deleted file mode 100644 index ec24ade8ce..0000000000 --- a/src/com/vaadin/tests/components/accordion/RemoveTabs.html +++ /dev/null @@ -1,122 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>RemoveTabsTest</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">RemoveTabsTest</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.accordion.RemoveTabs</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsaccordionRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsaccordionRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VAccordion[0]/domChild[2]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsaccordionRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsaccordionRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsaccordionRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsaccordionRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/accordion/RemoveTabs.java b/src/com/vaadin/tests/components/accordion/RemoveTabs.java deleted file mode 100644 index a345ad61a2..0000000000 --- a/src/com/vaadin/tests/components/accordion/RemoveTabs.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.vaadin.tests.components.accordion;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.AbstractComponentContainer;
-import com.vaadin.ui.Accordion;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class RemoveTabs extends TestBase {
-
- private Accordion accordion;
-
- protected Component[] tab = new Component[5];
-
- private Button closeCurrent;
- private Button closeFirst;
- private Button closeLast;
- private Button reorderTabs;
-
- @Override
- protected Integer getTicketNumber() {
- return 2425;
- }
-
- @Override
- protected String getDescription() {
- return "Tests the removal of individual tabs from an Accordion. No matter what is done in this test the tab caption \"Tab X\" should always match the content \"Tab X\". Use \"remove first\" and \"remove active\" buttons to remove the first or the active tab. The \"reorder\" button reverses the order by adding and removing all components.";
- }
-
- @Override
- protected void setup() {
- accordion = new Accordion();
- for (int i = 1; i <= tab.length; i++) {
- tab[i - 1] = new Label("This is the contents of tab " + i);
- tab[i - 1].setCaption("Tab " + i);
-
- accordion.addComponent(tab[i - 1]);
- }
-
- getLayout().addComponent(accordion);
-
- closeCurrent = new Button("Close current tab");
- closeCurrent.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- closeCurrentTab();
-
- }
- });
-
- closeFirst = new Button("close first tab");
- closeFirst.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- closeFirstTab();
-
- }
- });
-
- closeLast = new Button("close last tab");
- closeLast.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- closeLastTab();
-
- }
- });
-
- reorderTabs = new Button("reorder");
- reorderTabs.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- reorder();
-
- }
- });
-
- getLayout().addComponent(closeFirst);
- getLayout().addComponent(closeLast);
- getLayout().addComponent(closeCurrent);
- getLayout().addComponent(reorderTabs);
-
- }
-
- private void closeCurrentTab() {
- Component c = accordion.getSelectedTab();
- if (c != null) {
- accordion.removeComponent(c);
- }
- }
-
- private void closeFirstTab() {
- accordion.removeComponent((Component) accordion.getComponentIterator()
- .next());
- }
-
- @SuppressWarnings("unchecked")
- private void closeLastTab() {
- Iterator i = accordion.getComponentIterator();
- Component last = null;
- while (i.hasNext()) {
- last = (Component) i.next();
-
- }
- accordion.removeComponent(last);
- }
-
- @SuppressWarnings("unchecked")
- private void reorder() {
- AbstractComponentContainer container = accordion;
-
- if (container != null) {
- List<Component> c = new ArrayList<Component>();
- Iterator<Component> i = container.getComponentIterator();
- while (i.hasNext()) {
- Component comp = i.next();
- c.add(comp);
- }
- container.removeAllComponents();
-
- for (int j = c.size() - 1; j >= 0; j--) {
- container.addComponent(c.get(j));
- }
-
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java b/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java deleted file mode 100644 index 5a42599005..0000000000 --- a/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerGenerator.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.vaadin.tests.components.beanitemcontainer; - -import java.util.Date; -import java.util.Random; - -import com.vaadin.data.util.BeanItemContainer; - -public class BeanItemContainerGenerator { - - public static BeanItemContainer<TestBean> createContainer(int size) { - - BeanItemContainer<TestBean> container = new BeanItemContainer<TestBean>( - TestBean.class); - Random r = new Random(new Date().getTime()); - for (int i = 0; i < size; i++) { - container.addBean(new TestBean(r)); - } - - return container; - - } - - public static class TestBean { - private String name, address, city, country; - private int age, shoesize; - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public int getShoesize() { - return shoesize; - } - - public void setShoesize(int shoesize) { - this.shoesize = shoesize; - } - - public TestBean(Random r) { - age = r.nextInt(100) + 5; - shoesize = r.nextInt(10) + 35; - name = createRandomString(r, r.nextInt(5) + 5); - address = createRandomString(r, r.nextInt(15) + 5) + " " - + r.nextInt(100) + 1; - city = createRandomString(r, r.nextInt(7) + 3); - if (r.nextBoolean()) { - country = createRandomString(r, r.nextInt(4) + 4); - } - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - } - - public static String createRandomString(Random r, int len) { - StringBuilder b = new StringBuilder(); - for (int i = 0; i < len; i++) { - b.append((char) (r.nextInt('z' - 'a') + 'a')); - } - - return b.toString(); - } - -} diff --git a/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java b/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java deleted file mode 100644 index 15f292a6ca..0000000000 --- a/src/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.vaadin.tests.components.beanitemcontainer; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Table; -import com.vaadin.ui.Button.ClickEvent; - -public class BeanItemContainerNullValues extends TestBase { - - private Table table; - - @Override - protected String getDescription() { - return "Null values should be sorted first (ascending sort) in a BeanItemContainer. Sort the 'country' column to see that the empty values come first."; - } - - @Override - protected Integer getTicketNumber() { - return 2917; - } - - @Override - protected void setup() { - table = new Table(); - table.setSortDisabled(false); - table.setContainerDataSource(BeanItemContainerGenerator - .createContainer(100)); - table.setColumnCollapsingAllowed(true); - - Button b = new Button("Disable sorting", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - table.setSortDisabled(!table.isSortDisabled()); - if (table.isSortDisabled()) { - event.getButton().setCaption("Enable sorting"); - } else { - event.getButton().setCaption("Disable sorting"); - } - } - - }); - - addComponent(table); - addComponent(b); - } - -} diff --git a/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.html b/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.html deleted file mode 100644 index a37e8ea662..0000000000 --- a/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TestBeanItemContainerUsage</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TestBeanItemContainerUsage</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.beanitemcontainer.TestBeanItemContainerUsage</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java b/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java deleted file mode 100644 index 20becea974..0000000000 --- a/src/com/vaadin/tests/components/beanitemcontainer/TestBeanItemContainerUsage.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.vaadin.tests.components.beanitemcontainer; - -import java.util.ArrayList; -import java.util.List; - -import com.vaadin.data.util.BeanItemContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Table; - -public class TestBeanItemContainerUsage extends TestBase { - - @Override - protected String getDescription() { - return "A test for the BeanItemContainer. The table should contain three persons and show their first and last names and their age."; - } - - @Override - protected Integer getTicketNumber() { - return 1061; - } - - @Override - protected void setup() { - Table t = new Table("Table containing Persons"); - t.setPageLength(5); - t.setWidth("100%"); - List<Person> persons = new ArrayList<Person>(); - persons.add(new Person("Jones", "Birchman", 35)); - persons.add(new Person("Marc", "Smith", 30)); - persons.add(new Person("Greg", "Sandman", 75)); - - BeanItemContainer<Person> bic = new BeanItemContainer<Person>(persons); - t.setContainerDataSource(bic); - - addComponent(t); - } - - public static class Person { - private String firstName; - private String lastName; - private int age; - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public Person(String firstName, String lastName, int age) { - super(); - this.firstName = firstName; - this.lastName = lastName; - this.age = age; - } - - } -} diff --git a/src/com/vaadin/tests/components/button/ButtonErrorMessage.java b/src/com/vaadin/tests/components/button/ButtonErrorMessage.java deleted file mode 100644 index b543c69c51..0000000000 --- a/src/com/vaadin/tests/components/button/ButtonErrorMessage.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.vaadin.tests.components.button;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class ButtonErrorMessage extends TestBase {
-
- @Override
- protected void setup() {
- Button b = new Button("Click for error");
- b.addListener(new ClickListener() {
- public void buttonClick(ClickEvent event) {
- throw new NullPointerException();
- }
- });
- addComponent(b);
- }
-
- @Override
- protected String getDescription() {
- return "Click the button for an exception. The exception should not contain any extra ',' characters";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3303;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html b/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html deleted file mode 100644 index 16d18d2e50..0000000000 --- a/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.html +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ButtonUndefinedWidth</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ButtonUndefinedWidth</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.button.ButtonUndefinedWidth</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VNativeButton[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VNativeButton[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsbuttonButtonUndefinedWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[2]</td> - <td>636,149</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java b/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java deleted file mode 100644 index 852e41bd05..0000000000 --- a/src/com/vaadin/tests/components/button/ButtonUndefinedWidth.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.components.button;
-
-import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.NativeButton;
-import com.vaadin.ui.Table;
-
-public class ButtonUndefinedWidth extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Both the button outside the table and inside the table should be only as wide as necessary. There should be empty space in the table to the right of the button.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3257;
- }
-
- @Override
- protected void setup() {
- Button b = new Button("Undefined wide");
- addComponent(b);
- NativeButton b2 = new NativeButton("Undefined wide");
- addComponent(b2);
-
- Table t = new Table();
- t.addContainerProperty("A", Button.class, null);
- t.setWidth("500px");
-
- Item i = t.addItem("1");
- i.getItemProperty("A").setValue(new Button("Undef wide"));
- Item i2 = t.addItem("2");
- i2.getItemProperty("A").setValue(new NativeButton("Undef wide"));
-
- addComponent(t);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/button/DisabledButtons.html b/src/com/vaadin/tests/components/button/DisabledButtons.html deleted file mode 100644 index 65584fd4d0..0000000000 --- a/src/com/vaadin/tests/components/button/DisabledButtons.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>DisabledButtons</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">DisabledButtons</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.button.DisabledButtons</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/button/DisabledButtons.java b/src/com/vaadin/tests/components/button/DisabledButtons.java deleted file mode 100644 index 3e438a5d5b..0000000000 --- a/src/com/vaadin/tests/components/button/DisabledButtons.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.vaadin.tests.components.button; - -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.VerticalLayout; - -public class DisabledButtons extends TestBase { - - private static final ThemeResource ICON = new ThemeResource( - "../runo/icons/16/ok.png"); - private String CAPTION = "Caption"; - - @Override - protected String getDescription() { - return "The disabled buttons should be identical to the enabled buttons but grayed out."; - } - - @Override - protected Integer getTicketNumber() { - return 3110; - } - - @Override - protected void setup() { - HorizontalLayout hl = new HorizontalLayout(); - hl.addComponent(createButtons(true)); - hl.addComponent(createButtons(false)); - - addComponent(hl); - - } - - private Component createButtons(boolean enabled) { - VerticalLayout vl = new VerticalLayout(); - Button b; - - // Button w/ text - b = new Button(CAPTION); - b.setEnabled(enabled); - vl.addComponent(b); - - // Button w/ text, icon - b = new Button(CAPTION); - b.setEnabled(enabled); - b.setIcon(ICON); - vl.addComponent(b); - - // Button w/ icon - b = new Button(); - b.setEnabled(enabled); - b.setIcon(ICON); - vl.addComponent(b); - - return vl; - } - -} diff --git a/src/com/vaadin/tests/components/button/IE7ButtonWithIcon.html b/src/com/vaadin/tests/components/button/IE7ButtonWithIcon.html deleted file mode 100644 index a05b439759..0000000000 --- a/src/com/vaadin/tests/components/button/IE7ButtonWithIcon.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>IE7ButtonWithIcon</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">IE7ButtonWithIcon</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.button.IE7ButtonWithIcon</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/button/IE7ButtonWithIcon.java b/src/com/vaadin/tests/components/button/IE7ButtonWithIcon.java deleted file mode 100644 index c6a0ae96a9..0000000000 --- a/src/com/vaadin/tests/components/button/IE7ButtonWithIcon.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vaadin.tests.components.button; - -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; - -public class IE7ButtonWithIcon extends TestBase { - - @Override - protected String getDescription() { - return "The button should contain the text \"Normal\" and an 16x16 icon and have padding to the left and the right"; - } - - @Override - protected Integer getTicketNumber() { - return 3031; - } - - @Override - protected void setup() { - Button b = new Button("Normal"); - b.setIcon(new ThemeResource("../runo/icons/16/ok.png")); - - addComponent(b); - } - -} diff --git a/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java b/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java deleted file mode 100644 index 3fed5b9c02..0000000000 --- a/src/com/vaadin/tests/components/button/TooltipForDisabledButton.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.vaadin.tests.components.button;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class TooltipForDisabledButton extends TestBase {
-
- @Override
- protected String getDescription() {
- return "A disabled button should show a tooltip when hovering it";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2085;
- }
-
- @Override
- protected void setup() {
- Button buttonEnabled = new Button("This is an enabled button");
- Button buttonDisabled = new Button("This is an disabled button");
- buttonDisabled.setEnabled(false);
-
- buttonEnabled.setDescription("Tooltip for enabled");
- buttonDisabled.setDescription("Tooltip for disabled");
-
- buttonDisabled.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- getMainWindow().showNotification("Clicked Disabled");
- }
-
- });
-
- buttonEnabled.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- getMainWindow().showNotification("Clicked Enabled");
- }
-
- });
-
- addComponent(buttonEnabled);
- addComponent(buttonDisabled);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/caption/LargeCaptionIcon.html b/src/com/vaadin/tests/components/caption/LargeCaptionIcon.html deleted file mode 100644 index d2928cf4c3..0000000000 --- a/src/com/vaadin/tests/components/caption/LargeCaptionIcon.html +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>LargeCaptionIcon</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">LargeCaptionIcon</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.caption.LargeCaptionIcon</td> - <td></td> -</tr> -<tr> - <td>pause</td> - <td>500</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>refresh</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pause</td> - <td>500</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/caption/LargeCaptionIcon.java b/src/com/vaadin/tests/components/caption/LargeCaptionIcon.java deleted file mode 100644 index 0ff82e9847..0000000000 --- a/src/com/vaadin/tests/components/caption/LargeCaptionIcon.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.vaadin.tests.components.caption; - -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; - -public class LargeCaptionIcon extends TestBase { - - @Override - protected String getDescription() { - return "The icon should be completetly visible on both initial load and after subsequent refreshes."; - } - - @Override - protected Integer getTicketNumber() { - return 2902; - } - - @Override - protected void setup() { - GridLayout gl = new GridLayout(); - gl.setWidth("100%"); - - Label l = new Label("This is a label"); - l.setCaption("This is its caption, it also has a large icon"); - l.setIcon(new ThemeResource("../runo/icons/64/ok.png")); - gl.addComponent(l); - addComponent(gl); - } -} diff --git a/src/com/vaadin/tests/components/checkbox/CheckboxCaptionWrapping.html b/src/com/vaadin/tests/components/checkbox/CheckboxCaptionWrapping.html deleted file mode 100644 index 26ecc95721..0000000000 --- a/src/com/vaadin/tests/components/checkbox/CheckboxCaptionWrapping.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>CheckboxCaptionWrapping</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">CheckboxCaptionWrapping</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.checkbox.CheckboxCaptionWrapping</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/checkbox/CheckboxCaptionWrapping.java b/src/com/vaadin/tests/components/checkbox/CheckboxCaptionWrapping.java deleted file mode 100644 index 540af083c4..0000000000 --- a/src/com/vaadin/tests/components/checkbox/CheckboxCaptionWrapping.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.vaadin.tests.components.checkbox;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.VerticalLayout;
-
-public class CheckboxCaptionWrapping extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The checkbox caption consists of 10 words which should all be shown. There should be no extra white space between the checkbox caption and the label below it.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3263;
- }
-
- @Override
- protected void setup() {
- setTheme("tests-tickets");
- VerticalLayout mainLayout = new VerticalLayout();
- CheckBox cb = new CheckBox(
- "Checkbox with some Incididunt ut labore et dolore magna aliqua.");
- cb.setStyleName("wrap");
- cb.setWidth("100%");
- mainLayout.setStyleName("borders");
- mainLayout.setWidth("300px");
- mainLayout.addComponent(cb);
- mainLayout.addComponent(new Label(
- "Lorem ipsum dolor sit amet, consectetur adipisicing"
- + " elit, sed do eiusmod tempor."));
-
- addComponent(mainLayout);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/components/checkbox/CheckboxIcon.java b/src/com/vaadin/tests/components/checkbox/CheckboxIcon.java deleted file mode 100644 index 1f96a05084..0000000000 --- a/src/com/vaadin/tests/components/checkbox/CheckboxIcon.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.vaadin.tests.components.checkbox;
-
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.CheckBox;
-
-public class CheckboxIcon extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The icon of a Checkbox component should have the same cursor as the text and should be clickable. The tooltip should appear when hovering the checkbox, the icon or the caption.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected void setup() {
- CheckBox checkbox = new CheckBox("A checkbox");
- checkbox.setIcon(new ThemeResource("../runo/icons/32/calendar.png"));
- checkbox.setDescription("Tooltip for checkbox");
-
- addComponent(checkbox);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java b/src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java deleted file mode 100644 index 9636af0284..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.components.combobox; - -import java.util.Map; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.PopupView; - -public class ComboBoxInPopupView extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2508; - } - - @Override - protected String getDescription() { - return "Testcase for ComboBox in PopupView. Make the window narrower than the popup: the focused (2) one wraps button to second row AND seems narrower than (1), the unfocused one (1) works as expected."; - } - - @Override - protected void setup() { - final ComboBox cb1 = new ComboBox(); - cb1.setWidth("260px"); - // cb.focus(); - PopupView pv1 = new PopupView("<u>1. expected (click)</u>", cb1); - getLayout().addComponent(pv1); - - final ComboBox cb2 = new ComboBox(); - cb2.setWidth("260px"); - PopupView pv2 = new PopupView("<u>2. focused (click)</u>", cb2) { - public void changeVariables(Object source, Map variables) { - super.changeVariables(source, variables); - cb2.focus(); - } - - }; - getLayout().addComponent(pv2); - - } - -} diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.html b/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.html deleted file mode 100644 index 447000d6d7..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.html +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ComboBoxItemIcon</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ComboBoxItemIcon</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.combobox.ComboBoxItemIcon</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxItemIcon::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java b/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java deleted file mode 100644 index 4800316a5a..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.components.combobox; - -import com.vaadin.data.Item; -import com.vaadin.terminal.Resource; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.ComboBox; - -public class ComboBoxItemIcon extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2455; - } - - @Override - protected String getDescription() { - return "The items in the ComboBox should have icons - also when selected."; - } - - @Override - protected void setup() { - ComboBox cb = new ComboBox(); - cb.addContainerProperty("icon", Resource.class, null); - cb.setItemIconPropertyId("icon"); - getLayout().addComponent(cb); - - Item item = cb.addItem("FI"); - item.getItemProperty("icon").setValue( - new ThemeResource("../sampler/flags/fi.gif")); - item = cb.addItem("SE"); - item.getItemProperty("icon").setValue( - new ThemeResource("../sampler/flags/se.gif")); - - } - -} diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java b/src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java deleted file mode 100644 index 1992c12943..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.components.combobox; - -import java.util.Date; - -import com.vaadin.data.Item; -import com.vaadin.terminal.Resource; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.ComboBox; - -public class ComboBoxLargeIcons extends TestBase { - - @Override - protected Integer getTicketNumber() { - return null; - } - - @Override - protected String getDescription() { - return "<p>All items in the Combobox has large icons. The size of the dropdown should fit the contents, also when changing pages. The height of the dropdown shouldn't exceed the browser's viewport, but fewer items should be visible then.</p><p>The size of the shadow behind the dropdown must also be correctly sized.</p><p>Note that the image URL change for every restart to keep the browser from using cached images.</p>"; - } - - @Override - protected void setup() { - ComboBox cb = new ComboBox(); - cb.addContainerProperty("icon", Resource.class, null); - cb.setItemIconPropertyId("icon"); - getLayout().addComponent(cb); - cb.setNullSelectionAllowed(false); - String[] icons = new String[] { "folder-add", "folder-delete", - "arrow-down", "arrow-left", "arrow-right", "arrow-up", - "document-add", "document-delete", "document-doc", - "document-edit", "document-image", "document-pdf", - "document-ppt", "document-txt", "document-web", "document-xls", - "document" }; - for (String icon : icons) { - Item item = cb.addItem(new Object()); - item.getItemProperty("icon").setValue( - new ThemeResource("icons/64/" + icon + ".png?" - + new Date().getTime())); - } - - } -} diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.html b/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.html deleted file mode 100644 index 1f1248fce8..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.html +++ /dev/null @@ -1,397 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ComboBoxNavigation</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ComboBoxNavigation</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.combobox.ComboBoxNavigation</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>setSpeed</td> - <td>500</td> - <td>Needed because of #3409</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>41,10</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>e</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>up</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>enter</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyValue</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxNavigation::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[0]</td> - <td>Item 7</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java b/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java deleted file mode 100644 index 245fc123df..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxNavigation.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.components.combobox; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.ComboBox; - -public class ComboBoxNavigation extends TestBase { - - @Override - protected String getDescription() { - return "Entering e in the field and scrolling down with the arrow keys should always select the next item, also when the page changes. Scrolling back up should always select the previous item, also when changing pages."; - } - - @Override - protected Integer getTicketNumber() { - return 2214; - } - - @Override - protected void setup() { - ComboBox cb = new ComboBox(); - for (int i = 1; i < 100; i++) { - cb.addItem("Item " + i); - } - - cb.setFilteringMode(ComboBox.FILTERINGMODE_CONTAINS); - addComponent(cb); - - } - -} diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.html b/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.html deleted file mode 100644 index 2aab40f13f..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.html +++ /dev/null @@ -1,292 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ComboBoxValueInput</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ComboBoxValueInput</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.combobox.ComboBoxValueInput</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[3]/td</td> - <td>58,6</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[0]</td> - <td>96,14</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[4]/td/span</td> - <td>29,6</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[3]/td</td> - <td>99,13</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[1]/td</td> - <td>97,14</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>68,17</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>value</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>down</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pressSpecialKey</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>enter</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VFilterSelect[0]/domChild[0]</td> - <td>76,17</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td</td> - <td>71,11</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[1]/td</td> - <td>58,9</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VFilterSelect[0]/domChild[0]</td> - <td>73,12</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxValueInput::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VFilterSelect[0]/domChild[0]</td> - <td>43,7</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java b/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java deleted file mode 100644 index c91a707859..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxValueInput.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.components.combobox;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.VerticalLayout;
-
-public class ComboBoxValueInput extends TestBase {
-
- @Override
- protected void setup() {
- ((VerticalLayout) getLayout()).setSpacing(true);
-
- ComboBox cb = getComboBox("A combobox", false);
- addComponent(cb);
-
- cb = getComboBox("A combobox with input prompt", false);
- cb.setInputPrompt("Please select");
- addComponent(cb);
-
- cb = getComboBox("A combobox with null item", true);
- addComponent(cb);
-
- cb = getComboBox("A combobox with null item and input prompt", true);
- cb.setInputPrompt("Please select");
- addComponent(cb);
-
- cb = getComboBox("A disabled combobox", true);
- cb.setEnabled(false);
- addComponent(cb);
-
- cb = getComboBox("A read-only combobox", true);
- cb.setReadOnly(true);
- addComponent(cb);
-
- cb = getComboBox("A combobox with filteringMode off", false);
- cb.setFilteringMode(ComboBox.FILTERINGMODE_OFF);
-
- }
-
- @Override
- protected String getDescription() {
- return "A combobox should always show the selected value when it is not focused. Entering a text when nothing is selected and blurring the combobox should reset the value. The same should happen when a value is selected";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3268;
- }
-
- private ComboBox getComboBox(String caption, boolean addNullItem) {
- ComboBox cb = new ComboBox(caption);
- cb.setImmediate(true);
- if (addNullItem) {
- cb.addItem("Null item");
- cb.setNullSelectionItemId("Null item");
- }
- cb.addItem("Value 1");
- cb.addItem("Value 2");
- cb.addItem("Value 3");
-
- return cb;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java b/src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java deleted file mode 100644 index 75cefe9360..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboBoxValueUpdate.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.vaadin.tests.components.combobox; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Label; - -public class ComboBoxValueUpdate extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2451; - } - - private Label selectedLabel; - - @Override - protected String getDescription() { - return "Testcase for ComboBox. Test especially edge values(of page changes) when selecting items with keyboard only."; - } - - @Override - protected void setup() { - ComboBox select = new ComboBox(""); - select.setImmediate(true); - for (int i = 0; i < 100; i++) { - select.addItem("item " + i); - } - - final Label value = new Label(); - - select.addListener(new ComboBox.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - System.err - .println("Selected " + event.getProperty().getValue()); - value.setValue("Selected " + event.getProperty().getValue()); - - } - }); - - getLayout().addComponent(select); - getLayout().addComponent(value); - - } - -} diff --git a/src/com/vaadin/tests/components/combobox/ComboxBoxErrorMessage.java b/src/com/vaadin/tests/components/combobox/ComboxBoxErrorMessage.java deleted file mode 100644 index a6eaf7d3e6..0000000000 --- a/src/com/vaadin/tests/components/combobox/ComboxBoxErrorMessage.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.vaadin.tests.components.combobox;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.ComboBox;
-
-public class ComboxBoxErrorMessage extends TestBase {
-
- @Override
- protected void setup() {
- ComboBox cb = new ComboBox("");
- cb.setRequired(true);
- cb.setRequiredError("You must select something");
- addComponent(cb);
- }
-
- @Override
- protected String getDescription() {
- return "The ComboBox should show an \"You must select something\" tooltip when the cursor is hovering it. Both when hovering the textfield and the dropdown button.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3345;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/combobox/fi.gif b/src/com/vaadin/tests/components/combobox/fi.gif Binary files differdeleted file mode 100755 index 8d3a191828..0000000000 --- a/src/com/vaadin/tests/components/combobox/fi.gif +++ /dev/null diff --git a/src/com/vaadin/tests/components/combobox/se.gif b/src/com/vaadin/tests/components/combobox/se.gif Binary files differdeleted file mode 100755 index 80f6285228..0000000000 --- a/src/com/vaadin/tests/components/combobox/se.gif +++ /dev/null diff --git a/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.html b/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.html deleted file mode 100644 index af711b9ab8..0000000000 --- a/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.html +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="http://localhost:8888/" /> -<title>DateFieldReadOnly</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">DateFieldReadOnly</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.datefield.DateFieldReadOnly</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldReadOnly::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java b/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java deleted file mode 100644 index ae31d25190..0000000000 --- a/src/com/vaadin/tests/components/datefield/DateFieldReadOnly.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.vaadin.tests.components.datefield;
-
-import java.util.Calendar;
-import java.util.Locale;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class DateFieldReadOnly extends TestBase {
-
- @Override
- protected String getDescription() {
- return "A read-only DateField should not show the popup button and not be editable.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3163;
- }
-
- @Override
- protected void setup() {
- final DateField timeField = new DateField("A read-only datefield");
- timeField.setResolution(DateField.RESOLUTION_SEC);
- timeField.setDateFormat("HH:mm:ss");
- timeField.setCaption(null);
- timeField.setIcon(null);
- timeField.setWidth("8em");
- timeField.addStyleName("timeField");
-
- // Set date so that testing always has same time
- Calendar c = Calendar.getInstance(Locale.ENGLISH);
- c.set(2009, 05, 12, 0, 0, 0);
-
- timeField.setValue(c.getTime());
- timeField.setReadOnly(true);
-
- addComponent(timeField);
-
- Button b = new Button("Switch read-only");
- b.addListener(new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- timeField.setReadOnly(!timeField.isReadOnly());
- }
- });
-
- addComponent(b);
- }
-}
diff --git a/src/com/vaadin/tests/components/datefield/DisabledDateFieldWidth b/src/com/vaadin/tests/components/datefield/DisabledDateFieldWidth deleted file mode 100644 index 48b11e1f7c..0000000000 --- a/src/com/vaadin/tests/components/datefield/DisabledDateFieldWidth +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="http://localhost:8888/" /> -<title>DisabledDateFieldWidth</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">DisabledDateFieldWidth</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.datefield.DisabledDateFieldWidth</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDisabledDateFieldWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldDisabledDateFieldWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java b/src/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java deleted file mode 100644 index 3f26e106ee..0000000000 --- a/src/com/vaadin/tests/components/datefield/DisabledDateFieldWidth.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.components.datefield;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class DisabledDateFieldWidth extends TestBase {
- @Override
- public void setup() {
-
- final DateField dateField1 = new DateField("DateField");
- dateField1.setResolution(DateField.RESOLUTION_YEAR);
- dateField1.setEnabled(false);
-
- Button button = new Button("Repaint datefield",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- dateField1.requestRepaint();
- }
- });
-
- GridLayout gl = new GridLayout(3, 1);
- gl.addComponent(dateField1);
- gl.addComponent(button);
-
- addComponent(gl);
- }
-
- @Override
- protected String getDescription() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/src/com/vaadin/tests/components/datefield/TestDatefieldYear.html b/src/com/vaadin/tests/components/datefield/TestDatefieldYear.html deleted file mode 100644 index 9ecb803ab0..0000000000 --- a/src/com/vaadin/tests/components/datefield/TestDatefieldYear.html +++ /dev/null @@ -1,132 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TestDatefieldYear</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TestDatefieldYear</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.datefield.TestDatefieldYear</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsdatefieldTestDatefieldYear::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[1]/button</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[2]/button</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[2]/button</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[2]/button</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[2]/button</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[4]/button</td> - <td>16,7</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[4]/button</td> - <td>-287,-85</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[5]/button</td> - <td>10,9</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/datefield/TestDatefieldYear.java b/src/com/vaadin/tests/components/datefield/TestDatefieldYear.java deleted file mode 100644 index fb1a1934c2..0000000000 --- a/src/com/vaadin/tests/components/datefield/TestDatefieldYear.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.datefield; - -import java.util.Date; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.DateField; - -public class TestDatefieldYear extends TestBase { - - @Override - protected String getDescription() { - return "A popup with resolution year or month should update the textfield when browsing. The value displayed in the textfield should always be the same as the popup shows."; - } - - @Override - protected Integer getTicketNumber() { - return 2813; - } - - @Override - protected void setup() { - DateField df = new DateField("Year", new Date(2009 - 1900, 4 - 1, 1)); - df.setResolution(DateField.RESOLUTION_YEAR); - df.setResolution(DateField.RESOLUTION_MONTH); - addComponent(df); - - } -} diff --git a/src/com/vaadin/tests/components/embedded/EmbeddedFlash.java b/src/com/vaadin/tests/components/embedded/EmbeddedFlash.java deleted file mode 100644 index 87e0714545..0000000000 --- a/src/com/vaadin/tests/components/embedded/EmbeddedFlash.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.vaadin.tests.components.embedded;
-
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Embedded;
-
-public class EmbeddedFlash extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The embedded flash should have the movie parameter set to \"someRandomValue\" and an allowFullScreen parameter set to \"true\".";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3367;
- }
-
- @Override
- public void setup() {
- Embedded player = new Embedded();
- player.setType(Embedded.TYPE_OBJECT);
- player.setWidth("400px");
- player.setHeight("300px");
- player.setMimeType("application/x-shockwave-flash");
- String url = "http://www.youtube.com/v/qQ9N742QB4g&autoplay=1";
- player.setSource(new ExternalResource(url));
- player.setParameter("movie", "someRandomValue");
- player.setParameter("allowFullScreen", "true");
-
- addComponent(player);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java b/src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java deleted file mode 100644 index e2b4ca5a2e..0000000000 --- a/src/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.vaadin.tests.components.embedded; - -import java.awt.Color; -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Date; - -import javax.imageio.ImageIO; - -import com.vaadin.terminal.StreamResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Button.ClickEvent; - -public class EmbeddedImageRefresh extends TestBase { - @Override - protected String getDescription() { - return "Tests if requestRepaint() makes the browser reload a dynamic resource."; - } - - @Override - protected Integer getTicketNumber() { - return 2470; - } - - @Override - protected void setup() { - // Create the embedded. - final Embedded embedded = new Embedded(); - embedded.setDescription("Click on the grid cells to switch them."); - addComponent(embedded); - - // Attach it to a resource. - final MyImageSource imageSource = new MyImageSource(); - final StreamResource imageResource = new StreamResource(imageSource, - "testimage.png", this); - imageResource.setCacheTime(0); - embedded.setSource(imageResource); - - // The button requests repainting the embedded. - Button button = new Button("refr"); - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - embedded.requestRepaint(); - } - }); - addComponent(button); - button = new Button("refr name"); - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - ((StreamResource) embedded.getSource()).setFilename(new Date() - .getTime() - + ".png"); - embedded.requestRepaint(); - } - }); - addComponent(button); - button = new Button("200x200"); - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - embedded.setWidth("200px"); - embedded.setHeight("200px"); - } - }); - addComponent(button); - button = new Button("undef"); - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - embedded.setSizeUndefined(); - } - }); - addComponent(button); - - } - - public class MyImageSource implements StreamResource.StreamSource { - public MyImageSource() { - } - - int intervalPos(int pos, int resolution, int cells) { - return (int) Math.round(pos * resolution / (cells * 1.0)); - } - - public InputStream getStream() { - // Create an image and draw some background on it. - BufferedImage image = new BufferedImage(640, 480, - BufferedImage.TYPE_INT_RGB); - Graphics drawable = image.getGraphics(); - - // Background - drawable.setColor(Color.white); - drawable.fillRect(0, 0, 640, 480); - - final int rows = 10; - final int cols = 10; - - // Grid - for (int row = 0; row < rows; row++) { - int gridy = intervalPos(row, 480, rows); - int gridynext = intervalPos(row + 1, 480, rows); - - // Horizontal grid line - if (row > 0) { - drawable.setColor(Color.lightGray); - drawable.drawLine(0, gridy, 640 - 1, gridy); - } - - for (int col = 0; col < cols; col++) { - int gridx = intervalPos(col, 640, cols); - int gridxnext = intervalPos(col + 1, 640, cols); - - // Vertical grid line - if (row == 0 && col > 0) { - drawable.setColor(Color.lightGray); - drawable.drawLine(gridx, 0, gridx, 480 - 1); - } - - // Cell - if (Math.random() < 0.5f) { - drawable.setColor(Color.white); - } else { - drawable.setColor(Color.black); - } - drawable.fillRect(gridx + 1, gridy + 1, gridxnext - gridx - - 1, gridynext - gridy - 1); - } - } - - try { - // Write the image to a buffer. - ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream(); - ImageIO.write(image, "png", imagebuffer); - - // Return a stream from the buffer. - ByteArrayInputStream istream = new ByteArrayInputStream( - imagebuffer.toByteArray()); - return istream; // new DownloadStream (istream,null,null); - } catch (IOException e) { - return null; - } - } - - } -} diff --git a/src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java b/src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java deleted file mode 100644 index 37dbacb830..0000000000 --- a/src/com/vaadin/tests/components/embedded/EmbeddedTooltip.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.embedded;
-
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Embedded;
-
-public class EmbeddedTooltip extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The tooltip for an Embedded image should be visible also when hovering the image";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2853;
- }
-
- @Override
- protected void setup() {
- Embedded e = new Embedded("Embedded caption", new ThemeResource(
- "../runo/icons/64/ok.png"));
- e
- .setDescription("Embedded tooltip, only shown on caption, not on the image");
- addComponent(e);
-
- }
-}
diff --git a/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.html b/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.html deleted file mode 100644 index b0305e60dc..0000000000 --- a/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.html +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>FormCommitWithInvalidValues</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">FormCommitWithInvalidValues</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.form.FormCommitWithInvalidValues</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> - <td>1</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VForm[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td> - <td>123</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsformFormCommitWithInvalidValues::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java b/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java deleted file mode 100644 index 6431e0aeb1..0000000000 --- a/src/com/vaadin/tests/components/form/FormCommitWithInvalidValues.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.vaadin.tests.components.form; - -import com.vaadin.data.validator.StringLengthValidator; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Form; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Window.Notification; - -public class FormCommitWithInvalidValues extends TestBase { - - private Form form; - - @Override - protected String getDescription() { - return "Commiting a form with invalid values should throw an exception"; - } - - @Override - protected Integer getTicketNumber() { - return 2466; - } - - @Override - protected void setup() { - form = new Form(); - TextField tf = new TextField("A field, must contain 1-2 chars"); - tf - .addValidator(new StringLengthValidator("Invalid length", 1, 2, - false)); - tf.setRequired(true); - - form.addField("a", tf); - - Button b = new Button("Commit", new ClickListener() { - - public void buttonClick(ClickEvent event) { - try { - form.commit(); - if (form.isValid()) { - getMainWindow().showNotification( - "OK! Form validated and no error was thrown", - Notification.TYPE_HUMANIZED_MESSAGE); - } else { - getMainWindow().showNotification( - "Form is invalid but no exception was thrown", - Notification.TYPE_ERROR_MESSAGE); - } - } catch (Exception e) { - if (form.isValid()) { - getMainWindow().showNotification( - "Form is valid but an exception was thrown", - Notification.TYPE_ERROR_MESSAGE); - } else { - getMainWindow().showNotification( - "OK! Error was thrown for an invalid input", - Notification.TYPE_HUMANIZED_MESSAGE); - - } - } - } - - }); - - addComponent(form); - addComponent(b); - } - -} diff --git a/src/com/vaadin/tests/components/form/FormNotGettingSmaller.java b/src/com/vaadin/tests/components/form/FormNotGettingSmaller.java deleted file mode 100644 index 1cf21126a0..0000000000 --- a/src/com/vaadin/tests/components/form/FormNotGettingSmaller.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.components.form; - -import com.vaadin.data.Item; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.data.util.PropertysetItem; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Form; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; - -public class FormNotGettingSmaller extends TestBase { - - @Override - protected void setup() { - Item item = new PropertysetItem(); - item.addItemProperty("name", new ObjectProperty("Charles Anthony")); - item.addItemProperty("city", new ObjectProperty("London")); - item.addItemProperty("isTallPerson", new ObjectProperty(Boolean.FALSE)); - - Label spacer = new Label(); - HorizontalLayout buttons = new HorizontalLayout(); - buttons.setSpacing(true); - buttons.setWidth("100%"); - buttons.addComponent(spacer); - buttons.addComponent(new Button("OK")); - buttons.addComponent(new Button("Cancel")); - buttons.setExpandRatio(spacer, 1f); - - Form form = new Form(); - form - .setDescription("Ooh. Just a demonstration of things, really. Some long lorem ipsum dolor sit amet.Some very long lorem ipsum dolor sit amet.Some very long lorem ipsum dolor sit amet.Some very long lorem ipsum dolor sit amet."); - - form.setItemDataSource(item); - form.setFooter(buttons); - - getLayout().addComponent(form); - } - - @Override - protected String getDescription() { - return "When resizing window buttons should stay on " - + "right edge of the screent. Form should also get narrower."; - } - - @Override - protected Integer getTicketNumber() { - return 3365; - } - -} diff --git a/src/com/vaadin/tests/components/form/FormRenderingFlicker.java b/src/com/vaadin/tests/components/form/FormRenderingFlicker.java deleted file mode 100644 index 6956eee017..0000000000 --- a/src/com/vaadin/tests/components/form/FormRenderingFlicker.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.vaadin.tests.components.form;
-
-import com.vaadin.data.Item;
-import com.vaadin.event.ItemClickEvent;
-import com.vaadin.event.ItemClickEvent.ItemClickListener;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.VerticalLayout;
-
-public class FormRenderingFlicker extends TestBase {
-
- private VerticalLayout tableLayout;
- private Table table;
- private Panel tablePanel;
- private Form form;
-
- @Override
- protected String getDescription() {
- return "Clicking on an item in the table will replace the panel (surrounding the table) with a form. This should not cause the table rows to move downwards or cause any other visible flicker";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2816;
- }
-
- @Override
- protected void setup() {
- createTableLayout();
- form = new Form();
-
- tablePanel = new Panel();
- tablePanel.setLayout(tableLayout);
-
- addComponent(tablePanel);
- }
-
- private void createTableLayout() {
- tableLayout = new VerticalLayout();
- table = new Table();
- table.addContainerProperty("name", String.class, "");
- table.addContainerProperty("age", String.class, "");
- for (int i = 0; i < 100; i++) {
- table.addItem(new Object[] { "Name " + i, String.valueOf(i) },
- new Object());
- }
- table.setImmediate(true);
- table.addListener(new ItemClickListener() {
-
- public void itemClick(ItemClickEvent event) {
- clicked(event.getItem());
- }
-
- });
-
- tableLayout.addComponent(table);
- }
-
- protected void clicked(Item item) {
- getLayout().replaceComponent(tablePanel, form);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.html b/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.html deleted file mode 100644 index 667f08ba4f..0000000000 --- a/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.html +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>HundredPercentWideLabelResize</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">HundredPercentWideLabelResize</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.label.HundredPercentWideLabelResize</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentslabelHundredPercentWideLabelResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentslabelHundredPercentWideLabelResize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java b/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java deleted file mode 100644 index d494ac176e..0000000000 --- a/src/com/vaadin/tests/components/label/HundredPercentWideLabelResize.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.components.label;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class HundredPercentWideLabelResize extends TestBase {
-
- @Override
- protected String getDescription() {
- return "100% wide label re-wrap should cause re-layout; forceLayout fixes this.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2514;
- }
-
- @Override
- protected void setup() {
- getLayout().setWidth("500px");
- Label text = new Label(
- "This is a fairly long text that will wrap if the width of the layout is narrow enough. Directly below the text is a Button - however, when the layout changes size, the Label re-wraps w/o moving the button, causing eiter clipping or a big space.");
- text.setWidth("100%");
- getLayout().addComponent(text);
-
- getLayout().addComponent(
- new Button("toggle width", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- if (getLayout().getWidth() == 500) {
- getLayout().setWidth("100px");
- } else {
- getLayout().setWidth("500px");
- }
-
- }
-
- }));
- }
-
-}
diff --git a/src/com/vaadin/tests/components/label/LabelWrapping.html b/src/com/vaadin/tests/components/label/LabelWrapping.html deleted file mode 100644 index b8038a75b4..0000000000 --- a/src/com/vaadin/tests/components/label/LabelWrapping.html +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>LabelWrapping</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">LabelWrapping</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.label.LabelWrapping</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentslabelLabelWrapping::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentslabelLabelWrapping::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/label/LabelWrapping.java b/src/com/vaadin/tests/components/label/LabelWrapping.java deleted file mode 100644 index d702f2440d..0000000000 --- a/src/com/vaadin/tests/components/label/LabelWrapping.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.vaadin.tests.components.label;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class LabelWrapping extends TestBase {
-
- @Override
- protected String getDescription() {
- return "A label inside a limited HorizontalLayout should strive to be as wide as possible and only wrap when the size of the layout is reached. The label should look the same if it is rendered initially with the layout or updated later on.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2478;
- }
-
- @Override
- protected void setup() {
- HorizontalLayout hl = new HorizontalLayout();
- hl.setWidth("250px");
-
- final String longString = "this is a somewhat long string.";
- final Label longLabel = new Label(longString);
-
- Button changeLength = new Button("Change length");
- changeLength.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- if (longLabel.getValue().equals(longString)) {
- longLabel.setValue("");
- } else {
- longLabel.setValue(longString);
- }
- }
- });
-
- hl.addComponent(longLabel);
- hl.addComponent(changeLength);
-
- addComponent(hl);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/link/LinkIcon.java b/src/com/vaadin/tests/components/link/LinkIcon.java deleted file mode 100644 index 372417a45c..0000000000 --- a/src/com/vaadin/tests/components/link/LinkIcon.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.components.link;
-
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Link;
-
-public class LinkIcon extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The icon of a Link component should have the same cursor as the text and should be clickable";
- }
-
- @Override
- protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected void setup() {
- Link l = new Link("www.google.com", new ExternalResource(
- "http://www.vaadin.com/"));
- l.setIcon(new ThemeResource("../runo/icons/32/calendar.png"));
-
- addComponent(l);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/link/LinkTargetSize.java b/src/com/vaadin/tests/components/link/LinkTargetSize.java deleted file mode 100644 index d5542cab04..0000000000 --- a/src/com/vaadin/tests/components/link/LinkTargetSize.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.components.link;
-
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Link;
-
-public class LinkTargetSize extends TestBase {
-
- @Override
- protected String getDescription() {
- return "This link should open a small window w/o decorations";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2524;
- }
-
- @Override
- protected void setup() {
- Link l = new Link("Try it!", new ExternalResource(
- "http://www.google.com/m"));
- l.setTargetName("_blank");
- l.setTargetWidth(300);
- l.setTargetHeight(300);
- l.setTargetBorder(Link.TARGET_BORDER_NONE);
- addComponent(l);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/loginform/LoginFormTest.java b/src/com/vaadin/tests/components/loginform/LoginFormTest.java deleted file mode 100644 index f8e8b96f62..0000000000 --- a/src/com/vaadin/tests/components/loginform/LoginFormTest.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.vaadin.tests.components.loginform; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.LoginForm; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.LoginForm.LoginEvent; -import com.vaadin.ui.LoginForm.LoginListener; - -public class LoginFormTest extends TestBase { - - private LoginForm loginForm; - - @Override - protected void setup() { - loginForm = new LoginForm(); - getLayout().setSizeFull(); - loginForm.addListener(new LoginListener() { - - /** - * - */ - private static final long serialVersionUID = 1L; - - public void onLogin(LoginEvent event) { - login(event.getLoginParameter("user"), event - .getLoginParameter("password")); - - } - }); - addComponent(loginForm); - - } - - protected void login(String user, String password) { - Label info = new Label("User '" + user + "', password='" + password - + "' logged in"); - getLayout().removeAllComponents(); - getLayout().addComponent(info); - getLayout().addComponent(new Button("Log out", new ClickListener() { - - public void buttonClick(ClickEvent event) { - getLayout().removeAllComponents(); - getLayout().addComponent(loginForm); - } - - })); - - } - - @Override - protected String getDescription() { - return "Basic test for the LoginForm component. The login form should be visible. Entering a username+password and clicking 'login' should replace the login form with a label telling the user name as password. Also a logout button should then be shown and pressing that takes the user back to the original screen with the LoginForm"; - } - - @Override - protected Integer getTicketNumber() { - return 3597; - } - -} diff --git a/src/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java b/src/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java deleted file mode 100644 index ccb5b10c08..0000000000 --- a/src/com/vaadin/tests/components/optiongroup/OptionGroupMultipleValueChange.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.components.optiongroup; - -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.OptionGroup; - -public class OptionGroupMultipleValueChange extends TestBase { - - @Override - protected String getDescription() { - return "Clicking on the description of an option should behave exactly like clicking on the radio button. No extra 'null' valuechange event should be sent"; - } - - @Override - protected Integer getTicketNumber() { - return 3066; - } - - @Override - protected void setup() { - final OptionGroup og = new OptionGroup(); - og - .addItem("Clicking on the text might cause an extra valuechange event"); - og.addItem("Second option, same thing"); - og.setImmediate(true); - addComponent(og); - - final Label events = new Label("", Label.CONTENT_PREFORMATTED); - events.setWidth(null); - addComponent(events); - - og.addListener(new Property.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - String s = "ValueChange: " + event.getProperty().getValue(); - events.setValue(events.getValue() + "\n" + s); - } - }); - } -} diff --git a/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.html b/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.html deleted file mode 100644 index 7a071030dc..0000000000 --- a/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.html +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ReplaceComponentNPE</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ReplaceComponentNPE</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.orderedlayout.ReplaceComponentNPE</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsorderedlayoutReplaceComponentNPE::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.java b/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.java deleted file mode 100644 index c081382ee1..0000000000 --- a/src/com/vaadin/tests/components/orderedlayout/ReplaceComponentNPE.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.components.orderedlayout;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class ReplaceComponentNPE extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Clicking 'ReplaceComponent' should replace the 'Button' button with a VericalLayout, and move the button inside the verticalLayout. Visually this can be seen by the added margins of the VerticalLayout.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3195;
- }
-
- final Button button = new Button("Button");
- final VerticalLayout outer = new VerticalLayout();
-
- @Override
- protected void setup() {
- outer.setMargin(true);
-
- Button changer = new Button("ReplaceComponent");
- changer.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- getLayout().replaceComponent(button, outer);
- outer.addComponent(button);
- }
- });
-
- getLayout().addComponent(button);
- getLayout().addComponent(changer);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java b/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java deleted file mode 100644 index 982cbced5b..0000000000 --- a/src/com/vaadin/tests/components/panel/PanelShouldRemoveActionHandler.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.vaadin.tests.components.panel; - -import java.util.ArrayList; -import java.util.List; - -import com.vaadin.event.Action; -import com.vaadin.event.ShortcutAction; -import com.vaadin.event.Action.Handler; -import com.vaadin.event.ShortcutAction.ModifierKey; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; - -public class PanelShouldRemoveActionHandler extends TestBase { - - private Panel panel; - - @Override - protected String getDescription() { - return "Adding action handlers to the panel should make them appear on the client side. Removing the action handlers should remove them also from the client side, also if all action handlers are removed."; - } - - @Override - protected Integer getTicketNumber() { - return 2941; - } - - @Override - protected void setup() { - panel = new Panel("A panel"); - panel.addComponent(new TextField()); - Button add = new Button("Add an action handler", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - add(); - } - - }); - Button addAnother = new Button("Add another action handler", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - addAnother(); - } - - }); - Button remove = new Button("Remove an action handler", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - remove(); - } - - }); - - addComponent(panel); - addComponent(add); - addComponent(addAnother); - addComponent(remove); - } - - public void remove() { - panel.setCaption(panel.getCaption() + " - Removed handler"); - panel.removeActionHandler(actionHandlers - .remove(actionHandlers.size() - 1)); - } - - private List<Handler> actionHandlers = new ArrayList<Handler>(); - - public void add() { - panel.setCaption(panel.getCaption() + " - Added handler"); - Handler actionHandler = new Handler() { - - public Action[] getActions(Object target, Object sender) { - return new Action[] { new ShortcutAction("Ctrl+Left", - ShortcutAction.KeyCode.ARROW_LEFT, - new int[] { ModifierKey.CTRL }) }; - } - - public void handleAction(Action action, Object sender, Object target) { - getMainWindow().showNotification( - "Handling action " + action.getCaption()); - } - - }; - - addHandler(actionHandler); - } - - public void addAnother() { - Handler actionHandler = new Handler() { - - public Action[] getActions(Object target, Object sender) { - return new Action[] { new ShortcutAction("Ctrl+Right", - ShortcutAction.KeyCode.ARROW_RIGHT, - new int[] { ModifierKey.CTRL }) }; - } - - public void handleAction(Action action, Object sender, Object target) { - getMainWindow().showNotification( - "Handling action " + action.getCaption()); - } - - }; - - addHandler(actionHandler); - } - - private void addHandler(Handler actionHandler) { - actionHandlers.add(actionHandler); - panel.addActionHandler(actionHandler); - panel.setCaption("A panel with " + actionHandlers.size() - + " action handlers"); - - } -} diff --git a/src/com/vaadin/tests/components/popupview/PopupViewLabelResized.java b/src/com/vaadin/tests/components/popupview/PopupViewLabelResized.java deleted file mode 100644 index 52bdd47790..0000000000 --- a/src/com/vaadin/tests/components/popupview/PopupViewLabelResized.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.components.popupview;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.PopupView;
-
-public class PopupViewLabelResized extends TestBase {
-
- @Override
- protected String getDescription() {
- return "When clicking on the popup view on the left, its size should not change.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3483;
- }
-
- @Override
- protected void setup() {
- GridLayout gl = new GridLayout(3, 1);
- gl.setSizeFull();
-
- Label expander = new Label();
- gl.addComponent(expander, 1, 0);
- gl.setColumnExpandRatio(1, 1);
-
- gl.addComponent(
- new PopupView("Click here to popup", new Label("test")), 0, 0);
- gl.addComponent(
- new PopupView("Click here to popup", new Label("test")), 2, 0);
-
- addComponent(gl);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/popupview/PopupViewNullValues.java b/src/com/vaadin/tests/components/popupview/PopupViewNullValues.java deleted file mode 100644 index 30fa028c40..0000000000 --- a/src/com/vaadin/tests/components/popupview/PopupViewNullValues.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.vaadin.tests.components.popupview;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.PopupView;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Window.Notification;
-
-public class PopupViewNullValues extends TestBase {
-
- private PopupView pv[] = new PopupView[4];
- private Button b[] = new Button[4];
-
- @Override
- protected void setup() {
- try {
- pv[0] = new PopupView("Popupview 1 - no component", null);
- addComponent(pv[0]);
- b[0] = new Button("Open popupview 1", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- pv[0].setPopupVisible(true);
- }
-
- });
- } catch (Exception e) {
- getMainWindow()
- .showNotification(
- "Error, 'null content' should not throw an exception at this point",
- Notification.TYPE_ERROR_MESSAGE);
- }
-
- try {
- pv[1] = new PopupView(null, new TextField(
- "Empty html, contains component"));
- addComponent(pv[1]);
- b[1] = new Button("Open popupview 2", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- pv[1].setPopupVisible(true);
- }
-
- });
- } catch (Exception e) {
- getMainWindow()
- .showNotification(
- "Error, 'null html', should not throw an exception at this point",
- Notification.TYPE_ERROR_MESSAGE);
- }
-
- try {
- pv[2] = new PopupView(null, null);
- addComponent(pv[2]);
- b[2] = new Button("Open popupview 3", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- pv[2].setPopupVisible(true);
- }
-
- });
- } catch (Exception e) {
- getMainWindow()
- .showNotification(
- "Error, 'null html, null content', should not throw an exception at this point",
- Notification.TYPE_ERROR_MESSAGE);
- }
- try {
- pv[3] = new PopupView("Popupview 4 - has component", new TextField(
- "This is the content of popupview 4"));
- addComponent(pv[3]);
- b[3] = new Button("Open popupview 4", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- pv[3].setPopupVisible(true);
- }
-
- });
- } catch (Exception e) {
- getMainWindow()
- .showNotification(
- "Error, 'null html, null content', should not throw an exception at this point",
- Notification.TYPE_ERROR_MESSAGE);
- }
-
- addComponent(b[0]);
- addComponent(b[1]);
- addComponent(b[2]);
- addComponent(b[3]);
- }
-
- @Override
- protected String getDescription() {
- return "This test case contains 3 popupviews. Only the second and the forth popup views have non-null components and can be opened. 1 and 3 will produce an exception if you try to open them.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3248;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.html b/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.html deleted file mode 100644 index 99ee864179..0000000000 --- a/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.html +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>PopupViewOffScreen</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">PopupViewOffScreen</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.popupview.PopupViewOffScreen</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentspopupviewPopupViewOffScreen::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VGridLayout[0]/AbsolutePanel[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java b/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java deleted file mode 100644 index 194c76d9df..0000000000 --- a/src/com/vaadin/tests/components/popupview/PopupViewOffScreen.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.vaadin.tests.components.popupview; - -import java.util.ArrayList; -import java.util.List; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.tests.util.LoremIpsum; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.PopupView; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class PopupViewOffScreen extends TestBase { - - private List<PopupView> popupViews = new ArrayList<PopupView>(); - - @Override - protected String getDescription() { - return "A popupview should be displayed on screen. If the popup position is close to a border it should be moved so it is still on screen."; - } - - @Override - protected Integer getTicketNumber() { - return 3099; - } - - @Override - protected void setup() { - GridLayout gl = new GridLayout(3, 3); - gl.setSizeFull(); - Label expander = new Label(); - gl.addComponent(expander, 1, 1); - gl.setColumnExpandRatio(1, 1); - gl.setRowExpandRatio(1, 1); - - Button showall = new Button("Popup all", new ClickListener() { - - public void buttonClick(ClickEvent event) { - for (PopupView pv : popupViews) { - pv.setPopupVisible(true); - } - } - }); - gl.addComponent(showall, 1, 0); - gl.addComponent(createPopupView("red"), 0, 0); - gl.addComponent(createPopupView("green"), 2, 0); - gl.addComponent(createPopupView("blue"), 0, 2); - gl.addComponent(createPopupView("yellow"), 2, 2); - - addComponent(gl); - gl.getParent().setSizeFull(); - } - - private Component createPopupView(String bg) { - VerticalLayout vl = new VerticalLayout(); - vl.setSpacing(false); - vl.setMargin(false); - vl.setSizeFull(); - - Panel p = new Panel(vl); - p.setWidth("400px"); - p.setHeight("400px"); - - Label l = new Label( - "<div style='width: 100%; height: 100%; background: " + bg - + "'>" + LoremIpsum.get(2000) + "</div>", - Label.CONTENT_XHTML); - l.setSizeFull(); - p.addComponent(l); - PopupView pv = new PopupView("Click here to popup", p); - - popupViews.add(pv); - return pv; - } -} diff --git a/src/com/vaadin/tests/components/popupview/PopupViewWithRTE.java b/src/com/vaadin/tests/components/popupview/PopupViewWithRTE.java deleted file mode 100644 index 06319a5019..0000000000 --- a/src/com/vaadin/tests/components/popupview/PopupViewWithRTE.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.vaadin.tests.components.popupview;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.PopupView;
-import com.vaadin.ui.RichTextArea;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.PopupView.Content;
-
-public class PopupViewWithRTE extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Rich text editor should work properly in popupview. Try to edit text below.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3043;
- }
-
- @Override
- protected void setup() {
- PopupView pv = new PopupView(new Content() {
-
- RichTextArea rte = new RichTextArea();
-
- VerticalLayout vl = new VerticalLayout();
-
- public String getMinimizedValueAsHTML() {
- Object value = rte.getValue();
- if (value == null || "".equals(value)) {
- value = "Initial <b>content</b> for <h3>rte</h3>.";
- rte.setValue(value);
- rte.setHeight("150px");
- rte.setWidth("100%");
- vl.addComponent(rte);
- vl.setWidth("600px");
- }
- return value.toString();
- }
-
- public Component getPopupComponent() {
- return vl;
- }
- });
- getLayout().addComponent(pv);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html b/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html deleted file mode 100644 index 7708c88e54..0000000000 --- a/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>RichTextAreaSize</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">RichTextAreaSize</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.richtextarea.RichTextAreaSize</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java b/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java deleted file mode 100644 index ce8dcb4df8..0000000000 --- a/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.components.richtextarea; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.VerticalLayout; - -public class RichTextAreaSize extends TestBase { - - @Override - protected String getDescription() { - return "Test the size of a rich text area. The first area is 100px*100px wide, the second 100%*100% (of 200x200px), the third one has undefined width and height."; - } - - @Override - protected Integer getTicketNumber() { - return 2573; - } - - @Override - protected void setup() { - HorizontalLayout main = new HorizontalLayout(); - getMainWindow().setContent(main); - - RichTextArea first = new RichTextArea(); - RichTextArea second = new RichTextArea(); - RichTextArea third = new RichTextArea(); - - first.setWidth("100px"); - first.setHeight("100px"); - second.setSizeFull(); - third.setSizeUndefined(); - - VerticalLayout secondLayout = new VerticalLayout(); - secondLayout.setWidth("200px"); - secondLayout.setHeight("200px"); - secondLayout.addComponent(second); - - main.addComponent(first); - main.addComponent(secondLayout); - main.addComponent(third); - } - -} diff --git a/src/com/vaadin/tests/components/select/NullSelectionItemId.java b/src/com/vaadin/tests/components/select/NullSelectionItemId.java deleted file mode 100644 index f42995a601..0000000000 --- a/src/com/vaadin/tests/components/select/NullSelectionItemId.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.vaadin.tests.components.select;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class NullSelectionItemId extends TestBase implements ClickListener {
-
- private static final String NULL_ITEM_ID = "Null item id";
-
- private Select mySelect;
-
- @Override
- protected void setup() {
-
- mySelect = new Select("My Select");
-
- // add items
- mySelect.addItem(NULL_ITEM_ID);
- mySelect.addItem("Another item");
-
- // allow null and set the null item id
- mySelect.setNullSelectionAllowed(true);
- mySelect.setNullSelectionItemId(NULL_ITEM_ID);
-
- // select the null item
- mySelect.select(NULL_ITEM_ID);
-
- Button button = new Button("Show selected value", this);
-
- addComponent(mySelect);
- addComponent(button);
-
- }
-
- public void buttonClick(ClickEvent event) {
- this.getMainWindow().showNotification(
- "mySelect.getValue() returns: " + mySelect.getValue());
- }
-
- @Override
- protected String getDescription() {
- return "Steps to reproduce:<br />"
- + "<ol><li>Click the button -> value is the item id \"Null item id\".</li>"
- + "<li>Select the \"Another item\".</li>"
- + "<li>Select back the first item.</li>"
- + "<li>Click the button -> the value is null</li></ol>";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3203;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.html b/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.html deleted file mode 100644 index e8e7395198..0000000000 --- a/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.html +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>SplitPanelExtraScrollbars</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">SplitPanelExtraScrollbars</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.splitpanel.SplitPanelExtraScrollbars</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentssplitpanelSplitPanelExtraScrollbars::/VSplitPanelHorizontal[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VNativeButton[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.java b/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.java deleted file mode 100644 index 9d9800eeaf..0000000000 --- a/src/com/vaadin/tests/components/splitpanel/SplitPanelExtraScrollbars.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.vaadin.tests.components.splitpanel;
-import com.vaadin.terminal.Sizeable;
-import com.vaadin.tests.components.AbstractTestCase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.NativeButton;
-import com.vaadin.ui.SplitPanel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class SplitPanelExtraScrollbars extends AbstractTestCase implements
- ClickListener {
-
- private SplitPanel sp;
- private HorizontalLayout hl;
- private Button b;
-
- @Override
- public void init() {
- sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
- sp.setSizeFull();
- sp.setSplitPosition(0, Sizeable.UNITS_PIXELS);
-
- hl = new HorizontalLayout();
- hl.setMargin(true);
- hl.setWidth("100%");
- hl.setHeight(null);
-
- b = createButton("200px");
- sp.setSecondComponent(hl);
- hl.addComponent(b);
-
- Window w = new Window("Test", sp);
- setMainWindow(w);
- }
-
- private Button createButton(String height) {
- Button b = new NativeButton("A BIG button");
- b.setHeight(height);
- b.addListener(this);
- return b;
- }
-
- @Override
- protected String getDescription() {
- return "Click the button to change its height. Making the button higher than the browser should not cause vertical but not horizontal scrollbars to appear.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3458;
- }
-
- public void buttonClick(ClickEvent event) {
- if (b.getHeight() == 200) {
- b.setHeight("1200px");
- } else {
- b.setHeight("200px");
- }
-
- // Sending all changes in one repaint triggers the bug
- hl.requestRepaint();
- sp.requestRepaint();
- }
-
-}
diff --git a/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java b/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java deleted file mode 100644 index 89008754ba..0000000000 --- a/src/com/vaadin/tests/components/splitpanel/SplitPanelSplitterWidth.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.components.splitpanel; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Panel; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window.Notification; - -public class SplitPanelSplitterWidth extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2510; - } - - @Override - protected String getDescription() { - return "SplitPanel splitter is effectively a 1px wide target after unlocking previously locked splitter."; - } - - @Override - protected void setup() { - final SplitPanel split = new SplitPanel( - SplitPanel.ORIENTATION_HORIZONTAL); - split.setWidth("200px"); - split.setHeight("200px"); - split.setLocked(true); - Panel p = new Panel("Left"); - p.setSizeFull(); - split.addComponent(p); - p = new Panel("Right"); - p.setSizeFull(); - split.addComponent(p); - - final SplitPanel split2 = new SplitPanel(); - split2.setWidth("200px"); - split2.setHeight("200px"); - split2.setLocked(true); - p = new Panel("Top"); - p.setSizeFull(); - split2.addComponent(p); - p = new Panel("Bottom"); - p.setSizeFull(); - split2.addComponent(p); - - getLayout().addComponent( - new Button("Unlock", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - split.setLocked(false); - split2.setLocked(false); - getMainWindow().showNotification( - "Try moving split. Then reload page.", - Notification.TYPE_WARNING_MESSAGE); - getLayout().removeComponent(event.getButton()); - } - - })); - getLayout().addComponent(split); - getLayout().addComponent(split2); - - } -} diff --git a/src/com/vaadin/tests/components/splitpanel/SplitPanelWidthOnResize.java b/src/com/vaadin/tests/components/splitpanel/SplitPanelWidthOnResize.java deleted file mode 100644 index b49131b94f..0000000000 --- a/src/com/vaadin/tests/components/splitpanel/SplitPanelWidthOnResize.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.components.splitpanel;
-
-import com.vaadin.terminal.Sizeable;
-import com.vaadin.tests.components.AbstractTestCase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.NativeButton;
-import com.vaadin.ui.SplitPanel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-public class SplitPanelWidthOnResize extends AbstractTestCase {
-
- @Override
- public void init() {
- VerticalLayout layout = new VerticalLayout();
- layout.setSizeFull();
- Window w = new Window("", layout);
- setMainWindow(w);
- SplitPanel splitPanel = new SplitPanel(
- SplitPanel.ORIENTATION_HORIZONTAL);
- Button button = new NativeButton("A huge button");
- button.setSizeFull();
- TextField textField = new TextField("A small textfield");
-
- splitPanel.setFirstComponent(button);
- splitPanel.setSecondComponent(textField);
- splitPanel.setSizeFull();
- splitPanel.setSplitPosition(100, Sizeable.UNITS_PERCENTAGE);
-
- layout.addComponent(splitPanel);
- }
-
- @Override
- protected String getDescription() {
- return "Make the browser window smaller and then larger again. The huge button should always stay visible and the TextField should never be shown.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3322;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/table/ClippedComponentsInTable.html b/src/com/vaadin/tests/components/table/ClippedComponentsInTable.html deleted file mode 100644 index 4a6ccbbe2d..0000000000 --- a/src/com/vaadin/tests/components/table/ClippedComponentsInTable.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ClippedComponentsInTable</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ClippedComponentsInTable</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.ClippedComponentsInTable</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/ClippedComponentsInTable.java b/src/com/vaadin/tests/components/table/ClippedComponentsInTable.java deleted file mode 100644 index 8b6775cc74..0000000000 --- a/src/com/vaadin/tests/components/table/ClippedComponentsInTable.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-
-public class ClippedComponentsInTable extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The table below should display 3 rows. Each with a textfield containing the row number.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return null;
- }
-
- @Override
- protected void setup() {
- Table t = new Table();
- addComponent(t);
-
- t.addContainerProperty("Name", TextField.class, null);
- t.addContainerProperty("Button", Button.class, null);
-
- for (int i = 0; i < 3; i++) {
- Item item = t.addItem(i);
- TextField tf = new TextField("", String.valueOf(i + 1));
- tf.setColumns(10);
- item.getItemProperty("Name").setValue(tf);
-
- Button b = new Button("OK");
- item.getItemProperty("Button").setValue(b);
- }
-
- }
-}
diff --git a/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html b/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html deleted file mode 100644 index 9e529836b6..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ColumnCollapsingAndColumnExpansion</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ColumnCollapsingAndColumnExpansion</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.ColumnCollapsingAndColumnExpansion</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<!--Initial state, all 3 columns visible--> -<tr> - <td>screenCapture</td> - <td></td> - <td>col1-col2-col3-visible</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<!--Hide 'col2' through table interface--> -<tr> - <td>click</td> - <td>//td[@id='gwt-uid-2']/span/div</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>col2-hidden</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<!--Hide 'Col1' using button--> -<tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td> - <td>Col1</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>col1-col2-hidden</td> -</tr> -<!--Show 'col2' using action handler--> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>contextmenu</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VContextMenu[0]#option0</td> - <td>11,6</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td> - <td>Col2</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>col1-hidden</td> -</tr> -<!--Show 'Col1' using button--> -<tr> - <td>enterCharacter</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td> - <td>Col1</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<!--We should now be back at the initial state, all 3 columns visible--> -<tr> - <td>screenCapture</td> - <td></td> - <td>col1-col2-col3-visible-again</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java b/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java deleted file mode 100644 index 11a111acf8..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.event.Action;
-import com.vaadin.event.Action.Handler;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class ColumnCollapsingAndColumnExpansion extends TestBase {
-
- private Table table;
-
- @Override
- public void setup() {
-
- table = new Table();
-
- table.addContainerProperty("Col1", String.class, null);
- table.addContainerProperty("Col2", String.class, null);
- table.addContainerProperty("Col3", String.class, null);
- table.setColumnCollapsingAllowed(true);
-
- table.addActionHandler(new Handler() {
-
- final Action H = new Action("Toggle Col2");
- final Action[] actions = new Action[] { H };
-
- public Action[] getActions(Object target, Object sender) {
- return actions;
- }
-
- public void handleAction(Action action, Object sender, Object target) {
- try {
- table.setColumnCollapsed("Col2", !table
- .isColumnCollapsed("Col2"));
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- });
-
- table.setSizeFull();
-
- for (int y = 1; y < 5; y++) {
- table.addItem(new Object[] { "cell " + 1 + "-" + y,
- "cell " + 2 + "-" + y, "cell " + 3 + "-" + y, },
- new Object());
- }
-
- addComponent(table);
-
- HorizontalLayout hl = new HorizontalLayout();
- final TextField tf = new TextField("Column name (ColX)");
- Button hide = new Button("Collapse", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- try {
- table.setColumnCollapsed(tf.getValue(), true);
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- });
-
- Button show = new Button("Show", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- try {
- table.setColumnCollapsed(tf.getValue(), false);
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- });
-
- hl.addComponent(tf);
- hl.addComponent(hide);
- hl.addComponent(show);
- hl.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
- hl.setComponentAlignment(hide, Alignment.BOTTOM_LEFT);
- hl.setComponentAlignment(show, Alignment.BOTTOM_LEFT);
- addComponent(hl);
-
- }
-
- @Override
- protected String getDescription() {
- return "After hiding column 2 the remaining columns (1 and 3) should use all available space in the table";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3246;
- }
-}
diff --git a/src/com/vaadin/tests/components/table/ColumnExpandRatio.html b/src/com/vaadin/tests/components/table/ColumnExpandRatio.html deleted file mode 100644 index 6d5422831e..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnExpandRatio.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ColumnExpandRatio</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ColumnExpandRatio</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.ColumnExpandRatio</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/ColumnExpandRatio.java b/src/com/vaadin/tests/components/table/ColumnExpandRatio.java deleted file mode 100644 index be176d83fa..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnExpandRatio.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; - -public class ColumnExpandRatio extends TestBase { - - @Override - protected String getDescription() { - return "Column expand ratios can be used to adjust the way " - + "how excess horizontal space is divided among columns."; - - } - - @Override - protected Integer getTicketNumber() { - return 2806; - } - - private static final int ROWS = 100; - - @Override - public void setup() { - Table table1 = initTable(); - addComponent(new Label("Plain table")); - addComponent(table1); - - } - - private Table initTable() { - Table table = new Table(); - table.setWidth("100%"); - - IndexedContainer idx = new IndexedContainer(); - idx.addContainerProperty("firstname", String.class, null); - idx.addContainerProperty("lastname", String.class, null); - Item i = idx.addItem(1); - i.getItemProperty("firstname").setValue("John"); - i.getItemProperty("lastname").setValue("Johnson"); - - i = idx.addItem(2); - i.getItemProperty("firstname").setValue("Jane"); - i.getItemProperty("lastname").setValue("Janeine"); - - for (int index = 3; index < ROWS; index++) { - i = idx.addItem(index); - i.getItemProperty("firstname").setValue("Jane"); - i.getItemProperty("lastname").setValue("Janeine"); - } - - idx.addContainerProperty("fixed 50px column", String.class, ""); - - idx.addContainerProperty("Expanded with 2", String.class, "foobar"); - - table.setContainerDataSource(idx); - - table.setColumnHeader("firstname", "FirstName"); - table.setColumnHeader("lastname", "LastName (1)"); - - table.setColumnWidth("fixed 50px column", 50); - table.setColumnExpandRatio("Expanded with 2", 2); - table.setColumnExpandRatio("lastname", 1); - - return table; - } - -} diff --git a/src/com/vaadin/tests/components/table/ColumnExpandWithFixedColumns.html b/src/com/vaadin/tests/components/table/ColumnExpandWithFixedColumns.html deleted file mode 100644 index eb338c8dde..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnExpandWithFixedColumns.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ColumnExpandWithFixedColumns</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ColumnExpandWithFixedColumns</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.ColumnExpandWithFixedColumns</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/ColumnExpandWithFixedColumns.java b/src/com/vaadin/tests/components/table/ColumnExpandWithFixedColumns.java deleted file mode 100644 index f0c3779a4e..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnExpandWithFixedColumns.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-
-public class ColumnExpandWithFixedColumns extends TestBase {
-
- private Table createTable() {
- Table t = new Table();
- t.addContainerProperty("id", Integer.class, null);
- t.addContainerProperty("txt", Component.class, null);
- t.addContainerProperty("button", Button.class, null);
- t.setColumnWidth("id", 30);
- t.setColumnWidth("button", 200);
- t.setColumnExpandRatio("txt", 10);// This column should be 400px wide.
- t.setSelectable(true);
- t.setSizeFull();
-
- for (int i = 0; i < 10; i++) {
- t.addItem(new Object[] { i, new Label("test " + i),
- new Button("Button " + i) }, i);
- }
-
- return t;
-
- }
-
- @Override
- protected String getDescription() {
- return "The second coulmn has expand ratio and should use the maximum available space";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3143;
- }
-
- @Override
- protected void setup() {
- addComponent(createTable());
- }
-}
diff --git a/src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java b/src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java deleted file mode 100644 index d3dfa61ceb..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnGeneratorAddingOrder.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Table; - -public class ColumnGeneratorAddingOrder extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2457; - } - - @Override - protected String getDescription() { - return "Column generator must be allowed to be added both before and after data source setting and overriding should work. Bugs in 5.3-rc7 if added after DS."; - } - - @Override - protected void setup() { - Table t = new Table(); - - t.addGeneratedColumn("col2", new Table.ColumnGenerator() { - public Component generateCell(Table source, Object itemId, - Object columnId) { - return new Button("generated b c2"); - } - }); - - IndexedContainer c = new IndexedContainer(); - c.addContainerProperty("col1", String.class, "col1 ds data"); - c.addContainerProperty("col2", String.class, "col2 ds data"); - c.addContainerProperty("col3", String.class, "col3 ds data"); - for (int i = 0; i < 100; i++) { - c.addItem(); - } - t.setContainerDataSource(c); - - t.addGeneratedColumn("col1", new Table.ColumnGenerator() { - public Component generateCell(Table source, Object itemId, - Object columnId) { - return new Button("generated b c1"); - } - }); - - getLayout().addComponent(t); - - } - -} diff --git a/src/com/vaadin/tests/components/table/ColumnWidths.java b/src/com/vaadin/tests/components/table/ColumnWidths.java deleted file mode 100644 index 9fe7a98179..0000000000 --- a/src/com/vaadin/tests/components/table/ColumnWidths.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; - -public class ColumnWidths extends TestBase { - - @Override - protected String getDescription() { - return "On window resize undefined " - + "columns (by server or user (dragged)) columns " - + "must consume the excess space. Space is divided " - + "by default according to natural widths of columns." - + "In example last column is fixed width. Other columns" - + " should divide excess space relatively to 'natural' width unless user has resized column."; - - } - - @Override - protected Integer getTicketNumber() { - return 2804; - } - - private static final int ROWS = 100; - - @Override - public void setup() { - Table table1 = initTable(); - addComponent(new Label("Plain table")); - addComponent(table1); - - } - - private Table initTable() { - Table table = new Table(); - table.setWidth("100%"); - - IndexedContainer idx = new IndexedContainer(); - idx.addContainerProperty("firstname", String.class, null); - idx.addContainerProperty("lastname", String.class, null); - Item i = idx.addItem(1); - i.getItemProperty("firstname").setValue("John"); - i.getItemProperty("lastname").setValue("Johnson"); - i = idx.addItem(2); - i.getItemProperty("firstname").setValue("Jane"); - i.getItemProperty("lastname").setValue("Janeine"); - - for (int index = 3; index < ROWS; index++) { - i = idx.addItem(index); - i.getItemProperty("firstname").setValue("Jane"); - i.getItemProperty("lastname").setValue("Janeine"); - } - - idx.addContainerProperty("150pxfixedCol", String.class, "foobar"); - - table.setContainerDataSource(idx); - - table.setColumnHeader("firstname", "FirstName"); - table.setColumnHeader("lastname", "LastName with long header"); - - table.setColumnWidth("150pxfixedCol", 150); - - return table; - } - -} diff --git a/src/com/vaadin/tests/components/table/ContainerSizeChange.html b/src/com/vaadin/tests/components/table/ContainerSizeChange.html deleted file mode 100644 index 7c2374f322..0000000000 --- a/src/com/vaadin/tests/components/table/ContainerSizeChange.html +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>ContainerSizeChange</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">ContainerSizeChange</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.ContainerSizeChange</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableContainerSizeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableContainerSizeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentstableContainerSizeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td> - <td>945</td> -</tr> -<tr> - <td>pause</td> - <td>300</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentstableContainerSizeChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]</td> - <td>525</td> -</tr> -<tr> - <td>pause</td> - <td>300</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/ContainerSizeChange.java b/src/com/vaadin/tests/components/table/ContainerSizeChange.java deleted file mode 100644 index 567cde8a54..0000000000 --- a/src/com/vaadin/tests/components/table/ContainerSizeChange.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Table; -import com.vaadin.ui.Button.ClickEvent; - -public class ContainerSizeChange extends TestBase { - - private Table table; - private MyDataSource ds; - - @Override - protected String getDescription() { - return "A table should be able to handle a decrease in the size of the container. The original container here contains 50 items and the decrease button removes 10 of these. To reproduce the problem: Click 'Decrease size' two times to reduce size to 30 and scroll to the end (50). What should happen is the table should notice the container size has decreased and show the last items which now exists in the new container."; - } - - @Override - protected Integer getTicketNumber() { - return 2862; - } - - @Override - protected void setup() { - table = new Table("A table"); - ds = new MyDataSource(); - table.setContainerDataSource(ds); - table.setPageLength(5); - addComponent(table); - - Button b = new Button("Decrease size", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - ds.decreaseSize(); - } - - }); - - addComponent(b); - - b = new Button("Increase size", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - ds.increaseSize(); - } - - }); - - addComponent(b); - - } - -} - -class MyDataSource extends IndexedContainer { - - private int size = 0; - - public MyDataSource() { - addContainerProperty("a", String.class, ""); - addContainerProperty("b", String.class, ""); - addContainerProperty("c", String.class, ""); - - for (int i = 0; i < 100; i++) { - Item item = addItem(String.valueOf(i)); - item.getItemProperty("a").setValue("a " + i); - item.getItemProperty("b").setValue("b " + i); - item.getItemProperty("c").setValue("c " + i); - } - size = 50; - } - - public void increaseSize() { - size += 10; - - } - - public void decreaseSize() { - if (size > 10) { - size -= 10; - } - - } - - @Override - public int size() { - return size; - } -} diff --git a/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.html b/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.html deleted file mode 100644 index e8dccea4e7..0000000000 --- a/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.html +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>LabelEmbeddedClickThroughForTable</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">LabelEmbeddedClickThroughForTable</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.LabelEmbeddedClickThroughForTable</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VLabel[1]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableLabelEmbeddedClickThroughForTable::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VLabel[1]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java b/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java deleted file mode 100644 index dc6cf53de7..0000000000 --- a/src/com/vaadin/tests/components/table/LabelEmbeddedClickThroughForTable.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.event.ItemClickEvent; -import com.vaadin.event.ItemClickEvent.ItemClickListener; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Component; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; - -public class LabelEmbeddedClickThroughForTable extends TestBase { - - @Override - protected String getDescription() { - return "Clicking on a Label or Embedded inside a Table should select the row in the same way that clicking on a text selects the row."; - } - - @Override - protected Integer getTicketNumber() { - return 2688; - } - - @Override - protected void setup() { - Table table = new Table(); - table.setSelectable(true); - table.addContainerProperty("Column 1", String.class, ""); - table.addContainerProperty("Column 2", Component.class, ""); - table.addContainerProperty("Column 3", Component.class, ""); - table.addContainerProperty("Column 4", Component.class, ""); - - Item item = table.addItem("Item 1 (row 1)"); - item.getItemProperty("Column 1").setValue("String A"); - item.getItemProperty("Column 2").setValue(new Label("Label A")); - item.getItemProperty("Column 3").setValue( - new Label("<b>Label A</b>", Label.CONTENT_XHTML)); - item.getItemProperty("Column 4").setValue( - new Embedded("An embedded image", new ThemeResource( - "../runo/icons/32/ok.png"))); - - item = table.addItem("Item 2 (row 2)"); - item.getItemProperty("Column 1").setValue("String B"); - item.getItemProperty("Column 2").setValue(new Label("Label B")); - item - .getItemProperty("Column 3") - .setValue( - new Label( - "<a href=\"http://www.vaadin.com\" target=_blank>Label A</a>", - Label.CONTENT_XHTML)); - item.getItemProperty("Column 4").setValue( - new Embedded("", new ThemeResource( - "../runo/icons/32/cancel.png"))); - - table.addListener(new ItemClickListener() { - - public void itemClick(ItemClickEvent event) { - getMainWindow().showNotification( - "Clickevent on item " + event.getItemId() - + ", column: " + event.getPropertyId()); - - } - - }); - addComponent(table); - } - -} diff --git a/src/com/vaadin/tests/components/table/MissingScrollbar.html b/src/com/vaadin/tests/components/table/MissingScrollbar.html deleted file mode 100644 index dfea329e60..0000000000 --- a/src/com/vaadin/tests/components/table/MissingScrollbar.html +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>MissingScrollbar</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">MissingScrollbar</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.MissingScrollbar</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableMissingScrollbar::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableMissingScrollbar::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/MissingScrollbar.java b/src/com/vaadin/tests/components/table/MissingScrollbar.java deleted file mode 100644 index 26ad70e79b..0000000000 --- a/src/com/vaadin/tests/components/table/MissingScrollbar.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.vaadin.tests.components.table; - -import java.io.Serializable; - -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Button.ClickEvent; - -public class MissingScrollbar extends TestBase { - - private Table table; - private IndexedContainer container50; - private IndexedContainer container2; - - @Override - protected String getDescription() { - return "Increasing the number of items to more than is displayed at once should show the scrollbar."; - } - - @Override - protected Integer getTicketNumber() { - return 3076; - } - - @Override - protected void setup() { - HorizontalLayout hl = new HorizontalLayout(); - - container50 = createContainer(50); - container2 = createContainer(2); - - table = new Table(); - table.setContainerDataSource(container2); - table.setPageLength(10); - - VerticalLayout buttonLayout = new VerticalLayout(); - buttonLayout.setWidth(null); - - Button b = new Button("Set items to 2", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - table.setContainerDataSource(container2); - } - }); - buttonLayout.addComponent(b); - - b = new Button("Set items to 50", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - table.setContainerDataSource(container50); - } - - }); - buttonLayout.addComponent(b); - - hl.addComponent(buttonLayout); - hl.addComponent(table); - - addComponent(hl); - } - - private static IndexedContainer createContainer(int items) { - IndexedContainer ic = new IndexedContainer(); - ic.addContainerProperty("License number", Integer.class, ""); - ic.addContainerProperty("First", String.class, ""); - ic.addContainerProperty("Last", String.class, ""); - - for (int i = 0; i < items; i++) { - Item item = ic.addItem("" + i); - item.getItemProperty("License number").setValue(i); - item.getItemProperty("First").setValue("First " + i); - item.getItemProperty("Last").setValue("Last " + i); - } - - return ic; - } - - private void writeObject(java.io.ObjectOutputStream out) throws Exception { - - out.defaultWriteObject(); - System.out.println("Serialize " + getClass().getName() + "(" - + (this instanceof Serializable) + ")"); - } -} diff --git a/src/com/vaadin/tests/components/table/ModifyContainerProperty.java b/src/com/vaadin/tests/components/table/ModifyContainerProperty.java deleted file mode 100644 index 0038e7f083..0000000000 --- a/src/com/vaadin/tests/components/table/ModifyContainerProperty.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Table;
-
-@SuppressWarnings("serial")
-public class ModifyContainerProperty extends TestBase {
-
- private Table table = new Table();
- private IndexedContainer ic = new IndexedContainer();
-
- @Override
- protected void setup() {
- addComponent(table);
-
- ic.addContainerProperty("one", String.class, "one");
- ic.addContainerProperty("two", String.class, "two");
-
- ic.addItem("foo");
-
- ic.getContainerProperty("foo", "one").setValue("bar");
- ic.getContainerProperty("foo", "two").setValue("baz");
-
- table.setContainerDataSource(ic);
- addComponent(new Button("Remove container property",
- new Button.ClickListener() {
- public void buttonClick(com.vaadin.ui.Button.ClickEvent arg0) {
- ic.removeContainerProperty("one");
- }
- }));
- addComponent(new Button("Add container property",
- new Button.ClickListener() {
- public void buttonClick(com.vaadin.ui.Button.ClickEvent arg0) {
- ic.addContainerProperty("three", String.class, "three");
- Object[] current = table.getVisibleColumns();
- Object[] vis = new Object[current.length + 1];
- for (int i = 0; i < current.length; i++) {
- vis[i] = current[i];
- }
- vis[current.length] = "three";
- table.setVisibleColumns(vis);
- }
- }));
- }
-
- @Override
- protected String getDescription() {
- return "Clicking on \"Add container property\" adds a property to the container and sets it visible. The table should then show a \"three\" column in addition to the others. Clicking on \"Remove container property\" should remove column \"two\" from the table.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3165;
- }
-}
diff --git a/src/com/vaadin/tests/components/table/NotselectablePaintSelections.java b/src/com/vaadin/tests/components/table/NotselectablePaintSelections.java deleted file mode 100644 index 9d3011365d..0000000000 --- a/src/com/vaadin/tests/components/table/NotselectablePaintSelections.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Table;
-
-public class NotselectablePaintSelections extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Table should paint selections even if it's not selectable.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3500;
- }
-
- @Override
- protected void setup() {
- // Multiselect
- Table t = new Table("Multiselect");
- addComponent(t);
- t.setSelectable(false);
- t.setMultiSelect(true);
- t.setPageLength(5);
- t.addContainerProperty("Name", String.class, null);
- Set<Object> selected = new HashSet<Object>();
- for (int i = 0; i < 30; i++) {
- Item item = t.addItem(i);
- item.getItemProperty("Name").setValue("Name " + i);
- if (i % 2 == 0) {
- selected.add(i);
- }
- }
- t.setValue(selected);
-
- // Singleselect
- t = new Table("Singleselect");
- addComponent(t);
- t.setSelectable(false);
- t.setMultiSelect(false);
- t.setPageLength(5);
- t.addContainerProperty("Name", String.class, null);
- for (int i = 0; i < 30; i++) {
- Item item = t.addItem(i);
- item.getItemProperty("Name").setValue("Name " + i);
- }
- t.setValue(3);
-
- }
-}
diff --git a/src/com/vaadin/tests/components/table/PropertyValueChange.html b/src/com/vaadin/tests/components/table/PropertyValueChange.html deleted file mode 100644 index 41f97ebb61..0000000000 --- a/src/com/vaadin/tests/components/table/PropertyValueChange.html +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>PropertyValueChange</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">PropertyValueChange</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.PropertyValueChange</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VFilterSelect[0]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[4]/td</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::PID_Seditortable/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td> - <td>9</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstablePropertyValueChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/PropertyValueChange.java b/src/com/vaadin/tests/components/table/PropertyValueChange.java deleted file mode 100644 index 353d2f13ef..0000000000 --- a/src/com/vaadin/tests/components/table/PropertyValueChange.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Container; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.BaseFieldFactory; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.Field; -import com.vaadin.ui.FieldFactory; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; -import com.vaadin.ui.AbstractSelect.NewItemHandler; -import com.vaadin.ui.Table.ColumnGenerator; - -public class PropertyValueChange extends TestBase { - - @Override - protected String getDescription() { - return "Property value change should only update absolutely " - + "needed cells. Tables have common datasource. The first is " - + "editable, second one has data in disabled fields, the lastone " - + "is plain table that directly shows data. Use first table and " - + "combobox/sync button to send changed values to server and evaluate " - + "given uidl responses."; - } - - @Override - protected Integer getTicketNumber() { - return 2823; - } - - private IndexedContainer container; - - // Also use column generator in test, to ensure it is possible to build - // columns that update automatically. - ColumnGenerator multiplier = new ColumnGenerator() { - private int getMultipliedValue(Property p) { - int i = ((Integer) p.getValue()).intValue(); - return i * 3; - } - - public Component generateCell(Table source, Object itemId, - Object columnId) { - final Label l = new Label(); - final Property integer = source.getContainerProperty(itemId, - "integer"); - l.setValue(getMultipliedValue(integer)); - - // we must hook value change listener to ensure updates in all use - // cases (eg. edit mode) - if (integer instanceof Property.ValueChangeNotifier) { - Property.ValueChangeNotifier notifier = (Property.ValueChangeNotifier) integer; - notifier.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - l.setValue(getMultipliedValue(integer)); - } - }); - } - return l; - } - }; - - FieldFactory ff = new MyFieldFactory(); - - @Override - public void setup() { - container = new IndexedContainer(); - - container.addContainerProperty("text", String.class, "sampletext"); - container.addContainerProperty("integer", Integer.class, 5); - - container.addItem(); - container.addItem(); - - Table t1 = new Table( - "Editable table with bells and wistles. See description."); - t1.setDescription("Opening combobox should never fire table" - + " refresh (for this table). Update from textfield " - + "(integer) may be sent to server however. The readonly table" - + " my refresh, but not this one."); - t1.setPageLength(0); - t1.setContainerDataSource(container); - t1.addGeneratedColumn("integer x 3", multiplier); - t1.setFieldFactory(ff); - t1.setEditable(true); - t1.setDebugId("editortable"); - - Table t2 = new Table( - "A clone of table1, but disabled. Properties are in components."); - t2 - .setDescription("This table is in editable mode." - + " Updates to common datasource should not affect redraw for this " - + "table. Only the components inside table should get updated."); - t2.setFieldFactory(ff); - t2.setEditable(true); - t2.setEnabled(false); - t2.setContainerDataSource(container); - t2.addGeneratedColumn("integer x 3", multiplier); - t2.setPageLength(0); - t2.setDebugId("disabled table"); - - Table reader = new Table("Reader table"); - reader - .setDescription("This table should be redrawn on container changes as container data is " - + "displayed directly in cells."); - reader.setContainerDataSource(container); - reader.addGeneratedColumn("integer x 3", multiplier); - reader.setPageLength(0); - reader.setDebugId("reader table"); - - getLayout().addComponent(t1); - getLayout().addComponent(t2); - getLayout().addComponent(reader); - getLayout().addComponent(new Button("Sync!")); - - } -} - -class MyFieldFactory extends BaseFieldFactory { - - IndexedContainer texts = new IndexedContainer(); - - public MyFieldFactory() { - texts.addItem("sampletext"); - texts.addItem("foo"); - texts.addItem("bar"); - for (int i = 0; i < 100; i++) { - texts.addItem("foo" + 1); - } - - } - - @Override - public Field createField(Container container, Object itemId, - Object propertyId, Component uiContext) { - if (propertyId.equals("text")) { - // replace text fields with comboboxes - final ComboBox cb = new ComboBox() { - }; - cb.setContainerDataSource(texts); - cb.setNewItemsAllowed(true); - cb.setNewItemHandler(new NewItemHandler() { - public void addNewItem(String newItemCaption) { - texts.addItem(newItemCaption); - cb.setValue(newItemCaption); - } - }); - return cb; - } - - return super.createField(container, itemId, propertyId, uiContext); - } -} diff --git a/src/com/vaadin/tests/components/table/RowAdditionTest.java b/src/com/vaadin/tests/components/table/RowAdditionTest.java deleted file mode 100644 index 9b600eff7a..0000000000 --- a/src/com/vaadin/tests/components/table/RowAdditionTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class RowAdditionTest extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Adding a row should refresh client area only if newly added row is in the rendered area.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return new Integer(2799);
- }
-
- @Override
- protected void setup() {
- final Table table = new Table();
- final IndexedContainer container = (IndexedContainer) table
- .getContainerDataSource();
- table.addContainerProperty("column1", String.class, "test");
-
- for (int i = 0; i < 100; ++i) {
- table.addItem();
- }
-
- HorizontalLayout hl = new HorizontalLayout();
- hl.addComponent(new Button("Add first", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Item item = container.addItemAt(0, new Object());
- item.getItemProperty("column1").setValue("0");
- }
- }));
- hl.addComponent(new Button("Add at position 50",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Item item = container.addItemAt(50, new Object());
- item.getItemProperty("column1").setValue("50");
- }
- }));
- hl.addComponent(new Button("Add at position 100",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Item item = container.addItemAt(100, new Object());
- item.getItemProperty("column1").setValue("100");
- }
- }));
-
- getLayout().addComponent(table);
- getLayout().addComponent(hl);
- }
-}
diff --git a/src/com/vaadin/tests/components/table/TableItemIcon.java b/src/com/vaadin/tests/components/table/TableItemIcon.java deleted file mode 100644 index b8a6733e83..0000000000 --- a/src/com/vaadin/tests/components/table/TableItemIcon.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.Resource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Table; - -public class TableItemIcon extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2457; - } - - @Override - protected String getDescription() { - return "The items in the Table should have icons in the first column (rowheader)."; - } - - @Override - protected void setup() { - Table table = new Table(); - table.addContainerProperty("icon", Resource.class, null); - table.setItemIconPropertyId("icon"); - table.setRowHeaderMode(Table.ROW_HEADER_MODE_ICON_ONLY); - getLayout().addComponent(table); - - Item item = table.addItem("FI"); - item.getItemProperty("icon").setValue( - new ClassResource("fi.gif", TableItemIcon.this)); - item = table.addItem("SE"); - item.getItemProperty("icon").setValue( - new ClassResource("se.gif", TableItemIcon.this)); - - } - -} diff --git a/src/com/vaadin/tests/components/table/TableLastRowMissing.html b/src/com/vaadin/tests/components/table/TableLastRowMissing.html deleted file mode 100644 index ca8ee6d6a4..0000000000 --- a/src/com/vaadin/tests/components/table/TableLastRowMissing.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TableLastRowMissing</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TableLastRowMissing</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TableLastRowMissing</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TableLastRowMissing.java b/src/com/vaadin/tests/components/table/TableLastRowMissing.java deleted file mode 100644 index 4e4a223e23..0000000000 --- a/src/com/vaadin/tests/components/table/TableLastRowMissing.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.data.Item;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-
-public class TableLastRowMissing extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The table below should display 3 rows. Each with a textfield containing the row number.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2933;
- }
-
- @Override
- protected void setup() {
- Table t = new Table();
- addComponent(t);
-
- t.addContainerProperty("Name", TextField.class, null);
-
- for (int i = 0; i < 3; i++) {
- Item item = t.addItem(i);
- TextField tf = new TextField("", String.valueOf(i + 1));
- tf.setColumns(10);
- item.getItemProperty("Name").setValue(tf);
- }
-
- }
-}
diff --git a/src/com/vaadin/tests/components/table/TablePageLengthUpdate.html b/src/com/vaadin/tests/components/table/TablePageLengthUpdate.html deleted file mode 100644 index fe5887634f..0000000000 --- a/src/com/vaadin/tests/components/table/TablePageLengthUpdate.html +++ /dev/null @@ -1,127 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TablePageLengthUpdate</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TablePageLengthUpdate</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TablePageLengthUpdate</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextField[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextField[0]</td> - <td>200px</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>exact:Pagelength: 9</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextField[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextField[0]</td> - <td>250px</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>exact:Pagelength: 11</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VTextField[0]</td> - <td>50px</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTablePageLengthUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>exact:Pagelength: 2</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java b/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java deleted file mode 100644 index 8906b8e835..0000000000 --- a/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.util.MethodProperty; -import com.vaadin.terminal.Sizeable; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class TablePageLengthUpdate extends TestBase { - - private Label pageLengthLabel; - private Table table; - - @Override - protected String getDescription() { - return "When the height is set for a table, the pagelength should be updated according to what is actually displayed. The table pagelength is initially 100 and the height is 100px. After clicking update the pageLength label should display the correct value (?)."; - } - - @Override - protected Integer getTicketNumber() { - return 1623; - } - - @Override - protected void setup() { - table = new Table(); - table.setWidth("400px"); - table.setHeight("100px"); - table.setPageLength(100); - table.addContainerProperty("p1", String.class, null); - table.addContainerProperty("p2", String.class, null); - table.addContainerProperty("p3", String.class, null); - - for (int i = 0; i < 10; i++) { - table.addItem(new Object[] { "a" + i, "b" + i, "c" + i }, "" + i); - } - - addComponent(table); - - pageLengthLabel = new Label(""); - updatePageLengthLabel(); - addComponent(pageLengthLabel); - - Button updateButton = new Button("Update pageLength", - new ClickListener() { - - public void buttonClick(ClickEvent event) { - updatePageLengthLabel(); - } - }); - addComponent(updateButton); - - TextField tableHeight = new TextField("Table height", - new MethodProperty(this, "tableHeight")); - tableHeight.setImmediate(true); - addComponent(tableHeight); - } - - public String getTableHeight() { - return "" + (int) table.getHeight() - + Sizeable.UNIT_SYMBOLS[table.getHeightUnits()]; - } - - public void setTableHeight(String height) { - table.setHeight(height); - } - - protected void updatePageLengthLabel() { - pageLengthLabel.setValue("Pagelength: " + table.getPageLength()); - } - -} diff --git a/src/com/vaadin/tests/components/table/TableRowHeight.html b/src/com/vaadin/tests/components/table/TableRowHeight.html deleted file mode 100644 index a28df6329f..0000000000 --- a/src/com/vaadin/tests/components/table/TableRowHeight.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TableRowHeight</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TableRowHeight</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TableRowHeight</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TableRowHeight.java b/src/com/vaadin/tests/components/table/TableRowHeight.java deleted file mode 100644 index 7e51226094..0000000000 --- a/src/com/vaadin/tests/components/table/TableRowHeight.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Component; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; -import com.vaadin.ui.Table.ColumnGenerator; - -public class TableRowHeight extends TestBase { - - @Override - protected String getDescription() { - return "This test case contains 4 tables in various configurations. All tables have a pageLength of " - + PAGELENGTH - + " and thus should show as many rows without any scrollbars (height is undefined for all tables)."; - - } - - @Override - protected Integer getTicketNumber() { - return 2691; - } - - private static final int PAGELENGTH = 2; - - public void setup() { - Table table1 = initTable(PAGELENGTH, false, false); - addComponent(new Label("Plain table")); - addComponent(table1); - - Table table2 = initTable(PAGELENGTH, true, false); - addComponent(new Label("Table with label component in generated column")); - addComponent(table2); - - Table table3 = initTable(PAGELENGTH, false, true); - addComponent(new Label( - "Table with layout component in generated column")); - addComponent(table3); - - Table table4 = initTable(PAGELENGTH, true, true); - addComponent(new Label( - "Table with both label and layout component in generated column")); - addComponent(table4); - - } - - private Table initTable(int pageLength, boolean addLabelColGen, - boolean addLayoutColGen) { - Table table = new Table(); - table.setWidth("100%"); - table.setPageLength(pageLength); - - IndexedContainer idx = new IndexedContainer(); - idx.addContainerProperty("firstname", String.class, null); - idx.addContainerProperty("lastname", String.class, null); - Item i = idx.addItem(1); - i.getItemProperty("firstname").setValue("John"); - i.getItemProperty("lastname").setValue("Johnson"); - i = idx.addItem(2); - i.getItemProperty("firstname").setValue("Jane"); - i.getItemProperty("lastname").setValue("Janeine"); - - table.setContainerDataSource(idx); - - table.setColumnHeader("firstname", "FirstName"); - table.setColumnHeader("lastname", "LastName"); - if (addLabelColGen) { - table.addGeneratedColumn("name1", new LabelColumnGenerator()); - } - if (addLayoutColGen) { - table.addGeneratedColumn("name2", new LayoutColumnGenerator()); - } - - return table; - } - - public class LabelColumnGenerator implements ColumnGenerator { - - public Component generateCell(Table source, Object itemId, - Object columnId) { - Item item = source.getItem(itemId); - String firstname = (String) item.getItemProperty("firstname") - .getValue(); - String lastname = (String) item.getItemProperty("lastname") - .getValue(); - Label label = new Label(firstname + " " + lastname); - return label; - } - - } - - public class LayoutColumnGenerator implements ColumnGenerator { - - public Component generateCell(Table source, Object itemId, - Object columnId) { - Item item = source.getItem(itemId); - GridLayout layout = new GridLayout(1, 2); - String firstname = (String) item.getItemProperty("firstname") - .getValue(); - String lastname = (String) item.getItemProperty("lastname") - .getValue(); - layout.addComponent(new Label(firstname), 0, 0); - layout.addComponent(new Label(lastname), 0, 1); - return layout; - } - - } - -} diff --git a/src/com/vaadin/tests/components/table/TableRowHeight2.html b/src/com/vaadin/tests/components/table/TableRowHeight2.html deleted file mode 100644 index bd83c1d9dc..0000000000 --- a/src/com/vaadin/tests/components/table/TableRowHeight2.html +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TableRowHeight2</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TableRowHeight2</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TableRowHeight2</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableRowHeight2::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VButton[1]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableRowHeight2::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[1]/VButton[1]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TableRowHeight2.java b/src/com/vaadin/tests/components/table/TableRowHeight2.java deleted file mode 100644 index 2c9d75808b..0000000000 --- a/src/com/vaadin/tests/components/table/TableRowHeight2.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Table; - -public class TableRowHeight2 extends TestBase { - - private static final int TABLE_EXTRA = 2; // borders - private static final int COLEXTRASPACE = 6; // cell margins by theme - - @Override - protected String getDescription() { - return "The table contains 2 rows, which both should be shown completely as the table height is undefined."; - } - - @Override - protected Integer getTicketNumber() { - return 2747; - } - - @Override - protected void setup() { - setTheme("tests-tickets"); - HorizontalLayout vl = new HorizontalLayout(); - vl.setSizeFull(); - - Table table = new Table(); - - int COL_TITLE_W = 200; - int COL_TEST_W = 98; - - table - .setWidth((COL_TEST_W + COL_TITLE_W + 2 * COLEXTRASPACE + TABLE_EXTRA) - + "px"); - table.setPageLength(0); - table.setColumnWidth("title", COL_TITLE_W); - table.setColumnWidth("test", COL_TEST_W); - table.addContainerProperty("title", Button.class, ""); - table.addContainerProperty("test", Button.class, ""); - for (int i = 0; i < 2; i++) { - Item item = table.addItem(new Object()); - - Button b = new Button(); - b.setWidth("100%"); - b.setStyleName(Button.STYLE_LINK); - b.addStyleName("nowraplink"); - - b - .setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero."); - - item.getItemProperty("title").setValue(b); - - Button c = new Button("test"); - item.getItemProperty("test").setValue(c); - } - - vl.addComponent(table); - - addComponent(vl); - } -} diff --git a/src/com/vaadin/tests/components/table/TableRowHeight3.html b/src/com/vaadin/tests/components/table/TableRowHeight3.html deleted file mode 100644 index 2aa90085e4..0000000000 --- a/src/com/vaadin/tests/components/table/TableRowHeight3.html +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TableRowHeight3</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TableRowHeight3</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TableRowHeight3</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TableRowHeight3.java b/src/com/vaadin/tests/components/table/TableRowHeight3.java deleted file mode 100644 index d0b7afe94c..0000000000 --- a/src/com/vaadin/tests/components/table/TableRowHeight3.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.data.Item; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Table; - -public class TableRowHeight3 extends TestBase { - - @Override - protected String getDescription() { - return "All rows should be visible and the table height should match the height of the rows (no vertical scrollbar)"; - } - - @Override - protected Integer getTicketNumber() { - return 2747; - } - - @Override - protected void setup() { - setTheme("tests-tickets"); - HorizontalLayout vl = new HorizontalLayout(); - vl.setSizeFull(); - - Table table = new Table(); - table.setWidth("320px"); - table.setPageLength(0); - table.setColumnWidth("title", 200); - table.setColumnWidth("test", 98); - table.addContainerProperty("title", Button.class, ""); - table.addContainerProperty("test", Button.class, ""); - for (int i = 0; i < 6; i++) { - Item item = table.addItem(new Object()); - - Button b = new Button(); - b.setWidth("100%"); - b.setStyleName(Button.STYLE_LINK); - b.addStyleName("nowraplink"); - if (i < 2) { - b - .setCaption("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper, elit quis elementum iaculis, dui est rutrum risus, at cursus sem leo eget arcu. Proin vel eros ut tortor luctus pretium. Nulla facilisi. Donec in dui. Proin ac diam vitae massa tempus faucibus. Fusce eu risus. Nunc ac risus. Cras libero."); - } else if (2 <= i && i < 4) { - b.setCaption("One line"); - } else { - b.setCaption("This button caption should use up two lines"); - } - item.getItemProperty("title").setValue(b); - - Button c = new Button("test"); - item.getItemProperty("test").setValue(c); - } - - vl.addComponent(table); - - addComponent(vl); - - } - -} diff --git a/src/com/vaadin/tests/components/table/TableVisibleColumnsUpdate.html b/src/com/vaadin/tests/components/table/TableVisibleColumnsUpdate.html deleted file mode 100644 index 05325cb9e6..0000000000 --- a/src/com/vaadin/tests/components/table/TableVisibleColumnsUpdate.html +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TableVisibleColumnsUpdate</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TableVisibleColumnsUpdate</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TableVisibleColumnsUpdate</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableVisibleColumnsUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableVisibleColumnsUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTableVisibleColumnsUpdate::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TableVisibleColumnsUpdate.java b/src/com/vaadin/tests/components/table/TableVisibleColumnsUpdate.java deleted file mode 100644 index 8f7f781684..0000000000 --- a/src/com/vaadin/tests/components/table/TableVisibleColumnsUpdate.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.vaadin.tests.components.table; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Table; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class TableVisibleColumnsUpdate extends TestBase { - - private String[] cols1 = new String[] { "p1", "p2", "p3" }; - private String[] cols2 = new String[] { "p1", "p4", "p3" }; - private Table table; - - @Override - protected String getDescription() { - return "Columns should change between p1,p2,p3 and p1,p4,p3"; - } - - @Override - protected Integer getTicketNumber() { - return 3139; - } - - @Override - protected void setup() { - table = new Table(); - table.setWidth("400px"); - table.setHeight("100px"); - table.setPageLength(100); - table.addContainerProperty("p1", String.class, null); - table.addContainerProperty("p2", String.class, null); - table.addContainerProperty("p3", String.class, null); - table.addContainerProperty("p4", String.class, null); - - for (int i = 0; i < 10; i++) { - table.addItem(new Object[] { "a" + i, "b" + i, "c" + i, "X" + i }, - "" + i); - } - - addComponent(table); - - table.setVisibleColumns(cols1); - // table.setColumnHeaders(headers1); - - Button updateButton = new Button("Change columns", new ClickListener() { - private boolean one = true; - - public void buttonClick(ClickEvent event) { - table.setVisibleColumns((one ? cols2 : cols1)); - one = !one; - } - }); - addComponent(updateButton); - } - -} diff --git a/src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java b/src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java deleted file mode 100644 index d74c3b7238..0000000000 --- a/src/com/vaadin/tests/components/table/TestCurrentPageFirstItem.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.Application;
-import com.vaadin.data.Container;
-import com.vaadin.data.Item;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class TestCurrentPageFirstItem extends Application implements
- ClickListener {
-
- private Button buttonIndex;
- private Button buttonItem;
- private Table table;
- private int counter = 0;
- IndexedContainer container = new IndexedContainer();
-
- @Override
- public void init() {
- try {
- Window main = new Window("Table header Test");
- setMainWindow(main);
- main.setSizeFull();
- // setTheme("testtheme");
- VerticalLayout baseLayout = new VerticalLayout();
- main.setLayout(baseLayout);
-
- table = new Table();
- container.addContainerProperty("row", String.class, "");
- table.setContainerDataSource(container);
- table.setWidth("100%");
- table.setPageLength(3);
- buttonIndex = new Button("Add row and select last index", this);
- buttonItem = new Button("Add row and select last item", this);
-
- baseLayout.addComponent(table);
- baseLayout.addComponent(buttonIndex);
- baseLayout.addComponent(buttonItem);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void buttonClick(ClickEvent event) {
- Item item = container.addItem(++counter);
- item.getItemProperty("row").setValue(counter + "");
- table.select(counter);
- if (event.getButton() == buttonIndex) {
- table.setCurrentPageFirstItemIndex(((Container.Indexed) table
- .getContainerDataSource()).indexOfId(counter));
- } else {
- table.setCurrentPageFirstItemId(counter);
- }
- }
-}
diff --git a/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html b/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html deleted file mode 100644 index 5b5ea40168..0000000000 --- a/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.html +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TextFieldRelativeWidth</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TextFieldRelativeWidth</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.table.TextFieldRelativeWidth</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstableTextFieldRelativeWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/ScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java b/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java deleted file mode 100644 index b3c75ea06d..0000000000 --- a/src/com/vaadin/tests/components/table/TextFieldRelativeWidth.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.vaadin.tests.components.table;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class TextFieldRelativeWidth extends TestBase {
-
- @Override
- public void setup() {
- TextField tf = new TextField("test", "testing");
- tf.setWidth("100%");
-
- EditTable t = new EditTable();
- t.setButtonCaption("Click to add new Key Research Question");
- t.setInputPrompt("Key Reseach question");
- t.setInputPromptChild("Question details");
- t.addNewRow();
- addComponent(t);
- }
-
- public class EditTable extends Table implements Button.ClickListener {
-
- private Button addButton = new Button("Add new row",
- (Button.ClickListener) this);
-
- private String inputPrompt;
-
- private String inputPromptChild;
-
- private int nextItemIndex = 1;
-
- private static final long serialVersionUID = 3326806911297977454L;
-
- public EditTable() {
- setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
- inputPrompt = "";
- setPageLength(100);
- setHeight("100%");
- setSizeFull();
- addContainerProperty("id", Integer.class, null);
- addContainerProperty("text", Component.class, null);
- addContainerProperty("button", Button.class, null);
- setColumnExpandRatio("text", 1);
- Item i = getItem(addItem());
- i.getItemProperty("text").setValue(addButton);
- setImmediate(true);
- setSelectable(true);
- addListener(new Property.ValueChangeListener() {
- private static final long serialVersionUID = 448896474865195605L;
-
- public void valueChange(
- com.vaadin.data.Property.ValueChangeEvent event) {
- IndexedContainer idc = (IndexedContainer) getContainerDataSource();
-
- }
-
- });
- }
-
- public void addNewRow() {
- IndexedContainer idc = (IndexedContainer) this
- .getContainerDataSource();
- int size = idc.size();
- Object itemId = idc.addItemAt(size - 1);
- Item newItem = idc.getItem(itemId);
- TextField tf = new TextField();
- if (inputPrompt != null && inputPrompt.length() > 0) {
- tf.setInputPrompt(inputPrompt);
- }
- tf.setWidth("100%");
-
- newItem.getItemProperty("id").setValue(nextItemIndex);
- nextItemIndex++;
- newItem.getItemProperty("text").setValue(tf);
- setValue(itemId);
- itemId = idc.addItemAt(size);
- newItem = idc.getItem(itemId);
-
- tf = new TextField();
- if (inputPromptChild != null && inputPromptChild.length() > 0) {
- tf.setInputPrompt(inputPromptChild);
- }
- // tf.setRows(1);
- // tf.setHeight("45px");
- tf.setWidth("100%");
- tf.addStyleName("childtf");
- newItem.getItemProperty("text").setValue(tf);
-
- }
-
- public void setButtonCaption(String caption) {
- addButton.setCaption(caption);
- }
-
- public void buttonClick(ClickEvent event) {
- Button b = event.getButton();
- if (b == addButton) {
- this.select(getNullSelectionItemId());
- addNewRow();
- }
- }
-
- public void setInputPrompt(String string) {
- inputPrompt = string;
- }
-
- public void setInputPromptChild(String string) {
- inputPromptChild = string;
- }
-
- }
-
- @Override
- protected String getDescription() {
- return "The table has 3 columns. The second column is expanded and contains 100% wide textfields. These should fill the available space. The third column is empty.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3145;
- }
-}
diff --git a/src/com/vaadin/tests/components/table/fi.gif b/src/com/vaadin/tests/components/table/fi.gif Binary files differdeleted file mode 100755 index 8d3a191828..0000000000 --- a/src/com/vaadin/tests/components/table/fi.gif +++ /dev/null diff --git a/src/com/vaadin/tests/components/table/se.gif b/src/com/vaadin/tests/components/table/se.gif Binary files differdeleted file mode 100755 index 80f6285228..0000000000 --- a/src/com/vaadin/tests/components/table/se.gif +++ /dev/null diff --git a/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.html b/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.html deleted file mode 100644 index e919454fc2..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.html +++ /dev/null @@ -1,117 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>AddAndRemoveTabs</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">AddAndRemoveTabs</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.AddAndRemoveTabs</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VHorizontalLayout[1]/ChildComponentContainer[0]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetAddAndRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java b/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java deleted file mode 100644 index 44859fb511..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/AddAndRemoveTabs.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.vaadin.tests.components.tabsheet; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Button.ClickEvent; - -public class AddAndRemoveTabs extends TestBase { - private TabSheet tabSheet; - - private int counter = 0; - - @Override - public void setup() { - tabSheet = new TabSheet(); - addTab(); - addComponent(tabSheet); - - Button addTabBtn = new Button("Add new tab", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - addTab(); - } - - }); - addComponent(addTabBtn); - } - - private void addTab() { - final HorizontalLayout layout = new HorizontalLayout(); - layout.setCaption("Test " + counter); - - Button closeTab = new Button("Close tab", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - tabSheet.removeComponent(layout); - - } - - }); - - layout.addComponent(closeTab); - - tabSheet.addComponent(layout); - counter++; - } - - @Override - protected String getDescription() { - return "Removing all tabs and then adding new tabs should work properly and without javascript errors. All new tabs should be displayed and not only the first one"; - } - - @Override - protected Integer getTicketNumber() { - return 2861; - } - -} diff --git a/src/com/vaadin/tests/components/tabsheet/PreventTabChange.html b/src/com/vaadin/tests/components/tabsheet/PreventTabChange.html deleted file mode 100644 index c4f5998f47..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/PreventTabChange.html +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="http://localhost:8080/" /> -<title>PreventTabChange</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">PreventTabChange</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.PreventTabChange</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetPreventTabChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetPreventTabChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetPreventTabChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetPreventTabChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/PreventTabChange.java b/src/com/vaadin/tests/components/tabsheet/PreventTabChange.java deleted file mode 100644 index f1faecb711..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/PreventTabChange.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.vaadin.tests.components.tabsheet; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; -import com.vaadin.ui.TabSheet.SelectedTabChangeListener; - -public class PreventTabChange extends TestBase implements - SelectedTabChangeListener { - - private TabSheet tabSheet; - - private Component lastTab; - - private Label tab1; - private Label tab2; - private Label tab3; - - @Override - protected String getDescription() { - return "Tests prevention of selecting certain tabs. Selecting the tabs in order (1-2-3-1) should work, while selecting out of order should cause the current tab to remain selected. The selected tab will actually first be changed (by the client) and then changed back (on the server response)."; - } - - @Override - protected Integer getTicketNumber() { - return 3199; - } - - @Override - protected void setup() { - tabSheet = new TabSheet(); - tabSheet.addListener(this); - tab1 = new Label("Tab 1 contents"); - tab2 = new Label("Tab 2 contents"); - tab3 = new Label("Tab 3 contents"); - - tabSheet.addTab(tab1, "The first tab", null); - tabSheet.addTab(tab2, "The second tab", null); - tabSheet.addTab(tab3, "The third tab", null); - - lastTab = tab1; - tabSheet.setSelectedTab(tab1); - - addComponent(tabSheet); - } - - public void selectedTabChange(SelectedTabChangeEvent event) { - - TabSheet tabsheet = event.getTabSheet(); - if (lastTab == tab1) { - if (tabsheet.getSelectedTab() != tab2) { - tabsheet.setSelectedTab(lastTab); - } - } else if (lastTab == tab2) { - if (tabsheet.getSelectedTab() != tab3) { - tabsheet.setSelectedTab(lastTab); - } - } else if (lastTab == tab3) { - if (tabsheet.getSelectedTab() != tab1) { - tabsheet.setSelectedTab(lastTab); - } - } - lastTab = tabsheet.getSelectedTab(); - } -} diff --git a/src/com/vaadin/tests/components/tabsheet/RemoveTabs.java b/src/com/vaadin/tests/components/tabsheet/RemoveTabs.java deleted file mode 100644 index c2f8af8454..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/RemoveTabs.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.AbstractComponentContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class RemoveTabs extends TestBase {
-
- protected TabSheet tabsheet;
-
- protected Component[] tab = new Component[5];
-
- private Button closeCurrent;
- private Button closeFirst;
- private Button closeLast;
- private Button reorderTabs;
-
- @Override
- protected Integer getTicketNumber() {
- return 2425;
- }
-
- @Override
- protected String getDescription() {
- return "Tests the removal of individual tabs from a Tabsheet. No matter what is done in this test the tab caption \"Tab X\" should always match the content \"Tab X\". Use \"remove first\" and \"remove active\" buttons to remove the first or the active tab. The \"reorder\" button reverses the order by adding and removing all components.";
- }
-
- @Override
- protected void setup() {
- tabsheet = new TabSheet();
- for (int i = 1; i <= tab.length; i++) {
- tab[i - 1] = new Label("This is the contents of tab " + i);
- tab[i - 1].setCaption("Tab " + i);
-
- tabsheet.addComponent(tab[i - 1]);
- }
-
- getLayout().addComponent(tabsheet);
-
- closeCurrent = new Button("Close current tab");
- closeCurrent.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- closeCurrentTab();
-
- }
- });
-
- closeFirst = new Button("close first tab");
- closeFirst.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- closeFirstTab();
-
- }
- });
-
- closeLast = new Button("close last tab");
- closeLast.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- closeLastTab();
-
- }
- });
-
- reorderTabs = new Button("reorder");
- reorderTabs.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- reorder();
-
- }
- });
-
- getLayout().addComponent(closeFirst);
- getLayout().addComponent(closeLast);
- getLayout().addComponent(closeCurrent);
- getLayout().addComponent(reorderTabs);
-
- }
-
- private void closeCurrentTab() {
- Component c = tabsheet.getSelectedTab();
- if (c != null) {
- tabsheet.removeComponent(c);
- }
- }
-
- private void closeFirstTab() {
- tabsheet.removeComponent((Component) tabsheet.getComponentIterator()
- .next());
- }
-
- @SuppressWarnings("unchecked")
- private void closeLastTab() {
- Iterator i = tabsheet.getComponentIterator();
- Component last = null;
- while (i.hasNext()) {
- last = (Component) i.next();
-
- }
- tabsheet.removeComponent(last);
- }
-
- @SuppressWarnings("unchecked")
- private void reorder() {
- AbstractComponentContainer container = tabsheet;
-
- if (container != null) {
- List<Component> c = new ArrayList<Component>();
- Iterator<Component> i = container.getComponentIterator();
- while (i.hasNext()) {
- Component comp = i.next();
- c.add(comp);
- }
- container.removeAllComponents();
-
- for (int j = c.size() - 1; j >= 0; j--) {
- container.addComponent(c.get(j));
- }
-
- }
- }
-}
diff --git a/src/com/vaadin/tests/components/tabsheet/RemoveTabsTabsheet.html b/src/com/vaadin/tests/components/tabsheet/RemoveTabsTabsheet.html deleted file mode 100644 index 18fa4705ce..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/RemoveTabsTabsheet.html +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>RemoveTabs</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">RemoveTabs</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.RemoveTabs</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetRemoveTabs::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.html b/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.html deleted file mode 100644 index d240d4b419..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.html +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TabSheetCaptions</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TabSheetCaptions</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.TabSheetCaptions</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>Panel initial caption (should also be tab caption)</td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VPanel[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>Panel initial caption (should also be tab caption)</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>This is a new tab caption Sun, 2001-Sep-09</td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VPanel[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>Panel initial caption (should also be tab caption)</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>This is a new tab caption Sun, 2001-Sep-09</td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetCaptions::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VPanel[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td>This is a new panel caption Sun, 2001-Sep-09</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java b/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java deleted file mode 100644 index 699988489f..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetCaptions.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class TabSheetCaptions extends TestBase {
-
- Panel panel1;
-
- @Override
- protected String getDescription() {
- return "Updating the tabsheet tab text should not change the caption of the component. Click on the button to change the tab text. This must update the tab and not touch the Panel's caption.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2846;
- }
-
- @Override
- protected void setup() {
- final TabSheet tabSheet = new TabSheet();
- // Define date and locale so that it doesn't change for machine/time
- final SimpleDateFormat dateFormatter = new SimpleDateFormat(
- "EEE, yyyy-MMM-dd", Locale.ENGLISH);
- final Date date = new Date();
- date.setTime((long) 1000000000000.0);
-
- panel1 = new Panel("Panel initial caption (should also be tab caption)");
- panel1.setSizeFull();
- panel1.getLayout().setSizeFull();
- panel1.addComponent(new Label("This is a panel"));
- tabSheet.addTab(panel1);
-
- Button button = new Button("Update tab caption");
- button.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- tabSheet.setTabCaption(panel1, "This is a new tab caption "
- + dateFormatter.format(date));
- }
- });
-
- Button button2 = new Button("Update panel caption");
- button2.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- panel1.setCaption("This is a new panel caption "
- + dateFormatter.format(date));
- }
- });
-
- addComponent(tabSheet);
- addComponent(button);
- addComponent(button2);
- }
-}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.html b/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.html deleted file mode 100644 index bc03f7687b..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.html +++ /dev/null @@ -1,162 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TabSheetDisabling</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TabSheetDisabling</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.TabSheetDisabling</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[2]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[6]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[3]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>3</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[1]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabSheetDisabling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[2]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>4</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java b/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java deleted file mode 100644 index 612960f2cf..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetDisabling.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class TabSheetDisabling extends TestBase {
-
- private static final int NR_BUTTONS = 10;
- private Button buttons[] = new Button[NR_BUTTONS];
- private TabSheet tabSheet;
-
- @Override
- public void setup() {
- tabSheet = new TabSheet();
- for (int i = 0; i < NR_BUTTONS; i++) {
- if (i % 2 == 0) {
- buttons[i] = new Button("Disable this tab",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Button b = event.getButton();
- tabSheet.getTab(b).setEnabled(false);
-
- }
-
- });
- } else {
- buttons[i] = new Button("Hide this tab", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Button b = event.getButton();
- tabSheet.getTab(b).setVisible(false);
- }
-
- });
- }
- tabSheet.addTab(buttons[i]);
- }
-
- Button button = new Button("Enable/disable", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- tabSheet.setEnabled(!tabSheet.isEnabled());
- }
- });
- addComponent(tabSheet);
- addComponent(button);
- }
-
- @Override
- protected String getDescription() {
- return "Switching the tabsheet between disabled and enabled should not change which tab is selected. Disabling the open tab should select the first enabled tab.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2658;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.html b/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.html deleted file mode 100644 index 425da11af4..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.html +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TabSheetIcons</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TabSheetIcons</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.TabSheetIcons</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java b/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java deleted file mode 100644 index 49c9784eb9..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.TextField;
-
-public class TabSheetIcons extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Tests rendering of a Tabsheet with fixed/dynamic width when the TabSheet contains icons";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return null;
- }
-
- @Override
- protected void setup() {
- TabSheet ts1 = createTabsheet();
- ts1.setHeight("100px");
- TabSheet ts2 = createTabsheet();
- ts2.setHeight("100px");
- ts2.setWidth("400px");
-
- addComponent(ts1);
- addComponent(ts2);
- }
-
- private TabSheet createTabsheet() {
- TabSheet tabsheet = new TabSheet();
- tabsheet.setSizeUndefined();
-
- Component[] tab = new Component[3];
- tab[0] = new Label("This is tab 1");
- tab[0].setIcon(new ThemeResource("../runo/icons/32/folder-add.png"));
- tab[0].setCaption("tab number 1");
- tab[1] = new TextField("This is tab 2", "Contents of tab 2 textfield");
- tab[2] = new Label("This is tab 3");
- tab[2].setIcon(new ThemeResource("../runo/icons/16/folder-add.png"));
- tab[2].setCaption("tab number 3");
-
- for (Component c : tab) {
- tabsheet.addTab(c);
- }
-
- return tabsheet;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetWithoutTabCaption.html b/src/com/vaadin/tests/components/tabsheet/TabSheetWithoutTabCaption.html deleted file mode 100644 index 36e85c1b37..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetWithoutTabCaption.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TabSheetWithoutTabCaption</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TabSheetWithoutTabCaption</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.TabSheetWithoutTabCaption</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabSheetWithoutTabCaption.java b/src/com/vaadin/tests/components/tabsheet/TabSheetWithoutTabCaption.java deleted file mode 100644 index d766277b48..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabSheetWithoutTabCaption.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.tabsheet; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; - -public class TabSheetWithoutTabCaption extends TestBase { - - @Override - protected String getDescription() { - return "There should be a tabsheet with one tab visible. The tab has no caption and contains a label saying 'Tab contents'."; - } - - @Override - protected Integer getTicketNumber() { - // TODO Auto-generated method stub - return null; - } - - @Override - protected void setup() { - final TabSheet moduleArea = new TabSheet(); - Label label = new Label("Tab contents"); - moduleArea.addTab(label); - addComponent(moduleArea); - } - -} diff --git a/src/com/vaadin/tests/components/tabsheet/TabsheetNPE.java b/src/com/vaadin/tests/components/tabsheet/TabsheetNPE.java deleted file mode 100644 index a9ebd2dfa0..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabsheetNPE.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.tests.components.AbstractTestCase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.TabSheet.Tab;
-
-public class TabsheetNPE extends AbstractTestCase implements ClickListener {
-
- @Override
- protected String getDescription() {
- return "Enable and activate tab should enable and activate the first tab.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3292;
- }
-
- private static final int TABS_COUNT = 3;
- private TabSheet tabSheet;
- private Label[] label = new Label[TABS_COUNT];
- private Tab[] tab = new Tab[TABS_COUNT];
-
- @Override
- public void init() {
- setMainWindow(new Window("TabSheet Demo", createMainLayout()));
- }
-
- private VerticalLayout createMainLayout() {
- VerticalLayout layout = new VerticalLayout();
-
- tabSheet = new TabSheet();
- for (int i = 1; i <= TABS_COUNT; i++) {
- label[i - 1] = new Label("Tab " + i);
- tab[i - 1] = tabSheet.addTab(label[i - 1], "Tab " + i, null);
- tab[i - 1].setEnabled(false);
- }
-
- layout.addComponent(tabSheet);
- Button btn = new Button("Enable and activate tab");
- btn.addListener(this);
- layout.addComponent(btn);
- return layout;
- }
-
- public void buttonClick(ClickEvent event) {
- for (int i = 0; i < TABS_COUNT; i++) {
- tab[i].setEnabled(true);
- }
- tabSheet.setSelectedTab(label[0]);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabsheetScrolling.html b/src/com/vaadin/tests/components/tabsheet/TabsheetScrolling.html deleted file mode 100644 index 16657e27c4..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabsheetScrolling.html +++ /dev/null @@ -1,182 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TabsheetScrolling</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TabsheetScrolling</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.TabsheetScrolling?restartApplication</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[1]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[1]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[1]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[1]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[1]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTabsheet[0]/VTabsheetPanel[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VTabsheet[0]/VTabsheetPanel[0]/VButton[1]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[1]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[2]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[3]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[4]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[5]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetScrolling::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VButton[6]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java b/src/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java deleted file mode 100644 index 718a10aadd..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabsheetScrolling.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.TabSheet.Tab;
-
-public class TabsheetScrolling extends TestBase {
-
- private TabSheet fixedSizeTabSheet;
- private TabSheet autoWideTabSheet;
-
- @Override
- protected void setup() {
- fixedSizeTabSheet = new TabSheet();
- fixedSizeTabSheet.setHeight("200px");
- fixedSizeTabSheet.setWidth("400px");
-
- for (int i = 0; i < 100; i++) {
- Button b = new Button("Hide this tab (" + i + ")",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- fixedSizeTabSheet.getTab(event.getButton())
- .setVisible(false);
- }
-
- });
- Tab t = fixedSizeTabSheet.addTab(b, "Tab " + i, null);
- if (i % 2 == 0) {
- t.setVisible(false);
- }
- }
-
- addComponent(fixedSizeTabSheet);
-
- autoWideTabSheet = new TabSheet();
- autoWideTabSheet.setHeight("200px");
- autoWideTabSheet.setWidth(null);
-
- for (int i = 0; i < 10; i++) {
- Button b = new Button("Hide this tab (" + i + ")",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- autoWideTabSheet.getTab(event.getButton())
- .setVisible(false);
- }
- });
-
- Tab t = autoWideTabSheet.addTab(b, "Tab " + i, null);
- if (i % 2 == 0) {
- t.setVisible(false);
-
- }
- }
-
- addComponent(autoWideTabSheet);
-
- }
-
- @Override
- protected String getDescription() {
- return "Two tabsheets, upper has fixed width, lower has dynamic width. Every other tab in both tabsheets are hidden (even numbered tabs). Scrolling the upper tab sheet should never display a hidden tab. Hiding a tab in the upper tabsheet should not affect scrolling. Hiding a tab in the lower tabsheet should make the tabsheet width change (auto wide).";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3141;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.html b/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.html deleted file mode 100644 index c476374a70..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.html +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="http://localhost:8888/" /> -<title>TabsheetTooltip</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TabsheetTooltip</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.TabsheetTooltip</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseOver</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>pause</td> - <td>1000</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseOver</td> - <td>vaadin=runcomvaadintestscomponentstabsheetTabsheetTooltip::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>pause</td> - <td>1000</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java b/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java deleted file mode 100644 index 18934e9318..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/TabsheetTooltip.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.components.tabsheet; - -import com.vaadin.terminal.UserError; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.TabSheet.Tab; - -public class TabsheetTooltip extends TestBase { - - @Override - protected String getDescription() { - return "The label inside the tabsheet should show a tooltip 'This is a label' and the tab should show a different tooltip 'This is a tab'"; - } - - @Override - protected Integer getTicketNumber() { - return 2995; - } - - @Override - protected void setup() { - TabSheet tabSheet = new TabSheet(); - Label l = new Label("Label"); - l.setDescription("This is a label"); - - Tab tab = tabSheet.addTab(l, "Tab", null); - tab.setDescription("This is a tab"); - tab.setComponentError(new UserError("abc error")); - - Tab tab2 = tabSheet.addTab(new Label("Another label, d'oh"), "Tab 2", - null); - tab2.setDescription("This is another tab"); - - addComponent(tabSheet); - } -} diff --git a/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.html b/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.html deleted file mode 100644 index 3da03edb6a..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.html +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>VerticalScrollbarPosition</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">VerticalScrollbarPosition</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tabsheet.VerticalScrollbarPosition</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetVerticalScrollbarPosition::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[1]/domChild[1]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetVerticalScrollbarPosition::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>3</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentstabsheetVerticalScrollbarPosition::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>1</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java b/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java deleted file mode 100644 index a94aa1cd47..0000000000 --- a/src/com/vaadin/tests/components/tabsheet/VerticalScrollbarPosition.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.components.tabsheet;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.TextField;
-
-public class VerticalScrollbarPosition extends TestBase {
-
- @Override
- protected String getDescription() {
- return "A vertical scrollbar in a TabSheet should always be placed at the right edge";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2473;
- }
-
- @Override
- protected void setup() {
- TabSheet tabsheet = new TabSheet();
- tabsheet.setWidth(null);
- tabsheet.setHeight("200px");
- TextField tf = new TextField();
- tf.setRows(2);
- tf.setHeight("300px");
- tf.setWidth("200px");
- tabsheet
- .addTab(
- tf,
- "A text field that is 200px wide, the tab bar for the tabsheet is wider",
- null);
- TextField tf2 = new TextField("Another tab", "b");
- tf2.setWidth("1000px");
- tf2.setHeight("50px");
- tabsheet.addTab(tf2);
- addComponent(tabsheet);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/textfield/EnterShortcutMaySendInputPromptAsValue.java b/src/com/vaadin/tests/components/textfield/EnterShortcutMaySendInputPromptAsValue.java deleted file mode 100644 index bf9924cdbb..0000000000 --- a/src/com/vaadin/tests/components/textfield/EnterShortcutMaySendInputPromptAsValue.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.vaadin.tests.components.textfield; - -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.event.Action; -import com.vaadin.event.ShortcutAction; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; - -public class EnterShortcutMaySendInputPromptAsValue extends TestBase { - - @Override - protected String getDescription() { - return "?"; - } - - @Override - protected Integer getTicketNumber() { - return 2935; - } - - @Override - protected void setup() { - - final TextField testField = new TextField(); - testField.setInputPrompt("Enter a value"); - - getMainWindow().addActionHandler(new Action.Handler() { - - final Action enter = new ShortcutAction("enter", - ShortcutAction.KeyCode.ENTER, null); - - public Action[] getActions(Object target, Object sender) { - return new Action[] { enter }; - } - - public void handleAction(Action action, Object sender, Object target) { - if (action == enter) { - - } - } - - }); - testField.addListener(new ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - String value = event.getProperty().getValue().toString(); - addComponent(new Label("TextField sent value: " + value)); - testField.setValue(""); - } - }); - - addComponent(testField); - - } - -} diff --git a/src/com/vaadin/tests/components/textfield/IE6Cursor.java b/src/com/vaadin/tests/components/textfield/IE6Cursor.java deleted file mode 100644 index aee56dd7ee..0000000000 --- a/src/com/vaadin/tests/components/textfield/IE6Cursor.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vaadin.tests.components.textfield;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.TextField;
-
-public class IE6Cursor extends TestBase {
-
- @Override
- protected void setup() {
- TextField tf1 = new TextField("First");
- TextField tf2 = new TextField("Second");
- tf2.setInputPrompt("prompt");
-
- addComponent(tf1);
- addComponent(tf2);
- }
-
- @Override
- protected String getDescription() {
- return "Tabbing from the first field to the second should clear the second textfield and show the normal, blinking cursor in the field";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3343;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/textfield/TextFields.html b/src/com/vaadin/tests/components/textfield/TextFields.html deleted file mode 100644 index 4b6f845b7c..0000000000 --- a/src/com/vaadin/tests/components/textfield/TextFields.html +++ /dev/null @@ -1,122 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="http://localhost:8888/" /> -<title>TextFields</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TextFields</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.textfield.TextFields</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>enabled</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[1]</td> - <td>3,12</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[1]</td> - <td>31,13</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>required-and-error</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td> - <td>17,8</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>required-error-readonly</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td> - <td>16,8</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[1]</td> - <td>32,8</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td> - <td>23,4</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>readonly-disabled</td> -</tr> -<tr> - <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[1]</td> - <td>30,11</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>disabled</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/textfield/TextFields.java b/src/com/vaadin/tests/components/textfield/TextFields.java deleted file mode 100644 index 7b7c3b3415..0000000000 --- a/src/com/vaadin/tests/components/textfield/TextFields.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.vaadin.tests.components.textfield; - -import java.util.ArrayList; -import java.util.List; - -import com.vaadin.terminal.UserError; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; - -public class TextFields extends TestBase { - - private TextField textFields[] = new TextField[20]; - - @Override - protected void setup() { - HorizontalLayout actionLayout = new HorizontalLayout(); - actionLayout.setSpacing(true); - actionLayout.setMargin(true); - for (Component c : createActions()) { - actionLayout.addComponent(c); - } - addComponent(actionLayout); - - int index = 0; - - textFields[index] = createTextField("TextField 100% wide"); - textFields[index].setWidth("100%"); - addComponent(textFields[index++]); - - textFields[index] = createTextField(null, - "TextField 100% wide, no caption"); - textFields[index].setWidth("100%"); - addComponent(textFields[index++]); - - textFields[index] = createTextField("TextField auto wide"); - addComponent(textFields[index++]); - - textFields[index] = createTextField("TextField with input prompt"); - textFields[index].setInputPrompt("Please enter a value"); - addComponent(textFields[index++]); - - textFields[index] = createTextField("100px wide textfield"); - textFields[index].setWidth("100px"); - addComponent(textFields[index++]); - - textFields[index] = createTextField("150px wide, 120px high textfield"); - textFields[index].setWidth("150px"); - textFields[index].setHeight("120px"); - addComponent(textFields[index++]); - - textFields[index] = createTextField("50px high textfield"); - textFields[index].setHeight("50px"); - addComponent(textFields[index++]); - - textFields[index] = createTextField(null, "No caption"); - addComponent(textFields[index++]); - - textFields[index] = createTextField(null, "No caption and input prompt"); - textFields[index].setInputPrompt("Enter a value"); - addComponent(textFields[index++]); - - } - - private TextField createTextField(String caption, String value) { - TextField tf = new TextField(caption); - tf.setValue(value); - - return tf; - } - - private TextField createTextField(String caption) { - return createTextField(caption, ""); - } - - @Override - protected String getDescription() { - return "A generic test for TextFields in different configurations"; - } - - @Override - protected Integer getTicketNumber() { - // TODO Auto-generated method stub - return null; - } - - protected List<Component> createActions() { - ArrayList<Component> actions = new ArrayList<Component>(); - - CheckBox errorIndicators = new CheckBox("Error indicators", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - boolean enabled = (Boolean) b.getValue(); - setErrorIndicators(enabled); - - } - }); - - CheckBox required = new CheckBox("Required", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - boolean enabled = (Boolean) b.getValue(); - setRequired(enabled); - } - }); - - CheckBox enabled = new CheckBox("Enabled", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - boolean enabled = (Boolean) b.getValue(); - setEnabled(enabled); - } - }); - - CheckBox readonly = new CheckBox("Readonly", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - boolean enabled = (Boolean) b.getValue(); - setReadOnly(enabled); - } - }); - - errorIndicators.setValue(new Boolean(false)); - required.setValue(new Boolean(false)); - readonly.setValue(new Boolean(false)); - enabled.setValue(new Boolean(true)); - - errorIndicators.setImmediate(true); - required.setImmediate(true); - readonly.setImmediate(true); - enabled.setImmediate(true); - - actions.add(errorIndicators); - actions.add(required); - actions.add(readonly); - actions.add(enabled); - - return actions; - } - - protected void setRequired(boolean on) { - - for (TextField tf : textFields) { - if (tf == null) { - continue; - } - - tf.setRequired(on); - } - - } - - protected void setErrorIndicators(boolean on) { - for (TextField tf : textFields) { - if (tf == null) { - continue; - } - - if (on) { - tf.setComponentError(new UserError("It failed!")); - } else { - tf.setComponentError(null); - - } - } - - } - - protected void setEnabled(boolean on) { - for (TextField tf : textFields) { - if (tf == null) { - continue; - } - - tf.setEnabled(on); - } - - } - - protected void setReadOnly(boolean on) { - for (TextField tf : textFields) { - if (tf == null) { - continue; - } - - tf.setReadOnly(on); - } - - } - -} diff --git a/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html b/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html deleted file mode 100644 index f98482f4c7..0000000000 --- a/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.html +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TreeNodeCaptionWrapping</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TreeNodeCaptionWrapping</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.tree.TreeNodeCaptionWrapping</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>A very long item that should not wrap</td> - <td></td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>Subitem - also long</td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java b/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java deleted file mode 100644 index 2101abb630..0000000000 --- a/src/com/vaadin/tests/components/tree/TreeNodeCaptionWrapping.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.components.tree; - -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Tree; - -public class TreeNodeCaptionWrapping extends TestBase { - - @Override - protected String getDescription() { - return "The text should not wrap to the following line but instead be cut off when there is too little horizontal space."; - } - - @Override - protected Integer getTicketNumber() { - return 3098; - } - - @Override - protected void setup() { - setTheme("runo"); - Tree tree = new Tree(); - tree.setWidth("100px"); - - tree.addItem("1"); - tree.setItemIcon("1", new ThemeResource("../runo/icons/16/ok.png")); - - String mainItem = "A very long item that should not wrap"; - String subItem = "Subitem - also long"; - - tree.addItem(mainItem); - tree.setItemIcon(mainItem, new ThemeResource( - "../runo/icons/16/error.png")); - - tree.addItem(subItem); - tree.setParent(subItem, mainItem); - - tree.expandItem("1"); - tree.expandItem(mainItem); - tree.expandItem(subItem); - - addComponent(tree); - } -} diff --git a/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.html b/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.html deleted file mode 100644 index 2e15d8d645..0000000000 --- a/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>CenteredWindowWithUndefinedSize</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">CenteredWindowWithUndefinedSize</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.window.CenteredWindowWithUndefinedSize</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java b/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java deleted file mode 100644 index 51b6568f94..0000000000 --- a/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class CenteredWindowWithUndefinedSize extends TestBase { - - @Override - protected String getDescription() { - return "The centered sub-window with undefined height and a 100% high layout should be rendered in the center of the screen and not in the top-left corner."; - } - - @Override - protected Integer getTicketNumber() { - return 2702; - } - - @Override - protected void setup() { - Window centered = new Window("A window"); - centered.setSizeUndefined(); - centered.getLayout().setSizeFull(); - centered.center(); - - Label l = new Label("This window should be centered"); - l.setSizeUndefined(); - centered.addComponent(l); - - getMainWindow().addWindow(centered); - - } -} diff --git a/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.html b/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.html deleted file mode 100644 index d74e09dd6a..0000000000 --- a/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>EmbeddedInSubWindow</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">EmbeddedInSubWindow</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.window.EmbeddedInSubWindow</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java b/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java deleted file mode 100644 index f1ef0069c9..0000000000 --- a/src/com/vaadin/tests/components/window/EmbeddedInSubWindow.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.Window; - -public class EmbeddedInSubWindow extends TestBase { - - @Override - protected String getDescription() { - return "The sub window contains a large icon and should be sized according to the icon. The icon contains a blue border of 10px at the outer edges. The layout in the sub window has margins enabled."; - } - - @Override - protected Integer getTicketNumber() { - return null; - } - - @Override - protected void setup() { - setTheme("tests-tickets"); - Window zoom = new Window("Image Preview"); - zoom.setSizeUndefined(); - zoom.getContent().setSizeUndefined(); - - String res = "icons/EmbeddedInSubWindow-image.png"; - Embedded imagePreview = new Embedded("", new ThemeResource(res)); - imagePreview.setSizeUndefined(); - - zoom.addComponent(imagePreview); - zoom.setModal(true); - zoom.setResizable(false); - - zoom.addListener(new Window.CloseListener() { - public void windowClose(Window.CloseEvent closeEvent) { - getMainWindow().removeWindow(closeEvent.getWindow()); - } - }); - - getMainWindow().addWindow(zoom); - - } - -} diff --git a/src/com/vaadin/tests/components/window/FullSizedWindow.java b/src/com/vaadin/tests/components/window/FullSizedWindow.java deleted file mode 100644 index 3cb5f45712..0000000000 --- a/src/com/vaadin/tests/components/window/FullSizedWindow.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.vaadin.tests.components.window;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.NativeButton;
-import com.vaadin.ui.Window;
-
-public class FullSizedWindow extends TestBase {
-
- @Override
- protected void setup() {
- Window w = new Window("full sized window");
- w.setSizeFull();
- w.getContent().setSizeFull();
- NativeButton b = new NativeButton("A large button");
- b.setSizeFull();
- w.getContent().addComponent(b);
- getMainWindow().addWindow(w);
- setTheme("runo");
- }
-
- @Override
- protected String getDescription() {
- return "A 100%x100% sub window should not produce scrollbars in the main view or in the sub window. The button inside the sub window is 100%x100%, as is the layout";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3407;
- }
-
-}
diff --git a/src/com/vaadin/tests/components/window/SubWindowOrder.java b/src/com/vaadin/tests/components/window/SubWindowOrder.java deleted file mode 100644 index ca0d4e662e..0000000000 --- a/src/com/vaadin/tests/components/window/SubWindowOrder.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Window; - -public class SubWindowOrder extends TestBase { - - @Override - protected void setup() { - Window mainWindow = getMainWindow(); - for (int i = 1; i <= 10; i++) { - Window dialog = new Window("Dialog " + i, new HorizontalLayout()); - mainWindow.addWindow(dialog); - } - } - - @Override - protected String getDescription() { - return "Subwindows should be rendered in the same order as they are added."; - } - - @Override - protected Integer getTicketNumber() { - return 3363; - } - -} diff --git a/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java b/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java deleted file mode 100644 index aeab7f6c97..0000000000 --- a/src/com/vaadin/tests/components/window/SubwindowInvalidLayout.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.vaadin.tests.components.window;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-public class SubwindowInvalidLayout extends TestBase {
-
- @Override
- protected String getDescription() {
- return "The subwindow contains an invalid layout, which analyze layouts should detect.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3096;
- }
-
- @Override
- protected void setup() {
- Window window = new Window("Sub window");
- window.center();
-
- VerticalLayout vl = new VerticalLayout();
- vl.setWidth(null);
- Button b = new Button("A 100% wide button, invalid");
- b.setWidth("100%");
- vl.addComponent(b);
- window.addComponent(vl);
-
- getMainWindow().addWindow(window);
- }
-
-}
diff --git a/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html b/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html deleted file mode 100644 index f926696d63..0000000000 --- a/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.html +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>TestTooSmallSubwindowSize</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">TestTooSmallSubwindowSize</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.window.TestTooSmallSubwindowSize</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java b/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java deleted file mode 100644 index 859c1b4b5d..0000000000 --- a/src/com/vaadin/tests/components/window/TestTooSmallSubwindowSize.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class TestTooSmallSubwindowSize extends TestBase { - - @Override - protected String getDescription() { - return "The size of the subwindow (outer size) is set to 60x60 pixels. Minimum size for the content area is 150x100, which means the window and shadow should be around 155x155 and the content area 150x100. The decoration at the lower left corner of the window must not be missing either."; - } - - @Override - protected Integer getTicketNumber() { - return 2579; - } - - @Override - protected void setup() { - Window w = new Window("Scroll"); - Label desc = new Label( - "This is a new child window with a preset" - + " width, height and position. Resizing has been" - + " disabled for this window. Additionally, this text label" - + " is intentionally too large to fit the window. You can" - + " use the scrollbars to view different parts of the window content."); - w.addComponent(desc); - - // Set window position - w.setPositionX(100); - w.setPositionY(100); - - // Set window size - w.setWidth(60, Window.UNITS_PIXELS); - w.setHeight(60, Window.UNITS_PIXELS); - - // Disable resizing - w.setResizable(true); - - getMainWindow().addWindow(w); - } - -} diff --git a/src/com/vaadin/tests/components/window/UndefinedWidthSubWindow.html b/src/com/vaadin/tests/components/window/UndefinedWidthSubWindow.html deleted file mode 100644 index 68bb3c5f2d..0000000000 --- a/src/com/vaadin/tests/components/window/UndefinedWidthSubWindow.html +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="http://localhost:8888/" /> -<title>UndefinedWidthSubWindow</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">UndefinedWidthSubWindow</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.window.UndefinedWidthSubWindow</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>add-button</td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowUndefinedWidthSubWindow::/VWindow[0]/ScrollPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowUndefinedWidthSubWindow::/VWindow[0]/ScrollPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>add+2 remove</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowUndefinedWidthSubWindow::/VWindow[0]/ScrollPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowUndefinedWidthSubWindow::/VWindow[0]/ScrollPanel[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>screenCapture</td> - <td></td> - <td>add-button only</td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/window/UndefinedWidthSubWindow.java b/src/com/vaadin/tests/components/window/UndefinedWidthSubWindow.java deleted file mode 100644 index c8009c8431..0000000000 --- a/src/com/vaadin/tests/components/window/UndefinedWidthSubWindow.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class UndefinedWidthSubWindow extends TestBase { - - private Window autoWideWindow; - - @Override - protected String getDescription() { - return "Two windows should be shown. The width of the one in the upper left corner should be adjusted according to the contents. The centered windows width should be set according to the caption and the second textfield should be clipped."; - } - - @Override - protected Integer getTicketNumber() { - return null; - } - - private Component createRemoveButton() { - Button b = new Button("Remove"); - b.addListener(new ClickListener() { - - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - ComponentContainer cc = (ComponentContainer) b.getParent(); - cc.removeComponent(b); - } - }); - - return b; - } - - @Override - protected void setup() { - autoWideWindow = new Window("Dialog - width defined by contents", - new HorizontalLayout()); - autoWideWindow.getContent().setSizeUndefined(); - autoWideWindow.addComponent(new TextField("Field 1")); - autoWideWindow.addComponent(new TextField("Field 2")); - autoWideWindow.addComponent(new Button("Add", new ClickListener() { - - public void buttonClick(ClickEvent event) { - autoWideWindow.addComponent(createRemoveButton()); - - } - - })); - - getMainWindow().addWindow(autoWideWindow); - - Window dialog2 = new Window("Dialog - width defined by caption"); - dialog2.addComponent(new TextField("Field 1")); - - TextField tf2 = new TextField("Field 2"); - tf2.setWidth("500px"); - dialog2.addComponent(tf2); - dialog2.addComponent(new Button("Ok")); - - dialog2.center(); - getMainWindow().addWindow(dialog2); - } -} diff --git a/src/com/vaadin/tests/components/window/WindowResizeListener.java b/src/com/vaadin/tests/components/window/WindowResizeListener.java deleted file mode 100644 index 0ba87336f6..0000000000 --- a/src/com/vaadin/tests/components/window/WindowResizeListener.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.terminal.Sizeable; -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window.ResizeEvent; -import com.vaadin.ui.Window.ResizeListener; - -public class WindowResizeListener extends TestBase { - - @Override - protected String getDescription() { - return "Size changes from windows (both sub " - + "and browsers level) should get back to server." - + " If size changes, a separate server side event should occur."; - } - - @Override - protected Integer getTicketNumber() { - return null; - } - - Window subwin = new ResizeListenerWindow(); - - @Override - protected void setup() { - - final Label l = new Label(); - getLayout().addComponent(l); - - getMainWindow().addListener(new ResizeListener() { - public void windowResized(ResizeEvent e) { - l.setValue("Current main window size: " - + getMainWindow().getWidth() + " x " - + getMainWindow().getHeight()); - } - }); - - CheckBox subwindow = new CheckBox("show subwindow"); - subwindow.setImmediate(true); - subwindow.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (event.getButton().booleanValue()) { - getMainWindow().addWindow(subwin); - } else { - getMainWindow().removeWindow(subwin); - } - } - }); - getLayout().addComponent(subwindow); - - CheckBox immediate = new CheckBox("immediate"); - immediate.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - boolean booleanValue = event.getButton().booleanValue(); - getMainWindow().setImmediate(booleanValue); - subwin.setImmediate(booleanValue); - } - }); - immediate.setImmediate(true); - getLayout().addComponent(immediate); - - getLayout().addComponent(new Button("Sync")); - - } -} - -class ResizeListenerWindow extends Window { - Label sizeLabel = new Label(); - - public ResizeListenerWindow() { - super("Subwindow"); - setWidth("400px"); - - Layout hl = getLayout(); - hl.addComponent(new Label("Current size: ")); - hl.addComponent(sizeLabel); - - addListener(new ResizeListener() { - public void windowResized(ResizeEvent e) { - updateLabel(); - } - }); - - updateLabel(); - } - - public void updateLabel() { - sizeLabel - .setValue(getWidth() + Sizeable.UNIT_SYMBOLS[getWidthUnits()] - + " x " + getHeight() - + Sizeable.UNIT_SYMBOLS[getHeightUnits()]); - } -} diff --git a/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html b/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html deleted file mode 100644 index 4923bff58a..0000000000 --- a/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.html +++ /dev/null @@ -1,107 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<link rel="selenium.base" href="" /> -<title>WindowShouldRemoveActionHandler</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">WindowShouldRemoveActionHandler</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.window.WindowShouldRemoveActionHandler</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTitle</td> - <td>A panel with 2 action handlers</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTitle</td> - <td>A panel with 3 action handlers</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTitle</td> - <td>A panel with 3 action handlers - Removed handler - Removed handler</td> - <td></td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowShouldRemoveActionHandler::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>waitForVaadin</td> - <td></td> - <td></td> -</tr> -<tr> - <td>verifyTitle</td> - <td>A panel with 2 action handlers</td> - <td></td> -</tr> - -</tbody></table> -</body> -</html> diff --git a/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java b/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java deleted file mode 100644 index d61deffef8..0000000000 --- a/src/com/vaadin/tests/components/window/WindowShouldRemoveActionHandler.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.vaadin.tests.components.window;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.vaadin.event.Action;
-import com.vaadin.event.ShortcutAction;
-import com.vaadin.event.Action.Handler;
-import com.vaadin.event.ShortcutAction.ModifierKey;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class WindowShouldRemoveActionHandler extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Adding action handlers to the window should make them appear on the client side. Removing the action handlers should remove them also from the client side, also if all action handlers are removed.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2941;
- }
-
- @Override
- protected void setup() {
- addComponent(new TextField());
- Button add = new Button("Add an action handler",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- add();
- }
-
- });
- Button addAnother = new Button("Add another action handler",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- addAnother();
- }
-
- });
- Button remove = new Button("Remove an action handler",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- remove();
- }
-
- });
-
- addComponent(add);
- addComponent(addAnother);
- addComponent(remove);
- }
-
- public void remove() {
- getMainWindow().setCaption(
- getMainWindow().getCaption() + " - Removed handler");
- getMainWindow().removeActionHandler(
- actionHandlers.remove(actionHandlers.size() - 1));
- }
-
- private List<Handler> actionHandlers = new ArrayList<Handler>();
-
- public void add() {
- getMainWindow().setCaption(
- getMainWindow().getCaption() + " - Added handler");
- Handler actionHandler = new Handler() {
-
- public Action[] getActions(Object target, Object sender) {
- return new Action[] { new ShortcutAction("Ctrl+Left",
- ShortcutAction.KeyCode.ARROW_LEFT,
- new int[] { ModifierKey.CTRL }) };
- }
-
- public void handleAction(Action action, Object sender, Object target) {
- getMainWindow().showNotification(
- "Handling action " + action.getCaption());
- }
-
- };
-
- addHandler(actionHandler);
- }
-
- public void addAnother() {
- Handler actionHandler = new Handler() {
-
- public Action[] getActions(Object target, Object sender) {
- return new Action[] { new ShortcutAction("Ctrl+Right",
- ShortcutAction.KeyCode.ARROW_RIGHT,
- new int[] { ModifierKey.CTRL }) };
- }
-
- public void handleAction(Action action, Object sender, Object target) {
- getMainWindow().showNotification(
- "Handling action " + action.getCaption());
- }
-
- };
-
- addHandler(actionHandler);
- }
-
- private void addHandler(Handler actionHandler) {
- actionHandlers.add(actionHandler);
- getMainWindow().addActionHandler(actionHandler);
- getMainWindow().setCaption(
- "A panel with " + actionHandlers.size() + " action handlers");
-
- }
-}
diff --git a/src/com/vaadin/tests/components/window/WindowStyleNames.java b/src/com/vaadin/tests/components/window/WindowStyleNames.java deleted file mode 100644 index 3a36926b42..0000000000 --- a/src/com/vaadin/tests/components/window/WindowStyleNames.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.components.window; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class WindowStyleNames extends TestBase { - - @Override - protected String getDescription() { - return "Click 'add style' to add a 'new' style to the window. The 'old' style should disappear and only the 'new' style should be set. Verify using e.g. firebug"; - } - - @Override - protected Integer getTicketNumber() { - return 3059; - } - - @Override - protected void setup() { - setWindowStyle("old"); - addComponent(new Button("Set style to 'new'", new ClickListener() { - - public void buttonClick(ClickEvent event) { - setWindowStyle("new"); - } - - })); - - addComponent(new Button("Set style to 'custom'", new ClickListener() { - - public void buttonClick(ClickEvent event) { - setWindowStyle("custom"); - } - - })); - - addComponent(new Button("Add 'foo' style", new ClickListener() { - - public void buttonClick(ClickEvent event) { - getMainWindow().addStyleName("foo"); - } - - })); - - } - - protected void setWindowStyle(String string) { - getMainWindow().setStyleName(string); - - } - -} diff --git a/src/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java b/src/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java deleted file mode 100644 index e4b65d5676..0000000000 --- a/src/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.vaadin.tests.containers;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.terminal.Sizeable;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class BeanItemContainerFilteringTest extends TestBase {
-
- private Table table;
- private BeanItemContainer<TestBean> container;
- private TextField filterString;
- private TextField position;
- private int nextToAdd = 1;
- private Label nextLabel;
-
- protected static class TestBean {
- private String id;
- private String value;
-
- public TestBean() {
- }
-
- public TestBean(String id, String value) {
- setId(id);
- setValue(value);
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
- }
-
- @Override
- protected String getDescription() {
- return "Test adding items in a filtered BeanItemContainer.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return new Integer(1061);
- }
-
- @Override
- protected void setup() {
- table = new Table();
- try {
- container = new BeanItemContainer<TestBean>(TestBean.class);
- table.setContainerDataSource(container);
-
- table.setWidth(300, Sizeable.UNITS_PIXELS);
- table.setSelectable(true);
- table.setMultiSelect(false);
- table.setEditable(true);
- table.setImmediate(true);
- // table.addContainerProperty("column1", String.class, "test");
-
- for (int i = 0; i < 25; ++i) {
- container.addItem(new TestBean("Item " + i, "Value for " + i));
- }
-
- VerticalLayout vl = new VerticalLayout();
-
- // activate & deactivate filtering
- filterString = new TextField("Filter string:", "1");
- vl.addComponent(filterString);
-
- final CheckBox cb = new CheckBox("Filter on value",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- container.removeAllContainerFilters();
- if (((CheckBox) event.getSource()).booleanValue()) {
- container.addContainerFilter("value",
- filterString.getValue().toString(),
- false, false);
- }
- }
- });
- cb.setImmediate(true);
- vl.addComponent(cb);
-
- nextLabel = new Label();
- nextLabel.setCaption("Next id: " + nextToAdd);
- vl.addComponent(nextLabel);
-
- // addItemAt(idx), addItemAfter(selection), addItem()
-
- final Button addItemButton = new Button("addItem()",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- container.addItem(new TestBean("addItem() "
- + nextToAdd, "value " + nextToAdd));
- nextToAdd++;
- nextLabel.setCaption("Next id: " + nextToAdd);
- }
- });
- addItemButton.setImmediate(true);
- vl.addComponent(addItemButton);
-
- final Button addItemAfterButton = new Button("addItemAfter()",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Object selection = table.getValue();
- if (selection == null) {
- return;
- }
- TestBean bean = new TestBean("addItemAfter() "
- + nextToAdd, "value " + nextToAdd);
- Item item = container.addItemAfter(selection, bean);
- if (item == null) {
- getMainWindow().showNotification(
- "Adding item after " + selection
- + " failed");
- }
- nextToAdd++;
- nextLabel.setCaption("Next id: " + nextToAdd);
- }
- });
- addItemAfterButton.setImmediate(true);
- vl.addComponent(addItemAfterButton);
-
- position = new TextField("Position:", "0");
- vl.addComponent(position);
-
- final Button addItemAtButton = new Button("addItemAt()",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- int index = Integer.parseInt(position.getValue()
- .toString());
- TestBean bean = new TestBean("addItemAt() "
- + nextToAdd, "value " + nextToAdd);
- Item item = container.addItemAt(index, bean);
- if (item == null) {
- getMainWindow().showNotification(
- "Adding item at index "
- + position.getValue()
- + " failed");
- }
- nextToAdd++;
- nextLabel.setCaption("Next id: " + nextToAdd);
- }
- });
- addItemAtButton.setImmediate(true);
- vl.addComponent(addItemAtButton);
-
- getLayout().addComponent(table);
- getLayout().addComponent(vl);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/containers/BeanItemContainerTest.java b/src/com/vaadin/tests/containers/BeanItemContainerTest.java deleted file mode 100644 index 905ec2f9ff..0000000000 --- a/src/com/vaadin/tests/containers/BeanItemContainerTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.vaadin.tests.containers; - -import java.util.Collection; -import java.util.LinkedList; - -import com.vaadin.data.util.BeanItemContainer; - -public class BeanItemContainerTest { - - /** - * Test class for BeanItemContainer - * - * @throws IllegalAccessException - * @throws InstantiationException - */ - public static void main(String[] args) throws InstantiationException, - IllegalAccessException { - BeanItemContainer<Hello> c = new BeanItemContainer<Hello>(Hello.class); - c.addItem(new Hello()); - - Collection<Hello> col = new LinkedList<Hello>(); - for (int i = 0; i < 100; i++) { - col.add(new Hello()); - } - col.add(new Hello2()); - - c = new BeanItemContainer<Hello>(col); - - System.out.println(c + " contains " + c.size() + " objects"); - - // test that subclass properties are handled correctly - System.out.println(c + " item 0 second = " - + c.getContainerProperty(c.getIdByIndex(0), "second")); - System.out.println(c + " item 100 second = " - + c.getContainerProperty(c.getIdByIndex(100), "second")); - - } - - public static class Hello { - - public String first; - public String second; - - public Hello() { - first = "f"; - second = "l"; - } - - public String getFirst() { - return first; - } - - public void setFirst(String first) { - this.first = first; - } - - public String getSecond() { - return second; - } - - public void setSecond(String second) { - this.second = second; - } - - } - - public static class Hello2 extends Hello { - - @Override - public String getSecond() { - return "second"; - } - - } -} diff --git a/src/com/vaadin/tests/containers/IndexedContainerFilteringTest.java b/src/com/vaadin/tests/containers/IndexedContainerFilteringTest.java deleted file mode 100644 index d66435bdaa..0000000000 --- a/src/com/vaadin/tests/containers/IndexedContainerFilteringTest.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.vaadin.tests.containers;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.terminal.Sizeable;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class IndexedContainerFilteringTest extends TestBase {
-
- private Table table;
- private IndexedContainer container;
- private TextField filterString;
- private TextField position;
- private int nextToAdd = 1;
- private Label nextLabel;
-
- @Override
- protected String getDescription() {
- return "Adding items to a filtered IndexedContainer inserts the items at the wrong location.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return new Integer(2809);
- }
-
- @Override
- protected void setup() {
- table = new Table();
- container = (IndexedContainer) table.getContainerDataSource();
-
- table.setWidth(300, Sizeable.UNITS_PIXELS);
- table.setSelectable(true);
- table.setMultiSelect(false);
- table.addContainerProperty("column1", String.class, "test");
-
- for (int i = 0; i < 25; ++i) {
- table.addItem(new Object[] { "Item " + i }, "Item " + i);
- }
-
- VerticalLayout vl = new VerticalLayout();
-
- // activate & deactivate filtering
- filterString = new TextField("Filter string:", "1");
- vl.addComponent(filterString);
-
- final CheckBox cb = new CheckBox("Filter", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- container.removeAllContainerFilters();
- if (((CheckBox) event.getSource()).booleanValue()) {
- container.addContainerFilter("column1", filterString
- .getValue().toString(), false, false);
- }
- }
- });
- cb.setImmediate(true);
- vl.addComponent(cb);
-
- nextLabel = new Label();
- nextLabel.setCaption("Next id: " + nextToAdd);
- vl.addComponent(nextLabel);
-
- // addItemAt(idx), addItemAfter(selection), addItem()
-
- final Button addItemButton = new Button("addItem()",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Item item = container.addItem("addItem() " + nextToAdd);
- if (item != null) {
- item.getItemProperty("column1").setValue(
- "addItem() " + nextToAdd);
- }
- nextToAdd++;
- nextLabel.setCaption("Next id: " + nextToAdd);
- }
- });
- addItemButton.setImmediate(true);
- vl.addComponent(addItemButton);
-
- final Button addItemAfterButton = new Button("addItemAfter()",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- Object selection = table.getValue();
- if (selection == null) {
- return;
- }
- String id = "addItemAfter() " + nextToAdd;
- Item item = container.addItemAfter(selection, id);
- if (item != null) {
- item.getItemProperty("column1").setValue(id);
- table.setValue(id);
- } else {
- getMainWindow().showNotification(
- "Adding item after " + selection
- + " failed");
- }
- nextToAdd++;
- nextLabel.setCaption("Next id: " + nextToAdd);
- }
- });
- addItemAfterButton.setImmediate(true);
- vl.addComponent(addItemAfterButton);
-
- position = new TextField("Position:", "0");
- vl.addComponent(position);
-
- final Button addItemAtButton = new Button("addItemAt()",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- int index = Integer.parseInt(position.getValue()
- .toString());
- String id = "addItemAt() " + nextToAdd;
- Item item = container.addItemAt(index, id);
- if (item != null) {
- item.getItemProperty("column1").setValue(id);
- table.setValue(id);
- } else {
- getMainWindow().showNotification(
- "Adding item at index "
- + position.getValue() + " failed");
- }
- nextToAdd++;
- nextLabel.setCaption("Next id: " + nextToAdd);
- }
- });
- addItemAtButton.setImmediate(true);
- vl.addComponent(addItemAtButton);
-
- getLayout().addComponent(table);
- getLayout().addComponent(vl);
- }
-}
diff --git a/src/com/vaadin/tests/featurebrowser/Feature.java b/src/com/vaadin/tests/featurebrowser/Feature.java deleted file mode 100644 index f3335f8e24..0000000000 --- a/src/com/vaadin/tests/featurebrowser/Feature.java +++ /dev/null @@ -1,199 +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.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TabSheet; - -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 OrderedLayout layout; - - private TabSheet ts; - - private boolean initialized = false; - - private static Resource sampleIcon; - - protected PropertyPanel propertyPanel; - - private Label javadoc; - - private Label description; - - /** Constuctor for the feature component */ - public Feature() { - layout = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - setCompositionRoot(layout); - } - - /** - * Actual URL consists of "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 OrderedLayout mainLayout = new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL); - final OrderedLayout layout = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - 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 OrderedLayout l = new OrderedLayout(); - if (getTitle() != null) { - l.addComponent(new Label( - "<b>// " + getTitle() + " example</b>", - Label.CONTENT_XHTML)); - } - l.addComponent(new Label(example, Label.CONTENT_PREFORMATTED)); - ts.addTab(l, "Code Sample", null); - } - - } - - /** Get the desctiption of the feature as XHTML fragment */ - protected String getDescriptionXHTML() { - return "<h2>Feature description is under construction</h2>"; - } - - /** Get the title of the feature */ - protected String getTitle() { - return 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/src/com/vaadin/tests/featurebrowser/FeatureBrowser.java b/src/com/vaadin/tests/featurebrowser/FeatureBrowser.java deleted file mode 100644 index 2b8668aa94..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureBrowser.java +++ /dev/null @@ -1,353 +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.AbstractComponent; -import com.vaadin.ui.Button; -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; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class FeatureBrowser extends CustomComponent implements - Property.ValueChangeListener, ClickListener, Layout { - - private Tree features; - - private Feature currentFeature = null; - - private CustomLayout mainlayout; - - private PropertyPanel properties; - - private boolean initialized = false; - - private 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.setStyle("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.setStyle("link"); - mainlayout.addComponent(close, "restart"); - - // Test component - registerFeature("/Welcome", new IntroWelcome()); - registerFeature("/UI Components", new IntroComponents()); - registerFeature("/UI Components/Basic", new IntroBasic()); - registerFeature("/UI Components/Basic/Text Field", - new FeatureTextField()); - registerFeature("/UI Components/Basic/Date Field", - new FeatureDateField()); - registerFeature("/UI Components/Basic/Button", new FeatureButton()); - registerFeature("/UI Components/Basic/Form", new FeatureForm()); - registerFeature("/UI Components/Basic/Label", new FeatureLabel()); - registerFeature("/UI Components/Basic/Link", new FeatureLink()); - registerFeature("/UI Components/Item Containers", - new IntroItemContainers()); - registerFeature("/UI Components/Item Containers/Select", - new FeatureSelect()); - registerFeature("/UI Components/Item Containers/Table", - new FeatureTable()); - registerFeature("/UI Components/Item Containers/Tree", - new FeatureTree()); - registerFeature("/UI Components/Layouts", new IntroLayouts()); - registerFeature("/UI Components/Layouts/Ordered Layout", - new FeatureOrderedLayout()); - registerFeature("/UI Components/Layouts/Grid Layout", - new FeatureGridLayout()); - registerFeature("/UI Components/Layouts/Custom Layout", - new FeatureCustomLayout()); - registerFeature("/UI Components/Layouts/Panel", new FeaturePanel()); - registerFeature("/UI Components/Layouts/Tab Sheet", - new FeatureTabSheet()); - registerFeature("/UI Components/Layouts/Window", new FeatureWindow()); - // Disabled for now - // registerFeature("/UI Components/Layouts/Frame Window", - // new FeatureFrameWindow()); - registerFeature("/UI Components/Data handling", new IntroDataHandling()); - registerFeature("/UI Components/Data handling/Embedded Objects", - new FeatureEmbedded()); - registerFeature("/UI Components/Data handling/Upload", - new FeatureUpload()); - registerFeature("/Data Model", new IntroDataModel()); - registerFeature("/Data Model/Properties", new FeatureProperties()); - registerFeature("/Data Model/Items", new FeatureItems()); - registerFeature("/Data Model/Containers", new FeatureContainers()); - registerFeature("/Data Model/Validators", new FeatureValidators()); - registerFeature("/Data Model/Buffering", new FeatureBuffering()); - // registerFeature("/Terminal", new IntroTerminal()); - // registerFeature("/Terminal/Parameters and URI Handling", - // new FeatureParameters()); - - // Pre-open all menus - for (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) - && ((AbstractComponent) event.getProperty()).getTag() - .equals("tree")) { - // ignore tree initialization - } else { - FeatureUtil.debug(getApplication().getUser().toString(), - "valueChange " - + ((AbstractComponent) event.getProperty()) - .getTag() + ", " + 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().getTag() + ", " - + 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 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/src/com/vaadin/tests/featurebrowser/FeatureBuffering.java b/src/com/vaadin/tests/featurebrowser/FeatureBuffering.java deleted file mode 100644 index 48ead2f676..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureBuffering.java +++ /dev/null @@ -1,91 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - 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/src/com/vaadin/tests/featurebrowser/FeatureButton.java b/src/com/vaadin/tests/featurebrowser/FeatureButton.java deleted file mode 100644 index a47eda9d35..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureButton.java +++ /dev/null @@ -1,72 +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.OrderedLayout; -import com.vaadin.ui.Select; - -public class FeatureButton extends Feature { - - public FeatureButton() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureContainers.java b/src/com/vaadin/tests/featurebrowser/FeatureContainers.java deleted file mode 100644 index 319be0056b..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureContainers.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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureCustomLayout.java b/src/com/vaadin/tests/featurebrowser/FeatureCustomLayout.java deleted file mode 100644 index 97ce9761a1..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureCustomLayout.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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureDateField.java b/src/com/vaadin/tests/featurebrowser/FeatureDateField.java deleted file mode 100644 index 31a3c53438..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureDateField.java +++ /dev/null @@ -1,105 +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.OrderedLayout; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureEmbedded.java b/src/com/vaadin/tests/featurebrowser/FeatureEmbedded.java deleted file mode 100644 index 65453a8ecc..0000000000 --- a/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.OrderedLayout; - -public class FeatureEmbedded extends Feature { - - public FeatureEmbedded() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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(250); - emb.setHeight(100); - 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/src/com/vaadin/tests/featurebrowser/FeatureForm.java b/src/com/vaadin/tests/featurebrowser/FeatureForm.java deleted file mode 100644 index f50ad70ffc..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureForm.java +++ /dev/null @@ -1,182 +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.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; - -public class FeatureForm extends Feature implements - Property.ValueChangeListener { - - OrderedLayout demo = null; - - Form test; - - Layout formLayout = null; - - Select addField = new Select("Add field"); - - Select resetLayout = new Select("Restart"); - - @Override - protected Component getDemoComponent() { - - if (demo == null) { - demo = new OrderedLayout(); - createDemo(); - } - - setJavadocURL("ui/Form.html"); - - return demo; - } - - private void createDemo() { - - demo.removeAllComponents(); - - // Test form - if (formLayout == null) { - test = new Form(); - } else { - test = new Form(formLayout); - } - - demo.addComponent(test); - final OrderedLayout actions = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - demo.addComponent(actions); - - // form adder - addField.setImmediate(true); - addField.addItem("Add field"); - addField.setNullSelectionItemId("Add field"); - addField.addItem("Text field"); - addField.addItem("Time"); - addField.addItem("Option group"); - addField.addItem("Calendar"); - addField.addListener(this); - actions.addComponent(addField); - - // Layout reset - resetLayout.setImmediate(true); - resetLayout.addItem("Select layout example"); - resetLayout.setNullSelectionItemId("Select layout example"); - resetLayout.addItem("Vertical form (OrderedLayout form-style)"); - resetLayout.addItem("Two columns (2x1 GridLayout)"); - resetLayout.addItem("Flow (OrderedLayout flow-orientation)"); - resetLayout.addListener(this); - actions.addComponent(resetLayout); - - // Properties - propertyPanel = new PropertyPanel(test); - propertyPanel.addProperties("Form special properties", new Form()); - } - - public void valueChange(Property.ValueChangeEvent event) { - - if (event.getProperty() == resetLayout) { - - 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 OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - } - - 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.setStyle("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.setStyle("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.setStyle("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/src/com/vaadin/tests/featurebrowser/FeatureGridLayout.java b/src/com/vaadin/tests/featurebrowser/FeatureGridLayout.java deleted file mode 100644 index 297248001e..0000000000 --- a/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.OrderedLayout; -import com.vaadin.ui.TextField; - -public class FeatureGridLayout extends Feature { - - public FeatureGridLayout() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - final GridLayout gl = new GridLayout(3, 3); - final DateField cal = new DateField("Test component 1", new Date()); - cal.setStyle("calendar"); - gl.addComponent(cal, 1, 0, 2, 1); - for (int i = 2; i < 7; i++) { - gl.addComponent(new TextField("Test component " + i)); - } - l.addComponent(gl); - - // Properties - propertyPanel = new PropertyPanel(gl); - 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/src/com/vaadin/tests/featurebrowser/FeatureItems.java b/src/com/vaadin/tests/featurebrowser/FeatureItems.java deleted file mode 100644 index 00e06deafd..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureItems.java +++ /dev/null @@ -1,87 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class FeatureItems extends Feature { - - private static final String INTRO_TEXT = "" - + "Item is an object, which contains a set of named " - + "properties. Each property is identified by an " - + "id and a reference to the property can be queried from the Item. " - + "Item defines inner-interfaces for maintaining the item property " - + "set and listening the item property set changes." - + "<br /><br />Items generally represent objects in the object-oriented " - + "model, but with the exception that they are configurable " - + "and provide an event mechanism. The simplest way of utilizing " - + "Item interface is to use existing Item implementations. " - + "Provided utility classes include configurable property set," - + " bean to item adapter and Form UI component."; - - public FeatureItems() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureLabel.java b/src/com/vaadin/tests/featurebrowser/FeatureLabel.java deleted file mode 100644 index f12a76b39b..0000000000 --- a/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.OrderedLayout; - -public class FeatureLabel extends Feature { - - public FeatureLabel() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureLink.java b/src/com/vaadin/tests/featurebrowser/FeatureLink.java deleted file mode 100644 index c20f8fe456..0000000000 --- a/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.OrderedLayout; - -public class FeatureLink extends Feature { - - public FeatureLink() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureOrderedLayout.java b/src/com/vaadin/tests/featurebrowser/FeatureOrderedLayout.java deleted file mode 100644 index 1ef07a6878..0000000000 --- a/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.Form; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.TextField; - -public class FeatureOrderedLayout extends Feature { - - public FeatureOrderedLayout() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - final OrderedLayout ol = new OrderedLayout(); - for (int i = 1; i < 5; i++) { - ol.addComponent(new TextField("Test component " + i)); - } - l.addComponent(ol); - - // Properties - propertyPanel = new PropertyPanel(ol); - final Form ap = propertyPanel - .createBeanPropertySet(new String[] { "orientation" }); - ap.replaceWithSelect("orientation", new Object[] { - new Integer(OrderedLayout.ORIENTATION_HORIZONTAL), - new Integer(OrderedLayout.ORIENTATION_VERTICAL) }, - new Object[] { "Horizontal", "Vertical" }); - 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(OrderedLayout.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/src/com/vaadin/tests/featurebrowser/FeaturePanel.java b/src/com/vaadin/tests/featurebrowser/FeaturePanel.java deleted file mode 100644 index a12e51cae2..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeaturePanel.java +++ /dev/null @@ -1,73 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class FeaturePanel extends Feature { - - public FeaturePanel() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - // 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/src/com/vaadin/tests/featurebrowser/FeatureParameters.java b/src/com/vaadin/tests/featurebrowser/FeatureParameters.java deleted file mode 100644 index 4bb90e02b0..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureParameters.java +++ /dev/null @@ -1,167 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.Table; - -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 OrderedLayout l = new OrderedLayout(); - - 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 parameters) { - params.removeAllItems(); - for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) { - final String name = (String) i.next(); - final String[] values = (String[]) parameters.get(name); - String v = ""; - for (int j = 0; j < values.length; j++) { - if (v.length() > 0) { - v += ", "; - } - v += "'" + values[j] + "'"; - } - params.addItem(new Object[] { v }, name); - } - } -} diff --git a/src/com/vaadin/tests/featurebrowser/FeatureProperties.java b/src/com/vaadin/tests/featurebrowser/FeatureProperties.java deleted file mode 100644 index 5c2b07b3e2..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureProperties.java +++ /dev/null @@ -1,92 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureSelect.java b/src/com/vaadin/tests/featurebrowser/FeatureSelect.java deleted file mode 100644 index d38815e960..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureSelect.java +++ /dev/null @@ -1,90 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureTabSheet.java b/src/com/vaadin/tests/featurebrowser/FeatureTabSheet.java deleted file mode 100644 index 5dd686e60e..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureTabSheet.java +++ /dev/null @@ -1,75 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TabSheet; - -public class FeatureTabSheet extends Feature { - - public FeatureTabSheet() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureTable.java b/src/com/vaadin/tests/featurebrowser/FeatureTable.java deleted file mode 100644 index ecc000320b..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureTable.java +++ /dev/null @@ -1,195 +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.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.Table; - -public class FeatureTable extends Feature implements Action.Handler { - - private static final String[] firstnames = new String[] { "John", "Mary", - "Joe", "Sarah", "Jeff", "Jane", "Peter", "Marc", "Josie", "Linus" }; - - private static final String[] lastnames = new String[] { "Torvalds", - "Smith", "Jones", "Beck", "Sheridan", "Picard", "Hill", "Fielding", - "Einstein" }; - - private static final String[] title = new String[] { "Project Manager", - "Marketing Manager", "Sales Manager", "Trainer", "IT Support", - "Account Manager", "Customer Support", "Testing Engineer", - "Software Designer", "Programmer", "Consultant" }; - - private static final String[] unit = new String[] { "Tokyo", "Mexico City", - "Seoul", "New York", "Sao Paulo", "Bombay", "Delhi", "Shanghai", - "Los Angeles", "London", "Bangalore", "Hong Kong", "Madrid", - "Milano", "Beijing", "Paris", "Moscow", "Helsinki" }; - - private Table t; - - private boolean actionsActive = false; - - private 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 OrderedLayout l = new OrderedLayout(); - - // Sample table - t = new Table("Corporate Employees"); - t.setPageLength(10); - l.addComponent(t); - - // Add columns to table - t.addContainerProperty("Firstname", String.class, ""); - t.addContainerProperty("Lastname", String.class, ""); - t.addContainerProperty("Title", String.class, ""); - t.addContainerProperty("Unit", String.class, ""); - - // set alignments to demonstrate features - t.setColumnAlignment("Title", Table.ALIGN_CENTER); - t.setColumnAlignment("Unit", Table.ALIGN_RIGHT); - - // Add random rows to table - for (int j = 0; j < 300; j++) { - t - .addItem( - new Object[] { - firstnames[(int) (Math.random() * (firstnames.length - 1))], - lastnames[(int) (Math.random() * (lastnames.length - 1))], - title[(int) (Math.random() * title.length)], - unit[(int) (Math.random() * unit.length)] }, - new Integer(j)); - } - - // Actions - l.addComponent(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/src/com/vaadin/tests/featurebrowser/FeatureTextField.java b/src/com/vaadin/tests/featurebrowser/FeatureTextField.java deleted file mode 100644 index f2612ec857..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureTextField.java +++ /dev/null @@ -1,73 +0,0 @@ -/* -@ITMillApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.featurebrowser; - -import com.vaadin.ui.Component; -import com.vaadin.ui.Form; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; - -public class FeatureTextField extends Feature { - - public FeatureTextField() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - - // 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/src/com/vaadin/tests/featurebrowser/FeatureTree.java b/src/com/vaadin/tests/featurebrowser/FeatureTree.java deleted file mode 100644 index 368b2df0f7..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureTree.java +++ /dev/null @@ -1,174 +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.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.Tree; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureUpload.java b/src/com/vaadin/tests/featurebrowser/FeatureUpload.java deleted file mode 100644 index 2dd586d7b8..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureUpload.java +++ /dev/null @@ -1,150 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Upload; -import com.vaadin.ui.Upload.FinishedEvent; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureUtil.java b/src/com/vaadin/tests/featurebrowser/FeatureUtil.java deleted file mode 100644 index 077ee4fbe5..0000000000 --- a/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/src/com/vaadin/tests/featurebrowser/FeatureValidators.java b/src/com/vaadin/tests/featurebrowser/FeatureValidators.java deleted file mode 100644 index 5f251929a5..0000000000 --- a/src/com/vaadin/tests/featurebrowser/FeatureValidators.java +++ /dev/null @@ -1,87 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeatureWindow.java b/src/com/vaadin/tests/featurebrowser/FeatureWindow.java deleted file mode 100644 index 0153bf5a0e..0000000000 --- a/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.OrderedLayout; -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 OrderedLayout layoutRoot = new OrderedLayout(); - final OrderedLayout layoutUpper = new OrderedLayout(); - final OrderedLayout layoutLower = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/FeaturesApplication.java b/src/com/vaadin/tests/featurebrowser/FeaturesApplication.java deleted file mode 100644 index 2d3ac436ad..0000000000 --- a/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.setLayout(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/src/com/vaadin/tests/featurebrowser/IntroBasic.java b/src/com/vaadin/tests/featurebrowser/IntroBasic.java deleted file mode 100644 index 5d480c106a..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroBasic.java +++ /dev/null @@ -1,79 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class IntroBasic extends Feature { - - private static final String INTRO_TEXT = "" - + "Text Field, Date Field, Button, Form, Label and Link components are provided as samples" - + " for basic UI components." - + "<br /><br />See the API documentation of respective components for more information."; - - public IntroBasic() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/IntroComponents.java b/src/com/vaadin/tests/featurebrowser/IntroComponents.java deleted file mode 100644 index c4898a7fcc..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroComponents.java +++ /dev/null @@ -1,83 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class IntroComponents extends Feature { - - private static final String INTRO_TEXT = "" - + "This picture summarizes the relations between different user interface (UI) components." - + "<br /><br />See API documentation below for more information."; - - public IntroComponents() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/IntroDataHandling.java b/src/com/vaadin/tests/featurebrowser/IntroDataHandling.java deleted file mode 100644 index d164442d4c..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroDataHandling.java +++ /dev/null @@ -1,78 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class IntroDataHandling extends Feature { - - private static final String INTRO_TEXT = "" - + "Embedded Objects and Upload components are provided as samples" - + " for data handling section." - + "<br /><br />See the API documentation of respective components for more information."; - - public IntroDataHandling() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/IntroDataModel.java b/src/com/vaadin/tests/featurebrowser/IntroDataModel.java deleted file mode 100644 index b4fb8f6757..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroDataModel.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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/IntroItemContainers.java b/src/com/vaadin/tests/featurebrowser/IntroItemContainers.java deleted file mode 100644 index db9909946c..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroItemContainers.java +++ /dev/null @@ -1,79 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class IntroItemContainers extends Feature { - - private static final String INTRO_TEXT = "" - + "Select, Table and Tree components are provided as samples" - + " for item containers section." - + "<br /><br />See the API documentation of respective components for more information."; - - public IntroItemContainers() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/IntroLayouts.java b/src/com/vaadin/tests/featurebrowser/IntroLayouts.java deleted file mode 100644 index bd180a860c..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroLayouts.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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -public class IntroLayouts extends Feature { - - private static final String INTRO_TEXT = "" - + "Layouts are required to place components to specific place in the UI." - + " You can use plain Java to accomplish sophisticated component layouting." - + " Other option is to use Custom Layout and let the web page designers" - + " to take responsibility of component layouting using their own set of tools." - + "<br /><br />See API documentation below for more information."; - - public IntroLayouts() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - 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/src/com/vaadin/tests/featurebrowser/IntroTerminal.java b/src/com/vaadin/tests/featurebrowser/IntroTerminal.java deleted file mode 100644 index 8bb4a3f145..0000000000 --- a/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.OrderedLayout; - -public class IntroTerminal extends Feature { - - public IntroTerminal() { - super(); - } - - @Override - protected Component getDemoComponent() { - - final OrderedLayout l = new OrderedLayout(); - - final Label lab = new Label(); - lab.setStyle("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/src/com/vaadin/tests/featurebrowser/IntroWelcome.java b/src/com/vaadin/tests/featurebrowser/IntroWelcome.java deleted file mode 100644 index d9c20b96b2..0000000000 --- a/src/com/vaadin/tests/featurebrowser/IntroWelcome.java +++ /dev/null @@ -1,173 +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.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; - -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 OrderedLayout l = new OrderedLayout(); - - 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 parameters) { - for (final Iterator i = parameters.keySet().iterator(); i.hasNext();) { - final String name = (String) i.next(); - if (name.equals("systemStatus")) { - String status = ""; - status += "timestamp=" + new Date() + " "; - status += "free=" + Runtime.getRuntime().freeMemory() + ", "; - status += "total=" + Runtime.getRuntime().totalMemory() + ", "; - status += "max=" + Runtime.getRuntime().maxMemory() + "\n"; - System.out.println(status); - } - } - } - -} diff --git a/src/com/vaadin/tests/featurebrowser/PropertyPanel.java b/src/com/vaadin/tests/featurebrowser/PropertyPanel.java deleted file mode 100644 index 5e105dbf1e..0000000000 --- a/src/com/vaadin/tests/featurebrowser/PropertyPanel.java +++ /dev/null @@ -1,512 +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.AbstractComponent; -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.OptionGroup; -import com.vaadin.ui.OrderedLayout; -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.Window; - -public class PropertyPanel extends Panel implements Button.ClickListener, - Property.ValueChangeListener { - - private Select addComponent; - - private final OrderedLayout formsLayout = new OrderedLayout(); - - private final LinkedList forms = new LinkedList(); - - 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 config; - - protected static final int COLUMNS = 3; - - /** Contruct new property panel for configuring given object. */ - public PropertyPanel(Object objectToConfigure) { - super(); - getLayout().setMargin(false); - - // Layout - setCaption("Properties"); - addComponent(formsLayout); - - setSizeFull(); - - // Target object - this.objectToConfigure = objectToConfigure; - config = new BeanItem(objectToConfigure); - - // Control buttons - final OrderedLayout buttons = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - 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(Panel.STYLE_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 listed = new HashSet(); - for (final Iterator i = forms.iterator(); i.hasNext();) { - listed.addAll(((Form) 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"), new Boolean(true)); - disableField(set.getField("visible"), new Boolean(true)); - disableField(set.getField("componentError")); - disableField(set.getField("icon")); - } - } - - /** Add properties for selecting */ - private void addSelectProperties() { - 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 OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL)); - - addComponent = new Select(); - addComponent.setImmediate(true); - addComponent.addItem("Add component to container"); - addComponent.setNullSelectionItemId("Add component to container"); - addComponent.addItem("Text field"); - addComponent.addItem("Option group"); - addComponent.addListener(this); - - set.addField("component adder", addComponent); - set.addField("remove all components", new Button( - "Remove all components", objectToConfigure, - "removeAllComponents")); - - addProperties("ComponentContainer Features", set); - } - - /** Value change listener for listening selections */ - public void valueChange(Property.ValueChangeEvent event) { - - // FIXME: navigation statistics - try { - FeatureUtil.debug(getApplication().getUser().toString(), - "valueChange " - + ((AbstractComponent) event.getProperty()) - .getTag() + ", " + event.getProperty()); - } catch (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().getTag() + ", " - + 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 i = forms.iterator(); i.hasNext();) { - ((Form) i.next()).discard(); - } - } - - } - - /** - * Helper function for creating forms from array of propety names. - */ - protected Form createBeanPropertySet(String names[]) { - - final Form set = new Form(new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL)); - - 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 i = forms.iterator(); i.hasNext();) { - final Form f = (Form) 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 i = forms.iterator(); i.hasNext();) { - ((Form) i.next()).commit(); - } - } - - private void disableField(Field field) { - field.setEnabled(false); - field.setReadOnly(true); - } - - private void disableField(Field field, Object value) { - field.setValue(value); - disableField(field); - } - -} diff --git a/src/com/vaadin/tests/featurebrowser/components.png b/src/com/vaadin/tests/featurebrowser/components.png Binary files differdeleted file mode 100644 index e5681d4d37..0000000000 --- a/src/com/vaadin/tests/featurebrowser/components.png +++ /dev/null diff --git a/src/com/vaadin/tests/featurebrowser/icon_demo.png b/src/com/vaadin/tests/featurebrowser/icon_demo.png Binary files differdeleted file mode 100644 index 6a5c295d6a..0000000000 --- a/src/com/vaadin/tests/featurebrowser/icon_demo.png +++ /dev/null diff --git a/src/com/vaadin/tests/featurebrowser/icon_intro.png b/src/com/vaadin/tests/featurebrowser/icon_intro.png Binary files differdeleted file mode 100644 index 032712985c..0000000000 --- a/src/com/vaadin/tests/featurebrowser/icon_intro.png +++ /dev/null diff --git a/src/com/vaadin/tests/featurebrowser/itmill.gif b/src/com/vaadin/tests/featurebrowser/itmill.gif Binary files differdeleted file mode 100644 index b1c3e053f0..0000000000 --- a/src/com/vaadin/tests/featurebrowser/itmill.gif +++ /dev/null diff --git a/src/com/vaadin/tests/featurebrowser/m-bullet-blue.gif b/src/com/vaadin/tests/featurebrowser/m-bullet-blue.gif Binary files differdeleted file mode 100644 index fa6b38b4c9..0000000000 --- a/src/com/vaadin/tests/featurebrowser/m-bullet-blue.gif +++ /dev/null diff --git a/src/com/vaadin/tests/featurebrowser/m.gif b/src/com/vaadin/tests/featurebrowser/m.gif Binary files differdeleted file mode 100644 index 2201bdfc1c..0000000000 --- a/src/com/vaadin/tests/featurebrowser/m.gif +++ /dev/null diff --git a/src/com/vaadin/tests/featurebrowser/vaadin_spin.swf b/src/com/vaadin/tests/featurebrowser/vaadin_spin.swf Binary files differdeleted file mode 100644 index 9e58ce29c6..0000000000 --- a/src/com/vaadin/tests/featurebrowser/vaadin_spin.swf +++ /dev/null diff --git a/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java b/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java deleted file mode 100644 index 7172dd7e0d..0000000000 --- a/src/com/vaadin/tests/layouts/AbsoluteLayoutAddRemove.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.AbsoluteLayout; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Button.ClickEvent; - -public class AbsoluteLayoutAddRemove extends TestBase { - - @Override - protected String getDescription() { - return "Tests that addComponent() and removeComponent() works"; - } - - @Override - protected Integer getTicketNumber() { - return 2915; - } - - @Override - protected void setup() { - Layout main = getLayout(); - - final Label l = new Label("A Label"); - final AbsoluteLayout al = new AbsoluteLayout(); - al.setWidth("300px"); - al.setHeight("200px"); - main.addComponent(al); - - final Button b = new Button("Add", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - if (l.getParent() == null) { - al.addComponent(l); - event.getButton().setCaption("Remove"); - } else { - al.removeComponent(l); - event.getButton().setCaption("Add"); - } - - } - - }); - main.addComponent(b); - - } - -} diff --git a/src/com/vaadin/tests/layouts/DeepComponentTrees.java b/src/com/vaadin/tests/layouts/DeepComponentTrees.java deleted file mode 100644 index e13cdf5c3a..0000000000 --- a/src/com/vaadin/tests/layouts/DeepComponentTrees.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class DeepComponentTrees extends TestBase {
-
- private Panel root;
-
- @Override
- protected String getDescription() {
- return "Vaadin should not choke on deep component trees. 15 levels should be minimum to survive.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return null;
- }
-
- private int i = 0;
- private Class<?> currentValue = VerticalLayout.class;
-
- @Override
- protected void setup() {
- Layout main = getLayout();
- main.setSizeUndefined();
- getMainWindow().getLayout().setHeight(null);
-
- Label l = new Label(
- "This is a nice game to guess how many Layouts your FF2 (or any other browser) can deal with. Due to the worldwide attempt to decrease energy consumption, playing this game is only allowed above 60° longitude betwheen August and May (as excess energy consumed by you CPU is used to heat your room). It is considered wise to save all your work before starting the game.");
-
- root = new Panel("Test box");
- root.setWidth("600px");
- root.setHeight("200px");
- final Button b = new Button("Go try your luck with " + i + " layouts!");
- b.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- FF2KILLER(i++);
- b.setCaption("Go try your luck with " + i + " layouts!");
- }
-
- });
-
- final ComboBox s = new ComboBox("Restart game with select:");
- s.setNullSelectionAllowed(false);
- s.addItem("-- Choose value --");
- s.setValue("-- Choose value --");
- s.addItem(VerticalLayout.class);
- s.addItem(HorizontalLayout.class);
- s.addItem(GridLayout.class);
- s.addListener(new ComboBox.ValueChangeListener() {
-
- public void valueChange(ValueChangeEvent event) {
- Object value = s.getValue();
- if (!value.equals("-- Choose value --")) {
- currentValue = (Class<?>) value;
- i = 0;
- s.setValue("-- Choose value --");
- b.setCaption("Go try your luck with " + i + " layouts!");
- }
-
- }
- });
- s.setImmediate(true);
-
- main.addComponent(l);
- main.addComponent(b);
- main.addComponent(s);
- main.addComponent(root);
-
- }
-
- private void FF2KILLER(int layouts) {
- Layout layout = getTestLayout();
- Layout r = layout;
- for (int i = 0; i < layouts; i++) {
- Layout lo = getTestLayout();
- layout.addComponent(lo);
- layout = lo;
- }
- layout.addComponent(new Label(
- "FF did it! Vaadin, Mozilla and you win! Dare to try again?"));
- root.setLayout(r);
- }
-
- Layout getTestLayout() {
- Layout l = new VerticalLayout();
- if (currentValue == GridLayout.class) {
- l = new GridLayout(1, 1);
- } else {
- try {
- l = (Layout) currentValue.newInstance();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return l;
- }
-
-}
diff --git a/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java b/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java deleted file mode 100644 index 8934adae0a..0000000000 --- a/src/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Button.ClickEvent; - -public class FormLayoutWithInvisibleComponent extends TestBase { - - private TextField messages; - - @Override - protected String getDescription() { - return "There is an initial invisible text field below the checkbox. Checking the checkbox should show the field as a textarea (40x10) and also show its caption(\"Messages visible\") and a required error (*)."; - } - - @Override - protected Integer getTicketNumber() { - return 2706; - } - - @Override - protected void setup() { - FormLayout formLayout = new FormLayout(); - CheckBox control = new CheckBox("Messages On/Off", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - messages.setVisible(event.getButton().booleanValue()); - messages.setRequired(true); - messages.setCaption("Messages visible"); - } - - }); - control.setImmediate(true); - formLayout.addComponent(control); - - messages = new TextField("Messages hidden"); - messages.setRows(10); - messages.setColumns(40); - messages.setVisible(false); - messages.setEnabled(false); - formLayout.addComponent(messages); - - addComponent(formLayout); - } - -} diff --git a/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java b/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java deleted file mode 100644 index 781e39bb4e..0000000000 --- a/src/com/vaadin/tests/layouts/GridLayoutExpandRatioModification.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class GridLayoutExpandRatioModification extends TestBase implements - ClickListener { - - private boolean isVisible = false; - private GridLayout mainLayout; - private VerticalLayout vl1; - private VerticalLayout vl2; - private Button button; - - public void setup() { - Window main = new Window("The Main Window"); - mainLayout = new GridLayout(3, 3); - main.setLayout(mainLayout); - setMainWindow(main); - - // The upper layout - vl1 = new VerticalLayout(); - Label label1 = new Label("The upper/left layout"); - vl1.addComponent(label1); - - // Button that hides or shows the bottom part - button = new Button("show / hide", this); - - // The bottom layout - vl2 = new VerticalLayout(); - TextField tf = new TextField("The bottom/right field"); - tf.setHeight("100%"); - tf.setWidth("100%"); - vl2.addComponent(tf); - - // Add everything to the view - mainLayout.addComponent(vl1, 0, 0); - mainLayout.addComponent(button, 1, 1); - mainLayout.addComponent(vl2, 2, 2); - - // Set expand ratios, hide lower - mainLayout.setRowExpandRatio(0, 1); - mainLayout.setColumnExpandRatio(0, 1); - mainLayout.setRowExpandRatio(2, 0); - mainLayout.setColumnExpandRatio(2, 0); - - // Maximize everything - main.setSizeFull(); - mainLayout.setSizeFull(); - vl1.setSizeFull(); - vl2.setSizeFull(); - } - - public void buttonClick(ClickEvent event) { - if (isVisible) { - mainLayout.setRowExpandRatio(2, 0); - mainLayout.setColumnExpandRatio(2, 0); - isVisible = false; - } else { - mainLayout.setRowExpandRatio(2, 1); - mainLayout.setColumnExpandRatio(2, 1); - isVisible = true; - } - } - - @Override - protected String getDescription() { - return "Changing the expand ratio should repaint the layout correctly. Changing from 0 to something else should render the previously invisible component"; - } - - @Override - protected Integer getTicketNumber() { - return 2454; - } -} diff --git a/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java b/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java deleted file mode 100644 index bc2e8c01cb..0000000000 --- a/src/com/vaadin/tests/layouts/GridLayoutInsidePanel.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; - -public class GridLayoutInsidePanel extends TestBase { - - @Override - protected String getDescription() { - return "The first Panel contains a VerticalLayout, which contains a GridLayout, which contains a Label. The second panel directly contains a GridLayout, which contains a Label. Both should be rendered in the same way."; - } - - @Override - protected Integer getTicketNumber() { - return 2652; - } - - @Override - protected void setup() { - { - GridLayout gl = new GridLayout(1, 1); - gl.setSizeUndefined(); - gl.addComponent(new Label( - "A label which defines the size of the GL")); - - Panel p = new Panel("Panel 1"); - p.getLayout().setMargin(false); - p.setSizeUndefined(); - p.getLayout().setSizeUndefined(); - - p.addComponent(gl); - addComponent(p); - } - { - GridLayout gl = new GridLayout(1, 1); - gl.setSizeUndefined(); - gl.addComponent(new Label( - "A label which defines the size of the GL")); - - Panel p = new Panel("Panel 2", gl); - p.getLayout().setMargin(false); - p.setSizeUndefined(); - p.getLayout().setSizeUndefined(); - - addComponent(p); - } - } - -} diff --git a/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java b/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java deleted file mode 100644 index 22fabab4d7..0000000000 --- a/src/com/vaadin/tests/layouts/GridLayoutInsidePanel2.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.Application; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Window; - -public class GridLayoutInsidePanel2 extends Application { - - private Layout layout; - - @Override - public void init() { - Window w = new Window("Main"); - setMainWindow(w); - layout = w.getLayout(); - GridLayout gl = new GridLayout(1, 1); - gl.setSizeUndefined(); - Label l = new Label("This should be visible"); - l.setWidth("100px"); - gl.addComponent(l); - - layout.setSizeUndefined(); - layout.addComponent(gl); - } - -} diff --git a/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java b/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java deleted file mode 100644 index e548d7dacc..0000000000 --- a/src/com/vaadin/tests/layouts/HiddenHorizontalLayout.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class HiddenHorizontalLayout extends TestBase {
-
- @Override
- protected String getDescription() {
- return "Test to verify that toggling layout visibility works properly.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3183;
- }
-
- @Override
- public void setup() {
-
- VerticalLayout vl = new VerticalLayout();
- vl.setSizeFull();
- getLayout().addComponent(vl);
-
- final HorizontalLayout hl = new HorizontalLayout();
- hl.setWidth("100%");
- hl.setHeight("30px");
- hl.addComponent(new Label("label1"));
- hl.addComponent(new Label("label2"));
- hl.addComponent(new Label("label3"));
- hl.addComponent(new Label("label4"));
- vl.addComponent(hl);
-
- Label l = new Label("Steps to reproduce with Vaadin 6.0.1:<br/>"
- + "1. set browser size smaller than fullscreen<br/>"
- + "2. Refresh page with browser<br/>"
- + "3. Click \"toggle layout visibility\"<br>"
- + "4. Resize browser window to full <br/>"
- + "5. Click \"toggle layout visibility\"<br/>",
- Label.CONTENT_XHTML);
- vl.addComponent(l);
- Button b = new Button("toggle layout visibility",
- new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- hl.setVisible(!hl.isVisible());
- }
-
- });
- vl.addComponent(b);
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java b/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java deleted file mode 100644 index 3167947697..0000000000 --- a/src/com/vaadin/tests/layouts/OrderedLayoutBasics.java +++ /dev/null @@ -1,1221 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.terminal.UserError;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.AbstractOrderedLayout;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Layout.AlignmentHandler;
-
-public class OrderedLayoutBasics extends TestBase {
-
- String valignName[] = new String[] { "top", "middle", "bottom" };
- int valign[] = new int[] { AlignmentHandler.ALIGNMENT_TOP,
- AlignmentHandler.ALIGNMENT_VERTICAL_CENTER,
- AlignmentHandler.ALIGNMENT_BOTTOM };
-
- Set<AbstractOrderedLayout> layouts = new HashSet<AbstractOrderedLayout>();
- private AbstractOrderedLayout layoutContainer;
- private int suffix = 0;
-
- @Override
- protected String getDescription() {
- return "Various layout tests for VerticalLayout and HorizontalLayout";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return null;
- }
-
- @Override
- public void setup() {
- getMainWindow().getLayout().setHeight(null);
-
- layoutContainer = new VerticalLayout();
- createUI(layoutContainer);
- addComponent(layoutContainer);
- }
-
- private void createUI(Layout layout) {
- layout
- .addComponent(wrapLayout(layout_field_100pct_button_field(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_field_100pct_button_field(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_overfilled(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_overfilled(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_overfilled_dynamic_height(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_overfilled_dynamic_height(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_symmetric_fields(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_symmetric_fields(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_leftAndRight(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_leftAndRight(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_fixed_filled(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_fixed_filled(new VerticalLayout())));
- layout.addComponent(wrapLayout(layout_dynamic(new HorizontalLayout())));
- layout.addComponent(wrapLayout(layout_dynamic(new VerticalLayout())));
- layout.addComponent(wrapLayout(layout_labels(new HorizontalLayout())));
- layout.addComponent(wrapLayout(layout_labels(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions(new HorizontalLayout())));
- layout.addComponent(wrapLayout(layout_captions(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions_fixed_size(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions_fixed_size(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions_fixed_size_and_relative_size(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions_fixed_size_and_relative_size(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions_fixed_size_and_fixed_size(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_captions_fixed_size_and_fixed_size(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_add_remove_components(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_add_remove_components(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_pctFilled(new HorizontalLayout())));
- layout.addComponent(wrapLayout(layout_pctFilled(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_underFilled(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_underFilled(new VerticalLayout())));
- layout
- .addComponent(wrapLayout(layout_basic_test(new HorizontalLayout())));
- layout
- .addComponent(wrapLayout(layout_basic_test(new VerticalLayout())));
- }
-
- private Layout wrapLayout(Layout ol) {
- Panel p = new Panel(ol);
- p.setSizeUndefined();
- p.setCaption(ol.getCaption());
- ol.setCaption(null);
-
- VerticalLayout l = new VerticalLayout();
- l.setSizeUndefined();
- l.addComponent(p);
- // p.setWidth("600px");
-
- if (ol instanceof AbstractOrderedLayout) {
- layouts.add((AbstractOrderedLayout) ol);
- }
- return l;
- }
-
- /* LAYOUTS */
-
- private Layout layout1() {
- HorizontalLayout ol = new HorizontalLayout();
- ol.setHeight("200px");
- ol.setWidth("");
- ol.setCaption("Fixed height (200px) and dynamic width");
-
- TextField tf = new TextField("100px high TextField, valign: bottom");
- tf.setHeight("100px");
- tf.setWidth("");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- Select s = new Select("100% high select");
- s.setMultiSelect(true);
- s.setHeight("100%");
- s.setWidth("");
- ol.addComponent(s);
-
- s = new Select("200 px high select");
- s.setMultiSelect(true);
- s.setHeight("200px");
- s.setWidth("");
- ol.addComponent(s);
-
- // tf = new TextField("100% high TextField, right/bottom");
- // tf.setHeight("100%");
- // tf.setWidth("");
- // ol.addComponent(tf);
- // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
- // AlignmentHandler.ALIGNMENT_BOTTOM);
-
- // tf = new TextField("100% high, 200px wide TextField");
- // tf.setHeight("100%");
- // tf.setWidth("200px");
- // ol.addComponent(tf);
-
- return ol;
-
- }
-
- private Layout layout2() {
- HorizontalLayout ol = new HorizontalLayout();
- ol.setHeight("70px");
- ol.setWidth("");
- ol.setCaption("Fixed height (50px) and dynamic width");
-
- TextField tf = new TextField(
- "100px high TextField, valign: bottom, should be partly outside");
- tf.setHeight("100px");
- tf.setWidth("");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- tf = new TextField(
- "100% high, 50px wide TextField, valign: bottom, should fill full height");
- tf.setHeight("100%");
- tf.setWidth("50px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- Label l = new Label(
- "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");
- tf.setHeight("100%");
- tf.setWidth("50px");
- ol.addComponent(l);
- ol.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
-
- Select s = new Select("100% high select, should fit into layout");
- s.setMultiSelect(true);
- s.setHeight("100%");
- s.setWidth("");
- for (int i = 0; i < 10; i++) {
- s.addItem(new Object());
- }
-
- ol.addComponent(s);
-
- s = new Select("200 px high select, should be partly outside");
- s.setMultiSelect(true);
- s.setHeight("200px");
- s.setWidth("");
- ol.addComponent(s);
-
- return ol;
- }
-
- private Layout layout3() {
- HorizontalLayout ol = new HorizontalLayout();
- ol.setHeight("");
- ol.setWidth("500px");
- ol.setCaption("Fixed width (500px) and dynamic height");
- TextField tf;
-
- tf = new TextField("100px high TextField, valign: bottom");
- tf.setHeight("100px");
- tf.setWidth("100%");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- tf = new TextField("100px high TextField, valign: top");
- tf.setHeight("100px");
- tf.setWidth("100%");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- tf = new TextField("100% high, 50px wide TextField, valign: bottom");
- tf.setHeight("100%");
- tf.setWidth("50px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- Label l = new Label(
- "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");
- tf.setHeight("100%");
- tf.setWidth("50px");
- ol.addComponent(l);
- ol.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
-
- Select s = new Select("100% high select, should fit into layout");
- s.setMultiSelect(true);
- s.setHeight("100%");
- s.setWidth("100%");
- for (int i = 0; i < 10; i++) {
- s.addItem(new Object());
- }
-
- ol.addComponent(s);
-
- s = new Select("200 px high select, should make the layout 200px high");
- s.setMultiSelect(true);
- s.setHeight("200px");
- s.setWidth("100%");
- ol.addComponent(s);
-
- return ol;
- }
-
- private Layout layout3New() {
- AbstractOrderedLayout ol = new HorizontalLayout();
- ol.setHeight("300px");
- // ol.setWidth("500px");
- ol.setWidth("");
- ol.setCaption("Dynamic width and fixed height(300px)");
- TextField tf;
-
- tf = new TextField("100px high TextField, valign: bottom");
- tf.setHeight("100px");
- tf.setWidth("100%");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- tf = new TextField("100px high TextField, valign: top");
- tf.setHeight("100px");
- tf.setWidth("100%");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- tf = new TextField("100% high, 50px wide TextField, valign: bottom");
- tf.setHeight("100%");
- tf.setWidth("50px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_LEFT);
-
- Label l = new Label(
- "100% high, 50px wide Label, valign: bottom, does not fill full height, only needed space");
- tf.setHeight("100%");
- tf.setWidth("50px");
- ol.addComponent(l);
- ol.setComponentAlignment(l, Alignment.BOTTOM_LEFT);
-
- Select s = new Select("100% high select, should fit into layout");
- s.setMultiSelect(true);
- s.setHeight("100%");
- s.setWidth("100%");
- for (int i = 0; i < 10; i++) {
- s.addItem(new Object());
- }
-
- ol.addComponent(s);
-
- s = new Select("200 px high select, should make the layout 200px high");
- s.setMultiSelect(true);
- s.setHeight("200px");
- s.setWidth("100%");
- ol.addComponent(s);
-
- return ol;
- }
-
- private Layout layout4(AbstractOrderedLayout ol) {
- // ol.setHeight("300px");
- // ol.setWidth("500px");
- ol.setMargin(true);
- ol.setSpacing(true);
- ol.setWidth("");
- ol.setCaption("Dynamic width and dynamic height");
- TextField tf;
-
- tf = new TextField("100% high TextField");
- tf.setCaption(null);
- tf.setRequired(true);
- tf.setValue("100% high Field");
- tf.setHeight("100%");
- tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
-
- tf = new TextField("100% high TextField");
- tf.setCaption("100% high TextField");
- tf.setRequired(true);
- tf.setValue("100% high Field");
- tf.setHeight("100%");
- tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
-
- for (int i = 1; i < 4; i++) {
- int w = i * 100;
- tf = new TextField("Field " + i);
- tf.setRows(2);
- tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
- + valignName[i % 3]);
- tf.setWidth(w + "px");
- tf.setHeight(w + "px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_LEFT,
- valign[i % 3]);
-
- }
-
- tf = new TextField("100% high TextField");
- tf.setValue("100% high 100px wide");
- tf.setRows(2);
- tf.setHeight("100%");
- tf.setWidth("100px");
- ol.addComponent(tf);
- return ol;
- }
-
- private Layout layout_field_100pct_button_field(AbstractOrderedLayout ol) {
- ol.setHeight("500px");
- ol.setWidth("916px");
- ol.setMargin(false);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight()
- + "px) / layout_field_100pct_button_field");
- TextField tf;
-
- tf = new TextField("300px x 300px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("300x300 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- Button b;
- b = new Button("This is a 100%x50% valign middle button");
- b.setSizeFull();
- b.setHeight("50%");
- ol.addComponent(b);
- ol.setExpandRatio(b, 1.0f);
- ol.setComponentAlignment(b, Alignment.MIDDLE_RIGHT);
-
- tf = new TextField("300px x 300px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("300x300 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- return ol;
- }
-
- private Layout layout_basic_test(AbstractOrderedLayout ol) {
- ol.setHeight("700px");
- ol.setWidth("900px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight()
- + "px) / layout_basic_test");
- TextField tf;
-
- tf = new TextField("300px x 300px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("300x300 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- Button b;
- // b = new Button("This is a 100%x50% valign middle button");
- // b.setSizeFull();
- // b.setHeight("50%");
- // ol.addComponent(b, 1.0f);
- // ol.setComponentAlignment(b, AlignmentHandler.ALIGNMENT_RIGHT,
- // AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);
-
- tf = new TextField("300px x 300px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("300x300 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- return ol;
- }
-
- private Layout layout_symmetric_fields(AbstractOrderedLayout ol) {
- ol.setHeight("900px");
- ol.setWidth("900px");
- ol.setMargin(false);
- ol.setSpacing(false);
-
- // ol.setWidth("");
- ol.setCaption("Fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight()
- + "px) / layout_symmetric_fields");
- TextField tf;
-
- tf = new TextField("300px x 300px Field");
- tf.setValue("300x300 field");
- tf.setRows(2);
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- tf = new TextField("300px x 300px Field");
- tf.setValue("300x300 field");
- tf.setRows(2);
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.MIDDLE_CENTER);
-
- tf = new TextField("300px x 300px Field");
- tf.setValue("300x300 field");
- tf.setRows(2);
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- return ol;
- }
-
- private Layout layout_leftAndRight(AbstractOrderedLayout ol) {
- ol.setHeight("700px");
- ol.setWidth("700px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight()
- + "px) / layout_leftAndRight");
- TextField tf;
-
- // tf = new TextField("100%x100% Field");
- // tf.setCaption(null);
- // tf.setValue("100% x 100% TextField");
- // tf.setSizeFull();
- // tf.setRequired(true);
- // // tf.setComponentError(new UserError("It's broken!"));
- //
- // // tf.setHeight("100%");
- // // tf.setWidth("100px");
- // tf.setRows(2);
- // ol.addComponent(tf);
- //
- // for (int i = 1; i < 5; i++) {
- // int w = i * 100;
- // tf = new TextField("Caption field " + i);
- // tf.setRows(2);
- // tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
- // + valignName[i % 3]);
- // tf.setWidth(w + "px");
- // tf.setHeight(w + "px");
- // ol.addComponent(tf);
- // ol.setComponentAlignment(tf,
- // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, valign[i % 3]);
- // }
- //
- // tf.setValue(tf.getValue().toString() + " (100% wide)");
- // tf.setWidth("100%");
-
- // tf = new TextField("100%x70px Field");
- // tf.setCaption(null);
- // tf.setRequired(true);
- // // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- // tf.setComponentError(new UserError("abc"));
- // tf.setValue("100% high 70px wide TextField");
- // tf.setRows(2);
- // // tf.setSizeFull();
- // tf.setHeight("100%");
- // tf.setWidth("70px");
- // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
- // AlignmentHandler.ALIGNMENT_TOP);
- // ol.addComponent(tf);
-
- tf = new TextField("300px x 300px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("300x300 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- tf = new TextField("300px x 300px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("300x300 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("300px");
- tf.setWidth("300px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- return ol;
- }
-
- private Layout layout_fixed_filled(AbstractOrderedLayout ol) {
- ol.setHeight("700px");
- ol.setWidth("700px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Filled with fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight() + "px)");
- TextField tf;
-
- tf = new TextField("60%x100% Field");
- tf.setCaption("This one has a caption");
- tf.setValue("60% x 100% TextField");
- tf.setWidth("100%");
- tf.setHeight("100%");
- tf.setRequired(true);
- // tf.setComponentError(new UserError("It's broken!"));
-
- // tf.setHeight("100%");
- // tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
- ol.setExpandRatio(tf, 1f);
- //
-
- tf = new TextField("60%x60% Field");
- tf.setCaption(null);
- tf.setValue("60% x 60% TextField");
- tf.setWidth("100%");
- tf.setHeight("60%");
- tf.setRequired(true);
- ol.addComponent(tf);
- ol.setExpandRatio(tf, 1f);
- ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_LEFT,
- AlignmentHandler.ALIGNMENT_VERTICAL_CENTER);
- // tf.setComponentError(new UserError("It's broken!"));
-
- // tf.setHeight("100%");
- // tf.setWidth("100px");
- tf.setRows(2);
- //
- // for (int i = 1; i < 5; i++) {
- // int w = i * 100;
- // tf = new TextField("Caption field " + i);
- // tf.setRows(2);
- // tf.setValue(w + "px high, " + w + "px wide TextField, valign: "
- // + valignName[i % 3]);
- // tf.setWidth(w + "px");
- // tf.setHeight(w + "px");
- // ol.addComponent(tf);
- // ol.setComponentAlignment(tf,
- // AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER, valign[i % 3]);
- // }
- //
- // tf.setValue(tf.getValue().toString() + " (100% wide)");
- // tf.setWidth("100%");
-
- // tf = new TextField("100%x70px Field");
- // tf.setCaption(null);
- // tf.setRequired(true);
- // // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- // tf.setComponentError(new UserError("abc"));
- // tf.setValue("100% high 70px wide TextField");
- // tf.setRows(2);
- // // tf.setSizeFull();
- // tf.setHeight("100%");
- // tf.setWidth("70px");
- // ol.setComponentAlignment(tf, AlignmentHandler.ALIGNMENT_RIGHT,
- // AlignmentHandler.ALIGNMENT_TOP);
- // ol.addComponent(tf);
-
- tf = new TextField("200px x 200px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("200x200 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("200px");
- tf.setWidth("200px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- tf = new TextField("200px x 200px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("200x200 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("200px");
- tf.setWidth("200px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- return ol;
- }
-
- private Layout layout_overfilled(AbstractOrderedLayout ol) {
- ol.setHeight("300px");
- ol.setWidth("700px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("OverFilled with fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight() + "px)");
- TextField tf;
-
- for (int i = 0; i < 5; i++) {
- tf = new TextField("200x200px Field");
- tf.setCaption("This one has a caption");
- tf.setValue("200x200 TextField");
- tf.setWidth("200px");
- tf.setHeight("200px");
- tf.setRequired(true);
- // tf.setComponentError(new UserError("It's broken!"));
-
- // tf.setHeight("100%");
- // tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
- }
-
- return ol;
- }
-
- private Layout layout_overfilled_dynamic_height(AbstractOrderedLayout ol) {
- ol.setHeight(null);
- ol.setWidth("700px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("OverFilled with fixed width (" + ol.getWidth()
- + "px) and dynamic height");
- TextField tf;
-
- for (int i = 0; i < 10; i++) {
- tf = new TextField("200x200px Field");
- tf.setCaption("This one has a caption");
- tf.setWidth("200px");
- tf.setHeight(((i + 1) * 50) + "px");
- tf.setValue(tf.getWidth() + "x" + tf.getHeight() + " TextField");
- tf.setRequired(true);
- // tf.setComponentError(new UserError("It's broken!"));
-
- // tf.setHeight("100%");
- // tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
- }
-
- return ol;
- }
-
- // private Layout layout_add_components(AbstractOrderedLayout ol) {
- // ol.setHeight("600px");
- // ol.setWidth("600px");
- // ol.setMargin(true);
- // ol.setSpacing(true);
- //
- // // ol.setWidth("");
- // ol.setCaption("Fixed width (" + ol.getWidth()
- // + "px) and fixed height (" + ol.getHeight() + "px)");
- //
- // for (int i = 0; i < 3; i++) {
- // Button b = createAddButton(ol);
- // ol.addComponent(b);
- // }
- //
- // return ol;
- //
- // }
-
- private Layout layout_add_remove_components(AbstractOrderedLayout ol) {
- ol.setHeight("600px");
- ol.setWidth("600px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight()
- + "px) / layout_add_remove_components");
-
- for (int i = 0; i < 2; i++) {
- AbstractOrderedLayout inner = createAddRemove(ol, "", "");
- ol.addComponent(inner);
- ol.setComponentAlignment(inner, Alignment.BOTTOM_RIGHT);
- }
-
- return ol;
-
- }
-
- private Layout layout_dynamic(AbstractOrderedLayout ol) {
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Dynamic width, dynamic height");
-
- for (int i = 0; i < 3; i++) {
- Button b = new Button("Button " + i);
- if (i == 2) {
- b.setHeight("200px");
- } else {
- b.setHeight("100%");
- }
- ol.addComponent(b);
- }
-
- return ol;
-
- }
-
- private Layout layout_captions(AbstractOrderedLayout ol) {
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Caption test with dynamic width");
-
- TextField tf;
- tf = new TextField("Short caption");
- ol.addComponent(tf);
-
- tf = new TextField(
- "A very long caption which is probably much longer than the field");
- ol.addComponent(tf);
-
- tf = new TextField(
- "A very long caption which is probably much longer than the field and includes indicators");
- tf.setRequired(true);
- tf.setComponentError(new UserError("abc123"));
- ol.addComponent(tf);
-
- // for (int i = 0; i < 3; i++) {
- // Button b = new Button("Button " + i);
- // if (i == 2) {
- // b.setHeight("200px");
- // } else {
- // b.setHeight("100%");
- // }
- // ol.addComponent(b);
- // }
-
- return ol;
-
- }
-
- private Layout layout_captions_fixed_size(AbstractOrderedLayout ol) {
- ol.setWidth("700px");
- ol.setHeight("250px");
-
- ol.setMargin(false);
- ol.setSpacing(false);
-
- // ol.setWidth("");
- ol.setCaption("Caption test with fixed size");
-
- TextField tf;
- tf = new TextField("Short caption");
- tf.setValue("Undefined width");
- tf.setComponentError(new UserError("123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- tf = new TextField(
- "A long caption which is probably much longer than the field");
- tf.setValue("Undefined width");
- tf.setRequired(true);
- tf.setComponentError(new UserError("123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- tf = new TextField(
- "A very long caption which is probably much longer than the field and includes indicators");
- tf.setValue("Undefined width");
- tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setRequired(true);
- tf.setComponentError(new UserError("abc123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- // for (int i = 0; i < 3; i++) {
- // Button b = new Button("Button " + i);
- // if (i == 2) {
- // b.setHeight("200px");
- // } else {
- // b.setHeight("100%");
- // }
- // ol.addComponent(b);
- // }
-
- return ol;
-
- }
-
- private Layout layout_captions_fixed_size_and_relative_size(
- AbstractOrderedLayout ol) {
- ol.setWidth("700px");
- ol.setHeight("250px");
-
- ol.setMargin(false);
- ol.setSpacing(false);
-
- // ol.setWidth("");
- ol.setCaption("Caption test with fixed width (700x250)");
-
- TextField tf;
- tf = new TextField("Short caption");
- tf.setSizeFull();
- tf.setValue("100% wide field, ratio 1");
-
- tf.setComponentError(new UserError("123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- ol.setExpandRatio(tf, 1);
-
- tf = new TextField(
- "A long caption which is probably much longer than the field");
- tf.setValue("100% wide field, ratio 2");
- tf.setSizeFull();
- tf.setRequired(true);
- tf.setComponentError(new UserError("123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- ol.setExpandRatio(tf, 2);
-
- tf = new TextField(
- "A very long caption which is probably much longer than the field and includes indicators");
- tf.setValue("100% wide field, ratio 3");
- tf.setSizeFull();
- tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setRequired(true);
- tf.setComponentError(new UserError("abc123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- ol.setExpandRatio(tf, 3);
-
- // for (int i = 0; i < 3; i++) {
- // Button b = new Button("Button " + i);
- // if (i == 2) {
- // b.setHeight("200px");
- // } else {
- // b.setHeight("100%");
- // }
- // ol.addComponent(b);
- // }
-
- return ol;
-
- }
-
- private Layout layout_captions_fixed_size_and_fixed_size(
- AbstractOrderedLayout ol) {
- ol.setWidth("700px");
- ol.setHeight("250px");
-
- ol.setMargin(false);
- ol.setSpacing(false);
-
- // ol.setWidth("");
- ol.setCaption("Caption test with fixed width");
-
- TextField tf;
- tf = new TextField("Short caption");
- tf.setValue("250px wide field");
- tf.setWidth("250px");
- tf.setComponentError(new UserError("123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- tf = new TextField(
- "A long caption which is probably much longer than the field");
- tf.setWidth("250px");
- tf.setValue("250px wide field");
- tf.setRequired(true);
- tf.setComponentError(new UserError("123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- tf = new TextField(
- "A very long caption which is probably much longer than the field and includes indicators");
- tf.setValue("200px wide field");
- tf.setWidth("200px");
- tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setRequired(true);
- tf.setComponentError(new UserError("abc123"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- // for (int i = 0; i < 3; i++) {
- // Button b = new Button("Button " + i);
- // if (i == 2) {
- // b.setHeight("200px");
- // } else {
- // b.setHeight("100%");
- // }
- // ol.addComponent(b);
- // }
-
- return ol;
-
- }
-
- private Layout layout_labels(AbstractOrderedLayout ol) {
- // ol.setWidth("700px");
- // ol.setHeight("200px");
-
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Caption test with fixed width");
-
- Label l;
- l = new Label(
- "This is a long text and should remain on one line as there is nothing forcing line breaks");
- ol.addComponent(l);
- // ol.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT,
- // AlignmentHandler.ALIGNMENT_BOTTOM);
-
- l = new Label("WTF OMG LOL");
- ol.addComponent(l);
- // ol.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT,
- // AlignmentHandler.ALIGNMENT_BOTTOM);
-
- return ol;
-
- }
-
- private AbstractOrderedLayout createAddRemove(AbstractOrderedLayout ol,
- String width, String buttonSuffix) {
- Button b = createAddButton(ol);
- Button wb = createWideAddButton(ol);
- Button r = createRemoveButton(ol, buttonSuffix);
- VerticalLayout inner = new VerticalLayout();
- inner.setCaption("Width: " + width);
- inner.setWidth(width);
-
- inner.addComponent(b);
- inner.addComponent(wb);
- inner.addComponent(r);
-
- // inner.setHeight("132px");
- return inner;
- }
-
- private Button createAddButton(AbstractOrderedLayout ol) {
- Button b = new Button("Add before", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- addBefore((AbstractOrderedLayout) event.getButton().getData(),
- event.getButton().getParent(), "");
- }
-
- });
- b.setData(ol);
-
- return b;
- }
-
- private Button createWideAddButton(AbstractOrderedLayout ol) {
- Button b = new Button("Add 100% before", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- addBefore((AbstractOrderedLayout) event.getButton().getData(),
- event.getButton().getParent(), "100%");
- }
-
- });
- b.setData(ol);
-
- return b;
- }
-
- private Button createRemoveButton(AbstractOrderedLayout ol, String suffix) {
- Button b = new Button("Remove this " + suffix, new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- remove((AbstractOrderedLayout) event.getButton().getData(),
- event.getButton().getParent());
- }
-
- });
- b.setWidth("100%");
- b.setData(ol);
-
- return b;
- }
-
- protected void remove(AbstractOrderedLayout ol, Component c) {
- ol.removeComponent(c);
-
- }
-
- protected void addBefore(AbstractOrderedLayout ol, Component c, String width) {
- int index = 0;
- Iterator iter = ol.getComponentIterator();
- while (iter.hasNext()) {
- if (iter.next() == c) {
- break;
- }
- index++;
- }
- AbstractOrderedLayout inner = createAddRemove(ol, width, String
- .valueOf(suffix++));
- ol.addComponent(inner, index);
- if (width.contains("%")) {
- ol.setExpandRatio(inner, 1.0f);
- }
-
- ol.setComponentAlignment(inner, Alignment.BOTTOM_RIGHT);
-
- }
-
- private Layout layout_pctFilled(AbstractOrderedLayout ol) {
- ol.setHeight("600px");
- ol.setWidth("600px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("100 % filled with fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight() + "px)");
- TextField tf;
-
- tf = new TextField();
- tf.setCaption("This one has a caption");
- tf.setValue("60% expand TextField");
- tf.setWidth("100%");
- tf.setHeight("100%");
- // tf.setRequired(true);
- // tf.setComponentError(new UserError("It's broken!"));
-
- // tf.setHeight("100%");
- // tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
- ol.setExpandRatio(tf, 60);
-
- tf = new TextField();
- tf.setValue("100px 100px TextField");
- tf.setWidth("100px");
- tf.setHeight("100px");
- tf.setRows(2);
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.MIDDLE_CENTER);
-
- //
-
- tf = new TextField("40%x40% Field");
- // tf.setCaption(null);
- tf.setValue("40% expand (40% height) TextField");
- tf.setWidth("100%");
- tf.setHeight("40%");
- ol.addComponent(tf);
- ol.setExpandRatio(tf, 40);
- // tf.setRequired(true);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- tf.setRows(2);
-
- return ol;
- }
-
- private Layout layout_pctFilled2(AbstractOrderedLayout ol) {
- ol.setHeight("600px");
- ol.setWidth("600px");
- ol.setMargin(true);
- ol.setSpacing(false);
-
- // ol.setWidth("");
- ol.setCaption("100 % filled with fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight() + "px)");
- TextField tf;
-
- tf = new TextField();
- // tf.setCaption("This one has a caption");
- tf.setValue("80% x 20% TextField");
- tf.setWidth("80%");
- tf.setHeight("20%");
- // tf.setRequired(true);
- // tf.setComponentError(new UserError("It's broken!"));
-
- // tf.setHeight("100%");
- // tf.setWidth("100px");
- tf.setRows(2);
- ol.addComponent(tf);
- //
-
- tf = new TextField("20%x60% Field");
- tf.setCaption(null);
- tf.setValue("20% x 60% TextField");
- tf.setWidth("20%");
- tf.setHeight("60%");
- // tf.setRequired(true);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
-
- tf.setRows(2);
- ol.addComponent(tf);
-
- return ol;
- }
-
- private Layout layout_underFilled(AbstractOrderedLayout ol) {
- ol.setHeight("700px");
- ol.setWidth("700px");
- ol.setMargin(true);
- ol.setSpacing(true);
-
- // ol.setWidth("");
- ol.setCaption("Underfilled with fixed width (" + ol.getWidth()
- + "px) and fixed height (" + ol.getHeight() + "px)");
- TextField tf;
-
- tf = new TextField("60%x100% Field");
- tf.setCaption("Short capt");
- tf.setValue("60% x 100% TextField");
- tf.setWidth("60%");
- tf.setHeight("100%");
- tf.setRequired(true);
- tf.setRows(2);
-
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.MIDDLE_CENTER);
-
- tf = new TextField("200px x 200px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("200x200 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("200px");
- tf.setWidth("200px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.TOP_LEFT);
-
- tf = new TextField("200px x 200px Field");
- // tf.setIcon(new ThemeResource("icons/16/document-add.png"));
- tf.setValue("200x200 field");
- tf.setRows(2);
- // tf.setSizeFull();
- tf.setHeight("200px");
- tf.setWidth("200px");
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, Alignment.BOTTOM_RIGHT);
- return ol;
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java b/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java deleted file mode 100644 index 6073edf249..0000000000 --- a/src/com/vaadin/tests/layouts/OrderedLayoutCSSCompatibility.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.vaadin.tests.layouts; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; - -public class OrderedLayoutCSSCompatibility extends TestBase { - - @Override - protected String getDescription() { - return "This test is to make sure that spacing/margins in OrderedLayout is still backwards compatible"; - } - - @Override - protected Integer getTicketNumber() { - return 2463; - } - - @Override - protected void setup() { - OrderedLayout l = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - l.setMargin(true); - l.setSpacing(true); - l.addComponent(new TextField("abc")); - l.addComponent(new TextField("def")); - - addComponent(l); - - } - -} diff --git a/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java b/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java deleted file mode 100644 index efabf0ac9a..0000000000 --- a/src/com/vaadin/tests/layouts/TestAbsoluteLayout.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.AbsoluteLayout;
-import com.vaadin.ui.AbstractComponent;
-import com.vaadin.ui.BaseFieldFactory;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.FieldFactory;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.NativeSelect;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class TestAbsoluteLayout extends TestBase {
-
- private static class MFieldFactory extends BaseFieldFactory {
-
- @Override
- public Field createField(Item item, Object propertyId,
- Component uiContext) {
- if (propertyId.equals("CSSString")) {
- TextField f = new TextField();
- f.setRows(5);
- f.setHeight("8em");
- f.setCaption("CSS string");
- return f;
- } else if (((String) propertyId).contains("Units")) {
- NativeSelect s = new NativeSelect() {
- };
- s.addContainerProperty("caption", String.class, "");
- s.setItemCaptionPropertyId("caption");
- s.setNullSelectionAllowed(false);
- for (int i = 0; i < Layout.UNIT_SYMBOLS.length; i++) {
- Item unitItem = s.addItem(i);
- unitItem.getItemProperty("caption").setValue(
- Layout.UNIT_SYMBOLS[i]);
- }
- return s;
- }
-
- return super.createField(item, propertyId, uiContext);
- }
-
- private static MFieldFactory instance;
-
- public static FieldFactory get() {
- if (instance == null) {
- instance = new MFieldFactory();
- }
- return instance;
- }
- };
-
- @Override
- protected String getDescription() {
- return "This is absolute layout tester.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return null;
- }
-
- @Override
- protected void setup() {
- AbsoluteLayout layout = new AbsoluteLayout();
- setTheme("tests-tickets");
- layout.setStyleName("cyan");
- layout.setWidth("1000px");
- layout.setHeight("500px");
-
- layout.addComponent(new Label("Hello World"));
-
- Button button = new Button("Centered button,z-index:10;");
- button.setSizeFull();
- layout.addComponent(button,
- "top:40%;bottom:40%;right:20%;left:20%;z-index:10;");
-
- Label label = new Label(
- "Exotic positioned label. Fullsize, top:100px; left:2cm; right: 3.5in; bottom:12.12mm ");
- label.setStyleName("yellow");
- label.setSizeFull();
- layout.addComponent(label,
- "top:100px; left:2cm; right: 3.5in; bottom:12.12mm");
-
- label = new Label("fullize, bottom:80%;left:80%;");
- label.setStyleName("green");
- label.setSizeFull();
- layout.addComponent(label, "bottom:80%;left:80%;");
-
- label = new Label("bottomright");
- label.setSizeUndefined();
- label.setStyleName("green");
- layout.addComponent(label, "bottom:0px; right:0px;");
-
- getLayout().setSizeFull();
- getLayout().addComponent(layout);
-
- getMainWindow().addWindow(new EditorWindow(layout));
-
- }
-
- public class EditorWindow extends Window {
- private final AbsoluteLayout l;
- private Form componentEditor;
- private Form positionEditor;
-
- public EditorWindow(AbsoluteLayout lo) {
- super("AbsoluteLayout editor aka köyhän miehen wysiwyg");
- l = lo;
-
- setHeight("600px");
-
- Button componentChooser = new Button("choose component to edit");
- componentChooser.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- final Window chooser = new Window("Choose component");
- chooser.getLayout().setSizeUndefined();
- chooser.setModal(true);
-
- NativeSelect select = new NativeSelect(
- "Choose component to edit");
-
- select.setNullSelectionAllowed(false);
-
- IndexedContainer container = new IndexedContainer();
- container.addContainerProperty("caption", String.class, "");
- Iterator<Component> componentIterator = l
- .getComponentIterator();
- while (componentIterator.hasNext()) {
- AbstractComponent next = (AbstractComponent) componentIterator
- .next();
- Item item = container.addItem(next);
-
- String caption = next.getTag();
-
- caption += "; cap: " + next.getCaption() + "; debugid"
- + getDebugId();
-
- if (next instanceof Property) {
- caption += " value:" + ((Property) next).getValue();
- }
-
- item.getItemProperty("caption").setValue(caption);
- }
- select.setContainerDataSource(container);
- select.setItemCaptionPropertyId("caption");
- select.setImmediate(true);
-
- select.addListener(new ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- editcomponent((Component) event.getProperty()
- .getValue());
- getMainWindow().removeWindow(chooser);
- }
-
- });
-
- chooser.addComponent(select);
-
- getMainWindow().addWindow(chooser);
-
- }
- });
-
- addComponent(componentChooser);
-
- Button addComp = new Button("add component");
- addComp.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- final Window chooser = new Window(
- "Choose component type to add");
- chooser.getLayout().setSizeUndefined();
- chooser.setModal(true);
-
- NativeSelect select = new NativeSelect(
- "Choose component to edit");
-
- select.setNullSelectionAllowed(false);
-
- IndexedContainer container = new IndexedContainer();
-
- URL resource = AbstractComponent.class.getResource(".");
- File directory = new File(resource.getFile());
- if (directory.exists()) {
- // Get the list of the files contained in the
- // package
- final String[] files = directory.list();
- for (int j = 0; j < files.length; j++) {
- // we are only interested in .class files
- if (files[j].endsWith(".class")) {
- // removes the .class extension
- String p = resource.toString()
- + files[j].substring(0, files[j]
- .length() - 6);
- p = p.replaceAll(".*classes/", "");
- p = p.replaceAll("/", ".");
- Class c;
- try {
- c = Class.forName(p);
- if (AbstractComponent.class
- .isAssignableFrom(c)
- && !p.toLowerCase().contains(
- "layout")
- && !p.toLowerCase().contains(
- "abstract")) {
- container.addItem(c);
- }
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
- select.setContainerDataSource(container);
- select.setImmediate(true);
-
- select.addListener(new ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- Class c = (Class) event.getProperty().getValue();
-
- try {
- Component newInstance = (Component) c
- .newInstance();
- l.addComponent(newInstance);
- editcomponent(newInstance);
- getMainWindow().removeWindow(chooser);
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- });
-
- chooser.addComponent(select);
-
- getMainWindow().addWindow(chooser);
-
- }
- });
-
- addComponent(addComp);
-
- componentEditor = new Form();
- componentEditor.setWriteThrough(false);
- componentEditor.setCaption("Component properties:");
- componentEditor.setFieldFactory(MFieldFactory.get());
- addComponent(componentEditor);
-
- positionEditor = new Form();
- positionEditor.setCaption("Component position");
- positionEditor.setWriteThrough(false);
- positionEditor.setFieldFactory(MFieldFactory.get());
- addComponent(positionEditor);
-
- Button b = new Button("Commit changes", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- positionEditor.commit();
- componentEditor.commit();
- }
- });
- addComponent(b);
-
- }
-
- private void editcomponent(Component value) {
-
- BeanItem beanItem = new BeanItem(value);
- String c = "Component properties for "
- + value.getClass().getSimpleName();
- ArrayList<String> fields = new ArrayList<String>(Arrays
- .asList(new String[] { "width", "widthUnits", "height",
- "heightUnits", "caption", "styleName" }));
- if (value instanceof Label) {
- c += "(" + ((Label) value).getValue() + ")";
- fields.add("value");
- }
-
- componentEditor.setItemDataSource(beanItem, fields);
-
- beanItem = new BeanItem(l.getPosition(value));
- componentEditor.setCaption(c);
-
- positionEditor.setItemDataSource(beanItem);
-
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/layouts/TestLayoutPerformance.java b/src/com/vaadin/tests/layouts/TestLayoutPerformance.java deleted file mode 100644 index 896581ce3d..0000000000 --- a/src/com/vaadin/tests/layouts/TestLayoutPerformance.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.AbstractComponent;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CssLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.NativeSelect;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class TestLayoutPerformance extends TestBase {
- private NativeSelect ns;
- private int i;
- private NativeSelect ns2;
- private VerticalLayout testarea = new VerticalLayout();
-
- @Override
- protected String getDescription() {
- return "Test app to test simple rendering to various layouts.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return null;
- }
-
- @Override
- protected void setup() {
- Label label = new Label("<h1>CssLayout performance test.</h1>",
- Label.CONTENT_XHTML);
- getLayout().addComponent(label);
-
- label = new Label(
- "<em>Hint</em>. Use debug dialog to measure rendering times TODO: extend with size settings (to both layout and content).",
- Label.CONTENT_XHTML);
- getLayout().addComponent(label);
-
- ns = new NativeSelect("Select component to test");
- ns.addItem(CssLayout.class);
- ns.addItem(GridLayout.class);
- ns.addItem(VerticalLayout.class);
- ns.setNullSelectionAllowed(false);
- ns.setValue(CssLayout.class);
-
- ns2 = new NativeSelect("Select component to render inside layout.");
- ns2.addItem(Label.class);
- ns2.addItem(Button.class);
- ns2.setNullSelectionAllowed(false);
- ns2.setValue(Label.class);
-
- final TextField n = new TextField("Number of components");
-
- n.setValue("1000");
-
- final CheckBox cb = new CheckBox("Generate captions", false);
-
- Button b = new Button("Render component");
-
- b.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- int components = Integer.parseInt((String) n.getValue());
- Layout layout = getCurrentLayout();
- for (int i = 0; i < components; i++) {
- Component component = newTestComponent();
- if (cb.booleanValue()) {
- component.setCaption("caption " + i);
- }
- layout.addComponent(component);
- }
-
- testarea.removeAllComponents();
- testarea.addComponent(layout);
- }
-
- });
-
- getLayout().addComponent(ns);
- getLayout().addComponent(ns2);
- getLayout().addComponent(n);
- getLayout().addComponent(cb);
- getLayout().addComponent(b);
- getLayout().addComponent(testarea);
-
- }
-
- private Layout getCurrentLayout() {
- Class value = (Class) ns.getValue();
- if (value == GridLayout.class) {
- return new GridLayout(10, 1);
- }
-
- try {
- return (Layout) value.newInstance();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
-
- }
-
- private Component newTestComponent() {
- Class componentClass = (Class) ns2.getValue();
- AbstractComponent newInstance = null;
- try {
- newInstance = (AbstractComponent) componentClass.newInstance();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (componentClass == Label.class) {
- ((Label) newInstance).setValue("Test l " + (i++));
- ((Label) newInstance).setSizeUndefined();
- } else {
- newInstance.setCaption("Test l " + (i++));
- }
- return newInstance;
- }
-
-}
diff --git a/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java b/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java deleted file mode 100644 index 9aadbadd78..0000000000 --- a/src/com/vaadin/tests/layouts/VerticalLayoutExpandRatioModification.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class VerticalLayoutExpandRatioModification extends TestBase implements
- ClickListener {
-
- private boolean isVisible = false;
- private VerticalLayout mainLayout;
- private VerticalLayout vl1;
- private VerticalLayout vl2;
- private Button button;
-
- public void setup() {
- Window main = new Window("The Main Window");
- mainLayout = new VerticalLayout();
- main.setLayout(mainLayout);
- setMainWindow(main);
-
- // The upper layout
- vl1 = new VerticalLayout();
- Label label1 = new Label("The upper layout");
- vl1.addComponent(label1);
-
- // Button that hides or shows the bottom part
- button = new Button("show / hide", this);
-
- // The bottom layout
- vl2 = new VerticalLayout();
- TextField tf = new TextField("The bottom field");
- tf.setHeight("100%");
- vl2.addComponent(tf);
-
- // Add everything to the view
- mainLayout.addComponent(vl1);
- mainLayout.addComponent(button);
- mainLayout.addComponent(vl2);
-
- // Set expand ratios, hide lower
- mainLayout.setExpandRatio(vl1, 1);
- mainLayout.setExpandRatio(vl2, 0);
-
- // Maximize everything
- main.setSizeFull();
- mainLayout.setSizeFull();
- vl1.setSizeFull();
- vl2.setSizeFull();
- }
-
- public void buttonClick(ClickEvent event) {
- if (isVisible) {
- mainLayout.setExpandRatio(vl2, 0);
- isVisible = false;
- } else {
- mainLayout.setExpandRatio(vl2, 1);
- isVisible = true;
- }
- }
-
- @Override
- protected String getDescription() {
- return "Changing the expand ratio should repaint the layout correctly. Changing from 0 to something else should render the previously invisible component";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2454;
- }
-}
diff --git a/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java b/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java deleted file mode 100644 index 8ff742c179..0000000000 --- a/src/com/vaadin/tests/layouts/VerticalLayoutWithRelativeSizeComponents.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vaadin.tests.layouts;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-
-public class VerticalLayoutWithRelativeSizeComponents extends TestBase {
-
- @Override
- protected String getDescription() {
- return "A undefined wide VerticalLayout containing a 100% wide label, a Button and another identical label. The labels should be as wide as the button (400px) and there should be no extra space between the bottom of the first label and the button.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 2591;
- }
-
- @Override
- protected void setup() {
- getLayout().setSizeUndefined();
- getMainWindow().getLayout().setHeight(null);
-
- Label l = new Label(
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum urna quis leo. In hac habitasse platea dictumst. Pellentesque tincidunt. Sed libero nisl, faucibus in, laoreet pellentesque, consectetur non, dolor. Sed tortor. Ut pretium sapien. Cras elementum enim non lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla velit est, aliquam a, pellentesque a, iaculis nec, sapien. Ut ultrices ligula vitae nulla. Morbi sem pede, iaculis ac, condimentum a, ornare eget, nisi. Aliquam hendrerit pulvinar massa. Vestibulum pretium purus eu augue. Sed posuere elit ut magna. Cras consequat faucibus nunc. Vestibulum quis diam.");
- Label l2 = new Label(
- "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc condimentum urna quis leo. In hac habitasse platea dictumst. Pellentesque tincidunt. Sed libero nisl, faucibus in, laoreet pellentesque, consectetur non, dolor. Sed tortor. Ut pretium sapien. Cras elementum enim non lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla velit est, aliquam a, pellentesque a, iaculis nec, sapien. Ut ultrices ligula vitae nulla. Morbi sem pede, iaculis ac, condimentum a, ornare eget, nisi. Aliquam hendrerit pulvinar massa. Vestibulum pretium purus eu augue. Sed posuere elit ut magna. Cras consequat faucibus nunc. Vestibulum quis diam.");
- l.setWidth("100%");
- l2.setWidth("100%");
-
- Button b = new Button("This defines the width");
- b.setWidth("400px");
- addComponent(l);
- addComponent(b);
- addComponent(l2);
- }
-
-}
diff --git a/src/com/vaadin/tests/m.gif b/src/com/vaadin/tests/m.gif Binary files differdeleted file mode 100644 index 2201bdfc1c..0000000000 --- a/src/com/vaadin/tests/m.gif +++ /dev/null diff --git a/src/com/vaadin/tests/resources/ResourceDownload.java b/src/com/vaadin/tests/resources/ResourceDownload.java deleted file mode 100644 index d7da9c2d63..0000000000 --- a/src/com/vaadin/tests/resources/ResourceDownload.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.vaadin.tests.resources;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import com.vaadin.terminal.StreamResource;
-import com.vaadin.terminal.StreamResource.StreamSource;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class ResourceDownload extends TestBase {
-
- @Override
- public void setup() {
-
- Button b = new Button("Download (_new)", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- download("_new");
- }
- });
- addComponent(b);
-
- b = new Button("Download (_blank)", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- download("_blank");
- }
- });
- addComponent(b);
-
- b = new Button("Download ()", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- download("");
- }
- });
- addComponent(b);
-
- b = new Button("Download (_top)", new ClickListener() {
- public void buttonClick(ClickEvent event) {
- download("_top");
- }
- });
- addComponent(b);
-
- b = new Button("Test", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- ResourceDownload.this.getMainWindow().showNotification(
- "Still working");
- }
-
- });
- addComponent(b);
-
- }
-
- protected void download(String target) {
- String filename = "filename";
- StreamResource streamResource = new StreamResource(new StreamSource() {
-
- public InputStream getStream() {
- try {
- return new FileInputStream("FIXME C:/temp/file.xls");
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return null;
- }
- }
- }, filename + ".xls", this);
- streamResource.setCacheTime(5000); // no cache (<=0) does not work with
- // IE8
- streamResource.setMIMEType("application/x-msexcel");
-
- getMainWindow().open(streamResource, target);
-
- }
-
- @Override
- protected String getDescription() {
- return "Downloading with target _new should work, aswell as with target _blank and _top.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 3289;
- }
-}
diff --git a/src/com/vaadin/tests/robustness/Robustness.java b/src/com/vaadin/tests/robustness/Robustness.java deleted file mode 100644 index 6294e09d4e..0000000000 --- a/src/com/vaadin/tests/robustness/Robustness.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.vaadin.tests.robustness; - -import com.vaadin.automatedtests.util.Log; -import com.vaadin.tests.util.RandomComponents; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public abstract class Robustness extends com.vaadin.Application - implements Button.ClickListener { - - static int totalCount = 0; - - int count = 0; - - final Window main = new Window("Robustness tests by featurebrowser"); - - Button close = new Button("Close application"); - - Button remove = new Button("Remove all components"); - - Button create = new Button("Create"); - - Label label = new Label(); - - ComponentContainer stressLayout; - - RandomComponents randomComponents = new RandomComponents(); - - @Override - public void init() { - createNewView(); - } - - public void createNewView() { - setMainWindow(main); - main.removeAllComponents(); - - main.addComponent(label); - main.addComponent(close); - main.addComponent(remove); - main.addComponent(create); - close.addListener(this); - remove.addListener(this); - create.addListener(this); - - remove.setDescription("After this garbage collector should" - + " be able to collect every component" - + " inside stressLayout."); - - close.setDebugId("close"); - remove.setDebugId("remove"); - create.setDebugId("create"); - - } - - public void buttonClick(ClickEvent event) { - if (event.getButton() == create) { - create(); - } else if (event.getButton() == remove) { - main.removeAllComponents(); - close.removeListener(this); - remove.removeListener(this); - create.removeListener(this); - close = null; - remove = null; - create = null; - label = null; - stressLayout = null; - System.out.println("main.getLayout()=" + main.getLayout()); - System.out.println(Log.getMemoryStatistics()); - } else if (event.getButton() == close) { - System.out.println("Before close, memory statistics:"); - System.out.println(Log.getMemoryStatistics()); - close(); - // Still valueUnbound (session expiration) needs to occur for GC to - // do its work - System.out.println("After close, memory statistics:"); - System.out.println(Log.getMemoryStatistics()); - } - } - - public abstract void create(); -} diff --git a/src/com/vaadin/tests/robustness/RobustnessSimple.java b/src/com/vaadin/tests/robustness/RobustnessSimple.java deleted file mode 100644 index 63324ad9bc..0000000000 --- a/src/com/vaadin/tests/robustness/RobustnessSimple.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.vaadin.tests.robustness; - -import com.vaadin.automatedtests.util.Log; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; - -public class RobustnessSimple extends Robustness implements - Button.ClickListener { - - @Override - public void create() { - count++; - - // remove old stressLayout, all dependant components should be now - // allowed for garbage collection. - if (stressLayout != null) { - main.removeComponent(stressLayout); - } - - // create new stress layout - stressLayout = new OrderedLayout(); - - // CASE single orderedlayout with a label containing 1Mb of data - // fill with random components - Label label = new Label("Label " + Log.getMemoryStatistics(), - Label.CONTENT_PREFORMATTED); - byte[] data = new byte[1024 * 1024]; - label.setData(data); - stressLayout.addComponent(label); - - // CASE simple button example - // stressLayout.addComponent(new ButtonExample()); - - // CASE #1392, this "leaks" in a way that we cannot release opened - // windows - // in any way (Window.open method) - // stressLayout.addComponent(new WindowingExample()); - - // CASE TableExample - // stressLayout.addComponent(new TableExample()); - - // add new component container to main layout - main.addComponent(stressLayout); - - System.out.println("Created " + count + " times."); - } - -} diff --git a/src/com/vaadin/tests/themes/ButtonsTest.java b/src/com/vaadin/tests/themes/ButtonsTest.java deleted file mode 100644 index 9ad2a9f39e..0000000000 --- a/src/com/vaadin/tests/themes/ButtonsTest.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.vaadin.tests.themes; - -import com.vaadin.terminal.ThemeResource; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Layout; -import com.vaadin.ui.NativeButton; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -@SuppressWarnings("serial") -public class ButtonsTest extends com.vaadin.Application { - - final Window main = new Window("Button states & themes"); - - CheckBox styleToggle; - CheckBox iconToggle; - CheckBox nativeToggle; - CheckBox themeToggle; - boolean largeIcons = false; - boolean nativeButtons = false; - - final HorizontalLayout toggles = new HorizontalLayout(); - - @Override - public void init() { - setMainWindow(main); - setTheme("reindeer"); - - themeToggle = new CheckBox("Runo theme", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (getTheme() == "reindeer") { - setTheme("runo"); - } else { - setTheme("reindeer"); - } - } - }); - themeToggle.setStyleName("small"); - themeToggle.setImmediate(true); - - styleToggle = new CheckBox("Black style", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (!main.getContent().getStyleName().contains("black")) { - main.getContent().setStyleName("black"); - } else { - main.getContent().setStyleName(""); - } - } - }); - styleToggle.setImmediate(true); - styleToggle.setStyleName("small"); - - iconToggle = new CheckBox("64x icons", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - largeIcons = !largeIcons; - recreateAll(); - } - }); - iconToggle.setImmediate(true); - iconToggle.setStyleName("small"); - - nativeToggle = new CheckBox("Native buttons", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - nativeButtons = !nativeButtons; - recreateAll(); - } - }); - nativeToggle.setImmediate(true); - nativeToggle.setStyleName("small"); - - toggles.setSpacing(true); - toggles.addComponent(themeToggle); - toggles.addComponent(styleToggle); - toggles.addComponent(iconToggle); - toggles.addComponent(nativeToggle); - main.addComponent(toggles); - - recreateAll(); - - } - - private void recreateAll() { - main.removeAllComponents(); - main.addComponent(toggles); - - main.addComponent(buildButtons(false, false, false, false)); - main.addComponent(buildButtons(false, false, true, false)); - main.addComponent(buildButtons(false, true, false, false)); - main.addComponent(buildButtons(false, true, true, false)); - main.addComponent(buildButtons(true, false, false, false)); - main.addComponent(buildButtons(true, false, true, false)); - main.addComponent(buildButtons(true, true, false, false)); - main.addComponent(buildButtons(true, true, true, false)); - - main.addComponent(buildButtons(false, false, false, true)); - main.addComponent(buildButtons(false, false, true, true)); - main.addComponent(buildButtons(false, true, false, true)); - main.addComponent(buildButtons(false, true, true, true)); - main.addComponent(buildButtons(true, false, false, true)); - main.addComponent(buildButtons(true, false, true, true)); - main.addComponent(buildButtons(true, true, false, true)); - main.addComponent(buildButtons(true, true, true, true)); - - final Button b = new Button("Tabindex"); - b.setTabIndex(1); - main.addComponent(b); - - Button c = new Button("toggle enabled", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - b.setEnabled(!b.isEnabled()); - } - }); - main.addComponent(c); - } - - private Layout buildButtons(boolean disabled, boolean icon, boolean error, - boolean sized) { - - String[] buttonStyles = new String[] { "Normal", "Primary", "Small", - "Link" }; - - HorizontalLayout hl = new HorizontalLayout(); - hl.setSpacing(true); - hl.setMargin(true); - - for (int i = 0; i < buttonStyles.length; i++) { - Button b; - if (nativeButtons) { - b = new NativeButton(buttonStyles[i] + " style"); - } else { - b = new Button(buttonStyles[i] + " style"); - } - b.setStyleName(buttonStyles[i].toLowerCase()); - if (icon) { - b.setIcon(new ThemeResource("../runo/icons/" - + (largeIcons ? "64" : "16") + "/document.png")); - } - if (error) { - b.setComponentError(new UserError("Error")); - } - if (disabled) { - b.setEnabled(false); - } - if (sized) { - b.setWidth("250px"); - b.setCaption(b.getCaption() + " (250px)"); - } - hl.addComponent(b); - } - - return hl; - } - -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1225.java b/src/com/vaadin/tests/tickets/Ticket1225.java deleted file mode 100644 index 5244308f45..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1225.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -/** - * With IE7 extra scrollbars appear in content area all though content fits - * properly. Scrollbars will disappear if "shaking" content a bit, like - * selecting tests in area. - */ -public class Ticket1225 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window( - "Test app to break layout fuction in IE7"); - setMainWindow(mainWin); - - SplitPanel sp = new SplitPanel(); - - sp.setFirstComponent(new Label("First")); - - ExpandLayout el = new ExpandLayout(); - - sp.setSecondComponent(el); - el.setMargin(true); - el.setSizeFull(); - - el.addComponent(new Label("Top")); - - Table testTable = TestForTablesInitialColumnWidthLogicRendering - .getTestTable(5, 50); - testTable.setSizeFull(); - - TabSheet ts = new TabSheet(); - ts.setSizeFull(); - - Label red = new Label( - "<div style='background:red;width:100%;height:100%;'>??</div>", - Label.CONTENT_XHTML); - // red.setCaption("cap"); - // red.setSizeFull(); - - // el.addComponent(testTable); - // el.expand(testTable); - - el.addComponent(ts); - el.expand(ts); - ts.addComponent(red); - ts.setTabCaption(red, "REd tab"); - - Label l = new Label("<div style='background:blue;'>sdf</div>", - Label.CONTENT_XHTML); - el.addComponent(l); - el.setComponentAlignment(l, ExpandLayout.ALIGNMENT_RIGHT, - ExpandLayout.ALIGNMENT_VERTICAL_CENTER); - - mainWin.setLayout(sp); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1230.java b/src/com/vaadin/tests/tickets/Ticket1230.java deleted file mode 100644 index 233dd3aae8..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1230.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.data.Item;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket1230 extends Application {
-
- private static final Object PROPERTY_ID = new Object();
- private static final Object NULL_ITEM_ID = new Object();
- private Select selectWithoutNullItem;
- private Select selectWithNullItem;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
-
- GridLayout layout = new GridLayout(5, 5);
- w.setLayout(layout);
-
- layout.setSpacing(true);
-
- {
- selectWithoutNullItem = createSelect();
-
- layout.addComponent(selectWithoutNullItem);
- Button b = new Button("Select NULL_PROPERTY", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithoutNullItem.select(NULL_ITEM_ID);
-
- }
- });
- layout.addComponent(b);
- b = new Button("Select 1", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithoutNullItem.select("1");
-
- }
- });
- layout.addComponent(b);
- b = new Button("Select 2", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithoutNullItem.select("2");
-
- }
- });
- layout.addComponent(b);
-
- b = new Button("Select null", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithoutNullItem.select(null);
-
- }
- });
- layout.addComponent(b);
- }
-
- {
- selectWithNullItem = createSelect();
- Item nullItem = selectWithNullItem.addItem(NULL_ITEM_ID);
- nullItem.getItemProperty(PROPERTY_ID).setValue("NULL");
- selectWithNullItem.setNullSelectionItemId(NULL_ITEM_ID);
-
- layout.addComponent(selectWithNullItem);
- Button b = new Button("Select NULL_PROPERTY", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithNullItem.select(NULL_ITEM_ID);
-
- }
- });
- layout.addComponent(b);
-
- b = new Button("Select 1", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithNullItem.select("1");
-
- }
- });
- layout.addComponent(b);
- b = new Button("Select 2", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithNullItem.select("2");
-
- }
- });
- layout.addComponent(b);
-
- b = new Button("Select null", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- selectWithNullItem.select(null);
-
- }
- });
- layout.addComponent(b);
-
- }
- }
-
- private Select createSelect() {
- Select select = new Select();
- select.setMultiSelect(false);
- select.addContainerProperty(PROPERTY_ID, String.class, "");
- select.setItemCaptionPropertyId(PROPERTY_ID);
-
- Item item1 = select.addItem("1");
- item1.getItemProperty(PROPERTY_ID).setValue("1");
- Item item2 = select.addItem("2");
- item2.getItemProperty(PROPERTY_ID).setValue("2");
-
- select.setNullSelectionAllowed(true);
-
- return select;
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket124.java b/src/com/vaadin/tests/tickets/Ticket124.java deleted file mode 100644 index 1c2ca1a2e1..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket124.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket124 extends Application {
-
- private TextField tf;
- private GridLayout gl;
-
- @Override
- public void init() {
- Window w = new Window("#124: Insert & remove row for GridLayout");
- setMainWindow(w);
- setTheme("tests-tickets");
- // gl = new GridLayout(4, 4);
- gl = new GridLayout(2, 2);
-
- tf = new TextField("Row nr");
- Button insert = new Button("Insert row", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- insertRow();
-
- }
- });
- Button delete = new Button("Delete row", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- deleteRow();
-
- }
- });
-
- // gl.addComponent(new Label("0-0"), 0, 0);
- // gl.addComponent(new Label("0-1"), 1, 0);
- gl.addComponent(new Label("1-0"), 1, 0);
- gl.addComponent(new Label("1-1"), 1, 1);
- gl.addComponent(new Label("0,0-1,0"), 0, 0, 1, 0);
- gl.addComponent(new Label("2,0-3,0"), 2, 0, 3, 0);
- Label l = new Label("Large cell 0,1-2,2<br/>yadayada<br/>lorem ipsum");
- l.setContentMode(Label.CONTENT_XHTML);
- gl.addComponent(l, 0, 1, 2, 2);
- gl.addComponent(new Label("3-1"), 3, 1);
- gl.addComponent(new Label("3,2-3,3"), 3, 2, 3, 3);
- gl.addComponent(tf, 0, 3);
- gl.addComponent(insert, 1, 3);
- gl.addComponent(delete, 2, 3);
-
- gl.setStyleName("border");
- w.addComponent(gl);
- }
-
- protected void deleteRow() {
- int pos = Integer.parseInt(tf.getValue().toString());
- gl.removeRow(pos);
-
- }
-
- protected void clearRow() {
- int pos = Integer.parseInt(tf.getValue().toString());
- for (int col = 0; col < gl.getColumns(); col++) {
- try {
- gl.removeComponent(col, pos);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-
- protected void insertRow() {
- int pos = Integer.parseInt(tf.getValue().toString());
- gl.insertRow(pos);
- try {
- TextField t = new TextField("", "Newly added row");
- t.setWidth("100%");
- gl.addComponent(t, 0, pos, 3, pos);
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1245.java b/src/com/vaadin/tests/tickets/Ticket1245.java deleted file mode 100644 index c2a150b8ba..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1245.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.ui.AbstractSelect;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Tree;
-import com.vaadin.ui.Window;
-
-public class Ticket1245 extends com.vaadin.Application {
-
- TextField f = new TextField();
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- main.addComponent(new TreeExample());
- }
-}
-
-class TreeExample extends CustomComponent {
-
- // Id for the caption property
- private static final Object CAPTION_PROPERTY = "caption";
-
- private static final String desc = "non-first tree in non-sized orderedlayout seems to be the problem";
-
- Tree tree;
-
- public TreeExample() {
- final OrderedLayout main = new OrderedLayout();
- setCompositionRoot(main);
-
- // Panel w/ Tree
- main.setStyleName(Panel.STYLE_LIGHT);
- main.setWidth(200);
- // // Description, this is needed. Works in first slot
- main.addComponent(new Label(desc));
-
- // setting either width or height fixes the issue
- // p.setWidth(500);
- // p.setHeight(800);
-
- // Tree with a few items
- tree = new Tree();
- tree.setImmediate(true);
- // we'll use a property for caption instead of the item id ("value"),
- // so that multiple items can have the same caption
- tree.addContainerProperty(CAPTION_PROPERTY, String.class, "");
- tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
- tree.setItemCaptionPropertyId(CAPTION_PROPERTY);
- for (int i = 1; i <= 3; i++) {
- final Object id = addCaptionedItem("Section " + i, null);
- tree.expandItem(id);
- addCaptionedItem("Team A", id);
- addCaptionedItem("Team B", id);
- }
- main.addComponent(tree);
- }
-
- /**
- * Helper to add an item with specified caption and (optional) parent.
- *
- * @param caption
- * The item caption
- * @param parent
- * The (optional) parent item id
- * @return the created item's id
- */
- private Object addCaptionedItem(String caption, Object parent) {
- // add item, let tree decide id
- final Object id = tree.addItem();
- // get the created item
- final Item item = tree.getItem(id);
- // set our "caption" property
- final Property p = item.getItemProperty(CAPTION_PROPERTY);
- p.setValue(caption);
- if (parent != null) {
- tree.setChildrenAllowed(parent, true);
- tree.setParent(id, parent);
- tree.setChildrenAllowed(id, false);
- }
- return id;
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1362Login.java b/src/com/vaadin/tests/tickets/Ticket1362Login.java deleted file mode 100644 index 8640b06bc0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1362Login.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.io.ByteArrayInputStream; -import java.net.URL; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; - -import com.vaadin.Application; -import com.vaadin.terminal.ApplicationResource; -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.ParameterHandler; -import com.vaadin.terminal.URIHandler; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window.Notification; - -/** - * Proof of concept how to create a decent login screen that works with browsers - * PW managers. (Browsers don't autofill generated login forms) - * - * TODO generalize js to work inside iframes (if a Vaadin application is inside - * iframe) - * - * TODO extract login form to a external template. - * - * TODO theme - * - * TODO refine docs, make LoginBox a standard Vaadin component - * - * TODO article - * - */ -public class Ticket1362Login extends Application { - - public class LoginBox extends CustomComponent { - - Embedded iframe = new Embedded(); - - ApplicationResource loginPage = new ApplicationResource() { - - private byte[] loginHTML = ("" - + "<html>" - + "<head><script type='text/javascript'>" - + "var setTarget = function() {document.getElementById('loginf').action = top.location;};" - + "</script></head>" - + "<body onload='setTarget();'>" - + "Iframe generated by LoginBox. PW managers can autofill form. Form handled by LoginBox " - + "that will fire LoginEvents. Will post into another iframe, from where the script " - + "will find Vaadin client that will be force synced. <form id='loginf' target='logintarget'>" - + "Username : <input type='text' name='username'>" - + "Password : <input type='password' name='password'>" - + "<input type='submit' value='login'>" + "</form>" - + "<iframe name='logintarget'></iframe>" + "</body>" - + "</html>").getBytes(); - - public Application getApplication() { - return LoginBox.this.getApplication(); - } - - public int getBufferSize() { - return loginHTML.length; - } - - public long getCacheTime() { - return 0; - } - - public String getFilename() { - return "login.html"; - } - - public DownloadStream getStream() { - return new DownloadStream(new ByteArrayInputStream(loginHTML), - getMIMEType(), getFilename()); - } - - public String getMIMEType() { - return "text/html"; - } - }; - - private ParameterHandler paramHandler = new ParameterHandler() { - - public void handleParameters(Map parameters) { - if (parameters.containsKey("username")) { - getWindow().addURIHandler(uriHandler); - - HashMap params = new HashMap(); - // expecting single params - for (Iterator it = parameters.keySet().iterator(); it - .hasNext();) { - String key = (String) it.next(); - String value = ((String[]) parameters.get(key))[0]; - params.put(key, value); - } - LoginEvent event = new LoginEvent(params); - for (Iterator iterator = listeners.iterator(); iterator - .hasNext();) { - LoginListener listener = (LoginListener) iterator - .next(); - listener.onLogin(event); - } - } - } - }; - - private URIHandler uriHandler = new URIHandler() { - public DownloadStream handleURI(URL context, String relativeUri) { - if (window != null) { - window.removeURIHandler(this); - } - return new DownloadStream( - new ByteArrayInputStream( - "<html><body>Login form handeled.<script type='text/javascript'>top.vaadin.forceSync();</script></body></html>" - .getBytes()), "text/html", - "loginSuccesfull.html"); - } - }; - - private LinkedList listeners = new LinkedList(); - - private Window window; - - LoginBox() { - iframe.setType(Embedded.TYPE_BROWSER); - iframe.setSizeFull(); - setCompositionRoot(iframe); - } - - @Override - public void attach() { - super.attach(); - getApplication().addResource(loginPage); - getWindow().addParameterHandler(paramHandler); - iframe.setSource(loginPage); - } - - @Override - public void detach() { - getApplication().removeResource(loginPage); - getWindow().removeParameterHandler(paramHandler); - // store window temporary to properly remove uri handler once - // response is handled. (May happen if login handler removes login - // box - window = getWindow(); - super.detach(); - } - - /** - * This event is sent when login form is submitted. - */ - public class LoginEvent { - - private Map params; - - private LoginEvent(Map params) { - this.params = params; - } - - /** - * Returns form value by field name. - * - * @param name - * @return value in given field - */ - public String getLoginParameter(String name) { - if (params.containsKey(name)) { - return (String) params.get(name); - } else { - return null; - } - } - } - - /** - * Adds LoginListener to handle login logic - * - * @param listener - */ - public void addLoginListener(LoginListener listener) { - listeners.add(listener); - } - - /** - * Removes LoginListener - * - * @param listener - */ - public void removeLoginListener(LoginListener listener) { - listeners.remove(listener); - } - - } - - /** - * Login listener is a class capable to listen LoginEvents sent from - * LoginBox - */ - public interface LoginListener { - /** - * This method is fired on each login form post. - * - * @param event - */ - public void onLogin(LoginBox.LoginEvent event); - } - - final static String GUEST = "guest"; - - LoginBox loginBox = new LoginBox(); - - Label currentUser = new Label(GUEST); - - private Panel mainPanel; - - private ExpandLayout el; - - @Override - public void init() { - - final Window mainWin = new Window( - "Test app with password manager savvy login functionality"); - - el = new ExpandLayout(); - - currentUser.setCaption("Currennt user"); - el.addComponent(currentUser); - - el.addComponent(loginBox); - el.expand(loginBox); - - mainWin.setLayout(el); - - setMainWindow(mainWin); - - mainPanel = new Panel("Test app"); - mainPanel.setSizeFull(); - mainPanel.addComponent(new Label("User is logged in")); - mainPanel.addComponent(new Button("Logout", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - Ticket1362Login.this.close(); - } - })); - - loginBox.addLoginListener(new LoginListener() { - public void onLogin(LoginBox.LoginEvent event) { - String pw = event.getLoginParameter("password"); - String username = event.getLoginParameter("username"); - if (pw.equals("1234")) { - setUser(username); - currentUser.setValue(username); - currentUser.getWindow().showNotification( - "Logged in user: " + username); - getMainWindow().getLayout().replaceComponent(loginBox, - mainPanel); - el.expand(mainPanel); - } else { - getMainWindow().showNotification( - "Wrong password. Hint, try '1234' ", - Notification.TYPE_WARNING_MESSAGE); - } - } - }); - - } - -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1365.java b/src/com/vaadin/tests/tickets/Ticket1365.java deleted file mode 100644 index 1a890e313e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1365.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.event.Action;
-import com.vaadin.event.ShortcutAction;
-import com.vaadin.event.Action.Handler;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket1365 extends com.vaadin.Application implements
- Handler {
-
- TextField f = new TextField();
-
- Label status = new Label("ENTER and CTRL-S fires shortcut action.");
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- main.addComponent(f);
- main.addComponent(status);
- main.addActionHandler(this);
- f.focus();
-
- }
-
- final static private Action[] actions = new Action[] {
- new ShortcutAction("Enter", ShortcutAction.KeyCode.ENTER,
- new int[] {}),
- new ShortcutAction("CTRL-S", ShortcutAction.KeyCode.S,
- new int[] { ShortcutAction.ModifierKey.CTRL }), };
-
- public Action[] getActions(Object target, Object sender) {
- return actions;
- }
-
- public void handleAction(Action action, Object sender, Object target) {
- status.setValue("Pressed " + action.getCaption()
- + " to fire shortcut. Texfield value: " + f.getValue());
- f.focus();
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1368.java b/src/com/vaadin/tests/tickets/Ticket1368.java deleted file mode 100644 index 9df316fdcb..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1368.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -/** - */ -public class Ticket1368 extends Application { - - private Table t; - - @Override - public void init() { - - final Window mainWin = new Window("Test app to #1368"); - setMainWindow(mainWin); - - t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 5); - - mainWin.addComponent(t); - - ComboBox addColumn = new ComboBox(); - addColumn.setImmediate(true); - addColumn.setNewItemsAllowed(true); - addColumn.setNewItemHandler(new ComboBox.NewItemHandler() { - public void addNewItem(String newItemCaption) { - t.addContainerProperty(newItemCaption, String.class, "-"); - } - }); - mainWin.addComponent(addColumn); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1397.java b/src/com/vaadin/tests/tickets/Ticket1397.java deleted file mode 100644 index b56620365c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1397.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.Date; - -import com.vaadin.Application; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.InlineDateField; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.PopupView; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket1397 extends Application { - - Window main; - - @Override - public void init() { - setTheme("runo"); - main = new Window("PopupView test"); - setMainWindow(main); - Panel panel = new Panel("PopupTest"); - - // First test component - final ObjectProperty prop = new ObjectProperty("fooTextField"); - - PopupView.Content content = new PopupView.Content() { - public String getMinimizedValueAsHTML() { - return prop.toString(); - } - - public Component getPopupComponent() { - return new TextField("Edit foo", prop); - } - }; - - PopupView pe = new PopupView(content); - pe.setDescription("Click to edit"); - panel.addComponent(pe); - - // Second test component - PopupView pe2 = new PopupView("fooLabel", new Label("Foooooooooo...")); - pe2.setDescription("Click to view"); - panel.addComponent(pe2); - - // Third test component - final ObjectProperty prop2 = new ObjectProperty(new StringBuffer( - "Text for button")); - - class myButton extends Button { - public myButton() { - super("Reverse the property"); - this.addListener(new Button.ClickListener() { - public void buttonClick(Button.ClickEvent event) { - StringBuffer getContents = (StringBuffer) prop2 - .getValue(); - getContents.reverse(); - - } - }); - } - } - - final Panel panel2 = new Panel("Editor with a button"); - panel2.addComponent(new myButton()); - PopupView.Content content2 = new PopupView.Content() { - public String getMinimizedValueAsHTML() { - return prop2.toString(); - } - - public Component getPopupComponent() { - return panel2; - } - }; - - PopupView p3 = new PopupView(content2); - panel.addComponent(p3); - - // Fourth test component - final Panel panel3 = new Panel("Editor popup for a property"); - TextField tf2 = new TextField("TextField for editing a property"); - final ObjectProperty op = new ObjectProperty("This is property text."); - tf2.setPropertyDataSource(op); - panel3.addComponent(tf2); - PopupView.Content content3 = new PopupView.Content() { - - public String getMinimizedValueAsHTML() { - return op.toString(); - } - - public Component getPopupComponent() { - return panel3; - } - - }; - PopupView p4 = new PopupView(content3); - panel.addComponent(p4); - - // Fifth test component - Table table = new Table("Table for testing purposes"); - for (int i = 0; i < 5; i++) { - table.addContainerProperty("" + (i + 1), String.class, ""); - } - table.addContainerProperty("" + 6, PopupView.class, null); - table.addContainerProperty("" + 7, PopupView.class, null); - table.setPageLength(20); - for (int i = 0; i < 1000; i++) { - - final InlineDateField df = new InlineDateField("", new Date()); - PopupView pp = new PopupView(new PopupView.Content() { - public String getMinimizedValueAsHTML() { - return df.toString(); - } - - public Component getPopupComponent() { - return df; - } - }); - final int lineNum = i; - PopupView pp2 = new PopupView(new PopupView.Content() { - - TextField tf = new TextField("Editor for line " + lineNum, - - "Try to edit the contents for this textfield on line " - + lineNum - + " and see how the overview-version changes."); - - public String getMinimizedValueAsHTML() { - return "" + tf.toString().length() + " characters of info"; - } - - public Component getPopupComponent() { - return tf; - } - - }); - table.addItem(new Object[] { "1 " + i, "2 " + i, "3 " + i, - "4 " + i, "5 " + i, pp, pp2 }, new Integer(i)); - } - - main.addComponent(table); - main.addComponent(panel); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket1435.java b/src/com/vaadin/tests/tickets/Ticket1435.java deleted file mode 100644 index 9058184d8f..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1435.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket1435 extends Application { - - private static final boolean useWorkaround = true; - - @Override - public void init() { - - final Window mainWin = new Window("ButtonPanel containing a table test"); - setMainWindow(mainWin); - ((OrderedLayout) mainWin.getLayout()).setSpacing(true); - - ButtonPanel dataCardView1 = buildButtonPanel("My Tickets"); - ButtonPanel dataCardView2 = buildButtonPanel("My Tickets 2"); - - mainWin.addComponent(dataCardView1); - mainWin.addComponent(dataCardView2); - - } - - /** - * A ButtonPanel is a Panel, which has context specific Buttons in its - * header. - * - * ButtonPanel also provides buttons for controlling its visibility - * (collapse/expand). - */ - public class ButtonPanel extends CustomComponent { - - ExpandLayout root = new ExpandLayout(); - - // In header are the panel's title and the control buttons. - // Panel title is expanded by default. - ExpandLayout header = new ExpandLayout( - ExpandLayout.ORIENTATION_HORIZONTAL); - - // This is where the actual data is put. - Panel container = new Panel(); - - // Last known height before the panel was collapsed - private float lastHeight = -1; - private int lastHeightUnit = -1; - - public ButtonPanel(String labelString) { - setCompositionRoot(root); - root.setSizeFull(); - - root.setStyleName("toolbarpanel"); - header.setStyleName("toolbar"); - - initHeader(labelString); - - initContainer(); - } - - private void initHeader(String labelString) { - root.addComponent(header); - header.setWidth("100%"); - header.setHeight("26px"); - Label label = new Label(labelString); - label.setStyleName("caption"); - header.addComponent(label); - - final Layout buttonContainer; - if (useWorkaround) { - buttonContainer = header; - - } else { - buttonContainer = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - header.addComponent(buttonContainer); - - } - - Button edit = new Button("Edit"); - edit.setStyleName("link"); - buttonContainer.addComponent(edit); - - Button copy = new Button("Copy"); - copy.setStyleName("link"); - buttonContainer.addComponent(copy); - - Button move = new Button("Move"); - move.setStyleName("link"); - buttonContainer.addComponent(move); - - Button delete = new Button("Delete"); - delete.setStyleName("link"); - buttonContainer.addComponent(delete); - - Button bind = new Button("Bind"); - bind.setStyleName("link"); - buttonContainer.addComponent(bind); - - Button options = new Button("Options..."); - options.setStyleName("link"); - buttonContainer.addComponent(options); - - final Button expand = new Button("Expand"); - - final Button collapse = new Button("Collapse"); - buttonContainer.addComponent(collapse); - - collapse.setStyleName("collapse"); - collapse.addListener(new Button.ClickListener() { - public void buttonClick(Button.ClickEvent event) { - if (useWorkaround) { - container.setVisible(false); - lastHeight = root.getHeight(); - lastHeightUnit = root.getHeightUnits(); - root.setHeight("26px"); - buttonContainer.replaceComponent(collapse, expand); - } else { - boolean visible = container.isVisible(); - container.setVisible(!visible); - if (visible) { - lastHeight = root.getHeight(); - lastHeightUnit = root.getHeightUnits(); - root.setHeight("26px"); - } else { - root.setHeight(lastHeight, lastHeightUnit); - } - event.getButton().setCaption( - visible ? "Expand" : "Collapse"); - } - } - }); - - if (useWorkaround) { - expand.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - container.setVisible(true); - root.setHeight(lastHeight, lastHeightUnit); - buttonContainer.replaceComponent(expand, collapse); - } - }); - } - - } - - private void initContainer() { - container.setStyleName("custompanel"); - container.setSizeFull(); - container.getLayout().setMargin(false); - container.getLayout().setSizeFull(); - root.addComponent(container); - root.expand(container); - } - - public void setHeight(int height, int unit) { - root.setHeight(height, unit); - lastHeight = height; - lastHeightUnit = unit; - container.setHeight("100%"); - } - - @Override - public void setHeight(String height) { - root.setHeight(height); - lastHeight = root.getHeight(); - lastHeightUnit = root.getHeightUnits(); - container.setHeight("100%"); - } - - @Override - public void setWidth(String width) { - root.setWidth(width); - } - - public void setWidth(int width, int unit) { - root.setWidth(width, unit); - } - - @Override - public void setSizeFull() { - setWidth("100%"); - setHeight("100%"); - } - - public void setPanelComponent(Component component) { - container.removeAllComponents(); - container.addComponent(component); - } - } - - public ButtonPanel buildButtonPanel(String caption) { - ButtonPanel panel = new ButtonPanel(caption); - - panel.setHeight("250px"); - panel.setWidth("500px"); - - Table table = new Table(); - - table.setSizeFull(); - - table.addContainerProperty("checkbox", CheckBox.class, new CheckBox()); - table.setColumnWidth("checkbox", 30); - table.setColumnHeader("checkbox", ""); - - table.addContainerProperty("Tickets", String.class, null); - table.setColumnWidth("Tickets", 150); - - table.addContainerProperty("Deadline", String.class, null); - - for (int i = 0; i < 10; i++) { - String name = "Name " + i; - table.addItem(new Object[] { new CheckBox(), name, - "02-22-2007 13:37" }, new Integer(i)); - } - - panel.setPanelComponent(table); - - return panel; - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1444.java b/src/com/vaadin/tests/tickets/Ticket1444.java deleted file mode 100644 index 2944f460f6..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1444.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket1444 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window( - "Test app to break layout fuction in IE7"); - setMainWindow(mainWin); - - OrderedLayout ol = new OrderedLayout(); - ol.setHeight("250px"); - ol.setWidth("500px"); - - Label red = new Label( - "<div style='background:red;width:100%;height:100%;'>??</div>", - Label.CONTENT_XHTML); - red.setSizeFull(); - - ol.addComponent(red); - mainWin.addComponent(ol); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java b/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java deleted file mode 100644 index 3437ca5d2a..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1465ModalNotification.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket1465ModalNotification extends Application { - - @Override - public void init() { - - final Window mainWin = new Window("ButtonPanel containing a table test"); - setMainWindow(mainWin); - - final Window modal = new Window("Modal window"); - modal.setModal(true); - - Button b = new Button("click to show notification", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - modal.showNotification( - "Try clicking the button in main window!", - Window.Notification.TYPE_ERROR_MESSAGE); - - } - }); - modal.addComponent(b); - - b = new Button("click to warning notification", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - modal.showNotification( - "Try clicking the button in main window!", - Window.Notification.TYPE_WARNING_MESSAGE); - } - }); - modal.addComponent(b); - - b = new Button("click to Humanized notification", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - modal.showNotification( - "Try clicking the button in main window!", - Window.Notification.TYPE_HUMANIZED_MESSAGE); - } - }); - modal.addComponent(b); - - b = new Button("click to test modality!", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - mainWin.addComponent(new Label("clicked")); - - } - }); - - modal.addComponent(b); - - mainWin.addWindow(modal); - - b = new Button("click to test modality!", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - mainWin.addComponent(new Label("clicked")); - - } - }); - - mainWin.addComponent(b); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1506.java b/src/com/vaadin/tests/tickets/Ticket1506.java deleted file mode 100644 index 4788d27aad..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1506.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Panel; - -public class Ticket1506 extends CustomComponent { - - Panel p; - - public Ticket1506() { - p = new Ticket1506_Panel(); - setCompositionRoot(p); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1506_Panel.java b/src/com/vaadin/tests/tickets/Ticket1506_Panel.java deleted file mode 100644 index edbfd8928d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1506_Panel.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.Container;
-import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Select;
-
-/**
- * @author Efecte R&D
- * @version $Revision$, $Date$
- */
-public class Ticket1506_Panel extends Panel {
-
- public Ticket1506_Panel() {
- ObjectProperty property1 = new ObjectProperty(null, String.class);
- addComponent(initSelect(new Ticket1506_TestContainer(), "Test select",
- property1));
- addComponent(initButton(property1));
- addComponent(initSelect(new Ticket1506_TestContainer2(),
- "Test select 2", new ObjectProperty(null, String.class)));
- }
-
- private Component initButton(final ObjectProperty property) {
- Button button = new Button("Clear select");
- button.addListener(new Button.ClickListener() {
- public void buttonClick(Button.ClickEvent event) {
- property.setValue(null);
- }
- });
- return button;
- }
-
- private Component initSelect(Container containerDataSource, String caption,
- ObjectProperty property) {
- Select select = new Select(caption);
- select.setFilteringMode(Select.FILTERINGMODE_CONTAINS);
- select.setImmediate(true);
- select.setNullSelectionAllowed(false);
- select.setItemCaptionPropertyId(Ticket1506_TestContainer.PROPERTY_2_ID);
-
- select.setContainerDataSource(containerDataSource);
- select.setPropertyDataSource(property);
- return select;
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1506_TestContainer.java b/src/com/vaadin/tests/tickets/Ticket1506_TestContainer.java deleted file mode 100644 index 7002602ca2..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1506_TestContainer.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.data.Container;
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.data.util.PropertysetItem;
-
-/**
- * @author Efecte R&D
- * @version $Revision$, $Date$
- */
-public class Ticket1506_TestContainer implements Container {
- private Map items = new HashMap();
- public static final String ITEM_1_ID = "1";
- public static final String ITEM_2_ID = "2";
- public static final String PROPERTY_1_ID = "property 1";
- public static final String PROPERTY_2_ID = "property 2";
-
- private void loadItems() {
- final PropertysetItem item1 = new PropertysetItem();
- item1.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value 1",
- String.class));
- item1.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name 1",
- String.class));
- items.put(ITEM_1_ID, item1);
-
- final PropertysetItem item2 = new PropertysetItem();
- item2.addItemProperty(PROPERTY_1_ID, new ObjectProperty("value 2",
- String.class));
- item2.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name 2",
- String.class));
- items.put(ITEM_2_ID, item2);
- }
-
- public Item getItem(Object itemId) {
- if (items.isEmpty()) {
- loadItems();
- }
- return (Item) items.get(itemId);
- }
-
- public Collection getContainerPropertyIds() {
- if (items.isEmpty()) {
- loadItems();
- }
- ArrayList a = new ArrayList();
- a.add(PROPERTY_1_ID);
- a.add(PROPERTY_2_ID);
- return a;
- }
-
- public Collection getItemIds() {
- if (items.isEmpty()) {
- loadItems();
- }
- ArrayList a = new ArrayList();
- a.add(ITEM_1_ID);
- a.add(ITEM_2_ID);
- return a;
- }
-
- public Property getContainerProperty(Object itemId, Object propertyId) {
- if (items.isEmpty()) {
- loadItems();
- }
- Item item = (Item) items.get(itemId);
- if (item != null) {
- return item.getItemProperty(propertyId);
- }
- return null;
- }
-
- public Class getType(Object propertyId) {
- if (items.isEmpty()) {
- loadItems();
- }
- return String.class;
- }
-
- public int size() {
- if (items.isEmpty()) {
- loadItems();
- }
- return items.size();
- }
-
- public boolean containsId(Object itemId) {
- if (items.isEmpty()) {
- loadItems();
- }
- return items.containsKey(itemId);
- }
-
- public Item addItem(Object itemId) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Object addItem() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean removeItem(Object itemId)
- throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean addContainerProperty(Object propertyId, Class type,
- Object defaultValue) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean removeContainerProperty(Object propertyId)
- throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean removeAllItems() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1506_TestContainer2.java b/src/com/vaadin/tests/tickets/Ticket1506_TestContainer2.java deleted file mode 100644 index 4345b3e581..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1506_TestContainer2.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.data.Container;
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.data.util.PropertysetItem;
-
-/**
- * @author Efecte R&D
- * @version $Revision$, $Date$
- */
-public class Ticket1506_TestContainer2 implements Container {
- private Map items = new HashMap();
- public static final String ITEM_1_ID = "1";
- public static final String ITEM_2_ID = "2";
- public static final String PROPERTY_1_ID = "property 1";
- public static final String PROPERTY_2_ID = "property 2";
-
- private void loadItems() {
- for (int i = 1; i < 15; i++) {
- final PropertysetItem item = new PropertysetItem();
- item.addItemProperty(PROPERTY_1_ID, new ObjectProperty(
- "value " + i, String.class));
- item.addItemProperty(PROPERTY_2_ID, new ObjectProperty("name " + i,
- String.class));
- items.put(String.valueOf(i), item);
- }
- }
-
- public Item getItem(Object itemId) {
- if (items.isEmpty()) {
- loadItems();
- }
- return (Item) items.get(itemId);
- }
-
- public Collection getContainerPropertyIds() {
- if (items.isEmpty()) {
- loadItems();
- }
- ArrayList a = new ArrayList();
- a.add(PROPERTY_1_ID);
- a.add(PROPERTY_2_ID);
- return a;
- }
-
- public Collection getItemIds() {
- if (items.isEmpty()) {
- loadItems();
- }
- return items.keySet();
- }
-
- public Property getContainerProperty(Object itemId, Object propertyId) {
- if (items.isEmpty()) {
- loadItems();
- }
- Item item = (Item) items.get(itemId);
- if (item != null) {
- return item.getItemProperty(propertyId);
- }
- return null;
- }
-
- public Class getType(Object propertyId) {
- if (items.isEmpty()) {
- loadItems();
- }
- return String.class;
- }
-
- public int size() {
- if (items.isEmpty()) {
- loadItems();
- }
- return items.size();
- }
-
- public boolean containsId(Object itemId) {
- if (items.isEmpty()) {
- loadItems();
- }
- return items.containsKey(itemId);
- }
-
- public Item addItem(Object itemId) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public Object addItem() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean removeItem(Object itemId)
- throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean addContainerProperty(Object propertyId, Class type,
- Object defaultValue) throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean removeContainerProperty(Object propertyId)
- throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-
- public boolean removeAllItems() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Not implemented");
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1519.java b/src/com/vaadin/tests/tickets/Ticket1519.java deleted file mode 100644 index d088b2be23..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1519.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Window; - -public class Ticket1519 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window("Test app to #1368"); - setMainWindow(mainWin); - - mainWin.setTheme("example"); - TabSheet ts = new TabSheet(); - - ts.addTab(new CustomLayout("News"), "News", null); - ts.addTab(new CustomLayout("Support"), "Support", null); - - mainWin.addComponent(ts); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1572.java b/src/com/vaadin/tests/tickets/Ticket1572.java deleted file mode 100644 index b2bc0397fd..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1572.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1572 extends com.vaadin.Application {
-
- private Label state;
- private GridLayout gl;
- private Label spacingstate;
-
- @Override
- public void init() {
-
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- Panel p = new Panel("Test wrapper for gridlayout margin/spacing");
-
- p.setLayout(new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL));
-
- gl = new GridLayout(3, 3);
- gl.setMargin(true);
- for (int i = 0; i < 3 * 3; i++) {
- gl.addComponent(new Button("test"));
- }
- p.addComponent(gl);
- p.addComponent(new Label("| next component"));
-
- Button b = new Button("next margin state");
- b.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- nextMarginState();
- }
-
- });
-
- state = new Label();
- state.setCaption("Current margin state:");
- main.addComponent(state);
- main.addComponent(b);
-
- Button b2 = new Button("next spacing state");
- b2.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- nextSpacingState();
- }
-
- });
-
- spacingstate = new Label();
- spacingstate.setCaption("Current Spacing State:");
- main.addComponent(spacingstate);
- main.addComponent(b2);
-
- main.addComponent(p);
-
- nextMarginState();
- nextSpacingState();
-
- }
-
- private int stateCounter = -1;
-
- private void nextMarginState() {
- stateCounter++;
- switch (stateCounter) {
- case 0:
- gl.setMargin(false);
- state.setValue("Margin off");
- break;
- case 1:
- gl.setMargin(true);
- state.setValue("Margin on");
- break;
- case 2:
- gl.setMargin(true, false, false, false);
- state.setValue("Margin top");
- break;
- case 3:
- gl.setMargin(false, true, false, false);
- state.setValue("Margin right");
- break;
- case 4:
- gl.setMargin(false, false, true, false);
- state.setValue("Margin bottom");
- break;
- case 5:
- gl.setMargin(false, false, false, true);
- state.setValue("Margin left");
- break;
- default:
- stateCounter = -1;
- nextMarginState();
- break;
- }
- }
-
- private boolean spacing = true;
-
- private void nextSpacingState() {
- spacing = !spacing;
- if (spacing) {
- gl.setSpacing(true);
- spacingstate.setValue("Spacing on");
- } else {
- gl.setSpacing(false);
- spacingstate.setValue("Spacing off");
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1581.java b/src/com/vaadin/tests/tickets/Ticket1581.java deleted file mode 100644 index 0b170260d9..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1581.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Date;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.ProgressIndicator;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket1581 extends com.vaadin.Application {
-
- private Label time;
- private ProgressIndicator poller;
- private Thread thread;
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- main.addComponent(new Label("Test the second issue in ticket #1581"));
-
- time = new Label();
- poller = new ProgressIndicator();
- poller.setPollingInterval(200);
- main.addComponent(time);
- main.addComponent(poller);
-
- thread = new Thread() {
-
- @Override
- public void run() {
- super.run();
- while (true) {
- time.setValue(new Date());
- try {
- sleep(200);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- };
-
- thread.start();
-
- final Button stop = new Button("Stop updating", new ClickListener() {
- boolean active = true;
-
- public void buttonClick(ClickEvent event) {
-
- if (active) {
- main.removeComponent(poller);
- event.getButton().setCaption("Resume");
- } else {
- main.addComponent(poller);
- event.getButton().setCaption("Stop updating");
- }
- active = !active;
- }
- });
-
- main.addComponent(stop);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1589.java b/src/com/vaadin/tests/tickets/Ticket1589.java deleted file mode 100644 index 3debf78f25..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1589.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Date;
-
-import javax.imageio.ImageIO;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.DownloadStream;
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.terminal.URIHandler;
-import com.vaadin.ui.Link;
-import com.vaadin.ui.Window;
-
-public class Ticket1589 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
-
- MyDynamicResource res = new MyDynamicResource();
-
- w.addURIHandler(res);
-
- w
- .addComponent(new Link(
- "Test (without Content-Disposition, should suggest generatedFile.png when saving, browser default for actual disposition)",
- new ExternalResource("myresource")));
-
- w
- .addComponent(new Link(
- "Test (with Content-Disposition, should popup download dialog that suggests filename downloadedPNG.png)",
- new ExternalResource("myresource_download")));
- }
-}
-
-class MyDynamicResource implements URIHandler {
- String textToDisplay = (new Date()).toString();
-
- /**
- * Provides the dynamic resource if the URI matches the resource URI. The
- * matching URI is "/myresource" under the application URI context.
- *
- * Returns null if the URI does not match. Otherwise returns a download
- * stream that contains the response from the server.
- */
- public DownloadStream handleURI(URL context, String relativeUri) {
- // Catch the given URI that identifies the resource, otherwise let other
- // URI handlers or the Application to handle the response.
- if (!relativeUri.startsWith("myresource")) {
- return null;
- }
-
- // Create an image and draw some background on it.
- BufferedImage image = new BufferedImage(200, 200,
- BufferedImage.TYPE_INT_RGB);
- Graphics drawable = image.getGraphics();
- drawable.setColor(Color.lightGray);
- drawable.fillRect(0, 0, 200, 200);
- drawable.setColor(Color.yellow);
- drawable.fillOval(25, 25, 150, 150);
- drawable.setColor(Color.blue);
- drawable.drawRect(0, 0, 199, 199);
-
- // Use the parameter to create dynamic content.
- drawable.setColor(Color.black);
- drawable.drawString("Time: " + textToDisplay, 75, 100);
-
- try {
- // Write the image to a buffer.
- ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
- ImageIO.write(image, "png", imagebuffer);
-
- // Return a stream from the buffer.
- ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer
- .toByteArray());
- DownloadStream downloadStream = new DownloadStream(istream,
- "image/png", "generatedFile.png");
-
- if (relativeUri.startsWith("myresource_download")) {
- downloadStream.setParameter("Content-Disposition",
- "attachment; filename=\"downloadedPNG.png\"");
- }
- return downloadStream;
- } catch (IOException e) {
- return null;
- }
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1598.java b/src/com/vaadin/tests/tickets/Ticket1598.java deleted file mode 100644 index 0b35a223cc..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1598.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.ArrayList; -import java.util.List; - -import com.vaadin.Application; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.ui.MenuBar; -import com.vaadin.ui.Window; -import com.vaadin.ui.MenuBar.Command; -import com.vaadin.ui.MenuBar.MenuItem; - -public class Ticket1598 extends Application { - - Window main = new Window("MenuBar test"); - - final MenuBar menuBar = new MenuBar(); - - @Override - public void init() { - setMainWindow(main); - setTheme("runo"); - - List<MenuItem> itemList = new ArrayList<MenuItem>(); - // Populate the menu bar - for (int i = 0; i < 6; i++) { - itemList.add(menuBar.addItem(new String("Menu " + i), null, null)); - } - - MenuItem first = itemList.get(0); - - for (int i = 0; i < 5; i++) { - first.addItem(new String("Submenu item" + i), null, new Command() { - - public void menuSelected(MenuItem selected) { - main.showNotification("Action " + selected.getText()); - } - }); - } - - MenuItem firstSubItem1 = first.getChildren().get(1); - - for (int i = 0; i < 3; i++) { - firstSubItem1.addItem(new String("Subsubmenu item" + i), null, - new Command() { - - public void menuSelected(MenuItem selected) { - main.showNotification("Action " - + selected.getText()); - } - }); - } - MenuItem firstSubItem2 = first.getChildren().get(3); - - for (int i = 0; i < 3; i++) { - firstSubItem2.addItem(new String("Subsubmenu item" + i), null, - new Command() { - - public void menuSelected(MenuItem selected) { - main.showNotification("Action " - + selected.getText()); - } - }); - } - - MenuItem second = menuBar.getItems().get(1); - - for (int i = 0; i < 5; i++) { - second.addItem(new String("Second submenu item" + i), null, - new Command() { - - public void menuSelected(MenuItem selected) { - main.showNotification("Action " - + selected.getText()); - } - }); - } - - MenuItem third = menuBar.getItems().get(2); - third.setIcon(new ThemeResource("icons/16/document.png")); - - for (int i = 2; i <= 3; i++) { - (menuBar.getItems().get(i)).setCommand(new Command() { - - public void menuSelected(MenuItem selectedItem) { - main.showNotification("Action " + selectedItem.getText()); - } - }); - } - - final MenuItem fourth = menuBar.getItems().get(3); - fourth.setText("Add new item"); - - fourth.setCommand(new Command() { - public void menuSelected(MenuItem selected) { - menuBar.addItem("Newborn", null, null); - } - }); - - final MenuItem fifth = menuBar.getItems().get(4); - for (int i = 0; i < 5; i++) { - fifth.addItem("Another subitem " + i, null); - } - - final MenuItem last = menuBar.getItems().get(menuBar.getSize() - 1); - last.setText("Remove me!"); - - // A command for removing the selected menuitem - Command removeCommand = new Command() { - - public void menuSelected(MenuItem selected) { - MenuItem parent = selected.getParent(); - if (parent != null) { - parent.removeChild(selected); - } else { - menuBar.removeItem(selected); - } - } - }; - - last.setCommand(removeCommand); - - main.addComponent(menuBar); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket161.java b/src/com/vaadin/tests/tickets/Ticket161.java deleted file mode 100644 index a09b0d01cb..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket161.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Container; -import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; -import com.vaadin.ui.Button; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -/** - */ -public class Ticket161 extends Application { - - private Table t; - - @Override - public void init() { - - final Window mainWin = new Window("Test app to #1368"); - setMainWindow(mainWin); - - t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 100); - t.setCurrentPageFirstItemIndex(50); - - mainWin.addComponent(t); - - Button b = new Button("Truncate to 20 rows"); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - - Container containerDataSource = t.getContainerDataSource(); - Object[] itemIds = containerDataSource.getItemIds().toArray(); - @SuppressWarnings("unused") - int c = 0; - for (int i = 0; i < itemIds.length; i++) { - if (i > 19) { - containerDataSource.removeItem(itemIds[i]); - } - } - } - }); - - mainWin.addComponent(b); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1632.java b/src/com/vaadin/tests/tickets/Ticket1632.java deleted file mode 100644 index 1c521f8afb..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1632.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.ui.Button; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -/** - */ -public class Ticket1632 extends Application { - - private Table t; - - @Override - public void init() { - - final Window mainWin = new Window("Test app"); - setMainWindow(mainWin); - - t = new Table(); - - t.addContainerProperty("col1", String.class, ""); - t.addContainerProperty("col2", String.class, ""); - t.addContainerProperty("col3", String.class, ""); - - t.addItem(new Object[] { "jep", "foo", "bar" }, "1"); - t.addItem(new Object[] { "jep", "foo", "bar" }, "2"); - t.addItem(new Object[] { "jep", "foo", "bar" }, "3"); - - t.setVisibleColumns(new Object[] { "col1", "col2" }); - - t.addItem(new Object[] { "foo", "bar" }, "4"); - - // workaround to add item with all values - Item i = t.addItem("5"); - i.getItemProperty("col1").setValue("jep"); - i.getItemProperty("col2").setValue("foo"); - i.getItemProperty("col3").setValue("bar"); - - mainWin.addComponent(t); - - Button b = new Button("Toggle col3"); - b.addListener(new Button.ClickListener() { - boolean visible = false; - - public void buttonClick(ClickEvent event) { - visible = !visible; - if (visible) { - t - .setVisibleColumns(new Object[] { "col1", "col2", - "col3" }); - - } else { - t.setVisibleColumns(new Object[] { "col1", "col2" }); - - } - - } - }); - - mainWin.addComponent(b); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1659.java b/src/com/vaadin/tests/tickets/Ticket1659.java deleted file mode 100644 index 78715c89d1..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1659.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket1659 extends Application { - - @Override - public void init() { - final Window mainWin = new Window(); - setMainWindow(mainWin); - mainWin.addComponent(new Button( - "Change URI using Application.getURL()", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - mainWin.open(new ExternalResource(getURL() + "#" - + System.currentTimeMillis())); - } - })); - mainWin.addComponent(new Button("Change URI uring Window.getURL()", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - mainWin.open(new ExternalResource(mainWin.getURL() - + "#" + System.currentTimeMillis())); - } - })); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1663.java b/src/com/vaadin/tests/tickets/Ticket1663.java deleted file mode 100644 index 04adfa3c79..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1663.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.terminal.SystemError;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket1663 extends com.vaadin.Application {
-
- @Override
- public void init() {
-
- Window main = new Window("#1663");
- setMainWindow(main);
-
- TextField tf = new TextField("First name");
- tf
- .setDescription("The first name is used for the administration user interfaces only.");
- tf.setComponentError(new SystemError(
- "You must enter only one first name."));
-
- main.addComponent(tf);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1673.java b/src/com/vaadin/tests/tickets/Ticket1673.java deleted file mode 100644 index 845e49daed..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1673.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Window;
-
-public class Ticket1673 extends com.vaadin.Application {
-
- @Override
- public void init() {
-
- final Window main = new Window("#1673");
- setMainWindow(main);
-
- main.addComponent(new Button("close", this, "close"));
-
- }
-
- public static Application.SystemMessages getSystemMessages() {
- Application.CustomizedSystemMessages msgs = new Application.CustomizedSystemMessages();
-
- msgs.setSessionExpiredURL("http://www.vaadin.com/");
- msgs.setSessionExpiredCaption("Foo");
- msgs.setSessionExpiredMessage("Bar");
-
- return msgs;
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1710.java b/src/com/vaadin/tests/tickets/Ticket1710.java deleted file mode 100644 index f65fd0c8e4..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1710.java +++ /dev/null @@ -1,436 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.util.MethodProperty;
-import com.vaadin.terminal.Sizeable;
-import com.vaadin.terminal.SystemError;
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.ui.AbstractComponent;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.NativeSelect;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Layout.AlignmentHandler;
-
-public class Ticket1710 extends com.vaadin.Application {
-
- LinkedList listOfAllFields = new LinkedList();
-
- public void init() {
-
- setTheme("tests-tickets");
-
- OrderedLayout lo = new OrderedLayout();
- setMainWindow(new Window("#1710", lo));
- lo.setMargin(true);
- lo.setSpacing(true);
- lo.setWidth("100%");
-
- // Hiding controls
- OrderedLayout hidingControls = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- lo.addComponent(hidingControls);
-
- // OrderedLayout
- final OrderedLayout orderedLayout = new OrderedLayout();
- LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout",
- orderedLayout);
- hidingControls.addComponent(new Button("OrderedLayout",
- new MethodProperty(oltp, "visible")));
- lo.addComponent(oltp);
- orderedLayout.setSpacing(false);
- addFields(orderedLayout);
- final Button orientationButton = new Button("horizontal orientation",
- false);
- orientationButton.addListener(new Property.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- orderedLayout
- .setOrientation(orientationButton.booleanValue() ? OrderedLayout.ORIENTATION_HORIZONTAL
- : OrderedLayout.ORIENTATION_VERTICAL);
- }
- });
- orientationButton.setImmediate(true);
- oltp.controls.addComponent(orientationButton);
-
- // GridLayout
- GridLayout grid = new GridLayout(1, 1);
- Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid);
- hidingControls.addComponent(new Button("GridLayout (1col)",
- new MethodProperty(g1tp, "visible")));
- g1tp.setVisible(false);
- lo.addComponent(g1tp);
- grid.setSpacing(true);
- addFields(grid);
- GridLayout grid2 = new GridLayout(2, 1);
- Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2);
- hidingControls.addComponent(new Button("GridLayout (2cols)",
- new MethodProperty(g2tp, "visible")));
- g2tp.setVisible(false);
- lo.addComponent(g2tp);
- grid2.setSpacing(true);
- addFields(grid2);
-
- // ExpandLayout
- ExpandLayout el = new ExpandLayout();
- Panel elp = new LayoutTestingPanel(
- "ExpandLayout width first component expanded", el);
- hidingControls.addComponent(new Button("ExpandLayout (vertical)",
- new MethodProperty(elp, "visible")));
- elp.setVisible(false);
- el.setHeight(700);
- addFields(el);
- Component firstComponent = (Component) el.getComponentIterator().next();
- firstComponent.setSizeFull();
- el.expand(firstComponent);
- lo.addComponent(elp);
- ExpandLayout elh = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
- Panel elhp = new LayoutTestingPanel(
- "ExpandLayout width first component expanded; horizontal", elh);
- hidingControls.addComponent(new Button("ExpandLayout (horizontal)",
- new MethodProperty(elhp, "visible")));
- elhp.setVisible(false);
- elhp.setScrollable(true);
- elh.setWidth(2000);
- elh.setHeight(100);
- addFields(elh);
- Component firstComponentElh = (Component) elh.getComponentIterator()
- .next();
- firstComponentElh.setSizeFull();
- elh.expand(firstComponentElh);
- lo.addComponent(elhp);
-
- // CustomLayout
- OrderedLayout cl = new OrderedLayout();
- Panel clp = new LayoutTestingPanel("CustomLayout", cl);
- hidingControls.addComponent(new Button("CustomLayout",
- new MethodProperty(clp, "visible")));
- clp.setVisible(false);
- lo.addComponent(clp);
- cl.addComponent(new Label("<<< Add customlayout testcase here >>>"));
-
- // Form
- Panel formPanel = new Panel("Form");
- hidingControls.addComponent(new Button("Form", new MethodProperty(
- formPanel, "visible")));
- formPanel.setVisible(false);
- formPanel.addComponent(getFormPanelExample());
- lo.addComponent(formPanel);
-
- for (Iterator i = hidingControls.getComponentIterator(); i.hasNext();) {
- ((AbstractComponent) i.next()).setImmediate(true);
- }
-
- }
-
- private Form getFormPanelExample() {
- Form f = new Form();
- f.setCaption("Test form");
- Button fb1 = new Button("Test button");
- fb1.setComponentError(new SystemError("Test error"));
- f.addField("fb1", fb1);
- Button fb2 = new Button("Test button", true);
- fb2.setComponentError(new SystemError("Test error"));
- f.addField("fb2", fb2);
- TextField ft1 = new TextField("With caption");
- ft1.setComponentError(new SystemError("Error"));
- f.addField("ft1", ft1);
- TextField ft2 = new TextField();
- ft2.setComponentError(new SystemError("Error"));
- ft2.setValue("Without caption");
- f.addField("ft2", ft2);
- TextField ft3 = new TextField("With caption and required");
- ft3.setComponentError(new SystemError("Error"));
- ft3.setRequired(true);
- f.addField("ft3", ft3);
- return f;
- }
-
- private void addFields(ComponentContainer lo) {
- Button button = new Button("Test button");
- button.setComponentError(new SystemError("Test error"));
- lo.addComponent(button);
-
- Button b2 = new Button("Test button");
- b2.setComponentError(new SystemError("Test error"));
- b2.setSwitchMode(true);
- lo.addComponent(b2);
-
- TextField t1 = new TextField("With caption");
- t1.setComponentError(new SystemError("Error"));
- lo.addComponent(t1);
-
- TextField t2 = new TextField("With caption and required");
- t2.setComponentError(new SystemError("Error"));
- t2.setRequired(true);
- lo.addComponent(t2);
-
- TextField t3 = new TextField();
- t3.setValue("Without caption");
- t3.setComponentError(new SystemError("Error"));
- lo.addComponent(t3);
-
- lo.addComponent(new TextField("Textfield with no error in it"));
-
- TextField tt1 = new TextField("100% wide Textfield with no error in it");
- tt1.setWidth("100%");
- lo.addComponent(tt1);
-
- TextField tt2 = new TextField();
- tt2.setWidth("100%");
- tt2.setValue("100% wide Textfield with no error in it and no caption");
- lo.addComponent(tt2);
-
- TextField t4 = new TextField();
- t4.setValue("Without caption, With required");
- t4.setComponentError(new SystemError("Error"));
- t4.setRequired(true);
- lo.addComponent(t4);
-
- TextField t5 = new TextField();
- t5.setValue("Without caption, WIDE");
- t5.setComponentError(new SystemError("Error"));
- t5.setWidth(100);
- t5.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
- lo.addComponent(t5);
-
- TextField t6 = new TextField();
- t6.setValue("Without caption, With required, WIDE");
- t6.setComponentError(new SystemError("Error"));
- t6.setRequired(true);
- t6.setWidth(100);
- t6.setWidthUnits(Sizeable.UNITS_PERCENTAGE);
- lo.addComponent(t6);
-
- TextField t7 = new TextField();
- t7.setValue("With icon and required and icon");
- t7.setComponentError(new SystemError("Error"));
- t7.setRequired(true);
- t7.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
- lo.addComponent(t7);
-
- DateField d1 = new DateField(
- "Datefield with caption and icon, next one without caption");
- d1.setComponentError(new SystemError("Error"));
- d1.setRequired(true);
- d1.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
- lo.addComponent(d1);
-
- DateField d2 = new DateField();
- d2.setComponentError(new SystemError("Error"));
- d2.setRequired(true);
- lo.addComponent(d2);
- }
-
- public class LayoutTestingPanel extends Panel {
-
- Layout testedLayout;
-
- OrderedLayout controls = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- Button marginLeft = new Button("m-left", false);
- Button marginRight = new Button("m-right", false);
- Button marginTop = new Button("m-top", false);
- Button marginBottom = new Button("m-bottom", false);
- Button spacing = new Button("spacing", false);
- OrderedLayout testPanelLayout = new OrderedLayout();
-
- LayoutTestingPanel(String caption, Layout layout) {
- super(caption);
- OrderedLayout internalLayout = new OrderedLayout();
- internalLayout.setWidth("100%");
- setLayout(internalLayout);
- testedLayout = layout;
- testPanelLayout.setWidth("100%");
- Panel controlWrapper = new Panel();
- controlWrapper.addComponent(controls);
- controlWrapper.setWidth("100%");
- controlWrapper.setScrollable(true);
- controlWrapper.setStyleName("controls");
- internalLayout.addComponent(controlWrapper);
- Panel testPanel = new Panel(testPanelLayout);
- testPanel.setStyleName("testarea");
- testPanelLayout.addComponent(testedLayout);
- internalLayout.addComponent(testPanel);
- internalLayout.setMargin(true);
- internalLayout.setSpacing(true);
- controls.setSpacing(true);
- controls.setMargin(false);
- controls.addComponent(new Label("width"));
- controls.addComponent(new TextField(new MethodProperty(
- testedLayout, "width")));
- controls.addComponent(new Button("%", new MethodProperty(this,
- "widthPercents")));
- controls.addComponent(new Label("height"));
- controls.addComponent(new TextField(new MethodProperty(
- testedLayout, "height")));
- controls.addComponent(new Button("%", new MethodProperty(this,
- "heightPercents")));
- controls.addComponent(marginLeft);
- controls.addComponent(marginRight);
- controls.addComponent(marginTop);
- controls.addComponent(marginBottom);
- if (testedLayout instanceof Layout.SpacingHandler) {
- controls.addComponent(spacing);
- }
-
- Property.ValueChangeListener marginSpacingListener = new Property.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- updateMarginsAndSpacing();
- }
- };
-
- marginBottom.addListener(marginSpacingListener);
- marginTop.addListener(marginSpacingListener);
- marginLeft.addListener(marginSpacingListener);
- marginRight.addListener(marginSpacingListener);
- spacing.addListener(marginSpacingListener);
- updateMarginsAndSpacing();
-
- addAlignmentControls();
-
- testedLayout.setStyleName("tested-layout");
- setStyleName("layout-testing-panel");
-
- for (Iterator i = controls.getComponentIterator(); i.hasNext();) {
- ((AbstractComponent) i.next()).setImmediate(true);
- }
- }
-
- private void addAlignmentControls() {
- if (!(testedLayout instanceof Layout.AlignmentHandler)) {
- return;
- }
- @SuppressWarnings("unused")
- final Layout.AlignmentHandler ah = (AlignmentHandler) testedLayout;
-
- final NativeSelect vAlign = new NativeSelect();
- final NativeSelect hAlign = new NativeSelect();
- controls.addComponent(new Label("component alignment"));
- controls.addComponent(hAlign);
- controls.addComponent(vAlign);
- hAlign.setNullSelectionAllowed(false);
- vAlign.setNullSelectionAllowed(false);
-
- vAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_TOP));
- vAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_TOP), "top");
- vAlign.addItem(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER));
- vAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_VERTICAL_CENTER),
- "center");
- vAlign
- .addItem(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_BOTTOM));
- vAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_BOTTOM), "bottom");
-
- hAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT));
- hAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_LEFT), "left");
- hAlign.addItem(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER));
- hAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
- "center");
- hAlign
- .addItem(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_RIGHT));
- hAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right");
-
- Property.ValueChangeListener alignmentChangeListener = new Property.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- updateAlignments(((Integer) hAlign.getValue()).intValue(),
- ((Integer) vAlign.getValue()).intValue());
- }
-
- };
-
- hAlign
- .setValue(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_LEFT));
- vAlign.addListener(alignmentChangeListener);
- hAlign.addListener(alignmentChangeListener);
- vAlign.setValue(new Integer(Layout.AlignmentHandler.ALIGNMENT_TOP));
-
- controls.addComponent(new Label("layout alignment"));
- final NativeSelect lAlign = new NativeSelect();
- controls.addComponent(lAlign);
- lAlign.setNullSelectionAllowed(false);
- lAlign.addItem(new Integer(Layout.AlignmentHandler.ALIGNMENT_LEFT));
- lAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_LEFT), "left");
- lAlign.addItem(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER));
- lAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_HORIZONTAL_CENTER),
- "center");
- lAlign
- .addItem(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_RIGHT));
- lAlign.setItemCaption(new Integer(
- Layout.AlignmentHandler.ALIGNMENT_RIGHT), "right");
-
- lAlign.addListener(new Property.ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- testPanelLayout.setComponentAlignment(testedLayout,
- ((Integer) lAlign.getValue()).intValue(),
- OrderedLayout.ALIGNMENT_TOP);
- }
- });
- }
-
- private void updateAlignments(int h, int v) {
- for (Iterator i = testedLayout.getComponentIterator(); i.hasNext();) {
- ((Layout.AlignmentHandler) testedLayout).setComponentAlignment(
- (Component) i.next(), h, v);
- }
- }
-
- private void updateMarginsAndSpacing() {
- testedLayout.setMargin(((Boolean) marginTop.getValue())
- .booleanValue(), ((Boolean) marginRight.getValue())
- .booleanValue(), ((Boolean) marginBottom.getValue())
- .booleanValue(), ((Boolean) marginLeft.getValue())
- .booleanValue());
- if (testedLayout instanceof Layout.SpacingHandler) {
- ((Layout.SpacingHandler) testedLayout)
- .setSpacing(((Boolean) spacing.getValue())
- .booleanValue());
- }
- }
-
- public boolean getWidthPercents() {
- return testedLayout.getWidthUnits() == Sizeable.UNITS_PERCENTAGE;
- }
-
- public void setWidthPercents(boolean b) {
- testedLayout.setWidthUnits(b ? Sizeable.UNITS_PERCENTAGE
- : Sizeable.UNITS_PIXELS);
- }
-
- public boolean getHeightPercents() {
- return testedLayout.getHeightUnits() == Sizeable.UNITS_PERCENTAGE;
- }
-
- public void setHeightPercents(boolean b) {
- testedLayout.setHeightUnits(b ? Sizeable.UNITS_PERCENTAGE
- : Sizeable.UNITS_PIXELS);
- }
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1737.java b/src/com/vaadin/tests/tickets/Ticket1737.java deleted file mode 100644 index cc44e43c46..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1737.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.demo.Calc; -import com.vaadin.terminal.ClassResource; -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.Resource; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; - -public class Ticket1737 extends Application { - - Resource slowRes = new ClassResource(Calc.class, "m-bullet-blue.gif", this) { - @Override - public DownloadStream getStream() { - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return super.getStream(); - } - }; - - @Override - public void init() { - - final Window main = new Window(getClass().getName().substring( - getClass().getName().lastIndexOf(".") + 1)); - setMainWindow(main); - - ExpandLayout el = new ExpandLayout(); - main.setLayout(el); - - Panel p = new Panel("Test panel"); - p.setSizeFull(); - - p.addComponent(new Label( - "Second component is embedded with a slow resource " - + "and thus should break layout if Embedded cannot" - + " request re-layout after load.")); - - Embedded em = new Embedded("TestEmbedded", slowRes); - - el.addComponent(p); - el.addComponent(em); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1767.java b/src/com/vaadin/tests/tickets/Ticket1767.java deleted file mode 100644 index a65a601175..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1767.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Window;
-
-public class Ticket1767 extends com.vaadin.Application {
-
- @Override
- public void init() {
-
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- ComboBox cb = new ComboBox(" '<' item is not seen in populist?");
- cb.addItem("Te<strong>st</strong> < jep >");
- cb.addItem("<");
- cb.addItem(">");
-
- cb.addItem("< dsf");
- cb.addItem("> sdf");
-
- cb.addItem("dsfs <");
- cb.addItem("sdfsd >");
-
- main.addComponent(cb);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1772.java b/src/com/vaadin/tests/tickets/Ticket1772.java deleted file mode 100644 index 977d8563f0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1772.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1772 extends com.vaadin.Application {
-
- @Override
- public void init() {
-
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- Button b = new Button("Add content");
- main.addComponent(b);
-
- final GridLayout gridLayout = new GridLayout(2, 2);
- main.addComponent(gridLayout);
-
- b.addListener(new Button.ClickListener() {
- int counter = 0;
-
- public void buttonClick(ClickEvent event) {
-
- gridLayout
- .addComponent(new TextField("Content " + (++counter)));
-
- }
- });
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1775.java b/src/com/vaadin/tests/tickets/Ticket1775.java deleted file mode 100644 index cd66ecf0e5..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1775.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1775 extends com.vaadin.Application {
-
- @Override
- public void init() {
-
- final Window main = new Window("#1775");
- setMainWindow(main);
- main.setTheme("example");
- String layoutName = "mainLayout";
- final CustomLayout layout = new CustomLayout(layoutName);
-
- main.addComponent(layout);
-
- Button button2 = new Button("Populate content");
- main.addComponent(button2);
-
- final Button button = new Button("Change content");
- main.addComponent(button);
-
- button2.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Label mainComponent = new Label("Main");
- Label header = new Label("Header");
- final Label anotherComponent = new Label("another");
- layout.addComponent(mainComponent, "body");
- layout.addComponent(header, "loginUser");
- button.addListener(new Button.ClickListener() {
- public void buttonClick(Button.ClickEvent event) {
- layout.addComponent(anotherComponent, "body");
- layout.removeComponent("loginUser");
- }
- });
-
- }
- });
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1804.java b/src/com/vaadin/tests/tickets/Ticket1804.java deleted file mode 100644 index 5a0cc7e30b..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1804.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import com.vaadin.data.Validator;
-import com.vaadin.data.util.MethodProperty;
-import com.vaadin.terminal.Sizeable;
-import com.vaadin.terminal.SystemError;
-import com.vaadin.ui.AbstractField;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1804 extends com.vaadin.Application {
-
- LinkedList listOfAllFields = new LinkedList();
-
- @Override
- public void init() {
-
- final Window main = new Window("#1804");
- setMainWindow(main);
-
- com.vaadin.ui.Select s;
-
- s = new Select("Select with null selection allowed; required=true");
- s.setNullSelectionAllowed(true);
- s.setRequired(true);
- listOfAllFields.add(s);
-
- s = new Select("Select with null selection NOT allowed; required=true");
- s.setNullSelectionAllowed(false);
- s.setRequired(true);
- listOfAllFields.add(s);
-
- s = new Select("Testcase from the ticket #1804");
- s.setNullSelectionAllowed(false);
- s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));
- s.addValidator(new EmptyStringValidator(
- "Selection required for test-field"));
- s.setRequired(true);
- listOfAllFields.add(s);
-
- s = new Select("Testcase from the ticket #1804, but without validator");
- s.setNullSelectionAllowed(false);
- s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));
- s.setRequired(true);
- listOfAllFields.add(s);
-
- s = new Select(
- "Testcase from the ticket #1804, but with required=false");
- s.setNullSelectionAllowed(false);
- s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));
- s.addValidator(new EmptyStringValidator(
- "Selection required for test-field"));
- listOfAllFields.add(s);
-
- s = new Select(
- "Testcase from the ticket #1804, but without validator and with required=false");
- s.setNullSelectionAllowed(false);
- s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));
- listOfAllFields.add(s);
-
- s = new Select(
- "Required=true, custom error message, null selection not allowed");
- s.setRequired(true);
- s.setNullSelectionAllowed(false);
- s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));
- s.setValue(null);
- s.setComponentError(new SystemError("Test error message"));
- listOfAllFields.add(s);
-
- for (Iterator i = listOfAllFields.iterator(); i.hasNext();) {
- s = (Select) i.next();
- main.addComponent(s);
- s.addItem("foo");
- s.addItem("");
- s.addItem("bar");
- if (s.isNullSelectionAllowed()) {
- s.addItem("<null>");
- s.setNullSelectionItemId("<null>");
- }
- s.setImmediate(true);
- }
-
- Button checkValidity = new Button("Check validity of the fields");
- main.addComponent(checkValidity);
- checkValidity.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- StringBuffer msg = new StringBuffer();
- for (java.util.Iterator i = listOfAllFields.iterator(); i
- .hasNext();) {
- AbstractField af = (AbstractField) i.next();
- msg.append("<h1>" + af.getCaption() + "</h1>\n");
- msg.append("Value=" + af.getValue() + "<br/>\n");
- if (af.isValid()) {
- msg.append("VALID\n<hr/>");
- } else {
- msg.append("INVALID<br/><i>" + af.getErrorMessage()
- + "</i><hr/>");
- }
- }
- Window w = new Window("Status of the fields");
- w.setModal(true);
- w.setScrollable(true);
- w.setHeight(80);
- w.setHeightUnits(Sizeable.UNITS_PERCENTAGE);
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));
- main.addWindow(w);
- }
- });
- }
-
- public class TestPojo {
- String id = "";
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- }
-
- /** Throws an exception when the string is empty or null. */
- class EmptyStringValidator implements Validator {
-
- String msg;
-
- EmptyStringValidator(String msg) {
- this.msg = msg;
- }
-
- public boolean isValid(Object value) {
- return !(value == null || value.toString().length() == 0);
- }
-
- public void validate(Object value) throws InvalidValueException {
- if (!isValid(value)) {
- throw new InvalidValueException(msg);
- }
- }
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1805.java b/src/com/vaadin/tests/tickets/Ticket1805.java deleted file mode 100644 index ef80904854..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1805.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket1805 extends com.vaadin.Application {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
- main.getLayout().setMargin(false);
-
- Label description = new Label(
- "GridLayout with 100% (no height), is wanted to "
- + "share all available width with columns "
- + "relatively to their natural width. And it "
- + "should still work with margins and spacings");
- main.addComponent(description);
-
- final GridLayout grid = new GridLayout(4, 1);
-
- final TextField size = new TextField("Grid width in css unit");
- size.addListener(new ValueChangeListener() {
- public void valueChange(ValueChangeEvent event) {
- String width = size.getValue().toString();
- if (width == null || width.equals("")) {
- grid.setSizeUndefined();
- } else {
- grid.setWidth(width);
- }
- }
- });
- main.addComponent(size);
- main.addComponent(new Button("set size"));
-
- grid.setMargin(true);
- grid.setSpacing(true);
-
- grid.addComponent(new Label("WIDE"));
- grid.addComponent(new Label("_I_"));
- grid.addComponent(new Label("VEEEEEEEEEEERY_WIDE"));
- Label label = new Label("|");
- grid.addComponent(label);
- grid.setComponentAlignment(label, GridLayout.ALIGNMENT_RIGHT,
- GridLayout.ALIGNMENT_TOP);
- main.addComponent(grid);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1806.java b/src/com/vaadin/tests/tickets/Ticket1806.java deleted file mode 100644 index 1949fddfa1..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1806.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1806 extends com.vaadin.Application {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- final ObjectProperty prop = new ObjectProperty("");
- final TextField tf1 = new TextField(
- "Buffered TextField bound to ObjectProperty");
- tf1.setWriteThrough(false);
- tf1.setReadThrough(false);
- tf1.setPropertyDataSource(prop);
- main.addComponent(tf1);
- main
- .addComponent(new Button(
- "This button does nothing (but flushes queued variable changes)"));
- main.addComponent(new Button("Commit the field to property",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- tf1.commit();
- }
- }));
- main.addComponent(new Button("Show property value",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- main.showNotification("'" + prop.getValue() + "'");
- }
- }));
- main.addComponent(new Button("Show field value",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- main.showNotification("'" + tf1.getValue() + "'");
- }
- }));
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1811.java b/src/com/vaadin/tests/tickets/Ticket1811.java deleted file mode 100644 index 29571220a2..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1811.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import com.vaadin.data.Validator;
-import com.vaadin.data.validator.StringLengthValidator;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1811 extends com.vaadin.Application {
-
- LinkedList listOfAllFields = new LinkedList();
-
- @Override
- public void init() {
-
- final Window main = new Window("#1811");
- setMainWindow(main);
-
- Validator strLenValidator = new StringLengthValidator(
- "String must be at least 3 chars long and non-null", 3, -1,
- false);
-
- TextField tf1 = new TextField(
- "Text field with default settings (required=false)");
- listOfAllFields.add(tf1);
-
- TextField tf2 = new TextField("Text field with required=true");
- tf2.setRequired(true);
- listOfAllFields.add(tf2);
-
- TextField tf3 = new TextField(
- "Text field with required=true and strlen >= 3");
- tf3.setRequired(true);
- tf3.addValidator(strLenValidator);
- listOfAllFields.add(tf3);
-
- TextField tf4 = new TextField(
- "Text field with required=false (default) and strlen >= 3");
- tf4.addValidator(strLenValidator);
- listOfAllFields.add(tf4);
-
- for (Iterator i = listOfAllFields.iterator(); i.hasNext();) {
- TextField tf = (TextField) i.next();
- main.addComponent(tf);
- tf.setImmediate(true);
- }
-
- Button checkValidity = new Button("Check validity of the fields");
- main.addComponent(checkValidity);
- checkValidity.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- StringBuffer msg = new StringBuffer();
- for (java.util.Iterator i = listOfAllFields.iterator(); i
- .hasNext();) {
- TextField tf = (TextField) i.next();
- msg.append("<h1>" + tf.getCaption() + "</h1>\n");
- if (tf.isValid()) {
- msg.append("VALID\n<hr/>");
- } else {
- msg.append("INVALID<br/><i>" + tf.getErrorMessage()
- + "</i><hr/>");
- }
- }
- Window w = new Window("Status of the fields");
- w.setModal(true);
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));
- main.addWindow(w);
- }
- });
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1819.java b/src/com/vaadin/tests/tickets/Ticket1819.java deleted file mode 100644 index e014dfee29..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1819.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-
-import com.vaadin.ui.AbstractField;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1819 extends com.vaadin.Application {
-
- LinkedList listOfAllFields = new LinkedList();
-
- @Override
- public void init() {
-
- final Window main = new Window("#1819");
- setMainWindow(main);
-
- com.vaadin.ui.Select s;
-
- s = new Select("Select with null selection allowed");
- s.setNullSelectionAllowed(true);
- listOfAllFields.add(s);
-
- s = new Select("Select with null selection NOT allowed");
- s.setNullSelectionAllowed(false);
- listOfAllFields.add(s);
-
- for (Iterator i = listOfAllFields.iterator(); i.hasNext();) {
- s = (Select) i.next();
- main.addComponent(s);
- s.addItem("-null-");
- s.addItem("");
- s.addItem("foo");
- s.addItem("bar");
- s.setNullSelectionItemId("-null-");
- s.setImmediate(true);
- }
-
- Button checkValidity = new Button("Check validity of the fields");
- main.addComponent(checkValidity);
- checkValidity.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- StringBuffer msg = new StringBuffer();
- for (java.util.Iterator i = listOfAllFields.iterator(); i
- .hasNext();) {
- AbstractField af = (AbstractField) i.next();
- msg.append("<h1>" + af.getCaption() + "</h1>\n");
- msg.append("Value=" + af.getValue() + "<br/>\n");
- }
- Window w = new Window("Status of the fields");
- w.setModal(true);
- w.addComponent(new Label(msg.toString(), Label.CONTENT_XHTML));
- main.addWindow(w);
- }
- });
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java b/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java deleted file mode 100644 index 13e9591303..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1834PanelScrolling.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket1834PanelScrolling extends com.vaadin.Application {
-
- private static final int ROWS = 50;
-
- private Label state = new Label("State");
-
- private Panel p;
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- OrderedLayout currentState = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
-
- currentState.addComponent(state);
- Button b = new Button("update");
- currentState.addComponent(b);
- b.addListener(new ClickListener() {
- public void buttonClick(ClickEvent event) {
- state.setValue("ScrollTop: " + p.getScrollTop()
- + " ScrollLeft: " + p.getScrollLeft());
- }
- });
- main.addComponent(currentState);
-
- b = new Button("ScrollBy 50px");
- b.addListener(new ClickListener() {
- public void buttonClick(ClickEvent event) {
- p.setScrollLeft(p.getScrollLeft() + 50);
- p.setScrollTop(p.getScrollTop() + 50);
- state.setValue("ScrollTop: " + p.getScrollTop()
- + " ScrollLeft: " + p.getScrollLeft());
- }
- });
-
- main.addComponent(b);
-
- b = new Button("Add row");
- b.addListener(new ClickListener() {
- int i = 0;
-
- public void buttonClick(ClickEvent event) {
- p.addComponent(new Label("new Row" + ++i));
- }
- });
-
- main.addComponent(b);
-
- b = new Button("Repaint Panel");
- b.addListener(new ClickListener() {
- public void buttonClick(ClickEvent event) {
- p.requestRepaint();
- }
- });
-
- main.addComponent(b);
-
- p = new Panel("TestPanel");
- p.setScrollable(true);
-
- for (int i = 0; i < ROWS; i++) {
- p
- .addComponent(new Label(
- "Label"
- + i
- + "................................................................................................................."));
- }
-
- p.setHeight("300px");
- p.setWidth("250px");
-
- p.setScrollTop(100);
- p.setScrollLeft(100);
-
- main.addComponent(p);
-
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1857.java b/src/com/vaadin/tests/tickets/Ticket1857.java deleted file mode 100644 index 74278af70b..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1857.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.event.Action; -import com.vaadin.event.Action.Handler; -import com.vaadin.ui.Button; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket1857 extends Application implements Handler { - - @Override - public void init() { - - setTheme("tests-tickets"); - - ExpandLayout el = new ExpandLayout(); - Window main = new Window("Testcase for #1857", el); - setMainWindow(main); - el.setMargin(true); - el.setSpacing(true); - - final Table t = new Table(); - el.addComponent(t); - el.expand(t); - t.setSizeFull(); - addContentsToTable(t); - t.setStyleName("foo"); - - OrderedLayout footer = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - el.addComponent(footer); - footer.setSpacing(true); - - final Button actionHandlerEnabler = new Button("Action handlers", false); - footer.addComponent(actionHandlerEnabler); - actionHandlerEnabler.setImmediate(true); - actionHandlerEnabler.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - if (((Boolean) actionHandlerEnabler.getValue()).booleanValue()) { - t.addActionHandler(Ticket1857.this); - } else { - t.removeActionHandler(Ticket1857.this); - } - } - }); - - final Button cellStylesEnabler = new Button("Cell styles", false); - footer.addComponent(cellStylesEnabler); - cellStylesEnabler.setImmediate(true); - cellStylesEnabler.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - if (((Boolean) cellStylesEnabler.getValue()).booleanValue()) { - t.setCellStyleGenerator(new Table.CellStyleGenerator() { - public String getStyle(Object itemId, Object propertyId) { - Object cell = t.getContainerProperty(itemId, - propertyId).getValue(); - if (!(cell instanceof Integer)) { - return null; - } - int age = ((Integer) cell).intValue(); - return age > 65 ? "old" : (age < 18 ? "young" - : null); - } - }); - } else { - t.setCellStyleGenerator(null); - } - } - }); - cellStylesEnabler.setValue(Boolean.TRUE); - - } - - private void addContentsToTable(Table t) { - - t.addContainerProperty("First name", String.class, ""); - t.addContainerProperty("Last name", String.class, ""); - t.addContainerProperty("Age", Integer.class, ""); - - String firstNames[] = { "Quentin", "Marc", "Peter", "David", "Mary", - "Jani", "Jane", "Brita" }; - String lastNames[] = { "Heiskanen", "Bjorn", "Torwalds", "Autere", - "Smith", "Lindström" }; - - for (int i = 0; i < 1000; i++) { - t.addItem(new Object[] { - firstNames[((int) (Math.random() * firstNames.length))], - lastNames[((int) (Math.random() * lastNames.length))], - new Integer((int) (Math.random() * 100) + 10) }, - new Integer(i)); - } - } - - private final Action removeAction = new Action("Remove"); - - public Action[] getActions(Object target, Object sender) { - return new Action[] { removeAction }; - } - - public void handleAction(Action action, Object sender, Object target) { - getMainWindow().showNotification("Removing row number:" + target); - ((Table) sender).removeItem(target); - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1868.java b/src/com/vaadin/tests/tickets/Ticket1868.java deleted file mode 100644 index 3b68146df3..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1868.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-
-public class Ticket1868 extends com.vaadin.Application {
-
- @Override
- public void init() {
-
- setMainWindow(new Window("#1868"));
-
- Panel p = new Panel(
- "This is a really long caption for the panel, too long in fact!");
- p.setWidth(300);
- p.setHeight(300);
-
- getMainWindow().addComponent(p);
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1869.java b/src/com/vaadin/tests/tickets/Ticket1869.java deleted file mode 100644 index 6c101441a6..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1869.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.LinkedList;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-
-public class Ticket1869 extends com.vaadin.Application {
-
- LinkedList listOfAllFields = new LinkedList();
-
- @Override
- public void init() {
-
- GridLayout lo = new GridLayout(2, 1);
- setMainWindow(new Window("#1869", lo));
- lo.setMargin(true);
- lo.setSpacing(true);
-
- ExpandLayout el = new ExpandLayout();
- Panel elp = new Panel(
- "Vertical ExpandLayout /w first component expanded", el);
- el.setHeight(1000);
- for (int i = 0; i < 3; i++) {
- Button b = new Button("x");
- el.addComponent(b);
- if (i == 0) {
- b.setSizeFull();
- el.expand(b);
- }
- }
- lo.addComponent(elp);
- elp.setWidth(300);
- elp.setHeight(300);
- elp.setScrollable(true);
-
- ExpandLayout elh = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
- Panel elph = new Panel(
- "Horizontal ExpandLayout /w first component expanded", elh);
- elh.setWidth(1000);
- for (int i = 0; i < 3; i++) {
- Button b = new Button("x");
- elh.addComponent(b);
- if (i == 0) {
- b.setSizeFull();
- elh.expand(b);
- }
- }
- lo.addComponent(elph);
- elph.setWidth(300);
- elph.setHeight(300);
- elph.setScrollable(true);
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1878.java b/src/com/vaadin/tests/tickets/Ticket1878.java deleted file mode 100644 index 04f6efb78c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1878.java +++ /dev/null @@ -1,391 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Random;
-
-import com.vaadin.Application;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.validator.StringLengthValidator;
-import com.vaadin.terminal.Resource;
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.terminal.UserError;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Layout.AlignmentHandler;
-
-public class Ticket1878 extends Application {
-
- private Layout orderedLayout;
- private Layout gridLayout;
- private Layout formLayout;
- private GridLayout mainLayout;
- private Button switchToGridButton;
- private Button switchToOrderedButton;
- private Button switchToFormsButton;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
-
- mainLayout = new GridLayout(1, 2);
- w.setLayout(mainLayout);
- orderedLayout = createOL();
- gridLayout = createGL();
- formLayout = createForms();
-
- switchToGridButton = new Button("Switch to GridLayout",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- changeLayout(switchToGridButton, gridLayout);
- }
-
- });
- switchToOrderedButton = new Button("Switch to OrderedLayout",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- changeLayout(switchToOrderedButton, orderedLayout);
- }
-
- });
- switchToOrderedButton.setEnabled(false);
-
- switchToFormsButton = new Button("Switch to Form", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- changeLayout(switchToFormsButton, formLayout);
- }
-
- });
-
- OrderedLayout buttonLayout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- buttonLayout.addComponent(switchToOrderedButton);
- buttonLayout.addComponent(switchToGridButton);
- buttonLayout.addComponent(switchToFormsButton);
-
- mainLayout.addComponent(buttonLayout);
- mainLayout.addComponent(orderedLayout);
- // w.setLayout(orderedLayout);
- }
-
- private static Layout createOL() {
- GridLayout layout = new GridLayout(1, 5);
-
- GridLayout l1 = new GridLayout(1, 3);
- createLayout(l1,
- new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL),
- "1000px", "150px", "100%", null, true);
- createLayout(l1,
- new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL),
- "1000px", "150px", "50px", null, false);
- GridLayout l2 = new GridLayout(6, 1);
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),
- "200px", "500px", true);
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),
- "200px", "500px", "100%", null, true);
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),
- "150px", "500px", true);
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),
- "150px", "500px", "100%", null, true);
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),
- "100px", "500px", true);
- createLayout(l2, new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL),
- "100px", "500px", "100%", null, true);
- layout.addComponent(l1);
- layout.addComponent(l2);
-
- return layout;
- }
-
- private static Layout createGL() {
- GridLayout layout = new GridLayout(1, 5);
-
- GridLayout l1 = new GridLayout(1, 3);
- createLayout(l1, new GridLayout(8, 1), "1000px", "150px", "100%", null,
- true);
- createLayout(l1, new GridLayout(8, 1), "1000px", "150px", "50px", null,
- false);
- GridLayout l2 = new GridLayout(6, 1);
- createLayout(l2, new GridLayout(1, 8), "200px", "500px", true);
- createLayout(l2, new GridLayout(1, 8), "200px", "500px", "100%", null,
- true);
- createLayout(l2, new GridLayout(1, 8), "150px", "500px", true);
- createLayout(l2, new GridLayout(1, 8), "150px", "500px", "100%", null,
- true);
- createLayout(l2, new GridLayout(1, 8), "100px", "500px", true);
- createLayout(l2, new GridLayout(1, 8), "100px", "500px", "100%", null,
- true);
- layout.addComponent(l1);
- layout.addComponent(l2);
-
- return layout;
- }
-
- public class FormObject {
- private String stringValue = "abc";
- private int intValue = 1;
- private long longValue = 2L;
- private Date dateValue = new Date(34587034750L);
-
- public String getStringValue() {
- return stringValue;
- }
-
- public void setStringValue(String stringValue) {
- this.stringValue = stringValue;
- }
-
- public int getIntValue() {
- return intValue;
- }
-
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public long getLongValue() {
- return longValue;
- }
-
- public void setLongValue(long longValue) {
- this.longValue = longValue;
- }
-
- public Date getDateValue() {
- return dateValue;
- }
-
- public void setDateValue(Date dateValue) {
- this.dateValue = dateValue;
- }
-
- }
-
- private Layout createForms() {
- GridLayout layout = new GridLayout(1, 5);
- Form form;
-
- Random r = new Random();
- GridLayout l1 = new GridLayout(1, 3);
- form = createForm(l1, "200px", "500px");
- BeanItem item = new BeanItem(new FormObject());
- form.setItemDataSource(item);
- for (Iterator i = item.getItemPropertyIds().iterator(); i.hasNext();) {
- Object property = i.next();
- Field f = form.getField(property);
-
- f.setRequired(r.nextBoolean());
- if (r.nextBoolean()) {
- f.setIcon(new ThemeResource("icons/16/document-add.png"));
- }
- if (r.nextBoolean()) {
- f.setCaption(null);
- }
-
- f.addValidator(new StringLengthValidator("Error", 10, 8, false));
- }
- // createLayout(l1, new
- // ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL),
- // "1000px", "150px", "50px", null, false);
-
- // GridLayout l2 = new GridLayout(6, 1);
- // createLayout(l2, new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL),
- // "200px", "500px", true);
- // createLayout(l2, new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL),
- // "200px", "500px", "100%", null, true);
- // createLayout(l2, new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL),
- // "150px", "500px", true);
- // createLayout(l2, new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL),
- // "150px", "500px", "100%", null, true);
- // createLayout(l2, new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL),
- // "100px", "500px", true);
- // createLayout(l2, new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL),
- // "100px", "500px", "100%", null, true);
- layout.addComponent(l1);
- // layout.addComponent(l2);
-
- return layout;
- }
-
- private Form createForm(GridLayout parentLayout, String w, String h) {
- FormLayout formLayout = new FormLayout();
- Form form = new Form(formLayout);
-
- Panel p = new Panel("Form " + w + "x" + h);
-
- p.setWidth(w);
- p.setHeight(h);
-
- p.getLayout().setSizeFull();
-
- parentLayout.addComponent(p);
- p.addComponent(form);
- formLayout.setSizeFull();
-
- return form;
- }
-
- protected void changeLayout(Button b, Layout newLayout) {
- switchToOrderedButton.setEnabled(true);
- switchToGridButton.setEnabled(true);
- switchToFormsButton.setEnabled(true);
-
- b.setEnabled(false);
- java.util.Iterator i = mainLayout.getComponentIterator();
- i.next();
- Layout l = (Layout) i.next();
-
- mainLayout.replaceComponent(l, newLayout);
- }
-
- private static void createLayout(GridLayout parentLayout, Layout newLayout,
- String w, String h, boolean align) {
- createLayout(parentLayout, newLayout, w, h, null, null, align);
- }
-
- private static void createLayout(GridLayout parentLayout, Layout newLayout,
- String w, String h, String componentWidth, String componentHeight,
- boolean align) {
- int dir;
- String type;
- if (newLayout instanceof ExpandLayout) {
- dir = ((ExpandLayout) newLayout).getOrientation();
- type = "EL";
- } else if (newLayout instanceof OrderedLayout) {
- dir = ((OrderedLayout) newLayout).getOrientation();
- type = "OL";
- } else {
- dir = ((GridLayout) newLayout).getColumns() == 1 ? OrderedLayout.ORIENTATION_VERTICAL
- : OrderedLayout.ORIENTATION_HORIZONTAL;
- type = "GL";
- }
- String dirText = (dir == OrderedLayout.ORIENTATION_HORIZONTAL ? "H"
- : "V");
- String alignText = align ? "-A" : "";
- String cWidth = componentWidth == null ? "" : " - " + componentWidth;
- Panel p = new Panel(type + "/" + dirText + alignText + " " + w + "x"
- + h + cWidth, newLayout);
-
- p.setWidth(w);
- p.setHeight(h);
-
- newLayout.setSizeFull();
-
- String captions[] = new String[] { "TextField with caption", null };
- Resource icons[] = new Resource[] {
- new ThemeResource("icons/16/document-delete.png"), null };
- boolean required[] = new boolean[] { true, false };
- TextField fields[][] = new TextField[captions.length][icons.length];
- for (int caption = 0; caption < captions.length; caption++) {
- for (int icon = 0; icon < icons.length; icon++) {
- for (int req = 0; req < required.length; req++) {
- TextField tf = createTextFieldWithError(captions[caption],
- icons[icon], required[req]);
-
- fields[caption][icon] = tf;
- if (componentWidth != null) {
- tf.setWidth(componentWidth);
- tf.setValue(tf.getValue() + " w:" + componentWidth);
- }
-
- if (componentHeight != null) {
- tf.setHeight(componentWidth);
- tf.setValue(tf.getValue() + " h:" + componentHeight);
- }
-
- p.addComponent(tf);
-
- if (align) {
- ((AlignmentHandler) newLayout).setComponentAlignment(
- tf, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_BOTTOM);
- }
- }
- }
- }
-
- parentLayout.addComponent(p);
-
- }
-
- // private static void createGridLayout(GridLayout parentLayout, int dir,
- // String w, String h) {
- // createGridLayout(parentLayout, dir, w, h, null, null);
- // }
-
- // private static void createGridLayout(GridLayout parentLayout, int dir,
- // String w, String h, String componentWidth, String componentHeight) {
- // GridLayout gl;
- // if (dir == OrderedLayout.ORIENTATION_HORIZONTAL) {
- // gl = new GridLayout(8, 1);
- // } else {
- // gl = new GridLayout(1, 8);
- // }
- //
- // String dirText = (dir == OrderedLayout.ORIENTATION_HORIZONTAL ? "H"
- // : "V");
- // String cWidth = componentWidth == null ? "" : " - " + componentWidth;
- // Panel p = new Panel("GL/" + dirText + " " + w + "x" + h + cWidth, gl);
- //
- // p.setWidth(w);
- // p.setHeight(h);
- //
- // gl.setSizeFull();
- //
- // String captions[] = new String[] { "TextField with caption", null };
- // Resource icons[] = new Resource[] {
- // new ThemeResource("icons/16/document-delete.png"), null };
- // boolean required[] = new boolean[] { true, false };
- // TextField fields[][] = new TextField[captions.length][icons.length];
- // for (int caption = 0; caption < captions.length; caption++) {
- // for (int icon = 0; icon < icons.length; icon++) {
- // for (int req = 0; req < required.length; req++) {
- // TextField tf = createTextFieldWithError(captions[caption],
- // icons[icon], required[req]);
- //
- // fields[caption][icon] = tf;
- // if (componentWidth != null) {
- // tf.setWidth(componentWidth);
- // }
- //
- // if (componentHeight != null) {
- // tf.setHeight(componentWidth);
- // }
- //
- // p.addComponent(tf);
- // gl.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,
- // OrderedLayout.ALIGNMENT_BOTTOM);
- // }
- // }
- // }
- //
- // parentLayout.addComponent(p);
- //
- // }
-
- private static TextField createTextFieldWithError(String caption,
- Resource icon, boolean required) {
- TextField tf = new TextField();
- tf.setCaption(caption);
- tf.setIcon(icon);
- tf.setRequired(required);
- tf.setComponentError(new UserError("Test error message"));
- return tf;
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1900.java b/src/com/vaadin/tests/tickets/Ticket1900.java deleted file mode 100644 index a6f3c5c224..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1900.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Validator; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket1900 extends Application { - - TextField f[] = new TextField[5]; - Window main = new Window("#1900 test"); - - @Override - public void init() { - - setMainWindow(main); - - for (int i = 0; i < 5; i++) { - final int j = i; - f[i] = new TextField("Testcase " + i); - f[i].setImmediate(true); - f[i].setRequired(true); - main.addComponent(f[i]); - f[i].addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - main.showNotification("Validity test", "Testcase " + j - + " is " + (f[j].isValid() ? "valid" : "invalid")); - } - }); - f[i].addValidator(new ContainsValidator("1")); - f[i].addValidator(new ContainsValidator("2")); - - } - - f[0].setDescription("Field is empty, requiredError(null): *"); - - f[1] - .setDescription("Field is empty, requiredError(\"foo\"): * (popup shows the validation error)"); - f[1].setRequiredError("The field must not be empty"); - - f[2] - .setDescription("Field is non-empty, validators do not give validation error: *"); - f[2].setValue("valid 12"); - - f[3] - .setDescription("Field is non-empty, requiredError(null), validators " - + "give validation error: * ! (popup shows the validation error)"); - f[3].setValue("invalid"); - - f[4] - .setDescription("Field is non-empty, requiredError(\"foo\"), validators " - + "give validation error: * ! (popup shows the validation error)"); - f[4].setValue("invalid"); - f[4].setRequiredError("The field must not be empty"); - - } - - class ContainsValidator implements Validator { - private final String c; - - public ContainsValidator(String c) { - this.c = c; - } - - public boolean isValid(Object value) { - return value != null && value.toString().contains(c); - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException("Value does not contain " + c); - } - - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1902.java b/src/com/vaadin/tests/tickets/Ticket1902.java deleted file mode 100644 index 716b6b94f0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1902.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket1902 extends Application { - - @Override - public void init() { - - // Main layout and main window - final OrderedLayout mainLayout = new OrderedLayout(); - setMainWindow(new Window("Testcase for #1902", mainLayout)); - setTheme("tests-tickets"); - mainLayout.setMargin(false); - mainLayout.setSpacing(true); - mainLayout.addComponent(new Button("mainLayout.setSizeFull()", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - mainLayout.setSizeFull(); - getMainWindow().showNotification( - "Set the main layout size full"); - } - })); - mainLayout.addComponent(new Button("mainLayout.setWidth(\"100%\")", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - mainLayout.setWidth("100%"); - getMainWindow().showNotification( - "Set the main layout width 100%"); - } - })); - - // 100% wide component - TextField b2 = new TextField("100% wide field"); - mainLayout.addComponent(b2); - b2.setWidth("100%"); - - // 400px wide colored layout - OrderedLayout lo = new OrderedLayout(); - lo.setStyleName("red-background"); - mainLayout.addComponent(lo); - lo.setWidth(400); - - Button b = new Button("100% wide button"); - lo.addComponent(b); - b.setWidth("100%"); - - TextField tf = new TextField("100% wide textfield"); - lo.addComponent(tf); - tf.setWidth("100%"); - - // 400x100 colored layout - OrderedLayout lo2 = new OrderedLayout(); - lo2.setStyleName("red-background"); - mainLayout.addComponent(lo2); - lo2.setWidth("50%"); - lo2.setHeight(200); - - Button b3 = new Button("100% wide button"); - lo2.addComponent(b3); - b3.setWidth("100%"); - - TextField tf2 = new TextField("100% wide textfield"); - lo2.addComponent(tf2); - tf2.setWidth("100%"); - // tf2 = new TextField("50% wide, 100% height textfield"); // does not - // work with caption (10.7.2008 mac hosted mode) due layouts are broken - // in trunk - tf2 = new TextField(); - tf2.setRows(2); // trigger textArea impl. - tf2.setHeight("100%"); - tf2.setWidth("50%"); - lo2.addComponent(tf2); - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1904.java b/src/com/vaadin/tests/tickets/Ticket1904.java deleted file mode 100644 index 87ea8eeb1f..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1904.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket1904 extends Application { - - @Override - public void init() { - setMainWindow(new Window("#1904")); - setTheme("tests-tickets"); - - addOL("defaults", null, false); - addOL("l5,r10,t20,b40,vs20,hs40", "ticket1904", false); - addOL("l5,r10,t20,b40,vs20,hs40", "ticket1904", true); - } - - private void addOL(String descr, String style, boolean horizontal) { - OrderedLayout ol = new OrderedLayout(); - ol.setMargin(true); - ol.setSpacing(true); - if (style != null) { - ol.setStyleName(style); - } - ol.addComponent(new Label(descr)); - for (int i = 0; i < 3; i++) { - Button b = new Button("Row " + (i + 1)); - if (!horizontal) { - b.setWidth(500); - } - ol.addComponent(b); - } - if (horizontal) { - ol.setOrientation(OrderedLayout.ORIENTATION_HORIZONTAL); - } - getMainWindow().addComponent(ol); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1916.java b/src/com/vaadin/tests/tickets/Ticket1916.java deleted file mode 100644 index 9976393664..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1916.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket1916 extends Application { - - @Override - public void init() { - - OrderedLayout test = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - test.setSizeFull(); - - TextField tf = new TextField(); - tf.setComponentError(new UserError("Error message")); - - test.addComponent(tf); - test.setComponentAlignment(tf, - OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER, - OrderedLayout.ALIGNMENT_VERTICAL_CENTER); - - Window w = new Window("Test #1916", test); - setMainWindow(w); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1919.java b/src/com/vaadin/tests/tickets/Ticket1919.java deleted file mode 100644 index bf9b826b38..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1919.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-
-public class Ticket1919 extends com.vaadin.Application {
-
- private GridLayout lo;
- private boolean on = true;
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- main.setTheme("tests-tickets");
-
- lo = new GridLayout(2, 2);
- lo.setSizeFull();
- lo.setMargin(true);
- lo.setSpacing(true);
-
- lo.addComponent(getTestComponent());
- lo.addComponent(getTestComponent());
- lo.addComponent(getTestComponent());
- lo.addComponent(getTestComponent());
-
- main.setLayout(lo);
-
- }
-
- public void toggleStyleName() {
- if (on) {
- lo.setStyleName("test");
- } else {
- lo.setStyleName("");
- }
- on = !on;
- }
-
- private Component getTestComponent() {
- Panel p = new Panel();
- p.setSizeFull();
-
- Button b = new Button("toggle Values", this, "toggleStyleName");
- p.addComponent(b);
- return p;
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1921.java b/src/com/vaadin/tests/tickets/Ticket1921.java deleted file mode 100644 index 8dae844b75..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1921.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.Map; - -import com.vaadin.Application; -import com.vaadin.terminal.ParameterHandler; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket1921 extends Application implements ParameterHandler { - - int state = -1; - int round = 1; - Button button; - OrderedLayout outer, inner; - - @Override - public void init() { - - outer = new OrderedLayout(); - setMainWindow(new Window("#1921", outer)); - setTheme("tests-tickets"); - inner = new OrderedLayout(); - outer.addComponent(inner); - button = new Button("foo", this, "newState"); - inner.addComponent(button); - - outer.setStyleName("red"); - inner.setStyleName("blue"); - - newState(); - - getMainWindow().addParameterHandler(this); - } - - public void newState() { - - if (state >= 8) { - state = 0; - round++; - } else { - state++; - } - - button.setCaption("state " + round + "." + state); - - switch (state) { - - case 0: - outer.setMargin(true); - inner.setMargin(true); - inner.setSizeFull(); - outer.setSizeFull(); - button.setSizeFull(); - break; - - case 1: - button.setSizeUndefined(); - break; - - case 2: - inner.setMargin(false); - break; - - case 3: - outer.setMargin(false); - break; - - case 4: - inner.setMargin(true); - break; - - case 5: - inner.addComponent(new Label("Added at " + button.getCaption())); - break; - - case 6: - inner - .setOrientation(inner.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? OrderedLayout.ORIENTATION_VERTICAL - : OrderedLayout.ORIENTATION_HORIZONTAL); - getMainWindow() - .showNotification( - "inner swithed to " - + (inner.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? "horizontal" - : "vertical")); - break; - - case 7: - outer.addComponent(new Label("Added at " + button.getCaption())); - break; - - case 8: - outer - .setOrientation(outer.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? OrderedLayout.ORIENTATION_VERTICAL - : OrderedLayout.ORIENTATION_HORIZONTAL); - getMainWindow() - .showNotification( - "outer swithed to " - + (outer.getOrientation() == OrderedLayout.ORIENTATION_HORIZONTAL ? "horizontal" - : "vertical")); - break; - } - } - - public void handleParameters(Map parameters) { - String[] s = (String[]) parameters.get("state"); - if (s == null || s.length != 1) { - return; - } - String v[] = s[0].split("\\."); - if (v == null || v.length != 2) { - return; - } - try { - int rr = Integer.parseInt(v[0]); - int rs = Integer.parseInt(v[1]); - if (rr < round || (rr == round && rs < state)) { - getMainWindow().showNotification( - "Already past requested " + s[0]); - return; - } - while (round < rr || state < rs) { - newState(); - } - } catch (NumberFormatException ignored) { - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket1923.java b/src/com/vaadin/tests/tickets/Ticket1923.java deleted file mode 100644 index 8ed9273a06..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1923.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-
-public class Ticket1923 extends com.vaadin.Application {
-
- private static final int ROWS = 50;
-
- private Panel p;
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- p = new Panel("TestPanel 250x300");
- // p.getLayout().setWidth("100%");
- p.setScrollable(true);
- // p.setLayout(new GridLayout(1, 100));
- for (int i = 0; i < ROWS; i++) {
- p
- .addComponent(new Label(
- "Label"
- + i
- + " 5067w09adsfasdjfahlsdfjhalfjhaldjfhalsjdfhlajdhflajhdfljahdslfjahldsjfhaljdfhaljfdhlajsdhflajshdflkajhsdlfkjahsldfkjahsldfhalskjfdhlksjfdh857idifhaljsdfhlajsdhflajhdflajhdfljahldfjhaljdfhalsjdfhalkjdhflkajhdfljahsdlfjahlsdjfhaldjfhaljfdhlajdhflajshdfljahsdlfjhalsjdfhalskjhfdlhusfglksuhdflgjshflgjhslfghslfjghsljfglsjhfglsjhfgljshfgljshflgjhslfghsljfgsljdfglsdjhfglsjhflgkjshfldjgh"));
- }
- // main.getLayout().setSizeFull();
-
- p.setHeight("300px");
- p.setWidth("250px");
- // p.setWidth("50%");
-
- p.setScrollTop(100);
- p.setScrollLeft(100);
-
- main.addComponent(p);
-
- OrderedLayout ol = new OrderedLayout();
- p = new Panel("a");
- p.addComponent(new Label("Longer than caption"));
- ol.addComponent(p);
-
- main.addComponent(ol);
-
- ol = new OrderedLayout();
- p = new Panel("captionasdfjahsdjfh this should be clipped god damn it");
- // p.getLayout().setSizeFull();
- p.setWidth("50px");
- p.setHeight("100px");
- p
- .addComponent(new Label(
- "aasdfaasdfja dslkfj lakfdj lakjdf lkaj dflkaj ldfkj alsdfj laksdj flkajs dflkj sdfsadfasdfasd"));
- ol.addComponent(p);
-
- main.addComponent(ol);
-
- ol = new OrderedLayout();
- p = new Panel("300x-1");
- // p.getLayout().setSizeFull();
- p.setWidth("300px");
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- p.addComponent(new Label("Short"));
- ol.addComponent(p);
-
- main.addComponent(ol);
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1924ThemeChanging.java b/src/com/vaadin/tests/tickets/Ticket1924ThemeChanging.java deleted file mode 100644 index 4fb357b94e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1924ThemeChanging.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket1924ThemeChanging extends com.vaadin.Application {
-
- private Label l = new Label("Background should be red with test theme");
-
- @SuppressWarnings("unused")
- private Panel p;
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- l.setStyleName("red");
- main.addComponent(l);
-
- Button b = new Button("Toggle tests-tickets theme");
- b.addListener(new ClickListener() {
- boolean flag = false;
-
- public void buttonClick(ClickEvent event) {
- if (flag == !flag) {
- main.setTheme("tests-tickets");
- } else {
- main.setTheme(null);
- }
- }
- });
-
- main.addComponent(b);
-
- b = new Button("Modify caption (should not reload page)");
- b.addListener(new ClickListener() {
- public void buttonClick(ClickEvent event) {
- main.setCaption(main.getCaption() + ".");
- }
- });
-
- main.addComponent(b);
-
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1925.java b/src/com/vaadin/tests/tickets/Ticket1925.java deleted file mode 100644 index 83e5e1cfd4..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1925.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Window;
-
-public class Ticket1925 extends Application {
-
- @Override
- public void init() {
- Window mainWindow = new Window("Test åäö");
- setMainWindow(mainWindow);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1934.java b/src/com/vaadin/tests/tickets/Ticket1934.java deleted file mode 100644 index b80dfc07e0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1934.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class Ticket1934 extends Application { - - @Override - public void init() { - Window w = new Window( - "#1934 : Horizontal ExpandLayout completely broken"); - setMainWindow(w); - w.addComponent(new Label( - "Horizontal 500x200 ExpandLayout with two components:")); - - ExpandLayout testedLayout = new ExpandLayout( - ExpandLayout.ORIENTATION_HORIZONTAL); - testedLayout.setWidth("500px"); - testedLayout.setHeight("200px"); - - Button b1 = new Button("b1"); - testedLayout.addComponent(b1); - testedLayout.expand(b1); - testedLayout.addComponent(new Button("b2")); - - w.addComponent(testedLayout); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1939.java b/src/com/vaadin/tests/tickets/Ticket1939.java deleted file mode 100644 index 429834c382..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1939.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket1939 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getName()); - setMainWindow(w); - - final OrderedLayout l = new OrderedLayout(); - l.setWidth(400); - l.setHeight(100); - l.addComponent(new TextField("This one works fine")); - TextField t = new TextField(); - t.setRequired(true); - t.setValue("This one bugs"); - l.addComponent(t); - w.addComponent(l); - - w.addComponent(new Button("show me the bug", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - l.setWidth(-1); - } - })); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1940.java b/src/com/vaadin/tests/tickets/Ticket1940.java deleted file mode 100644 index 129a761e1c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1940.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket1940 extends Application { - - @Override - public void init() { - final Window w = new Window(getClass().getName()); - setMainWindow(w); - - final OrderedLayout l = new OrderedLayout(); - l.setWidth(200); - l.setHeight(-1); - TextField t = new TextField(); - l.addComponent(t); - t.setRequired(true); - w.addComponent(l); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1953.java b/src/com/vaadin/tests/tickets/Ticket1953.java deleted file mode 100644 index 43e7f10220..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1953.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class Ticket1953 extends Application { - public static final String cellStyle = "test-cell"; - public static final String colHeadStyle = "test-col-head"; - public static final String headingStyle = "test-heading"; - public static final String spacerStyle = "test-spacer"; - public static final String pageButtonStyle = "test-page-change"; - - @Override - public void init() { - - final Window main = new Window(getClass().getName().substring( - getClass().getName().lastIndexOf(".") + 1)); - setMainWindow(main); - - main.setTheme("tests-tickets"); - GridLayout gl = new GridLayout(5, 5); - - gl.setStyleName("borders"); - - gl.addComponent(new Label("0,0"), 0, 0); - gl.addComponent(new Label("0,1"), 0, 1); - gl.addComponent(new Label("0,2"), 0, 2); - gl.addComponent(new Label("0,3"), 0, 3); - gl.addComponent(new Label("0,4"), 0, 4); - gl.addComponent(new Label("1,0"), 1, 0); - gl.addComponent(new Label("2,0"), 2, 0); - gl.addComponent(new Label("3,0"), 3, 0); - gl.addComponent(new Label("4,0"), 4, 0); - - gl.addComponent(new Label("1,4"), 1, 4); - gl.addComponent(new Label("2,4"), 2, 4); - gl.addComponent(new Label("3,4"), 3, 4); - gl.addComponent(new Label("4,4"), 4, 4); - - gl.addComponent(new Label("1-1 -> 2-2"), 1, 1, 2, 2); - gl.addComponent(new Label("3,1"), 3, 1); - gl.addComponent(new Label("3,2"), 3, 2); - gl.addComponent(new Label("3,3"), 3, 3); - - main.addComponent(gl); - - // create grid - GridLayout grid = new GridLayout(7, 7); - - grid.setStyleName("borders"); - - // add upper row - Button up = new Button("UP"); - - up.setStyleName(pageButtonStyle); - grid.addComponent(up, 0, 0); - - Label space = new Label(); - space.setStyleName(spacerStyle); - grid.addComponent(space, 1, 0); - - Button single = null; - String headingStyle = "foo"; - for (int i = 1; i < grid.getColumns() - 2; i++) { - single = new Button(Integer.toString(i)); - single.setStyleName(headingStyle); - grid.addComponent(single, i + 1, 0); - } - - space = new Label(); - space.setStyleName(spacerStyle); - grid.addComponent(space, grid.getColumns() - 1, 0); - - // middle rows - char rowChar = 'A'; - for (int i = 1; i < grid.getRows() - 1; i++) { - space = new Label(Character.toString(rowChar++)); - space.setStyleName(colHeadStyle); - grid.addComponent(space, 0, i); - - space = new Label(); - space.setStyleName(spacerStyle); - grid.addComponent(space, 1, i); - - space = new Label(); - space.setStyleName(spacerStyle); - grid.addComponent(space, grid.getColumns() - 1, i); - } - - // bottom row - Button dn = new Button("DOWN"); - dn.setStyleName(pageButtonStyle); - grid.addComponent(dn, 0, grid.getRows() - 1); - - space = new Label(); - space.setStyleName(spacerStyle); - grid.addComponent(space, 1, grid.getRows() - 1); - - for (int i = 1; i < grid.getColumns() - 2; i++) { - single = new Button(Integer.toString(i)); - single.setStyleName(headingStyle); - grid.addComponent(single, i + 1, grid.getRows() - 1); - } - - space = new Label(); - space.setStyleName(spacerStyle); - grid.addComponent(space, grid.getColumns() - 1, grid.getRows() - 1); - - main.addComponent(grid); - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1966.java b/src/com/vaadin/tests/tickets/Ticket1966.java deleted file mode 100644 index d6c5accd4c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1966.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Layout.AlignmentHandler;
-
-public class Ticket1966 extends Application {
-
- private static final int LEFT = OrderedLayout.ALIGNMENT_LEFT;
- private static final int CENTER = OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER;
- private static final int RIGHT = OrderedLayout.ALIGNMENT_RIGHT;
- private static final int TOP = OrderedLayout.ALIGNMENT_TOP;
- private static final int VCENTER = OrderedLayout.ALIGNMENT_VERTICAL_CENTER;
- private static final int BOTTOM = OrderedLayout.ALIGNMENT_BOTTOM;
-
- private static Map names = new HashMap();
- static {
- names.put(new Integer(LEFT), "Left");
- names.put(new Integer(CENTER), "Center");
- names.put(new Integer(RIGHT), "Right");
- names.put(new Integer(BOTTOM), "Bottom");
- names.put(new Integer(VCENTER), "Vcenter");
- names.put(new Integer(TOP), "Top");
- }
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- w.setLayout(new GridLayout(2, 2));
- // w.getLayout().setSizeFull();
- createUI(w.getLayout());
- }
-
- private void createUI(Layout layout) {
- orderedLayout(layout);
- gridLayout(layout);
- }
-
- private void gridLayout(Layout layout) {
- Panel p = new Panel("GridLayout");
- layout.addComponent(p);
-
- GridLayout gl = new GridLayout(1, 4);
- gl.setCaption("Horizontal");
- Button b;
-
- b = new Button("Wide button");
- b.setWidth("500px");
- gl.addComponent(b);
-
- addButtons(gl);
-
- p.addComponent(gl);
-
- /* VERTICAL */
-
- gl = new GridLayout(4, 1);
- gl.setCaption("Vertical");
-
- addButtons(gl);
-
- b = new Button("High button");
- b.setHeight(200);
- gl.addComponent(b);
-
- p.addComponent(gl);
-
- }
-
- private void orderedLayout(Layout layout) {
- Panel p = new Panel("OrderedLayout");
- layout.addComponent(p);
-
- OrderedLayout ol = new OrderedLayout();
- ol.setCaption("Horizontal");
- // ol.setWidth("100%");
-
- Button b;
-
- b = new Button("Wide button");
- b.setWidth("500px");
- ol.addComponent(b);
-
- addButtons(ol);
- p.addComponent(ol);
-
- /* VERTICAL */
-
- ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- ol.setCaption("Vertical");
-
- addButtons(ol);
- b = new Button("High button");
- b.setHeight(200);
- ol.addComponent(b);
-
- p.addComponent(ol);
-
- }
-
- private void addButtons(Layout ol) {
- ol.addComponent(getButton(ol, LEFT, TOP));
- ol.addComponent(getButton(ol, CENTER, VCENTER));
- ol.addComponent(getButton(ol, RIGHT, BOTTOM));
-
- }
-
- private Button getButton(Layout l, int hAlign, int vAlign) {
- Button b = new Button("Narrow Button - "
- + names.get(new Integer(hAlign)) + " - "
- + names.get(new Integer(vAlign)));
- b.setWidth("100px");
- ((AlignmentHandler) l).setComponentAlignment(b, hAlign, vAlign);
-
- return b;
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1966_2.java b/src/com/vaadin/tests/tickets/Ticket1966_2.java deleted file mode 100644 index 862cb8ecd3..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1966_2.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Layout.AlignmentHandler;
-
-public class Ticket1966_2 extends Application {
-
- private static final int LEFT = OrderedLayout.ALIGNMENT_LEFT;
- private static final int CENTER = OrderedLayout.ALIGNMENT_HORIZONTAL_CENTER;
- private static final int RIGHT = OrderedLayout.ALIGNMENT_RIGHT;
- private static final int TOP = OrderedLayout.ALIGNMENT_TOP;
- private static final int VCENTER = OrderedLayout.ALIGNMENT_VERTICAL_CENTER;
- private static final int BOTTOM = OrderedLayout.ALIGNMENT_BOTTOM;
-
- private static Map names = new HashMap();
- static {
- names.put(new Integer(LEFT), "Left");
- names.put(new Integer(CENTER), "Center");
- names.put(new Integer(RIGHT), "Right");
- names.put(new Integer(BOTTOM), "Bottom");
- names.put(new Integer(VCENTER), "Vcenter");
- names.put(new Integer(TOP), "Top");
- }
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
- w.setLayout(new GridLayout(2, 2));
-
- // Panel p = new Panel("test");
- // p.setWidth(500);
- // p.setHeight(500);
- // p.setLayout(new GridLayout(1, 2));
- // p.getLayout().setSizeFull();
- //
- // p.addComponent(new Button("asjkdfhakshdf"));
- // p.addComponent(new Button("öalijgto8aq5"));
-
- // GridLayout gl = new GridLayout(4, 1);
- // // gl.setCaption("Vertical");
- // gl.setWidth("100%");
- // gl.setHeight(500);
-
- // addButtons(gl);
- // gl.addComponent(new Label("abc"));
- // p.addComponent(gl);
-
- // w.getLayout().addComponent(p);
- createUI(w.getLayout());
- }
-
- private void createUI(Layout layout) {
- orderedLayout(layout);
- gridLayout(layout);
- expandLayout(layout);
- }
-
- private void gridLayout(Layout layout) {
- Panel p = new Panel("GridLayout");
- p.setWidth(500);
- p.setHeight(500);
- p.getLayout().setSizeFull();
- layout.addComponent(p);
-
- GridLayout gl = new GridLayout(1, 4);
- gl.setCaption("Horizontal");
- gl.setWidth("100%");
-
- // Button b;
-
- // b = new Button("Wide button");
- // b.setWidth("500");
- // gl.addComponent(b);
-
- addButtons(gl);
-
- p.addComponent(gl);
-
- /* VERTICAL */
-
- gl = new GridLayout(4, 1);
- // gl.setCaption("Vertical");
- gl.setHeight("100%");
- addButtons(gl);
-
- // Button b = new Button("High button");
- // b.setHeight(200);
- // gl.addComponent(b);
-
- p.addComponent(gl);
-
- }
-
- private void orderedLayout(Layout layout) {
- Panel p = new Panel("OrderedLayout");
- p.setWidth(500);
- p.setHeight(500);
- p.getLayout().setWidth("100%");
- layout.addComponent(p);
-
- OrderedLayout ol = new OrderedLayout();
- // ol.setCaption("Horizontal");
- ol.setWidth("100%");
- addButtons(ol);
- p.addComponent(ol);
-
- /* VERTICAL */
-
- ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- // ol.setCaption("Vertical");
- ol.setHeight(200);
- addButtons(ol);
- // Button b = new Button("High button");
- // b.setHeight(200);
- // ol.addComponent(b);
- p.addComponent(ol);
-
- }
-
- private void expandLayout(Layout layout) {
- Panel p = new Panel("ExpandLayout");
- layout.addComponent(p);
- p.getLayout().setWidth("500");
- p.getLayout().setHeight("400");
-
- ExpandLayout el = new ExpandLayout(ExpandLayout.ORIENTATION_VERTICAL);
- // el.setCaption("Horizontal");
- // el.setSizeUndefined();
- // el.setWidth("100%");
- // ol.setWidth("100%");
- Button b;
-
- b = new Button("Wide button");
- b.setWidth("100%");
- // b.setHeight(200);
- // el.expand(b);
- // el.addComponent(b);
-
- addButtons(el);
- p.addComponent(el);
-
- /* VERTICAL */
-
- el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
- // el.setHeight(400);
- // el.setWidth("100%");
- // el.setCaption("Vertical");
-
- addButtons(el);
- // b = new Button("High button");
- // el.expand(b);
- // b.setHeight(100);
- // el.addComponent(b);
-
- p.addComponent(el);
-
- }
-
- private void addButtons(Layout ol) {
- ol.addComponent(getButton(ol, LEFT, TOP));
- ol.addComponent(getButton(ol, CENTER, VCENTER));
- ol.addComponent(getButton(ol, RIGHT, BOTTOM));
-
- }
-
- private Button getButton(Layout l, int hAlign, int vAlign) {
- Button b = new Button(names.get(new Integer(hAlign)) + " - "
- + names.get(new Integer(vAlign)));
- // b.setWidth("100");
- ((AlignmentHandler) l).setComponentAlignment(b, hAlign, vAlign);
-
- return b;
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1966_3.java b/src/com/vaadin/tests/tickets/Ticket1966_3.java deleted file mode 100644 index 6cd552b6b2..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1966_3.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.terminal.UserError;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket1966_3 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- OrderedLayout ol = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL);
- Panel p = new Panel(ol);
- p.setWidth("300px");
- p.setHeight("300px");
- p.getLayout().setSizeFull();
-
- TextField tf = new TextField("Long caption, longer than 100 pixels");
- tf.setWidth("100px");
-
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_TOP);
-
- tf = new TextField("Short caption");
- tf.setWidth("100px");
-
- tf.setComponentError(new UserError("error message"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_TOP);
-
- tf = new TextField("Short caption");
- tf.setComponentError(new UserError("error message"));
- tf.setIcon(new ThemeResource("icons/16/calendar.png"));
- tf.setWidth("100px");
-
- tf.setComponentError(new UserError("error message"));
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_TOP);
-
- tf = new TextField();
- tf.setValue("No caption");
- tf.setWidth("100px");
-
- ol.addComponent(tf);
- ol.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_RIGHT,
- OrderedLayout.ALIGNMENT_TOP);
-
- layout.addComponent(p);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1969.java b/src/com/vaadin/tests/tickets/Ticket1969.java deleted file mode 100644 index 5e183beb78..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1969.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.terminal.UserError;
-import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1969 extends com.vaadin.Application {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- main.getLayout().setSizeFull();
-
- TabSheet ts = new TabSheet();
- ts.setSizeFull();
-
- final Table t = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(7, 2000);
- t.setSizeFull();
- ts.addTab(t, "Table, scrollins should not flash", null);
-
- final Label testContent = new Label(
- "TabSheet by default uses caption, icon, errors etc. from Components. ");
-
- testContent.setCaption("Introduction to test");
-
- ts.addTab(testContent);
-
- final OrderedLayout actions = new OrderedLayout();
-
- actions.setCaption("Test actions");
-
- ts.addTab(actions);
-
- Button b;
-
- b = new Button(
- "change introduction caption (should add * to tab name)",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- testContent.setCaption(testContent.getCaption() + "*");
- }
- });
- actions.addComponent(b);
-
- b = new Button("change tab caption (should add * to tab name)",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- actions.setCaption(actions.getCaption() + "*");
- }
- });
-
- actions.addComponent(b);
-
- final UserError e = new UserError("Test error");
-
- b = new Button("Toggle error", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- if (testContent.getComponentError() == null) {
- testContent.setComponentError(e);
- } else {
- testContent.setComponentError(null);
- }
- }
- });
- actions.addComponent(b);
-
- b = new Button("Change table caption", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- t.setCaption(t.getCaption() + "*");
- }
- });
- actions.addComponent(b);
-
- b = new Button("Toggle Table error", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- if (t.getComponentError() == null) {
- t.setComponentError(e);
- } else {
- t.setComponentError(null);
- }
- }
- });
-
- actions.addComponent(b);
-
- for (int i = 0; i < 20; i++) {
- Label l = new Label("Test Content");
- l.setCaption("Extra tab " + i);
- ts.addComponent(l);
- }
-
- main.addComponent(ts);
-
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1970.java b/src/com/vaadin/tests/tickets/Ticket1970.java deleted file mode 100644 index b23a3f58d6..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1970.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.Iterator; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window.CloseEvent; - -public class Ticket1970 extends Application { - - @Override - public void init() { - setMainWindow(createWindow()); - } - - @Override - public Window getWindow(String name) { - - // If we already have the requested window, use it - Window w = super.getWindow(name); - if (w == null) { - - // If no window found, create it - w = createExtraWindow(name); - } - return w; - } - - private Window createExtraWindow(String name) { - final Window w = new Window("Extra window: " + name); - w.setName(name); - addWindow(w); - w.addComponent(new Label( - "This window has been created on fly for name: " + name)); - w.addComponent(new Button("Show open windows", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - String openWindows = ""; - for (Iterator i = getWindows().iterator(); i.hasNext();) { - Window t = (Window) i.next(); - openWindows += (openWindows.length() > 0 ? "," : "") - + t.getName(); - } - w.showNotification(openWindows); - } - })); - w.addListener(new Window.CloseListener() { - public void windowClose(CloseEvent e) { - removeWindow(w); - } - }); - - return w; - } - - private Window createWindow() { - final Window w = new Window(); - w.addComponent(new Button("Show the name of the application", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - w.showNotification("Name of this window = " - + w.getName()); - } - })); - w.addComponent(new Label("<a href='" + getURL().toExternalForm() + "'>" - + getURL().toExternalForm() + "</a>", Label.CONTENT_XHTML)); - w - .addComponent(new Label( - "<h2>How to reproduce</h2>Open the above link in another browser" - + " window and then press the Show-button on this window.", - Label.CONTENT_XHTML)); - - return w; - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket1972.java b/src/com/vaadin/tests/tickets/Ticket1972.java deleted file mode 100644 index 6cbbbb9f92..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1972.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-
-public class Ticket1972 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
- setTheme("tests-ticket");
- GridLayout layout = new GridLayout(3, 3);
- layout.setStyleName("borders");
- layout.addComponent(new Label("1-1"));
- layout.space();
- layout.space();
- layout.addComponent(new Label("2-1"));
- layout.space();
- layout.space();
- layout.addComponent(new Label("3-1"));
- layout.space();
- layout.addComponent(new Label("3-3"));
-
- w.setLayout(layout);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1973.java b/src/com/vaadin/tests/tickets/Ticket1973.java deleted file mode 100644 index 4e93ef57b4..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1973.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-
-public class Ticket1973 extends com.vaadin.Application {
-
- Window main = new Window();
- Table table = new Table();
-
- @Override
- public void init() {
- setMainWindow(main);
-
- final IndexedContainer container1 = new IndexedContainer();
- container1.addContainerProperty("layout", Component.class, null);
-
- final IndexedContainer container2 = new IndexedContainer();
- container2.addContainerProperty("layout", Component.class, null);
-
- fill(container1, 100, "Testi 1 :");
- fill(container2, 100, "Testi 2 :");
-
- table.setContainerDataSource(container1);
-
- Button refreshTable = new Button("Change table container");
- refreshTable.addListener(new Button.ClickListener() {
- public void buttonClick(Button.ClickEvent e) {
- table.setContainerDataSource(container2);
- table.setContainerDataSource(container1);
- }
- });
-
- main.addComponent(table);
- main.addComponent(refreshTable);
- }
-
- public void fill(IndexedContainer container, int size, String prefix) {
- for (int i = 0; i < size; i++) {
- Item item = container.addItem(new Integer(i));
- OrderedLayout layout = new OrderedLayout();
- layout.addComponent(new Button(prefix + i));
- item.getItemProperty("layout").setValue(layout);
- }
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1973_2.java b/src/com/vaadin/tests/tickets/Ticket1973_2.java deleted file mode 100644 index 875cc70bc6..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1973_2.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket1973_2 extends Application { - Window main = new Window(); - Table table = new Table(); - - @Override - public void init() { - setMainWindow(main); - - final IndexedContainer container1 = new IndexedContainer(); - container1.addContainerProperty("text", String.class, null); - container1.addContainerProperty("layout", Component.class, null); - - final IndexedContainer container2 = new IndexedContainer(); - container2.addContainerProperty("text", String.class, null); - container2.addContainerProperty("layout", Component.class, null); - - fill(container1, 100); - - table.setContainerDataSource(container1); - - Button refreshTable = new Button("Change table container"); - refreshTable.addListener(new Button.ClickListener() { - public void buttonClick(Button.ClickEvent e) { - table.setContainerDataSource(container2); - table.setContainerDataSource(container1); - } - }); - - main.addComponent(table); - main.addComponent(refreshTable); - } - - public void fill(IndexedContainer container, int size) { - for (int i = 0; i < size; i++) { - int randInt = i; - Item item = container.addItem(new Integer(i)); - OrderedLayout layout = new OrderedLayout(); - layout.setDebugId("lo" + i); - layout.addComponent(new Button("Test " + randInt)); - item.getItemProperty("layout").setValue(layout); - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket1975.java b/src/com/vaadin/tests/tickets/Ticket1975.java deleted file mode 100644 index 9adc67f529..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1975.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.gwt.server.WebApplicationContext;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CustomLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket1975 extends Application {
-
- private CustomLayout cl1;
- private CustomLayout cl2;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
- setTheme("tests-tickets");
- GridLayout layout = new GridLayout(1, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- String s = "<b>Blah</b><input type=\"text\" value='Lorem\" ipsum'/>";
- try {
- cl1 = new CustomLayout(new ByteArrayInputStream(s.getBytes()));
- layout.addComponent(cl1);
- WebApplicationContext wc = ((WebApplicationContext) getContext());
-
- layout.addComponent(new Button("Disable/Enable",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- boolean e = cl1.isEnabled();
-
- cl1.setEnabled(!e);
- cl2.setEnabled(!e);
- }
-
- }));
- File f = new File(wc.getBaseDirectory().getAbsoluteFile()
- + "/VAADIN/themes/" + getTheme()
- + "/layouts/Ticket1975.html");
-
- cl2 = new CustomLayout(new FileInputStream(f));
- layout.addComponent(cl2);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1982.java b/src/com/vaadin/tests/tickets/Ticket1982.java deleted file mode 100644 index a81478ff67..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1982.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.ArrayList; -import java.util.List; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket1982 extends Application { - - private List components = new ArrayList(); - - @Override - public void init() { - Window main = new Window(); - setMainWindow(main); - - GridLayout gl = new GridLayout(2, 2); - gl.setSizeFull(); - main.setLayout(gl); - gl.setMargin(true); - - TitleBar t1 = new TitleBar("Title 1", gl); - TitleBar t2 = new TitleBar("Title 2", gl); - TitleBar t3 = new TitleBar("Title 3", gl); - TitleBar t4 = new TitleBar("Title 4", gl); - components.add(t1); - components.add(t2); - components.add(t3); - components.add(t4); - - restoreComponents(gl); - - } - - private void restoreComponents(GridLayout gl) { - gl.removeAllComponents(); - gl.addComponent((TitleBar) components.get(0)); - gl.addComponent((TitleBar) components.get(1)); - gl.addComponent((TitleBar) components.get(2)); - gl.addComponent((TitleBar) components.get(3)); - } - - private class TitleBar extends ExpandLayout { - - private Button max = new Button("Max"); - private Button min = new Button("Min"); - private GridLayout layout; - - public TitleBar(String title, GridLayout layout) { - super(ExpandLayout.ORIENTATION_HORIZONTAL); - this.layout = layout; - addComponent(new Label(title)); - addComponent(max); - addComponent(min); - min.setVisible(false); - - max.addListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - min.setVisible(true); - max.setVisible(false); - TitleBar.this.layout.removeAllComponents(); - TitleBar.this.layout - .addComponent(TitleBar.this, 0, 0, 1, 1); - } - }); - min.addListener(new ClickListener() { - public void buttonClick(ClickEvent event) { - min.setVisible(false); - max.setVisible(true); - restoreComponents(TitleBar.this.layout); - } - }); - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket1983.java b/src/com/vaadin/tests/tickets/Ticket1983.java deleted file mode 100644 index b02047aca2..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1983.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.terminal.Sizeable; -import com.vaadin.ui.Button; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -/** - * Test class for ticket 1983 - */ -public class Ticket1983 extends Application { - - @Override - public void init() { - Window main = new Window("Test for ticket 1983"); - main.setLayout(new TestLayout()); - setMainWindow(main); - } - - private static class TestLayout extends SplitPanel { - boolean isLong = true; - final Table table = new MyTable(); - final String propId = "col"; - final String propId2 = "col2"; - - public TestLayout() { - super(ORIENTATION_HORIZONTAL); - - setSplitPosition(200, Sizeable.UNITS_PIXELS); - setMargin(false); - setLocked(true); - - final SplitPanel leftSide = initLeftSide(); - setFirstComponent(leftSide); - - final Layout rightSide = new OrderedLayout(); - rightSide.setHeight("100%"); - setSecondComponent(rightSide); - } - - private SplitPanel initLeftSide() { - final SplitPanel leftSide = new SplitPanel(ORIENTATION_VERTICAL); - leftSide.setHeight("100%"); - - final IndexedContainer dataSource = new IndexedContainer(); - dataSource.addContainerProperty(propId, String.class, null); - dataSource.addContainerProperty(propId2, String.class, null); - final Object itemId = dataSource.addItem(); - dataSource.getItem(itemId).getItemProperty(propId).setValue( - "Very long value that makes a scrollbar appear for sure"); - dataSource.getItem(itemId).getItemProperty(propId2).setValue( - "Very long value that makes a scrollbar appear for sure"); - - for (int i = 0; i < 150; i++) { - Object id = dataSource.addItem(); - dataSource - .getItem(id) - .getItemProperty(propId) - .setValue( - (i == 100 ? "Very long value that makes a scrollbar appear for sure" - : "Short")); - dataSource.getItem(id).getItemProperty(propId2).setValue( - "Short"); - } - - table.setSizeFull(); - table.setContainerDataSource(dataSource); - table.setVisibleColumns(new Object[] { propId }); - - leftSide.setSecondComponent(table); - - Button button = new Button("Change col value to short"); - button.addListener(new Button.ClickListener() { - public void buttonClick(Button.ClickEvent event) { - // Change the column value to a short one --> Should remove - // the scrollbar - if (isLong) { - dataSource.getItem(itemId).getItemProperty(propId) - .setValue("Short value"); - dataSource.getItem(itemId).getItemProperty(propId2) - .setValue("Short value"); - isLong = false; - } else { - dataSource - .getItem(itemId) - .getItemProperty(propId) - .setValue( - "Very long value that makes a scrollbar appear for sure"); - dataSource - .getItem(itemId) - .getItemProperty(propId2) - .setValue( - "Very long value that makes a scrollbar appear for sure"); - isLong = true; - } - // Works the same way with or without repaint request - table.requestRepaint(); - } - }); - - OrderedLayout ol = new OrderedLayout(); - ol.addComponent(button); - leftSide.setFirstComponent(ol); - - button = new Button("Two col"); - button.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - if (((Boolean) b.getValue()).booleanValue()) { - table - .setVisibleColumns(new Object[] { propId, - propId2 }); - } else { - table.setVisibleColumns(new Object[] { propId }); - } - - } - - }); - button.setSwitchMode(true); - ol.addComponent(button); - - return leftSide; - } - } - - static class MyTable extends Table { - MyTable() { - alwaysRecalculateColumnWidths = true; - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket1986.java b/src/com/vaadin/tests/tickets/Ticket1986.java deleted file mode 100644 index 1b96f7bd39..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1986.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.ListSelect;
-import com.vaadin.ui.NativeSelect;
-import com.vaadin.ui.OptionGroup;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.TwinColSelect;
-import com.vaadin.ui.Window;
-
-public class Ticket1986 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
-
- int index = 1;
-
- GridLayout layout = new GridLayout(2, 2);
- TextField f1 = new TextField("1");
- f1.setTabIndex(index++);
- TextField f2 = new TextField("2");
- f2.setTabIndex(index++);
-
- DateField f3 = new DateField("3");
- f3.setTabIndex(index++);
- ComboBox cb = new ComboBox("4");
- cb.setTabIndex(index++);
-
- ListSelect lss = new ListSelect("5");
- lss.addItem("foo");
- lss.addItem("Bar");
- lss.setTabIndex(index++);
-
- NativeSelect ns = new NativeSelect("6");
- ns.addItem("foo");
- ns.addItem("bar");
- ns.setTabIndex(index++);
-
- OptionGroup og = new OptionGroup("7");
- og.addItem("foo");
- og.addItem("bar");
- og.setTabIndex(index++);
-
- OptionGroup ogm = new OptionGroup("7");
- ogm.setMultiSelect(true);
- ogm.addItem("foo");
- ogm.addItem("bar");
- ogm.setTabIndex(index++);
-
- TwinColSelect ts = new TwinColSelect("8");
- ts.addItem("Foo");
- ts.addItem("Bar");
- ts.setTabIndex(index++);
-
- Button b = new Button("9");
- b.setTabIndex(index++);
-
- layout.addComponent(b);
- layout.addComponent(ts);
- layout.addComponent(ogm);
- layout.addComponent(og);
- layout.addComponent(ns);
- layout.addComponent(lss);
- layout.addComponent(cb);
- layout.addComponent(f3);
- layout.addComponent(f2);
- layout.addComponent(f1);
-
- w.setLayout(layout);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket1991.java b/src/com/vaadin/tests/tickets/Ticket1991.java deleted file mode 100644 index 430c54ec92..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1991.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-
-public class Ticket1991 extends com.vaadin.Application {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- Table t = new Table("Test table");
-
- t.addContainerProperty(" ", CheckBox.class, "");
- t.addContainerProperty("Col1", String.class, "");
- t.addContainerProperty("Col2", String.class, "");
-
- t.setPageLength(5);
-
- t.addItem(new Object[] { new CheckBox(), "Foo", "Bar" }, "1");
- t.addItem(new Object[] { new CheckBox(), "Foo", "Bar" }, "2");
-
- main.addComponent(t);
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket1995.java b/src/com/vaadin/tests/tickets/Ticket1995.java deleted file mode 100644 index 1745ace18c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket1995.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.data.Container;
-import com.vaadin.data.Item;
-import com.vaadin.data.Container.Filterable;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket1995 extends Application {
-
- private static final Object PROPERTY_1 = "Test";
- private Table table;
-
- @Override
- public void init() {
- final Window mainWin = new Window(getClass().getName());
- setMainWindow(mainWin);
-
- table = new Table();
- table.addContainerProperty(PROPERTY_1, String.class, "");
- table.setPageLength(4);
-
- Item item = table.addItem("1");
- item.getItemProperty(PROPERTY_1).setValue("Row 1");
- item = table.addItem("2");
- item.getItemProperty(PROPERTY_1).setValue("Row 2");
-
- Filterable filterable = (Container.Filterable) table
- .getContainerDataSource();
- filterable.addContainerFilter(PROPERTY_1, "Row", true, false);
-
- table.setColumnHeader(PROPERTY_1, "Test (filter: Row)");
-
- mainWin.addComponent(table);
- mainWin.addComponent(new Button("Add item",
- new com.vaadin.ui.Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- addItem();
- }
- }));
- }
-
- protected void addItem() {
- Filterable filterable = (Container.Filterable) table
- .getContainerDataSource();
-
- Item i = table.addItem("abc");
- String res = "";
- if (i == null) {
- res = "FAILED";
- } else {
- res = "OK!";
- }
-
- getMainWindow().showNotification("Tried to add item 'abc', " + res);
-
- filterable.addContainerFilter(PROPERTY_1, "Row", true, false);
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket20.java b/src/com/vaadin/tests/tickets/Ticket20.java deleted file mode 100644 index 7adb2e932e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket20.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Validator; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.data.validator.CompositeValidator; -import com.vaadin.ui.Button; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket20 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window("Test app for #20"); - setMainWindow(mainWin); - - final TextField tx = new TextField("Integer"); - mainWin.addComponent(tx); - tx.setImmediate(true); - CompositeValidator v = new CompositeValidator(); - v.addValidator(new Validator() { - - public boolean isValid(Object value) { - try { - Integer.parseInt("" + value); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException(value + " is not a number"); - } - } - }); - v.addValidator(new Validator() { - - public boolean isValid(Object value) { - try { - int i = Integer.parseInt("" + value); - if (i < 0) { - return false; - } - return true; - } catch (NumberFormatException e) { - return false; - } - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException(value - + " is not a non-negative number"); - } - } - }); - CompositeValidator v2 = new CompositeValidator( - CompositeValidator.MODE_OR, null); - v2.addValidator(v); - v2.addValidator(new Validator() { - - public boolean isValid(Object value) { - return "".equals("" + value); - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException("Value is not empty string"); - } - } - }); - tx.addValidator(v2); - - final String[] visibleProps = { "required", "invalidAllowed", - "readOnly", "readThrough", "invalidCommitted", - "validationVisible" }; - for (int i = 0; i < visibleProps.length; i++) { - Button b = new Button(visibleProps[i], new MethodProperty(tx, - visibleProps[i])); - b.setImmediate(true); - mainWin.addComponent(b); - } - - mainWin.addComponent(new Button("Validate integer", - new Button.ClickListener() { - public void buttonClick( - com.vaadin.ui.Button.ClickEvent event) { - mainWin.showNotification("The field is " - + (tx.isValid() ? "" : "not ") + "valid"); - }; - })); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2001.java b/src/com/vaadin/tests/tickets/Ticket2001.java deleted file mode 100644 index f3fbb4c508..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2001.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket2001 extends Application { - - @Override - public void init() { - final Window w = new Window(getClass().getName()); - setMainWindow(w); - - final OrderedLayout l = new OrderedLayout(); - l.addComponent(new Label("row 1")); - l.addComponent(new Label("row 2")); - w.addComponent(l); - - final Button b = new Button("fixed width: 30px", false); - b.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - l.setWidth(b.booleanValue() ? 30 : -1); - } - }); - b.setImmediate(true); - w.addComponent(b); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2002.java b/src/com/vaadin/tests/tickets/Ticket2002.java deleted file mode 100644 index 35f2c84872..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2002.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.data.util.MethodProperty;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2002 extends Application {
- private Long long1 = new Long(1L);
- private Long long2 = new Long(2L);
-
- public Long getLong1() {
- return long1;
- }
-
- public void setLong1(Long long1) {
- this.long1 = long1;
- }
-
- public Long getLong2() {
- return long2;
- }
-
- public void setLong2(Long long2) {
- this.long2 = long2;
- }
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
-
- GridLayout layout = new GridLayout(2, 2);
- layout.setSpacing(true);
-
- TextField f1 = new TextField("Non-immediate/Long text field",
- new MethodProperty(this, "long1"));
- f1.setImmediate(false);
- f1.setNullSettingAllowed(true);
- TextField f2 = new TextField("Immediate/Long text field",
- new MethodProperty(this, "long2"));
- f2.setImmediate(true);
- f2.setNullSettingAllowed(true);
-
- layout.addComponent(f1);
- layout.addComponent(f2);
-
- w.setLayout(layout);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2007.java b/src/com/vaadin/tests/tickets/Ticket2007.java deleted file mode 100644 index e925519ee2..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2007.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2007 extends Application { - - int childs = 0; - - @Override - public void init() { - - final Window main = new Window("Main window for #2007"); - setMainWindow(main); - main.addComponent(new Button("Open another (non-main) window", - new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - Window c = new Window("Non-main browser window " - + (++childs)); - addWindow(c); - main.open(new ExternalResource(c.getURL()), "_new"); - } - })); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2009.java b/src/com/vaadin/tests/tickets/Ticket2009.java deleted file mode 100644 index 4118794aa7..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2009.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.Container;
-import com.vaadin.event.ItemClickEvent;
-import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Tree;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket2009 extends com.vaadin.Application {
-
- TextField f = new TextField();
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- OrderedLayout ol = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- main.setLayout(ol);
- ol.setSizeFull();
-
- Panel p = new Panel("Tree test");
- p.setSizeFull();
-
- Tree t = new Tree();
-
- t.addItem("Foo");
- t.addItem("Bar");
-
- final OrderedLayout events = new OrderedLayout();
-
- t.addListener(new ItemClickEvent.ItemClickListener() {
- public void itemClick(ItemClickEvent event) {
- events.addComponent(new Label(new Label("Click:"
- + (event.isDoubleClick() ? "double" : "single")
- + " button:" + event.getButton() + " propertyId:"
- + event.getPropertyId() + " itemID:"
- + event.getItemId() + " item:" + event.getItem())));
-
- }
- });
-
- main.addComponent(p);
- p.addComponent(t);
- p.addComponent(events);
-
- Panel p2 = new Panel("Table test (try dbl click also)");
- p2.setSizeFull();
-
- final OrderedLayout events2 = new OrderedLayout();
- Table table = TestForTablesInitialColumnWidthLogicRendering
- .getTestTable(5, 100);
- table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
- table.addListener(new ItemClickEvent.ItemClickListener() {
- public void itemClick(ItemClickEvent event) {
- events2.addComponent(new Label("Click:"
- + (event.isDoubleClick() ? "double" : "single")
- + " button:" + event.getButton() + " propertyId:"
- + event.getPropertyId() + " itemID:"
- + event.getItemId() + " item:" + event.getItem()));
- if (event.isDoubleClick()) {
- new PropertyEditor(event);
- }
-
- }
- });
- p2.addComponent(table);
- p2.addComponent(events2);
-
- main.addComponent(p2);
-
- }
-
- class PropertyEditor extends Window {
-
- private static final int W = 300;
- private static final int H = 150;
-
- private Container c;
- private Object itemid;
- private Object propertyid;
-
- TextField editor = new TextField();
- Button done = new Button("Done");
-
- PropertyEditor(ItemClickEvent event) {
- c = (Container) event.getSource();
-
- propertyid = event.getPropertyId();
- itemid = event.getItemId();
-
- setCaption("Editing " + itemid + " : " + propertyid);
-
- editor.setPropertyDataSource(c.getContainerProperty(itemid,
- propertyid));
- addComponent(editor);
- addComponent(done);
-
- setWidth(W);
- setHeight(H);
-
- setPositionX(event.getClientX() - W / 2);
- setPositionY(event.getClientY() - H / 2);
-
- getMainWindow().addWindow(this);
-
- done.addListener(new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- getMainWindow().removeWindow(PropertyEditor.this);
- }
- });
-
- }
-
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2011.java b/src/com/vaadin/tests/tickets/Ticket2011.java deleted file mode 100644 index d4e5890635..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2011.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Select;
-import com.vaadin.ui.Window;
-
-public class Ticket2011 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
- // setTheme("tests-ticket");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- Select s = new Select("Select");
- s.addItem("Item 1");
- s.addItem("Item 2");
- layout.addComponent(s);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2014.java b/src/com/vaadin/tests/tickets/Ticket2014.java deleted file mode 100644 index 1cf0e4c58e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2014.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.UUID;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2014 extends Application {
-
- private OrderedLayout innerLayout1;
- private Button b1;
- private Panel panel;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getName());
- setMainWindow(w);
- // setTheme("tests-ticket");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- createPanel(layout);
-
- layout.addComponent(new Button("Change class name",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- b1.setStyleName(UUID.randomUUID().toString());
- }
-
- }));
-
- }
-
- private void createPanel(GridLayout layout) {
- panel = new Panel("panel caption");
- layout.addComponent(panel);
-
- innerLayout1 = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
- innerLayout1.setSpacing(true);
- panel.addComponent(innerLayout1);
-
- b1 = new Button("Button inside orderedLayout", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- System.out.println("Clicked " + event.getButton().getCaption());
- }
-
- });
-
- innerLayout1.addComponent(b1);
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2021.java b/src/com/vaadin/tests/tickets/Ticket2021.java deleted file mode 100644 index 5ea423ea99..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2021.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.AbstractComponent;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2021 extends Application {
-
- private TextField tf1, tf2, tf3;
-
- private String contents = "This TextField SHOULD FILL the panel and NOT CAUSE any scrollbars to appear in the Panel. Scrollbars SHOULD appear in the TextField AND the whole scrollbars (includinc arrow down) SHOULD be visible.\n\n"
- + ""
- + "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent quis justo. Vivamus nec mi eu libero convallis auctor. Mauris et arcu. Nunc luctus justo. Aenean convallis, odio in vehicula scelerisque, est magna condimentum pede, a aliquam elit eros vitae diam. Phasellus porttitor convallis tellus. Nullam elementum, ligula nec viverra malesuada, risus tortor bibendum dui, eget hendrerit sem enim at massa. Nam eu pede sed nulla congue fermentum. Vestibulum malesuada libero non nunc. Proin rutrum. Fusce erat pede, volutpat vitae, aliquam ut, sagittis vel, augue. Fusce dui pede, convallis nec, accumsan tincidunt, consectetuer ac, purus. Nulla facilisi. Ut nisi. Sed orci risus, lacinia eu, sodales molestie, gravida quis, neque. Vestibulum pharetra ornare elit. Nulla porttitor molestie mauris. Morbi fringilla tellus sed risus. Curabitur varius massa."
- + "Nulla nisi. Sed blandit, ante vitae sagittis volutpat, arcu mauris vehicula risus, vitae posuere felis lectus sit amet purus. Donec nec magna et leo eleifend scelerisque. Suspendisse condimentum pharetra ligula. Curabitur lorem. Pellentesque a augue sit amet enim fermentum placerat. Phasellus ante risus, molestie at, iaculis at, pellentesque non, tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus non urna eget risus tempus imperdiet. Integer est diam, sagittis sit amet, posuere sit amet, bibendum sed, lacus. Aenean adipiscing cursus ipsum. Quisque at elit. Vestibulum vitae nunc. Praesent placerat metus viverra lorem. Cras nec elit congue nisi faucibus feugiat. Nam eget mi. Vestibulum condimentum. Nunc nisl ante, cursus in, dictum ac, lobortis rutrum, mi. Nulla eu nisi. In ultricies vehicula magna."
- + "Nunc eros dui, elementum at, ullamcorper eget, varius at, velit. Ut dictum. Cras ullamcorper ante vel tortor. Quisque viverra mauris vulputate quam. Nulla dui. Suspendisse non eros at ipsum faucibus hendrerit. Morbi dignissim pharetra tortor. Etiam malesuada. Mauris lacinia elementum erat. Duis mollis placerat metus. Nunc risus felis, cursus ac, cursus vel, convallis vel, metus. Ut vehicula nibh et nulla. Vivamus id pede. Quisque egestas arcu a ligula. Maecenas vehicula. Quisque sed ligula quis tellus tempus rutrum. Curabitur vel augue sed orci egestas pharetra. Duis pharetra.";
-
- private OrderedLayout orderedLayout;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- w.setLayout(new GridLayout(2, 2));
- setMainWindow(w);
-
- Panel p = new Panel();
- p.setCaption("ExpandLayout");
- p.setWidth("500px");
- p.setHeight("500px");
- p.setLayout(new ExpandLayout());
- p.getLayout().setSizeFull();
-
- w.getLayout().addComponent(p);
-
- tf1 = new TextField();
- tf1.setRows(5);
- tf1.setSizeFull();
- tf1.setValue(contents);
- tf1.setCaption("TextField caption");
- p.getLayout().addComponent(tf1);
-
- /*
- *
- * OrderedLayout
- */
-
- Panel p2 = new Panel();
- p2.setCaption("OrderedLayout");
- p2.setWidth("500px");
- p2.setHeight("500px");
- p2.setLayout(new OrderedLayout());
- p2.getLayout().setSizeFull();
-
- w.getLayout().addComponent(p2);
-
- tf2 = new TextField();
- tf2.setRows(5);
- tf2.setSizeFull();
- tf2.setValue(contents);
- tf2.setCaption("TextField caption");
- p2.getLayout().addComponent(tf2);
-
- /*
- *
- * GridLayout
- */
-
- Panel p3 = new Panel();
- p3.setCaption("GridLayout");
- p3.setWidth(500);
- p3.setHeight(500);
- // p3.setLayout(new GridLayout());
- p3.getLayout().setSizeFull();
- p3.getLayout().setMargin(false);
-
- GridLayout gl = new GridLayout();
- gl.setSizeFull();
- gl.setMargin(false);
- p3.getLayout().addComponent(gl);
- w.getLayout().addComponent(p3);
-
- tf3 = new TextField();
- tf3.setRows(5);
- tf3.setSizeFull();
- tf3.setValue(contents);
- tf3.setCaption("TextField caption");
- // p3.getLayout().addComponent(tf3);
- gl.addComponent(tf3);
-
- // Panel pp = new Panel();
- // pp.setCaption("OrderedLayout");
- // pp.setWidth("500px");
- // pp.setHeight("500px");
- // pp.getLayout().setSizeFull();
- // orderedLayout = new OrderedLayout();
- // pp.getLayout().addComponent(orderedLayout);
- // w.getLayout().addComponent(pp);
- // createUI(orderedLayout);
- }
-
- @SuppressWarnings("unused")
- private void createUI(Layout layout) {
- Label l = new Label("Label");
- Button b = new Button("Enable/disable caption and watch button move",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- System.out.println("Enable/disable caption");
- for (AbstractComponent l : new AbstractComponent[] {
- tf1, tf2, tf3 }) {
- // AbstractComponent l = tf2;
- // Layout l = (Layout) event.getButton().getData();
- if (l.getCaption() == null) {
- l.setCaption("Expand layout caption");
- } else {
- l.setCaption(null);
- }
- }
- }
-
- });
- b.setData(layout);
- Label l2 = new Label("This should always be visible");
-
- layout.addComponent(l);
- layout.addComponent(b);
- layout.addComponent(l2);
-
- if (layout instanceof ExpandLayout) {
- ((ExpandLayout) layout).expand(l);
-
- }
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2022.java b/src/com/vaadin/tests/tickets/Ticket2022.java deleted file mode 100644 index 9dfcabc208..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2022.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.CustomLayout;
-import com.vaadin.ui.Window;
-
-public class Ticket2022 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- setTheme("tests-tickets");
- CustomLayout l;
-
- // WebApplicationContext wac = ((WebApplicationContext) getContext());
- // File f = new File(wac.getBaseDirectory().getAbsoluteFile()
- // + "/VAADIN/themes/" + getTheme() + "/layouts/Ticket2022.html");
-
- l = new CustomLayout("Ticket2022");
- // try {
- // l = new CustomLayout(new FileInputStream(f));
- w.setLayout(l);
- // } catch (FileNotFoundException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // } catch (IOException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2023.java b/src/com/vaadin/tests/tickets/Ticket2023.java deleted file mode 100644 index fac09e07ea..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2023.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Button; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2023 extends com.vaadin.Application implements - Button.ClickListener { - - AbstractComponent c = new Button(); - - @Override - public void init() { - Window main = new Window(); - setMainWindow(main); - - String[] sizes = { "20", "100", "1", "0", "-1", "", "z" }; - String[] units = { "%", "px", "em", "ex", "in", "cm", "mm", "pt", "pc", - "", "p", "zyx" }; - - GridLayout gl = new GridLayout(units.length, sizes.length); - main.addComponent(gl); - for (int i = 0; i < sizes.length; i++) { - for (int j = 0; j < units.length; j++) { - String s = sizes[i] + units[j]; - gl.addComponent(new Button(s, this)); - } - } - - gl.addComponent(new Button("null", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - c.setWidth(null); - c.setHeight(null); - - } - - })); - - main.addComponent(c); - - } - - public void buttonClick(ClickEvent event) { - c.setWidth(event.getButton().getCaption()); - c.setHeight(event.getButton().getCaption()); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2024.java b/src/com/vaadin/tests/tickets/Ticket2024.java deleted file mode 100644 index 1c2c7b4a33..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2024.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2024 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(2, 2);
- layout.setHeight("100%");
- layout.setWidth("700");
- w.getLayout().setSizeFull();
- w.getLayout().setHeight("2000");
- w.getLayout().addComponent(layout);
-
- layout.addComponent(new Label(
- "This should NOT get stuck when scrolling down"));
- layout
- .addComponent(new TextField(
- "This should not get stuck either..."));
-
- OrderedLayout ol = new OrderedLayout();
- ol.setHeight("1000");
- ol.setWidth("200");
- w.getLayout().addComponent(ol);
- ol.addComponent(new Label("Just a label to enable the scrollbar"));
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2026.java b/src/com/vaadin/tests/tickets/Ticket2026.java deleted file mode 100644 index 4bbb9057ff..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2026.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2026 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
-
- GridLayout layout = new GridLayout(2, 2);
- layout.setSpacing(true);
-
- @SuppressWarnings("unused")
- int nr = 5;
- TextField tf;
- tf = new TextField("TextField (tabIndex 1)");
- tf.setTabIndex(1);
- tf.focus();
- layout.addComponent(tf);
- layout.addComponent(new TextField("TextField without tab index"));
- layout.addComponent(new TextField("TextField without tab index"));
- layout.addComponent(new TextField("TextField without tab index"));
- layout.addComponent(new TextField("TextField without tab index"));
- tf = new TextField("TextField (tabIndex 2)");
- tf.setTabIndex(2);
- layout.addComponent(tf);
-
- w.setLayout(layout);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2029.java b/src/com/vaadin/tests/tickets/Ticket2029.java deleted file mode 100644 index 4c53e2cd9e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2029.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Random;
-
-import com.vaadin.Application;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.terminal.UserError;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2029 extends Application {
-
- int COMPONENTS;
- int DIM1, DIM2;
- Random r = new Random();
-
- @Override
- public void init() {
- COMPONENTS = 5;
- DIM1 = 504;
- DIM2 = 100;
-
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- Panel p = createPanel();
- w.getLayout().addComponent(p);
- // w.getLayout().addComponent(createGLPanel());
- w.getLayout().addComponent(createPanelV());
- }
-
- private Panel createPanel() {
- Panel p = new Panel(DIM1 + "x" + DIM2 + " OrderedLayout");
- p.setWidth(DIM1 + "px");
- p.setHeight(DIM2 + "px");
-
- OrderedLayout layout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- p.setLayout(layout);
- p.getLayout().setSizeFull();
-
- for (int i = 0; i < COMPONENTS; i++) {
- TextField tf = new TextField();
- if (r.nextBoolean()) {
- tf.setCaption("Caption");
- }
- if (r.nextBoolean()) {
- tf.setRequired(true);
- }
- if (r.nextBoolean()) {
- tf.setComponentError(new UserError("Error"));
- }
- tf.setWidth("100%");
- layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_BOTTOM);
- p.addComponent(tf);
-
- }
-
- return p;
- }
-
- private Panel createGLPanel() {
- Panel p = new Panel("" + DIM1 + "x" + DIM2 + " GridLayout");
- p.setWidth("" + DIM1 + "px");
- p.setHeight("" + DIM2 + "px");
-
- GridLayout layout = new GridLayout(COMPONENTS, 1);
- p.setLayout(layout);
- p.getLayout().setSizeFull();
-
- for (int i = 0; i < COMPONENTS; i++) {
- TextField tf = new TextField();
- tf.setImmediate(true);
- tf.addListener(new ValueChangeListener() {
-
- public void valueChange(ValueChangeEvent event) {
- Component c = ((Component) event.getProperty());
- c.setCaption("askfdj");
-
- }
- });
- if (r.nextBoolean()) {
- tf.setCaption("Caption");
- }
- if (r.nextBoolean()) {
- tf.setRequired(true);
- }
- if (r.nextBoolean()) {
- tf.setComponentError(new UserError("Error"));
- }
- tf.setWidth("100%");
- layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_VERTICAL_CENTER);
- p.addComponent(tf);
-
- }
-
- return p;
- }
-
- private Panel createPanelV() {
- Panel p = new Panel("" + DIM1 + "x" + DIM2 + " OrderedLayout");
- p.setWidth("" + DIM2 + "px");
- p.setHeight("" + DIM1 + "px");
-
- OrderedLayout layout = new OrderedLayout(
- OrderedLayout.ORIENTATION_VERTICAL);
- p.setLayout(layout);
- p.getLayout().setSizeFull();
-
- for (int i = 0; i < COMPONENTS; i++) {
- TextField tf = new TextField();
- if (r.nextBoolean()) {
- tf.setCaption("Caption");
- }
- if (r.nextBoolean()) {
- tf.setRequired(true);
- }
- if (r.nextBoolean()) {
- tf.setComponentError(new UserError("Error"));
- }
-
- tf.setRows(2);
- tf.setSizeFull();
-
- layout.setComponentAlignment(tf, OrderedLayout.ALIGNMENT_LEFT,
- OrderedLayout.ALIGNMENT_BOTTOM);
- p.addComponent(tf);
-
- }
-
- return p;
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2032.java b/src/com/vaadin/tests/tickets/Ticket2032.java deleted file mode 100644 index f51984f336..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2032.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.UserError;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2032 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- ExpandLayout el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
- Panel p = new Panel(el);
- p.setWidth(600);
- p.setHeight(500);
- p.getLayout().setSizeFull();
-
- TextField tf = new TextField("Field caption");
- tf.setValue("Expanded");
- el.addComponent(tf);
- el.expand(tf);
- tf.setSizeFull();
-
- tf = new TextField("Vertical bottom");
- // tf.setComponentError(new UserError("Error"));
- tf.setValue("Vertical bottom");
- el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- ExpandLayout.ALIGNMENT_BOTTOM);
- el.addComponent(tf);
-
- tf = new TextField("Vertical top");
- tf.setComponentError(new UserError("Error"));
- el.addComponent(tf);
- tf.setValue("Vertical top");
- el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- ExpandLayout.ALIGNMENT_TOP);
- tf = new TextField("Vertical center");
- el.addComponent(tf);
- tf.setValue("Vertical center");
- // tf.setComponentError(new UserError("Error"));
- el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
-
- layout.addComponent(p);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2033.java b/src/com/vaadin/tests/tickets/Ticket2033.java deleted file mode 100644 index 744195619e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2033.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.UserError;
-import com.vaadin.ui.ExpandLayout;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2033 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(2, 2);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- layout.addComponent(createExpandLayoutPanel());
- layout.addComponent(createOrderedLayoutPanel());
- layout.addComponent(createGridLayoutPanel());
- }
-
- private Panel createExpandLayoutPanel() {
- ExpandLayout el = new ExpandLayout(ExpandLayout.ORIENTATION_HORIZONTAL);
- Panel p = new Panel("ExpandLayout", el);
- p.setWidth(600);
- p.setHeight(500);
- p.getLayout().setSizeFull();
-
- TextField tf = new TextField("TextField 1");
- tf.setValue("Expanded");
- el.addComponent(tf);
- el.expand(tf);
- tf.setSizeFull();
-
- tf = new TextField("TextField 2 has a longer caption");
- // tf.setComponentError(new UserError("Error"));
- tf.setWidth(100);
- tf.setValue("Vertical bottom");
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_BOTTOM);
- el.addComponent(tf);
-
- tf = new TextField(
- "TextField 3 has a very, very long caption for some weird reason.");
- tf.setWidth(100);
- tf.setComponentError(new UserError("Error"));
- el.addComponent(tf);
- tf.setValue("Vertical top");
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_TOP);
- tf = new TextField("TextField 4");
- el.addComponent(tf);
- tf.setValue("Vertical center");
- // tf.setComponentError(new UserError("Error"));
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
-
- return p;
- }
-
- private Panel createOrderedLayoutPanel() {
- OrderedLayout ol = new OrderedLayout(
- ExpandLayout.ORIENTATION_HORIZONTAL);
- Panel p = new Panel("OrderedLayout", ol);
- p.setWidth(600);
- p.setHeight(500);
- p.getLayout().setSizeFull();
-
- TextField tf = new TextField("TextField 1");
- tf.setValue("Expanded");
- ol.addComponent(tf);
- // ol.expand(tf);
- tf.setSizeFull();
-
- tf = new TextField("TextField 2 has a longer caption");
- // tf.setComponentError(new UserError("Error"));
- tf.setWidth(100);
- tf.setValue("Vertical bottom");
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_BOTTOM);
- ol.addComponent(tf);
-
- tf = new TextField(
- "TextField 3 has a very, very long caption for some weird reason.");
- tf.setWidth(100);
- tf.setComponentError(new UserError("Error"));
- ol.addComponent(tf);
- tf.setValue("Vertical top");
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_TOP);
- tf = new TextField("TextField 4");
- ol.addComponent(tf);
- tf.setValue("Vertical center");
- // tf.setComponentError(new UserError("Error"));
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
-
- return p;
- }
-
- private Panel createGridLayoutPanel() {
- GridLayout gl = new GridLayout(4, 1);
- Panel p = new Panel("GridLayout", gl);
- p.setWidth(600);
- p.setHeight(500);
- p.getLayout().setSizeFull();
-
- TextField tf = new TextField("TextField 1");
- tf.setValue("Expanded");
- gl.addComponent(tf);
- // ol.expand(tf);
- tf.setSizeFull();
-
- tf = new TextField("TextField 2 has a longer caption");
- // tf.setComponentError(new UserError("Error"));
- tf.setWidth(100);
- tf.setValue("Vertical bottom");
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_BOTTOM);
- gl.addComponent(tf);
-
- tf = new TextField(
- "TextField 3 has a very, very long caption for some weird reason.");
- tf.setWidth(100);
- tf.setComponentError(new UserError("Error"));
- gl.addComponent(tf);
- tf.setValue("Vertical top");
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_TOP);
- tf = new TextField("TextField 4");
- gl.addComponent(tf);
- tf.setValue("Vertical center");
- // tf.setComponentError(new UserError("Error"));
- // el.setComponentAlignment(tf, ExpandLayout.ALIGNMENT_LEFT,
- // ExpandLayout.ALIGNMENT_VERTICAL_CENTER);
-
- return p;
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2037.java b/src/com/vaadin/tests/tickets/Ticket2037.java deleted file mode 100644 index 084ca14c0f..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2037.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket2037 extends com.vaadin.Application {
-
- @Override
- public void init() {
- Window main = new Window();
- setMainWindow(main);
-
- main
- .addComponent(new Label(
- "Use debug dialog and trac number of registered paintables. It should not grow on subsequant b clicks."));
-
- final Layout lo = new OrderedLayout();
-
- Button b = new Button("b");
-
- main.addComponent(b);
- main.addComponent(lo);
- b.addListener(new Button.ClickListener() {
-
- public void buttonClick(ClickEvent event) {
-
- repopupate(lo);
-
- }
- });
-
- }
-
- int counter = 0;
-
- protected void repopupate(Layout lo) {
- lo.removeAllComponents();
-
- for (int i = 0; i < 20; i++) {
- lo.addComponent(new Label("tc" + (counter++)));
- }
-
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2038.java b/src/com/vaadin/tests/tickets/Ticket2038.java deleted file mode 100644 index e566d50520..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2038.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.Button; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; - -public class Ticket2038 extends Application { - - @Override - public void init() { - final Window w = new Window("Testing for #2038"); - setMainWindow(w); - - final TextField tf = new TextField( - "Test-field, enter someting and click outside the field to activate"); - tf.setRequired(true); - tf.setImmediate(true); - tf.addListener(new Property.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - w.showNotification("TextField is " + (tf.isValid() ? "" : "in") - + "valid, with error: " + tf.getErrorMessage(), - Notification.TYPE_WARNING_MESSAGE); - } - }); - w.addComponent(tf); - - final Button b = new Button( - "Field should use error message. (!) should be shown when invalid.", - false); - w.addComponent(b); - b.setImmediate(true); - b.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - tf - .setRequiredError(b.booleanValue() ? "Field must not be empty" - : null); - } - }); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2040.java b/src/com/vaadin/tests/tickets/Ticket2040.java deleted file mode 100644 index e5300d5eed..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2040.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Accordion;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2040 extends com.vaadin.Application {
-
- TextField f = new TextField();
-
- @Override
- public void init() {
- Window main = new Window();
- setMainWindow(main);
-
- main.getLayout().setSizeFull();
- main.getLayout().setMargin(true);
-
- setTheme("tests-tickets");
-
- Accordion ts;
-
- ts = new Accordion();
- ts.setSizeFull();
- ts.setWidth("300px");
-
- TextField l = new TextField("DSFS");
- l.setRows(2);
- l.setStyleName("red");
- l.setSizeFull();
- ts.addTab(l, "100% h component", null);
-
- Label testContent = new Label(
- "TabSheet by default uses caption, icon, errors etc. from Components. ");
-
- testContent.setCaption("Introduction to test");
-
- ts.addTab(testContent);
-
- // main.addComponent(ts);
-
- ts = new Accordion();
- ts.setSizeFull();
- ts.setHeight("200px");
- ts.setWidth("300px");
-
- l = new TextField("DSFS");
- l.setRows(2);
- l.setStyleName("red");
- l.setSizeFull();
- ts.addTab(l, "200px h component", null);
-
- testContent = new Label(
- "TabSheet by default uses caption, icon, errors etc. from Components. ");
-
- testContent.setCaption("Introduction to test");
-
- ts.addTab(testContent);
-
- main.addComponent(ts);
-
- ts = new Accordion();
- ts.setSizeFull();
- ts.setHeight("50%");
- ts.setWidth("300px");
-
- l = new TextField("DSFS");
- l.setRows(2);
- l.setStyleName("red");
- l.setSizeFull();
- ts.addTab(l, "50% h component", null);
-
- testContent = new Label(
- "TabSheet by default uses caption, icon, errors etc. from Components. ");
-
- testContent.setCaption("Introduction to test");
-
- ts.addTab(testContent);
-
- // main.addComponent(ts);
-
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2042.java b/src/com/vaadin/tests/tickets/Ticket2042.java deleted file mode 100644 index 6339222a0b..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2042.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Window.Notification;
-
-public class Ticket2042 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(1, 2);
- layout.setHeight("2000px");
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- layout.addComponent(new Label("abc"));
- layout.addComponent(new Button("B", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Notification n = new Notification("Test");
- getMainWindow().showNotification(n);
- }
-
- }));
-
- layout.addComponent(new Label("abc"));
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2043.java b/src/com/vaadin/tests/tickets/Ticket2043.java deleted file mode 100644 index aad3cb554a..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2043.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Link;
-import com.vaadin.ui.Window;
-
-public class Ticket2043 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- Link l = new Link("Vaadin home (new 200x200 window, no decor, icon)",
- new ExternalResource("http://www.vaadin.com"), "_blank", 200,
- 200, Link.TARGET_BORDER_NONE);
-
- layout.addComponent(l);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2048.java b/src/com/vaadin/tests/tickets/Ticket2048.java deleted file mode 100644 index f1bfecdcc0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2048.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.ThemeResource;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Embedded;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.SplitPanel;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2048 extends Application {
-
- private Embedded embedded;
- private Panel p;
- private SplitPanel splitPanel;
- private GridLayout gridLayout;
- private OrderedLayout orderedLayout;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- // splitPanel = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
- // getMainWindow().setLayout(splitPanel);
-
- // GridLayout layout = new GridLayout(10, 10);
- // w.setLayout(layout);
- // gridLayout = new GridLayout(1, 1);
- orderedLayout = new OrderedLayout();
-
- getMainWindow().setLayout(orderedLayout);
- // getMainWindow().setLayout(new GridLayout(1, 1));
- getMainWindow().setSizeFull();
- getMainWindow().getLayout().setSizeFull();
-
- createUI(orderedLayout);
- // createUI(gridLayout);
-
- }
-
- private void createUI(Layout layout) {
- // Button sw = new Button("Switch", new ClickListener() {
- //
- // public void buttonClick(ClickEvent event) {
- // Layout l = getMainWindow().getLayout();
- // if (l == orderedLayout) {
- // getMainWindow().setLayout(gridLayout);
- // } else {
- // getMainWindow().setLayout(orderedLayout);
- // }
- //
- // }
- // });
- // layout.addComponent(sw);
-
- Layout ol = new GridLayout(1, 2);
- p = new Panel("Panel", ol);
- p.setSizeFull();
- Label l = new Label("Spacer");
- l.setHeight("400px");
- p.addComponent(l);
-
- embedded = new Embedded(null, new ThemeResource(
- "icons/64/folder-add.png"));
- layout.addComponent(embedded);
- Button b = new Button(
- "Replace image with new embedded component (flashes)",
- new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- Embedded newEmbedded = new Embedded(null,
- new ThemeResource("icons/64/folder-add.png"));
- getMainWindow().getLayout().replaceComponent(embedded,
- newEmbedded);
- embedded = newEmbedded;
-
- }
-
- });
- p.addComponent(b);
-
- b = new Button("Change image source (is fine)", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- String img = "folder-add";
- if (((ThemeResource) embedded.getSource()).getResourceId()
- .contains("folder-add")) {
- img = "folder-delete";
- }
- embedded
- .setSource(new ThemeResource("icons/64/" + img + ".png"));
-
- }
-
- });
-
- p.addComponent(b);
- layout.addComponent(p);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2051.java b/src/com/vaadin/tests/tickets/Ticket2051.java deleted file mode 100644 index b31acbde11..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2051.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.data.Item;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2051 extends Application {
-
- private static final Object P1 = new Object();
- private static final Object P2 = new Object();
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- Table t = new Table("This is a table");
- t.addContainerProperty(P1, Component.class, null);
- t.addContainerProperty(P2, Component.class, null);
- t.setColumnHeaders(new String[] { "Col1", "Col2" });
-
- Item i = t.addItem("1");
- i.getItemProperty(P1).setValue(new TextField("abc"));
- i.getItemProperty(P2).setValue(new Label("label"));
- Item i2 = t.addItem("2");
- i2.getItemProperty(P1).setValue(new Button("def"));
- i2.getItemProperty(P2).setValue(new DateField());
-
- layout.addComponent(t);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2053.java b/src/com/vaadin/tests/tickets/Ticket2053.java deleted file mode 100644 index 167a1440c0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2053.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Window.CloseEvent; - -public class Ticket2053 extends Application { - - int childs = 0; - - @Override - public void init() { - - final Window main = new Window("#2053"); - setMainWindow(main); - Button nothing = new Button("Do nothing"); - main.addComponent(nothing); - nothing - .setDescription("Even though no action is taked, this window is refreshed to " - + "draw changes not originating from this window. Such changes include changes " - + "made by other browser-windows."); - Button add = new Button("Add a window", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - final String name = "Child " + (++childs); - Window c = new Window(name); - c.addListener(new Window.CloseListener() { - public void windowClose(CloseEvent e) { - main.addComponent(new Label(name + " closed")); - } - }); - addWindow(c); - main.open(new ExternalResource(c.getURL()), "_new"); - main.addComponent(new Label(name + " opened")); - final TextField tf = new TextField("Non immediate textfield"); - c.addComponent(tf); - tf.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - main.addComponent(new Label(name + " send text:" - + tf.toString())); - } - }); - for (int i = 0; i < 3; i++) { - final String caption = "Slow button " + i; - c.addComponent(new Button(caption, - new Button.ClickListener() { - public synchronized void buttonClick( - ClickEvent event) { - try { - this.wait(2000); - } catch (InterruptedException e) { - } - main.addComponent(new Label(caption - + " pressed")); - } - })); - } - - } - }); - main.addComponent(add); - add - .setDescription("This button opens a new browser window. Closing the browser " - + "window should do two things: 1) submit all unsubmitted state to server " - + "(print any changes to textfield to main window) and 2) call window.close()" - + " on the child window (print closed on the main window)"); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2060.java b/src/com/vaadin/tests/tickets/Ticket2060.java deleted file mode 100644 index 09a391e80d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2060.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2060 extends Application {
-
- private Button button1;
- private Button button2;
- private Button button3;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- OrderedLayout buttonLayout = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- button1 = new Button("Button which is 50px wide");
- button1.setWidth("50px");
- button2 = new Button("Button without width");
- button3 = new Button("Click to repaint buttons", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- button1.requestRepaint();
- button2.requestRepaint();
- button3.requestRepaint();
-
- }
-
- });
-
- buttonLayout.addComponent(button1);
- buttonLayout.addComponent(button2);
- buttonLayout.addComponent(button3);
-
- layout.addComponent(buttonLayout);
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2061.java b/src/com/vaadin/tests/tickets/Ticket2061.java deleted file mode 100644 index b6c8f1fb38..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2061.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2061 extends Application { - - private Window mainWindow; - - @Override - public void init() { - mainWindow = new Window("Ticket 2061"); - mainWindow.setSizeFull(); - mainWindow.getLayout().setSizeFull(); - setMainWindow(mainWindow); - - MyTable table1 = new MyTable(24, "table1"); - table1.loadTable(1000); - - MyTable table2 = new MyTable(24, "table2"); - table2.loadTable(1000); - - MyTable table3 = new MyTable(24, "table3"); - table3.loadTable(1000); - - MyAccordion accordion = new MyAccordion(new Component[] { table1, - table2 }, "Test"); - - Tabs tab = new Tabs(new Component[] { accordion, table3 }); - - mainWindow.addComponent(tab); - - } - - public class MyTable extends CustomComponent implements ValueChangeListener { - - private Table table = new Table(); - private String[] columns; - private ExpandLayout layout = new ExpandLayout(); - - public MyTable(int columnNumber, String id) { - setDebugId(id); - setCompositionRoot(layout); - setSizeFull(); - columns = initializeColumns(columnNumber); - table.setWidth("100%"); - table.setHeight("100%"); - table.setColumnReorderingAllowed(true); - table.setColumnCollapsingAllowed(true); - table.setSelectable(true); - table.setMultiSelect(false); - table.setNullSelectionAllowed(false); - // table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); - table.addListener(this); - table.setContainerDataSource(createContainer()); - layout.addComponent(table); - } - - public void loadTable(int itemNumber) { - table.removeAllItems(); - for (int j = 0; j < itemNumber; j++) { - Item rowItem = table.addItem(j); - if (rowItem != null) { - for (int i = 0; i < columns.length; i++) { - rowItem.getItemProperty(columns[i]).setValue( - "Value" + j); - } - } - } - } - - private HierarchicalContainer createContainer() { - final HierarchicalContainer c = new HierarchicalContainer(); - for (int i = 0; i < columns.length; i++) { - c.addContainerProperty(columns[i], String.class, null); - } - return c; - } - - private String[] initializeColumns(int number) { - String[] columns = new String[number]; - for (int i = 0; i < number; i++) { - columns[i] = "Column" + i; - } - return columns; - } - - public void valueChange(ValueChangeEvent event) { - - } - - } - - public class Tabs extends TabSheet { - - public Tabs(Component[] components) { - this.setWidth("100%"); - this.setHeight("100%"); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - - } - } - - public class MyAccordion extends Accordion { - - public MyAccordion(Component[] components, String id) { - this.setWidth("100%"); - this.setHeight("100%"); - setDebugId(id); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - } - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2061b.java b/src/com/vaadin/tests/tickets/Ticket2061b.java deleted file mode 100644 index 8d87a70788..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2061b.java +++ /dev/null @@ -1,198 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; -import com.vaadin.ui.TabSheet.SelectedTabChangeListener; - -public class Ticket2061b extends Application implements - SelectedTabChangeListener { - - private Window mainWindow; - private Panel p; - - @Override - public void init() { - mainWindow = new Window("Ticket 2061b"); - mainWindow.setSizeFull(); - OrderedLayout mainLayout = (OrderedLayout) mainWindow.getLayout(); - mainLayout.setSizeFull(); - mainLayout.setMargin(false); - setMainWindow(mainWindow); - - SplitPanel sp = new SplitPanel(); - sp.setSizeFull(); - sp.setSplitPosition(20, SplitPanel.UNITS_PIXELS); - - p = new Panel("This is a panel"); - p.setSizeFull(); - Label label1 = new Label("This is a table!"); - label1.setHeight("1500px"); - label1.setWidth("1500px"); - p.addComponent(label1); - p.setScrollTop(50); - // MyTable table1 = new MyTable(24, "table1"); - // table1.loadTable(1000); - - // MyTable table2 = new MyTable(24, "table2"); - // table2.loadTable(1000); - - // MyTable table3 = new MyTable(24, "table3"); - // table3.loadTable(1000); - - // MyAccordion accordion = new MyAccordion(new Component[] { table1, - // table2 }, "Test"); - - Label a = new Label("abc123"); - TextField tf = new TextField("A large textfield"); - tf.setHeight("2500px"); - tf.setWidth("2500px"); - - TabsAcc tab = new TabsAcc(new Component[] { p, a, tf }); - tab.addListener(this); - - mainLayout.addComponent(sp); - sp.addComponent(new Label("C 1")); - // sp.addComponent(new Label("C 2")); - // sp.setHeight("100px"); - - sp.addComponent(tab); - // mainLayout.addComponent(new Label("Filler")); - // mainLayout.addComponent(tab); - // mainLayout.setExpandRatio(tab, 1.0f); - // sp.addComponent(new Label("Filler")); - // sp.addComponent(tab); - - p = new Panel("This is a panel"); - p.setWidth("2000px"); - p.setHeight("2000px"); - Panel p2 = new Panel("This is another panel"); - p2.setWidth("2500px"); - p2.setHeight("2500px"); - label1 = new Label("This is a table!"); - label1.setHeight("1500px"); - label1.setWidth("1500px"); - p2.addComponent(label1); - p.addComponent(p2); - - tab.addTab(p, "Panel with panel", null); - } - - public class MyTable extends CustomComponent implements ValueChangeListener { - - private Table table = new Table(); - private String[] columns; - private ExpandLayout layout = new ExpandLayout(); - - public MyTable(int columnNumber, String id) { - setDebugId(id); - setCompositionRoot(layout); - setSizeFull(); - columns = initializeColumns(columnNumber); - table.setWidth("100%"); - table.setHeight("100%"); - table.setColumnReorderingAllowed(true); - table.setColumnCollapsingAllowed(true); - table.setSelectable(true); - table.setMultiSelect(false); - table.setNullSelectionAllowed(false); - // table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); - table.addListener(this); - table.setContainerDataSource(createContainer()); - layout.addComponent(table); - } - - public void loadTable(int itemNumber) { - table.removeAllItems(); - for (int j = 0; j < itemNumber; j++) { - Item rowItem = table.addItem(j); - if (rowItem != null) { - for (int i = 0; i < columns.length; i++) { - rowItem.getItemProperty(columns[i]).setValue( - "Value" + j); - } - } - } - } - - private HierarchicalContainer createContainer() { - final HierarchicalContainer c = new HierarchicalContainer(); - for (int i = 0; i < columns.length; i++) { - c.addContainerProperty(columns[i], String.class, null); - } - return c; - } - - private String[] initializeColumns(int number) { - String[] columns = new String[number]; - for (int i = 0; i < number; i++) { - columns[i] = "Column" + i; - } - return columns; - } - - public void valueChange(ValueChangeEvent event) { - - } - - } - - public class Tabs extends TabSheet { - - public Tabs(Component[] components) { - this.setWidth("100%"); - this.setHeight("100%"); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - - } - - } - - public class TabsAcc extends Accordion { - - public TabsAcc(Component[] components) { - this.setWidth("100%"); - this.setHeight("100%"); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - - } - - } - - public class MyAccordion extends Accordion { - - public MyAccordion(Component[] components, String id) { - this.setWidth("100%"); - this.setHeight("100%"); - setDebugId(id); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - } - } - - public void selectedTabChange(SelectedTabChangeEvent event) { - p.setScrollTop(10); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2061c.java b/src/com/vaadin/tests/tickets/Ticket2061c.java deleted file mode 100644 index 77381dcbfd..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2061c.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.TabSheet.SelectedTabChangeEvent; -import com.vaadin.ui.TabSheet.SelectedTabChangeListener; - -public class Ticket2061c extends Application implements - SelectedTabChangeListener { - - private Window mainWindow; - private Panel p; - - @Override - public void init() { - mainWindow = new Window("Vaadin"); - mainWindow.setSizeFull(); - mainWindow.getLayout().setSizeFull(); - setMainWindow(mainWindow); - - OrderedLayout ol = new OrderedLayout(); - ol.setWidth("200px"); - ol.setHeight("200px"); - - OrderedLayout ol2 = new OrderedLayout(); - ol2.setSizeFull(); - - p = new Panel("This is a panel"); - p.setSizeFull(); - - Label label1 = new Label("This is a table!"); - label1.setHeight("1500px"); - label1.setWidth("1500px"); - p.setScrollTop(50); - - p.addComponent(label1); - ol2.addComponent(p); - ol.addComponent(ol2); - - Label a = new Label("abc123"); - a.setCaption("Label a"); - ol.setCaption("OL"); - Tabs tab = new Tabs(new Component[] { a, ol }); - tab.addListener(this); - mainWindow.addComponent(tab); - - } - - public class MyTable extends CustomComponent implements ValueChangeListener { - - private Table table = new Table(); - private String[] columns; - private ExpandLayout layout = new ExpandLayout(); - - public MyTable(int columnNumber, String id) { - setDebugId(id); - setCompositionRoot(layout); - setSizeFull(); - columns = initializeColumns(columnNumber); - table.setWidth("100%"); - table.setHeight("100%"); - table.setColumnReorderingAllowed(true); - table.setColumnCollapsingAllowed(true); - table.setSelectable(true); - table.setMultiSelect(false); - table.setNullSelectionAllowed(false); - // table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); - table.addListener(this); - table.setContainerDataSource(createContainer()); - layout.addComponent(table); - } - - public void loadTable(int itemNumber) { - table.removeAllItems(); - for (int j = 0; j < itemNumber; j++) { - Item rowItem = table.addItem(j); - if (rowItem != null) { - for (int i = 0; i < columns.length; i++) { - rowItem.getItemProperty(columns[i]).setValue( - "Value" + j); - } - } - } - } - - private HierarchicalContainer createContainer() { - final HierarchicalContainer c = new HierarchicalContainer(); - for (int i = 0; i < columns.length; i++) { - c.addContainerProperty(columns[i], String.class, null); - } - return c; - } - - private String[] initializeColumns(int number) { - String[] columns = new String[number]; - for (int i = 0; i < number; i++) { - columns[i] = "Column" + i; - } - return columns; - } - - public void valueChange(ValueChangeEvent event) { - - } - - } - - public class Tabs extends TabSheet { - - public Tabs(Component[] components) { - this.setWidth("100%"); - // this.setHeight("100%"); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - } - } - - public class MyAccordion extends Accordion { - - public MyAccordion(Component[] components, String id) { - this.setWidth("100%"); - this.setHeight("100%"); - setDebugId(id); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - } - } - - public void selectedTabChange(SelectedTabChangeEvent event) { - p.setScrollTop(10); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2062.java b/src/com/vaadin/tests/tickets/Ticket2062.java deleted file mode 100644 index e5650ae18c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2062.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.SplitPanel;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-
-public class Ticket2062 extends Application {
- private static final Object P1 = new Object();
-
- @Override
- public void init() {
- setMainWindow(new Window("Ticket2062"));
- getMainWindow().setSizeFull();
-
- SplitPanel p = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL);
- p.setSizeFull();
- getMainWindow().setLayout(p);
-
- TextField tf1 = new TextField("Tab 1");
- tf1.setValue("Field 1");
- tf1.setSizeFull();
-
- Table t = new Table("Table");
- t.addContainerProperty(P1, String.class, "");
- t.setSizeFull();
-
- TabSheet tabSheet = new TabSheet();
- tabSheet.setWidth("300px");
- tabSheet.setHeight("300px");
-
- tabSheet.addComponent(tf1);
- tabSheet.addComponent(t);
-
- getMainWindow().addComponent(tabSheet);
-
- }
-
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2083.java b/src/com/vaadin/tests/tickets/Ticket2083.java deleted file mode 100644 index e074210fec..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2083.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-
-public class Ticket2083 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- Panel p = new Panel(
- "This is a panel with a longer caption than it should have");
- p.setWidth("100px");
- p.getLayout().addComponent(new Label("Contents"));
- layout.addComponent(p);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2090.java b/src/com/vaadin/tests/tickets/Ticket2090.java deleted file mode 100644 index 5bc69e0a64..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2090.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.terminal.Sizeable; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket2090 extends Application { - - Label label = new Label(); - Button target = new Button(); - Window w = new Window("#2090"); - - @Override - public void init() { - setMainWindow(w); - final TextField width = new TextField("Width"); - width.setImmediate(true); - final TextField height = new TextField("Height"); - height.setImmediate(true); - w.addComponent(width); - w.addComponent(height); - w.addComponent(label); - w.addComponent(target); - height.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - try { - target.setHeight(height.toString()); - height.setComponentError(null); - updateLabel(); - } catch (Exception e) { - height.setComponentError(new UserError(e.getMessage())); - } - } - }); - width.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - try { - target.setWidth(width.toString()); - width.setComponentError(null); - updateLabel(); - } catch (Exception e) { - width.setComponentError(new UserError(e.getMessage())); - } - } - }); - - } - - private void updateLabel() { - label.setValue("width: " + target.getWidth() - + Sizeable.UNIT_SYMBOLS[target.getWidthUnits()] + ", height: " - + target.getHeight() - + Sizeable.UNIT_SYMBOLS[target.getHeightUnits()]); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2095.java b/src/com/vaadin/tests/tickets/Ticket2095.java deleted file mode 100644 index 49353db114..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2095.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.ui.Embedded;
-import com.vaadin.ui.Window;
-
-public class Ticket2095 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
-
- // uncomment to workaround iorderedlayout bug in current trunk
- // w.setLayout(new ExpandLayout());
- w.getLayout().setSizeFull();
-
- Embedded em = new Embedded();
- em.setType(Embedded.TYPE_BROWSER);
- em
- .setSource(new ExternalResource(
- "../statictestfiles/ticket2095.html"));
- em.setDebugId("MYIFRAME");
-
- em.setSizeFull();
-
- w.addComponent(em);
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2098.java b/src/com/vaadin/tests/tickets/Ticket2098.java deleted file mode 100644 index 829fb30070..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2098.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Window;
-
-public class Ticket2098 extends Application {
-
- private static final String info = "First tab hidden, second should initially be selected";
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- w.addComponent(new Label(info));
- createUI(w);
- }
-
- private void createUI(Window w) {
- TabSheet ts = new TabSheet();
- Label l1 = new Label("111");
- Label l2 = new Label("222");
- Label l3 = new Label("333");
- Label l4 = new Label("444");
-
- ts.addTab(l1, "1", null);
- ts.addTab(l2, "2", null);
- ts.addTab(l3, "3", null);
- ts.addTab(l4, "4", null);
-
- l1.setVisible(false);
-
- w.addComponent(ts);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2099.java b/src/com/vaadin/tests/tickets/Ticket2099.java deleted file mode 100644 index 44c264e07e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2099.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.TabSheet;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2099 extends Application {
-
- private Label l1, l2, l3;
- private OrderedLayout ol1, ol2, ol3;
- private Window popup;
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
- // setTheme("tests-tickets");
- GridLayout layout = new GridLayout(10, 10);
- w.setLayout(layout);
- createUI(layout);
- }
-
- private void createUI(GridLayout layout) {
- Button b = new Button("Show popup", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- getMainWindow().addWindow(popup);
- // popup.setVisible(true);
- }
-
- });
- popup = createPopup();
- addWindow(popup);
-
- layout.addComponent(b);
- layout.addComponent(new Button("Hide label '222'", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- l2.setVisible(!l2.isVisible());
- }
-
- }));
-
- }
-
- private Window createPopup() {
- Window w = new Window("Popup");
- TabSheet ts = new TabSheet();
- ol1 = new OrderedLayout();
- ol2 = new OrderedLayout();
- ol3 = new OrderedLayout();
- l1 = new Label("111");
- l2 = new Label("222");
- l3 = new Label("333");
-
- ol1.addComponent(l1);
- ol2.addComponent(l2);
- ol3.addComponent(l3);
-
- ts.addTab(ol1, "1", null);
- ts.addTab(ol2, "2", null);
- ts.addTab(ol3, "3", null);
-
- // l1.setVisible(false);
- // ts.setSelectedTab(l3);
-
- w.addComponent(ts);
-
- return w;
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2101.java b/src/com/vaadin/tests/tickets/Ticket2101.java deleted file mode 100644 index 9a260635cf..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2101.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Window;
-
-public class Ticket2101 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
-
- Button b = new Button(
- "Button with a long text which will not fit on 50 pixels");
- b.setWidth("50px");
-
- w.getLayout().addComponent(b);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2103.java b/src/com/vaadin/tests/tickets/Ticket2103.java deleted file mode 100644 index 3e655b6753..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2103.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.data.util.HierarchicalContainer; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Component; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2103 extends Application { - private Window mainWindow; - - @Override - public void init() { - mainWindow = new Window(getClass().getSimpleName()); - mainWindow.setLayout(new ExpandLayout()); - mainWindow.setSizeFull(); - mainWindow.getLayout().setSizeFull(); - - MyTable table1 = new MyTable(4, "table1"); - table1.loadTable(100); - MyTable table2 = new MyTable(4, "table2"); - table2.loadTable(100); - - MyAccordion a = new MyAccordion(new Component[] { table1, table2 }, - "FDSF"); - mainWindow.addComponent(a); - setMainWindow(mainWindow); - // mainWindow.addComponent(table1); - - } - - public class MyAccordion extends Accordion { - - public MyAccordion(Component[] components, String id) { - this.setWidth("100%"); - this.setHeight("100%"); - setDebugId(id); - for (int i = 0; i < components.length; i++) { - this.addTab(components[i], components[i].getDebugId(), null); - } - } - } - - public class MyTable extends Table { - - private Table table = this; - private String[] columns; - private ExpandLayout layout = new ExpandLayout(); - - public MyTable(int columnNumber, String id) { - setDebugId(id); - setSizeFull(); - columns = initializeColumns(columnNumber); - table.setWidth("100%"); - table.setHeight("100%"); - table.setColumnReorderingAllowed(true); - table.setColumnCollapsingAllowed(true); - table.setSelectable(true); - table.setMultiSelect(false); - table.setNullSelectionAllowed(false); - // table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); - table.setContainerDataSource(createContainer()); - layout.addComponent(table); - } - - public void loadTable(int itemNumber) { - table.removeAllItems(); - for (int j = 0; j < itemNumber; j++) { - Item rowItem = table.addItem(j); - if (rowItem != null) { - for (int i = 0; i < columns.length; i++) { - rowItem.getItemProperty(columns[i]).setValue( - "Value" + j); - } - } - } - } - - private HierarchicalContainer createContainer() { - final HierarchicalContainer c = new HierarchicalContainer(); - for (int i = 0; i < columns.length; i++) { - c.addContainerProperty(columns[i], String.class, null); - } - return c; - } - - private String[] initializeColumns(int number) { - String[] columns = new String[number]; - for (int i = 0; i < number; i++) { - columns[i] = "Column" + i; - } - return columns; - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2104.java b/src/com/vaadin/tests/tickets/Ticket2104.java deleted file mode 100644 index 974e97871f..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2104.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.event.ItemClickEvent; -import com.vaadin.event.ItemClickEvent.ItemClickListener; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Tree; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2104 extends Application { - - private static final Label info = new Label( - "Click event should _always_ come trough. Switching features on/off should immediatly affect the tree (verify w/ debug window)", - Label.CONTENT_RAW); - - Tree tree = new Tree(); - Table table = new Table(); - - @Override - public void init() { - Window main = new Window(); - setMainWindow(main); - - main.addComponent(info); - - OrderedLayout ol = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - main.addComponent(ol); - Button b = new Button("immediate", - new MethodProperty(tree, "immediate")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("selectable", new MethodProperty(tree, "selectable")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("nullsel", new MethodProperty(tree, - "nullSelectionAllowed")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("multi", new MethodProperty(tree, "multiSelect")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("icon", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (tree.getItemIconPropertyId() == null) { - tree.setItemIconPropertyId("icon"); - } else { - tree.setItemIconPropertyId(null); - } - - } - }); - ol.addComponent(b); - - main.addComponent(tree); - tree.setImmediate(true); - tree.setNullSelectionAllowed(false); - tree.addItem("Root 1"); - tree.addItem("1. Child 1"); - tree.setParent("1. Child 1", "Root 1"); - tree.addItem("1. Child 2"); - tree.setParent("1. Child 2", "Root 1"); - tree.addItem("Root 2"); - tree.addItem("2. Child 1"); - tree.setParent("2. Child 1", "Root 2"); - tree.addItem("2. Child 2"); - tree.setParent("2. Child 2", "Root 2"); - tree.addContainerProperty("icon", ExternalResource.class, - new ExternalResource( - "http://www.itmill.com/res/images/itmill_logo.gif")); - - tree.addListener(new ItemClickListener() { - public void itemClick(ItemClickEvent event) { - getMainWindow().addComponent( - new Label(event.toString() + " // " + event.getItemId() - + "//" + event.getSource())); - - } - }); - - ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); - main.addComponent(ol); - b = new Button("immediate", new MethodProperty(table, "immediate")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("selectable", new MethodProperty(table, "selectable")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("nullsel", new MethodProperty(table, - "nullSelectionAllowed")); - b.setImmediate(true); - ol.addComponent(b); - b = new Button("multi", new MethodProperty(table, "multiSelect")); - b.setImmediate(true); - ol.addComponent(b); - main.addComponent(table); - table.setWidth("150px"); - table.setImmediate(true); - table.setSelectable(true); - table.setNullSelectionAllowed(false); - for (int i = 0; i < 10; i++) { - table.addItem("Item " + i); - } - table.addListener(new ItemClickListener() { - public void itemClick(ItemClickEvent event) { - getMainWindow().addComponent( - new Label(event.toString() + " // " + event.getItemId() - + "//" + event.getSource())); - - } - }); - table.addContainerProperty("Column", String.class, "value"); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2106.java b/src/com/vaadin/tests/tickets/Ticket2106.java deleted file mode 100644 index 8168e06154..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2106.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.Date; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2106 extends Application { - - private static CustomizedSystemMessages msgs = new Application.CustomizedSystemMessages(); - static { - // We will forward the user to www.vaadin.com when the session expires - msgs.setSessionExpiredURL("http://www.vaadin.com"); - msgs.setSessionExpiredMessage(null); - msgs.setSessionExpiredCaption(null); - } - - public static Application.SystemMessages getSystemMessages() { - return msgs; - } - - @Override - public void init() { - setMainWindow(new Window("#2106")); - getMainWindow().addComponent( - new Button("Do nothing", new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - getMainWindow().addComponent( - new Label("Last time did nothing: " - + new Date())); - } - })); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2107.java b/src/com/vaadin/tests/tickets/Ticket2107.java deleted file mode 100644 index adb6784275..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2107.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Validator; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.Button; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Window.Notification; - -public class Ticket2107 extends Application { - - @Override - public void init() { - final Window w = new Window("Testing for #2107"); - setMainWindow(w); - - final TextField tf = new TextField( - "Required field that validated the input"); - tf - .setDescription("Enter someting and click outside the field to activate"); - tf.setRequired(true); - tf.setImmediate(true); - tf.addListener(new Property.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - w.showNotification("TextField is " + (tf.isValid() ? "" : "in") - + "valid, with error: " + tf.getErrorMessage(), - Notification.TYPE_WARNING_MESSAGE); - } - }); - tf.addValidator(new Validator() { - - public boolean isValid(Object value) { - return value != null && value.toString().length() > 3; - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException( - "Text length must exceed 3 characters"); - } - } - }); - w.addComponent(tf); - - final Button b = new Button( - "Field should use error message. (!) should be shown when empty.", - false); - w.addComponent(b); - b.setImmediate(true); - b.addListener(new Property.ValueChangeListener() { - public void valueChange(ValueChangeEvent event) { - tf - .setRequiredError(b.booleanValue() ? "Field must not be empty" - : null); - } - }); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2117.java b/src/com/vaadin/tests/tickets/Ticket2117.java deleted file mode 100644 index 6a22915f03..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2117.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2117 extends Application { - - @Override - public void init() { - setMainWindow(createWindow()); - } - - @Override - public Window getWindow(String name) { - - // If we already have the requested window, use it - Window w = super.getWindow(name); - if (w == null) { - - // If no window found, create it - w = createExtraWindow(name); - w.open(new ExternalResource(w.getURL())); - } - return w; - } - - private Window createExtraWindow(String name) { - final Window w = new Window("Extra window: " + name); - w.setName(name); - addWindow(w); - w.addComponent(new Label( - "This window has been created on fly for name: " + name)); - w.addComponent(new Label("It has also been redirected to " + w.getURL() - + " to support reloading")); - w.addComponent(new Button("button", new ClickListener() { - public void buttonClick(ClickEvent event) { - w.showNotification("Button clicked"); - w.addComponent(new Label("clicked")); - } - })); - return w; - } - - private Window createWindow() { - final Window w = new Window(); - w - .addComponent(new Label( - "Click this link: <a target=\"_blank\" href='" - + getURL().toExternalForm() - + "'>" - + getURL().toExternalForm() - + "</a> which opens new windows to this uri. They should end up having a separate Window and URL.", - Label.CONTENT_XHTML)); - return w; - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2119.java b/src/com/vaadin/tests/tickets/Ticket2119.java deleted file mode 100644 index 7e782dc2a0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2119.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Select; -import com.vaadin.ui.Window; - -/** - * Test case for Ticket 2119. - */ -public class Ticket2119 extends Application { - - private ObjectProperty globalValue; - - @Override - public void init() { - globalValue = new ObjectProperty(null, String.class); - Window main = createWindow(); - setMainWindow(main); - } - - @Override - public Window getWindow(String name) { - if (!isRunning()) { - return null; - } - // If we already have the requested window, use it - Window w = super.getWindow(name); - if (w == null) { - // If no window found, create it - w = createWindow(); - addWindow(w); - w.open(new ExternalResource(w.getURL())); - } - return w; - } - - private Window createWindow() { - Window main = new Window("Test for ticket XXX"); - main.setLayout(testLayout()); - return main; - } - - private Layout testLayout() { - final Layout layout = new OrderedLayout(); - final Label label = new Label( - "Instructions to reproduce:\n" - + " - Open this application in two browser windows\n" - + " - Click the Button in first Window\n" - + " - Go to the second Window\n" - + " - Click the arrow in the Select\n" - + " --> The opened list correctly shows the new value but the old one is shown in the \"input\" part"); - label.setContentMode(Label.CONTENT_PREFORMATTED); - layout.addComponent(label); - - final Select select = new Select("Test Select"); - select.setWidth("100px"); - select.setImmediate(true); - select.setNullSelectionAllowed(false); - select.addItem("1"); - select.addItem("2"); - select.addItem("3"); - - final ObjectProperty valueProperty = new ObjectProperty("1", - String.class); - select.setPropertyDataSource(valueProperty); - layout.addComponent(select); - - globalValue.addListener(new Property.ValueChangeListener() { - public void valueChange(Property.ValueChangeEvent event) { - valueProperty.setValue(event.getProperty().getValue()); - } - }); - - final Button changeValueButton = new Button("Change Value to 2"); - changeValueButton.addListener(new Button.ClickListener() { - public void buttonClick(Button.ClickEvent event) { - globalValue.setValue("2"); - } - }); - - layout.addComponent(changeValueButton); - - return layout; - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2125.java b/src/com/vaadin/tests/tickets/Ticket2125.java deleted file mode 100644 index 49610597db..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2125.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Table.CellStyleGenerator; -import com.vaadin.ui.Table.ColumnGenerator; - -public class Ticket2125 extends Application { - - @Override - public void init() { - setMainWindow(new MainWindow("Ticket2125")); - - } - - class MainWindow extends Window { - MainWindow(String caption) { - super(caption); - - addComponent(new Label( - "Inspect w/ Firebug: row 5 should have a MYROW -style on the row, and MYCELL on all cells")); - - Table table = new Table(); - table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX); - addComponent(table); - for (int i = 0; i < 50; i++) { - table.addItem(new Integer(i)); - } - table.addContainerProperty("String", String.class, "a string"); - table.addContainerProperty("Boolean", Boolean.class, Boolean.TRUE); - table.addGeneratedColumn("Generated", new ColumnGenerator() { - public Component generateCell(Table source, Object itemId, - Object columnId) { - return new Label("Item " + itemId); - } - }); - table.setCellStyleGenerator(new CellStyleGenerator() { - public String getStyle(Object itemId, Object propertyId) { - if (new Integer(4).equals(itemId)) { - if (propertyId == null) { - return "MYROW"; - } else { - return "MYCELL"; - } - } - return null; - } - - }); - Button b = new Button("editmode", new MethodProperty(table, - "editable")); - b.setImmediate(true); - addComponent(b); - } - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2126.java b/src/com/vaadin/tests/tickets/Ticket2126.java deleted file mode 100644 index 01ef18f2ef..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2126.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.data.Item;
-import com.vaadin.data.util.IndexedContainer;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-
-/**
- *
- * Toggling container with an empty one may result duplicate header cell in
- * client.
- *
- */
-public class Ticket2126 extends com.vaadin.Application {
-
- Window main = new Window();
- Table table = new Table();
-
- @Override
- public void init() {
- setMainWindow(main);
-
- final IndexedContainer container1 = new IndexedContainer();
- container1.addContainerProperty("text", Component.class, null);
- final IndexedContainer container2 = new IndexedContainer();
-
- // Case #2 Try to comment the following line for another type of strange
- // behaviour
- container2.addContainerProperty("text", Component.class, null);
-
- for (int i = 0; i < 100; i++) {
- Item item = container1.addItem(i);
- item.getItemProperty("text").setValue(new Label("Test " + i));
- }
-
- table.setContainerDataSource(container1);
-
- // workaround for case #2
- // table.setWidth("300px");
- // table.setHeight("300px");
-
- Button refreshTable = new Button("Switch table container");
- refreshTable.addListener(new Button.ClickListener() {
- boolean full = true;
-
- public void buttonClick(Button.ClickEvent e) {
- if (full) {
- table.setContainerDataSource(container2);
- } else {
- table.setContainerDataSource(container1);
- }
- full = !full;
- }
- });
-
- main.addComponent(table);
- main.addComponent(refreshTable);
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2151.java b/src/com/vaadin/tests/tickets/Ticket2151.java deleted file mode 100644 index 06d1f15336..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2151.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket2151 extends Application { - - private Label status; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - Button b = new Button("This is a button"); - CheckBox cb = new CheckBox("This is a checkbox"); - cb.setImmediate(true); - setTheme("tests-tickets"); - layout.setStyleName("mylayout"); - status = new Label("Result:"); - layout.addComponent(status); - layout.setSpacing(true); - layout.setMargin(true); - - layout.addComponent(b); - layout.addComponent(cb); - - layout.addComponent(new Label("a")); - layout.addComponent(new Label("b")); - layout.addComponent(new Label("c")); - - check(Button.class); - check(CheckBox.class); - checkDataBinding(Button.class); - checkDataBinding(CheckBox.class); - - } - - private void check(Class<? extends Button> class1) { - boolean ok = false; - Button b; - try { - b = class1.newInstance(); - b.setCaption("Button of type " + class1.getSimpleName()); - try { - // This should throw an exception - b.setValue("ON"); - } catch (IllegalArgumentException e) { - ok = true; - } catch (Exception e) { - e.printStackTrace(); - } - } catch (Exception e1) { - e1.printStackTrace(); - return; - } - - if (ok) { - status.setValue(status.getValue() + " " - + class1.getClass().getSimpleName() + ": OK"); - } else { - status.setValue(status.getValue() + " " - + class1.getClass().getSimpleName() + ": FAILED"); - } - - } - - private void checkDataBinding(Class<? extends Button> class1) { - boolean ok = false; - Button b; - try { - b = class1.newInstance(); - b.setCaption("Button of type " + class1.getSimpleName()); - try { - b.setWriteThrough(true); - b.setReadThrough(true); - ObjectProperty prop = new ObjectProperty("ABC 123"); - /* - * This should throw an exception or somehow tell that the - * property was invalid (wrong type). See #2223. - */ - b.setPropertyDataSource(prop); - } catch (Exception e) { - e.printStackTrace(); - } - } catch (Exception e1) { - e1.printStackTrace(); - return; - } - - if (ok) { - status.setValue(status.getValue() + " " - + class1.getClass().getSimpleName() + "/DB: OK"); - } else { - status.setValue(status.getValue() + " " - + class1.getClass().getSimpleName() + "/DB: FAILED"); - } - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2157.java b/src/com/vaadin/tests/tickets/Ticket2157.java deleted file mode 100644 index c4f6ff30d3..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2157.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; - -public class Ticket2157 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - OrderedLayout ol; - Panel p; - ComboBox cb; - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox without width"); - // p.setWidth("100px"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - // cb.setWidth("100%"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox without width with caption"); - // p.setWidth("100px"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - // cb.setWidth("100px"); - p.addComponent(cb); - layout.addComponent(p); - - // - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100px wide"); - // p.setWidth("100px"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - cb.setWidth("100px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100px wide with caption"); - // p.setWidth("100px"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - cb.setWidth("100px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 500px wide"); - // p.setWidth("500px"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - cb.setWidth("500px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 500px wide with caption"); - // p.setWidth("500px"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - cb.setWidth("500px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100% wide"); - p.setWidth("200px"); - ol.setWidth("100%"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - cb.setWidth("100%"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100% wide with caption"); - p.setWidth("200px"); - ol.setWidth("100%"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - cb.setWidth("100%"); - p.addComponent(cb); - layout.addComponent(p); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2178.java b/src/com/vaadin/tests/tickets/Ticket2178.java deleted file mode 100644 index c663b29778..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2178.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; - -public class Ticket2178 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - OrderedLayout ol; - Panel p; - ComboBox cb; - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox without width"); - // p.setWidth("100px"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - // cb.setWidth("100%"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox without width with caption"); - // p.setWidth("100px"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - // cb.setWidth("100px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100px wide"); - // p.setWidth("100px"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - cb.setWidth("100px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100px wide with caption"); - // p.setWidth("100px"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - cb.setWidth("100px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 500px wide"); - // p.setWidth("500px"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - cb.setWidth("500px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 500px wide with caption"); - // p.setWidth("500px"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - cb.setWidth("500px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100% wide inside 200px panel"); - p.setWidth("200px"); - ol.setWidth("100%"); - cb = new ComboBox(); - // cb.setCaption("A combobox"); - cb.setWidth("100%"); - // cb.setWidth("500px"); - p.addComponent(cb); - layout.addComponent(p); - - ol = new OrderedLayout(); - p = new Panel(ol); - p.setCaption("Combobox 100% wide inside 200px panel with caption"); - p.setWidth("200px"); - ol.setWidth("100%"); - cb = new ComboBox(); - cb.setCaption("A combobox"); - cb.setWidth("100%"); - p.addComponent(cb); - layout.addComponent(p); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2179.java b/src/com/vaadin/tests/tickets/Ticket2179.java deleted file mode 100644 index 4612f7464f..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2179.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Validator; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket2179 extends Application { - - TextField f = new TextField("Test fiel ( must contain 1 & 2 )"); - Window main = new Window("Dual validator test"); - - @Override - public void init() { - - f.setImmediate(true); - f.setRequired(true); - f.addValidator(new ContainsValidator("1")); - f.addValidator(new ContainsValidator("2")); - - setMainWindow(main); - main.addComponent(f); - - f.addListener(new Property.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - main.showNotification("Test field is " - + (f.isValid() ? "valid" : "invalid")); - } - }); - - } - - class ContainsValidator implements Validator { - private final String c; - - public ContainsValidator(String c) { - this.c = c; - } - - public boolean isValid(Object value) { - return value != null && value.toString().contains(c); - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException("Value does not contain " + c); - } - - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2180.java b/src/com/vaadin/tests/tickets/Ticket2180.java deleted file mode 100644 index 9f5e2a2de1..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2180.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Window; - -public class Ticket2180 extends Application { - - private Window mainWindow; - private TabSheet tabSheet; - - @Override - public void init() { - mainWindow = new Window("Tabsheet should cause scrollbars"); - setMainWindow(mainWindow); - // mainWindow.getLayout().setSizeFull(); - tabSheet = new TabSheet(); - // tabSheet.setWidth("100%"); - Button button = new Button("Blah"); - button.setWidth("100%"); - Label label1 = new Label("Lorem ipsum"); - Label label2 = new Label("Lorem"); - Label label3 = new Label( - "Lorema jsdfhak sjdfh kajsdh fkajhd kfjah dkfjah ksfdjh kajsfh kj 1 2 3 4 5 6 7 8 9 10"); - - label3.setWidth("800px"); - tabSheet.addTab(label1, "Tab 1", null); - tabSheet.addTab(label2, "Tab 2", null); - tabSheet.addTab(label3, "Tab 3", null); - tabSheet.addTab(new Label("a"), "Tab 4", null); - tabSheet.addTab(new Label("a"), "Tab 5", null); - tabSheet.addTab(new Label("a"), "Tab 6", null); - // mainWindow.addComponent(new Label("123")); - mainWindow.addComponent(tabSheet); - mainWindow.addComponent(button); - // mainWindow.addComponent(new Label("abc")); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2181.java b/src/com/vaadin/tests/tickets/Ticket2181.java deleted file mode 100644 index d5afb01e0d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2181.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Random; -import java.util.Set; - -import com.vaadin.Application; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.terminal.UserError; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.OptionGroup; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2181 extends Application implements Button.ClickListener { - - // private static final Object PROPERTY_VALUE = new Object(); - // private static final Object PROPERTY_CAPTION = new Object(); - - private static final String caption = "This is a caption which is very long and nice and perhaps sometimes should be clipped"; - Window main = new Window("#2181 test"); - TextField tf1 = new TextField(caption, "Test field - undefined width"); - TextField tf2 = new TextField(caption, "Test field - 150px wide"); - Button setButton = new Button("Set", this); - private Random random = new Random(123); - private OptionGroup options; - - private static ArrayList<String> icons = new ArrayList<String>(); - static { - icons.add("icons/64/ok.png"); - icons.add("icons/64/arrow-down.png"); - icons.add("icons/64/arrow-left.png"); - icons.add("icons/64/arrow-right.png"); - icons.add("icons/64/arrow-up.png"); - } - - @Override - public void init() { - setMainWindow(main); - OrderedLayout ol; - ol = new OrderedLayout(); - ol.addComponent(tf1); - main.addComponent(ol); - - ol = new OrderedLayout(); - ol.setWidth("150px"); - tf2.setWidth("150px"); - ol.addComponent(tf2); - main.addComponent(ol); - - main.addComponent(createSelection()); - main.addComponent(setButton); - } - - private Component createSelection() { - options = new OptionGroup(); - options.addItem("Icon"); - options.addItem("Caption"); - options.addItem("Required"); - options.addItem("Error"); - options.setMultiSelect(true); - options.select("Caption"); - - // ol.addComponent(og); - return options; - } - - public void buttonClick(ClickEvent event) { - if (event.getButton() == setButton) { - set(); - } - } - - private void set() { - Set<String> values = (Set<String>) options.getValue(); - TextField[] tfs = new TextField[] { tf1, tf2 }; - for (TextField tf : tfs) { - // Clear all - tf.setCaption(null); - tf.setComponentError(null); - tf.setRequired(false); - tf.setIcon(null); - - for (String value : values) { - if (value.equals("Caption")) { - tf.setCaption(caption); - } else if (value.equals("Icon")) { - String timestamp = String.valueOf(new Date().getTime()); - tf.setIcon(new ThemeResource(icons.get(random.nextInt(icons - .size())) - + "?" + timestamp)); - } else if (value.equals("Required")) { - tf.setRequired(true); - } else if (value.equals("Error")) { - tf.setComponentError(new UserError("Nooooo...")); - } - } - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2186.java b/src/com/vaadin/tests/tickets/Ticket2186.java deleted file mode 100644 index 55eff60fef..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2186.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2186 extends Application { - - @Override - public void init() { - Window main = new Window("Quick test"); - setMainWindow(main); - - OrderedLayout base = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - main.setLayout(base); - - OrderedLayout content = new OrderedLayout(); - - content.addComponent(new Label("Content.")); - content.setWidth("500px"); - - Table table = new Table(); - - table.setPageLength(10); - - table.setWidth("100%"); - - table.addContainerProperty("Lähettäjä", String.class, ""); - table.addContainerProperty("Viestin tyyppi", String.class, ""); - - for (int i = 0; i < 15; i++) { - - table.addItem(new Object[] { i + " Joku Ihminen", "Testiviesti" }, - - new Object()); - - } - - content.addComponent(table); - - Panel right = new Panel("Panel"); - - right.addComponent(new Label("Some basic text might show up here.")); - - base.addComponent(content); - - base.addComponent(right); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2204.java b/src/com/vaadin/tests/tickets/Ticket2204.java deleted file mode 100644 index d4bcd55c55..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2204.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.vaadin.Application; -import com.vaadin.data.Container; -import com.vaadin.data.Item; -import com.vaadin.data.Property; -import com.vaadin.data.util.BeanItem; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.Field; -import com.vaadin.ui.FieldFactory; -import com.vaadin.ui.Form; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2204 extends Application { - - private final List<RichTextArea> textAreas = new ArrayList<RichTextArea>(); - private TabSheet ts; - private final Map<Component, Component> containerToComponent = new HashMap<Component, Component>(); - private RichTextArea rta; - private final List<Class<? extends Component>> classes = new ArrayList<Class<? extends Component>>(); - protected RichTextArea formTextArea; - - @Override - public void init() { - classes.add(OrderedLayout.class); - classes.add(GridLayout.class); - classes.add(Accordion.class); - classes.add(TabSheet.class); - classes.add(Panel.class); - classes.add(SplitPanel.class); - classes.add(Form.class); - - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - ts = new TabSheet(); - layout.addComponent(ts); - - for (Class c : classes) { - ts.addTab(createComponent(c), c.getSimpleName(), null); - } - rta = new RichTextArea(); - rta.setVisible(false); - ts.addTab(rta, "Hidden rta", null); - - Button b = new Button("Show area", new ClickListener() { - - public void buttonClick(ClickEvent event) { - showHide(); - } - }); - - layout.addComponent(b); - - b = new Button("Show tab", new ClickListener() { - - public void buttonClick(ClickEvent event) { - showTab(); - } - }); - - layout.addComponent(b); - - } - - protected void showTab() { - rta.setVisible(!rta.isVisible()); - - } - - protected void showHide() { - Component c = containerToComponent.get(ts.getSelectedTab()); - c.setVisible(!c.isVisible()); - } - - private Component createComponent(Class c) { - RichTextArea textArea = new RichTextArea(); - textArea.setVisible(false); - textArea.setCaption("This is the textArea"); - textArea.setWidth("200px"); - textArea.setHeight("100px"); - textAreas.add(textArea); - Component cc = null; - - try { - cc = (Component) c.newInstance(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - return null; - } - // if (c == OrderedLayout.class) { - // cc = new OrderedLayout(); - // } else - if (c == Accordion.class) { - // Label l = new Label("Filler"); - // l.setCaption("Filler label"); - // cc.addComponent(l); - } - - if (c == Form.class) { - Form f = (Form) cc; - f.setFieldFactory(new FieldFactory() { - - public Field createField(Class type, Component uiContext) { - return createField(); - } - - public Field createField(Property property, Component uiContext) { - return createField(); - } - - public Field createField(Item item, Object propertyId, - Component uiContext) { - return createField(); - } - - private Field createField() { - formTextArea = new RichTextArea(); - formTextArea.setVisible(false); - return formTextArea; - } - - public Field createField(Container container, Object itemId, - Object propertyId, Component uiContext) { - return createField(); - } - - }); - f.setItemDataSource(new BeanItem(new Object() { - private int a; - - public int getA() { - return a; - } - - public void setA(int a) { - this.a = a; - } - })); - containerToComponent.put(f, formTextArea); - return f; - } - containerToComponent.put(cc, textArea); - if (cc instanceof ComponentContainer) { - ((ComponentContainer) cc).addComponent(textArea); - } - - if (c == SplitPanel.class) { - SplitPanel sp = (SplitPanel) cc; - sp.setWidth("300px"); - sp.setHeight("300px"); - sp.addComponent(new Label("Label")); - textArea.setSizeFull(); - } - if (c == Panel.class) { - Layout layout = ((Panel) cc).getLayout(); - containerToComponent.put(cc, layout); - layout.setVisible(false); - textArea.setVisible(true); - return cc; - } - - return cc; - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2208.java b/src/com/vaadin/tests/tickets/Ticket2208.java deleted file mode 100644 index 0c8639603e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2208.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.data.Item;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Table.CellStyleGenerator;
-import com.vaadin.ui.Table.ColumnGenerator;
-
-public class Ticket2208 extends Application {
-
- private Table t;
-
- @Override
- public void init() {
- Window mainWindow = new Window();
- setMainWindow(mainWindow);
-
- t = new Table("A table");
- t.addContainerProperty("col 1 (red)", String.class, "");
- t.addContainerProperty("col 2", String.class, "");
-
- t.setHeight("150px");
- t.addGeneratedColumn("col 3 (green)", new ColumnGenerator() {
-
- public Component generateCell(Table source, Object itemId,
- Object columnId) {
- Item item = source.getItem(itemId);
- String col1 = (String) item.getItemProperty("col 1 (red)")
- .getValue();
- String col2 = (String) item.getItemProperty("col 2").getValue();
- return new Label(col1 + "-" + col2);
- }
- });
-
- t.addContainerProperty("col 4", String.class, "");
- t.setCellStyleGenerator(new CellStyleGenerator() {
-
- public String getStyle(Object itemId, Object propertyId) {
- if ("col 1 (red)".equals(propertyId)) {
- return "red";
- }
-
- if ("col 3 (green)".equals(propertyId)) {
- return "green";
- }
-
- return null;
- }
- });
-
- t.addItem(new Object[] { "Col 1-1", "Col 2-1", "Col 4-1" },
- new Object());
- t.addItem(new Object[] { "Col 1-2", "Col 2-2", "Col 4-2" },
- new Object());
- t.addItem(new Object[] { "Col 1-3", "Col 2-3", "Col 4-3" },
- new Object());
-
- t.setColumnReorderingAllowed(true);
- t.setColumnCollapsingAllowed(true);
- setTheme("tests-tickets");
- mainWindow.addComponent(t);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2209.java b/src/com/vaadin/tests/tickets/Ticket2209.java deleted file mode 100644 index 02450e23c1..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2209.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2209 extends Application {
-
- private GridLayout gl;
- private ComboBox combo;
- private Label labelLong;
-
- @Override
- public void init() {
- setMainWindow(new Window());
-
- gl = new GridLayout(1, 2);
- gl.setStyleName("borders");
- getMainWindow().addComponent(gl);
- setTheme("tests-tickets");
- combo = new ComboBox("Combo caption");
- labelLong = new Label(
- "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");
- gl.addComponent(combo);
- gl.addComponent(labelLong);
-
- Button b = new Button("Add label text", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- labelLong.setValue(labelLong.getValue() + "-12345");
- }
-
- });
- getMainWindow().addComponent(b);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2209OL.java b/src/com/vaadin/tests/tickets/Ticket2209OL.java deleted file mode 100644 index 620fed1021..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2209OL.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2209OL extends Application {
-
- private OrderedLayout gl;
- private ComboBox combo;
- private Label labelLong;
-
- @Override
- public void init() {
- setMainWindow(new Window());
- getMainWindow().getLayout().setWidth("250px");
- gl = new OrderedLayout();
- gl.setStyleName("borders");
- getMainWindow().addComponent(gl);
- setTheme("tests-tickets");
- combo = new ComboBox("Combo caption");
- labelLong = new Label(
- "This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. "
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");
- gl.addComponent(combo);
- gl.addComponent(labelLong);
-
- Button b = new Button("Add label text", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- labelLong.setValue(labelLong.getValue() + "-12345");
- }
-
- });
- getMainWindow().addComponent(b);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2209OL2.java b/src/com/vaadin/tests/tickets/Ticket2209OL2.java deleted file mode 100644 index 5f250b7976..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2209OL2.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-
-public class Ticket2209OL2 extends Application {
-
- private OrderedLayout gl;
- private ComboBox combo;
- private Label labelLong;
-
- @Override
- public void init() {
- setMainWindow(new Window());
- getMainWindow().getLayout().setWidth("250px");
- gl = new OrderedLayout();
- gl.setSizeUndefined();
- gl.setStyleName("borders");
- getMainWindow().addComponent(gl);
- setTheme("tests-tickets");
- combo = new ComboBox("Combo caption");
- labelLong = new Label(
- "This should stay on one line or to wrap to multiple lines? At leas it should display all the text?. "
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?"
- + "A long label, longer than the combo box. Why doesn't it affect the width? And why is the gridlayout so high?");
- gl.addComponent(combo);
- gl.addComponent(labelLong);
-
- Button b = new Button("Add label text", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- labelLong.setValue(labelLong.getValue() + "-12345");
- }
-
- });
- getMainWindow().addComponent(b);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2215.java b/src/com/vaadin/tests/tickets/Ticket2215.java deleted file mode 100644 index 51b0236ad0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2215.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Window;
-
-public class Ticket2215 extends Application {
-
- @Override
- public void init() {
- setMainWindow(new Window());
-
- OrderedLayout ol = new OrderedLayout();
- Panel p = new Panel("Test");
- p.addComponent(new Label("Panel1"));
- p.setHeight("500px");
- p.setWidth("500px");
- p.setStyleName(Panel.STYLE_LIGHT);
- ol.addComponent(p);
- ol.addComponent(new Label("NextComponent"));
-
- getMainWindow().addComponent(ol);
-
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2221.java b/src/com/vaadin/tests/tickets/Ticket2221.java deleted file mode 100644 index 30d3070043..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2221.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.Layout; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2221 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - layout.setSizeFull(); - layout.addComponent(new Invoice()); - } - - public class Invoice extends CustomComponent { - - Layout main = new OrderedLayout(); - - private TextField tf; - - private Panel outerPanel; - - private TextField tf2; - - public Invoice() { - setSizeFull(); - - setCompositionRoot(main); - main.setSizeFull(); - Button b = new Button("Switch textfield/panel", - new ClickListener() { - - public void buttonClick(ClickEvent event) { - Component visible = tf; - - if (tf.isVisible()) { - visible = outerPanel; - } - - outerPanel.setVisible(false); - tf.setVisible(false); - - visible.setVisible(true); - } - - }); - main.addComponent(b); - - tf = new TextField("TextField"); - tf.setHeight("1000px"); - tf.setWidth("1000px"); - - outerPanel = new Panel(); - outerPanel.setCaption("A RichTextArea"); - outerPanel.setVisible(false); - outerPanel.setHeight("1000px"); - outerPanel.setWidth("1000px"); - - outerPanel.getLayout().setSizeFull(); - Panel innerPanel = new Panel("Inner panel"); - innerPanel.setSizeFull(); - outerPanel.addComponent(innerPanel); - - tf2 = new TextField("A 2000x2000 textfield"); - tf2.setWidth("2000px"); - tf2.setHeight("2000px"); - - innerPanel.addComponent(tf2); - main.addComponent(outerPanel); - main.addComponent(tf); - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2222.java b/src/com/vaadin/tests/tickets/Ticket2222.java deleted file mode 100644 index 40980fcef2..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2222.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket2222 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - OrderedLayout horiz = new OrderedLayout( - OrderedLayout.ORIENTATION_HORIZONTAL); - horiz.setSpacing(true); - horiz.setMargin(true); - horiz.setStyleName("ticket2222"); - - horiz.addComponent(new Label("Horiz spacing: 60px;")); - horiz.addComponent(new Label("Margin-left: 40px")); - horiz.addComponent(new Label("Margin-top: 100px;")); - horiz.addComponent(new Label("Margin-right: 20px;")); - horiz.addComponent(new Label("Margin-bottom: 30px;")); - horiz.addStyleName("borders"); - - OrderedLayout vert = new OrderedLayout( - OrderedLayout.ORIENTATION_VERTICAL); - vert.setSizeUndefined(); - vert.setSpacing(true); - vert.setMargin(false); - vert.setStyleName("ticket2222"); - vert.addComponent(new Label("Vert spacing: 50px;")); - vert.addComponent(new Label("No margins")); - vert.addComponent(new Label("label 3")); - vert.addStyleName("borders"); - - GridLayout gl = new GridLayout(3, 2); - gl.setStyleName("borders"); - gl.setSpacing(true); - gl.setMargin(true); - gl.setStyleName("ticket2222"); - gl.addComponent(new Label("Vert spacing: 50px; horiz 20px;")); - gl.addComponent(new Label("Margin-left: 40px")); - gl.addComponent(new Label("Margin-top: 100px;")); - gl.addComponent(new Label("Margin-right: 20px;")); - gl.addComponent(new Label("Margin-bottom: 30px;")); - gl.addComponent(new Label("label 3")); - gl.addStyleName("borders"); - - layout.addComponent(horiz); - layout.addComponent(new Label(" ")); - layout.addComponent(vert); - layout.addComponent(new Label(" ")); - layout.addComponent(gl); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java b/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java deleted file mode 100644 index a8b4867323..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2227OrderedlayoutInTable.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2227OrderedlayoutInTable extends Application { - - @Override - public void init() { - Window w = new Window(); - Table t = new Table(); - t.setWidth("500px"); - t.setHeight("200px"); - t.addContainerProperty("pno", String.class, ""); - t.addContainerProperty("testi", String.class, ""); - t.addContainerProperty("testi2", OrderedLayout.class, null); - t.addContainerProperty("komponentti", Component.class, null); - t.addContainerProperty("nimi", String.class, ""); - t.setVisibleColumns(new Object[] { "pno", "testi", "testi2", "nimi" }); - - t.setSelectable(true); - - Item i = t.addItem(1); - i.getItemProperty("pno").setValue("1"); - i.getItemProperty("testi").setValue("12.12.08"); - OrderedLayout ol = new OrderedLayout(); - ol.setWidth("100%"); - ol.setHeight(null); - ol.addComponent(new Label("monirivi testi")); - ol.addComponent(new Label("monirivi testi2")); - - i.getItemProperty("testi2").setValue(ol); - i.getItemProperty("nimi").setValue("test"); - - w.addComponent(t); - setMainWindow(w); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2231.java b/src/com/vaadin/tests/tickets/Ticket2231.java deleted file mode 100644 index c9f773a4a4..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2231.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket2231 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - layout.setSizeUndefined(); - layout.setMargin(false); - layout.setStyleName("borders"); - Label l = new Label("Margin-label"); - - l.setStyleName("ticket2231"); - - layout.addComponent(l); - - for (int i = 0; i < 5; i++) { - l = new Label("This is a label with border"); - l.setStyleName("ticket2231-border"); - if (i == 2) { - l.setWidth("100%"); - l.setValue("100% wide"); - } else if (i == 4) { - l.setWidth("20em"); - l.setValue("20em wide"); - } - // l.addStyleName("ticket2231"); - layout.addComponent(l); - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2232.java b/src/com/vaadin/tests/tickets/Ticket2232.java deleted file mode 100644 index 2b33ee39cf..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2232.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Layout.SpacingHandler;
-
-public class Ticket2232 extends Application {
-
- @Override
- public void init() {
- setMainWindow(new Window());
- setTheme("tests-tickets");
-
- getMainWindow()
- .addComponent(
- new Label(
- "Defining spacing must be possible also with pure CSS"));
-
- Layout gl;
- gl = new OrderedLayout();
- gl.setWidth("100%");
- gl.setHeight("200px");
- gl.setStyleName("t2232");
- fillAndAdd(gl);
-
- gl = new GridLayout();
- gl.setWidth("100%");
- gl.setHeight("200px");
- gl.setStyleName("t2232");
- fillAndAdd(gl);
-
- gl = new OrderedLayout();
- gl.setWidth("100%");
- gl.setHeight("200px");
- ((SpacingHandler) gl).setSpacing(true);
- fillAndAdd(gl);
-
- gl = new GridLayout();
- gl.setWidth("100%");
- gl.setHeight("200px");
- ((SpacingHandler) gl).setSpacing(true);
- fillAndAdd(gl);
-
- gl = new OrderedLayout();
- gl.setWidth("100%");
- gl.setHeight("200px");
- fillAndAdd(gl);
-
- gl = new GridLayout();
- gl.setWidth("100%");
- gl.setHeight("200px");
- fillAndAdd(gl);
-
- }
-
- private void fillAndAdd(Layout gl) {
- for (int i = 0; i < 4; i++) {
- Button b = new Button("B");
- b.setSizeFull();
- gl.addComponent(b);
- }
- String caption = gl.getClass().getSimpleName();
- caption += " style: " + gl.getStyleName() + ", spacingFromServer:"
- + ((SpacingHandler) gl).isSpacingEnabled();
- gl.setCaption(caption);
- getMainWindow().addComponent(gl);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2234.java b/src/com/vaadin/tests/tickets/Ticket2234.java deleted file mode 100644 index 25d74e8574..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2234.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; - -public class Ticket2234 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - ComboBox combo = new ComboBox("Combobox caption"); - combo.addContainerProperty("blah", String.class, ""); - combo.setItemCaptionPropertyId("blah"); - - Item item; - for (int i = 0; i < 100; i++) { - item = combo.addItem(new Object()); - item.getItemProperty("blah").setValue("Item " + i); - } - - layout.addComponent(combo); - - combo = new ComboBox("Combobox caption"); - combo.addContainerProperty("blah", String.class, ""); - combo.setItemCaptionPropertyId("blah"); - - for (int i = 0; i < 5; i++) { - item = combo.addItem(new Object()); - item.getItemProperty("blah").setValue("Item " + i); - } - - layout.addComponent(combo); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2235.java b/src/com/vaadin/tests/tickets/Ticket2235.java deleted file mode 100644 index 98c618453d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2235.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket2235 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - layout.setSizeFull(); - - TextField tf = new TextField(); - tf.setCaption("A text field"); - tf.setSizeFull(); - tf.setRows(2); - - layout.addComponent(tf); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2240.java b/src/com/vaadin/tests/tickets/Ticket2240.java deleted file mode 100644 index e28a463eed..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2240.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket2240 extends Application { - - public static final String txt = "<p>There are two main types of windows: application-level windows, and " - + "\"sub windows\".</p><p>A sub window is rendered as a \"inline\" popup window" - + " within the (native) browser window to which it was added. You can create" - + " a sub window by creating a new Window and adding it to a application-level window, for instance" - + " your main window. </p><p> In contrast, you create a application-level window by" - + " creating a new Window and adding it to the Application. Application-level" - + " windows are not shown by default - you need to open a browser window for" - + " the url representing the window. You can think of the application-level" - + " windows as separate views into your application - and a way to create a" - + " \"native\" browser window.</p><p>Depending on your needs, it's also" - + " possible to create a new window instance (with it's own internal state)" - + " for each new (native) browser window, or you can share the same instance" - + " (and state) between several browser windows (the latter is most useful" - + " for read-only views).</p><br/><p>This is the end.</p>"; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - layout.setHeight(null); - layout.setStyleName("borders"); - // layout.setSizeFull(); - final Label l = new Label(txt); - l.setContentMode(Label.CONTENT_XHTML); - // l.setWidth("100%"); - - TextField tf = new TextField("This is a textField"); - tf.setWidth("100%"); - - layout.addComponent(tf); - layout.addComponent(l); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2242.java b/src/com/vaadin/tests/tickets/Ticket2242.java deleted file mode 100644 index 0c1bf21a3f..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2242.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Item; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.data.util.ObjectProperty; -import com.vaadin.ui.Button; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2242 extends Application implements ValueChangeListener { - - private Object tableValue = null; - private Table t; - private String valueDataSource = "-"; - private ObjectProperty prop; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - Button b = new Button("Change container datasource", - new ClickListener() { - - public void buttonClick(ClickEvent event) { - for (int i = 0; i < 5; i++) { - t.setContainerDataSource(createContainer()); - // prop.setValue("ipsum"); - } - } - - }); - - layout.addComponent(b); - - t = new Table("A table"); - prop = new ObjectProperty(valueDataSource); - t.setPropertyDataSource(prop); - t.setSelectable(true); - t.setImmediate(true); - t.setPageLength(5); - t.setContainerDataSource(createContainer()); - tableValue = t.getValue(); - t.addListener(this); - - layout.addComponent(t); - } - - private IndexedContainer createContainer() { - IndexedContainer ic = new IndexedContainer(); - ic.addContainerProperty("a", String.class, null); - - for (String s : new String[] { "Lorem", "ipsum", "dolor", "sit", - "amet", "consectetuer" }) { - Item item = ic.addItem(s); - item.getItemProperty("a").setValue(s); - - } - - return ic; - } - - private static class TestObject { - public TestObject(int a, String b, Long c) { - super(); - this.a = a; - this.b = b; - this.c = c; - } - - private int a; - private String b; - private Long c; - - public int getA() { - return a; - } - - public void setA(int a) { - this.a = a; - } - - public String getB() { - return b; - } - - public void setB(String b) { - this.b = b; - } - - public Long getC() { - return c; - } - - public void setC(Long c) { - this.c = c; - } - } - - public void valueChange(ValueChangeEvent event) { - System.out.println("Value change from " + tableValue + " to " - + t.getValue()); - tableValue = t.getValue(); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2244.java b/src/com/vaadin/tests/tickets/Ticket2244.java deleted file mode 100644 index 4631f63cc4..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2244.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.util.BeanItem; -import com.vaadin.ui.Button; -import com.vaadin.ui.Form; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2244 extends Application { - - Form form; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - - GridLayout gl = new GridLayout(3, 3); - gl.setSpacing(true); - gl.addComponent(new Label("Before form")); - gl.newLine(); - - form = new Form(gl); - form.setItemDataSource(new BeanItem(new MyBean())); - - gl.addComponent(new Label("After form")); - - w.addComponent(form); - - w.addComponent(new Button("new item", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - form.setItemDataSource(new BeanItem(new MyBean())); - - } - - })); - w.addComponent(new Button("new bigger item", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - form - .setItemDataSource(new BeanItem( - new MyBiggerBean())); - - } - - })); - w.addComponent(new Button("new grid layout", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - form.setLayout(new GridLayout()); - - } - - })); - w.addComponent(new Button("new form layout", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - form.setLayout(new FormLayout()); - - } - - })); - - } - - public class MyBean { - String firstname; - String lastname; - String password; - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - } - - public class MyBiggerBean extends MyBean { - String address; - String phone; - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2245.java b/src/com/vaadin/tests/tickets/Ticket2245.java deleted file mode 100644 index 8232b7bc38..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2245.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.Window; - -public class Ticket2245 extends Application { - - @Override - public void init() { - Window main = new Window("The Main Window"); - main.getLayout().setSizeFull(); - setMainWindow(main); - SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_VERTICAL); - main.addComponent(sp); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2267.java b/src/com/vaadin/tests/tickets/Ticket2267.java deleted file mode 100644 index 2ccbce604a..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2267.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2267 extends Application { - - Label l = new Label("0"); - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - GridLayout gl = new GridLayout(4, 2); - - Button button = new Button("1", new ClickListener() { - - public void buttonClick(ClickEvent event) { - Button b = event.getButton(); - l.setValue(l.getValue() + b.getCaption()); - - } - - }); - - gl.addComponent(l, 0, 0, 3, 0); - gl.addComponent(button); - gl.addComponent(new Label("2")); - gl.addComponent(new Label("3")); - gl.addComponent(new Label("4")); - - w.setLayout(gl); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2271.java b/src/com/vaadin/tests/tickets/Ticket2271.java deleted file mode 100644 index 50a5466645..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2271.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComboBox; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class Ticket2271 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - - VerticalLayout ol = new VerticalLayout(); - ol.setWidth(null); - - ComboBox cb = new ComboBox("Asiakas"); - cb.setWidth("100%"); - - Button b = new Button("View CSV-tiedostoon"); - - ol.addComponent(cb); - ol.addComponent(b); - - layout.addComponent(ol); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2279.java b/src/com/vaadin/tests/tickets/Ticket2279.java deleted file mode 100644 index 06f2cb9348..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2279.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import com.vaadin.Application; -import com.vaadin.terminal.gwt.client.ui.AlignmentInfo; -import com.vaadin.ui.AbstractOrderedLayout; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Layout.AlignmentHandler; - -public class Ticket2279 extends Application { - - private Label label; - - private static Map<String, Integer> expected = new HashMap<String, Integer>(); - - private static Set<String> longHorizontalAlignments = new HashSet<String>(); - private static Set<String> shortHorizontalAlignments = new HashSet<String>(); - private static Set<String> longVerticalAlignments = new HashSet<String>(); - private static Set<String> shortVerticalAlignments = new HashSet<String>(); - - static { - expected.put("r", AlignmentInfo.Bits.ALIGNMENT_RIGHT); - expected.put("l", AlignmentInfo.Bits.ALIGNMENT_LEFT); - expected.put("c", AlignmentInfo.Bits.ALIGNMENT_HORIZONTAL_CENTER); - expected.put("t", AlignmentInfo.Bits.ALIGNMENT_TOP); - expected.put("b", AlignmentInfo.Bits.ALIGNMENT_BOTTOM); - expected.put("m", AlignmentInfo.Bits.ALIGNMENT_VERTICAL_CENTER); - - expected.put("right", AlignmentInfo.Bits.ALIGNMENT_RIGHT); - expected.put("left", AlignmentInfo.Bits.ALIGNMENT_LEFT); - expected.put("center", AlignmentInfo.Bits.ALIGNMENT_HORIZONTAL_CENTER); - expected.put("top", AlignmentInfo.Bits.ALIGNMENT_TOP); - expected.put("bottom", AlignmentInfo.Bits.ALIGNMENT_BOTTOM); - expected.put("middle", AlignmentInfo.Bits.ALIGNMENT_VERTICAL_CENTER); - - shortHorizontalAlignments.add("r"); - shortHorizontalAlignments.add("l"); - shortHorizontalAlignments.add("c"); - shortVerticalAlignments.add("t"); - shortVerticalAlignments.add("b"); - shortVerticalAlignments.add("m"); - - longHorizontalAlignments.add("right"); - longHorizontalAlignments.add("left"); - longHorizontalAlignments.add("center"); - longVerticalAlignments.add("top"); - longVerticalAlignments.add("bottom"); - longVerticalAlignments.add("middle"); - - } - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - AbstractOrderedLayout layout = (AbstractOrderedLayout) w.getLayout(); - - createUI(layout); - } - - private void createUI(Layout layout) { - VerticalLayout vl = new VerticalLayout(); - vl.setWidth("500px"); - vl.setHeight("500px"); - vl.setStyleName("borders"); - label = new Label("<b>Error messages follows:</b><br/>", - Label.CONTENT_XHTML); - vl.addComponent(label); - layout.addComponent(vl); - - testAlignments(vl); - - GridLayout gl = new GridLayout(1, 1); - gl.setWidth("500px"); - gl.setHeight("500px"); - gl.setStyleName("borders"); - label = new Label("<b>Error messages follows:</b><br/>", - Label.CONTENT_XHTML); - gl.addComponent(label); - layout.addComponent(gl); - - testAlignments(gl); - - } - - private void testAlignments(AlignmentHandler layout) { - HashSet<String> horizontals = new HashSet<String>(); - horizontals.addAll(shortHorizontalAlignments); - horizontals.addAll(longHorizontalAlignments); - - for (String horiz : horizontals) { - // Test "l","r","left","right" etc - int expectedHoriz = expected.get(horiz); - checkAlignment(layout, horiz, AlignmentHandler.ALIGNMENT_TOP - | expectedHoriz); - - for (String vert : shortVerticalAlignments) { - int expectedVert = expected.get(vert); - - // Test "lt","rt" etc - if (horiz.length() == 1) { - checkAlignment(layout, horiz + vert, expectedHoriz - | expectedVert); - checkAlignment(layout, vert + horiz, expectedHoriz - | expectedVert); - } else { - boolean ok = false; - try { - checkAlignment(layout, horiz + vert, expectedHoriz - | expectedVert); - } catch (IllegalArgumentException e) { - // OK, "centert","rightb" etc are not valid - ok = true; - } - if (!ok) { - error("IllegalArgumentException was not thrown for " - + horiz + vert); - } - ok = false; - try { - checkAlignment(layout, vert + horiz, expectedHoriz - | expectedVert); - } catch (IllegalArgumentException e) { - // OK, "centert","rightb" etc are not valid - ok = true; - } - if (!ok) { - error("IllegalArgumentException was not thrown for " - + horiz + vert); - } - - } - - // Test "l t","r t" etc - checkAlignment(layout, horiz + " " + vert, expectedHoriz - | expectedVert); - checkAlignment(layout, vert + " " + horiz, expectedHoriz - | expectedVert); - } - - for (String vert : longVerticalAlignments) { - int expectedVert = expected.get(vert); - - // Test "right t","right b" etc - checkAlignment(layout, horiz + " " + vert, expectedHoriz - | expectedVert); - checkAlignment(layout, vert + " " + horiz, expectedHoriz - | expectedVert); - - // Three alignments should throw an exception - boolean ok = false; - try { - checkAlignment(layout, horiz + " " + vert + " " + horiz, - expectedHoriz | expectedVert); - } catch (IllegalArgumentException e) { - // OK, "centert","rightb" etc are not valid - ok = true; - } - if (!ok) { - error("IllegalArgumentException was not thrown for " - + horiz + " " + vert + " " + horiz); - } - } - } - - checkAlignment(layout, "left right", AlignmentHandler.ALIGNMENT_TOP - | AlignmentHandler.ALIGNMENT_RIGHT); - } - - private void checkAlignment(AlignmentHandler layout, - String alignmentString, int expected) { - layout.setComponentAlignment(label, AlignmentInfo.Bits.ALIGNMENT_TOP, - AlignmentInfo.Bits.ALIGNMENT_LEFT); - if (layout instanceof AbstractOrderedLayout) { - ((AbstractOrderedLayout) layout).setComponentAlignment(label, - alignmentString); - } else { - ((GridLayout) layout).setComponentAlignment(label, alignmentString); - } - - int actual = layout.getComponentAlignment(label).getBitMask(); - if (actual != expected) { - String error = "Error " + alignmentString - + " did not produce expected results"; - error(error); - } else { - String str = layout.getClass().getSimpleName() + "/" - + alignmentString + ": OK"; - System.out.println(str); - } - - } - - private void error(String error) { - label.setValue(label.getValue() + error + "<br/>"); - System.out.println(error); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2282.java b/src/com/vaadin/tests/tickets/Ticket2282.java deleted file mode 100644 index 1e5924fced..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2282.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.FormLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2282 extends Application { - - private FormLayout layout1; - private FormLayout layout2; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - w.getLayout().setSizeUndefined(); - - layout1 = new FormLayout(); - layout1.setSizeUndefined(); - layout1.setStyleName("borders"); - Label label = new Label( - "This should not be wider than this label + reserved error space"); - label.setCaption("A caption"); - layout1.addComponent(label); - w.addComponent(layout1); - - layout2 = new FormLayout(); - layout2.setWidth("500px"); - layout2.setStyleName("borders"); - label = new Label("This should be 500px wide"); - label.setCaption("A caption"); - layout2.addComponent(label); - w.addComponent(layout2); - - Button b = new Button("Swap", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - if (layout1.getWidth() < 0.0) { - layout1.setWidth("500px"); - layout2.setWidth(null); - } else { - layout1.setWidth(null); - layout2.setWidth("500px"); - } - } - - }); - w.addComponent(b); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2283.java b/src/com/vaadin/tests/tickets/Ticket2283.java deleted file mode 100644 index 6504355676..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2283.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Layout.AlignmentHandler; - -public class Ticket2283 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - - GridLayout gl = new GridLayout(2, 2); - gl.setSizeUndefined(); - - gl.addComponent(new Label( - "Label 1 abc abc abcasdfas dfasd fasdf asdf sadf asdf")); - gl.addComponent(new Label("Label 2 abc abc abc ")); - Label l = new Label("Colspan2, align right"); - gl.addComponent(l, 0, 1, 1, 1); - gl.setComponentAlignment(l, AlignmentHandler.ALIGNMENT_RIGHT, - AlignmentHandler.ALIGNMENT_TOP); - w.setLayout(gl); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2287.java b/src/com/vaadin/tests/tickets/Ticket2287.java deleted file mode 100644 index cd6770e156..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2287.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.net.URL;
-
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-
-public class Ticket2287 extends Ticket2292 {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
- URL url = getURL();
- main
- .addComponent(new Label(
- "Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));
-
- Label l = new Label();
- l.setContentMode(Label.CONTENT_XHTML);
- l.setValue("This is a label with as slow image. <img src=\"" + url
- + "/icon.png\" />");
- main.addComponent(l);
-
- l = new Label();
- l.setContentMode(Label.CONTENT_XHTML);
- l.setValue("This is a label with as slow image. <img src=\"" + url
- + "/icon.png\" />");
- main.addComponent(l);
-
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2289.java b/src/com/vaadin/tests/tickets/Ticket2289.java deleted file mode 100644 index bd92311f73..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2289.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Accordion; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.CustomComponent; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2289 extends Application { - - TabSheet ts = null; - Accordion acc = null; - - @Override - public void init() { - - Window w = new Window(); - setMainWindow(w); - VerticalLayout ol = new VerticalLayout(); - w.setLayout(ol); - Button b = new Button("close current tab"); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - closeCurrentTab(); - - } - }); - ol.addComponent(b); - - b = new Button("close first tab"); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - closeFirstTab(); - - } - }); - - ol.addComponent(b); - ts = new TabSheet(); - ts.setSizeUndefined(); - ts.setWidth("300px"); - ts.addTab(new MyTab("tab one"), "Caption1", null); - ts.addTab(new MyTab("tab two"), "Caption2", null); - ts.addTab(new MyTab("tab three"), "Caption3", null); - ts.addTab(new MyTab("tab four"), "Caption4", null); - ts.addTab(new MyTab("tab five"), "Caption5", null); - - acc = new Accordion(); - acc.setSizeUndefined(); - acc.addTab(new MyTab("tab one"), "Caption1", null); - acc.addTab(new MyTab("tab two"), "Caption2", null); - acc.addTab(new MyTab("tab three"), "Caption3", null); - acc.addTab(new MyTab("tab four"), "Caption4", null); - - ol.addComponent(acc); - ts = null; - // ol.addComponent(ts); - - } - - private void closeCurrentTab() { - if (ts != null) { - MyTab m = (MyTab) ts.getSelectedTab(); - if (m != null) { - ts.removeComponent(m); - } - } - if (acc != null) { - MyTab m = (MyTab) acc.getSelectedTab(); - if (m != null) { - acc.removeComponent(m); - } - } - } - - private void closeFirstTab() { - if (ts != null) { - ts.removeComponent((Component) ts.getComponentIterator().next()); - } - if (acc != null) { - acc.removeComponent((Component) acc.getComponentIterator().next()); - } - } - -} - -class MyTab extends CustomComponent { - public MyTab(String text) { - setSizeUndefined(); - HorizontalLayout ol = new HorizontalLayout(); - setCompositionRoot(ol); - ol.addComponent(new Label(text)); - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2292.java b/src/com/vaadin/tests/tickets/Ticket2292.java deleted file mode 100644 index 9cd448a5c7..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2292.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-
-import javax.imageio.ImageIO;
-
-import com.vaadin.terminal.DownloadStream;
-import com.vaadin.terminal.ExternalResource;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Link;
-import com.vaadin.ui.Window;
-
-public class Ticket2292 extends com.vaadin.Application {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
-
- ExternalResource icon = new ExternalResource("./icon.png");
- main
- .addComponent(new Label(
- "Note, run with trailing slash in url to have a working icon. Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)"));
- Button b = new Button();
- main.addComponent(b);
- b.setIcon(icon);
-
- CheckBox checkBox = new CheckBox();
- main.addComponent(checkBox);
- checkBox.setIcon(icon);
-
- Link l = new Link("l", icon);
- main.addComponent(l);
-
- }
-
- @Override
- public DownloadStream handleURI(URL context, String relativeUri) {
- if (!relativeUri.contains("icon.png")) {
- return null;
- }
-
- // be slow to show bug
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- BufferedImage image = new BufferedImage(200, 200,
- BufferedImage.TYPE_INT_RGB);
- Graphics drawable = image.getGraphics();
- drawable.setColor(Color.lightGray);
- drawable.fillRect(0, 0, 200, 200);
- drawable.setColor(Color.yellow);
- drawable.fillOval(25, 25, 150, 150);
- drawable.setColor(Color.blue);
- drawable.drawRect(0, 0, 199, 199);
-
- // Use the parameter to create dynamic content.
- drawable.setColor(Color.black);
- drawable.drawString("Tex", 75, 100);
-
- try {
- // Write the image to a buffer.
- ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
- ImageIO.write(image, "png", imagebuffer);
-
- // Return a stream from the buffer.
- ByteArrayInputStream istream = new ByteArrayInputStream(imagebuffer
- .toByteArray());
- return new DownloadStream(istream, null, null);
- } catch (IOException e) {
- return null;
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2294.java b/src/com/vaadin/tests/tickets/Ticket2294.java deleted file mode 100644 index f6c8a14420..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2294.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Layout.AlignmentHandler; - -public class Ticket2294 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((OrderedLayout) w.getLayout()); - } - - private void createUI(OrderedLayout layout) { - Label label1 = new Label(); - Label label2 = null; - Label label3 = new Label(); - String result1 = ""; - String result2 = ""; - String result3 = ""; - - layout.addComponent(label1); - try { - layout.setComponentAlignment(label1, - AlignmentHandler.ALIGNMENT_LEFT, - AlignmentHandler.ALIGNMENT_BOTTOM); - result1 = "OK"; - } catch (Exception e) { - result1 = "FAILED: " + e.getMessage(); - } - - try { - layout.setComponentAlignment(label2, - AlignmentHandler.ALIGNMENT_LEFT, - AlignmentHandler.ALIGNMENT_BOTTOM); - result2 = "FAILED, no exception"; - } catch (IllegalArgumentException e) { - result2 = "OK"; - } catch (Exception e) { - result2 = "FAILED: " + e.getMessage(); - } - - try { - layout.setComponentAlignment(label3, - AlignmentHandler.ALIGNMENT_LEFT, - AlignmentHandler.ALIGNMENT_BOTTOM); - result3 = "FAILED, no exception"; - } catch (IllegalArgumentException e) { - result3 = "OK"; - } catch (Exception e) { - result3 = "FAILED: " + e.getMessage(); - } - - label1.setValue("Result 1: " + result1 + ", result 2: " + result2 - + ", result 3: " + result3); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2296.java b/src/com/vaadin/tests/tickets/Ticket2296.java deleted file mode 100644 index e4eb3e7a1d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2296.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.Window; - -public class Ticket2296 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - CustomLayout cl = new CustomLayout("Ticket2296"); - cl.setSizeFull(); - Button b = new Button("100%x100% button"); - b.setSizeFull(); - cl.addComponent(b, "button1"); - - b = new Button("100%x100% button"); - b.setSizeFull(); - cl.addComponent(b, "button2"); - - b = new Button("50%x50% button"); - b.setWidth("50%"); - b.setHeight("50%"); - cl.addComponent(b, "button3"); - - w.setLayout(cl); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2297.java b/src/com/vaadin/tests/tickets/Ticket2297.java deleted file mode 100644 index 48265ded63..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2297.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.net.URL;
-
-import com.vaadin.ui.CustomLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Window;
-
-public class Ticket2297 extends Ticket2292 {
-
- @Override
- public void init() {
- final Window main = new Window(getClass().getName().substring(
- getClass().getName().lastIndexOf(".") + 1));
- setMainWindow(main);
- URL url = getURL();
- main
- .addComponent(new Label(
- "Icon is built by servlet with a slow method, so it will show the bug (components not firing requestLayout)."));
-
- try {
- CustomLayout cl = new CustomLayout(
- new ByteArrayInputStream(
- ("This is an empty CustomLayout with as slow image. <img src=\""
- + url.toString() + "/icon.png\" />")
- .getBytes()));
- main.addComponent(cl);
-
- cl = new CustomLayout(
- new ByteArrayInputStream(
- ("This is an empty CustomLayout with as slow image. <img src=\""
- + url.toString() + "/icon.png\" />")
- .getBytes()));
- main.addComponent(cl);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2303.java b/src/com/vaadin/tests/tickets/Ticket2303.java deleted file mode 100644 index 927358723d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2303.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-import com.vaadin.Application;
-import com.vaadin.ui.CustomLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Window;
-
-public class Ticket2303 extends Application {
-
- @Override
- public void init() {
- Window w = new Window("main window");
-
- String customlayout = "<div location=\"test\"></div>";
- CustomLayout cl = null;
- try {
- cl = new CustomLayout(new ByteArrayInputStream(customlayout
- .getBytes()));
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- cl.setWidth("100%");
- w.setLayout(cl);
-
- // VerticalLayout ol = new VerticalLayout();
- // w.setLayout(ol);
- OrderedLayout hugeLayout = new OrderedLayout();
- hugeLayout.setMargin(true);
- hugeLayout.setSpacing(true);
- for (int i = 0; i < 30; i++) {
- hugeLayout.addComponent(new Label("huge " + i));
- }
- cl.addComponent(hugeLayout, "test");
- // ol.addComponent(hugeLayout);
- setMainWindow(w);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2304.java b/src/com/vaadin/tests/tickets/Ticket2304.java deleted file mode 100644 index 57c7acefc1..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2304.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; - -public class Ticket2304 extends Application { - - @Override - public void init() { - final Window main = new Window(getClass().getName().substring( - getClass().getName().lastIndexOf(".") + 1)); - setMainWindow(main); - - Panel p = new Panel(); - p.setStyleName(Panel.STYLE_LIGHT); - main.addComponent(p); - p.setHeight("100px"); - - Label l = new Label( - "a\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\n"); - l.setContentMode(Label.CONTENT_PREFORMATTED); - p.addComponent(l); - main.addComponent(new Label( - "This text should be right below the panel, w/o spacing")); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2310.java b/src/com/vaadin/tests/tickets/Ticket2310.java deleted file mode 100644 index 3318456afa..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2310.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2310 extends Application { - - @Override - public void init() { - final Window main = new Window(getClass().getName().substring( - getClass().getName().lastIndexOf(".") + 1)); - setMainWindow(main); - - main - .addComponent(new Label( - "Instructions: change label when panel is " - + "invisible -> invalid change (with disabled " - + "flag) is sent to client. Label is grey when panel is shown.")); - - final Panel p = new Panel(); - p.setStyleName(Panel.STYLE_LIGHT); - main.addComponent(p); - p.setHeight("100px"); - - final Label l = new Label("foobar"); - - p.addComponent(l); - - Button b = new Button("change label"); - - b.addListener(new Button.ClickListener() { - int i = 0; - - public void buttonClick(ClickEvent event) { - - l.setValue("foobar " + i++); - - } - }); - - Button b2 = new Button("toggle panel visibility"); - b2.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - p.setVisible(!p.isVisible()); - } - }); - - main.addComponent(b); - main.addComponent(b2); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2319.java b/src/com/vaadin/tests/tickets/Ticket2319.java deleted file mode 100644 index 9d61a27613..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2319.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class Ticket2319 extends Application { - - @Override - public void init() { - Window mainw = new Window(); - setMainWindow(mainw); - - mainw - .addComponent(new Label( - "This test has somewhat invalid layouts in it to detect analyzy layout function in debug dialog")); - - HorizontalLayout hl = new HorizontalLayout(); - Panel panel = new Panel("p1"); - Panel panel2 = new Panel("p2"); - hl.addComponent(panel); - hl.addComponent(panel2); - - mainw.addComponent(hl); - - hl = new HorizontalLayout(); - panel = new Panel("p1"); - panel.setSizeUndefined(); - panel.setHeight("100%"); - panel2 = new Panel("p2"); - panel2.setSizeUndefined(); - panel2.setHeight("100%"); - - hl.addComponent(panel); - hl.addComponent(panel2); - mainw.addComponent(hl); - - SplitPanel sp = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); - - VerticalLayout first = new VerticalLayout(); - first.addComponent(new Label("first")); - VerticalLayout second = new VerticalLayout(); - second.addComponent(new Label("second")); - - sp.setFirstComponent(first); - sp.setSecondComponent(second); - - SplitPanel sp2 = new SplitPanel(); - Label label = new Label("first"); - label.setSizeFull(); - sp2.setFirstComponent(label); - sp2.setSecondComponent(sp); - - sp2.setHeight("200px"); - - mainw.addComponent(sp2); - - mainw.addComponent(new Button("click me to save split panel state")); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2323.java b/src/com/vaadin/tests/tickets/Ticket2323.java deleted file mode 100644 index 4def857112..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2323.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.Window; - -public class Ticket2323 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - - Window subWindow = new Window(""); - subWindow.setSizeUndefined(); - subWindow.getLayout().setSizeUndefined(); - subWindow.center(); - subWindow.addComponent(new RichTextArea()); - w.addWindow(subWindow); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2325.java b/src/com/vaadin/tests/tickets/Ticket2325.java deleted file mode 100644 index 3b46d89a5e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2325.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class Ticket2325 extends Application { - - @Override - public void init() { - Window main = new Window("Testing...."); - setMainWindow(main); - - final VerticalLayout lo = new VerticalLayout(); - lo.setSizeUndefined(); - lo.setWidth("100%"); - TextField tf = new TextField(); - tf.setValue("The textfield should fill the window." - + "\n - Try to resize window\n - Try to push REdo button"); - tf.setRows(10); - tf.setWidth("100%"); - lo.addComponent(tf); - Window subWin = new Window( - "This window should initially be as wide as the caption", lo); - main.addWindow(subWin); - // subWin.setWidth("500px"); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2329.java b/src/com/vaadin/tests/tickets/Ticket2329.java deleted file mode 100644 index c55ab9cac5..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2329.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Table.ColumnGenerator; - -public class Ticket2329 extends Application { - private Table table; - private VerticalLayout mainLo; - - @Override - public void init() { - Window mainw = new Window(); - setMainWindow(mainw); - mainLo = (VerticalLayout) mainw.getLayout(); - table = new Table(); - for (int i = 0; i < 10000; i++) { - table.addItem(i); - } - TestColumnGenerator cgen = new TestColumnGenerator(); - table.addGeneratedColumn("col1", cgen); - table.addGeneratedColumn("col2", cgen); - table.addGeneratedColumn("col3", cgen); - table.addGeneratedColumn("col4", cgen); - table.addGeneratedColumn("col5", cgen); - table.addGeneratedColumn("col6", cgen); - table.addGeneratedColumn("col7", cgen); - table.setHeight("500px"); - mainLo.addComponent(table); - } - - class TestColumnGenerator implements ColumnGenerator { - public Component generateCell(Table source, Object rowId, - Object columnId) { - return new Button("1"); - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2337.java b/src/com/vaadin/tests/tickets/Ticket2337.java deleted file mode 100644 index aae4807277..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2337.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2337 extends Application { - - GridLayout gl = new GridLayout(3, 1); - - @Override - public void init() { - Window w = new Window(); - setMainWindow(w); - Button b = new Button("add", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - gl.addComponent(new Label("asd"), 0, gl.getCursorY(), 2, gl - .getCursorY()); - - } - - }); - w.addComponent(b); - - b = new Button("empty", new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - gl.removeAllComponents(); - ; - - } - - }); - w.addComponent(b); - - w.addComponent(gl); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2339.java b/src/com/vaadin/tests/tickets/Ticket2339.java deleted file mode 100644 index 6476807ada..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2339.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.io.ByteArrayInputStream; -import java.io.IOException; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.Window; - -public class Ticket2339 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window(getClass().getSimpleName()); - setMainWindow(mainWin); - - try { - CustomLayout cl = new CustomLayout( - new ByteArrayInputStream( - "<div style=\"width:400px;overflow:hidden;background-color:red;\"><div style=\"border:1em solid blue; height:4em; padding:1em 1.5em;\" location=\"b\"></div></div>" - .getBytes())); - Button button = new Button("b"); - button.setSizeFull(); - - cl.addComponent(button, "b"); - - mainWin.addComponent(cl); - - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2341.java b/src/com/vaadin/tests/tickets/Ticket2341.java deleted file mode 100644 index b6dd4cc1f0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2341.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.data.Item; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2341 extends com.vaadin.Application { - @Override - public void init() { - Window main = new Window(); - setMainWindow(main); - constructTables(main.getLayout()); - } - - private void constructTables(Layout layout) { - - Table t = createTable(); - layout.addComponent(t); - t = createTable(); - Label l = new Label("A high label to enable scrollbars"); - l.setHeight("2000px"); - layout.addComponent(l); - - } - - private Table createTable() { - Table t = new Table(); - t.addContainerProperty("test1", String.class, ""); - t.addContainerProperty("test2", String.class, ""); - t.addContainerProperty("test3", String.class, ""); - t.addContainerProperty("test4", String.class, ""); - t.setWidth("100%"); - t.setHeight("300px"); - for (int i = 0; i < 100; i++) { - Item item = t.addItem(i); - item.getItemProperty("test1").setValue("testing1 " + i); - item.getItemProperty("test2").setValue("testing2 " + i); - item.getItemProperty("test3").setValue("testing3 " + i); - item.getItemProperty("test4").setValue("testing4 " + i); - } - - return t; - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2344.java b/src/com/vaadin/tests/tickets/Ticket2344.java deleted file mode 100644 index cb36fbca9e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2344.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.Random; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Table; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class Ticket2344 extends Application { - - private Panel p; - - @Override - public void init() { - Window main = new Window("Quick test"); - - setMainWindow(main); - - // setTheme("quicktest"); - - VerticalLayout hl = new VerticalLayout(); - hl.setWidth("400px"); - main.setLayout(hl); - - Table t = new Table(); - t.setWidth("100%"); - - t.addContainerProperty("Prop 1", VerticalLayout.class, ""); - t.addContainerProperty("Prop 2", String.class, ""); - t.addContainerProperty("Prop 3", String.class, ""); - t.addContainerProperty("Prop 4", String.class, ""); - t.addContainerProperty("Prop 5", Button.class, ""); - - t.setPageLength(3); - - for (int i = 0; i < 10; i++) { - - VerticalLayout vl = new VerticalLayout(); - // vl.setWidth(null); - Button b = new Button("String 1 2 3"); - b.setStyleName(Button.STYLE_LINK); - vl.addComponent(b); - t.addItem(new Object[] { vl, "String 2", "String 3", "String 4", - - new Button("String 5") }, new Integer(new Random().nextInt())); - - } - - hl.addComponent(t); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2347.java b/src/com/vaadin/tests/tickets/Ticket2347.java deleted file mode 100644 index 08e1aae34c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2347.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.CustomLayout; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2347 extends Application { - - private Button b1; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - setTheme("tests-tickets"); - createUI((VerticalLayout) w.getLayout()); - } - - private void createUI(VerticalLayout layout) { - CustomLayout cl = new CustomLayout("Ticket2347"); - b1 = new Button("200px button"); - b1.addListener(new ClickListener() { - - public void buttonClick(ClickEvent event) { - if (b1.getWidth() == 200.0) { - b1.setWidth("300px"); - } else { - b1.setWidth("200px"); - - } - b1.setCaption(b1.getWidth() + "px button"); - - } - - }); - b1.setWidth("200px"); - Button b2 = new Button("100% button"); - b2.setWidth("100%"); - - cl.addComponent(b1, "button1"); - cl.addComponent(b2, "button2"); - - layout.addComponent(cl); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2364.java b/src/com/vaadin/tests/tickets/Ticket2364.java deleted file mode 100644 index 7f7290dd80..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2364.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Form; -import com.vaadin.ui.Select; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class Ticket2364 extends Application { - - @Override - public void init() { - - Window main = new Window("The Main Window!!!"); - setMainWindow(main); - Form form = new Form(); - VerticalLayout formLayout = new VerticalLayout(); - form.setLayout(formLayout); - Select formSelect = new Select("hello"); - Select select = new Select("hello"); - form.setEnabled(false); - select.setEnabled(false); - formLayout.addComponent(formSelect); - - VerticalLayout l2 = new VerticalLayout(); - l2.addComponent(new Select("hello")); - l2.setEnabled(false); - - form.setCaption("Form"); - main.addComponent(form); - l2.setCaption("VerticalLayout"); - main.addComponent(l2); - main.addComponent(select); - main.addComponent(new Select("Enabled=true select")); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2365.java b/src/com/vaadin/tests/tickets/Ticket2365.java deleted file mode 100644 index 1fee955e6b..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2365.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Panel; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2365 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window(getClass().getSimpleName()); - setMainWindow(mainWin); - - VerticalLayout lo = new VerticalLayout(); - lo.setSizeFull(); - mainWin.setLayout(lo); - - final Panel p = createMultilevelPanel(5, (Panel) null); - - Button b = new Button("Toggle parent level size"); - lo.addComponent(b); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - if (p.getWidth() > 0) { - p.setSizeUndefined(); - } else { - p.setSizeFull(); - } - } - }); - - lo.addComponent(p); - - lo.setExpandRatio(p, 1); - - } - - private Panel createMultilevelPanel(int i, Panel panel) { - if (panel == null) { - panel = new Panel("Panel level " + i); - panel.setSizeFull(); - panel.getLayout().setSizeFull(); - } - Panel p = new Panel("Panel level " + i--); - p.getLayout().setSizeFull(); - p.setSizeFull(); - panel.addComponent(p); - if (i > 0) { - createMultilevelPanel(i, p); - } - return panel; - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2398.java b/src/com/vaadin/tests/tickets/Ticket2398.java deleted file mode 100644 index dee0417eff..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2398.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.util.IndexedContainer; -import com.vaadin.ui.Label; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2398 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window(); - setMainWindow(mainWin); - - Table t = new Table(); - - IndexedContainer c = new IndexedContainer(); - - c.addItem("foo"); - - c.addContainerProperty("testcol1", Integer.class, new Integer(7)); - c.addContainerProperty("testcol2", String.class, "str"); - c.addContainerProperty("testcol3", String.class, null); - - c.addItem("bar"); - - t.setContainerDataSource(c); - - t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID); - - mainWin.addComponent(new Label( - "Both rows in table should have same data (default values)")); - - mainWin.addComponent(t); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2404.java b/src/com/vaadin/tests/tickets/Ticket2404.java deleted file mode 100644 index 478d8b7786..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2404.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Window; - -public class Ticket2404 extends Application { - - @Override - public void init() { - - GridLayout gl = new GridLayout(2, 2); - gl.setSizeFull(); - - Button bb = new Button("1st row on 2x2 GridLayout"); - bb.setSizeFull(); - gl.addComponent(bb, 0, 0, 1, 0); - for (int i = 0; i < 2; i++) { - Button b = new Button("" + i); - gl.addComponent(b); - b.setSizeFull(); - } - - setMainWindow(new Window("GridLayout test", gl)); - - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2405.java b/src/com/vaadin/tests/tickets/Ticket2405.java deleted file mode 100644 index 174d6e5d6c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2405.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.ui.Button; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class Ticket2405 extends Application { - - private Label label; - private SplitPanel split; - - @Override - public void init() { - - final Window root = new Window("VaadinTunes"); - root.setWidth("90%"); - root.setHeight("90%"); - root.center(); - - // We'll attach the window to the browser view already here, so we won't - // forget it later. - // browser.addWindow(root); - setMainWindow(root); - - root.getLayout().setSizeFull(); - root.getLayout().setMargin(false); - - // Top area, containing playback and volume controls, play status, view - // modes and search - HorizontalLayout top = new HorizontalLayout(); - // GridLayout top = new GridLayout(1, 1); - top.setWidth("100%"); - top.setMargin(false); - top.setSpacing(false); - - // Let's attach that one straight away too - root.addComponent(top); - - label = new Label( - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent porttitor porta lacus. Nulla tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin mollis turpis in mauris faucibus posuere. Nullam rutrum, nisi a fermentum tempus, lacus metus rutrum massa, a condimentum mauris justo a tortor. Mauris aliquet, ante quis ultricies posuere, sapien libero laoreet sem, a accumsan diam metus sed elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur vehicula metus nec turpis dignissim cursus. Suspendisse potenti. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nullam feugiat orci eget risus. Vestibulum at sem. "); - label.setWidth("100%"); - top.addComponent(label); - split = new SplitPanel(SplitPanel.ORIENTATION_HORIZONTAL); - split.setHeight("100%"); - Embedded image = new Embedded("An image", new ExternalResource( - "http://dev.itmill.com/chrome/site/toolkit-logo.png")); - image.setWidth("100%"); - root.addComponent(split); - ((VerticalLayout) root.getLayout()).setExpandRatio(split, 1.0f); - VerticalLayout vl = new VerticalLayout(); - split.addComponent(vl); - - vl.addComponent(new TextField("abc")); - vl.addComponent(image); - vl.setExpandRatio(image, 1.0f); - vl.setComponentAlignment(image, "bottom center"); - vl.setHeight("100%"); - // We'll need one splitpanel to separate the sidebar and track listing - Button bottomButton = new Button("Filler"); - bottomButton.setSizeFull(); - // root.addComponent(bottomButton); - - // The splitpanel is by default 100% x 100%, but we'll need to adjust - // our main window layout to accomodate the height - root.getLayout().setHeight("100%"); - // ((VerticalLayout) root.getLayout()).setExpandRatio(bottomButton, - // 1.0F); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2406.java b/src/com/vaadin/tests/tickets/Ticket2406.java deleted file mode 100644 index b4f8ec77cf..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2406.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; - -public class Ticket2406 extends Application { - - private Window w; - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - // setTheme("tests-tickets"); - createUI((VerticalLayout) w.getLayout()); - } - - private void createUI(VerticalLayout layout) { - w = new Window("A sub window"); - w.setSizeUndefined(); - getMainWindow().addWindow(w); - - VerticalLayout l = new VerticalLayout(); - l.setSizeFull(); - w.setLayout(l); - - Button b = new Button("Button 1"); - b.setSizeFull(); - b.addListener(new ClickListener() { - - public void buttonClick(ClickEvent event) { - w.setHeight("200px"); - } - - }); - l.addComponent(b); - - for (int i = 0; i < 5; i++) { - b = new Button("Button number " + (i + 2)); - b.setSizeFull(); - l.addComponent(b); - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2407.java b/src/com/vaadin/tests/tickets/Ticket2407.java deleted file mode 100644 index e095bb294c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2407.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.ui.Form;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-public class Ticket2407 extends com.vaadin.Application {
-
- @Override
- public void init() {
- final Window main = new Window("Ticket2407");
- setMainWindow(main);
-
- Form form = new Form(new VerticalLayout());
- TextField text = new TextField("This caption shall be visible");
- text.setRequired(true);
- form.addField("test", text);
- main.addComponent(form);
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2411.java b/src/com/vaadin/tests/tickets/Ticket2411.java deleted file mode 100644 index b402ced300..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2411.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Window;
-
-public class Ticket2411 extends Application {
-
- @Override
- public void init() {
- Window w = new Window(getClass().getSimpleName());
- setMainWindow(w);
-
- // VerticalLayout l = new VerticalLayout();
- GridLayout l = new GridLayout();
- w.setLayout(l);
-
- l.setHeight("504px");
-
- for (int i = 1; i <= 5; i++) {
- Button b = new Button("Button " + i
- + " should be 100px or 101px high");
- b.setHeight("100%");
- l.addComponent(b);
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket2415.java b/src/com/vaadin/tests/tickets/Ticket2415.java deleted file mode 100644 index 5c1d0c2a51..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2415.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Property; -import com.vaadin.data.Property.ValueChangeEvent; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket2415 extends Application { - - @Override - public void init() { - final Window main = new Window(""); - setMainWindow(main); - - final TextField tf = new TextField("Try to change me"); - main.addComponent(tf); - - tf.setImmediate(true); - tf.addListener(new Property.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - main.showNotification("New value = " + tf); - } - }); - - final TextField tf2 = new TextField("Try to change me"); - main.addComponent(tf2); - - tf2.setImmediate(true); - tf2.addListener(new Property.ValueChangeListener() { - - public void valueChange(ValueChangeEvent event) { - main.showNotification("New value = " + tf2); - } - }); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2420.java b/src/com/vaadin/tests/tickets/Ticket2420.java deleted file mode 100644 index e40d73877c..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2420.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.ProgressIndicator; -import com.vaadin.ui.Window; - -public class Ticket2420 extends Application { - - @Override - public void init() { - final Window main = new Window("Hello window"); - setMainWindow(main); - - main.setTheme("tests-tickets"); - - ProgressIndicator pi = new ProgressIndicator(); - pi.setCaption("Visible"); - pi.setIndeterminate(false); - pi.setValue(new Float(0.5)); - main.addComponent(pi); - - pi = new ProgressIndicator(); - pi.setCaption("Visible (indeterminate)"); - pi.setIndeterminate(true); - - main.addComponent(pi); - - main.addComponent(pi); - - pi = new ProgressIndicator(); - pi.setCaption("Visible (indeterminate, with .redborder css)"); - pi.addStyleName("redborder"); - pi.setIndeterminate(true); - - main.addComponent(pi); - - pi = new ProgressIndicator(); - pi.setCaption("Disabled "); - pi.setEnabled(false); - pi.setIndeterminate(true); - - main.addComponent(pi); - - pi = new ProgressIndicator(); - - pi.setCaption("Hidden (via css)"); - - pi.addStyleName("dispnone"); - - main.addComponent(pi); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2425.java b/src/com/vaadin/tests/tickets/Ticket2425.java deleted file mode 100644 index 75810137ad..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2425.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.Window; - -public class Ticket2425 extends Application { - - @Override - public void init() { - Window w = new Window(getClass().getSimpleName()); - setMainWindow(w); - - w.addComponent(new Label("No scrollbars should be visible anywhere")); - TabSheet ts = new TabSheet(); - ts.addTab(new Panel(), "Panel 1", null); - ts.addTab(new Panel(), "Panel 2", null); - - w.addComponent(ts); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2426.java b/src/com/vaadin/tests/tickets/Ticket2426.java deleted file mode 100644 index bbad5ef686..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2426.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class Ticket2426 extends Application { - - @Override - public void init() { - Window w = new Window(); - setMainWindow(w); - - final String content = "<select/>"; - - w.addComponent(new Label("CONTENT_DEFAULT: " + content, - Label.CONTENT_DEFAULT)); - w.addComponent(new Label("CONTENT_PREFORMATTED: " + content, - Label.CONTENT_PREFORMATTED)); - w.addComponent(new Label("CONTENT_RAW: " + content, Label.CONTENT_RAW)); - w - .addComponent(new Label("CONTENT_TEXT: " + content, - Label.CONTENT_TEXT)); - w.addComponent(new Label("CONTENT_XML: " + content, Label.CONTENT_XML)); - w.addComponent(new Label("CONTENT_XHTML: " + content, - Label.CONTENT_XHTML)); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2431.java b/src/com/vaadin/tests/tickets/Ticket2431.java deleted file mode 100644 index 5ab8486663..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2431.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.event.Action; -import com.vaadin.event.ShortcutAction; -import com.vaadin.event.Action.Handler; -import com.vaadin.event.ShortcutAction.KeyCode; -import com.vaadin.event.ShortcutAction.ModifierKey; -import com.vaadin.ui.Label; -import com.vaadin.ui.Window; - -public class Ticket2431 extends Application { - - @Override - public void init() { - - Window w = new Window(); - setMainWindow(w); - Label help = new Label( - "Use CTRL X to fire action, CTRL C to remove it (fails before fix)"); - - w.addComponent(help); - - w.addActionHandler(new Handler() { - - final ShortcutAction a1 = new ShortcutAction("action", KeyCode.X, - new int[] { ModifierKey.CTRL }); - final ShortcutAction a2 = new ShortcutAction("action", KeyCode.C, - new int[] { ModifierKey.CTRL }); - - Action[] actions = new Action[] { a1, a2 }; - - public Action[] getActions(Object target, Object sender) { - return actions; - } - - public void handleAction(Action action, Object sender, Object target) { - if (action == a1) { - getMainWindow().addComponent(new Label("CTRL X hit")); - } else { - actions = new Action[] { a2 }; - // annoyance, we need to repaint the panel or detect the - // action in presence in handler - getMainWindow().removeActionHandler(this); - getMainWindow().addActionHandler(this); - } - } - }); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2432.java b/src/com/vaadin/tests/tickets/Ticket2432.java deleted file mode 100644 index 635a356e49..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2432.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Alignment; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Layout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Layout.AlignmentHandler; -import com.vaadin.ui.Layout.SpacingHandler; - -public class Ticket2432 extends Application { - - @Override - public void init() { - - Window w = new Window(); - setMainWindow(w); - w.getLayout().setSizeFull(); - ((SpacingHandler) w.getLayout()).setSpacing(true); - - Layout layout = new GridLayout(3, 3); - populateLayout(layout); - w.addComponent(layout); - layout = new HorizontalLayout(); - populateLayout(layout); - w.addComponent(layout); - - } - - private static Alignment[] alignments = new Alignment[] { - Alignment.TOP_LEFT, Alignment.TOP_CENTER, Alignment.TOP_RIGHT, - Alignment.MIDDLE_LEFT, Alignment.MIDDLE_CENTER, - Alignment.MIDDLE_RIGHT, Alignment.BOTTOM_LEFT, - Alignment.BOTTOM_CENTER, Alignment.BOTTOM_RIGHT }; - - private void populateLayout(Layout layout) { - layout.setSizeFull(); - for (int i = 0; i < 9; i++) { - Label l = new Label("M"); - Alignment a = alignments[i]; - l.setCaption(a.getHorizontalAlignment() + " " - + a.getVerticalAlignment() + " " + a.getBitMask()); - layout.addComponent(l); - ((AlignmentHandler) layout).setComponentAlignment(l, a); - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2434.java b/src/com/vaadin/tests/tickets/Ticket2434.java deleted file mode 100644 index 5d4a884895..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2434.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.tests.TestForTablesInitialColumnWidthLogicRendering; -import com.vaadin.ui.Table; -import com.vaadin.ui.Window; - -public class Ticket2434 extends Application { - - @Override - public void init() { - - Window w = new Window(); - - setMainWindow(w); - - Table t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, - 50); - - t.setPageLength(0); - - t.addStyleName("bordered"); - - w.addComponent(t); - - setTheme("tests-tickets"); - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2436.java b/src/com/vaadin/tests/tickets/Ticket2436.java deleted file mode 100644 index 0d6a4a1444..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2436.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.PopupView; -import com.vaadin.ui.Window; - -public class Ticket2436 extends Application { - - public void init() { - final Window main = new Window(); - setMainWindow(main); - - final Button remover = new Button("Remove PopupView"); - final PopupView pv = new PopupView(new PopupView.Content() { - public String getMinimizedValueAsHTML() { - return "PopupView"; - } - - public Component getPopupComponent() { - return remover; - } - }); - - remover.addListener(new Button.ClickListener() { - public void buttonClick(Button.ClickEvent event) { - main.removeComponent(pv); - } - }); - - main.addComponent(pv); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2440.java b/src/com/vaadin/tests/tickets/Ticket2440.java deleted file mode 100644 index 16b8c3e707..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2440.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.net.URL; - -import com.vaadin.Application; -import com.vaadin.terminal.DownloadStream; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.terminal.URIHandler; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.Window; - -public class Ticket2440 extends Application { - - @Override - public void init() { - final Window main = new MainWindow(); - setMainWindow(main); - main - .addComponent(new Label( - "Clicking the link should open a new window that should receive the URI 'msg/hello' and add that a a Label to it's ui. Currently the Label ends up in this (main) window (try reloading). Console intentionally spams during the window finding/uri handling - looks, uhm, interesting.")); - } - - @Override - public Window getWindow(String name) { - System.err.println("Looking for " + name); - if ("msg".equals(name)) { - System.err - .println(" rest uri, returning new MainWindow with message from uri"); - MainWindow restWindow = new MainWindow(); - addWindow(restWindow); - return restWindow; - } - // If we already have the requested window, use it - Window w = super.getWindow(name); - if (w == null) { - // If no window found, create it - System.err.println(" new win"); - w = new MainWindow(); - w.setName(name); - addWindow(w); - return w; - } else { - System.err.println(" found win"); - return w; - } - - } - - private class MainWindow extends Window { - public MainWindow() { - super("Main window"); - - addComponent(new Link("new mainwin", new ExternalResource( - Ticket2440.this.getURL() + "msg/hello"), "_blank", -1, -1, - Window.BORDER_DEFAULT)); - - addURIHandler(new URIHandler() { - public DownloadStream handleURI(URL context, String relativeUri) { - System.err - .println((getMainWindow() == getWindow() ? "mainwin: " - : "subwin: ") - + context + ", " + relativeUri); - addComponent(new Label(relativeUri)); - return null; - } - }); - } - - @Override - public DownloadStream handleURI(URL context, String relativeUri) { - System.err.println("MainWindow.handleURI();"); - return super.handleURI(context, relativeUri); - } - - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket2526.java b/src/com/vaadin/tests/tickets/Ticket2526.java deleted file mode 100644 index 05528ef086..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2526.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket2526 extends Application { - - @Override - public void init() { - final Window main = new Window(); - setMainWindow(main); - Button b = new Button("Add windows"); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - main.addWindow(new Window()); - } - }); - main.addComponent(b); - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket2742.java b/src/com/vaadin/tests/tickets/Ticket2742.java deleted file mode 100644 index 11eb01e051..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2742.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - */ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.NativeSelect; -import com.vaadin.ui.Window; - -/** - * @author Risto Yrjänä / IT Mill Ltd. - * - */ -public class Ticket2742 extends Application { - - /* - * (non-Javadoc) - * - * @see com.vaadin.Application#init() - */ - @Override - public void init() { - Window mainWindow = new Window(); - setMainWindow(mainWindow); - - String shortString = "Short"; - String longString = "Very, very long"; - - HorizontalLayout hl = new HorizontalLayout(); - - for (int i = 0; i < 2; i++) { - NativeSelect ns = new NativeSelect(shortString); - ns.addItem(longString); - ns.setNullSelectionAllowed(false); - ns.select(longString); - hl.addComponent(ns); - } - mainWindow.addComponent(hl); - } - -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2901.java b/src/com/vaadin/tests/tickets/Ticket2901.java deleted file mode 100644 index 61537488ca..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2901.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Label; -import com.vaadin.ui.SplitPanel; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -/** - * With IE7 extra scrollbars appear in content area all though content fits - * properly. Scrollbars will disappear if "shaking" content a bit, like - * selecting tests in area. - */ -public class Ticket2901 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window("Test app to break layout in IE6"); - setMainWindow(mainWin); - - SplitPanel sp = new SplitPanel(); - - VerticalLayout l = new VerticalLayout(); - for (int i = 0; i < 100; i++) { - l.addComponent(new Label("Label" + i)); - } - sp.setFirstComponent(l); - - mainWin.setContent(sp); - - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/tickets/Ticket2998.java b/src/com/vaadin/tests/tickets/Ticket2998.java deleted file mode 100644 index 11fc3194b0..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket2998.java +++ /dev/null @@ -1,337 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-import java.util.Set;
-
-import com.vaadin.Application;
-import com.vaadin.data.Container;
-import com.vaadin.data.Validator;
-import com.vaadin.data.util.BeanItemContainer;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.DateField;
-import com.vaadin.ui.DefaultFieldFactory;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.Layout;
-import com.vaadin.ui.ListSelect;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-
-/**
- * Table layout is very slow in Firefox 3.0.10 when the table contains
- * components.
- *
- * This is adapted from the HbnContainer example application WorkoutLog.
- *
- * Other browsers are much faster.
- */
-public class Ticket2998 extends Application {
- private Table table;
- private WorkoutEditor editor = new WorkoutEditor(this);
- private VerticalLayout mainLayout;
-
- public class Workout implements Serializable {
- private Long id;
- private Date date = new Date();
- private String title = " -- new workout -- ";
- private float kilometers;
-
- private String trainingType;
-
- private Set<String> secondaryTypes;
-
- public Workout() {
- }
-
- public Long getId() {
- return id;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public float getKilometers() {
- return kilometers;
- }
-
- public void setKilometers(float kilometers) {
- this.kilometers = kilometers;
- }
-
- public String getTrainingType() {
- return trainingType;
- }
-
- public void setTrainingType(String trainingType) {
- this.trainingType = trainingType;
- }
-
- public void setSecondaryTypes(Set<String> secondaryTypes) {
- this.secondaryTypes = secondaryTypes;
- }
-
- public Set<String> getSecondaryTypes() {
- return secondaryTypes;
- }
-
- }
-
- public class WorkoutEditor extends Window {
-
- private DateField date = new DateField("Date");
- private TextField kilomiters = new TextField("Kilometers");
- private TextField title = new TextField("Title/note");
-
- private Workout run;
- private Ticket2998 workoutLog;
-
- public WorkoutEditor(Ticket2998 app) {
- super("Edit workout");
- workoutLog = app;
- Layout main = new VerticalLayout();
- setLayout(main);
- main.setSizeUndefined();
- main.setStyleName(Panel.STYLE_LIGHT);
-
- FormLayout form = new FormLayout();
- form.setSizeUndefined();
- date.setResolution(DateField.RESOLUTION_MIN);
- form.addComponent(date);
- form.addComponent(kilomiters);
- form.addComponent(title);
- main.addComponent(form);
-
- }
-
- public void loadRun(Workout run) {
- if (run == null) {
- close();
- } else {
- date.setValue(run.getDate());
- kilomiters.setValue(run.getKilometers());
- title.setValue(run.getTitle());
- if (getParent() == null) {
- workoutLog.getMainWindow().addWindow(this);
- }
- kilomiters.focus();
- this.run = run;
- }
- }
- }
-
- public class MyFieldFactory extends DefaultFieldFactory {
-
- private BeanItemContainer<String> trainingTypes;
-
- public MyFieldFactory(Ticket2998 app) {
- trainingTypes = new BeanItemContainer<String>(String.class);
- }
-
- @Override
- public Field createField(Container container, Object itemId,
- Object propertyId, Component uiContext) {
-
- /*
- * trainingType is manyToOne relation, give it a combobox
- */
- if (propertyId.equals("trainingType")) {
- return getTrainingTypeComboboxFor(itemId);
- }
-
- /*
- * Secondarytypes is manyToMany relation, give it a multiselect list
- */
- if (propertyId.equals("secondaryTypes")) {
- return getSecondaryTypesList(itemId);
- }
-
- final Field f = super.createField(container, itemId, propertyId,
- uiContext);
- if (f != null) {
- if (f instanceof TextField) {
- TextField tf = (TextField) f;
- tf.setWidth("100%");
- }
- if (propertyId.equals("kilometers")) {
- f.setWidth("4em");
- f.addValidator(new Validator() {
- public boolean isValid(Object value) {
- try {
- @SuppressWarnings("unused")
- float f = Float.parseFloat((String) value);
- return true;
- } catch (Exception e) {
- f.getWindow().showNotification(
- "Bad number value");
- f.setValue(0);
- return false;
- }
- }
-
- public void validate(Object value)
- throws InvalidValueException {
- // TODO Auto-generated method stub
-
- }
- });
- }
- if (propertyId.equals("date")) {
- ((DateField) f).setResolution(DateField.RESOLUTION_MIN);
- }
- }
- return f;
-
- }
-
- private Map<Object, ListSelect> workoutIdToList = new HashMap<Object, ListSelect>();
-
- private Field getSecondaryTypesList(Object itemId) {
- ListSelect list = workoutIdToList.get(itemId);
- if (list == null) {
- list = new ListSelect();
- list.setMultiSelect(true);
- list.addItem("Item1");
- list.addItem("Item2");
- list.addItem("Item3");
- list.addItem("Item4");
- list.addItem("Item5");
- // list.setContainerDataSource(trainingTypes);
- list.setRows(4);
- workoutIdToList.put(itemId, list);
- }
- return list;
- }
-
- private Map<Object, ComboBox> workoutIdToCombobox = new HashMap<Object, ComboBox>();
-
- private Field getTrainingTypeComboboxFor(Object itemId) {
- ComboBox cb = workoutIdToCombobox.get(itemId);
- if (cb == null) {
- final ComboBox cb2 = new ComboBox();
- cb2.addItem("value1");
- cb2.addItem("value2");
- cb2.addItem("value3");
- cb2.addItem("value4");
- cb2.setNewItemsAllowed(true);
-
- workoutIdToCombobox.put(itemId, cb2);
- cb = cb2;
- }
- return cb;
- }
- }
-
- @Override
- public void init() {
- buildView();
- setTheme("reindeer");
- }
-
- /**
- * Builds a simple view for application with Table and a row of buttons
- * below it.
- */
- private void buildView() {
-
- final Window w = new Window("Workout Log");
-
- // set theme and some layout stuff
- setMainWindow(w);
- w.getLayout().setSizeFull();
- w.getLayout().setMargin(false);
-
- Panel p = new Panel("Workout Log");
- p.setStyleName(Panel.STYLE_LIGHT);
- w.addComponent(p);
- mainLayout = new VerticalLayout();
- p.setLayout(mainLayout);
-
- populateAndConfigureTable();
-
- mainLayout.addComponent(table);
-
- // make table consume all extra space
- p.setSizeFull();
- mainLayout.setSizeFull();
- mainLayout.setExpandRatio(table, 1);
- table.setSizeFull();
- }
-
- protected void populateAndConfigureTable() {
- table = new Table();
-
- table.setWidth("100%");
- table.setSelectable(true);
- table.setImmediate(true);
- table.setColumnCollapsingAllowed(true);
- table.setColumnWidth("date", 200);
- table.setColumnWidth("kilometers", 100);
- // table.addListener(this);
- table.setTableFieldFactory(new MyFieldFactory(this));
-
- loadWorkouts();
-
- table.setEditable(true);
- }
-
- /**
- * Loads container to Table
- */
- protected void loadWorkouts() {
- final BeanItemContainer<Workout> cont;
- // Use plain HbnContainer
- cont = new BeanItemContainer<Workout>(Workout.class);
- table.setContainerDataSource(cont);
-
- // insert some sample data
- Calendar c = Calendar.getInstance();
- c.set(Calendar.MILLISECOND, 0);
- c.set(Calendar.SECOND, 0);
- c.set(Calendar.MINUTE, 0);
-
- String[] titles = new String[] { "A short easy one", "intervals",
- "very long", "just shaking legs after work",
- "long one with Paul", "test run" };
-
- c.add(Calendar.DATE, -1000);
-
- Random rnd = new Random();
-
- Workout r;
-
- for (int i = 0; i < 1000; i++) {
- r = new Workout();
- c.set(Calendar.HOUR_OF_DAY,
- 12 + (rnd.nextInt(11) - rnd.nextInt(11)));
- r.setDate(c.getTime());
- r.setTitle(titles[rnd.nextInt(titles.length)]);
- r.setKilometers(Math.round(rnd.nextFloat() * 30));
- r.setTrainingType("tt");
- c.add(Calendar.DATE, 1);
- cont.addBean(r);
- }
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket3146.java b/src/com/vaadin/tests/tickets/Ticket3146.java deleted file mode 100644 index 53600b9299..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket3146.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import com.vaadin.Application;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket3146 extends Application {
-
- Table table;
- TextField result;
-
- @Override
- public void init() {
- Window mainWindow = new Window("Test");
-
- table = new Table();
- table.addContainerProperty("Items", String.class, null);
- table.addItem(new String[] { "a" }, "a");
- table.addItem(new String[] { "b" }, "b");
- table.addItem(new String[] { "c" }, "c");
- for (int i = 1; i < 100; ++i) {
- table.addItem(new String[] { "Item " + i }, "Item " + i);
- }
- table.setMultiSelect(true);
- table.setSelectable(true);
- table.setImmediate(true);
- table.setHeight("200px");
- table.setWidth("200px");
- mainWindow.addComponent(table);
-
- Button clearButton = new Button("Clear selection",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- clearSelection();
- }
- });
- mainWindow.addComponent(clearButton);
- Button clearButton2 = new Button("Clear selection 2",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- clearSelection2();
- }
- });
- mainWindow.addComponent(clearButton2);
- Button clearButton3 = new Button("Clear selection 3",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- clearSelection3();
- }
- });
- mainWindow.addComponent(clearButton3);
- Button printButton = new Button("Print selection",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- printSelection();
- }
- });
- mainWindow.addComponent(printButton);
-
- result = new TextField();
- result.setHeight("200px");
- result.setWidth("200px");
- mainWindow.addComponent(result);
-
- setMainWindow(mainWindow);
- }
-
- void clearSelection() {
- table.setValue(null);
- }
-
- void clearSelection2() {
- table.setValue(new HashSet());
- }
-
- void clearSelection3() {
- table.unselect("a");
- table.unselect("b");
- table.unselect("c");
- }
-
- void printSelection() {
- String selection = "";
- for (Object item : (Collection) table.getValue()) {
- selection = selection + item + ' ';
- }
- result.setValue(selection);
- }
-
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket34.java b/src/com/vaadin/tests/tickets/Ticket34.java deleted file mode 100644 index beb6813d4d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket34.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.util.HashMap; -import java.util.Map; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Component; -import com.vaadin.ui.Label; -import com.vaadin.ui.Panel; -import com.vaadin.ui.TextField; -import com.vaadin.ui.UriFragmentUtility; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.UriFragmentUtility.FragmentChangedEvent; - -public class Ticket34 extends Application { - - private Map<String, Component> views = new HashMap<String, Component>(); - private VerticalLayout mainLayout; - private Component currentView; - private UriFragmentUtility reader; - - @Override - public void init() { - - buildViews(new String[] { "main", "view2", "view3" }); - - reader = new UriFragmentUtility(); - reader.addListener(new UriFragmentUtility.FragmentChangedListener() { - - public void fragmentChanged(FragmentChangedEvent event) { - getMainWindow().showNotification( - "Fragment now: " - + event.getUriFragmentUtility().getFragment()); - // try to change to view mapped by fragment string - setView(event.getUriFragmentUtility().getFragment()); - } - }); - - mainLayout = new VerticalLayout(); - mainLayout.setSizeFull(); - final Window mainWin = new Window( - "Test app for URI fragment management/reading", mainLayout); - setMainWindow(mainWin); - - // UriFragmentReader is 0px size by default, so it will not render - // anything on screen - mainLayout.addComponent(reader); - - setView("main"); - - } - - private void setView(String string) { - Component component = views.get(string); - if (component == null) { - getMainWindow().showNotification( - "View called " + string + " not found!"); - } else if (component != currentView) { - if (currentView != null) { - mainLayout.replaceComponent(currentView, component); - } else { - mainLayout.addComponent(component); - } - // give all extra space for view - mainLayout.setExpandRatio(component, 1); - currentView = component; - } - } - - private void buildViews(String[] strings) { - for (String string : strings) { - Panel p = new Panel(string); - p.setSizeFull(); - ((VerticalLayout) p.getLayout()).setSpacing(true); - p.addComponent(new Label("This is a simple test case for " - + "UriFragmentReader that can be used for" - + " adding linking, back/forward button " - + "and history support for ajax application. ")); - StringBuffer sb = new StringBuffer(); - sb.append("Available views : "); - for (String key : strings) { - sb.append(key); - sb.append(" "); - } - sb.append("Application will change to them from uri " - + "fragment or server initiated via textfield below."); - p.addComponent(new Label(sb.toString())); - - final TextField tf = new TextField( - "Type view name (will change to that " - + "view and change the uri fragment)"); - p.addComponent(tf); - Button b = new Button("Go!"); - p.addComponent(b); - b.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - String viewName = tf.getValue().toString(); - // fragmentChangedListener will change the view if possible - reader.setFragment(viewName); - } - }); - - views.put(string, p); - } - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket677.java b/src/com/vaadin/tests/tickets/Ticket677.java deleted file mode 100644 index ab945a2d8e..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket677.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.vaadin.tests.tickets;
-
-import com.vaadin.Application;
-import com.vaadin.data.Container;
-import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.ui.BaseFieldFactory;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.ComponentContainer;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.GridLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.OrderedLayout;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.Table;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
-
-public class Ticket677 extends Application {
-
- private static final Label info = new Label(
- "<li> keep debug window open to see variable changes"
- + "<li> disable root panel w/ toggle button"
- + "<li> toggle one of the subpanels"
- + "<li> we attempt to focus the subpanels first textfield"
- + "<li> focusing should fail (try tabbing as well) [worked previousy]"
- + "<li> no variable changes should be sent from disabled fields [changed sent previously]"
- + "<li> try further toggling and tabbing around",
- Label.CONTENT_RAW);
-
- Panel root = new Panel("Enabled");
- Panel one = new Panel("Enabled");
- Panel two = new Panel("Enabled");
- Form form;
- Table table;
-
- @Override
- public void init() {
- Window main = new Window();
- setMainWindow(main);
-
- main.addComponent(info);
-
- OrderedLayout l = new OrderedLayout(
- OrderedLayout.ORIENTATION_HORIZONTAL);
- main.addComponent(l);
-
- l.addComponent(new Button("Toggle root panel",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- toggle(root);
- }
- }));
- l.addComponent(new Button("Toggle panel one",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- toggle(one);
- }
- }));
- l.addComponent(new Button("Toggle panel two",
- new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- toggle(two);
- }
- }));
- l.addComponent(new Button("Toggle form", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- toggle(form);
- }
- }));
- l.addComponent(new Button("Toggle table", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- toggle(table);
- }
- }));
-
- root.setLayout(new GridLayout(2, 3));
- main.addComponent(root);
-
- TextField tf = new TextField("Enabled");
- tf.setImmediate(true);
- root.addComponent(tf);
- tf = new TextField("Disabled");
- tf.setImmediate(true);
- tf.setEnabled(false);
- root.addComponent(tf);
-
- root.addComponent(one);
- tf = new TextField("Enabled");
- tf.setImmediate(true);
- one.addComponent(tf);
- tf = new TextField("Disabled");
- tf.setImmediate(true);
- tf.setEnabled(false);
- one.addComponent(tf);
-
- root.addComponent(two);
- tf = new TextField("Enabled");
- tf.setImmediate(true);
- two.addComponent(tf);
- tf = new TextField("Disabled");
- tf.setImmediate(true);
- tf.setEnabled(false);
- two.addComponent(tf);
-
- form = new Form();
- form.setCaption("Enabled");
- form.setFieldFactory(new BaseFieldFactory() {
-
- @Override
- public Field createField(Item item, Object propertyId,
- Component uiContext) {
- Field f = super.createField(item, propertyId, uiContext);
- f.setEnabled(!"disabled".equals(propertyId));
- return f;
- }
-
- });
- form.setItemDataSource(new BeanItem(new MyBean()));
- root.addComponent(form);
-
- table = new Table("Enabled");
- table.setPageLength(7);
- table.addContainerProperty("Text", String.class, null);
- for (int i = 0; i < 150; i++) {
- Item item = table.addItem("Item" + i);
- Property p = item.getItemProperty("Text");
- p.setValue(i % 5 == 0 ? "enabled" : "disabled");
- }
-
- table.setFieldFactory(new BaseFieldFactory() {
-
- @Override
- public Field createField(Container container, Object itemId,
- Object propertyId, Component uiContext) {
- Field f = super.createField(container, itemId, propertyId,
- uiContext);
- Item item = container.getItem(itemId);
- Property p = item.getItemProperty(propertyId);
- if ("disabled".equals(p.getValue())) {
- f.setEnabled(false);
- }
- return f;
- }
-
- });
- table.setEditable(true);
- root.addComponent(table);
-
- }
-
- private void toggle(Component c) {
- boolean enable = "Disabled".equals(c.getCaption());
- c.setEnabled(enable);
- c.setCaption((enable ? "Enabled" : "Disabled"));
- if (c instanceof ComponentContainer) {
- TextField tf = (TextField) ((ComponentContainer) c)
- .getComponentIterator().next();
- tf.focus();
- }
- }
-
- class MyBean {
- boolean on = false;
- int number = 1;
- String rw = "read/write";
- String r = "read";
- String disabled = "disabled";
-
- public boolean isOn() {
- return on;
- }
-
- public void setOn(boolean on) {
- this.on = on;
- }
-
- public int getNumber() {
- return number;
- }
-
- public void setNumber(int number) {
- this.number = number;
- }
-
- public String getRw() {
- return rw;
- }
-
- public void setRw(String rw) {
- this.rw = rw;
- }
-
- public String getDisabled() {
- return disabled;
- }
-
- public void setDisabled(String disabled) {
- this.disabled = disabled;
- }
-
- public String getR() {
- return r;
- }
-
- }
-}
diff --git a/src/com/vaadin/tests/tickets/Ticket695.java b/src/com/vaadin/tests/tickets/Ticket695.java deleted file mode 100644 index a328133014..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket695.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.vaadin.tests.tickets; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -@SuppressWarnings("serial") -public class Ticket695 extends Application { - - @Override - public void init() { - final Window w = new Window("Serialization test #695"); - setMainWindow(w); - Button b = new Button("Serialize ApplicationContext"); - w.addComponent(b); - b.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - try { - ObjectOutputStream oos = new ObjectOutputStream(buffer); - long t = System.currentTimeMillis(); - oos.writeObject(getContext()); - w.showNotification("ApplicationContext serialized (" - + buffer.size() + "bytes) in " - + (System.currentTimeMillis() - t) + "ms"); - } catch (IOException e) { - e.printStackTrace(); - w - .showNotification("ApplicationContext serialization failed - see console for stacktrace"); - } - - } - }); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket736.java b/src/com/vaadin/tests/tickets/Ticket736.java deleted file mode 100644 index 45d46866a5..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket736.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Validator; -import com.vaadin.data.util.BeanItem; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Button; -import com.vaadin.ui.ExpandLayout; -import com.vaadin.ui.Form; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket736 extends Application { - - Address address = new Address(); - - @Override - public void init() { - - final Window mainWin = new Window("Test app for #736"); - setMainWindow(mainWin); - - mainWin.setTheme("example"); - - // Create form for editing address - final Form f = new Form(); - f.setItemDataSource(new BeanItem(address, new String[] { "name", - "street", "zip", "city", "state", "country" })); - f.setCaption("Office address"); - f.setIcon(new ThemeResource("../runo/icons/16/document.png")); - f.setDescription("Jep jpe, this is form description."); - mainWin.addComponent(f); - - // Select to use buffered mode for editing to enable commit and discard - f.setWriteThrough(false); - f.setReadThrough(false); - Button commit = new Button("Commit", f, "commit"); - Button discard = new Button("Discard", f, "discard"); - ExpandLayout ol = new ExpandLayout(OrderedLayout.ORIENTATION_HORIZONTAL); - ol.setHeight("3em"); - ol.addComponent(commit); - ol.setComponentAlignment(commit, ExpandLayout.ALIGNMENT_RIGHT, - ExpandLayout.ALIGNMENT_TOP); - ol.addComponent(discard); - f.setFooter(ol); - - // Add some validators for the form - f.getField("zip").addValidator(new IsInteger()); - f.getField("zip").setDescription("Jepjep"); - ((AbstractComponent) f.getField("zip")).setIcon(new ThemeResource( - "../runo/icons/16/folder.png")); - f.getField("state").addValidator(new IsValidState()); - f.getField("name").setRequired(true); - f.getField("street").setRequired(true); - f.getField("city").setRequired(true); - f.getField("zip").setRequired(true); - - // Debug form properties - final Panel formProperties = new Panel("Form properties"); - formProperties.setWidth(200); - final String[] visibleProps = { "required", "invalidAllowed", - "readOnly", "readThrough", "writeThrough", "invalidCommitted", - "validationVisible", "immediate" }; - for (int i = 0; i < visibleProps.length; i++) { - Button b = new Button(visibleProps[i], new MethodProperty(f, - visibleProps[i])); - b.setImmediate(true); - formProperties.addComponent(b); - } - mainWin.addComponent(formProperties); - - // Debug the internal state of the address-object - mainWin.addComponent(new Button("Show state of the address object", - new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - mainWin.showNotification(address.toString()); - } - })); - } - - /** Address pojo. */ - public class Address { - String name = ""; - String street = ""; - String zip = ""; - String city = ""; - String state = ""; - String country = ""; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getStreet() { - return street; - } - - public void setStreet(String street) { - this.street = street; - } - - public String getZip() { - return zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - @Override - public String toString() { - return name + "; " + street + "; " + city + " " + zip - + (state != null ? " " + state : "") + " " + country; - } - - } - - /** Simple validator for checking if the validated value is an integer */ - class IsInteger implements Validator { - - public boolean isValid(Object value) { - try { - Integer.parseInt("" + value); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException("'" + value - + "' is not a number"); - } - } - } - - /** Simple state validator */ - class IsValidState implements Validator { - - public boolean isValid(Object value) { - // Empty and null are accepted values - if (value == null || "".equals("" + value)) { - return true; - } - - // Otherwise state must be two capital letter combo - if (value.toString().length() != 2) { - return false; - } - return value.toString().equals(("" + value).toUpperCase()); - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException( - "State must be either two capital letter abreviation or left empty"); - } - } - } -} diff --git a/src/com/vaadin/tests/tickets/Ticket846.java b/src/com/vaadin/tests/tickets/Ticket846.java deleted file mode 100644 index 888906105d..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket846.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.data.Validator; -import com.vaadin.data.util.MethodProperty; -import com.vaadin.ui.Button; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; - -public class Ticket846 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window("Test app for #846"); - setMainWindow(mainWin); - - final TextField tx = new TextField("Integer"); - mainWin.addComponent(tx); - tx.setImmediate(true); - tx.addValidator(new Validator() { - - public boolean isValid(Object value) { - try { - Integer.parseInt("" + value); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - public void validate(Object value) throws InvalidValueException { - if (!isValid(value)) { - throw new InvalidValueException(value + " is not a number"); - } - } - }); - - final String[] visibleProps = { "required", "invalidAllowed", - "readOnly", "readThrough", "invalidCommitted", - "validationVisible" }; - for (int i = 0; i < visibleProps.length; i++) { - Button b = new Button(visibleProps[i], new MethodProperty(tx, - visibleProps[i])); - b.setImmediate(true); - mainWin.addComponent(b); - } - - // tx.setIcon(new ThemeResource("icons/16/folder.png")); - - mainWin.addComponent(new Button("Validate integer", - new Button.ClickListener() { - public void buttonClick( - com.vaadin.ui.Button.ClickEvent event) { - mainWin.showNotification("The field is " - + (tx.isValid() ? "" : "not ") + "valid"); - }; - })); - TextField caption = new TextField("Caption", new MethodProperty(tx, - "caption")); - caption.setImmediate(true); - mainWin.addComponent(caption); - } - -} diff --git a/src/com/vaadin/tests/tickets/Ticket932.java b/src/com/vaadin/tests/tickets/Ticket932.java deleted file mode 100644 index 6a8a459042..0000000000 --- a/src/com/vaadin/tests/tickets/Ticket932.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.vaadin.tests.tickets; - -import com.vaadin.Application; -import com.vaadin.ui.Button; -import com.vaadin.ui.Label; -import com.vaadin.ui.RichTextArea; -import com.vaadin.ui.TextField; -import com.vaadin.ui.Window; -import com.vaadin.ui.Button.ClickEvent; - -public class Ticket932 extends Application { - - @Override - public void init() { - - final Window mainWin = new Window("Test app for max length feature"); - setMainWindow(mainWin); - - final TextField tx = new TextField( - "Textfield with maxlenght 10, single row"); - tx.setImmediate(true); - tx.setMaxLength(10); - - final Label l = new Label(); - - Button b = new Button("Check value"); - b.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - l.setValue("Length: " + tx.getValue().toString().length() - + " Content: " + tx.getValue()); - } - }); - - mainWin.addComponent(tx); - mainWin.addComponent(b); - - final TextField tx2 = new TextField( - "Textfield with maxlenght 10, multirow "); - mainWin.addComponent(tx2); - tx2.setImmediate(true); - tx2.setRows(5); - tx2.setMaxLength(10); - - Button b2 = new Button("Check value"); - b2.addListener(new Button.ClickListener() { - - public void buttonClick(ClickEvent event) { - l.setValue("Length: " + tx2.getValue().toString().length() - + " Content: " + tx2.getValue()); - } - }); - - mainWin.addComponent(tx); - mainWin.addComponent(b); - - mainWin.addComponent(l); - - final RichTextArea rta = new RichTextArea(); - rta.setCaption("RTA with max lenght 10"); - - rta.setMaxLength(10); - - b = new Button("Check value"); - b.addListener(new Button.ClickListener() { - public void buttonClick(ClickEvent event) { - l.setValue("Length: " + rta.getValue().toString().length() - + " Content: " + rta.getValue()); - } - }); - - mainWin.addComponent(rta); - mainWin.addComponent(b); - - } - -} diff --git a/src/com/vaadin/tests/util/LogPrintWriter.java b/src/com/vaadin/tests/util/LogPrintWriter.java deleted file mode 100644 index 1f07a9c7ae..0000000000 --- a/src/com/vaadin/tests/util/LogPrintWriter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.vaadin.tests.util; - -import java.io.PrintWriter; -import java.io.Writer; - -/** - * Use for collecting HTTP response. - * - */ -public class LogPrintWriter extends PrintWriter { - - private final StringBuffer result = new StringBuffer(256); - - public LogPrintWriter(Writer out) { - super(out); - } - - @Override - public void print(String s) { - result.append(s); - super.print(s); - } - - @Override - public void write(String s) { - result.append(s); - super.write(s); - } - - public String getResult() { - return result.toString(); - } - -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/util/LoremIpsum.java b/src/com/vaadin/tests/util/LoremIpsum.java deleted file mode 100644 index 3dc775badf..0000000000 --- a/src/com/vaadin/tests/util/LoremIpsum.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.vaadin.tests.util; - -public class LoremIpsum { - private static final String LOREM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lacinia sollicitudin neque, vitae cursus eros scelerisque sit amet. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin sollicitudin tempus lorem, sed consectetur nibh ultrices nec. Ut tempus laoreet dolor non molestie. Quisque consectetur tellus ut tortor imperdiet semper. In tempor odio eu metus hendrerit pharetra. Aliquam erat volutpat. Aliquam erat volutpat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec sit amet turpis facilisis ipsum cursus viverra ut vitae turpis. Integer tincidunt sem id sem tristique a laoreet eros euismod. Ut quis leo vel neque pellentesque ullamcorper. Aliquam at fermentum justo. Sed eget laoreet elit. Pellentesque commodo dui quis metus ornare bibendum. Ut tempus, ipsum in euismod scelerisque, augue ante lacinia sem, scelerisque imperdiet felis lectus rhoncus felis.Fusce vitae nisl lorem, id ultricies massa. Phasellus augue eros, dapibus vel fermentum non, sodales id mi. Nulla tincidunt diam a justo ultricies vestibulum nec sed tellus. Morbi faucibus leo et odio condimentum at porttitor diam auctor. Aenean volutpat lacinia mauris. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean malesuada ullamcorper elit ut eleifend. Etiam tempor, mauris id aliquet tempor, erat felis rutrum eros, a aliquam dolor nunc nec enim. Sed enim dolor, tristique ut tempus vitae, elementum at velit. Duis vulputate ultricies risus, ac gravida erat tincidunt posuere. Pellentesque dapibus tincidunt rhoncus. Phasellus eleifend molestie eros. Praesent id imperdiet urna. Etiam fermentum interdum quam, in tempus quam condimentum at.Curabitur eget ultrices augue. Suspendisse potenti. Nam hendrerit, dolor eget adipiscing lobortis, enim risus dignissim orci, a imperdiet tellus nulla id nibh. Praesent eu dui sit amet nulla interdum dignissim vel quis ante. Sed a lectus metus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus eget ultrices neque. Cras adipiscing condimentum justo adipiscing consequat. In accumsan mollis sapien ut euismod. Nulla sodales pulvinar leo, nec condimentum leo vestibulum ut. Phasellus risus metus, aliquet quis porta at, imperdiet vitae metus. Proin nec odio odio. Quisque nec elit id lacus iaculis ullamcorper sit amet vel ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In non lacus sed libero euismod rhoncus. Suspendisse augue massa, ullamcorper at accumsan at, porttitor ac odio.Morbi imperdiet, lectus vehicula eleifend ornare, lectus arcu ullamcorper augue, a imperdiet eros augue id justo. Integer eget pretium lorem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cras vehicula leo eget metus consectetur viverra. Nullam a mi nisl, in lacinia metus. Curabitur mollis eleifend augue, consectetur imperdiet velit sagittis aliquet. In tempor tempor orci eu faucibus. Mauris nisi neque, vulputate eu dignissim eget, aliquet sed nibh. Mauris rhoncus elit eget lectus dignissim bibendum. Phasellus sed nunc lacus, nec aliquet elit. Fusce blandit, sem vitae gravida elementum, sem orci porttitor eros, id porta tortor massa ut velit. Nulla pretium mi at tortor porttitor sollicitudin.Ut gravida est at lectus eleifend non ultrices ligula blandit. Sed purus lectus, adipiscing ut mollis vel, interdum quis diam. Phasellus eget nibh augue. Fusce justo felis, facilisis in auctor ut, cursus et enim. Praesent hendrerit venenatis elit, iaculis cursus ligula auctor in. Proin mollis malesuada dolor at elementum. Maecenas sit amet leo odio. Integer ac enim in justo eleifend dapibus. Pellentesque consequat, libero congue sagittis pulvinar, odio eros porta quam, et aliquet dolor turpis non lacus. Sed eu risus nunc. Aliquam tempus nulla a purus auctor mattis. Nullam adipiscing nisl nec purus porttitor rutrum. Sed pellentesque tincidunt posuere. Nulla varius cursus eros. Phasellus vel neque at metus tempus placerat laoreet ac dolor. Nulla faucibus leo nisi, vel placerat lectus.Donec non leo lacinia metus euismod dignissim suscipit ut neque. Donec iaculis, lacus ut luctus bibendum, mi libero tristique sem, vel consectetur risus ligula in turpis. Nulla lorem justo, porttitor non sollicitudin at, pharetra non ante. Phasellus tristique, purus at luctus auctor, nisl neque congue lacus, eget convallis mauris libero sit amet arcu. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tellus quam, lobortis vitae commodo id, ultrices a augue. Nam tellus erat, varius vel iaculis et, fermentum ut tellus. Donec id urna orci. Curabitur eleifend hendrerit libero, id tempor dolor faucibus eu. Quisque aliquam sapien a tortor mollis sollicitudin. Duis augue erat, sagittis eget consequat vel, volutpat et augue. Sed vehicula mattis nisi, non porta elit imperdiet vitae. Curabitur scelerisque mollis lectus, consequat suscipit est ultricies sit amet. Aenean in sem libero, id adipiscing urna. Aenean eleifend posuere lorem in aliquet. Praesent arcu est, tristique quis adipiscing ac, tincidunt nec dui. Nunc sed leo quis justo posuere suscipit. Fusce vitae lectus vitae urna sodales aliquam.Sed velit purus, ullamcorper non interdum quis, facilisis eget tortor. Etiam vestibulum venenatis aliquet. Fusce felis felis, venenatis id tincidunt at, vehicula et erat. Curabitur eu sagittis nisl. Curabitur nisi sapien, venenatis nec pulvinar ut, tempor id diam. Suspendisse metus libero, placerat in fermentum a, aliquam id arcu. Nulla quis accumsan massa. Curabitur consectetur pulvinar sapien non consequat. Etiam sem dolor, posuere id laoreet a, tempor vel nisl. Fusce eu lacus orci. Pellentesque tellus dui, pulvinar nec egestas vitae, adipiscing euismod nunc. Mauris consequat felis sit amet justo pellentesque venenatis. Donec dignissim porta dolor, eget pellentesque lorem porta eu. Donec eget enim eu leo mattis ornare in ut libero. Maecenas sit amet ante mauris.Praesent ultrices diam id lectus viverra sed lobortis risus adipiscing. Nulla in risus est. Proin vitae dolor ligula, a placerat enim. Integer hendrerit erat tincidunt leo malesuada sit amet tincidunt justo mattis. Morbi ut neque urna, ut blandit erat. Donec eleifend justo ac augue ultrices consectetur. In rutrum, leo ac porttitor volutpat, neque mi lacinia diam, id fermentum risus neque vitae risus. Suspendisse in justo libero, eget ultrices nisl. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In sollicitudin, arcu et convallis fermentum, est tellus pellentesque neque, ac faucibus tellus orci non purus. Ut aliquet facilisis ullamcorper. Cras justo ipsum, mollis vel ultricies non, consectetur a libero.Aliquam erat volutpat. Nunc ut mauris eu lorem consequat placerat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse sapien nisi, pellentesque ut porttitor eget, auctor vitae massa. Fusce et euismod massa. In dolor enim, commodo vitae scelerisque sit amet, vulputate quis nibh. Donec ut mollis elit. Nullam placerat sem at urna euismod tempus vitae a mi. Curabitur ac sem non tortor dapibus euismod in et augue. Phasellus elit nisi, ornare eget aliquam et, convallis vitae eros. Vivamus vitae facilisis quam. Nullam a dolor sit amet ante sodales vulputate. Sed vel elit libero. Vestibulum vestibulum porttitor orci, a elementum risus congue in. Mauris ut justo sed dolor rhoncus viverra nec non eros. Phasellus dignissim, mi id laoreet venenatis, enim lacus pharetra arcu, sit amet consectetur velit elit hendrerit arcu. Integer hendrerit suscipit pretium. Proin orci quam, vehicula vel accumsan tempor, facilisis tempus tortor.Etiam et nunc id odio lobortis ornare ac eget lorem. Proin tristique iaculis felis, ut gravida lacus congue ut. Etiam nibh turpis, congue vel ornare ut, feugiat ut mi. Etiam id ante eget turpis laoreet dapibus. Vivamus accumsan sem at est lacinia sagittis vitae a erat. Etiam mollis justo et felis faucibus sodales. Etiam placerat felis sed ante sollicitudin dignissim. Nunc fringilla nunc in lacus ultricies rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed venenatis porta turpis dignissim tempor. Etiam consequat vulputate elementum. Sed augue lacus, aliquam eu ornare vel, aliquam at turpis.Ut lacinia velit odio. Nulla sapien tellus, fringilla dignissim porta sed, elementum eget diam. Quisque pulvinar commodo massa, vitae lobortis velit iaculis id. Vestibulum id dolor vel mauris auctor commodo id at odio. Suspendisse consectetur consequat erat. Aliquam in purus at sem pretium ultricies. In urna elit, porttitor vel gravida at, varius non nisi. Nullam id eros at lorem posuere ullamcorper eget in dui. Sed sit amet mi vel quam vestibulum imperdiet. Ut ullamcorper purus nibh, a commodo tortor. Phasellus pretium, nulla ut venenatis euismod, augue arcu volutpat nulla, id semper est purus eget urna. Vivamus pharetra diam ac ante cursus tempus.Cras in rhoncus felis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In semper leo sit amet nisi rutrum et interdum odio fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cras sollicitudin dui non risus iaculis a lobortis odio consequat. Sed consectetur nisl eu nisi pulvinar fermentum. Etiam placerat tincidunt pellentesque. Etiam luctus auctor nulla ac pulvinar. Pellentesque sit amet eros est. Sed hendrerit sem rhoncus purus rhoncus ullamcorper. Integer vitae commodo sem. Donec orci lectus, gravida sit amet viverra ut, suscipit eu odio. Vivamus ac dolor sit amet augue porttitor imperdiet nec quis mauris. Etiam luctus pharetra lectus sed mattis. Proin tincidunt ultricies dolor, at sagittis ante tincidunt ac.Morbi sit amet sem ut leo ornare luctus at sed odio. Donec vestibulum consequat consectetur. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Integer sit amet leo eget ipsum eleifend commodo et vel sapien. Donec vulputate facilisis nisi in bibendum. Vestibulum justo magna, mollis in varius a, malesuada id nisl. Vestibulum fermentum leo at ipsum euismod scelerisque. Donec id diam eget sapien varius ultricies. Quisque mollis vehicula lorem, vitae suscipit lorem gravida vel. Cras ipsum odio, pellentesque vitae molestie at, facilisis eget felis. Morbi gravida velit eget ante posuere id pharetra dolor vehicula. Praesent lectus sem, pretium sit amet eleifend non, ultricies vitae eros.Etiam consequat felis quis elit semper sed lobortis risus faucibus. Quisque diam ante, gravida ut mollis tristique, auctor ac mauris. Phasellus vestibulum sapien et justo sagittis sed dignissim dui sollicitudin. Maecenas egestas quam et odio mattis eu posuere est sagittis. Nulla nec posuere turpis. In mauris sapien, pharetra et placerat eu, dictum quis justo. Curabitur sit amet varius nulla. Cras feugiat erat quis ante aliquam blandit. In ac libero id massa dapibus ultrices. Donec non massa orci.In gravida justo vitae eros ultrices fringilla. Sed mi quam, lobortis eu pharetra nec, pulvinar eu justo. Sed ornare diam sed nulla pellentesque at tincidunt lacus cursus. Donec vel neque et urna euismod suscipit. Proin in tortor eget felis euismod ultrices. Nunc ut orci elit, vitae pellentesque ligula. Vivamus in mi felis, at congue nulla. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mattis, ligula id sollicitudin posuere, eros odio pellentesque felis, in auctor libero mi nec massa. Praesent fringilla pretium tempus. Sed quis leo nulla, a pretium mi. Sed malesuada quam eget lorem tristique eget accumsan libero auctor. Vestibulum metus nisl, rutrum vel ullamcorper scelerisque, ultrices cursus purus. Aliquam convallis sollicitudin elit at mattis. Phasellus vitae magna id quam laoreet gravida quis ac metus.Duis lobortis arcu a elit porta laoreet. Pellentesque at condimentum sapien. Maecenas rutrum eleifend quam, eu pellentesque quam tincidunt ac. Vivamus fermentum justo ac dui dapibus ut tempus massa congue. Phasellus fermentum placerat enim, et dignissim mi feugiat in. Etiam odio diam, mollis vitae viverra a, egestas eget arcu. Curabitur purus lectus, accumsan quis lobortis ut, faucibus ac magna. Vivamus consectetur, ligula sit amet convallis rhoncus, risus lorem scelerisque arcu, eu fermentum felis leo sit amet eros. In hac habitasse platea dictumst. Sed congue pretium erat, vel hendrerit velit dapibus ut. Aliquam porta porttitor nunc facilisis pretium. Aliquam tincidunt porttitor tincidunt. Sed at erat a arcu elementum dignissim nec et ipsum. In et magna erat. In hac habitasse platea dictumst. Nulla sit amet enim vitae magna ullamcorper auctor ac id lectus. Fusce id sapien massa.Fusce porta nisl non leo iaculis sed elementum purus viverra. Aenean vitae erat elit. Proin id tincidunt nibh. Fusce faucibus dignissim laoreet. Etiam volutpat ultricies magna in euismod. Quisque luctus malesuada massa, ac ullamcorper dui luctus quis. Mauris a felis ut urna blandit semper egestas vel dui. Nulla facilisi. Ut dapibus bibendum bibendum. Curabitur id facilisis tellus. Vestibulum arcu orci, pretium vestibulum accumsan ut, feugiat eget eros. Mauris dapibus sem a massa ornare id posuere purus ornare. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Phasellus mollis, orci ac eleifend pharetra, risus turpis euismod urna, ut congue neque nunc ut felis. Aliquam a nisi leo. Nulla consequat faucibus ligula consectetur tristique. Duis at lacus orci, eget pulvinar tortor.Aenean nisi justo, dictum ac sagittis a, mollis ut orci. Donec faucibus congue neque ut gravida. Nam interdum nunc vel ipsum molestie elementum. Aliquam a eros non mi accumsan lacinia ut eu justo. Donec id ipsum purus, sed congue nunc. Donec euismod ante quis metus interdum feugiat. Sed nec dictum neque. Vivamus sed felis non lorem placerat facilisis eu sit amet nisi. Morbi dolor dolor, malesuada eu congue at, sollicitudin ut metus. In sit amet ipsum purus, ut dignissim dolor. Pellentesque quis velit velit. Aenean dapibus ipsum eu felis placerat volutpat. Donec auctor dictum ligula ut facilisis. Aliquam vulputate nunc nec diam ultricies auctor dictum dui fringilla. Cras urna metus, porttitor et sodales eu, tempus non mauris. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.Etiam tempor, mi ut tempor adipiscing, nunc lorem gravida odio, scelerisque aliquet ante massa id nibh. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus eu nisl urna. Quisque vel leo in lorem bibendum bibendum ut eget massa. Morbi dictum, metus eu pellentesque lobortis, augue nisi facilisis velit, sit amet feugiat risus nunc vitae elit. Fusce blandit mi a augue gravida eu tristique sem consequat. Suspendisse non malesuada nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Quisque commodo lorem id ipsum cursus posuere. Proin euismod facilisis est, vel imperdiet lectus commodo blandit. Proin luctus dapibus purus, id vulputate mauris tincidunt vel. Vestibulum volutpat molestie nulla faucibus malesuada. Aenean ut ornare lectus.Maecenas vel mauris in dolor imperdiet gravida eu nec mi. Vestibulum varius sem et nibh aliquet eu posuere tellus luctus. Fusce blandit, odio ut gravida semper, tellus lorem porta felis, vitae posuere mi lorem eget magna. Sed tristique nisi ut ipsum adipiscing molestie. Donec volutpat nunc eget neque posuere aliquam. Vivamus vel sem lectus. In volutpat dictum eros. Curabitur mollis pretium arcu ut rhoncus. Vivamus eros risus, sagittis posuere suscipit sit amet, consectetur eget elit. Mauris porttitor feugiat magna, sed lobortis ante porttitor at. Etiam non enim quam, nec tempus erat. Ut porta pharetra nibh vel laoreet. Sed euismod elit eget sem tempus non sodales massa cursus. Aliquam erat volutpat. Nulla a tortor ornare nibh feugiat venenatis. Mauris interdum mattis odio eget porta. Maecenas ac ullamcorper velit. Nulla id sagittis ligula. Aliquam pharetra, diam ut euismod pellentesque, sapien ligula sagittis nisi, sed dictum dolor purus sit amet elit.Aenean quis metus velit. In at fermentum nunc. Cras in magna sapien, sed vestibulum lacus. Sed pellentesque, massa sed malesuada tincidunt, erat tortor consectetur lacus, vel congue arcu enim id libero. Donec elit neque, egestas a faucibus ut, tempor nec diam. Donec turpis est, vulputate id venenatis vitae, vulputate sit amet elit. Ut semper nibh orci. Fusce nibh nisi, tristique eu dapibus id, faucibus nec augue. Sed sagittis malesuada leo, pretium porttitor ante lacinia in. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.Sed quis libero ante, ac consequat nisl. Cras nisl urna, ultrices eu dapibus sed, pretium quis diam. Curabitur aliquam, dolor et convallis viverra, purus orci commodo neque, a sagittis felis tellus quis mi. In mi orci, tempus ut sodales imperdiet, condimentum ac tortor. Phasellus ornare, tortor eget egestas ultricies, est risus ultricies lorem, ac tempus nibh ligula ac ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec fermentum nibh vitae tortor laoreet sed rutrum arcu suscipit. Fusce iaculis nisl in justo pretium a interdum ipsum dignissim. Sed sed semper metus. Aenean ante turpis, fermentum vestibulum dapibus eget, dictum id leo. Nam nec lorem erat.Cras dolor nulla, suscipit nec viverra ac, egestas vitae enim. Quisque vel laoreet sem. Sed non felis at nisl ultricies pharetra vitae a lorem. Suspendisse tempor arcu id massa laoreet congue. Nam eu turpis justo, nec adipiscing tortor. Etiam mattis lorem tincidunt diam molestie semper. Vivamus rutrum est in tortor egestas consequat. Sed vitae ultrices leo. Aenean pulvinar malesuada enim, eget elementum purus bibendum a. Vivamus sit amet mauris mauris, placerat varius lorem. Sed diam tortor, posuere non convallis molestie, dictum quis libero. Nulla quis tellus a nunc semper elementum vel sed odio. Cras ac mattis lectus. Proin placerat imperdiet sodales. Fusce quis magna dolor, eget porttitor lectus. Mauris elementum lorem vitae lectus porta scelerisque nec a sapien. Vivamus dapibus volutpat leo nec vehicula. Praesent ac diam ipsum.Pellentesque nec ullamcorper nulla. Nam lectus dolor, porttitor vitae varius sed, egestas a arcu. Suspendisse malesuada venenatis erat nec consequat. Morbi consequat magna a neque ultrices eget aliquet sapien ultrices. Aenean vel diam ipsum, ac scelerisque dui. Morbi quis arcu neque, eget auctor enim. Etiam pretium est sit amet nunc porta ornare vel quis sapien. Aliquam pulvinar pharetra risus, vel mollis mauris cursus sed. In sagittis nisl ac nunc placerat bibendum. Proin in risus lorem, sed fringilla eros.Proin luctus aliquam metus vitae euismod. Maecenas hendrerit sollicitudin hendrerit. Etiam magna elit, fringilla ut suscipit at, viverra eget ante. Morbi consequat, dui non tristique varius, eros ipsum vulputate sem, eu tristique nibh lacus vel felis. Maecenas eget eros a urna consectetur interdum. Integer est nibh, semper sed feugiat quis, lacinia eget diam. In ultricies mollis lectus sed imperdiet. Proin sed magna nec tortor blandit lacinia in sit amet nibh. Nullam ultrices tempor lacus, vel tincidunt eros vulputate euismod. Praesent justo nibh, convallis ut vehicula consequat, molestie posuere nulla. Mauris sollicitudin egestas vestibulum. Suspendisse auctor imperdiet eros, sit amet dignissim magna dapibus in. Praesent ultrices sem et risus interdum vel pharetra dolor tristique. Proin eleifend nunc eget risus venenatis posuere. Sed est nisi, interdum porta dapibus a, laoreet ac mi. Praesent sit amet varius lectus. Phasellus suscipit lacinia velit, sed tempus odio varius at. Fusce eleifend elementum aliquet. Proin ultricies libero at ipsum condimentum rhoncus.Quisque convallis, arcu at vehicula imperdiet, velit eros posuere sem, sit amet pulvinar purus massa a tellus. Maecenas cursus neque in dolor facilisis ac aliquam ligula eleifend. Fusce quis faucibus nisl. Fusce pulvinar magna vel enim scelerisque id cursus tortor faucibus. Nunc est turpis, iaculis ac sodales non, euismod vitae nunc. Fusce felis purus, iaculis dapibus mollis quis, condimentum consequat eros. Ut a lectus nec mi lacinia fringilla. Donec eget metus lectus, et rhoncus enim. Donec pharetra malesuada enim at rutrum. Vestibulum tincidunt gravida viverra. Vestibulum commodo sem nisl.Vivamus iaculis mollis arcu, quis dapibus risus semper quis. Quisque consectetur ullamcorper arcu id lacinia. Proin non tellus tellus. Nunc vehicula, arcu in pharetra feugiat, ante ante viverra urna, at convallis ligula odio id purus. Morbi quis orci non ante imperdiet luctus. Maecenas et ipsum est, at viverra sem. Morbi placerat ultrices imperdiet. Nullam id arcu at quam mollis hendrerit eu ac lectus. Etiam a neque sed turpis vestibulum posuere. Ut elementum tincidunt nulla at pellentesque. Integer nisl nunc, faucibus non sollicitudin eu, vestibulum ut nulla. In auctor est blandit purus rhoncus et sagittis eros convallis. Mauris sodales ultricies varius. Nulla facilisi. Donec ut nisl nunc, id accumsan erat. Praesent gravida molestie lobortis. In suscipit nisi sed elit sagittis tristique. Pellentesque vitae ante elit. Nullam diam est, ultrices vitae molestie at, tempus et magna. In hac habitasse platea dictumst.Vestibulum id tristique quam. Vivamus dui nulla, pretium eget elementum et, pulvinar a diam. Sed sed arcu sapien, et pharetra nisl. Nunc dignissim, lectus ac fringilla cursus, risus ante pretium justo, nec molestie sem urna id velit. Aenean tincidunt felis sed risus vestibulum ultricies. Aliquam lacinia scelerisque hendrerit. Morbi tincidunt molestie sapien sed faucibus. Vivamus et nisl velit, in semper libero. Duis elementum, dolor eget euismod porttitor, tortor eros tristique risus, eget posuere purus leo venenatis leo. Quisque in elit hendrerit felis accumsan gravida id sed sem.Sed massa turpis, interdum eget adipiscing a, tempor non enim. Vivamus sit amet purus tortor, quis tincidunt nunc. Nam vehicula dolor vitae est bibendum sed condimentum nisl pretium. Aenean pellentesque egestas lacinia. Vestibulum id felis sapien, vestibulum pharetra mauris. Donec quis ligula quis risus ultrices pharetra ac et quam. Nunc aliquam adipiscing mauris id euismod. Suspendisse potenti. Ut pharetra tristique pellentesque. Fusce tristique nisl vitae eros adipiscing lobortis. Ut porttitor porttitor est, vel euismod mi feugiat quis. Sed bibendum lacus vel sem hendrerit a ultricies sapien mattis.Vestibulum a tempus urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean tincidunt interdum dui, in accumsan ante placerat non. Aliquam suscipit eros eget quam ullamcorper consequat. Nulla facilisi. Phasellus porttitor interdum quam nec mattis. Etiam vitae diam vel est tempus aliquam eu et tellus. Phasellus lobortis porttitor mi, eu mollis augue tempus eu. Morbi a urna id nibh faucibus dictum. Sed hendrerit fringilla nunc vel elementum. Donec vel massa vitae nibh imperdiet vestibulum. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vestibulum in velit lorem, eu posuere felis. Maecenas ornare posuere faucibus. Donec dignissim ante eu neque suscipit interdum. Pellentesque ultrices dictum quam, tempor tempus leo posuere eget. Vestibulum dictum interdum urna, at feugiat neque venenatis ac. Donec tempus dictum enim, nec tempor neque rhoncus vel.Sed mollis luctus leo sed mattis. Vestibulum tempor mattis vehicula. Duis id elementum libero. Integer condimentum tincidunt molestie. Aenean quam tortor, rutrum sit amet placerat sed, sollicitudin eget turpis. In hac habitasse platea dictumst. Mauris lacinia mollis rhoncus. Fusce nec tellus elementum magna congue ultricies. Nulla consequat, dui nec facilisis hendrerit, ligula sapien viverra velit, at tempor risus leo vestibulum risus. Cras volutpat molestie orci ullamcorper gravida. Nullam est nisi, tempus et tincidunt ut, dapibus vitae nibh. Nam scelerisque purus sit amet odio imperdiet mattis. Integer ut ultrices odio.Cras placerat turpis nisl. Quisque consectetur urna vel nunc faucibus dictum. Nunc ac varius mauris. In ut egestas purus. Sed arcu nibh, mollis vitae dapibus eget, consectetur sit amet eros. Curabitur tincidunt purus sagittis neque adipiscing pretium. Aliquam tempor ullamcorper lectus. Cras quis elit et sapien euismod dapibus vitae in urna. Aliquam adipiscing urna non elit suscipit hendrerit. Mauris euismod tincidunt tortor eu vestibulum. Praesent ac quam massa. Fusce vitae viverra justo. Phasellus vel posuere augue. Praesent sagittis auctor odio in cursus. Sed vel lacus velit, vitae eleifend leo. Donec dapibus ornare mauris ut imperdiet. Nullam a sem felis, in commodo ligula. Nunc sed justo id metus bibendum pretium. Fusce lacinia lorem at leo ultricies porta.Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi non ipsum nisi, at porta ipsum. Nulla dolor lacus, auctor eget tincidunt et, tempor in velit. Cras vel diam facilisis dolor sagittis sodales. In hac habitasse platea dictumst. Donec dignissim vulputate tempor. Fusce tristique vestibulum vehicula. Integer nec erat a risus semper ultrices nec ac eros. Phasellus egestas, risus eget suscipit iaculis, mi magna posuere urna, in sollicitudin odio leo nec lorem. Ut at enim nunc, eget pellentesque ipsum. Nam at ipsum et magna tempor gravida vestibulum ut diam. Aenean aliquam scelerisque blandit. Cras sapien sem, consectetur a laoreet at, mattis vel lorem. Maecenas enim mauris, hendrerit ac imperdiet in, hendrerit a justo. Vestibulum justo metus, adipiscing at pulvinar at, scelerisque at velit. Aliquam sodales feugiat tortor ullamcorper cursus. Quisque tortor felis, sodales eu bibendum in, pellentesque eget urna.Nullam ultricies congue nisi nec blandit. Nulla nisl mi, aliquet vel dictum in, pellentesque fringilla arcu. Nam vulputate iaculis pellentesque. Morbi faucibus, augue vitae aliquam fringilla, ipsum tellus lacinia ligula, a luctus mauris orci id nulla. Vestibulum commodo, diam eget tincidunt iaculis, leo ante suscipit ligula, convallis scelerisque quam augue quis libero. Pellentesque vulputate ultricies eros a porta. In hac habitasse platea dictumst. Quisque at sem vel nisl pellentesque pellentesque at imperdiet turpis. Sed quis sem non nulla pellentesque placerat. Etiam sed ultricies nisl. Nunc vel leo augue, vitae fringilla urna. Suspendisse eget dolor enim, sed interdum lorem. Etiam imperdiet, nunc a tempor elementum, ipsum ante sodales tortor, id dignissim arcu diam vitae metus.Sed tincidunt fringilla mauris a lobortis. Morbi mollis elementum purus ac auctor. Etiam malesuada sapien vehicula magna fringilla sit amet porta sem scelerisque. Vestibulum malesuada ante nunc. Curabitur laoreet commodo mauris eu tempor. Sed hendrerit, lorem vel scelerisque aliquam, metus ligula ultricies ante, at luctus neque risus ut nisi. Suspendisse lectus sapien, tempor eget volutpat non, tempor at orci. Aenean eu est metus, vel convallis augue. Integer aliquam turpis id neque posuere tincidunt. Morbi at ante felis, ac semper diam. Etiam iaculis sapien a mauris tempus semper. Nunc ut leo nec massa tincidunt sodales id sed justo. Fusce sed blandit turpis. Pellentesque scelerisque laoreet luctus.Integer lobortis sollicitudin sapien, vel consequat augue hendrerit ut. Quisque pretium, enim condimentum ornare viverra, est nisl convallis lacus, vel varius turpis mi a eros. Curabitur eget enim non quam condimentum lobortis id sit amet dolor. Aliquam in ligula ut nisi accumsan consectetur. Pellentesque blandit ultrices magna, eget posuere dui eleifend ut. Quisque ornare, ante eget iaculis rutrum, nisi dolor tincidunt diam, eget volutpat nibh sapien vel massa. Sed viverra pulvinar lectus et commodo. Sed lacus mauris, aliquet ut tristique at, feugiat sit amet lectus. Duis lacinia purus a lacus accumsan tristique. Donec felis nunc, egestas ut porttitor ac, vulputate at purus. Quisque euismod nibh sit amet metus ullamcorper a consequat ipsum luctus. Mauris vitae sapien tristique lorem mollis porta auctor vitae leo.Donec mauris nibh, elementum a tincidunt nec, volutpat vitae enim. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque at purus quis massa vulputate mollis ut eu risus. Cras libero diam, pharetra quis ultrices facilisis, tincidunt id arcu. Praesent at volutpat quam. Phasellus quis malesuada sapien. Nullam eu leo quam, bibendum sagittis turpis. Vestibulum sagittis accumsan enim ut tristique. Donec eu enim nisi. Curabitur mauris orci, fringilla et suscipit placerat, ullamcorper vel turpis. Mauris est arcu, gravida ac accumsan ac, tincidunt vel nibh. Mauris pulvinar massa tempor dui hendrerit vel elementum diam pulvinar. Sed felis leo, laoreet at laoreet nec, venenatis eu risus. Nunc a massa lacus. Vestibulum ut pellentesque sem. Donec consectetur, turpis consequat aliquam consectetur, leo nunc lobortis elit, at sagittis ipsum risus sed turpis. Vivamus at sollicitudin purus. Nulla facilisi.Morbi congue dignissim nibh ut commodo. Integer sed urna fermentum neque hendrerit aliquam ac et tortor. Phasellus massa sem, egestas sed tincidunt id, malesuada vel odio. Nulla arcu nisl, elementum at pretium interdum, pharetra at nulla. Vestibulum lectus ante, ultricies ac lacinia euismod, adipiscing at metus. Aliquam velit orci, posuere a dapibus dapibus, consectetur vitae est. Pellentesque suscipit pulvinar varius. Morbi sagittis blandit nulla, eu posuere arcu blandit eu. Nulla cursus nunc volutpat orci commodo aliquet. Quisque condimentum dui a mi facilisis tincidunt.Quisque ac nisi vitae ipsum condimentum luctus non quis erat. Pellentesque eget nunc sit amet ipsum pharetra vulputate ac in mi. Etiam consectetur nulla vitae risus pharetra a ornare ligula sagittis. Proin euismod mauris id lectus tincidunt luctus at sed ligula. Aenean porttitor hendrerit quam quis interdum. Suspendisse eu metus turpis, ut venenatis ipsum. Nulla ipsum orci, lacinia ac vestibulum ut, mattis quis eros. Pellentesque a velit et erat sodales ornare. Pellentesque pellentesque tortor eget magna facilisis accumsan. Praesent tincidunt posuere lacus sed sollicitudin. Praesent consectetur diam vel turpis elementum vehicula. Integer rutrum dignissim justo, ac dapibus quam fringilla non. Suspendisse porta elementum bibendum. Praesent at lorem at quam dignissim commodo. Etiam placerat euismod ipsum eu interdum. Aliquam in mi molestie justo varius venenatis eu aliquam quam. Integer feugiat, neque hendrerit egestas hendrerit, lectus ligula placerat enim, a faucibus ante ligula vitae mi. Praesent urna nunc, volutpat vitae scelerisque non, porta vel dolor. Aenean quam sem, dignissim at faucibus non, auctor sodales libero.Morbi justo elit, tempus ac cursus porta, eleifend nec odio. Ut nec quam velit. Duis elit nulla, placerat et rutrum quis, tempor non nisi. Quisque massa erat, pretium ut elementum sit amet, sodales vel metus. Phasellus sollicitudin sapien vel nisl faucibus ornare. Duis ut dolor arcu, vel semper felis. In quis orci mauris, id porttitor diam. Fusce ornare, dolor in posuere blandit, neque est mollis lacus, eu venenatis nisi orci vel diam. Etiam ornare sapien eu sapien tristique vitae consequat arcu consequat. Fusce a felis at dui sollicitudin pellentesque sit amet vel mi. Curabitur congue porttitor orci, eu auctor nibh mollis at. Nulla facilisi. Nam aliquet ullamcorper metus ac vulputate. Aenean feugiat purus vitae dui congue egestas. Curabitur sollicitudin leo eget nibh facilisis fermentum fermentum non nisi. Ut at libero eget est bibendum laoreet non eu ante. Proin pellentesque quam ut augue condimentum id suscipit risus tristique. Nunc laoreet risus elit.Suspendisse vel ante elit, eu feugiat diam. Etiam ultrices condimentum tempor. Donec eget porta lacus. Nunc in velit lacus, ut ultricies felis. Nulla id cursus metus. Praesent suscipit, orci a facilisis imperdiet, eros lectus eleifend nibh, sit amet auctor magna arcu ac enim. In malesuada volutpat felis a posuere. Aliquam mattis ipsum ut quam semper aliquet. Maecenas convallis consequat magna, blandit viverra nulla consectetur sit amet. Pellentesque id velit nec risus iaculis imperdiet ac accumsan metus. Suspendisse et sem massa. Vestibulum ac enim hendrerit est tincidunt ullamcorper.Curabitur placerat, libero id molestie vehicula, neque tortor vulputate sapien, ut blandit orci metus et nibh. Cras convallis justo a nibh iaculis ut convallis neque vestibulum. Duis gravida purus metus, nec viverra leo. In tincidunt elit sit amet orci lacinia non eleifend orci tincidunt. Praesent est metus, molestie a ullamcorper ultricies, cursus imperdiet augue. Sed vitae quam eu dui pellentesque dignissim. Curabitur convallis volutpat accumsan. Donec egestas malesuada est, vitae faucibus sem fermentum id. Donec porttitor rutrum vehicula. Nulla placerat risus in est egestas nec ultrices ligula auctor. Quisque erat lorem, ullamcorper vitae interdum sit amet, laoreet vel elit. Proin eu porta neque. Pellentesque eleifend, ipsum a sollicitudin ultrices, ligula nisl aliquet dui, eget fermentum quam mi vel."; - - public static String get(int len) { - return LOREM.substring(0, len); - } - - public static String get() { - return LOREM; - } -}
\ No newline at end of file diff --git a/src/com/vaadin/tests/util/RandomComponents.java b/src/com/vaadin/tests/util/RandomComponents.java deleted file mode 100644 index fdfb878e04..0000000000 --- a/src/com/vaadin/tests/util/RandomComponents.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.vaadin.tests.util; - -import java.util.ArrayList; -import java.util.Random; - -import com.vaadin.automatedtests.util.MultiListener; -import com.vaadin.data.Container.ItemSetChangeListener; -import com.vaadin.data.Container.PropertySetChangeListener; -import com.vaadin.data.Property.ValueChangeListener; -import com.vaadin.demo.featurebrowser.ButtonExample; -import com.vaadin.demo.featurebrowser.ClientCachingExample; -import com.vaadin.demo.featurebrowser.ComboBoxExample; -import com.vaadin.demo.featurebrowser.EmbeddedBrowserExample; -import com.vaadin.demo.featurebrowser.JavaScriptAPIExample; -import com.vaadin.demo.featurebrowser.LabelExample; -import com.vaadin.demo.featurebrowser.LayoutExample; -import com.vaadin.demo.featurebrowser.NotificationExample; -import com.vaadin.demo.featurebrowser.RichTextExample; -import com.vaadin.demo.featurebrowser.SelectExample; -import com.vaadin.demo.featurebrowser.TableExample; -import com.vaadin.demo.featurebrowser.TreeExample; -import com.vaadin.demo.featurebrowser.ValueInputExample; -import com.vaadin.demo.featurebrowser.WindowingExample; -import com.vaadin.terminal.ExternalResource; -import com.vaadin.terminal.ThemeResource; -import com.vaadin.tests.StressComponentsInTable; -import com.vaadin.ui.AbstractComponent; -import com.vaadin.ui.Button; -import com.vaadin.ui.ComponentContainer; -import com.vaadin.ui.DateField; -import com.vaadin.ui.Embedded; -import com.vaadin.ui.GridLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Link; -import com.vaadin.ui.OrderedLayout; -import com.vaadin.ui.Panel; -import com.vaadin.ui.Select; -import com.vaadin.ui.TabSheet; -import com.vaadin.ui.TextField; - -public class RandomComponents { - - private Random seededRandom = new Random(1); - - public RandomComponents() { - - } - - public void setRandom(Random rand) { - seededRandom = rand; - } - - /** - * Get random component container - * - * @param caption - * @return - */ - public ComponentContainer getRandomComponentContainer(String caption) { - ComponentContainer result = null; - final int randint = seededRandom.nextInt(5); - switch (randint) { - - case 0: - result = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL); - ((OrderedLayout) result).setCaption("OrderedLayout_horizontal_" - + caption); - break; - case 1: - result = new OrderedLayout(OrderedLayout.ORIENTATION_VERTICAL); - ((OrderedLayout) result).setCaption("OrderedLayout_vertical_" - + caption); - break; - case 2: - GridLayout gl; - if (seededRandom.nextInt(1) > 0) { - gl = new GridLayout(); - } else { - gl = new GridLayout(seededRandom.nextInt(3) + 1, seededRandom - .nextInt(3) + 1); - } - gl.setCaption("GridLayout_" + caption); - gl.setDescription(gl.getCaption()); - for (int x = 0; x < gl.getColumns(); x++) { - for (int y = 0; y < gl.getRows(); y++) { - // gl.addComponent(getExamplePicture("x=" + x + ", y=" + y), - // x, y); - gl.addComponent(new Label("x=" + x + ", y=" + y)); - } - } - result = gl; - break; - case 3: - result = new Panel(); - ((Panel) result).setCaption("Panel_" + caption); - break; - case 4: - final TabSheet ts = new TabSheet(); - ts.setCaption("TabSheet_" + caption); - // randomly select one of the tabs - final int selectedTab = seededRandom.nextInt(3); - final ArrayList tabs = new ArrayList(); - for (int i = 0; i < 3; i++) { - String tabCaption = "tab" + i; - if (selectedTab == i) { - tabCaption = "tabX"; - } - tabs.add(new OrderedLayout()); - ts.addTab((ComponentContainer) tabs.get(tabs.size() - 1), - tabCaption, null); - } - ts.setSelectedTab((ComponentContainer) tabs.get(selectedTab)); - result = ts; - break; - } - - return result; - } - - public AbstractComponent getRandomComponent(int caption) { - AbstractComponent result = null; - int randint = seededRandom.nextInt(23); - MultiListener l = new MultiListener(); - switch (randint) { - case 0: - // Label - result = new Label(); - result.setCaption("Label component " + caption); - break; - case 1: - // Button - result = new Button(); - result.setCaption("Button component " + caption); - // some listeners - ((Button) result).addListener((Button.ClickListener) l); - break; - case 2: - // TextField - result = new TextField(); - result.setCaption("TextField component " + caption); - break; - case 3: - // Select - result = new Select("Select component " + caption); - result.setCaption("Select component " + caption); - result.setImmediate(true); - ((Select) result).setNewItemsAllowed(true); - // items - ((Select) result).addItem("first"); - ((Select) result).addItem("first"); - ((Select) result).addItem("first"); - ((Select) result).addItem("second"); - ((Select) result).addItem("third"); - ((Select) result).addItem("fourth"); - // some listeners - ((Select) result).addListener((ValueChangeListener) l); - ((Select) result).addListener((PropertySetChangeListener) l); - ((Select) result).addListener((ItemSetChangeListener) l); - break; - case 4: - // Link - result = new Link("", new ExternalResource("http://www.vaadin.com")); - result.setCaption("Link component " + caption); - break; - case 5: - // Link - result = new Panel(); - result.setCaption("Panel component " + caption); - ((Panel) result) - .addComponent(new Label( - "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.")); - ((Panel) result).setWidth(250); - break; - case 6: - // Datefield - result = new DateField(); - ((DateField) result).setStyleName("calendar"); - ((DateField) result).setValue(new java.util.Date()); - result.setCaption("Calendar component " + caption); - break; - case 7: - // Datefield - result = new DateField(); - ((DateField) result).setValue(new java.util.Date()); - result.setCaption("Calendar component " + caption); - break; - case 8: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new ButtonExample()); - break; - case 9: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new ClientCachingExample()); - break; - case 10: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new ComboBoxExample()); - break; - case 11: - result = new OrderedLayout(); - // TODO: disabled gwt bug with mixed up iframe's - ((OrderedLayout) result).addComponent(new EmbeddedBrowserExample()); - break; - case 12: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new JavaScriptAPIExample()); - break; - case 13: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new LabelExample()); - break; - case 14: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new LayoutExample()); - break; - case 15: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new NotificationExample()); - break; - case 16: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new RichTextExample()); - break; - case 17: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new SelectExample()); - break; - case 18: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new ValueInputExample()); - break; - case 19: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new WindowingExample()); - break; - case 20: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new TreeExample()); - break; - case 21: - result = new OrderedLayout(); - ((OrderedLayout) result).addComponent(new TableExample()); - break; - case 22: - result = new OrderedLayout(); - ((OrderedLayout) result) - .addComponent(new StressComponentsInTable()); - break; - } - - return result; - } - - /** - * Add demo components to given container - * - * @param container - */ - public void fillLayout(ComponentContainer container, int numberOfComponents) { - for (int i = 0; i < numberOfComponents; i++) { - container.addComponent(getRandomComponent(i)); - } - } - - public AbstractComponent getExamplePicture(String caption) { - final ThemeResource res = new ThemeResource("test.png"); - final Embedded em = new Embedded("Embedded " + caption, res); - return em; - } - -} diff --git a/src/com/vaadin/tests/util/TestClickListener.java b/src/com/vaadin/tests/util/TestClickListener.java deleted file mode 100644 index 730452ac72..0000000000 --- a/src/com/vaadin/tests/util/TestClickListener.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.vaadin.tests.util; - -import java.util.HashMap; - -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; - -public class TestClickListener implements Button.ClickListener { - - private static final HashMap buttonListeners = new HashMap(); - - String name = ""; - int count = 0; - - public TestClickListener(String name) { - Integer count = null; - try { - count = (Integer) buttonListeners.get(name); - count = new Integer(count.intValue() + 1); - buttonListeners.put(name, count); - } catch (Exception e) { - count = new Integer(1); - buttonListeners.put(name, count); - } - - this.name = name; - this.count = count.intValue(); - - System.out.println("Created listener " + name + ", id=" + count); - } - - public void buttonClick(ClickEvent event) { - System.out - .println("ClickEvent from listener " + name + ", id=" + count); - } - -} diff --git a/src/com/vaadin/tests/vaadin_spin.swf b/src/com/vaadin/tests/vaadin_spin.swf Binary files differdeleted file mode 100644 index 9e58ce29c6..0000000000 --- a/src/com/vaadin/tests/vaadin_spin.swf +++ /dev/null diff --git a/src/com/vaadin/tests/validation/RequiredErrorMessage.java b/src/com/vaadin/tests/validation/RequiredErrorMessage.java deleted file mode 100644 index 7f5048bd80..0000000000 --- a/src/com/vaadin/tests/validation/RequiredErrorMessage.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.vaadin.tests.validation; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Form; -import com.vaadin.ui.TextField; -import com.vaadin.ui.VerticalLayout; -import com.vaadin.ui.Window; - -public class RequiredErrorMessage extends TestBase { - - @Override - protected Integer getTicketNumber() { - return 2442; - } - - @Override - protected String getDescription() { - return "This test verifies that the tooltip for a required field contains the requiredError message if such has been given. The tooltip for the first field should contain a message, the second field has no required error message set"; - } - - @Override - public void setup() { - - final Window main = new Window(getClass().getName()); - setMainWindow(main); - - final Form form = new Form(new VerticalLayout()); - final TextField requiredFieldWithError = new TextField( - "Field with requiredError"); - requiredFieldWithError.setRequired(true); - requiredFieldWithError - .setRequiredError("Error message for required field"); - form.addField("field1", requiredFieldWithError); - - final TextField requiredFieldNoError = new TextField( - "Field without requiredError"); - requiredFieldNoError.setRequired(true); - form.addField("field2", requiredFieldNoError); - - final TextField requiredFieldDescriptionAndError = new TextField( - "Field with requiredError and description"); - requiredFieldDescriptionAndError.setRequired(true); - requiredFieldDescriptionAndError - .setRequiredError("Error message for required field"); - requiredFieldDescriptionAndError - .setDescription("Description message for the field"); - form.addField("field3", requiredFieldDescriptionAndError); - - main.addComponent(form); - } - -} diff --git a/src/com/vaadin/tests/validation/RequiredIndicatorForReadOnly.java b/src/com/vaadin/tests/validation/RequiredIndicatorForReadOnly.java deleted file mode 100644 index 6e806b60f4..0000000000 --- a/src/com/vaadin/tests/validation/RequiredIndicatorForReadOnly.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.vaadin.tests.validation; - -import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Form; -import com.vaadin.ui.TextField; - -public class RequiredIndicatorForReadOnly extends TestBase { - - @Override - protected String getDescription() { - return "Required flags should not be visible when a component is in read-only mode or inside a read-only form"; - } - - @Override - protected Integer getTicketNumber() { - return 2465; - } - - @Override - protected void setup() { - TextField tf = new TextField("A read only field"); - tf.setReadOnly(true); - tf.setRequired(true); - addComponent(tf); - - Form f = new Form(); - TextField tf2 = new TextField("A field in a read only form"); - tf2.setRequired(true); - f.addField("Field-1", tf2); - f.setReadOnly(true); - addComponent(f); - } -} diff --git a/src/com/vaadin/tests/validation/TestValidators.java b/src/com/vaadin/tests/validation/TestValidators.java deleted file mode 100644 index 75eaa61ce4..0000000000 --- a/src/com/vaadin/tests/validation/TestValidators.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.vaadin.tests.validation;
-
-import com.vaadin.data.Validator;
-import com.vaadin.data.validator.AbstractStringValidator;
-import com.vaadin.data.validator.CompositeValidator;
-import com.vaadin.data.validator.DoubleValidator;
-import com.vaadin.data.validator.EmailValidator;
-import com.vaadin.data.validator.IntegerValidator;
-import com.vaadin.data.validator.RegexpValidator;
-import com.vaadin.data.validator.StringLengthValidator;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Form;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.Window.Notification;
-
-public class TestValidators extends TestBase {
-
- @Override
- protected Integer getTicketNumber() {
- return 680;
- }
-
- @Override
- protected String getDescription() {
- return "This test verifies that various validators work correctly";
- }
-
- @Override
- public void setup() {
- final Form form = new Form(new VerticalLayout());
-
- // simple validators
-
- TextField tf = new TextField("A field, must contain 1-2 chars");
- tf
- .addValidator(new StringLengthValidator("Invalid length", 1, 2,
- false));
- tf.setRequired(true);
- tf.setValue("ab");
- form.addField("a", tf);
-
- tf = new TextField("A field, must contain an integer");
- tf.addValidator(new IntegerValidator("Invalid integer {0}"));
- tf.setRequired(true);
- tf.setValue("123");
- form.addField("b", tf);
-
- tf = new TextField("A field, must contain an integer or be empty");
- tf.addValidator(new IntegerValidator("Invalid integer {0}"));
- tf.setValue("-321");
- form.addField("c", tf);
-
- tf = new TextField(
- "A field, must contain a floating point number or be empty");
- tf.addValidator(new DoubleValidator("Invalid double {0}"));
- tf.setValue("-123.45e6");
- form.addField("d", tf);
-
- tf = new TextField(
- "A field, must contain an e-mail address or be empty");
- tf.addValidator(new EmailValidator("Invalid e-mail address {0}"));
- tf.setValue("a.b@example.com");
- form.addField("e", tf);
-
- // regular expressions
-
- tf = new TextField("A field, must match the regular expression a.*b.*c");
- tf.addValidator(new RegexpValidator("a.*b.*c",
- "{0} does not match the regular expression"));
- tf.setValue("aagsabeqgc");
- form.addField("f", tf);
-
- tf = new TextField(
- "A field, must contain the regular expression a.*b.*c");
- tf.addValidator(new RegexpValidator("a.*b.*c", false,
- "{0} does not contain the regular expression"));
- tf.setValue("aagsabeqgc");
- form.addField("g", tf);
-
- tf = new TextField(
- "A field, must match the regular expression ^a.*b.*c$");
- tf.addValidator(new RegexpValidator("^a.*b.*c$", false,
- "{0} does not match the regular expression with ^ and $"));
- tf.setValue("aagsabeqgc");
- form.addField("h", tf);
-
- tf = new TextField(
- "A field, must contain the regular expression ^a.*b.*c$");
- tf.addValidator(new RegexpValidator("^a.*b.*c$", false,
- "{0} does not contain the regular expression with ^ and $"));
- tf.setValue("aagsabeqgc");
- form.addField("i", tf);
-
- // TODO CompositeValidator
- tf = new TextField(
- "A field, must be a floating point number with 4-5 chars");
- CompositeValidator cv = new CompositeValidator(
- CompositeValidator.MODE_AND,
- "The field must contain a floating point number with 4-5 characters");
- cv
- .addValidator(new StringLengthValidator(
- "String length of '{0}' should be 4-5 characters", 4,
- 5, false));
- cv.addValidator(new DoubleValidator(
- "{0} must be a floating point number"));
- tf.addValidator(cv);
- tf.setValue("12.34");
- form.addField("j", tf);
-
- // Postal code that must be 5 digits (10000-99999).
- tf = new TextField("Postal Code");
- tf.setColumns(5);
-
- // Create the validator - this would be even easier with RegexpValidator
- Validator postalCodeValidator = new AbstractStringValidator(
- "Postal code must be a number 10000-99999.") {
- @Override
- protected boolean isValidString(String value) {
- return value.matches("[1-9][0-9]{4}");
- }
- };
- tf.addValidator(postalCodeValidator);
- tf.setValue("12345");
- form.addField("k", tf);
-
- Button b = new Button("Commit", new ClickListener() {
-
- public void buttonClick(ClickEvent event) {
- try {
- form.commit();
- if (form.isValid()) {
- getMainWindow().showNotification(
- "OK! Form validated and no error was thrown",
- Notification.TYPE_HUMANIZED_MESSAGE);
- } else {
- getMainWindow().showNotification(
- "Form is invalid but no exception was thrown",
- Notification.TYPE_ERROR_MESSAGE);
- }
- } catch (Exception e) {
- if (form.isValid()) {
- getMainWindow().showNotification(
- "Form is valid but an exception was thrown",
- Notification.TYPE_ERROR_MESSAGE);
- } else {
- getMainWindow().showNotification(
- "OK! Error was thrown for an invalid input",
- Notification.TYPE_HUMANIZED_MESSAGE);
-
- }
- }
- }
-
- });
-
- addComponent(form);
- addComponent(b);
- }
-}
|