setup();
}
- public void setMainWindow(Window mainWindow) {
+ private LegacyWindow window;
++
+ @Override
- private Window window;
++ public void setMainWindow(LegacyWindow mainWindow) {
+ if (mainWindow != window) {
+ throw new IllegalStateException(
+ "You should not set your own main window when using TestBase. If you need to use a custom Window as the main window, use AbstractTestCase instead.");
+ }
+ super.setMainWindow(mainWindow);
+ }
+
private VerticalLayout layout;
public TestBase() {
import java.util.List;
import com.vaadin.data.util.BeanItemContainer;
- import com.vaadin.tests.components.TestBase;
+ import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.tests.util.Person;
import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
- public class ScrollCausesRequestLoop extends TestBase {
+ public class ScrollCausesRequestLoop extends AbstractTestCase {
@Override
- protected void setup() {
+ public void init() {
- setMainWindow(new Window("", new TestView()));
+ setMainWindow(new LegacyWindow("", new TestView()));
}
@Override
mainLayout.setExpandRatio(firstLayout, 1);
first.addListener(new Button.ClickListener() {
++ @Override
public void buttonClick(ClickEvent event) {
if (mainLayout.getComponent(1).equals(secondLayout)) {
mainLayout.replaceComponent(secondLayout, firstLayout);
}
});
second.addListener(new Button.ClickListener() {
++ @Override
public void buttonClick(ClickEvent event) {
if (mainLayout.getComponent(1).equals(firstLayout)) {
mainLayout.replaceComponent(firstLayout, secondLayout);
table.setHeight("100px");
if (listenClicks) {
table.addListener(new ItemClickListener() {
++ @Override
public void itemClick(ItemClickEvent event) {
table.requestRepaint();
clickLabel.setValue("Click " + event.getItemId());
}
if (listenValueChanges) {
table.addListener(new ValueChangeListener() {
++ @Override
public void valueChange(ValueChangeEvent event) {
- valueChangeLabel.setValue("Value " + event.getProperty());
+ valueChangeLabel.setValue("Value "
+ + event.getProperty().getValue());
}
});
}
import java.io.File;
import com.vaadin.data.util.FilesystemContainer;
-import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.tests.components.TestBase;
- import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.Table;
-import com.vaadin.ui.Window;
-public class TableWithFileSystemContainer extends AbstractTestCase {
+public class TableWithFileSystemContainer extends TestBase {
private String testPath = "C:/temp/img";
@Override
- public void init() {
- setMainWindow(new Window(""));
+ public void setup() {
- setMainWindow(new LegacyWindow(""));
Table table = new Table("Documents", new FilesystemContainer(new File(
testPath)));
table.setWidth("100%");
private CssLayout wrapper2 = new CssLayout();
private FormFieldFactory fff = new FormFieldFactory() {
- public Field createField(Item item, Object propertyId,
++ @Override
+ public Field<?> createField(Item item, Object propertyId,
Component uiContext) {
if (propertyId.equals(DataPOJO.Fields.name.name())) {
}
@Override
- public void init() {
- Window mainWindow = new Window("Formlayoutcaptionboom Application");
+ protected void setup() {
- LegacyWindow mainWindow = new LegacyWindow(
- "Formlayoutcaptionboom Application");
++ LegacyWindow mainWindow = getMainWindow();
++
Label label = new Label("Hello Vaadin user");
mainWindow.addComponent(label);
-- setMainWindow(mainWindow);
DataPOJO forDemo = new DataPOJO();
mainWindow.addComponent(aFormWithGl);
Button b = new Button("Give me an error!", new Button.ClickListener() {
++ @Override
public void buttonClick(ClickEvent event) {
aFormWithGl.createErrors();
Button b2 = new Button("Get rid of an error!",
new Button.ClickListener() {
++ @Override
public void buttonClick(ClickEvent event) {
aFormWithGl.clearErrors();
private Button button;
@Override
- public void init() {
- Window main = new Window("The Main Window");
+ public void setup() {
- LegacyWindow main = new LegacyWindow("The Main Window");
++ LegacyWindow main = getMainWindow();
++
mainLayout = new GridLayout(3, 3);
main.setContent(mainLayout);
-- setMainWindow(main);
// The upper layout
vl1 = new VerticalLayout();
vl2.setSizeFull();
}
++ @Override
public void buttonClick(ClickEvent event) {
if (isVisible) {
mainLayout.setRowExpandRatio(2, 0);
private Button button;
@Override
- public void init() {
- Window main = new Window("The Main Window");
+ public void setup() {
- LegacyWindow main = new LegacyWindow("The Main Window");
++ LegacyWindow main = getMainWindow();
++
mainLayout = new VerticalLayout();
main.setContent(mainLayout);
-- setMainWindow(main);
// The upper layout
vl1 = new VerticalLayout();
vl2.setSizeFull();
}
++ @Override
public void buttonClick(ClickEvent event) {
if (isVisible) {
mainLayout.setExpandRatio(vl2, 0);
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Label;
+import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
-public class Ticket6002 extends AbstractTestCase {
+public class Ticket6002 extends TestBase {
@Override
- public void init() {
- Window main = new Window("The Main Window");
- setMainWindow(main);
+ public void setup() {
- LegacyWindow main = new LegacyWindow("The Main Window");
- setMainWindow(main);
++ LegacyWindow main = getMainWindow();
final VerticalLayout mainLayout = new VerticalLayout();
main.setContent(mainLayout);
final TextField tf1 = new TextField(
"Changing this field modifies only the textfield", property1);
tf1.addListener(new Property.ValueChangeListener() {
++ @Override
public void valueChange(ValueChangeEvent event) {
// This value change event is called twice if the new
// input value is an integer. The second time is during
"Changing this field modifies the layout - do it twice",
property2);
tf2.addListener(new Property.ValueChangeListener() {
++ @Override
public void valueChange(ValueChangeEvent event) {
// This value change event is called twice if the new
// input value is an integer. The second time is during
package com.vaadin.tests.validation;
- import com.vaadin.tests.components.TestBase;
+ import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.ui.Form;
+import com.vaadin.ui.Root.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.Window;
- public class RequiredErrorMessage extends TestBase {
+ public class RequiredErrorMessage extends AbstractTestCase {
@Override
protected Integer getTicketNumber() {
}
@Override
- public void setup() {
+ public void init() {
- final Window main = new Window(getClass().getName());
+ final LegacyWindow main = new LegacyWindow(getClass().getName());
setMainWindow(main);
final Form form = new Form(new VerticalLayout());