@@ -21,6 +21,7 @@ import java.util.EventObject; | |||
import java.util.Objects; | |||
import java.util.Optional; | |||
import com.vaadin.event.HasUserOriginated; | |||
import com.vaadin.event.SerializableEventListener; | |||
import com.vaadin.server.Setter; | |||
import com.vaadin.shared.Registration; |
@@ -30,7 +30,7 @@ import com.vaadin.util.ReflectTools; | |||
* @param <T> | |||
* collapsed item type | |||
*/ | |||
public class CollapseEvent<T> extends Component.Event { | |||
public class CollapseEvent<T> extends Component.Event implements HasUserOriginated { | |||
private final T collapsedItem; | |||
@@ -63,13 +63,7 @@ public class CollapseEvent<T> extends Component.Event { | |||
return collapsedItem; | |||
} | |||
/** | |||
* Returns whether this event was triggered by user interaction, on the | |||
* client side, or programmatically, on the server side. | |||
* | |||
* @return {@code true} if this event originates from the client, | |||
* {@code false} otherwise. | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} |
@@ -29,7 +29,8 @@ import com.vaadin.util.ReflectTools; | |||
* @param <T> | |||
* the expanded item's type | |||
*/ | |||
public class ExpandEvent<T> extends Component.Event { | |||
public class ExpandEvent<T> extends Component.Event | |||
implements HasUserOriginated { | |||
private final T expandedItem; | |||
@@ -62,13 +63,7 @@ public class ExpandEvent<T> extends Component.Event { | |||
return expandedItem; | |||
} | |||
/** | |||
* Returns whether this event was triggered by user interaction, on the | |||
* client side, or programmatically, on the server side. | |||
* | |||
* @return {@code true} if this event originates from the client, | |||
* {@code false} otherwise. | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} |
@@ -13,14 +13,14 @@ | |||
* License for the specific language governing permissions and limitations under | |||
* the License. | |||
*/ | |||
package com.vaadin.data; | |||
package com.vaadin.event; | |||
import java.io.Serializable; | |||
/** | |||
* Marker for events which provides information of the event origin. | |||
* | |||
* @since | |||
* @since 8.1 | |||
*/ | |||
public interface HasUserOriginated extends Serializable { | |||
/** |
@@ -35,7 +35,8 @@ import com.vaadin.ui.Component; | |||
* @since 8.0 | |||
* @author Vaadin Ltd | |||
*/ | |||
public class SortEvent<T extends SortOrder<?>> extends Component.Event { | |||
public class SortEvent<T extends SortOrder<?>> extends Component.Event | |||
implements HasUserOriginated { | |||
private final List<T> sortOrder; | |||
private final boolean userOriginated; | |||
@@ -67,11 +68,7 @@ public class SortEvent<T extends SortOrder<?>> extends Component.Event { | |||
return sortOrder; | |||
} | |||
/** | |||
* Returns whether this event originated from actions done by the user. | |||
* | |||
* @return true if sort event originated from user interaction | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} |
@@ -19,6 +19,8 @@ import java.io.Serializable; | |||
import java.util.Optional; | |||
import java.util.Set; | |||
import com.vaadin.event.HasUserOriginated; | |||
/** | |||
* A selection event that unifies the way to access to selection event for multi | |||
* selection and single selection components (in case when only one selected | |||
@@ -29,7 +31,7 @@ import java.util.Set; | |||
* @param <T> | |||
* the data type of the selection model | |||
*/ | |||
public interface SelectionEvent<T> extends Serializable { | |||
public interface SelectionEvent<T> extends HasUserOriginated, Serializable { | |||
/** | |||
* Get first selected data item. | |||
@@ -51,13 +53,4 @@ public interface SelectionEvent<T> extends Serializable { | |||
* @return return all the selected items, if any, never {@code null} | |||
*/ | |||
Set<T> getAllSelectedItems(); | |||
/** | |||
* Returns whether this selection event was triggered by user interaction, | |||
* on the client side, or programmatically, on the server side. | |||
* | |||
* @return {@code true} if this event originates from the client, | |||
* {@code false} otherwise. | |||
*/ | |||
boolean isUserOriginated(); | |||
} |
@@ -24,6 +24,7 @@ import java.util.Iterator; | |||
import org.jsoup.nodes.Element; | |||
import com.vaadin.event.ConnectorEventListener; | |||
import com.vaadin.event.HasUserOriginated; | |||
import com.vaadin.event.MouseEvents.ClickEvent; | |||
import com.vaadin.server.SizeWithUnit; | |||
import com.vaadin.server.Sizeable; | |||
@@ -68,8 +69,9 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { | |||
getSplitterState().position = position; | |||
fireEvent(new SplitPositionChangeEvent(AbstractSplitPanel.this, true, | |||
oldPosition, getSplitPositionUnit(), position, getSplitPositionUnit())); | |||
fireEvent(new SplitPositionChangeEvent(AbstractSplitPanel.this, | |||
true, oldPosition, getSplitPositionUnit(), position, | |||
getSplitPositionUnit())); | |||
} | |||
}; | |||
@@ -563,7 +565,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { | |||
* | |||
* @since 7.5.0 | |||
*/ | |||
public static class SplitPositionChangeEvent extends Component.Event { | |||
public static class SplitPositionChangeEvent extends Component.Event | |||
implements HasUserOriginated { | |||
private final float oldPosition; | |||
private final Unit oldUnit; | |||
@@ -574,9 +577,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { | |||
private final boolean userOriginated; | |||
public SplitPositionChangeEvent(final Component source, | |||
final boolean userOriginated, | |||
final float oldPosition, final Unit oldUnit, | |||
final float position, final Unit unit) { | |||
final boolean userOriginated, final float oldPosition, | |||
final Unit oldUnit, final float position, final Unit unit) { | |||
super(source); | |||
this.userOriginated = userOriginated; | |||
this.oldUnit = oldUnit; | |||
@@ -588,8 +590,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { | |||
/** | |||
* Returns the new split position that triggered this change event. | |||
* | |||
* @since 7.5.0 | |||
* | |||
* @return the new value of split position | |||
*/ | |||
public float getSplitPosition() { | |||
@@ -599,8 +599,6 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { | |||
/** | |||
* Returns the new split position unit that triggered this change event. | |||
* | |||
* @since 7.5.0 | |||
* | |||
* @return the new value of split position | |||
*/ | |||
public Unit getSplitPositionUnit() { | |||
@@ -624,22 +622,14 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { | |||
* | |||
* @since 8.1 | |||
* | |||
* @return the split position unit previously set to the source of | |||
* this event | |||
* @return the split position unit previously set to the source of this | |||
* event | |||
*/ | |||
public Unit getOldSplitPositionUnit() { | |||
return oldUnit; | |||
} | |||
/** | |||
* Returns whether this event was triggered by user interaction, on the | |||
* client side, or programmatically, on the server side. | |||
* | |||
* @since 8.1 | |||
* | |||
* @return {@code true} if this event originates from the client, | |||
* {@code false} otherwise. | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} |
@@ -60,6 +60,7 @@ import com.vaadin.data.provider.Query; | |||
import com.vaadin.data.provider.QuerySortOrder; | |||
import com.vaadin.event.ConnectorEvent; | |||
import com.vaadin.event.ContextClickEvent; | |||
import com.vaadin.event.HasUserOriginated; | |||
import com.vaadin.event.SortEvent; | |||
import com.vaadin.event.SortEvent.SortListener; | |||
import com.vaadin.event.SortEvent.SortNotifier; | |||
@@ -257,7 +258,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
/** | |||
* An event that is fired when the columns are reordered. | |||
*/ | |||
public static class ColumnReorderEvent extends Component.Event { | |||
public static class ColumnReorderEvent extends Component.Event | |||
implements HasUserOriginated { | |||
private final boolean userOriginated; | |||
@@ -280,6 +282,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @return <code>true</code> if event is a result of user interaction | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} | |||
@@ -289,7 +292,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* An event that is fired when a column is resized, either programmatically | |||
* or by the user. | |||
*/ | |||
public static class ColumnResizeEvent extends Component.Event { | |||
public static class ColumnResizeEvent extends Component.Event | |||
implements HasUserOriginated { | |||
private final Column<?, ?> column; | |||
private final boolean userOriginated; | |||
@@ -324,6 +328,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @return <code>true</code> if event is a result of user interaction | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} | |||
@@ -482,7 +487,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* | |||
* @since 7.5.0 | |||
*/ | |||
public static class ColumnVisibilityChangeEvent extends Component.Event { | |||
public static class ColumnVisibilityChangeEvent extends Component.Event | |||
implements HasUserOriginated { | |||
private final Column<?, ?> column; | |||
private final boolean userOriginated; | |||
@@ -530,12 +536,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
return hidden; | |||
} | |||
/** | |||
* Returns <code>true</code> if the column reorder was done by the user, | |||
* <code>false</code> if not and it was triggered by server side code. | |||
* | |||
* @return <code>true</code> if event is a result of user interaction | |||
*/ | |||
@Override | |||
public boolean isUserOriginated() { | |||
return userOriginated; | |||
} | |||
@@ -915,12 +916,13 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* <code>null</code> | |||
* @param presentationProvider | |||
* the function to get presentations from the value of this | |||
* column, not <code>null</code>. For more details, see {@link #setRenderer(ValueProvider, Renderer)} | |||
* column, not <code>null</code>. For more details, see | |||
* {@link #setRenderer(ValueProvider, Renderer)} | |||
* @param renderer | |||
* the presentation renderer, not <code>null</code> | |||
* @param <P> | |||
* the presentation type | |||
* | |||
* | |||
* @since 8.1 | |||
*/ | |||
protected <P> Column(ValueProvider<T, V> valueProvider, | |||
@@ -1939,10 +1941,10 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* column, not {@code null} | |||
* @param renderer | |||
* the new renderer, not {@code null} | |||
* | |||
* | |||
* @param <P> | |||
* the presentation type | |||
* | |||
* | |||
* @return this column | |||
* | |||
* @since 8.1 | |||
@@ -2594,7 +2596,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* the value presentation provider | |||
* @param <V> | |||
* the column value type | |||
* | |||
* | |||
* @see #addColumn(ValueProvider, ValueProvider, AbstractRenderer) | |||
* | |||
* @return the new column | |||
@@ -2609,7 +2611,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
/** | |||
* Adds a new column to this {@link Grid} with value provider, presentation | |||
* provider and typed renderer. | |||
* | |||
* | |||
* <p> | |||
* The presentation provider is a method that takes the value from the value | |||
* provider, and maps that to a value that the renderer accepts. This | |||
@@ -3819,8 +3821,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* account. | |||
* | |||
* @param row | |||
* zero based index of the item to scroll to in the current | |||
* view. | |||
* zero based index of the item to scroll to in the current view. | |||
* @throws IllegalArgumentException | |||
* if the provided id is not recognized by the data source. | |||
*/ | |||
@@ -3835,8 +3836,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, | |||
* account. | |||
* | |||
* @param row | |||
* zero based index of the item to scroll to in the current | |||
* view. | |||
* zero based index of the item to scroll to in the current view. | |||
* @param destination | |||
* value specifying desired position of scrolled-to row, not | |||
* {@code null} |
@@ -28,7 +28,6 @@ import java.util.Map; | |||
import org.jsoup.nodes.Attributes; | |||
import org.jsoup.nodes.Element; | |||
import com.vaadin.data.HasUserOriginated; | |||
import com.vaadin.event.FieldEvents.BlurEvent; | |||
import com.vaadin.event.FieldEvents.BlurListener; | |||
import com.vaadin.event.FieldEvents.BlurNotifier; | |||
@@ -36,6 +35,7 @@ import com.vaadin.event.FieldEvents.FocusAndBlurServerRpcDecorator; | |||
import com.vaadin.event.FieldEvents.FocusEvent; | |||
import com.vaadin.event.FieldEvents.FocusListener; | |||
import com.vaadin.event.FieldEvents.FocusNotifier; | |||
import com.vaadin.event.HasUserOriginated; | |||
import com.vaadin.server.ErrorMessage; | |||
import com.vaadin.server.KeyMapper; | |||
import com.vaadin.server.Resource; |