From d1af5d84e3f6b352318aa0819a65a36b7c6e2dad Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 9 Aug 2016 09:53:08 +0300 Subject: Add support for required status to AbstractField Change-Id: I64ef7d4425946031432032cc4060e0dcad43678b --- .../components/AbstractComponentTestCase.java | 35 ++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'uitest/src') diff --git a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java index 9414bc0fb4..7849124031 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java +++ b/uitest/src/main/java/com/vaadin/tests/components/AbstractComponentTestCase.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import java.util.Locale; +import com.vaadin.data.HasRequired; import com.vaadin.legacy.ui.LegacyField; import com.vaadin.server.Resource; import com.vaadin.server.ThemeResource; @@ -15,15 +16,24 @@ import com.vaadin.ui.Layout.SpacingHandler; public abstract class AbstractComponentTestCase extends TestBase { - protected static final ThemeResource ICON_16_HELP_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/help.png"); - protected static final ThemeResource ICON_16_FOLDER_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/folder.png"); - protected static final ThemeResource ICON_16_ERROR_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/error.png"); - protected static final ThemeResource ICON_16_USER_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/16/user.png"); - protected static final ThemeResource ICON_16_USER_PNG_UNCACHEABLE = uncacheableThemeResource("../runo/icons/16/user.png"); - protected static final ThemeResource ICON_32_ATTENTION_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/32/attention.png"); - protected static final ThemeResource ICON_32_ATTENTION_PNG_UNCACHEABLE = uncacheableThemeResource("../runo/icons/32/attention.png"); - protected static final ThemeResource ICON_64_EMAIL_REPLY_PNG_CACHEABLE = cacheableThemeResource("../runo/icons/64/email-reply.png"); - protected static final ThemeResource ICON_64_EMAIL_REPLY_PNG_UNCACHEABLE = uncacheableThemeResource("../runo/icons/64/email-reply.png"); + protected static final ThemeResource ICON_16_HELP_PNG_CACHEABLE = cacheableThemeResource( + "../runo/icons/16/help.png"); + protected static final ThemeResource ICON_16_FOLDER_PNG_CACHEABLE = cacheableThemeResource( + "../runo/icons/16/folder.png"); + protected static final ThemeResource ICON_16_ERROR_PNG_CACHEABLE = cacheableThemeResource( + "../runo/icons/16/error.png"); + protected static final ThemeResource ICON_16_USER_PNG_CACHEABLE = cacheableThemeResource( + "../runo/icons/16/user.png"); + protected static final ThemeResource ICON_16_USER_PNG_UNCACHEABLE = uncacheableThemeResource( + "../runo/icons/16/user.png"); + protected static final ThemeResource ICON_32_ATTENTION_PNG_CACHEABLE = cacheableThemeResource( + "../runo/icons/32/attention.png"); + protected static final ThemeResource ICON_32_ATTENTION_PNG_UNCACHEABLE = uncacheableThemeResource( + "../runo/icons/32/attention.png"); + protected static final ThemeResource ICON_64_EMAIL_REPLY_PNG_CACHEABLE = cacheableThemeResource( + "../runo/icons/64/email-reply.png"); + protected static final ThemeResource ICON_64_EMAIL_REPLY_PNG_UNCACHEABLE = uncacheableThemeResource( + "../runo/icons/64/email-reply.png"); private List testComponents = new ArrayList(); @@ -132,8 +142,8 @@ public abstract class AbstractComponentTestCase @Override public void execute(T c, Boolean enabled, Object data) { - if (c instanceof LegacyField) { - ((LegacyField) c).setRequired(enabled); + if (c instanceof HasRequired) { + ((HasRequired) c).setRequired(enabled); } else { throw new IllegalArgumentException(c.getClass().getName() + " is not a field and cannot be set to required"); @@ -198,7 +208,8 @@ public abstract class AbstractComponentTestCase }; - protected void doCommand(Command command, VALUET value) { + protected void doCommand(Command command, + VALUET value) { doCommand(command, value, null); } -- cgit v1.2.3