Skip to content

Commit

Permalink
Remove deprecated methods from 3.0
Browse files Browse the repository at this point in the history
Removes or hides remaining API that has been made deprecated in 1.0-2.2.
Only exclusion is @VaadinServletConfiguration, which is kept.

Fixes #6510
  • Loading branch information
pleku committed Jan 10, 2020
1 parent f73d7df commit f230dd8
Show file tree
Hide file tree
Showing 23 changed files with 91 additions and 603 deletions.
30 changes: 24 additions & 6 deletions flow-server/src/main/java/com/vaadin/flow/component/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
import java.util.stream.Stream;
import java.util.stream.Stream.Builder;

import com.vaadin.flow.component.dependency.JavaScript;
import com.vaadin.flow.component.internal.ComponentMetaData;
import com.vaadin.flow.component.polymertemplate.Id;
import com.vaadin.flow.component.polymertemplate.PolymerTemplate;
import com.vaadin.flow.dom.Element;
import com.vaadin.flow.dom.ElementUtil;
import com.vaadin.flow.dom.PropertyChangeListener;
import com.vaadin.flow.dom.ShadowRoot;
import com.vaadin.flow.i18n.I18NProvider;
import com.vaadin.flow.internal.AnnotationReader;
Expand Down Expand Up @@ -70,6 +71,9 @@ public MapToExistingElement(Element element,
private static final PropertyDescriptor<String, Optional<String>> idDescriptor = PropertyDescriptors
.optionalAttributeWithDefault("id", "");

private static final PropertyChangeListener NOOP_PROPERTY_LISTENER = event -> {
};

/**
* Contains information about the element which should be used the next time
* a component class is instantiated.
Expand Down Expand Up @@ -149,11 +153,25 @@ protected Component(Element element) {
* Configures synchronized properties based on given annotations.
*/
private void configureSynchronizedProperties() {
ComponentUtil.getSynchronizedProperties(getClass()).forEach(
info -> getElement().addSynchronizedProperty(info.getProperty(),
info.getUpdateMode()));
ComponentUtil.getSynchronizedPropertyEvents(getClass())
.forEach(getElement()::addSynchronizedPropertyEvent);
ComponentUtil.getSynchronizedProperties(getClass())
.forEach(this::addSynchronizedProperty);
}

private void addSynchronizedProperty(
ComponentMetaData.SynchronizedPropertyInfo info) {
if (info.getUpdateMode() == null) {
throw new IllegalArgumentException(getClass().getName()
+ ": property update control mode for disabled element in @Synchronize annotation must not be null.");
}
info.getEventNames().forEach(eventType -> {
if (eventType == null) {
throw new IllegalArgumentException(getClass().getName()
+ ": event type must not be null for @Synchronize annotation");
}
element.addPropertyChangeListener(info.getProperty(), eventType,
NOOP_PROPERTY_LISTENER)
.setDisabledUpdateMode(info.getUpdateMode());
});
}

private void mapToElement(String tagName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;

import com.vaadin.flow.dom.DomEvent;
import com.vaadin.flow.dom.Element;
import com.vaadin.flow.internal.ReflectTools;
import com.vaadin.flow.internal.ReflectionCache;

Expand Down Expand Up @@ -61,7 +60,7 @@ private ComponentEventBusUtil() {

/**
* Gets a map of event data expression (for
* {@link Element#addEventListener(String, com.vaadin.flow.dom.DomEventListener, String...)}
* {@link com.vaadin.flow.dom.DomListenerRegistration#addEventData(String)}
* ) to Java type, with the same order as the parameters for the event
* constructor (as returned by {@link #getEventConstructor(Class)}).
* <p>
Expand All @@ -79,7 +78,7 @@ public static LinkedHashMap<String, Class<?>> getEventDataExpressions(

/**
* Scans the event type and forms a map of event data expression (for
* {@link Element#addEventListener(String, com.vaadin.flow.dom.DomEventListener, String...)}
* {@link com.vaadin.flow.dom.DomListenerRegistration#addEventData(String)}
* ) to Java type, with the same order as the parameters for the event
* constructor (as returned by {@link #getEventConstructor(Class)}).
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.vaadin.flow.dom.DebouncePhase;
import com.vaadin.flow.dom.DisabledUpdateMode;
import com.vaadin.flow.dom.DomEventListener;
import com.vaadin.flow.dom.DomListenerRegistration;
import com.vaadin.flow.dom.Element;

Expand All @@ -46,8 +47,7 @@
* </ul>
*
* @see EventData
* @see Element#addEventListener(String, com.vaadin.flow.dom.DomEventListener,
* String...)
* @see Element#addEventListener(String, DomEventListener)
* @author Vaadin Ltd
* @since 1.0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

import com.vaadin.flow.dom.DisabledUpdateMode;
import com.vaadin.flow.dom.DomListenerRegistration;
import com.vaadin.flow.dom.Element;

/**
* A generic interface for components and other user interface objects that may
* be enabled or disabled. The server will ignore incoming events for a disabled
* element unless the listener has been explicitly configured to allow events in
* a disabled state using e.g.
* {@link DomListenerRegistration#setDisabledUpdateMode(DisabledUpdateMode)} or
* {@link Element#addSynchronizedProperty(String, DisabledUpdateMode)}.
* {@link DomListenerRegistration#setDisabledUpdateMode(DisabledUpdateMode)}.
* <p>
* Implementing classes should <b>not</b> define their own implementations of
* the methods defined in this interface since the framework's overall security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,6 @@ public boolean isIPad() {
* using IOS or if no information from the browser is present
*/
public boolean isIOS() {
return isIPad() || VaadinSession.getCurrent().getBrowser().isIOS();
return isIPad() || VaadinSession.getCurrent().getBrowser().isIPhone();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public interface Instantiator extends Serializable {
*
* @return a stream of all bootstrap listeners to use, not <code>null</code>
*
* @deprecated This API is deprecated in favor of
* @deprecated Since 3.0, this API is deprecated in favor of
* {@link Instantiator#getIndexHtmlRequestListeners(Stream)}
* when using client-side bootstrapping
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ private static DebouncePhase extractPhase(JsonObject eventData) {
* @return The element on which the listener has been attached.
*
* @see Element#addEventListener(String, DomEventListener)
* @see Element#addEventListener(String, DomEventListener, String...)
*/
@Override
public Element getSource() {
Expand Down

0 comments on commit f230dd8

Please sign in to comment.