aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorAnna Koskinen <Ansku@users.noreply.github.com>2021-07-08 12:04:58 +0300
committerGitHub <noreply@github.com>2021-07-08 12:04:58 +0300
commit3afe45849edc79f0e7b371a7fd3ef209292dce79 (patch)
tree2934d3ca30286b3480d7c6b4c5d5bfc99aa196db /uitest/src
parent347d36dcbccb07f1dd46f17ea5be6fceecc755cb (diff)
downloadvaadin-framework-3afe45849edc79f0e7b371a7fd3ef209292dce79.tar.gz
vaadin-framework-3afe45849edc79f0e7b371a7fd3ef209292dce79.zip
Code cleanup (#12333)
- removed unused private methods - removed unused private variables - removed unnecessary initializations - removed unnecessary substring(0) - removed inner assignments - renamed private methods that started with upper case - renamed static final variables to use upper case - converted to use non-deprecated options - suppressed unavoidable warnings - divided long Strings to multiple lines - added missing types - added missing JavaDoc parameters - formatting - updated comments & JavaDocs
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/HasValueRequiredIndicator.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/CollapseIndicatorOverlapsColumn.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableInTabsheet.java32
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java8
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java8
-rw-r--r--uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/MessageView.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/util/LoggingItemDataProvider.java2
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java8
-rw-r--r--uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java2
13 files changed, 37 insertions, 55 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/HasValueRequiredIndicator.java b/uitest/src/main/java/com/vaadin/tests/components/HasValueRequiredIndicator.java
index 0fd24c89fd..8afc0577ee 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/HasValueRequiredIndicator.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/HasValueRequiredIndicator.java
@@ -22,11 +22,9 @@ import com.vaadin.ui.VerticalLayout;
* @author Vaadin Ltd
*
*/
-public abstract class HasValueRequiredIndicator<C extends HasValue & Component>
+public abstract class HasValueRequiredIndicator<C extends HasValue<?> & Component>
extends AbstractTestUI {
- private static final List<Class<? extends Layout>> LAYOUTS = getVaadinLayouts();
-
@Override
protected void setup(VaadinRequest request) {
getContent().setSizeFull();
@@ -70,6 +68,7 @@ public abstract class HasValueRequiredIndicator<C extends HasValue & Component>
if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>) type;
try {
+ @SuppressWarnings("unchecked")
C component = (C) clazz.newInstance();
initValue(component);
component.setRequiredIndicatorVisible(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java
index 845a23ea48..6d3fd1651f 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridNullSafeNestedPropertyColumn.java
@@ -20,8 +20,6 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI {
private List<Person> personList = new ArrayList<>();
private ListDataProvider<Person> listDataProvider;
- private Grid.Column nullSafeColumn = null;
- private Grid.Column regularColumn = null;
@Override
protected void setup(VaadinRequest request) {
@@ -47,8 +45,7 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI {
Button addSafeColumnButton = new Button(
"add 'address.streetAddress' as a null-safe column", event -> {
- nullSafeColumn = grid.addColumn("address.streetAddress",
- new TextRenderer(),
+ grid.addColumn("address.streetAddress", new TextRenderer(),
Grid.Column.NestedNullBehavior.ALLOW_NULLS);
});
addSafeColumnButton.setId("safe");
@@ -56,7 +53,7 @@ public class GridNullSafeNestedPropertyColumn extends AbstractTestUI {
Button addUnsafeColumnButton = new Button(
"add 'address.streetAddress' column without nested null safety",
event -> {
- regularColumn = grid.addColumn("address.streetAddress");
+ grid.addColumn("address.streetAddress");
});
addUnsafeColumnButton.setId("unsafe");
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/CollapseIndicatorOverlapsColumn.java b/uitest/src/main/java/com/vaadin/tests/components/table/CollapseIndicatorOverlapsColumn.java
index 7f3c4d3cd2..a168707e20 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/CollapseIndicatorOverlapsColumn.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/CollapseIndicatorOverlapsColumn.java
@@ -4,16 +4,17 @@ import com.vaadin.tests.components.TestBase;
import com.vaadin.v7.data.Item;
import com.vaadin.v7.ui.Table;
+@SuppressWarnings("deprecation")
public class CollapseIndicatorOverlapsColumn extends TestBase {
@Override
protected void setup() {
Table tbl = createTable();
- tbl = createTable();
tbl.setWidth("400px");
addComponent(tbl);
}
+ @SuppressWarnings("unchecked")
private Table createTable() {
Table tbl = new Table();
tbl.addContainerProperty("COL1", String.class, "Column 1");
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableInTabsheet.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableInTabsheet.java
index 7f7f72ff43..9517928f43 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableInTabsheet.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableInTabsheet.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.table;
-import java.net.MalformedURLException;
-
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ContentMode;
import com.vaadin.tests.components.AbstractReindeerTestUI;
@@ -14,6 +12,7 @@ import com.vaadin.v7.ui.Table;
import com.vaadin.v7.ui.Table.Align;
import com.vaadin.v7.ui.themes.Reindeer;
+@SuppressWarnings("deprecation")
public class TableInTabsheet extends AbstractReindeerTestUI {
@Override
@@ -28,41 +27,30 @@ public class TableInTabsheet extends AbstractReindeerTestUI {
}
private VerticalLayout title() {
-
VerticalLayout vP = new VerticalLayout();
vP.setStyleName(Reindeer.LAYOUT_BLACK);
Label tit = new Label("<h1> Tab/Table Test</h1>", ContentMode.HTML);
vP.addComponent(tit);
return vP;
-
}
private VerticalLayout page() {
-
VerticalLayout vP = new VerticalLayout();
vP.setStyleName(Reindeer.LAYOUT_BLUE);
TabSheet t = new TabSheet();
t.setWidth(1000, Unit.PIXELS);
HorizontalLayout hP = new HorizontalLayout();
- t.addTab(Ranking(), "Ranking");
- try {
-
- t.addTab(GDocs(""), "Dez 2011");
- t.addTab(GDocs(""), "Jan 2012");
- t.addTab(GDocs(""), "Abr 2012");
-
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
+ t.addTab(createRankingLayout(), "Ranking");
+ t.addTab(createSimpleTabContent(), "Dez 2011");
+ t.addTab(createSimpleTabContent(), "Jan 2012");
+ t.addTab(createSimpleTabContent(), "Abr 2012");
hP.addComponent(t);
vP.addComponent(hP);
return vP;
-
}
- private AbsoluteLayout Ranking() {
-
+ private AbsoluteLayout createRankingLayout() {
AbsoluteLayout vT = new AbsoluteLayout();
vT.setHeight(500, Unit.PIXELS);
vT.setWidth(900, Unit.PIXELS);
@@ -86,22 +74,20 @@ public class TableInTabsheet extends AbstractReindeerTestUI {
vT.addComponent(table, "left: 50px; top: 50px;");
return vT;
-
}
- private VerticalLayout GDocs(String end) throws MalformedURLException {
-
+ private VerticalLayout createSimpleTabContent() {
VerticalLayout vT = new VerticalLayout();
vT.setHeight(500, Unit.PIXELS);
vT.setWidth(900, Unit.PIXELS);
return vT;
-
}
@Override
protected String getTestDescription() {
- return "Chaning to a different tab and then back to the first tab should properly render the table.";
+ return "Chaning to a different tab and then back to the first tab "
+ + "should properly render the table.";
}
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
index c0560b1178..fe7a402e1e 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableScrollOnExpand.java
@@ -4,6 +4,7 @@ import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.v7.ui.TreeTable;
+@SuppressWarnings("deprecation")
public class TreeTableScrollOnExpand extends AbstractReindeerTestUI {
@Override
@@ -15,9 +16,9 @@ public class TreeTableScrollOnExpand extends AbstractReindeerTestUI {
t.addContainerProperty("Name", String.class, "null");
for (int i = 1; i <= 100; i++) {
String parentID = "Item " + i;
- Object parent = t.addItem(new Object[] { parentID }, parentID);
+ t.addItem(new Object[] { parentID }, parentID);
String childID = "Item " + (100 + i);
- Object child = t.addItem(new Object[] { childID }, childID);
+ t.addItem(new Object[] { childID }, childID);
t.getContainerDataSource().setParent(childID, parentID);
}
addComponent(t);
@@ -30,7 +31,8 @@ public class TreeTableScrollOnExpand extends AbstractReindeerTestUI {
@Override
public String getTestDescription() {
- return "After selecting an item and scrolling it out of view, TreeTable should not scroll to the "
+ return "After selecting an item and scrolling it out of view, "
+ + "TreeTable should not scroll to the "
+ "selected item when expanding an item.";
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java
index 1cef44eafd..fd23538a03 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/uitest/components/AccordionsCssTest.java
@@ -8,14 +8,12 @@ import com.vaadin.ui.Label;
import com.vaadin.v7.ui.themes.ChameleonTheme;
import com.vaadin.v7.ui.themes.Runo;
+@SuppressWarnings("deprecation")
public class AccordionsCssTest {
- private TestSampler parent;
private int debugIdCounter = 0;
public AccordionsCssTest(TestSampler parent) {
- this.parent = parent;
-
Accordion def = createAccordionWith("Def Accordion", null);
parent.addComponent(def);
diff --git a/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java b/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java
index 100ebc3dc1..905b8ec7fa 100644
--- a/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java
+++ b/uitest/src/main/java/com/vaadin/tests/dd/DDTest7.java
@@ -19,6 +19,7 @@ import com.vaadin.v7.event.DataBoundTransferable;
import com.vaadin.v7.ui.AbstractSelect.AbstractSelectTargetDetails;
import com.vaadin.v7.ui.Table;
+@SuppressWarnings("deprecation")
public class DDTest7 extends TestBase {
java.util.Random r = new java.util.Random(1);
@@ -135,11 +136,12 @@ public class DDTest7 extends TestBase {
}
+ @SuppressWarnings("unchecked")
private void moveAfter(IndexedContainer containerDataSource,
Object itemId, Object idAfter) {
try {
- IndexedContainer clone = null;
- clone = (IndexedContainer) containerDataSource.clone();
+ IndexedContainer clone = (IndexedContainer) containerDataSource
+ .clone();
containerDataSource.removeItem(itemId);
Item newItem = containerDataSource.addItemAfter(idAfter,
itemId);
@@ -158,6 +160,7 @@ public class DDTest7 extends TestBase {
}
+ @SuppressWarnings("unchecked")
private void populateTable() {
table.addContainerProperty("Name", String.class, "");
table.addContainerProperty("Weight", Integer.class, 0);
diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java
index 7c63be9314..7bb7c4ce91 100644
--- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java
+++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/FormWithNestedProperties.java
@@ -5,17 +5,15 @@ import com.vaadin.tests.data.bean.Address;
import com.vaadin.tests.data.bean.Country;
import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.data.bean.Sex;
-import com.vaadin.tests.util.Log;
import com.vaadin.ui.CheckBox;
import com.vaadin.v7.data.fieldgroup.BeanFieldGroup;
import com.vaadin.v7.ui.NativeSelect;
import com.vaadin.v7.ui.TextField;
+@SuppressWarnings("deprecation")
public class FormWithNestedProperties
extends AbstractBeanFieldGroupTest<Person> {
- private Log log = new Log(5);
-
private TextField firstName = new TextField("First name");
private TextField lastName = new TextField("Last name");
private TextField email = new TextField("Email");
@@ -32,8 +30,8 @@ public class FormWithNestedProperties
super.setup();
setFieldBinder(new BeanFieldGroup<>(Person.class));
- country = (NativeSelect) getFieldBinder().buildAndBind("country",
- "address.country", NativeSelect.class);
+ country = getFieldBinder().buildAndBind("country", "address.country",
+ NativeSelect.class);
getFieldBinder().bindMemberFields(this);
addComponent(firstName);
addComponent(lastName);
diff --git a/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java b/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
index d4b37335b9..f039960b93 100644
--- a/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
+++ b/uitest/src/main/java/com/vaadin/tests/fonticon/FontIcons.java
@@ -46,6 +46,7 @@ import com.vaadin.v7.ui.TwinColSelect;
* <p>
* {@link VaadinIconSet} is the newer one for testing valo+vaadin icons.
*/
+@SuppressWarnings("deprecation")
public class FontIcons extends AbstractReindeerTestUI {
@Override
@@ -171,9 +172,9 @@ public class FontIcons extends AbstractReindeerTestUI {
menu.setIcon(icon);
menu.setCaption("MenuBar");
MenuItem mi = menu.addItem("File", icon, null);
+ mi.addItem("Item", icon, null);
MenuItem smi = mi.addItem("Item", icon, null);
- smi = mi.addItem("Item", icon, null);
- smi = smi.addItem("Item", icon, null);
+ smi.addItem("Item", icon, null);
gl.addComponent(menu);
// Tree, caption + item + subitem + action icons
diff --git a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/MessageView.java b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/MessageView.java
index 30e86a2be7..c828c185e8 100644
--- a/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/MessageView.java
+++ b/uitest/src/main/java/com/vaadin/tests/minitutorials/v7b9/MessageView.java
@@ -9,7 +9,6 @@ import com.vaadin.ui.VerticalLayout;
public class MessageView extends Panel implements View {
public static final String NAME = "message";
- private Layout layout;
public MessageView() {
super(new VerticalLayout());
diff --git a/uitest/src/main/java/com/vaadin/tests/util/LoggingItemDataProvider.java b/uitest/src/main/java/com/vaadin/tests/util/LoggingItemDataProvider.java
index 0cc12c1ed6..8cda999654 100644
--- a/uitest/src/main/java/com/vaadin/tests/util/LoggingItemDataProvider.java
+++ b/uitest/src/main/java/com/vaadin/tests/util/LoggingItemDataProvider.java
@@ -15,8 +15,6 @@ import com.vaadin.ui.VerticalLayout;
public class LoggingItemDataProvider
extends CallbackDataProvider<String, String> {
- private int counter;
-
public LoggingItemDataProvider(int size, VerticalLayout logContainer) {
super(q -> fetch(logContainer, q, size),
q -> size(logContainer, q, size));
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java
index fc71bdfbe4..c7511fa26a 100644
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/GridThemeUI.java
@@ -21,16 +21,15 @@ import com.vaadin.v7.ui.Grid;
import com.vaadin.v7.ui.NativeSelect;
import com.vaadin.v7.ui.renderers.DateRenderer;
+@SuppressWarnings("deprecation")
public class GridThemeUI extends AbstractTestUIWithLog {
- private Grid grid;
-
protected static String[] columns = { "firstName", "lastName", "gender",
"birthDate", "age", "alive", "address.streetAddress",
"address.postalCode", "address.city", "address.country" };
protected BeanItemContainer<ComplexPerson> container = ComplexPerson
- .createContainer(100);;
+ .createContainer(100);
{
container.addNestedContainerBean("address");
}
@@ -113,7 +112,8 @@ public class GridThemeUI extends AbstractTestUIWithLog {
b.setSizeFull();
row.join("address.streetAddress", "address.postalCode",
"address.city", "address.country").setComponent(b);
- // TODO: revert back to 25 when #16597 is fixed..
+ // NOTE: can't set column width that is too narrow to accommodate
+ // cell paddings, e.g. 25 would not be enough for Valo
getColumn("age").setWidth(42);
removeColumn("salary");
setEditorEnabled(true);
diff --git a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java
index 41a2d7b57e..519450eb1d 100644
--- a/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java
+++ b/uitest/src/main/java/com/vaadin/v7/tests/components/grid/basicfeatures/GridBasicFeatures.java
@@ -76,6 +76,7 @@ import com.vaadin.v7.ui.renderers.NumberRenderer;
* @author Vaadin Ltd
*/
@Theme("valo")
+@SuppressWarnings("deprecation")
public class GridBasicFeatures extends AbstractComponentTest<Grid> {
public static final String ROW_STYLE_GENERATOR_ROW_NUMBERS_FOR_3_OF_4 = "Row numbers for 3/4";
@@ -1017,7 +1018,6 @@ public class GridBasicFeatures extends AbstractComponentTest<Grid> {
protected void createColumnActions() {
createCategory("Columns", null);
for (int c = 0; c < COLUMNS; c++) {
- final int index = c;
createCategory(getColumnProperty(c), "Columns");
createClickAction("Add / Remove", getColumnProperty(c),