summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2016-08-04 20:58:28 +0300
committerVaadin Code Review <review@vaadin.com>2016-08-05 14:21:23 +0000
commitf6f111b88fcf65c9d75f36daaa046dd26efc68e5 (patch)
tree624771f12426fecb07ca6b63d2a6228c31e447f3 /server
parent138f8ddb6927f66bc2d5bfce6d7ae5963c0ca42e (diff)
downloadvaadin-framework-f6f111b88fcf65c9d75f36daaa046dd26efc68e5.tar.gz
vaadin-framework-f6f111b88fcf65c9d75f36daaa046dd26efc68e5.zip
Rename Field, AbstractField to legacy names
Change-Id: I46ce708e0f10e4c9fa3d11a2aef5be0248c2999f
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java18
-rw-r--r--server/src/main/java/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java22
-rw-r--r--server/src/main/java/com/vaadin/data/fieldgroup/FieldGroup.java114
-rw-r--r--server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java8
-rw-r--r--server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java4
-rw-r--r--server/src/main/java/com/vaadin/event/FieldEvents.java20
-rw-r--r--server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java (renamed from server/src/main/java/com/vaadin/ui/AbstractField.java)87
-rw-r--r--server/src/main/java/com/vaadin/legacy/ui/LegacyField.java (renamed from server/src/main/java/com/vaadin/ui/Field.java)18
-rw-r--r--server/src/main/java/com/vaadin/server/VaadinSession.java4
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractComponent.java5
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractSelect.java13
-rw-r--r--server/src/main/java/com/vaadin/ui/AbstractTextField.java5
-rw-r--r--server/src/main/java/com/vaadin/ui/CheckBox.java7
-rw-r--r--server/src/main/java/com/vaadin/ui/Component.java11
-rw-r--r--server/src/main/java/com/vaadin/ui/CustomField.java6
-rw-r--r--server/src/main/java/com/vaadin/ui/DateField.java28
-rw-r--r--server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java13
-rw-r--r--server/src/main/java/com/vaadin/ui/Form.java141
-rw-r--r--server/src/main/java/com/vaadin/ui/FormFieldFactory.java6
-rw-r--r--server/src/main/java/com/vaadin/ui/Grid.java192
-rw-r--r--server/src/main/java/com/vaadin/ui/ProgressBar.java7
-rw-r--r--server/src/main/java/com/vaadin/ui/RichTextArea.java3
-rw-r--r--server/src/main/java/com/vaadin/ui/Slider.java7
-rw-r--r--server/src/main/java/com/vaadin/ui/Table.java23
-rw-r--r--server/src/main/java/com/vaadin/ui/TableFieldFactory.java7
-rw-r--r--server/src/main/java/com/vaadin/ui/TextField.java4
-rw-r--r--server/src/main/javadoc/com/vaadin/data/package.html2
-rw-r--r--server/src/test/java/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java16
-rw-r--r--server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupDateTest.java6
-rw-r--r--server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/VaadinClasses.java6
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/FieldDefaultValuesTest.java12
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbsFieldValidatorsTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java10
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetachTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java12
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/fieldgroup/FieldGroupTest.java11
-rw-r--r--server/src/test/java/com/vaadin/tests/server/component/grid/GridEditorTest.java8
-rw-r--r--server/src/test/java/com/vaadin/tests/server/components/AbstractFieldValueChangeTestBase.java18
-rw-r--r--server/src/test/java/com/vaadin/tests/server/components/ComboBoxValueChangeTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/components/TextFieldValueChangeTest.java4
-rw-r--r--server/src/test/java/com/vaadin/tests/server/validation/BeanValidationTest.java4
-rw-r--r--server/src/test/java/com/vaadin/util/ReflectToolsGetFieldValueByTypeTest.java2
43 files changed, 488 insertions, 416 deletions
diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java b/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java
index 0a92c00cad..62eb51b811 100644
--- a/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java
+++ b/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java
@@ -24,18 +24,18 @@ import com.vaadin.data.Item;
import com.vaadin.data.util.BeanItem;
import com.vaadin.data.util.BeanUtil;
import com.vaadin.data.validator.BeanValidator;
-import com.vaadin.ui.Field;
+import com.vaadin.legacy.ui.LegacyField;
public class BeanFieldGroup<T> extends FieldGroup {
private final Class<T> beanType;
private static Boolean beanValidationImplementationAvailable = null;
- private final Map<Field<?>, BeanValidator> defaultValidators;
+ private final Map<LegacyField<?>, BeanValidator> defaultValidators;
public BeanFieldGroup(Class<T> beanType) {
this.beanType = beanType;
- this.defaultValidators = new HashMap<Field<?>, BeanValidator>();
+ this.defaultValidators = new HashMap<LegacyField<?>, BeanValidator>();
}
@Override
@@ -149,20 +149,20 @@ public class BeanFieldGroup<T> extends FieldGroup {
}
@Override
- public void bind(Field field, Object propertyId) {
+ public void bind(LegacyField field, Object propertyId) {
ensureNestedPropertyAdded(propertyId);
super.bind(field, propertyId);
}
@Override
- public <T extends Field> T buildAndBind(String caption, Object propertyId,
+ public <T extends LegacyField> T buildAndBind(String caption, Object propertyId,
Class<T> fieldType) throws BindException {
ensureNestedPropertyAdded(propertyId);
return super.buildAndBind(caption, propertyId, fieldType);
}
@Override
- public void unbind(Field<?> field) throws BindException {
+ public void unbind(LegacyField<?> field) throws BindException {
super.unbind(field);
BeanValidator removed = defaultValidators.remove(field);
@@ -172,7 +172,7 @@ public class BeanFieldGroup<T> extends FieldGroup {
}
@Override
- protected void configureField(Field<?> field) {
+ protected void configureField(LegacyField<?> field) {
super.configureField(field);
// Add Bean validators if there are annotations
if (isBeanValidationImplementationAvailable()
@@ -226,7 +226,7 @@ public class BeanFieldGroup<T> extends FieldGroup {
* @param bean
* the bean to be bound
* @param objectWithMemberFields
- * the class that contains {@link Field}s for bean properties
+ * the class that contains {@link LegacyField}s for bean properties
* @return the bean field group used to make binding
*/
public static <T> BeanFieldGroup<T> bindFieldsUnbuffered(T bean,
@@ -247,7 +247,7 @@ public class BeanFieldGroup<T> extends FieldGroup {
* @param bean
* the bean to be bound
* @param objectWithMemberFields
- * the class that contains {@link Field}s for bean properties
+ * the class that contains {@link LegacyField}s for bean properties
* @return the bean field group used to make binding
*/
public static <T> BeanFieldGroup<T> bindFieldsBuffered(T bean,
diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java b/server/src/main/java/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java
index b6bf97e68e..27f4628bae 100644
--- a/server/src/main/java/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java
+++ b/server/src/main/java/com/vaadin/data/fieldgroup/DefaultFieldGroupFieldFactory.java
@@ -20,13 +20,13 @@ import java.util.EnumSet;
import com.vaadin.data.Item;
import com.vaadin.data.fieldgroup.FieldGroup.BindException;
-import com.vaadin.ui.AbstractField;
+import com.vaadin.legacy.ui.LegacyField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.AbstractTextField;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.DateField;
-import com.vaadin.ui.Field;
import com.vaadin.ui.InlineDateField;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.NativeSelect;
@@ -64,7 +64,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
}
@Override
- public <T extends Field> T createField(Class<?> type, Class<T> fieldType) {
+ public <T extends LegacyField> T createField(Class<?> type, Class<T> fieldType) {
if (Enum.class.isAssignableFrom(type)) {
return createEnumField(type, fieldType);
} else if (Date.class.isAssignableFrom(type)) {
@@ -89,7 +89,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
return rta;
}
- private <T extends Field> T createEnumField(Class<?> type,
+ private <T extends LegacyField> T createEnumField(Class<?> type,
Class<T> fieldType) {
// Determine first if we should (or can) create a select for the enum
Class<AbstractSelect> selectClass = null;
@@ -110,9 +110,9 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
return null;
}
- private <T extends Field> T createDateField(Class<?> type,
+ private <T extends LegacyField> T createDateField(Class<?> type,
Class<T> fieldType) {
- AbstractField field;
+ LegacyAbstractField field;
if (InlineDateField.class.isAssignableFrom(fieldType)) {
field = new InlineDateField();
@@ -157,10 +157,10 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
* @since 7.4
* @param fieldType
* the type of the field
- * @return true if any AbstractField can be assigned to the field
+ * @return true if any LegacyAbstractField can be assigned to the field
*/
protected boolean anyField(Class<?> fieldType) {
- return fieldType == Field.class || fieldType == AbstractField.class;
+ return fieldType == LegacyField.class || fieldType == LegacyAbstractField.class;
}
/**
@@ -169,11 +169,11 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
* the type of the field
* @return true if any AbstractSelect can be assigned to the field
*/
- protected boolean anySelect(Class<? extends Field> fieldType) {
+ protected boolean anySelect(Class<? extends LegacyField> fieldType) {
return anyField(fieldType) || fieldType == AbstractSelect.class;
}
- protected <T extends Field> T createBooleanField(Class<T> fieldType) {
+ protected <T extends LegacyField> T createBooleanField(Class<T> fieldType) {
if (fieldType.isAssignableFrom(CheckBox.class)) {
CheckBox cb = new CheckBox(null);
cb.setImmediate(true);
@@ -213,7 +213,7 @@ public class DefaultFieldGroupFieldFactory implements FieldGroupFieldFactory {
* @return A field capable of editing the data or null if no field could be
* created
*/
- protected <T extends Field> T createDefaultField(Class<?> type,
+ protected <T extends LegacyField> T createDefaultField(Class<?> type,
Class<T> fieldType) {
if (fieldType.isAssignableFrom(TextField.class)) {
return fieldType.cast(createAbstractTextField(TextField.class));
diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroup.java b/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroup.java
index aaaae9e4f7..9c926637ef 100644
--- a/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroup.java
+++ b/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroup.java
@@ -29,9 +29,9 @@ import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Validator.InvalidValueException;
import com.vaadin.data.util.TransactionalPropertyWrapper;
-import com.vaadin.ui.AbstractField;
+import com.vaadin.legacy.ui.LegacyField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.ui.DefaultFieldFactory;
-import com.vaadin.ui.Field;
import com.vaadin.ui.Form;
import com.vaadin.util.ReflectTools;
@@ -62,8 +62,8 @@ public class FieldGroup implements Serializable {
private boolean enabled = true;
private boolean readOnly = false;
- private HashMap<Object, Field<?>> propertyIdToField = new HashMap<Object, Field<?>>();
- private LinkedHashMap<Field<?>, Object> fieldToPropertyId = new LinkedHashMap<Field<?>, Object>();
+ private HashMap<Object, LegacyField<?>> propertyIdToField = new HashMap<Object, LegacyField<?>>();
+ private LinkedHashMap<LegacyField<?>, Object> fieldToPropertyId = new LinkedHashMap<LegacyField<?>, Object>();
private List<CommitHandler> commitHandlers = new ArrayList<CommitHandler>();
/**
@@ -101,7 +101,7 @@ public class FieldGroup implements Serializable {
public void setItemDataSource(Item itemDataSource) {
this.itemDataSource = itemDataSource;
- for (Field<?> f : fieldToPropertyId.keySet()) {
+ for (LegacyField<?> f : fieldToPropertyId.keySet()) {
bind(f, fieldToPropertyId.get(f));
}
}
@@ -126,7 +126,7 @@ public class FieldGroup implements Serializable {
*
* @see #setBuffered(boolean) for more details on buffered mode
*
- * @see Field#isBuffered()
+ * @see LegacyField#isBuffered()
* @return true if buffered mode is on, false otherwise
*
*/
@@ -145,7 +145,7 @@ public class FieldGroup implements Serializable {
* The default is to use buffered mode.
* </p>
*
- * @see Field#setBuffered(boolean)
+ * @see LegacyField#setBuffered(boolean)
* @param buffered
* true to turn on buffered mode, false otherwise
*/
@@ -155,7 +155,7 @@ public class FieldGroup implements Serializable {
}
this.buffered = buffered;
- for (Field<?> field : getFields()) {
+ for (LegacyField<?> field : getFields()) {
field.setBuffered(buffered);
}
}
@@ -181,7 +181,7 @@ public class FieldGroup implements Serializable {
*/
public void setEnabled(boolean fieldsEnabled) {
enabled = fieldsEnabled;
- for (Field<?> field : getFields()) {
+ for (LegacyField<?> field : getFields()) {
field.setEnabled(fieldsEnabled);
}
}
@@ -211,7 +211,7 @@ public class FieldGroup implements Serializable {
*/
public void setReadOnly(boolean fieldsReadOnly) {
readOnly = fieldsReadOnly;
- for (Field<?> field : getFields()) {
+ for (LegacyField<?> field : getFields()) {
if (field.getPropertyDataSource() == null
|| !field.getPropertyDataSource().isReadOnly()) {
field.setReadOnly(fieldsReadOnly);
@@ -229,7 +229,7 @@ public class FieldGroup implements Serializable {
*
* @return A collection with all bound Fields
*/
- public Collection<Field<?>> getFields() {
+ public Collection<LegacyField<?>> getFields() {
return fieldToPropertyId.keySet();
}
@@ -249,7 +249,7 @@ public class FieldGroup implements Serializable {
* If the field is null or the property id is already bound to
* another field by this field binder
*/
- public void bind(Field<?> field, Object propertyId) throws BindException {
+ public void bind(LegacyField<?> field, Object propertyId) throws BindException {
throwIfFieldIsNull(field, propertyId);
throwIfPropertyIdAlreadyBound(field, propertyId);
@@ -287,7 +287,7 @@ public class FieldGroup implements Serializable {
return new TransactionalPropertyWrapper<T>(itemProperty);
}
- private void throwIfFieldIsNull(Field<?> field, Object propertyId) {
+ private void throwIfFieldIsNull(LegacyField<?> field, Object propertyId) {
if (field == null) {
throw new BindException(
String.format(
@@ -296,7 +296,7 @@ public class FieldGroup implements Serializable {
}
}
- private void throwIfPropertyIdAlreadyBound(Field<?> field, Object propertyId) {
+ private void throwIfPropertyIdAlreadyBound(LegacyField<?> field, Object propertyId) {
if (propertyIdToField.containsKey(propertyId)
&& propertyIdToField.get(propertyId) != field) {
throw new BindException("Property id " + propertyId
@@ -342,7 +342,7 @@ public class FieldGroup implements Serializable {
* If the field is not bound by this field binder or not bound
* to the correct property id
*/
- public void unbind(Field<?> field) throws BindException {
+ public void unbind(LegacyField<?> field) throws BindException {
Object propertyId = fieldToPropertyId.get(field);
if (propertyId == null) {
throw new BindException(
@@ -378,7 +378,7 @@ public class FieldGroup implements Serializable {
* @param field
* The field to update
*/
- protected void configureField(Field<?> field) {
+ protected void configureField(LegacyField<?> field) {
field.setBuffered(isBuffered());
field.setEnabled(isEnabled());
@@ -478,7 +478,7 @@ public class FieldGroup implements Serializable {
try {
firePreCommitEvent();
- Map<Field<?>, InvalidValueException> invalidValueExceptions = commitFields();
+ Map<LegacyField<?>, InvalidValueException> invalidValueExceptions = commitFields();
if (invalidValueExceptions.isEmpty()) {
firePostCommitEvent();
@@ -501,10 +501,10 @@ public class FieldGroup implements Serializable {
* @return a propertyId to validation exception map which is empty if all
* commits succeeded
*/
- private Map<Field<?>, InvalidValueException> commitFields() {
- Map<Field<?>, InvalidValueException> invalidValueExceptions = new HashMap<Field<?>, InvalidValueException>();
+ private Map<LegacyField<?>, InvalidValueException> commitFields() {
+ Map<LegacyField<?>, InvalidValueException> invalidValueExceptions = new HashMap<LegacyField<?>, InvalidValueException>();
- for (Field<?> f : fieldToPropertyId.keySet()) {
+ for (LegacyField<?> f : fieldToPropertyId.keySet()) {
try {
f.commit();
} catch (InvalidValueException e) {
@@ -523,7 +523,7 @@ public class FieldGroup implements Serializable {
*/
public static class FieldGroupInvalidValueException extends
InvalidValueException {
- private Map<Field<?>, InvalidValueException> invalidValueExceptions;
+ private Map<LegacyField<?>, InvalidValueException> invalidValueExceptions;
/**
* Constructs a new exception with the specified validation exceptions.
@@ -532,7 +532,7 @@ public class FieldGroup implements Serializable {
* a property id to exception map
*/
public FieldGroupInvalidValueException(
- Map<Field<?>, InvalidValueException> invalidValueExceptions) {
+ Map<LegacyField<?>, InvalidValueException> invalidValueExceptions) {
super(null, invalidValueExceptions.values().toArray(
new InvalidValueException[invalidValueExceptions.size()]));
this.invalidValueExceptions = invalidValueExceptions;
@@ -544,13 +544,13 @@ public class FieldGroup implements Serializable {
*
* @return a map with all the invalid value exceptions
*/
- public Map<Field<?>, InvalidValueException> getInvalidFields() {
+ public Map<LegacyField<?>, InvalidValueException> getInvalidFields() {
return invalidValueExceptions;
}
}
private void startTransactions() throws CommitException {
- for (Field<?> f : fieldToPropertyId.keySet()) {
+ for (LegacyField<?> f : fieldToPropertyId.keySet()) {
Property.Transactional<?> property = (Property.Transactional<?>) f
.getPropertyDataSource();
if (property == null) {
@@ -563,13 +563,13 @@ public class FieldGroup implements Serializable {
}
private void commitTransactions() {
- for (Field<?> f : fieldToPropertyId.keySet()) {
+ for (LegacyField<?> f : fieldToPropertyId.keySet()) {
((Property.Transactional<?>) f.getPropertyDataSource()).commit();
}
}
private void rollbackTransactions() {
- for (Field<?> f : fieldToPropertyId.keySet()) {
+ for (LegacyField<?> f : fieldToPropertyId.keySet()) {
try {
((Property.Transactional<?>) f.getPropertyDataSource())
.rollback();
@@ -616,7 +616,7 @@ public class FieldGroup implements Serializable {
*
*/
public void discard() {
- for (Field<?> f : fieldToPropertyId.keySet()) {
+ for (LegacyField<?> f : fieldToPropertyId.keySet()) {
try {
f.discard();
} catch (Exception e) {
@@ -635,7 +635,7 @@ public class FieldGroup implements Serializable {
* @return The field that is bound to the property id or null if no field is
* bound to that property id
*/
- public Field<?> getField(Object propertyId) {
+ public LegacyField<?> getField(Object propertyId) {
return propertyIdToField.get(propertyId);
}
@@ -647,7 +647,7 @@ public class FieldGroup implements Serializable {
* @return The property id that is bound to the field or null if the field
* is not bound to any property id by this FieldBinder
*/
- public Object getPropertyId(Field<?> field) {
+ public Object getPropertyId(LegacyField<?> field) {
return fieldToPropertyId.get(field);
}
@@ -751,14 +751,14 @@ public class FieldGroup implements Serializable {
/**
* Checks the validity of the bound fields.
* <p>
- * Call the {@link Field#validate()} for the fields to get the individual
+ * Call the {@link LegacyField#validate()} for the fields to get the individual
* error messages.
*
* @return true if all bound fields are valid, false otherwise.
*/
public boolean isValid() {
try {
- for (Field<?> field : getFields()) {
+ for (LegacyField<?> field : getFields()) {
field.validate();
}
return true;
@@ -773,7 +773,7 @@ public class FieldGroup implements Serializable {
* @return true if at least one field has been modified, false otherwise
*/
public boolean isModified() {
- for (Field<?> field : getFields()) {
+ for (LegacyField<?> field : getFields()) {
if (field.isModified()) {
return true;
}
@@ -807,7 +807,7 @@ public class FieldGroup implements Serializable {
* Binds member fields found in the given object.
* <p>
* This method processes all (Java) member fields whose type extends
- * {@link Field} and that can be mapped to a property id. Property id
+ * {@link LegacyField} and that can be mapped to a property id. Property id
* mapping is done based on the field name or on a @{@link PropertyId}
* annotation on the field. All non-null fields for which a property id can
* be determined are bound to the property id.
@@ -847,7 +847,7 @@ public class FieldGroup implements Serializable {
* that have not been initialized.
* <p>
* This method processes all (Java) member fields whose type extends
- * {@link Field} and that can be mapped to a property id. Property ids are
+ * {@link LegacyField} and that can be mapped to a property id. Property ids are
* searched in the following order: @{@link PropertyId} annotations, exact
* field name matches and the case-insensitive matching that ignores
* underscores. Fields that are not initialized (null) are built using the
@@ -892,7 +892,7 @@ public class FieldGroup implements Serializable {
* member fields that have not been initialized.
* <p>
* This method processes all (Java) member fields whose type extends
- * {@link Field} and that can be mapped to a property id. Property ids are
+ * {@link LegacyField} and that can be mapped to a property id. Property ids are
* searched in the following order: @{@link PropertyId} annotations, exact
* field name matches and the case-insensitive matching that ignores
* underscores. Fields that are not initialized (null) are built using the
@@ -912,7 +912,7 @@ public class FieldGroup implements Serializable {
for (java.lang.reflect.Field memberField : getFieldsInDeclareOrder(objectClass)) {
- if (!Field.class.isAssignableFrom(memberField.getType())) {
+ if (!LegacyField.class.isAssignableFrom(memberField.getType())) {
// Process next field
continue;
}
@@ -920,7 +920,7 @@ public class FieldGroup implements Serializable {
PropertyId propertyIdAnnotation = memberField
.getAnnotation(PropertyId.class);
- Class<? extends Field> fieldType = (Class<? extends Field>) memberField
+ Class<? extends LegacyField> fieldType = (Class<? extends LegacyField>) memberField
.getType();
Object propertyId = null;
@@ -950,11 +950,11 @@ public class FieldGroup implements Serializable {
continue;
}
- Field<?> field;
+ LegacyField<?> field;
try {
// Get the field from the object
- field = (Field<?>) ReflectTools.getJavaFieldValue(
- objectWithMemberFields, memberField, Field.class);
+ field = (LegacyField<?>) ReflectTools.getJavaFieldValue(
+ objectWithMemberFields, memberField, LegacyField.class);
} catch (Exception e) {
// If we cannot determine the value, just skip the field and try
// the next one
@@ -972,7 +972,7 @@ public class FieldGroup implements Serializable {
.createCaptionByPropertyId(propertyId);
}
- // Create the component (Field)
+ // Create the component (LegacyField)
field = build(caption, propertyType, fieldType);
// Store it in the field
@@ -1089,12 +1089,12 @@ public class FieldGroup implements Serializable {
* @return a map with all the invalid value exceptions. Can be empty but
* not null
*/
- public Map<Field<?>, InvalidValueException> getInvalidFields() {
+ public Map<LegacyField<?>, InvalidValueException> getInvalidFields() {
if (getCause() instanceof FieldGroupInvalidValueException) {
return ((FieldGroupInvalidValueException) getCause())
.getInvalidFields();
}
- return new HashMap<Field<?>, InvalidValueException>();
+ return new HashMap<LegacyField<?>, InvalidValueException>();
}
/**
@@ -1144,7 +1144,7 @@ public class FieldGroup implements Serializable {
* If there is a problem while building or binding
* @return The created and bound field
*/
- public Field<?> buildAndBind(Object propertyId) throws BindException {
+ public LegacyField<?> buildAndBind(Object propertyId) throws BindException {
String caption = DefaultFieldFactory
.createCaptionByPropertyId(propertyId);
return buildAndBind(caption, propertyId);
@@ -1161,11 +1161,11 @@ public class FieldGroup implements Serializable {
* finder.
* @throws BindException
* If there is a problem while building or binding
- * @return The created and bound field. Can be any type of {@link Field}.
+ * @return The created and bound field. Can be any type of {@link LegacyField}.
*/
- public Field<?> buildAndBind(String caption, Object propertyId)
+ public LegacyField<?> buildAndBind(String caption, Object propertyId)
throws BindException {
- return buildAndBind(caption, propertyId, Field.class);
+ return buildAndBind(caption, propertyId, LegacyField.class);
}
/**
@@ -1179,10 +1179,10 @@ public class FieldGroup implements Serializable {
* finder.
* @throws BindException
* If the field could not be created
- * @return The created and bound field. Can be any type of {@link Field}.
+ * @return The created and bound field. Can be any type of {@link LegacyField}.
*/
- public <T extends Field> T buildAndBind(String caption, Object propertyId,
+ public <T extends LegacyField> T buildAndBind(String caption, Object propertyId,
Class<T> fieldType) throws BindException {
Class<?> type = getPropertyType(propertyId);
@@ -1196,8 +1196,8 @@ public class FieldGroup implements Serializable {
* Creates a field based on the given data type.
* <p>
* The data type is the type that we want to edit using the field. The field
- * type is the type of field we want to create, can be {@link Field} if any
- * Field is good.
+ * type is the type of field we want to create, can be {@link LegacyField} if any
+ * LegacyField is good.
* </p>
*
* @param caption
@@ -1206,11 +1206,11 @@ public class FieldGroup implements Serializable {
* The data model type that we want to edit using the field
* @param fieldType
* The type of field that we want to create
- * @return A Field capable of editing the given type
+ * @return A LegacyField capable of editing the given type
* @throws BindException
* If the field could not be created
*/
- protected <T extends Field> T build(String caption, Class<?> dataType,
+ protected <T extends LegacyField> T build(String caption, Class<?> dataType,
Class<T> fieldType) throws BindException {
T field = getFieldFactory().createField(dataType, fieldType);
if (field == null) {
@@ -1224,7 +1224,7 @@ public class FieldGroup implements Serializable {
}
/**
- * Returns an array containing Field objects reflecting all the fields of
+ * Returns an array containing LegacyField objects reflecting all the fields of
* the class or interface represented by this Class object. The elements in
* the array returned are sorted in declare order from sub class to super
* class.
@@ -1252,9 +1252,9 @@ public class FieldGroup implements Serializable {
* @since 7.4
*/
public void clear() {
- for (Field<?> f : getFields()) {
- if (f instanceof AbstractField) {
- ((AbstractField) f).clear();
+ for (LegacyField<?> f : getFields()) {
+ if (f instanceof LegacyAbstractField) {
+ ((LegacyAbstractField) f).clear();
}
}
diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java b/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java
index 4aad08ba8d..fb2a579093 100644
--- a/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java
+++ b/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java
@@ -17,10 +17,10 @@ package com.vaadin.data.fieldgroup;
import java.io.Serializable;
-import com.vaadin.ui.Field;
+import com.vaadin.legacy.ui.LegacyField;
/**
- * Factory interface for creating new Field-instances based on the data type
+ * Factory interface for creating new LegacyField-instances based on the data type
* that should be edited.
*
* @author Vaadin Ltd.
@@ -33,10 +33,10 @@ public interface FieldGroupFieldFactory extends Serializable {
* @param dataType
* The type that we want to edit using the field
* @param fieldType
- * The type of field we want to create. If set to {@link Field}
+ * The type of field we want to create. If set to {@link LegacyField}
* then any type of field is accepted
* @return A field that can be assigned to the given fieldType and that is
* capable of editing the given type of data
*/
- <T extends Field> T createField(Class<?> dataType, Class<T> fieldType);
+ <T extends LegacyField> T createField(Class<?> dataType, Class<T> fieldType);
}
diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java b/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java
index e7fe50305e..c8be515c6d 100644
--- a/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java
+++ b/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java
@@ -21,13 +21,13 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Defines the custom property name to be bound to a {@link Field} using
+ * Defines the custom property name to be bound to a {@link LegacyField} using
* {@link FieldGroup} or {@link BeanFieldGroup}.
* <p>
* The automatic data binding in FieldGroup and BeanFieldGroup relies on a
* naming convention by default: properties of an item are bound to similarly
* named field components in given a editor object. If you want to map a
- * property with a different name (ID) to a {@link com.vaadin.client.ui.Field},
+ * property with a different name (ID) to a {@link com.vaadin.client.ui.LegacyField},
* you can use this annotation for the member fields, with the name (ID) of the
* desired property as the parameter.
* <p>
diff --git a/server/src/main/java/com/vaadin/event/FieldEvents.java b/server/src/main/java/com/vaadin/event/FieldEvents.java
index 364ac76ffd..c6109a79d2 100644
--- a/server/src/main/java/com/vaadin/event/FieldEvents.java
+++ b/server/src/main/java/com/vaadin/event/FieldEvents.java
@@ -19,17 +19,17 @@ package com.vaadin.event;
import java.io.Serializable;
import java.lang.reflect.Method;
+import com.vaadin.legacy.ui.LegacyField;
+import com.vaadin.legacy.ui.LegacyField.ValueChangeEvent;
import com.vaadin.shared.EventId;
import com.vaadin.shared.communication.FieldRpc.FocusAndBlurServerRpc;
import com.vaadin.ui.Component;
import com.vaadin.ui.Component.Event;
-import com.vaadin.ui.Field;
-import com.vaadin.ui.Field.ValueChangeEvent;
import com.vaadin.ui.TextField;
import com.vaadin.util.ReflectTools;
/**
- * Interface that serves as a wrapper for {@link Field} related events.
+ * Interface that serves as a wrapper for {@link LegacyField} related events.
*/
public interface FieldEvents {
@@ -53,7 +53,7 @@ public interface FieldEvents {
public interface FocusNotifier extends Serializable {
/**
* Adds a <code>FocusListener</code> to the Component which gets fired
- * when a <code>Field</code> receives keyboard focus.
+ * when a <code>LegacyField</code> receives keyboard focus.
*
* @param listener
* @see FocusListener
@@ -105,7 +105,7 @@ public interface FieldEvents {
public interface BlurNotifier extends Serializable {
/**
* Adds a <code>BlurListener</code> to the Component which gets fired
- * when a <code>Field</code> loses keyboard focus.
+ * when a <code>LegacyField</code> loses keyboard focus.
*
* @param listener
* @see BlurListener
@@ -139,7 +139,7 @@ public interface FieldEvents {
/**
* <code>FocusEvent</code> class for holding additional event information.
- * Fired when a <code>Field</code> receives keyboard focus.
+ * Fired when a <code>LegacyField</code> receives keyboard focus.
*
* @since 6.2
*/
@@ -158,7 +158,7 @@ public interface FieldEvents {
/**
* <code>FocusListener</code> interface for listening for
- * <code>FocusEvent</code> fired by a <code>Field</code>.
+ * <code>FocusEvent</code> fired by a <code>LegacyField</code>.
*
* @see FocusEvent
* @since 6.2
@@ -179,7 +179,7 @@ public interface FieldEvents {
/**
* <code>BlurEvent</code> class for holding additional event information.
- * Fired when a <code>Field</code> loses keyboard focus.
+ * Fired when a <code>LegacyField</code> loses keyboard focus.
*
* @since 6.2
*/
@@ -198,7 +198,7 @@ public interface FieldEvents {
/**
* <code>BlurListener</code> interface for listening for
- * <code>BlurEvent</code> fired by a <code>Field</code>.
+ * <code>BlurEvent</code> fired by a <code>LegacyField</code>.
*
* @see BlurEvent
* @since 6.2
@@ -281,7 +281,7 @@ public interface FieldEvents {
}
/**
- * An interface implemented by a {@link Field} supporting
+ * An interface implemented by a {@link LegacyField} supporting
* {@link TextChangeEvent}s. An example a {@link TextField} supports
* {@link TextChangeListener}s.
*/
diff --git a/server/src/main/java/com/vaadin/ui/AbstractField.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java
index 6d25076526..d1b013a64a 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractField.java
+++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java
@@ -14,7 +14,7 @@
* the License.
*/
-package com.vaadin.ui;
+package com.vaadin.legacy.ui;
import java.io.Serializable;
import java.lang.reflect.Method;
@@ -47,6 +47,8 @@ import com.vaadin.server.CompositeErrorMessage;
import com.vaadin.server.ErrorMessage;
import com.vaadin.shared.AbstractFieldState;
import com.vaadin.shared.util.SharedUtil;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Component;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
@@ -55,13 +57,13 @@ import com.vaadin.ui.declarative.DesignContext;
* Abstract field component for implementing buffered property editors. The
* field may hold an internal value, or it may be connected to any data source
* that implements the {@link com.vaadin.data.Property}interface.
- * <code>AbstractField</code> implements that interface itself, too, so
+ * <code>LegacyAbstractField</code> implements that interface itself, too, so
* accessing the Property value represented by it is straightforward.
* </p>
*
* <p>
- * AbstractField also provides the {@link com.vaadin.data.Buffered} interface
- * for buffering the data source value. By default the Field is in write
+ * LegacyAbstractField also provides the {@link com.vaadin.data.Buffered} interface
+ * for buffering the data source value. By default the LegacyField is in write
* through-mode and {@link #setWriteThrough(boolean)}should be called to enable
* buffering.
* </p>
@@ -75,8 +77,8 @@ import com.vaadin.ui.declarative.DesignContext;
* @since 3.0
*/
@SuppressWarnings("serial")
-public abstract class AbstractField<T> extends AbstractComponent implements
- Field<T>, Property.ReadOnlyStatusChangeListener,
+public abstract class LegacyAbstractField<T> extends AbstractComponent implements
+ LegacyField<T>, Property.ReadOnlyStatusChangeListener,
Property.ReadOnlyStatusChangeNotifier, Action.ShortcutNotifier {
/* Private members */
@@ -185,13 +187,13 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
/**
- * Returns the type of the Field. The methods <code>getValue</code> and
+ * Returns the type of the LegacyField. The methods <code>getValue</code> and
* <code>setValue</code> must be compatible with this type: one must be able
* to safely cast the value returned from <code>getValue</code> to the given
* type and pass any variable assignable to this type as an argument to
* <code>setValue</code>.
*
- * @return the type of the Field
+ * @return the type of the LegacyField
*/
@Override
public abstract Class<? extends T> getType();
@@ -242,7 +244,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* here, we use the default documentation from the implemented interface.
*/
@Override
- public void commit() throws Buffered.SourceException, InvalidValueException {
+ public void commit() throws Buffered.SourceException,
+ InvalidValueException {
if (dataSource != null && !dataSource.isReadOnly()) {
if ((isInvalidCommitted() || isValid())) {
try {
@@ -339,7 +342,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
/**
- * Sets the buffered mode of this Field.
+ * Sets the buffered mode of this LegacyField.
* <p>
* When the field is in buffered mode, changes will not be committed to the
* property data source until {@link #commit()} is called.
@@ -367,7 +370,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
/**
- * Checks the buffered mode of this Field.
+ * Checks the buffered mode of this LegacyField.
*
* @return true if buffered mode is on, false otherwise
*/
@@ -382,7 +385,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* or disabled.
* <p>
* If legacy Property toString mode is enabled, returns the value of this
- * <code>Field</code> converted to a String.
+ * <code>LegacyField</code> converted to a String.
* </p>
* <p>
* If legacy Property toString mode is disabled, the string representation
@@ -493,7 +496,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
throw new Property.ReadOnlyException();
}
try {
- T doubleConvertedFieldValue = convertFromModel(convertToModel(newFieldValue));
+ T doubleConvertedFieldValue = convertFromModel(convertToModel(
+ newFieldValue));
if (!SharedUtil
.equals(newFieldValue, doubleConvertedFieldValue)) {
newFieldValue = doubleConvertedFieldValue;
@@ -507,7 +511,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
// Repaint is needed even when the client thinks that it knows the
// new state if validity of the component may change
if (repaintIsNotNeeded
- && (isRequired() || hasValidators() || getConverter() != null)) {
+ && (isRequired() || hasValidators()
+ || getConverter() != null)) {
repaintIsNotNeeded = false;
}
@@ -612,8 +617,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* registers itself as a listener and updates itself according to the events
* it receives. To avoid memory leaks caused by references to a field no
* longer in use, the listener registrations are removed on
- * {@link AbstractField#detach() detach} and re-added on
- * {@link AbstractField#attach() attach}.
+ * {@link LegacyAbstractField#detach() detach} and re-added on
+ * {@link LegacyAbstractField#attach() attach}.
* </p>
*
* <p>
@@ -686,7 +691,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
// Fires value change if the value has changed
T value = getInternalValue();
if ((value != oldValue)
- && ((value != null && !value.equals(oldValue)) || value == null)) {
+ && ((value != null && !value.equals(oldValue))
+ || value == null)) {
fireValueChange(false);
}
}
@@ -828,7 +834,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* Returns the current value (as returned by {@link #getValue()}) converted
* to the data source type.
* <p>
- * This returns the same as {@link AbstractField#getValue()} if no converter
+ * This returns the same as {@link LegacyAbstractField#getValue()} if no converter
* has been set. The value is not necessarily the same as the data source
* value e.g. if the field is in buffered mode and has been modified.
* </p>
@@ -938,7 +944,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
/**
- * Checks the validity of the Field.
+ * Checks the validity of the LegacyField.
*
* A field is invalid if it is set as required (using
* {@link #setRequired(boolean)} and is empty, if one or several of the
@@ -1010,7 +1016,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
InvalidValueException[] exceptionArray = validationExceptions
- .toArray(new InvalidValueException[validationExceptions.size()]);
+ .toArray(new InvalidValueException[validationExceptions
+ .size()]);
// Create a composite validator and include all exceptions
throw new Validator.InvalidValueException(null, exceptionArray);
@@ -1087,10 +1094,11 @@ public abstract class AbstractField<T> extends AbstractComponent implements
return new CompositeErrorMessage(
new ErrorMessage[] {
superError,
- AbstractErrorMessage
- .getErrorMessageForException(validationError),
AbstractErrorMessage
- .getErrorMessageForException(getCurrentBufferedSourceException()) });
+ .getErrorMessageForException(validationError),
+ AbstractErrorMessage
+ .getErrorMessageForException(
+ getCurrentBufferedSourceException()) });
}
@@ -1106,7 +1114,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
} catch (final java.lang.NoSuchMethodException e) {
// This should never happen
throw new java.lang.RuntimeException(
- "Internal error finding methods in AbstractField");
+ "Internal error finding methods in LegacyAbstractField");
}
}
@@ -1116,7 +1124,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
*/
@Override
public void addValueChangeListener(Property.ValueChangeListener listener) {
- addListener(AbstractField.ValueChangeEvent.class, listener,
+ addListener(LegacyAbstractField.ValueChangeEvent.class, listener,
VALUE_CHANGE_METHOD);
// ensure "automatic immediate handling" works
markAsDirty();
@@ -1138,8 +1146,9 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* interface.
*/
@Override
- public void removeValueChangeListener(Property.ValueChangeListener listener) {
- removeListener(AbstractField.ValueChangeEvent.class, listener,
+ public void removeValueChangeListener(
+ Property.ValueChangeListener listener) {
+ removeListener(LegacyAbstractField.ValueChangeEvent.class, listener,
VALUE_CHANGE_METHOD);
// ensure "automatic immediate handling" works
markAsDirty();
@@ -1160,7 +1169,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* validated before the event is created.
*/
protected void fireValueChange(boolean repaintIsNotNeeded) {
- fireEvent(new AbstractField.ValueChangeEvent(this));
+ fireEvent(new LegacyAbstractField.ValueChangeEvent(this));
if (!repaintIsNotNeeded) {
markAsDirty();
}
@@ -1175,11 +1184,12 @@ public abstract class AbstractField<T> extends AbstractComponent implements
READ_ONLY_STATUS_CHANGE_METHOD = Property.ReadOnlyStatusChangeListener.class
.getDeclaredMethod(
"readOnlyStatusChange",
- new Class[] { Property.ReadOnlyStatusChangeEvent.class });
+ new Class[] {
+ Property.ReadOnlyStatusChangeEvent.class });
} catch (final java.lang.NoSuchMethodException e) {
// This should never happen
throw new java.lang.RuntimeException(
- "Internal error finding methods in AbstractField");
+ "Internal error finding methods in LegacyAbstractField");
}
}
@@ -1219,7 +1229,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* @param source
* the Source of the event.
*/
- public ReadOnlyStatusChangeEvent(AbstractField source) {
+ public ReadOnlyStatusChangeEvent(LegacyAbstractField source) {
super(source);
}
@@ -1283,7 +1293,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* is validated before the event is created.
*/
protected void fireReadOnlyStatusChange() {
- fireEvent(new AbstractField.ReadOnlyStatusChangeEvent(this));
+ fireEvent(new LegacyAbstractField.ReadOnlyStatusChangeEvent(this));
}
/**
@@ -1374,8 +1384,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
/**
- * Sets the internal field value. This is purely used by AbstractField to
- * change the internal Field value. It does not trigger valuechange events.
+ * Sets the internal field value. This is purely used by LegacyAbstractField to
+ * change the internal LegacyField value. It does not trigger valuechange events.
* It can be overridden by the inheriting classes to update all dependent
* variables.
*
@@ -1609,7 +1619,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
/**
* A ready-made {@link ShortcutListener} that focuses the given
- * {@link Focusable} (usually a {@link Field}) when the keyboard shortcut is
+ * {@link Focusable} (usually a {@link LegacyField}) when the keyboard shortcut is
* invoked.
*
*/
@@ -1640,7 +1650,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* @param modifiers
* modifiers required to invoke the shortcut
*/
- public FocusShortcut(Focusable focusable, int keyCode, int... modifiers) {
+ public FocusShortcut(Focusable focusable, int keyCode,
+ int... modifiers) {
super(null, keyCode, modifiers);
this.focusable = focusable;
}
@@ -1838,7 +1849,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
@Override
public void writeDesign(Element design, DesignContext designContext) {
super.writeDesign(design, designContext);
- AbstractField def = (AbstractField) designContext
+ LegacyAbstractField def = (LegacyAbstractField) designContext
.getDefaultInstance(this);
Attributes attr = design.attributes();
// handle readonly
@@ -1847,6 +1858,6 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
private static final Logger getLogger() {
- return Logger.getLogger(AbstractField.class.getName());
+ return Logger.getLogger(LegacyAbstractField.class.getName());
}
}
diff --git a/server/src/main/java/com/vaadin/ui/Field.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyField.java
index 8a9acd570f..a3ac84871d 100644
--- a/server/src/main/java/com/vaadin/ui/Field.java
+++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyField.java
@@ -14,20 +14,22 @@
* the License.
*/
-package com.vaadin.ui;
+package com.vaadin.legacy.ui;
import com.vaadin.data.BufferedValidatable;
import com.vaadin.data.Property;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Component.Event;
import com.vaadin.ui.Component.Focusable;
/**
- * Field interface is implemented by all classes (field components) that have a
+ * LegacyField interface is implemented by all classes (field components) that have a
* value that the user can change through the user interface.
*
- * Field components are built upon the framework defined in the Field interface
- * and the {@link com.vaadin.AbstractField} base class.
+ * LegacyField components are built upon the framework defined in the LegacyField interface
+ * and the {@link com.vaadin.LegacyAbstractField} base class.
*
- * The Field interface inherits the {@link com.vaadin.ui.Component}
+ * The LegacyField interface inherits the {@link com.vaadin.ui.Component}
* superinterface and also the {@link com.vaadin.ui.Property} interface to have
* a value for the field.
*
@@ -40,7 +42,7 @@ import com.vaadin.ui.Component.Focusable;
*
* @author IT Mill Ltd.
*/
-public interface Field<T> extends Component, BufferedValidatable, Property<T>,
+public interface LegacyField<T> extends Component, BufferedValidatable, Property<T>,
Property.ValueChangeNotifier, Property.ValueChangeListener,
Property.Editor, Focusable {
@@ -83,7 +85,7 @@ public interface Field<T> extends Component, BufferedValidatable, Property<T>,
public String getRequiredError();
/**
- * An <code>Event</code> object specifying the Field whose value has been
+ * An <code>Event</code> object specifying the LegacyField whose value has been
* changed.
*
* @author Vaadin Ltd.
@@ -99,7 +101,7 @@ public interface Field<T> extends Component, BufferedValidatable, Property<T>,
* @param source
* the field that caused the event.
*/
- public ValueChangeEvent(Field source) {
+ public ValueChangeEvent(LegacyField source) {
super(source);
}
diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java
index 304dd4bec6..d99bd75de8 100644
--- a/server/src/main/java/com/vaadin/server/VaadinSession.java
+++ b/server/src/main/java/com/vaadin/server/VaadinSession.java
@@ -51,8 +51,8 @@ import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.ConverterFactory;
import com.vaadin.data.util.converter.DefaultConverterFactory;
import com.vaadin.event.EventRouter;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.shared.communication.PushMode;
-import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
import com.vaadin.util.CurrentInstance;
@@ -615,7 +615,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
* </p>
* <p>
* The {@link Converter} for an individual field can be overridden using
- * {@link AbstractField#setConverter(Converter)} and for individual property
+ * {@link LegacyAbstractField#setConverter(Converter)} and for individual property
* ids in a {@link Table} using
* {@link Table#setConverter(Object, Converter)}.
* </p>
diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java
index 8fa1f523ff..24f1ef098b 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java
@@ -39,6 +39,8 @@ import com.vaadin.event.ConnectorActionManager;
import com.vaadin.event.ContextClickEvent;
import com.vaadin.event.ContextClickEvent.ContextClickListener;
import com.vaadin.event.ContextClickEvent.ContextClickNotifier;
+import com.vaadin.legacy.ui.LegacyField;
+import com.vaadin.legacy.ui.LegacyField.ValueChangeEvent;
import com.vaadin.event.ShortcutListener;
import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.AbstractErrorMessage.ContentMode;
@@ -59,7 +61,6 @@ import com.vaadin.shared.EventId;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.ComponentStateUtil;
import com.vaadin.shared.util.SharedUtil;
-import com.vaadin.ui.Field.ValueChangeEvent;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
import com.vaadin.util.ReflectTools;
@@ -1345,7 +1346,7 @@ public abstract class AbstractComponent extends AbstractClientConnector
/**
* Gets the {@link ActionManager} used to manage the
- * {@link ShortcutListener}s added to this {@link Field}.
+ * {@link ShortcutListener}s added to this {@link LegacyField}.
*
* @return the ActionManager in use
*/
diff --git a/server/src/main/java/com/vaadin/ui/AbstractSelect.java b/server/src/main/java/com/vaadin/ui/AbstractSelect.java
index 882458c531..bf0e7274f4 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractSelect.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractSelect.java
@@ -47,6 +47,7 @@ import com.vaadin.event.dd.TargetDetailsImpl;
import com.vaadin.event.dd.acceptcriteria.ClientSideCriterion;
import com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor;
import com.vaadin.event.dd.acceptcriteria.TargetDetailIs;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.server.KeyMapper;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
@@ -78,7 +79,7 @@ import com.vaadin.ui.declarative.DesignFormatter;
*/
@SuppressWarnings("serial")
// TODO currently cannot specify type more precisely in case of multi-select
-public abstract class AbstractSelect extends AbstractField<Object> implements
+public abstract class AbstractSelect extends LegacyAbstractField<Object> implements
Container, Container.Viewer, Container.PropertySetChangeListener,
Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier,
Container.ItemSetChangeListener, LegacyComponent {
@@ -646,7 +647,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
/**
* Gets the selected item id or in multiselect mode a set of selected ids.
*
- * @see com.vaadin.ui.AbstractField#getValue()
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#getValue()
*/
@Override
public Object getValue() {
@@ -686,7 +687,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
*
* @param newValue
* the New selected item or collection of selected items.
- * @see com.vaadin.ui.AbstractField#setValue(java.lang.Object)
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#setValue(java.lang.Object)
*/
@Override
public void setValue(Object newValue) throws Property.ReadOnlyException {
@@ -713,7 +714,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* True if caller is sure that repaint is not needed.
* @param ignoreReadOnly
* True if read-only check should be omitted.
- * @see com.vaadin.ui.AbstractField#setValue(java.lang.Object,
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#setValue(java.lang.Object,
* java.lang.Boolean)
*/
@Override
@@ -1788,7 +1789,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* For multi-selectable fields, also an empty collection of values is
* considered to be an empty field.
*
- * @see AbstractField#isEmpty().
+ * @see LegacyAbstractField#isEmpty().
*/
@Override
public boolean isEmpty() {
@@ -1875,7 +1876,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
/**
* Notifies the component that it is connected to an application.
*
- * @see com.vaadin.ui.AbstractField#attach()
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#attach()
*/
@Override
public void attach() {
diff --git a/server/src/main/java/com/vaadin/ui/AbstractTextField.java b/server/src/main/java/com/vaadin/ui/AbstractTextField.java
index 5fbe60937a..c3b911a56b 100644
--- a/server/src/main/java/com/vaadin/ui/AbstractTextField.java
+++ b/server/src/main/java/com/vaadin/ui/AbstractTextField.java
@@ -31,6 +31,7 @@ import com.vaadin.event.FieldEvents.FocusNotifier;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.event.FieldEvents.TextChangeNotifier;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.shared.ui.textfield.AbstractTextFieldState;
@@ -38,7 +39,7 @@ import com.vaadin.shared.ui.textfield.TextFieldConstants;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
-public abstract class AbstractTextField extends AbstractField<String> implements
+public abstract class AbstractTextField extends LegacyAbstractField<String> implements
BlurNotifier, FocusNotifier, TextChangeNotifier, LegacyComponent {
/**
@@ -457,7 +458,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements
* Make sure w reset lastKnownTextContent field on value change. The
* clearing must happen here as well because TextChangeListener can
* revert the original value. Client must respect the value in this
- * case. AbstractField optimizes value change if the existing value is
+ * case. LegacyAbstractField optimizes value change if the existing value is
* reset. Also we need to force repaint if the flag is on.
*/
if (lastKnownTextContent != null) {
diff --git a/server/src/main/java/com/vaadin/ui/CheckBox.java b/server/src/main/java/com/vaadin/ui/CheckBox.java
index 8b31edcbb4..e9e9b0d4b9 100644
--- a/server/src/main/java/com/vaadin/ui/CheckBox.java
+++ b/server/src/main/java/com/vaadin/ui/CheckBox.java
@@ -27,13 +27,14 @@ import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcImpl;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc;
import com.vaadin.shared.ui.checkbox.CheckBoxState;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
-public class CheckBox extends AbstractField<Boolean> {
+public class CheckBox extends LegacyAbstractField<Boolean> {
private CheckBoxServerRpc rpc = new CheckBoxServerRpc() {
@@ -129,8 +130,8 @@ public class CheckBox extends AbstractField<Boolean> {
}
/*
- * Overridden to keep the shared state in sync with the AbstractField
- * internal value. Should be removed once AbstractField is refactored to use
+ * Overridden to keep the shared state in sync with the LegacyAbstractField
+ * internal value. Should be removed once LegacyAbstractField is refactored to use
* shared state.
*
* See tickets #10921 and #11064.
diff --git a/server/src/main/java/com/vaadin/ui/Component.java b/server/src/main/java/com/vaadin/ui/Component.java
index 5db48806c3..0e8b385128 100644
--- a/server/src/main/java/com/vaadin/ui/Component.java
+++ b/server/src/main/java/com/vaadin/ui/Component.java
@@ -24,6 +24,7 @@ import org.jsoup.nodes.Element;
import com.vaadin.event.ConnectorEvent;
import com.vaadin.event.ConnectorEventListener;
import com.vaadin.event.FieldEvents;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.ClientConnector;
import com.vaadin.server.ErrorMessage;
import com.vaadin.server.Resource;
@@ -378,7 +379,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable {
/**
* Tests whether the component is in the read-only mode. The user can not
- * change the value of a read-only component. As only {@link Field}
+ * change the value of a read-only component. As only {@link LegacyField}
* components normally have a value that can be input or changed by the
* user, this is mostly relevant only to field components, though not
* restricted to them.
@@ -405,7 +406,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable {
* can not change the value of a read-only component.
*
* <p>
- * As only {@link Field} components normally have a value that can be input
+ * As only {@link LegacyField} components normally have a value that can be input
* or changed by the user, this is mostly relevant only to field components,
* though not restricted to them.
* </p>
@@ -1021,13 +1022,13 @@ public interface Component extends ClientConnector, Sizeable, Serializable {
/**
* A sub-interface implemented by components that can obtain input focus.
- * This includes all {@link Field} components as well as some other
+ * This includes all {@link LegacyField} components as well as some other
* components, such as {@link Upload}.
*
* <p>
* Focus can be set with {@link #focus()}. This interface does not provide
* an accessor that would allow finding out the currently focused component;
- * focus information can be acquired for some (but not all) {@link Field}
+ * focus information can be acquired for some (but not all) {@link LegacyField}
* components through the {@link com.vaadin.event.FieldEvents.FocusListener}
* and {@link com.vaadin.event.FieldEvents.BlurListener} interfaces.
* </p>
@@ -1061,7 +1062,7 @@ public interface Component extends ClientConnector, Sizeable, Serializable {
* <p>
* Notice that this interface does not provide an accessor that would
* allow finding out the currently focused component. Focus information
- * can be acquired for some (but not all) {@link Field} components
+ * can be acquired for some (but not all) {@link LegacyField} components
* through the {@link com.vaadin.event.FieldEvents.FocusListener} and
* {@link com.vaadin.event.FieldEvents.BlurListener} interfaces.
* </p>
diff --git a/server/src/main/java/com/vaadin/ui/CustomField.java b/server/src/main/java/com/vaadin/ui/CustomField.java
index 12f00ac23f..311a2069a3 100644
--- a/server/src/main/java/com/vaadin/ui/CustomField.java
+++ b/server/src/main/java/com/vaadin/ui/CustomField.java
@@ -20,9 +20,11 @@ import java.io.Serializable;
import java.util.Iterator;
import com.vaadin.data.Property;
+import com.vaadin.legacy.ui.LegacyField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
/**
- * A {@link Field} whose UI content can be constructed by the user, enabling the
+ * A {@link LegacyField} whose UI content can be constructed by the user, enabling the
* creation of e.g. form fields by composing Vaadin components. Customization of
* both the visual presentation and the logic of the field is possible.
*
@@ -43,7 +45,7 @@ import com.vaadin.data.Property;
*
* @since 7.0
*/
-public abstract class CustomField<T> extends AbstractField<T> implements
+public abstract class CustomField<T> extends LegacyAbstractField<T> implements
HasComponents {
/**
diff --git a/server/src/main/java/com/vaadin/ui/DateField.java b/server/src/main/java/com/vaadin/ui/DateField.java
index 052539cd28..6ceae9962c 100644
--- a/server/src/main/java/com/vaadin/ui/DateField.java
+++ b/server/src/main/java/com/vaadin/ui/DateField.java
@@ -38,6 +38,8 @@ import com.vaadin.event.FieldEvents.BlurEvent;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.event.FieldEvents.FocusEvent;
import com.vaadin.event.FieldEvents.FocusListener;
+import com.vaadin.legacy.ui.LegacyAbstractField;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.shared.ui.datefield.DateFieldConstants;
@@ -52,20 +54,20 @@ import com.vaadin.ui.declarative.DesignContext;
* compatible with <code>java.util.Date</code>.
* </p>
* <p>
- * Since <code>DateField</code> extends <code>AbstractField</code> it implements
- * the {@link com.vaadin.data.Buffered}interface.
+ * Since <code>DateField</code> extends <code>LegacyAbstractField</code> it
+ * implements the {@link com.vaadin.data.Buffered}interface.
* </p>
* <p>
* A <code>DateField</code> is in write-through mode by default, so
- * {@link com.vaadin.ui.AbstractField#setWriteThrough(boolean)}must be called to
- * enable buffering.
+ * {@link com.vaadin.legacy.ui.LegacyAbstractField#setWriteThrough(boolean)}must
+ * be called to enable buffering.
* </p>
*
* @author Vaadin Ltd.
* @since 3.0
*/
@SuppressWarnings("serial")
-public class DateField extends AbstractField<Date> implements
+public class DateField extends LegacyAbstractField<Date> implements
FieldEvents.BlurNotifier, FieldEvents.FocusNotifier, LegacyComponent {
/**
@@ -152,7 +154,7 @@ public class DateField extends AbstractField<Date> implements
private TimeZone timeZone = null;
- private static Map<Resolution, String> variableNameForResolution = new HashMap<Resolution, String>();
+ private static Map<Resolution, String> variableNameForResolution = new HashMap<>();
private String dateOutOfRangeMessage = "Date is out of allowed range";
@@ -485,7 +487,7 @@ public class DateField extends AbstractField<Date> implements
|| variables.containsKey("min")
|| variables.containsKey("sec")
|| variables.containsKey("msec") || variables
- .containsKey("dateString"))) {
+ .containsKey("dateString"))) {
// Old and new dates
final Date oldDate = getValue();
@@ -497,7 +499,7 @@ public class DateField extends AbstractField<Date> implements
// Gets the new date in parts
boolean hasChanges = false;
- Map<Resolution, Integer> calendarFieldChanges = new HashMap<Resolution, Integer>();
+ Map<Resolution, Integer> calendarFieldChanges = new HashMap<>();
for (Resolution r : Resolution
.getResolutionsHigherOrEqualTo(resolution)) {
@@ -543,7 +545,8 @@ public class DateField extends AbstractField<Date> implements
newDate = cal.getTime();
}
- if (newDate == null && dateString != null && !"".equals(dateString)) {
+ if (newDate == null && dateString != null && !"".equals(
+ dateString)) {
try {
Date parsedDate = handleUnparsableDateString(dateString);
setValue(parsedDate, true);
@@ -731,7 +734,7 @@ public class DateField extends AbstractField<Date> implements
Form f = (Form) parenOfDateField;
Collection<?> visibleItemProperties = f.getItemPropertyIds();
for (Object fieldId : visibleItemProperties) {
- Field<?> field = f.getField(fieldId);
+ LegacyField<?> field = f.getField(fieldId);
if (equals(field)) {
/*
* this datefield is logically in a form. Do the same
@@ -813,7 +816,8 @@ public class DateField extends AbstractField<Date> implements
// Start by a zeroed calendar to avoid having values for lower
// resolution variables e.g. time when resolution is day
int min, field;
- for (Resolution r : Resolution.getResolutionsLowerThan(resolution)) {
+ for (Resolution r : Resolution.getResolutionsLowerThan(
+ resolution)) {
field = r.getCalendarField();
min = calendar.getActualMinimum(field);
calendar.set(field, min);
@@ -981,7 +985,7 @@ public class DateField extends AbstractField<Date> implements
* invalid if it contains text typed in by the user that couldn't be parsed
* into a Date value.
*
- * @see com.vaadin.ui.AbstractField#validate()
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#validate()
*/
@Override
public void validate() throws InvalidValueException {
diff --git a/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java b/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java
index 535943bcd5..85ad1743ea 100644
--- a/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java
+++ b/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java
@@ -20,6 +20,7 @@ import java.util.Date;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.shared.util.SharedUtil;
/**
@@ -49,21 +50,21 @@ public class DefaultFieldFactory implements FormFieldFactory, TableFieldFactory
}
@Override
- public Field<?> createField(Item item, Object propertyId,
+ public LegacyField<?> createField(Item item, Object propertyId,
Component uiContext) {
Class<?> type = item.getItemProperty(propertyId).getType();
- Field<?> field = createFieldByPropertyType(type);
+ LegacyField<?> field = createFieldByPropertyType(type);
field.setCaption(createCaptionByPropertyId(propertyId));
return field;
}
@Override
- public Field createField(Container container, Object itemId,
+ public LegacyField createField(Container container, Object itemId,
Object propertyId, Component uiContext) {
Property containerProperty = container.getContainerProperty(itemId,
propertyId);
Class<?> type = containerProperty.getType();
- Field<?> field = createFieldByPropertyType(type);
+ LegacyField<?> field = createFieldByPropertyType(type);
field.setCaption(createCaptionByPropertyId(propertyId));
return field;
}
@@ -93,9 +94,9 @@ public class DefaultFieldFactory implements FormFieldFactory, TableFieldFactory
*
* @param type
* the type of the property
- * @return the most suitable generic {@link Field} for given type
+ * @return the most suitable generic {@link LegacyField} for given type
*/
- public static Field<?> createFieldByPropertyType(Class<?> type) {
+ public static LegacyField<?> createFieldByPropertyType(Class<?> type) {
// Null typed properties can not be edited
if (type == null) {
return null;
diff --git a/server/src/main/java/com/vaadin/ui/Form.java b/server/src/main/java/com/vaadin/ui/Form.java
index 45532756e5..606f6ee5f9 100644
--- a/server/src/main/java/com/vaadin/ui/Form.java
+++ b/server/src/main/java/com/vaadin/ui/Form.java
@@ -36,6 +36,8 @@ import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.Action.ShortcutNotifier;
import com.vaadin.event.ActionManager;
+import com.vaadin.legacy.ui.LegacyAbstractField;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.AbstractErrorMessage;
import com.vaadin.server.CompositeErrorMessage;
import com.vaadin.server.ErrorMessage;
@@ -48,7 +50,7 @@ import com.vaadin.shared.ui.form.FormState;
* Form component provides easy way of creating and managing sets fields.
*
* <p>
- * <code>Form</code> is a container for fields implementing {@link Field}
+ * <code>Form</code> is a container for fields implementing {@link LegacyField}
* interface. 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,
@@ -76,7 +78,7 @@ import com.vaadin.shared.ui.form.FormState;
* more flexibility.
*/
@Deprecated
-public class Form extends AbstractField<Object> implements Item.Editor,
+public class Form extends LegacyAbstractField<Object> implements Item.Editor,
Buffered, Item, Validatable, Action.Notifier, HasComponents,
LegacyComponent {
@@ -90,7 +92,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
/**
* Ordered list of property ids in this editor.
*/
- private final LinkedList<Object> propertyIds = new LinkedList<Object>();
+ private final LinkedList<Object> propertyIds = new LinkedList<>();
/**
* Current buffered source exception.
@@ -105,12 +107,12 @@ public class Form extends AbstractField<Object> implements Item.Editor,
/**
* Mapping from propertyName to corresponding field.
*/
- private final HashMap<Object, Field<?>> fields = new HashMap<Object, Field<?>>();
+ private final HashMap<Object, LegacyField<?>> fields = new HashMap<>();
/**
* Form may act as an Item, its own properties are stored here.
*/
- private final HashMap<Object, Property<?>> ownProperties = new HashMap<Object, Property<?>>();
+ private final HashMap<Object, Property<?>> ownProperties = new HashMap<>();
/**
* Field factory for this form.
@@ -131,7 +133,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*/
private final ValueChangeListener fieldValueChangeListener = new ValueChangeListener() {
@Override
- public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) {
+ public void valueChange(
+ com.vaadin.data.Property.ValueChangeEvent event) {
markAsDirty();
}
};
@@ -147,9 +150,9 @@ public class Form extends AbstractField<Object> implements Item.Editor,
/**
* Keeps track of the Actions added to this component, and manages the
- * painting and handling as well. Note that the extended AbstractField is a
- * {@link ShortcutNotifier} and has a actionManager that delegates actions
- * to the containing window. This one does not delegate.
+ * painting and handling as well. Note that the extended LegacyAbstractField
+ * is a {@link ShortcutNotifier} and has a actionManager that delegates
+ * actions to the containing window. This one does not delegate.
*/
private ActionManager ownActionManager = new ActionManager(this);
@@ -236,7 +239,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
// getErrorMessage() recursively instead of validate().
ErrorMessage validationError = null;
if (isValidationVisible()) {
- for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) {
+ for (final Iterator<Object> i = propertyIds.iterator(); i
+ .hasNext();) {
Object f = fields.get(i.next());
if (f instanceof AbstractComponent) {
AbstractComponent field = (AbstractComponent) f;
@@ -248,7 +252,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
validationError = new UserError(field.getCaption());
}
break;
- } else if (f instanceof Field && !((Field<?>) f).isValid()) {
+ } else if (f instanceof LegacyField && !((LegacyField<?>) f)
+ .isValid()) {
// Something is wrong with the field, but no proper
// error is given. Generate one.
validationError = new UserError(field.getCaption());
@@ -270,7 +275,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
getComponentError(),
validationError,
AbstractErrorMessage
- .getErrorMessageForException(currentBufferedSourceException) });
+ .getErrorMessageForException(
+ currentBufferedSourceException) });
}
/**
@@ -308,7 +314,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* use the default one from the interface.
*/
@Override
- public void commit() throws Buffered.SourceException, InvalidValueException {
+ public void commit() throws Buffered.SourceException,
+ InvalidValueException {
LinkedList<SourceException> problems = null;
@@ -329,14 +336,14 @@ public class Form extends AbstractField<Object> implements Item.Editor,
// Try to commit all
for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) {
try {
- final Field<?> f = (fields.get(i.next()));
+ final LegacyField<?> f = (fields.get(i.next()));
// Commit only non-readonly fields.
if (!f.isReadOnly()) {
f.commit();
}
} catch (final Buffered.SourceException e) {
if (problems == null) {
- problems = new LinkedList<SourceException>();
+ problems = new LinkedList<>();
}
problems.add(e);
}
@@ -380,7 +387,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
(fields.get(i.next())).discard();
} catch (final Buffered.SourceException e) {
if (problems == null) {
- problems = new LinkedList<SourceException>();
+ problems = new LinkedList<>();
}
problems.add(e);
}
@@ -416,7 +423,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
@Override
public boolean isModified() {
for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) {
- final Field<?> f = fields.get(i.next());
+ final LegacyField<?> f = fields.get(i.next());
if (f != null && f.isModified()) {
return true;
}
@@ -433,7 +440,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
public void setBuffered(boolean buffered) {
if (buffered != this.buffered) {
this.buffered = buffered;
- for (final Iterator<Object> i = propertyIds.iterator(); i.hasNext();) {
+ for (final Iterator<Object> i = propertyIds.iterator(); i
+ .hasNext();) {
(fields.get(i.next())).setBuffered(buffered);
}
}
@@ -461,7 +469,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
ownProperties.put(id, property);
// Gets suitable field
- final Field<?> field = fieldFactory.createField(this, id, this);
+ final LegacyField<?> field = fieldFactory.createField(this, id, this);
if (field == null) {
return false;
}
@@ -484,7 +492,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*
* <p>
* This field is added to the layout using the
- * {@link #attachField(Object, Field)} method.
+ * {@link #attachField(Object, LegacyField)} method.
* </p>
*
* @param propertyId
@@ -492,7 +500,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @param field
* the field which should be added to the form.
*/
- public void addField(Object propertyId, Field<?> field) {
+ public void addField(Object propertyId, LegacyField<?> field) {
registerField(propertyId, field);
attachField(propertyId, field);
markAsDirty();
@@ -510,9 +518,9 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @param propertyId
* the Property id of the field.
* @param field
- * the Field that should be registered
+ * the LegacyField that should be registered
*/
- private void registerField(Object propertyId, Field<?> field) {
+ private void registerField(Object propertyId, LegacyField<?> field) {
if (propertyId == null || field == null) {
return;
}
@@ -550,7 +558,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @param propertyId
* @param field
*/
- protected void attachField(Object propertyId, Field field) {
+ protected void attachField(Object propertyId, LegacyField field) {
if (propertyId == null || field == null) {
return;
}
@@ -577,7 +585,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*/
@Override
public Property getItemProperty(Object id) {
- final Field<?> field = fields.get(id);
+ final LegacyField<?> field = fields.get(id);
if (field == null) {
// field does not exist or it is not (yet) created for this property
return ownProperties.get(id);
@@ -597,7 +605,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @param propertyId
* the id of the property.
*/
- public Field getField(Object propertyId) {
+ public LegacyField getField(Object propertyId) {
return fields.get(propertyId);
}
@@ -616,7 +624,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
public boolean removeItemProperty(Object id) {
ownProperties.remove(id);
- final Field<?> field = fields.get(id);
+ final LegacyField<?> field = fields.get(id);
if (field != null) {
propertyIds.remove(id);
@@ -640,7 +648,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @param field
* the field to be detached from the forms layout.
*/
- protected void detachField(final Field field) {
+ protected void detachField(final LegacyField field) {
Component p = field.getParent();
if (p instanceof ComponentContainer) {
((ComponentContainer) p).removeComponent(field);
@@ -701,7 +709,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*
* @see com.vaadin.data.Item.Viewer#setItemDataSource(Item)
*/
- public void setItemDataSource(Item newDataSource, Collection<?> propertyIds) {
+ public void setItemDataSource(Item newDataSource,
+ Collection<?> propertyIds) {
if (getLayout() instanceof GridLayout) {
GridLayout gl = (GridLayout) getLayout();
@@ -733,7 +742,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
final Object id = i.next();
final Property<?> property = itemDatasource.getItemProperty(id);
if (id != null && property != null) {
- final Field<?> f = fieldFactory.createField(itemDatasource, id,
+ final LegacyField<?> f = fieldFactory.createField(
+ itemDatasource, id,
this);
if (f != null) {
bindPropertyToField(id, property, f);
@@ -745,7 +755,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
/**
* Binds an item property to a field. The default behavior is to bind
- * property straight to Field. If Property.Viewer type property (e.g.
+ * property straight to LegacyField. If Property.Viewer type property (e.g.
* PropertyFormatter) is already set for field, the property is bound to
* that Property.Viewer.
*
@@ -755,7 +765,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @since 6.7.3
*/
protected void bindPropertyToField(final Object propertyId,
- final Property property, final Field field) {
+ final Property property, final LegacyField field) {
// check if field has a property that is Viewer set. In that case we
// expect developer has e.g. PropertyFormatter that he wishes to use and
// assign the property to the Viewer instead.
@@ -808,7 +818,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
if (getLayout() != null) {
final Object[] properties = propertyIds.toArray();
for (int i = 0; i < properties.length; i++) {
- Field<?> f = getField(properties[i]);
+ LegacyField<?> f = getField(properties[i]);
detachField(f);
if (layout instanceof CustomLayout) {
((CustomLayout) layout).addComponent(f,
@@ -857,10 +867,11 @@ public class Form extends AbstractField<Object> implements Item.Editor,
}
// Gets the old field
- final Field<?> oldField = fields.get(propertyId);
+ final LegacyField<?> oldField = fields.get(propertyId);
if (oldField == null) {
- throw new IllegalArgumentException("Field with given propertyid '"
- + propertyId.toString() + "' can not be found.");
+ throw new IllegalArgumentException(
+ "Field with given propertyid '"
+ + propertyId.toString() + "' can not be found.");
}
final Object value = oldField.getPropertyDataSource() == null ? oldField
.getValue() : oldField.getPropertyDataSource().getValue();
@@ -877,8 +888,9 @@ public class Form extends AbstractField<Object> implements Item.Editor,
}
if (value != null && !found) {
if (value instanceof Collection) {
- for (final Iterator<?> it = ((Collection<?>) value).iterator(); it
- .hasNext();) {
+ for (final Iterator<?> it = ((Collection<?>) value)
+ .iterator(); it
+ .hasNext();) {
final Object val = it.next();
found = false;
for (int i = 0; i < values.length && !found; i++) {
@@ -1000,7 +1012,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*
* @param fieldFactory
* the new factory used to create the fields.
- * @see Field
+ * @see LegacyField
* @see FormFieldFactory
*/
public void setFormFieldFactory(FormFieldFactory fieldFactory) {
@@ -1019,7 +1031,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
/**
* Gets the field type.
*
- * @see com.vaadin.ui.AbstractField#getType()
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#getType()
*/
@Override
public Class<?> getType() {
@@ -1032,9 +1044,9 @@ public class Form extends AbstractField<Object> implements Item.Editor,
/**
* Sets the internal value.
*
- * This is relevant when the Form is used as Field.
+ * This is relevant when the Form is used as LegacyField.
*
- * @see com.vaadin.ui.AbstractField#setInternalValue(java.lang.Object)
+ * @see com.vaadin.legacy.ui.LegacyAbstractField#setInternalValue(java.lang.Object)
*/
@Override
protected void setInternalValue(Object newValue) {
@@ -1056,14 +1068,14 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* non-read-only fields, the first one of them is returned. Otherwise, the
* field for the first property (or null if none) is returned.
*
- * @return the Field.
+ * @return the LegacyField.
*/
- private Field<?> getFirstFocusableField() {
+ private LegacyField<?> getFirstFocusableField() {
Collection<?> itemPropertyIds = getItemPropertyIds();
if (itemPropertyIds != null && itemPropertyIds.size() > 0) {
for (Object id : itemPropertyIds) {
if (id != null) {
- Field<?> field = getField(id);
+ LegacyField<?> field = getField(id);
if (field.isConnectorEnabled() && !field.isReadOnly()) {
return field;
}
@@ -1094,7 +1106,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
if (data instanceof Item) {
item = (Item) data;
} else if (data != null) {
- item = new BeanItem<Object>(data);
+ item = new BeanItem<>(data);
}
// Sets the datasource to form
@@ -1138,7 +1150,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* the visibleProperties to set.
*/
public void setVisibleItemProperties(Object... visibleProperties) {
- LinkedList<Object> v = new LinkedList<Object>();
+ LinkedList<Object> v = new LinkedList<>();
for (int i = 0; i < visibleProperties.length; i++) {
v.add(visibleProperties[i]);
}
@@ -1152,7 +1164,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*/
@Override
public void focus() {
- final Field<?> f = getFirstFocusableField();
+ final LegacyField<?> f = getFirstFocusableField();
if (f != null) {
f.focus();
}
@@ -1166,7 +1178,8 @@ public class Form extends AbstractField<Object> implements Item.Editor,
@Override
public void setTabIndex(int tabIndex) {
super.setTabIndex(tabIndex);
- for (final Iterator<?> i = getItemPropertyIds().iterator(); i.hasNext();) {
+ for (final Iterator<?> i = getItemPropertyIds().iterator(); i
+ .hasNext();) {
(getField(i.next())).setTabIndex(tabIndex);
}
}
@@ -1178,8 +1191,9 @@ public class Form extends AbstractField<Object> implements Item.Editor,
@Override
public void setImmediate(boolean immediate) {
super.setImmediate(immediate);
- for (Iterator<Field<?>> i = fields.values().iterator(); i.hasNext();) {
- Field<?> f = i.next();
+ for (Iterator<LegacyField<?>> i = fields.values().iterator(); i
+ .hasNext();) {
+ LegacyField<?> f = i.next();
if (f instanceof AbstractComponent) {
((AbstractComponent) f).setImmediate(immediate);
}
@@ -1195,10 +1209,11 @@ public class Form extends AbstractField<Object> implements Item.Editor,
@Override
public boolean isEmpty() {
- for (Iterator<Field<?>> i = fields.values().iterator(); i.hasNext();) {
- Field<?> f = i.next();
- if (f instanceof AbstractField) {
- if (!((AbstractField<?>) f).isEmpty()) {
+ for (Iterator<LegacyField<?>> i = fields.values().iterator(); i
+ .hasNext();) {
+ LegacyField<?> f = i.next();
+ if (f instanceof LegacyAbstractField) {
+ if (!((LegacyAbstractField<?>) f).isEmpty()) {
return false;
}
}
@@ -1214,10 +1229,11 @@ public class Form extends AbstractField<Object> implements Item.Editor,
*/
@Override
public void clear() {
- for (Iterator<Field<?>> i = fields.values().iterator(); i.hasNext();) {
- Field<?> f = i.next();
- if (f instanceof AbstractField) {
- ((AbstractField<?>) f).clear();
+ for (Iterator<LegacyField<?>> i = fields.values().iterator(); i
+ .hasNext();) {
+ LegacyField<?> f = i.next();
+ if (f instanceof LegacyAbstractField) {
+ ((LegacyAbstractField<?>) f).clear();
}
}
}
@@ -1279,9 +1295,10 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* Gets the {@link ActionManager} responsible for handling {@link Action}s
* added to this Form.<br/>
* Note that Form has another ActionManager inherited from
- * {@link AbstractField}. The ownActionManager handles Actions attached to
- * this Form specifically, while the ActionManager in AbstractField
- * delegates to the containing Window (i.e global Actions).
+ * {@link LegacyAbstractField}. The ownActionManager handles Actions
+ * attached to this Form specifically, while the ActionManager in
+ * LegacyAbstractField delegates to the containing Window (i.e global
+ * Actions).
*
* @return
*/
diff --git a/server/src/main/java/com/vaadin/ui/FormFieldFactory.java b/server/src/main/java/com/vaadin/ui/FormFieldFactory.java
index 124e0fcb9a..5483b7a904 100644
--- a/server/src/main/java/com/vaadin/ui/FormFieldFactory.java
+++ b/server/src/main/java/com/vaadin/ui/FormFieldFactory.java
@@ -19,6 +19,7 @@ import java.io.Serializable;
import com.vaadin.data.Item;
import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.legacy.ui.LegacyField;
/**
* Factory interface for creating new Field-instances based on {@link Item},
@@ -49,7 +50,8 @@ public interface FormFieldFactory extends Serializable {
* is {@link Form}. uiContext will not necessary be the parent
* component of the field, but the one that is responsible for
* creating it.
- * @return Field the field suitable for editing the specified data.
+ * @return the field suitable for editing the specified data.
*/
- Field<?> createField(Item item, Object propertyId, Component uiContext);
+ LegacyField<?> createField(Item item, Object propertyId,
+ Component uiContext);
}
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java
index 388d74aeee..09a3eecb73 100644
--- a/server/src/main/java/com/vaadin/ui/Grid.java
+++ b/server/src/main/java/com/vaadin/ui/Grid.java
@@ -73,6 +73,7 @@ import com.vaadin.event.SelectionEvent.SelectionNotifier;
import com.vaadin.event.SortEvent;
import com.vaadin.event.SortEvent.SortListener;
import com.vaadin.event.SortEvent.SortNotifier;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.AbstractExtension;
import com.vaadin.server.EncodeResult;
@@ -157,14 +158,14 @@ import elemental.json.JsonValue;
* <h3 id="grid-selection-modes-and-models">Selection Modes and Models</h3>
* <p>
* Grid supports three selection <em>{@link SelectionMode modes}</em> (single,
- * multi, none), and comes bundled with one
- * <em>{@link SelectionModel model}</em> for each of the modes. The distinction
- * between a selection mode and selection model is as follows: a <em>mode</em>
- * essentially says whether you can have one, many or no rows selected. The
- * model, however, has the behavioral details of each. A single selection model
- * may require that the user deselects one row before selecting another one. A
- * variant of a multiselect might have a configurable maximum of rows that may
- * be selected. And so on.
+ * multi, none), and comes bundled with one <em>{@link SelectionModel
+ * model}</em> for each of the modes. The distinction between a selection mode
+ * and selection model is as follows: a <em>mode</em> essentially says whether
+ * you can have one, many or no rows selected. The model, however, has the
+ * behavioral details of each. A single selection model may require that the
+ * user deselects one row before selecting another one. A variant of a
+ * multiselect might have a configurable maximum of rows that may be selected.
+ * And so on.
* <p>
* <code><pre>
* Grid grid = new Grid(myContainer);
@@ -319,19 +320,19 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* client. Details components get destroyed once they scroll out of
* view.
*/
- private final Map<Object, Component> itemIdToDetailsComponent = new HashMap<Object, Component>();
+ private final Map<Object, Component> itemIdToDetailsComponent = new HashMap<>();
/**
* Set of item ids that got <code>null</code> from DetailsGenerator when
* {@link DetailsGenerator#getDetails(RowReference)} was called.
*/
- private final Set<Object> emptyDetails = new HashSet<Object>();
+ private final Set<Object> emptyDetails = new HashSet<>();
/**
* Set of item IDs for all open details rows. Contains even the ones
* that are not currently visible on the client.
*/
- private final Set<Object> openDetails = new HashSet<Object>();
+ private final Set<Object> openDetails = new HashSet<>();
public DetailComponentManager(Grid grid) {
this(grid, DetailsGenerator.NULL);
@@ -416,7 +417,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* Recreates all visible details components.
*/
public void refreshDetails() {
- Set<Object> visibleItemIds = new HashSet<Object>(
+ Set<Object> visibleItemIds = new HashSet<>(
itemIdToDetailsComponent.keySet());
for (Object itemId : visibleItemIds) {
destroyDetails(itemId);
@@ -540,7 +541,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
@Override
- protected <T extends Field> T build(String caption, Class<?> dataType,
+ protected <T extends LegacyField> T build(String caption,
+ Class<?> dataType,
Class<T> fieldType) throws BindException {
T field = super.build(caption, dataType, fieldType);
if (field instanceof CheckBox) {
@@ -573,7 +575,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
@Override
- public <T extends Field> T createField(Class<?> type, Class<T> fieldType) {
+ public <T extends LegacyField> T createField(Class<?> type,
+ Class<T> fieldType) {
T f = super.createField(type, fieldType);
if (f != null) {
f.setWidth("100%");
@@ -691,7 +694,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
private CommitException cause;
- private Set<Column> errorColumns = new HashSet<Column>();
+ private Set<Column> errorColumns = new HashSet<>();
private String userErrorMessage;
@@ -980,17 +983,17 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
@Override
public void commitError(CommitErrorEvent event) {
- Map<Field<?>, InvalidValueException> invalidFields = event
+ Map<LegacyField<?>, InvalidValueException> invalidFields = event
.getCause().getInvalidFields();
if (!invalidFields.isEmpty()) {
Object firstErrorPropertyId = null;
- Field<?> firstErrorField = null;
+ LegacyField<?> firstErrorField = null;
FieldGroup fieldGroup = event.getCause().getFieldGroup();
for (Column column : getColumns()) {
Object propertyId = column.getPropertyId();
- Field<?> field = fieldGroup.getField(propertyId);
+ LegacyField<?> field = fieldGroup.getField(propertyId);
if (invalidFields.keySet().contains(field)) {
event.addErrorColumn(column);
@@ -1018,10 +1021,10 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
private Object getFirstPropertyId(FieldGroup fieldGroup,
- Set<Field<?>> keySet) {
+ Set<LegacyField<?>> keySet) {
for (Column c : getColumns()) {
Object propertyId = c.getPropertyId();
- Field<?> f = fieldGroup.getField(propertyId);
+ LegacyField<?> f = fieldGroup.getField(propertyId);
if (keySet.contains(f)) {
return propertyId;
}
@@ -1339,7 +1342,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*/
public static abstract class AbstractSelectionModel extends
AbstractGridExtension implements SelectionModel, DataGenerator {
- protected final LinkedHashSet<Object> selection = new LinkedHashSet<Object>();
+ protected final LinkedHashSet<Object> selection = new LinkedHashSet<>();
@Override
public boolean isSelected(final Object itemId) {
@@ -1348,7 +1351,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
@Override
public Collection<Object> getSelectedRows() {
- return new ArrayList<Object>(selection);
+ return new ArrayList<>(selection);
}
@Override
@@ -1586,7 +1589,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
@Override
public void select(List<String> rowKeys) {
- List<Object> items = new ArrayList<Object>();
+ List<Object> items = new ArrayList<>();
for (String rowKey : rowKeys) {
items.add(getItemId(rowKey));
}
@@ -1595,7 +1598,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
@Override
public void deselect(List<String> rowKeys) {
- List<Object> items = new ArrayList<Object>();
+ List<Object> items = new ArrayList<>();
for (String rowKey : rowKeys) {
items.add(getItemId(rowKey));
}
@@ -1649,7 +1652,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
final boolean selectionWillChange = !selection.containsAll(itemIds)
&& selection.size() < selectionLimit;
if (selectionWillChange) {
- final HashSet<Object> oldSelection = new HashSet<Object>(
+ final HashSet<Object> oldSelection = new HashSet<>(
selection);
if (selection.size() + itemIds.size() >= selectionLimit) {
// Add one at a time if there's a risk of overflow
@@ -1728,7 +1731,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
return deselect(itemIds, true);
}
- protected boolean deselect(final Collection<?> itemIds, boolean refresh) {
+ protected boolean deselect(final Collection<?> itemIds,
+ boolean refresh) {
if (itemIds == null) {
throw new IllegalArgumentException("itemIds may not be null");
}
@@ -1736,7 +1740,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
final boolean hasCommonElements = !Collections.disjoint(itemIds,
selection);
if (hasCommonElements) {
- final HashSet<Object> oldSelection = new HashSet<Object>(
+ final HashSet<Object> oldSelection = new HashSet<>(
selection);
selection.removeAll(itemIds);
fireSelectionEvent(oldSelection, selection);
@@ -1820,7 +1824,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
checkItemIdsExist(itemIds);
boolean changed = false;
- Set<Object> selectedRows = new HashSet<Object>(itemIds);
+ Set<Object> selectedRows = new HashSet<>(itemIds);
final Collection<Object> oldSelection = getSelectedRows();
Set<Object> added = getDifference(selectedRows, selection);
if (!added.isEmpty()) {
@@ -1861,7 +1865,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*/
private static Set<Object> getDifference(Set<Object> set1,
Set<Object> set2) {
- Set<Object> diff = new HashSet<Object>(set1);
+ Set<Object> diff = new HashSet<>(set1);
diff.removeAll(set2);
return diff;
}
@@ -2162,7 +2166,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
if (cellDescriptionGenerator != null
&& cellDescriptions.keys().length > 0) {
- rowData.put(GridState.JSONKEY_CELLDESCRIPTION, cellDescriptions);
+ rowData.put(GridState.JSONKEY_CELLDESCRIPTION,
+ cellDescriptions);
}
if (cellStyleGenerator != null && cellStyles.keys().length > 0) {
@@ -2229,8 +2234,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
private RowState rowState = new RowState();
protected StaticSection<?> section;
- private Map<Object, CELLTYPE> cells = new LinkedHashMap<Object, CELLTYPE>();
- private Map<Set<CELLTYPE>, CELLTYPE> cellGroups = new HashMap<Set<CELLTYPE>, CELLTYPE>();
+ private Map<Object, CELLTYPE> cells = new LinkedHashMap<>();
+ private Map<Set<CELLTYPE>, CELLTYPE> cellGroups = new HashMap<>();
protected StaticRow(StaticSection<?> section) {
this.section = section;
@@ -2238,7 +2243,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
protected void addCell(Object propertyId) {
CELLTYPE cell = createCell();
- cell.setColumnId(section.grid.getColumn(propertyId).getState().id);
+ cell.setColumnId(section.grid.getColumn(propertyId)
+ .getState().id);
cells.put(propertyId, cell);
rowState.cells.add(cell.getCellState());
}
@@ -2314,7 +2320,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
public CELLTYPE join(Object... propertyIds) {
assert propertyIds.length > 1 : "You need to merge at least 2 properties";
- Set<CELLTYPE> cells = new HashSet<CELLTYPE>();
+ Set<CELLTYPE> cells = new HashSet<>();
for (int i = 0; i < propertyIds.length; ++i) {
cells.add(getCell(propertyIds[i]));
}
@@ -2332,7 +2338,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
public CELLTYPE join(CELLTYPE... cells) {
assert cells.length > 1 : "You need to merge at least 2 cells";
- return join(new HashSet<CELLTYPE>(Arrays.asList(cells)));
+ return join(new HashSet<>(Arrays.asList(cells)));
}
protected CELLTYPE join(Set<CELLTYPE> cells) {
@@ -2349,7 +2355,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
// Create new cell data for the group
CELLTYPE newCell = createCell();
- Set<String> columnGroup = new HashSet<String>();
+ Set<String> columnGroup = new HashSet<>();
for (CELLTYPE cell : cells) {
columnGroup.add(cell.getColumnId());
}
@@ -2398,7 +2404,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*/
protected void writeDesign(Element trElement,
DesignContext designContext) {
- Set<CELLTYPE> visited = new HashSet<CELLTYPE>();
+ Set<CELLTYPE> visited = new HashSet<>();
for (Grid.Column column : section.grid.getColumns()) {
CELLTYPE cell = getCell(column.getPropertyId());
if (visited.contains(cell)) {
@@ -2450,7 +2456,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
int colspan = DesignAttributeHandler.readAttribute(
"colspan", element.attributes(), 1, int.class);
- Set<CELLTYPE> cells = new HashSet<CELLTYPE>();
+ Set<CELLTYPE> cells = new HashSet<>();
for (int c = 0; c < colspan; ++c) {
cells.add(getCell(section.grid.getColumns()
.get(columnIndex + c).getPropertyId()));
@@ -2687,7 +2693,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
protected Grid grid;
- protected List<ROWTYPE> rows = new ArrayList<ROWTYPE>();
+ protected List<ROWTYPE> rows = new ArrayList<>();
/**
* Sets the visibility of the whole section.
@@ -3106,7 +3112,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
@Override
- protected void readDesign(Element trElement, DesignContext designContext) {
+ protected void readDesign(Element trElement,
+ DesignContext designContext) {
super.readDesign(trElement, designContext);
boolean defaultRow = DesignAttributeHandler.readAttribute(
@@ -3656,7 +3663,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
+ toString()
+ " sortable. The Container of Grid does not implement Sortable");
} else if (!((Sortable) grid.datasource)
- .getSortableContainerPropertyIds().contains(propertyId)) {
+ .getSortableContainerPropertyIds().contains(
+ propertyId)) {
throw new IllegalStateException(
"Can't set column "
+ toString()
@@ -3786,8 +3794,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
/**
* Sets the maximum width for this column.
* <p>
- * This defines the maximum allowed pixel width of the column
- * <em>when it is set to expand</em>.
+ * This defines the maximum allowed pixel width of the column <em>when
+ * it is set to expand</em>.
*
* @param pixels
* the maximum width
@@ -3882,7 +3890,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* the editor field
* @return this column
*/
- public Column setEditorField(Field<?> editor) {
+ public Column setEditorField(LegacyField<?> editor) {
grid.setEditorField(getPropertyId(), editor);
return this;
}
@@ -3910,7 +3918,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* if no field has been configured and there is a problem
* building or binding
*/
- public Field<?> getEditorField() {
+ public LegacyField<?> getEditorField() {
return grid.getEditorField(getPropertyId());
}
@@ -4020,7 +4028,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* @param designContext
* the design context
*/
- protected void writeDesign(Element design, DesignContext designContext) {
+ protected void writeDesign(Element design,
+ DesignContext designContext) {
Attributes attributes = design.attributes();
GridColumnState def = new GridColumnState();
@@ -4222,7 +4231,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* @return an encoded value ready to be sent to the client
*/
public static <T> JsonValue encodeValue(Object modelValue,
- Renderer<T> renderer, Converter<?, ?> converter, Locale locale) {
+ Renderer<T> renderer, Converter<?, ?> converter,
+ Locale locale) {
Class<T> presentationType = renderer.getPresentationType();
T presentationValue;
@@ -4417,17 +4427,17 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
/**
* Property id to column instance mapping
*/
- private final Map<Object, Column> columns = new HashMap<Object, Column>();
+ private final Map<Object, Column> columns = new HashMap<>();
/**
* Key generator for column server-to-client communication
*/
- private final KeyMapper<Object> columnKeys = new KeyMapper<Object>();
+ private final KeyMapper<Object> columnKeys = new KeyMapper<>();
/**
* The current sort order
*/
- private final List<SortOrder> sortOrder = new ArrayList<SortOrder>();
+ private final List<SortOrder> sortOrder = new ArrayList<>();
/**
* Property listener for listening to changes in data source properties.
@@ -4440,7 +4450,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
.getContainerPropertyIds());
// Find columns that need to be removed.
- List<Column> removedColumns = new LinkedList<Column>();
+ List<Column> removedColumns = new LinkedList<>();
for (Object propertyId : columns.keySet()) {
if (!properties.contains(propertyId)) {
removedColumns.add(getColumn(propertyId));
@@ -4456,7 +4466,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
datasourceExtension.columnsRemoved(removedColumns);
// Add new columns
- List<Column> addedColumns = new LinkedList<Column>();
+ List<Column> addedColumns = new LinkedList<>();
for (Object propertyId : properties) {
if (!columns.containsKey(propertyId)) {
addedColumns.add(appendColumn(propertyId));
@@ -4474,7 +4484,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
.getSortableContainerPropertyIds();
for (Object propertyId : columns.keySet()) {
Column column = columns.get(propertyId);
- if (!sortables.contains(propertyId) && column.isSortable()) {
+ if (!sortables.contains(propertyId) && column
+ .isSortable()) {
column.setSortable(false);
}
}
@@ -4531,10 +4542,11 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
private DetailComponentManager detailComponentManager = null;
- private Set<Component> extensionComponents = new HashSet<Component>();
+ private Set<Component> extensionComponents = new HashSet<>();
private static final Method SELECTION_CHANGE_METHOD = ReflectTools
- .findMethod(SelectionListener.class, "select", SelectionEvent.class);
+ .findMethod(SelectionListener.class, "select",
+ SelectionEvent.class);
private static final Method SORT_ORDER_CHANGE_METHOD = ReflectTools
.findMethod(SortListener.class, "sort", SortEvent.class);
@@ -4613,7 +4625,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
boolean userOriginated) {
assert columnIds.length == directions.length;
- List<SortOrder> order = new ArrayList<SortOrder>(
+ List<SortOrder> order = new ArrayList<>(
columnIds.length);
for (int i = 0; i < columnIds.length; i++) {
Object propertyId = getPropertyIdByColumnId(columnIds[i]);
@@ -4660,7 +4672,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
getState(false).columnOrder = newColumnOrder;
// write changes to diffState so that possible reverting the
// column order is sent to client
- assert diffState.hasKey(diffStateKey) : "Field name has changed";
+ assert diffState.hasKey(
+ diffStateKey) : "Field name has changed";
Type type = null;
try {
type = (getState(false).getClass().getDeclaredField(
@@ -4699,7 +4712,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
JsonObject diffState = connectorTracker
.getDiffState(Grid.this);
- assert diffState.hasKey(diffStateKey) : "Field name has changed";
+ assert diffState.hasKey(
+ diffStateKey) : "Field name has changed";
Type type = null;
try {
type = (getState(false).getClass().getDeclaredField(
@@ -4722,7 +4736,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
@Override
public void contextClick(int rowIndex, String rowKey,
- String columnId, Section section, MouseEventDetails details) {
+ String columnId, Section section,
+ MouseEventDetails details) {
Object itemId = null;
if (rowKey != null) {
itemId = getKeyMapper().get(rowKey);
@@ -4806,7 +4821,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
errorMessage = event.getUserErrorMessage();
- errorColumnIds = new ArrayList<String>();
+ errorColumnIds = new ArrayList<>();
for (Column column : event.getErrorColumns()) {
errorColumnIds.add(column.state.id);
}
@@ -5032,7 +5047,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* @return unmodifiable copy of current columns in visual order
*/
public List<Column> getColumns() {
- List<Column> columns = new ArrayList<Grid.Column>();
+ List<Column> columns = new ArrayList<>();
for (String columnId : getState(false).columnOrder) {
columns.add(getColumnByColumnId(columnId));
}
@@ -5075,7 +5090,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
// Inform the data provider of this new column.
Column column = getColumn(propertyId);
- List<Column> addedColumns = new ArrayList<Column>();
+ List<Column> addedColumns = new ArrayList<>();
addedColumns.add(column);
datasourceExtension.columnsAdded(addedColumns);
@@ -5141,8 +5156,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* Removes all columns from this Grid.
*/
public void removeAllColumns() {
- List<Column> removed = new ArrayList<Column>(columns.values());
- Set<Object> properties = new HashSet<Object>(columns.keySet());
+ List<Column> removed = new ArrayList<>(columns.values());
+ Set<Object> properties = new HashSet<>(columns.keySet());
for (Object propertyId : properties) {
removeColumn(propertyId);
}
@@ -5237,7 +5252,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
footer.addColumn(datasourcePropertyId);
String humanFriendlyPropertyId = SharedUtil
- .propertyIdToHumanFriendly(String.valueOf(datasourcePropertyId));
+ .propertyIdToHumanFriendly(String.valueOf(
+ datasourcePropertyId));
column.setHeaderCaption(humanFriendlyPropertyId);
if (datasource instanceof Sortable
@@ -5258,13 +5274,14 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* @throws IllegalArgumentException
* if there is no column for given property id in this grid
*/
- public void removeColumn(Object propertyId) throws IllegalArgumentException {
+ public void removeColumn(Object propertyId)
+ throws IllegalArgumentException {
if (!columns.keySet().contains(propertyId)) {
throw new IllegalArgumentException(
"There is no column for given property id " + propertyId);
}
- List<Column> removed = new ArrayList<Column>();
+ List<Column> removed = new ArrayList<>();
removed.add(getColumn(propertyId));
internalRemoveColumn(propertyId);
datasourceExtension.columnsRemoved(removed);
@@ -5292,12 +5309,12 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* properties in the desired column order
*/
public void setColumns(Object... propertyIds) {
- Set<?> removePids = new HashSet<Object>(columns.keySet());
+ Set<?> removePids = new HashSet<>(columns.keySet());
removePids.removeAll(Arrays.asList(propertyIds));
for (Object removePid : removePids) {
removeColumn(removePid);
}
- Set<?> addPids = new HashSet<Object>(Arrays.asList(propertyIds));
+ Set<?> addPids = new HashSet<>(Arrays.asList(propertyIds));
addPids.removeAll(columns.keySet());
for (Object propertyId : addPids) {
addColumn(propertyId);
@@ -5314,7 +5331,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
* properties in the order columns should be
*/
public void setColumnOrder(Object... propertyIds) {
- List<String> columnOrder = new ArrayList<String>();
+ List<String> columnOrder = new ArrayList<>();
for (Object propertyId : propertyIds) {
if (columns.containsKey(propertyId)) {
columnOrder.add(columnKeys.key(propertyId));
@@ -5602,7 +5619,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
public SelectionModel setSelectionMode(final SelectionMode selectionMode)
throws IllegalArgumentException {
if (selectionMode == null) {
- throw new IllegalArgumentException("selection mode may not be null");
+ throw new IllegalArgumentException(
+ "selection mode may not be null");
}
final SelectionModel newSelectionModel = selectionMode.createModel();
setSelectionModel(newSelectionModel);
@@ -6075,7 +6093,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
getState().sortColumns = new String[] {};
getState(false).sortDirs = new SortDirection[] {};
}
- fireEvent(new SortEvent(this, new ArrayList<SortOrder>(sortOrder),
+ fireEvent(new SortEvent(this, new ArrayList<>(sortOrder),
userOriginated));
} else {
throw new IllegalStateException(
@@ -6414,7 +6432,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
public Iterator<Component> iterator() {
// This is a hash set to avoid adding header/footer components inside
// merged cells multiple times
- LinkedHashSet<Component> componentList = new LinkedHashSet<Component>();
+ LinkedHashSet<Component> componentList = new LinkedHashSet<>();
Header header = getHeader();
for (int i = 0; i < header.getRowCount(); ++i) {
@@ -6476,9 +6494,11 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*
* @since 7.6
*/
- public void setCellDescriptionGenerator(CellDescriptionGenerator generator) {
+ public void setCellDescriptionGenerator(
+ CellDescriptionGenerator generator) {
cellDescriptionGenerator = generator;
- getState().hasDescriptions = (generator != null || rowDescriptionGenerator != null);
+ getState().hasDescriptions = (generator != null
+ || rowDescriptionGenerator != null);
datasourceExtension.refreshCache();
}
@@ -6512,7 +6532,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*/
public void setRowDescriptionGenerator(RowDescriptionGenerator generator) {
rowDescriptionGenerator = generator;
- getState().hasDescriptions = (generator != null || cellDescriptionGenerator != null);
+ getState().hasDescriptions = (generator != null
+ || cellDescriptionGenerator != null);
datasourceExtension.refreshCache();
}
@@ -6738,14 +6759,14 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
}
- private Field<?> getEditorField(Object propertyId) {
+ private LegacyField<?> getEditorField(Object propertyId) {
checkColumnExists(propertyId);
if (!getColumn(propertyId).isEditable()) {
return null;
}
- Field<?> editor = editorFieldGroup.getField(propertyId);
+ LegacyField<?> editor = editorFieldGroup.getField(propertyId);
try {
if (editor == null) {
@@ -6809,7 +6830,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
editorActive = true;
// Must ensure that all fields, recursively, are sent to the client
// This is needed because the fields are hidden using isRendered
- for (Field<?> f : getEditorFields()) {
+ for (LegacyField<?> f : getEditorFields()) {
f.markAsDirtyRecursive();
}
@@ -6819,10 +6840,10 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
}
}
- private void setEditorField(Object propertyId, Field<?> field) {
+ private void setEditorField(Object propertyId, LegacyField<?> field) {
checkColumnExists(propertyId);
- Field<?> oldField = editorFieldGroup.getField(propertyId);
+ LegacyField<?> oldField = editorFieldGroup.getField(propertyId);
if (oldField != null) {
editorFieldGroup.unbind(oldField);
oldField.setParent(null);
@@ -6884,7 +6905,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*/
cancelEditor();
}
- for (Field<?> editor : getEditorFields()) {
+ for (LegacyField<?> editor : getEditorFields()) {
editor.setParent(null);
}
@@ -6901,8 +6922,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
*
* @return a collection of all the fields bound to the item editor
*/
- Collection<Field<?>> getEditorFields() {
- Collection<Field<?>> fields = editorFieldGroup.getFields();
+ Collection<LegacyField<?>> getEditorFields() {
+ Collection<LegacyField<?>> fields = editorFieldGroup.getFields();
assert allAttached(fields);
return fields;
}
@@ -7273,7 +7294,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier,
if (selectionModel.getClass().equals(SingleSelectionModel.class)) {
selectionMode = SelectionMode.SINGLE;
- } else if (selectionModel.getClass().equals(MultiSelectionModel.class)) {
+ } else if (selectionModel.getClass().equals(
+ MultiSelectionModel.class)) {
selectionMode = SelectionMode.MULTI;
} else if (selectionModel.getClass().equals(NoSelectionModel.class)) {
selectionMode = SelectionMode.NONE;
diff --git a/server/src/main/java/com/vaadin/ui/ProgressBar.java b/server/src/main/java/com/vaadin/ui/ProgressBar.java
index d38067d51e..3182563eda 100644
--- a/server/src/main/java/com/vaadin/ui/ProgressBar.java
+++ b/server/src/main/java/com/vaadin/ui/ProgressBar.java
@@ -19,6 +19,7 @@ package com.vaadin.ui;
import org.jsoup.nodes.Element;
import com.vaadin.data.Property;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.shared.ui.progressindicator.ProgressBarState;
import com.vaadin.ui.declarative.DesignAttributeHandler;
import com.vaadin.ui.declarative.DesignContext;
@@ -34,7 +35,7 @@ import com.vaadin.ui.declarative.DesignContext;
* @since 7.1
* @author Vaadin Ltd
*/
-public class ProgressBar extends AbstractField<Float> implements
+public class ProgressBar extends LegacyAbstractField<Float> implements
Property.Viewer, Property.ValueChangeListener {
private static final float DEFAULT_VALUE = 0f;
@@ -140,8 +141,8 @@ public class ProgressBar extends AbstractField<Float> implements
}
/*
- * Overridden to keep the shared state in sync with the AbstractField
- * internal value. Should be removed once AbstractField is refactored to use
+ * Overridden to keep the shared state in sync with the LegacyAbstractField
+ * internal value. Should be removed once LegacyAbstractField is refactored to use
* shared state.
*
* See tickets #10921 and #11064.
diff --git a/server/src/main/java/com/vaadin/ui/RichTextArea.java b/server/src/main/java/com/vaadin/ui/RichTextArea.java
index 2f0ba215b9..57fcdc0a5e 100644
--- a/server/src/main/java/com/vaadin/ui/RichTextArea.java
+++ b/server/src/main/java/com/vaadin/ui/RichTextArea.java
@@ -21,6 +21,7 @@ import java.util.Map;
import org.jsoup.nodes.Element;
import com.vaadin.data.Property;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.server.PaintException;
import com.vaadin.server.PaintTarget;
import com.vaadin.shared.ui.textarea.RichTextAreaState;
@@ -33,7 +34,7 @@ import com.vaadin.ui.declarative.DesignContext;
* {@link RichTextArea} may produce unexpected results as formatting is counted
* into length of field.
*/
-public class RichTextArea extends AbstractField<String> implements
+public class RichTextArea extends LegacyAbstractField<String> implements
LegacyComponent {
/**
diff --git a/server/src/main/java/com/vaadin/ui/Slider.java b/server/src/main/java/com/vaadin/ui/Slider.java
index 1fd6d425fe..fbb9aa292a 100644
--- a/server/src/main/java/com/vaadin/ui/Slider.java
+++ b/server/src/main/java/com/vaadin/ui/Slider.java
@@ -21,6 +21,7 @@ import java.util.Collection;
import org.jsoup.nodes.Attributes;
import org.jsoup.nodes.Element;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.shared.ui.slider.SliderOrientation;
import com.vaadin.shared.ui.slider.SliderServerRpc;
import com.vaadin.shared.ui.slider.SliderState;
@@ -32,7 +33,7 @@ import com.vaadin.ui.declarative.DesignContext;
*
* @author Vaadin Ltd.
*/
-public class Slider extends AbstractField<Double> {
+public class Slider extends LegacyAbstractField<Double> {
private SliderServerRpc rpc = new SliderServerRpc() {
@@ -299,8 +300,8 @@ public class Slider extends AbstractField<Double> {
}
/*
- * Overridden to keep the shared state in sync with the AbstractField
- * internal value. Should be removed once AbstractField is refactored to use
+ * Overridden to keep the shared state in sync with the LegacyAbstractField
+ * internal value. Should be removed once LegacyAbstractField is refactored to use
* shared state.
*
* See tickets #10921 and #11064.
diff --git a/server/src/main/java/com/vaadin/ui/Table.java b/server/src/main/java/com/vaadin/ui/Table.java
index f518f4f161..4e85b9e028 100644
--- a/server/src/main/java/com/vaadin/ui/Table.java
+++ b/server/src/main/java/com/vaadin/ui/Table.java
@@ -57,6 +57,7 @@ import com.vaadin.event.dd.DragSource;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
import com.vaadin.event.dd.acceptcriteria.ServerSideCriterion;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.KeyMapper;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.server.LegacyPaint;
@@ -581,7 +582,7 @@ public class Table extends AbstractSelect implements Action.Container,
private RowGenerator rowGenerator = null;
- private final Map<Field<?>, Property<?>> associatedProperties = new HashMap<Field<?>, Property<?>>();
+ private final Map<LegacyField<?>, Property<?>> associatedProperties = new HashMap<LegacyField<?>, Property<?>>();
private boolean painted = false;
@@ -2551,8 +2552,8 @@ public class Table extends AbstractSelect implements Action.Container,
* Also remove property data sources to unregister listeners keeping the
* fields in memory.
*/
- if (component instanceof Field) {
- Field<?> field = (Field<?>) component;
+ if (component instanceof LegacyField) {
+ LegacyField<?> field = (LegacyField<?>) component;
Property<?> associatedProperty = associatedProperties
.remove(component);
if (associatedProperty != null
@@ -4103,7 +4104,7 @@ public class Table extends AbstractSelect implements Action.Container,
protected Object getPropertyValue(Object rowId, Object colId,
Property property) {
if (isEditable() && fieldFactory != null) {
- final Field<?> f = fieldFactory.createField(
+ final LegacyField<?> f = fieldFactory.createField(
getContainerDataSource(), rowId, colId, this);
if (f != null) {
// Remember that we have made this association so we can remove
@@ -4119,7 +4120,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Binds an item property to a field generated by TableFieldFactory. The
- * default behavior is to bind property straight to Field. If
+ * default behavior is to bind property straight to LegacyField. If
* Property.Viewer type property (e.g. PropertyFormatter) is already set for
* field, the property is bound to that Property.Viewer.
*
@@ -4130,7 +4131,7 @@ public class Table extends AbstractSelect implements Action.Container,
* @since 6.7.3
*/
protected void bindPropertyToField(Object rowId, Object colId,
- Property property, Field field) {
+ Property property, LegacyField field) {
// check if field has a property that is Viewer set. In that case we
// expect developer has e.g. PropertyFormatter that he wishes to use and
// assign the property to the Viewer instead.
@@ -4780,7 +4781,7 @@ public class Table extends AbstractSelect implements Action.Container,
*
* The FieldFactory is only used if the Table is editable.
*
- * @return TableFieldFactory used to create the Field instances.
+ * @return TableFieldFactory used to create the LegacyField instances.
* @see #isEditable
*/
public TableFieldFactory getTableFieldFactory() {
@@ -4790,7 +4791,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Is table editable.
*
- * If table is editable a editor of type Field is created for each table
+ * If table is editable a editor of type LegacyField is created for each table
* cell. The assigned FieldFactory is used to create the instances.
*
* To provide custom editors for table cells create a class implementing the
@@ -4798,7 +4799,7 @@ public class Table extends AbstractSelect implements Action.Container,
* property to true.
*
* @return true if table is editable, false otherwise.
- * @see Field
+ * @see LegacyField
* @see FieldFactory
*
*/
@@ -4809,7 +4810,7 @@ public class Table extends AbstractSelect implements Action.Container,
/**
* Sets the editable property.
*
- * If table is editable a editor of type Field is created for each table
+ * If table is editable a editor of type LegacyField is created for each table
* cell. The assigned FieldFactory is used to create the instances.
*
* To provide custom editors for table cells create a class implementing the
@@ -4818,7 +4819,7 @@ public class Table extends AbstractSelect implements Action.Container,
*
* @param editable
* true if table should be editable by user.
- * @see Field
+ * @see LegacyField
* @see FieldFactory
*
*/
diff --git a/server/src/main/java/com/vaadin/ui/TableFieldFactory.java b/server/src/main/java/com/vaadin/ui/TableFieldFactory.java
index 3c946dcec2..e77dc0ec35 100644
--- a/server/src/main/java/com/vaadin/ui/TableFieldFactory.java
+++ b/server/src/main/java/com/vaadin/ui/TableFieldFactory.java
@@ -18,12 +18,13 @@ package com.vaadin.ui;
import java.io.Serializable;
import com.vaadin.data.Container;
+import com.vaadin.legacy.ui.LegacyField;
/**
- * Factory interface for creating new Field-instances based on Container
+ * Factory interface for creating new LegacyField-instances based on Container
* (datasource), item id, property id and uiContext (the component responsible
* for displaying fields). Currently this interface is used by {@link Table},
- * but might later be used by some other components for {@link Field}
+ * but might later be used by some other components for {@link LegacyField}
* generation.
*
* <p>
@@ -49,7 +50,7 @@ public interface TableFieldFactory extends Serializable {
* @return A field suitable for editing the specified data or null if the
* property should not be editable.
*/
- Field<?> createField(Container container, Object itemId, Object propertyId,
+ LegacyField<?> createField(Container container, Object itemId, Object propertyId,
Component uiContext);
}
diff --git a/server/src/main/java/com/vaadin/ui/TextField.java b/server/src/main/java/com/vaadin/ui/TextField.java
index 8772f95f3d..31a15f85c9 100644
--- a/server/src/main/java/com/vaadin/ui/TextField.java
+++ b/server/src/main/java/com/vaadin/ui/TextField.java
@@ -31,10 +31,10 @@ import com.vaadin.ui.declarative.DesignContext;
* </p>
*
* <p>
- * Since <code>TextField</code> extends <code>AbstractField</code> it implements
+ * Since <code>TextField</code> extends <code>LegacyAbstractField</code> it implements
* the {@link com.vaadin.data.Buffered} interface. A <code>TextField</code> is
* in write-through mode by default, so
- * {@link com.vaadin.ui.AbstractField#setWriteThrough(boolean)} must be called
+ * {@link com.vaadin.legacy.ui.LegacyAbstractField#setWriteThrough(boolean)} must be called
* to enable buffering.
* </p>
*
diff --git a/server/src/main/javadoc/com/vaadin/data/package.html b/server/src/main/javadoc/com/vaadin/data/package.html
index a14ea1ac88..2f3c718ba4 100644
--- a/server/src/main/javadoc/com/vaadin/data/package.html
+++ b/server/src/main/javadoc/com/vaadin/data/package.html
@@ -39,7 +39,7 @@ to track and buffer changes and commit or discard them later.</p>
<p>{@link com.vaadin.data.Validator Validator} implementations are
used to validate data, typically the value of a {@link
-com.vaadin.ui.Field Field}. One or more {@link com.vaadin.data.Validator
+com.vaadin.legacy.ui.LegacyField LegacyField}. One or more {@link com.vaadin.data.Validator
Validators} can be added to a {@link com.vaadin.data.Validatable
Validatable} implementor and then used to validate the value of the
Validatable. </p>
diff --git a/server/src/test/java/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java b/server/src/test/java/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java
index fc258ab138..1b019586e2 100644
--- a/server/src/test/java/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java
+++ b/server/src/test/java/com/vaadin/data/DefaultFieldGroupFieldFactoryTest.java
@@ -23,10 +23,10 @@ import org.junit.Before;
import org.junit.Test;
import com.vaadin.data.fieldgroup.DefaultFieldGroupFieldFactory;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.DateField;
-import com.vaadin.ui.Field;
import com.vaadin.ui.InlineDateField;
import com.vaadin.ui.ListSelect;
import com.vaadin.ui.PopupDateField;
@@ -66,28 +66,28 @@ public class DefaultFieldGroupFieldFactoryTest {
@Test
public void testDateGenerationForPopupDateField() {
- Field f = fieldFactory.createField(Date.class, DateField.class);
+ LegacyField f = fieldFactory.createField(Date.class, DateField.class);
Assert.assertNotNull(f);
Assert.assertEquals(PopupDateField.class, f.getClass());
}
@Test
public void testDateGenerationForInlineDateField() {
- Field f = fieldFactory.createField(Date.class, InlineDateField.class);
+ LegacyField f = fieldFactory.createField(Date.class, InlineDateField.class);
Assert.assertNotNull(f);
Assert.assertEquals(InlineDateField.class, f.getClass());
}
@Test
public void testDateGenerationForTextField() {
- Field f = fieldFactory.createField(Date.class, TextField.class);
+ LegacyField f = fieldFactory.createField(Date.class, TextField.class);
Assert.assertNotNull(f);
Assert.assertEquals(TextField.class, f.getClass());
}
@Test
public void testDateGenerationForField() {
- Field f = fieldFactory.createField(Date.class, Field.class);
+ LegacyField f = fieldFactory.createField(Date.class, LegacyField.class);
Assert.assertNotNull(f);
Assert.assertEquals(PopupDateField.class, f.getClass());
}
@@ -98,14 +98,14 @@ public class DefaultFieldGroupFieldFactoryTest {
@Test
public void testEnumComboBox() {
- Field f = fieldFactory.createField(SomeEnum.class, ComboBox.class);
+ LegacyField f = fieldFactory.createField(SomeEnum.class, ComboBox.class);
Assert.assertNotNull(f);
Assert.assertEquals(ComboBox.class, f.getClass());
}
@Test
public void testEnumAnySelect() {
- Field f = fieldFactory
+ LegacyField f = fieldFactory
.createField(SomeEnum.class, AbstractSelect.class);
Assert.assertNotNull(f);
Assert.assertEquals(ListSelect.class, f.getClass());
@@ -113,7 +113,7 @@ public class DefaultFieldGroupFieldFactoryTest {
@Test
public void testEnumAnyField() {
- Field f = fieldFactory.createField(SomeEnum.class, Field.class);
+ LegacyField f = fieldFactory.createField(SomeEnum.class, LegacyField.class);
Assert.assertNotNull(f);
Assert.assertEquals(ListSelect.class, f.getClass());
}
diff --git a/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupDateTest.java b/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupDateTest.java
index ce76f8427b..919f4d3974 100644
--- a/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupDateTest.java
+++ b/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupDateTest.java
@@ -22,7 +22,7 @@ import org.junit.Before;
import org.junit.Test;
import com.vaadin.data.util.BeanItem;
-import com.vaadin.ui.Field;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.ui.PopupDateField;
public class FieldGroupDateTest {
@@ -66,14 +66,14 @@ public class FieldGroupDateTest {
@Test
public void testBuildAndBindDate() {
- Field f = fieldGroup.buildAndBind("javaDate");
+ LegacyField f = fieldGroup.buildAndBind("javaDate");
Assert.assertNotNull(f);
Assert.assertEquals(PopupDateField.class, f.getClass());
}
@Test
public void testBuildAndBindSqlDate() {
- Field f = fieldGroup.buildAndBind("sqlDate");
+ LegacyField f = fieldGroup.buildAndBind("sqlDate");
Assert.assertNotNull(f);
Assert.assertEquals(PopupDateField.class, f.getClass());
}
diff --git a/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupTest.java b/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupTest.java
index f8e4d1c2d0..7e404e7b31 100644
--- a/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupTest.java
+++ b/server/src/test/java/com/vaadin/data/fieldgroup/FieldGroupTest.java
@@ -13,18 +13,18 @@ import com.vaadin.data.Property;
import com.vaadin.data.Property.Transactional;
import com.vaadin.data.util.BeanItem;
import com.vaadin.data.util.TransactionalPropertyWrapper;
-import com.vaadin.ui.Field;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.ui.TextField;
public class FieldGroupTest {
private FieldGroup sut;
- private Field field;
+ private LegacyField field;
@Before
public void setup() {
sut = new FieldGroup();
- field = mock(Field.class);
+ field = mock(LegacyField.class);
}
@Test
@@ -37,7 +37,7 @@ public class FieldGroupTest {
@Test(expected = FieldGroup.BindException.class)
public void cannotBindToAlreadyBoundProperty() {
sut.bind(field, "foobar");
- sut.bind(mock(Field.class), "foobar");
+ sut.bind(mock(LegacyField.class), "foobar");
}
@Test(expected = FieldGroup.BindException.class)
diff --git a/server/src/test/java/com/vaadin/tests/VaadinClasses.java b/server/src/test/java/com/vaadin/tests/VaadinClasses.java
index b5933bbd10..a8bb79af7a 100644
--- a/server/src/test/java/com/vaadin/tests/VaadinClasses.java
+++ b/server/src/test/java/com/vaadin/tests/VaadinClasses.java
@@ -17,12 +17,12 @@ import java.util.jar.JarEntry;
import org.junit.Test;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.VaadinSession;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.DragAndDropWrapper;
-import com.vaadin.ui.Field;
import com.vaadin.ui.HorizontalSplitPanel;
import com.vaadin.ui.LoginForm;
import com.vaadin.ui.PopupView;
@@ -63,9 +63,9 @@ public class VaadinClasses {
}
}
- public static List<Class<? extends Field>> getFields() {
+ public static List<Class<? extends LegacyField>> getFields() {
try {
- return findClasses(Field.class, "com.vaadin.ui");
+ return findClasses(LegacyField.class, "com.vaadin.ui");
} catch (IOException e) {
e.printStackTrace();
return null;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/FieldDefaultValuesTest.java b/server/src/test/java/com/vaadin/tests/server/component/FieldDefaultValuesTest.java
index 32f5ef8850..89d73e98c5 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/FieldDefaultValuesTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/FieldDefaultValuesTest.java
@@ -21,15 +21,15 @@ import java.util.List;
import org.junit.Assert;
import org.junit.Test;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.tests.VaadinClasses;
-import com.vaadin.ui.Field;
import com.vaadin.ui.Slider;
public class FieldDefaultValuesTest {
@Test
public void testFieldsHaveDefaultValueAfterClear() throws Exception {
- for (Field<?> field : createFields()) {
+ for (LegacyField<?> field : createFields()) {
Object originalValue = field.getValue();
field.clear();
@@ -43,7 +43,7 @@ public class FieldDefaultValuesTest {
@Test
public void testFieldsAreEmptyAfterClear() throws Exception {
- for (Field<?> field : createFields()) {
+ for (LegacyField<?> field : createFields()) {
field.clear();
if (field instanceof Slider) {
@@ -60,11 +60,11 @@ public class FieldDefaultValuesTest {
}
@SuppressWarnings("rawtypes")
- private static List<Field<?>> createFields() throws InstantiationException,
+ private static List<LegacyField<?>> createFields() throws InstantiationException,
IllegalAccessException {
- List<Field<?>> fieldInstances = new ArrayList<Field<?>>();
+ List<LegacyField<?>> fieldInstances = new ArrayList<LegacyField<?>>();
- for (Class<? extends Field> fieldType : VaadinClasses.getFields()) {
+ for (Class<? extends LegacyField> fieldType : VaadinClasses.getFields()) {
fieldInstances.add(fieldType.newInstance());
}
return fieldInstances;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbsFieldValidatorsTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbsFieldValidatorsTest.java
index 59831d92e1..a4fa3e0ad0 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbsFieldValidatorsTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbsFieldValidatorsTest.java
@@ -9,11 +9,11 @@ import org.easymock.EasyMock;
import org.junit.Test;
import com.vaadin.data.Validator;
-import com.vaadin.ui.AbstractField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
public class AbsFieldValidatorsTest {
- AbstractField<Object> field = new AbstractField<Object>() {
+ LegacyAbstractField<Object> field = new LegacyAbstractField<Object>() {
@Override
public Class getType() {
return Object.class;
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java
index 96ed8b6f1e..41ee1580eb 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/abstractfield/AbstractFieldDeclarativeTest.java
@@ -18,25 +18,25 @@ package com.vaadin.tests.server.component.abstractfield;
import org.junit.Test;
import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.tests.design.DeclarativeTestBase;
-import com.vaadin.ui.AbstractField;
import com.vaadin.ui.TextField;
/**
- * Tests declarative support for implementations of {@link AbstractField}.
+ * Tests declarative support for implementations of {@link LegacyAbstractField}.
*
* @since 7.4
* @author Vaadin Ltd
*/
public class AbstractFieldDeclarativeTest extends
- DeclarativeTestBase<AbstractField<?>> {
+ DeclarativeTestBase<LegacyAbstractField<?>> {
@Test
public void testPlainText() {
String design = "<vaadin-text-field buffered validation-visible='false' invalid-committed"
+ " invalid-allowed='false' required required-error='This is a required field'"
+ " conversion-error='Input {0} cannot be parsed' tabindex=3 readonly/>";
- AbstractField tf = new TextField();
+ LegacyAbstractField tf = new TextField();
tf.setBuffered(true);
tf.setBuffered(true);
tf.setValidationVisible(false);
@@ -62,7 +62,7 @@ public class AbstractFieldDeclarativeTest extends
// Test that read only value coming from property data source is not
// written to design.
String design = "<vaadin-text-field value=test></vaadin-text-field>";
- AbstractField component = new TextField();
+ LegacyAbstractField component = new TextField();
ObjectProperty<String> property = new ObjectProperty<String>("test");
property.setReadOnly(true);
component.setPropertyDataSource(property);
diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetachTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetachTest.java
index f547f2c66b..8bceffb729 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetachTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetachTest.java
@@ -7,10 +7,10 @@ import org.junit.Test;
import com.vaadin.data.Property;
import com.vaadin.data.util.AbstractProperty;
import com.vaadin.data.util.converter.Converter.ConversionException;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinSession;
import com.vaadin.tests.util.AlwaysLockedVaadinSession;
-import com.vaadin.ui.AbstractField;
import com.vaadin.ui.UI;
public class RemoveListenersOnDetachTest {
@@ -18,7 +18,7 @@ public class RemoveListenersOnDetachTest {
int numValueChanges = 0;
int numReadOnlyChanges = 0;
- AbstractField field = new AbstractField() {
+ LegacyAbstractField field = new LegacyAbstractField() {
final private VaadinSession application = new AlwaysLockedVaadinSession(
null);
private UI uI = new UI() {
diff --git a/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java b/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
index 90c079b35c..a710e1c529 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
@@ -10,7 +10,7 @@ import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.data.fieldgroup.PropertyId;
import com.vaadin.data.util.BeanItem;
-import com.vaadin.ui.Field;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.TextField;
@@ -87,12 +87,12 @@ public class BeanFieldGroupTest {
BeanFieldGroup<MyBean> bindFields = BeanFieldGroup
.bindFieldsUnbuffered(myBean, viewStub);
- Field<String> field = (Field<String>) bindFields.getField("basicField");
+ LegacyField<String> field = (LegacyField<String>) bindFields.getField("basicField");
Assert.assertEquals(DEFAULT_FOR_BASIC_FIELD, myBean.basicField);
field.setValue("Foo");
Assert.assertEquals("Foo", myBean.basicField);
- field = (Field<String>) bindFields.getField("anotherField");
+ field = (LegacyField<String>) bindFields.getField("anotherField");
field.setValue("Foo");
Assert.assertEquals("Foo", myBean.anotherField);
}
@@ -106,12 +106,12 @@ public class BeanFieldGroupTest {
BeanFieldGroup<MyBean> bindFields = BeanFieldGroup.bindFieldsBuffered(
myBean, viewStub);
- Field<String> basicField = (Field<String>) bindFields
+ LegacyField<String> basicField = (LegacyField<String>) bindFields
.getField("basicField");
basicField.setValue("Foo");
Assert.assertEquals(DEFAULT_FOR_BASIC_FIELD, myBean.basicField);
- Field<String> anotherField = (Field<String>) bindFields
+ LegacyField<String> anotherField = (LegacyField<String>) bindFields
.getField("anotherField");
anotherField.setValue("Foo");
Assert.assertNull(myBean.anotherField);
@@ -131,7 +131,7 @@ public class BeanFieldGroupTest {
BeanFieldGroup<MyBean> bfg = new BeanFieldGroup<MyBean>(MyBean.class);
bfg.setItemDataSource(bean);
- com.vaadin.ui.Field<?> helloField = bfg.buildAndBind("Hello string",
+ com.vaadin.legacy.ui.LegacyField<?> helloField = bfg.buildAndBind("Hello string",
"nestedBean.hello");
assertEquals(bean.nestedBean.hello, helloField.getValue().toString());
}
diff --git a/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/FieldGroupTest.java b/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/FieldGroupTest.java
index d77a2e190b..3f98efb15d 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/FieldGroupTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/fieldgroup/FieldGroupTest.java
@@ -31,7 +31,7 @@ import com.vaadin.data.Validator.InvalidValueException;
import com.vaadin.data.fieldgroup.FieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.data.util.AbstractProperty;
-import com.vaadin.ui.Field;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.ui.TextField;
/**
@@ -81,16 +81,16 @@ public class FieldGroupTest {
field2.setRequired(true);
fieldGroup.bind(field2, "prop2");
- Set<TextField> set = new HashSet<TextField>(Arrays.asList(field1,
+ Set<TextField> set = new HashSet<>(Arrays.asList(field1,
field2));
try {
fieldGroup.commit();
Assert.fail("No commit exception is thrown");
} catch (CommitException exception) {
- Map<Field<?>, ? extends InvalidValueException> invalidFields = exception
+ Map<LegacyField<?>, ? extends InvalidValueException> invalidFields = exception
.getInvalidFields();
- for (Entry<Field<?>, ? extends InvalidValueException> entry : invalidFields
+ for (Entry<LegacyField<?>, ? extends InvalidValueException> entry : invalidFields
.entrySet()) {
set.remove(entry.getKey());
}
@@ -137,7 +137,8 @@ public class FieldGroupTest {
}
@Override
- public void setValue(String newValue) throws Property.ReadOnlyException {
+ public void setValue(String newValue)
+ throws Property.ReadOnlyException {
}
@Override
diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridEditorTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridEditorTest.java
index b70f17779a..5a019f702d 100644
--- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridEditorTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridEditorTest.java
@@ -35,10 +35,10 @@ import com.vaadin.data.Property;
import com.vaadin.data.fieldgroup.FieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.MockVaadinSession;
import com.vaadin.server.VaadinService;
import com.vaadin.server.VaadinSession;
-import com.vaadin.ui.Field;
import com.vaadin.ui.Grid;
import com.vaadin.ui.TextField;
@@ -235,7 +235,7 @@ public class GridEditorTest {
public void testFieldIsNotReadonly() {
startEdit();
- Field<?> field = grid.getColumn(PROPERTY_NAME).getEditorField();
+ LegacyField<?> field = grid.getColumn(PROPERTY_NAME).getEditorField();
assertFalse(field.isReadOnly());
}
@@ -244,13 +244,13 @@ public class GridEditorTest {
startEdit();
grid.getEditorFieldGroup().setReadOnly(true);
- Field<?> field = grid.getColumn(PROPERTY_NAME).getEditorField();
+ LegacyField<?> field = grid.getColumn(PROPERTY_NAME).getEditorField();
assertTrue(field.isReadOnly());
}
@Test
public void testColumnRemoved() {
- Field<?> field = grid.getColumn(PROPERTY_NAME).getEditorField();
+ LegacyField<?> field = grid.getColumn(PROPERTY_NAME).getEditorField();
assertSame("field should be attached to ", grid, field.getParent());
diff --git a/server/src/test/java/com/vaadin/tests/server/components/AbstractFieldValueChangeTestBase.java b/server/src/test/java/com/vaadin/tests/server/components/AbstractFieldValueChangeTestBase.java
index d068051663..9e71150946 100644
--- a/server/src/test/java/com/vaadin/tests/server/components/AbstractFieldValueChangeTestBase.java
+++ b/server/src/test/java/com/vaadin/tests/server/components/AbstractFieldValueChangeTestBase.java
@@ -7,7 +7,7 @@ import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Property.ValueChangeNotifier;
import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.ui.AbstractField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
/**
* Base class for tests for checking that value change listeners for fields are
@@ -17,16 +17,16 @@ import com.vaadin.ui.AbstractField;
* {@link ValueChangeNotifier}).
*
* Subclasses should implement {@link #setValue()} and call
- * <code>super.setValue(AbstractField)</code>. Also, subclasses should typically
- * override {@link #setValue(AbstractField)} to set the field value via
+ * <code>super.setValue(LegacyAbstractField)</code>. Also, subclasses should typically
+ * override {@link #setValue(LegacyAbstractField)} to set the field value via
* <code>changeVariables()</code>.
*/
public abstract class AbstractFieldValueChangeTestBase<T> {
- private AbstractField<T> field;
+ private LegacyAbstractField<T> field;
private ValueChangeListener listener;
- protected void setUp(AbstractField<T> field) {
+ protected void setUp(LegacyAbstractField<T> field) {
this.field = field;
listener = EasyMock.createStrictMock(ValueChangeListener.class);
@@ -72,7 +72,7 @@ public abstract class AbstractFieldValueChangeTestBase<T> {
* be seen in some cases also when there is no notification of value change
* from the property.
*
- * Field value change notifications closely mirror value changes of the data
+ * LegacyField value change notifications closely mirror value changes of the data
* source behind the field.
*/
@Test
@@ -87,7 +87,7 @@ public abstract class AbstractFieldValueChangeTestBase<T> {
* Fully buffered use where the data source is neither read nor modified
* during editing, and is updated at commit().
*
- * Field value change notifications reflect the buffered value in the field,
+ * LegacyField value change notifications reflect the buffered value in the field,
* not the original data source value changes.
*/
public void testBuffered() {
@@ -116,14 +116,14 @@ public abstract class AbstractFieldValueChangeTestBase<T> {
EasyMock.verify(listener);
}
- protected AbstractField<T> getField() {
+ protected LegacyAbstractField<T> getField() {
return field;
}
/**
* Override in subclasses to set value with changeVariables().
*/
- protected void setValue(AbstractField<T> field) {
+ protected void setValue(LegacyAbstractField<T> field) {
field.setValue((T) "newValue");
}
diff --git a/server/src/test/java/com/vaadin/tests/server/components/ComboBoxValueChangeTest.java b/server/src/test/java/com/vaadin/tests/server/components/ComboBoxValueChangeTest.java
index 8bc1eb87df..9d8901e129 100644
--- a/server/src/test/java/com/vaadin/tests/server/components/ComboBoxValueChangeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/components/ComboBoxValueChangeTest.java
@@ -5,7 +5,7 @@ import java.util.Map;
import org.junit.Before;
-import com.vaadin.ui.AbstractField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.ui.ComboBox;
/**
@@ -25,7 +25,7 @@ public class ComboBoxValueChangeTest extends
}
@Override
- protected void setValue(AbstractField<Object> field) {
+ protected void setValue(LegacyAbstractField<Object> field) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("selected", new String[] { "myvalue" });
((ComboBox) field).changeVariables(field, variables);
diff --git a/server/src/test/java/com/vaadin/tests/server/components/TextFieldValueChangeTest.java b/server/src/test/java/com/vaadin/tests/server/components/TextFieldValueChangeTest.java
index 3b34d17c99..0ce07f8fb3 100644
--- a/server/src/test/java/com/vaadin/tests/server/components/TextFieldValueChangeTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/components/TextFieldValueChangeTest.java
@@ -10,7 +10,7 @@ import org.junit.Test;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.ui.AbstractField;
+import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.ui.TextField;
/**
@@ -39,7 +39,7 @@ public class TextFieldValueChangeTest extends
}
@Override
- protected void setValue(AbstractField<String> field) {
+ protected void setValue(LegacyAbstractField<String> field) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("text", "newValue");
((TextField) field).changeVariables(field, variables);
diff --git a/server/src/test/java/com/vaadin/tests/server/validation/BeanValidationTest.java b/server/src/test/java/com/vaadin/tests/server/validation/BeanValidationTest.java
index 6ad6ac2d5f..70a6a4487c 100644
--- a/server/src/test/java/com/vaadin/tests/server/validation/BeanValidationTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/validation/BeanValidationTest.java
@@ -6,8 +6,8 @@ import org.junit.Test;
import com.vaadin.data.Validator.InvalidValueException;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.validator.BeanValidator;
+import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.tests.data.bean.BeanToValidate;
-import com.vaadin.ui.Field;
public class BeanValidationTest {
@Test(expected = InvalidValueException.class)
@@ -95,7 +95,7 @@ public class BeanValidationTest {
beanToValidate.setFirstname("a");
fieldGroup.setItemDataSource(beanToValidate);
- Field<?> nameField = fieldGroup.buildAndBind("firstname");
+ LegacyField<?> nameField = fieldGroup.buildAndBind("firstname");
Assert.assertEquals(1, nameField.getValidators().size());
try {
diff --git a/server/src/test/java/com/vaadin/util/ReflectToolsGetFieldValueByTypeTest.java b/server/src/test/java/com/vaadin/util/ReflectToolsGetFieldValueByTypeTest.java
index 67796314c0..c3b09428d4 100644
--- a/server/src/test/java/com/vaadin/util/ReflectToolsGetFieldValueByTypeTest.java
+++ b/server/src/test/java/com/vaadin/util/ReflectToolsGetFieldValueByTypeTest.java
@@ -28,7 +28,7 @@ public class ReflectToolsGetFieldValueByTypeTest {
try {
memberField = myInstance.getClass().getField("field");
// Should get a String value. Without the third parameter (calling
- // ReflectTools.getJavaFieldValue(Object object, Field field)) would
+ // ReflectTools.getJavaFieldValue(Object object, LegacyField field)) would
// get an Integer value
fieldValue = ReflectTools.getJavaFieldValue(myInstance,
memberField, String.class);