aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-11 14:53:04 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2014-12-12 00:18:46 +0200
commit71f3551fe0e26f5d4297f98835520dbd24309ffb (patch)
treeb5317448df0e316631277b7a246aa4846207c58d /server/src
parent9fc2409cb33797c536cd2e7e9ef035a5422c5e58 (diff)
downloadvaadin-framework-71f3551fe0e26f5d4297f98835520dbd24309ffb.tar.gz
vaadin-framework-71f3551fe0e26f5d4297f98835520dbd24309ffb.zip
Move Sort related helpers and events to correct packages (#13334)
Change-Id: I3aa86364b61d42f971c4fca2b4c4895ddae870c4
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/data/sort/Sort.java (renamed from server/src/com/vaadin/ui/components/grid/sort/Sort.java)2
-rw-r--r--server/src/com/vaadin/data/sort/SortOrder.java (renamed from server/src/com/vaadin/ui/components/grid/sort/SortOrder.java)2
-rw-r--r--server/src/com/vaadin/data/util/GeneratedPropertyContainer.java2
-rw-r--r--server/src/com/vaadin/data/util/PropertyValueGenerator.java2
-rw-r--r--server/src/com/vaadin/event/SortOrderChangeEvent.java111
-rw-r--r--server/src/com/vaadin/ui/Grid.java13
-rw-r--r--server/src/com/vaadin/ui/components/grid/SortOrderChangeEvent.java74
-rw-r--r--server/src/com/vaadin/ui/components/grid/SortOrderChangeListener.java34
8 files changed, 123 insertions, 117 deletions
diff --git a/server/src/com/vaadin/ui/components/grid/sort/Sort.java b/server/src/com/vaadin/data/sort/Sort.java
index 54831378b6..914a92f249 100644
--- a/server/src/com/vaadin/ui/components/grid/sort/Sort.java
+++ b/server/src/com/vaadin/data/sort/Sort.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.ui.components.grid.sort;
+package com.vaadin.data.sort;
import java.io.Serializable;
import java.util.ArrayList;
diff --git a/server/src/com/vaadin/ui/components/grid/sort/SortOrder.java b/server/src/com/vaadin/data/sort/SortOrder.java
index a76148fe0c..55cae8c51d 100644
--- a/server/src/com/vaadin/ui/components/grid/sort/SortOrder.java
+++ b/server/src/com/vaadin/data/sort/SortOrder.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package com.vaadin.ui.components.grid.sort;
+package com.vaadin.data.sort;
import java.io.Serializable;
diff --git a/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java b/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java
index 91498eaeb1..17472807b5 100644
--- a/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java
+++ b/server/src/com/vaadin/data/util/GeneratedPropertyContainer.java
@@ -31,9 +31,9 @@ import com.google.gwt.thirdparty.guava.common.collect.Sets;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
+import com.vaadin.data.sort.SortOrder;
import com.vaadin.data.util.filter.UnsupportedFilterException;
import com.vaadin.shared.ui.grid.SortDirection;
-import com.vaadin.ui.components.grid.sort.SortOrder;
/**
* Container wrapper that adds support for generated properties. This container
diff --git a/server/src/com/vaadin/data/util/PropertyValueGenerator.java b/server/src/com/vaadin/data/util/PropertyValueGenerator.java
index 88169b785b..c535803ee1 100644
--- a/server/src/com/vaadin/data/util/PropertyValueGenerator.java
+++ b/server/src/com/vaadin/data/util/PropertyValueGenerator.java
@@ -20,8 +20,8 @@ import java.io.Serializable;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
+import com.vaadin.data.sort.SortOrder;
import com.vaadin.data.util.filter.UnsupportedFilterException;
-import com.vaadin.ui.components.grid.sort.SortOrder;
/**
* PropertyValueGenerator for GeneratedPropertyContainer.
diff --git a/server/src/com/vaadin/event/SortOrderChangeEvent.java b/server/src/com/vaadin/event/SortOrderChangeEvent.java
new file mode 100644
index 0000000000..e38097e3ba
--- /dev/null
+++ b/server/src/com/vaadin/event/SortOrderChangeEvent.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.event;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.vaadin.data.sort.SortOrder;
+import com.vaadin.shared.ui.grid.SortEventOriginator;
+import com.vaadin.ui.Component;
+
+/**
+ * Event describing a change in sorting of a {@link Container}. Fired by
+ * {@link SortOrderChangeNotifier SortOrderChangeNotifiers}.
+ *
+ * @see SortOrderChangeListener
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class SortOrderChangeEvent extends Component.Event {
+
+ private final List<SortOrder> sortOrder;
+ private final SortEventOriginator originator;
+
+ /**
+ * Creates a new sort order change event with a sort order list.
+ *
+ * @param source
+ * the component from which the event originates
+ * @param sortOrder
+ * the new sort order list
+ * @param originator
+ * an enumeration describing what triggered the sorting
+ */
+ public SortOrderChangeEvent(Component source, List<SortOrder> sortOrder,
+ SortEventOriginator originator) {
+ super(source);
+ this.sortOrder = sortOrder;
+ this.originator = originator;
+ }
+
+ /**
+ * Gets the sort order list.
+ *
+ * @return the sort order list
+ */
+ public List<SortOrder> getSortOrder() {
+ return sortOrder;
+ }
+
+ /**
+ * Returns whether this event originated from actions done by the user.
+ *
+ * @return true if sort event originated from user interaction
+ */
+ public boolean isUserOriginated() {
+ return originator == SortEventOriginator.USER;
+ }
+
+ /**
+ * Listener for sort order change events.
+ */
+ public interface SortOrderChangeListener extends Serializable {
+ /**
+ * Called when the sort order has changed.
+ *
+ * @param event
+ * the sort order change event
+ */
+ public void sortOrderChange(SortOrderChangeEvent event);
+ }
+
+ /**
+ * The interface for adding and removing listeners for
+ * {@link SortOrderChangeEvent SortOrderChangeEvents}.
+ */
+ public interface SortOrderChangeNotifier extends Serializable {
+ /**
+ * Adds a sort order change listener that gets notified when the sort
+ * order changes.
+ *
+ * @param listener
+ * the sort order change listener to add
+ */
+ public void addSortOrderChangeListener(SortOrderChangeListener listener);
+
+ /**
+ * Removes a sort order change listener previously added using
+ * {@link #addSortOrderChangeListener(SortOrderChangeListener)}.
+ *
+ * @param listener
+ * the sort order change listener to remove
+ */
+ public void removeSortOrderChangeListener(
+ SortOrderChangeListener listener);
+ }
+}
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java
index ca69387301..49c082b0b2 100644
--- a/server/src/com/vaadin/ui/Grid.java
+++ b/server/src/com/vaadin/ui/Grid.java
@@ -51,12 +51,17 @@ import com.vaadin.data.fieldgroup.FieldGroup;
import com.vaadin.data.fieldgroup.FieldGroup.BindException;
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
import com.vaadin.data.fieldgroup.FieldGroupFieldFactory;
+import com.vaadin.data.sort.Sort;
+import com.vaadin.data.sort.SortOrder;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.ConverterUtil;
import com.vaadin.event.SelectionChangeEvent;
import com.vaadin.event.SelectionChangeEvent.SelectionChangeListener;
import com.vaadin.event.SelectionChangeEvent.SelectionChangeNotifier;
+import com.vaadin.event.SortOrderChangeEvent;
+import com.vaadin.event.SortOrderChangeEvent.SortOrderChangeListener;
+import com.vaadin.event.SortOrderChangeEvent.SortOrderChangeNotifier;
import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.AbstractExtension;
import com.vaadin.server.ClientConnector;
@@ -81,10 +86,6 @@ import com.vaadin.shared.ui.grid.ScrollDestination;
import com.vaadin.shared.ui.grid.SortDirection;
import com.vaadin.shared.ui.grid.SortEventOriginator;
import com.vaadin.shared.util.SharedUtil;
-import com.vaadin.ui.components.grid.SortOrderChangeEvent;
-import com.vaadin.ui.components.grid.SortOrderChangeListener;
-import com.vaadin.ui.components.grid.sort.Sort;
-import com.vaadin.ui.components.grid.sort.SortOrder;
import com.vaadin.ui.renderer.Renderer;
import com.vaadin.ui.renderer.TextRenderer;
import com.vaadin.util.ReflectTools;
@@ -157,7 +158,7 @@ import elemental.json.JsonValue;
* @author Vaadin Ltd
*/
public class Grid extends AbstractComponent implements SelectionChangeNotifier,
- SelectiveRenderer {
+ SortOrderChangeNotifier, SelectiveRenderer {
/**
* Selection modes representing built-in {@link SelectionModel
@@ -3354,6 +3355,7 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier,
* @param listener
* the sort order change listener to add
*/
+ @Override
public void addSortOrderChangeListener(SortOrderChangeListener listener) {
addListener(SortOrderChangeEvent.class, listener,
SORT_ORDER_CHANGE_METHOD);
@@ -3366,6 +3368,7 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier,
* @param listener
* the sort order change listener to remove
*/
+ @Override
public void removeSortOrderChangeListener(SortOrderChangeListener listener) {
removeListener(SortOrderChangeEvent.class, listener,
SORT_ORDER_CHANGE_METHOD);
diff --git a/server/src/com/vaadin/ui/components/grid/SortOrderChangeEvent.java b/server/src/com/vaadin/ui/components/grid/SortOrderChangeEvent.java
deleted file mode 100644
index 09e39020af..0000000000
--- a/server/src/com/vaadin/ui/components/grid/SortOrderChangeEvent.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.ui.components.grid;
-
-import java.util.List;
-
-import com.vaadin.shared.ui.grid.SortEventOriginator;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.Grid;
-import com.vaadin.ui.components.grid.sort.SortOrder;
-
-/**
- * Event fired by {@link Grid} when the sort order has changed.
- *
- * @see SortOrderChangeListener
- *
- * @since
- * @author Vaadin Ltd
- */
-public class SortOrderChangeEvent extends Component.Event {
-
- private final List<SortOrder> sortOrder;
- private final SortEventOriginator originator;
-
- /**
- * Creates a new sort order change event for a grid and a sort order list.
- *
- * @param grid
- * the grid from which the event originates
- * @param sortOrder
- * the new sort order list
- * @param wasInitiatedByUser
- * should be set to true if this event results from end-user
- * interaction instead of an API call or side effect
- */
- public SortOrderChangeEvent(Grid grid, List<SortOrder> sortOrder,
- SortEventOriginator originator) {
- super(grid);
- this.sortOrder = sortOrder;
- this.originator = originator;
- }
-
- /**
- * Gets the sort order list.
- *
- * @return the sort order list
- */
- public List<SortOrder> getSortOrder() {
- return sortOrder;
- }
-
- /**
- * Returns whether this event originated from actions done by the user.
- *
- * @return true if sort event originated from user interaction
- */
- public boolean isUserOriginated() {
- return originator == SortEventOriginator.USER;
- }
-
-}
diff --git a/server/src/com/vaadin/ui/components/grid/SortOrderChangeListener.java b/server/src/com/vaadin/ui/components/grid/SortOrderChangeListener.java
deleted file mode 100644
index 82d7ba3108..0000000000
--- a/server/src/com/vaadin/ui/components/grid/SortOrderChangeListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2000-2014 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.ui.components.grid;
-
-import java.io.Serializable;
-
-/**
- * Listener for sort order change events from {@link Grid}.
- *
- * @since
- * @author Vaadin Ltd
- */
-public interface SortOrderChangeListener extends Serializable {
- /**
- * Called when the sort order has changed.
- *
- * @param event
- * the sort order change event
- */
- public void sortOrderChange(SortOrderChangeEvent event);
-}