summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-09-04 15:05:27 +0300
committerArtur Signell <artur@vaadin.com>2015-09-04 15:05:27 +0300
commitf46be1b2792755cb7d9b111068dd6cf202398c4a (patch)
tree74f7098faee688cc1f1ca1b6ffe9e912338bbcaf /shared
parente603ea3cf91e5dd0893b766f27d400947527fba9 (diff)
parentebceef4d44bcd61605fa92fcf7be8d3678537599 (diff)
downloadvaadin-framework-f46be1b2792755cb7d9b111068dd6cf202398c4a.tar.gz
vaadin-framework-f46be1b2792755cb7d9b111068dd6cf202398c4a.zip
Merge remote-tracking branch 'origin/master' into reconnect-dialog
Change-Id: Ie622160a83116c83b255a26bec297f73f3223ac7
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/VBrowserDetails.java25
-rw-r--r--shared/src/com/vaadin/shared/data/DataProviderRpc.java12
-rw-r--r--shared/src/com/vaadin/shared/data/DataRequestRpc.java18
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridClientRpc.java17
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridConstants.java15
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java46
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridState.java43
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelServerRpc.java55
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelState.java31
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelServerRpc.java35
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelState.java30
-rw-r--r--shared/src/com/vaadin/shared/ui/table/TableConstants.java1
12 files changed, 267 insertions, 61 deletions
diff --git a/shared/src/com/vaadin/shared/VBrowserDetails.java b/shared/src/com/vaadin/shared/VBrowserDetails.java
index 561b6c76d0..d0de8ffb9f 100644
--- a/shared/src/com/vaadin/shared/VBrowserDetails.java
+++ b/shared/src/com/vaadin/shared/VBrowserDetails.java
@@ -41,6 +41,7 @@ public class VBrowserDetails implements Serializable {
private boolean isFirefox = false;
private boolean isOpera = false;
private boolean isIE = false;
+ private boolean isEdge = false;
private boolean isPhantomJS = false;
private boolean isWindowsPhone;
@@ -88,6 +89,16 @@ public class VBrowserDetails implements Serializable {
isSafari = !isChrome && !isIE && userAgent.indexOf("safari") != -1;
isFirefox = userAgent.indexOf(" firefox/") != -1;
isPhantomJS = userAgent.indexOf("phantomjs/") != -1;
+ if (userAgent.indexOf(" edge/") != -1) {
+ isEdge = true;
+ isChrome = false;
+ isOpera = false;
+ isIE = false;
+ isSafari = false;
+ isFirefox = false;
+ isWebKit = false;
+ isGecko = false;
+ }
// chromeframe
isChromeFrameCapable = userAgent.indexOf("chromeframe") != -1;
@@ -115,6 +126,8 @@ public class VBrowserDetails implements Serializable {
tmp = tmp.replaceFirst("([0-9]+\\.[0-9]+).*", "$1");
browserEngineVersion = Float.parseFloat(tmp);
}
+ } else if (isEdge) {
+ browserEngineVersion = 0;
}
} catch (Exception e) {
// Browser engine version parsing failed
@@ -158,6 +171,9 @@ public class VBrowserDetails implements Serializable {
i = userAgent.indexOf("opera/") + 6;
}
parseVersionString(safeSubstring(userAgent, i, i + 5));
+ } else if (isEdge) {
+ int i = userAgent.indexOf(" edge/") + 6;
+ parseVersionString(safeSubstring(userAgent, i, i + 8));
}
} catch (Exception e) {
// Browser version parsing failed
@@ -373,6 +389,15 @@ public class VBrowserDetails implements Serializable {
}
/**
+ * Tests if the browser is Edge.
+ *
+ * @return true if it is Edge, false otherwise
+ */
+ public boolean isEdge() {
+ return isEdge;
+ }
+
+ /**
* Tests if the browser is PhantomJS.
*
* @return true if it is PhantomJS, false otherwise
diff --git a/shared/src/com/vaadin/shared/data/DataProviderRpc.java b/shared/src/com/vaadin/shared/data/DataProviderRpc.java
index 4bfdb8b6c5..05965ea56c 100644
--- a/shared/src/com/vaadin/shared/data/DataProviderRpc.java
+++ b/shared/src/com/vaadin/shared/data/DataProviderRpc.java
@@ -91,4 +91,16 @@ public interface DataProviderRpc extends ClientRpc {
* the size of the new data set
*/
public void resetDataAndSize(int size);
+
+ /**
+ * Informs the client that rows have been updated. The client-side
+ * DataSource will map the given data to correct index if it should be in
+ * the cache.
+ *
+ * @since 7.6
+ * @param rowArray
+ * array of updated rows
+ */
+ @NoLayout
+ public void updateRowData(JsonArray rowArray);
}
diff --git a/shared/src/com/vaadin/shared/data/DataRequestRpc.java b/shared/src/com/vaadin/shared/data/DataRequestRpc.java
index 0d9b919a4e..4b553dda68 100644
--- a/shared/src/com/vaadin/shared/data/DataRequestRpc.java
+++ b/shared/src/com/vaadin/shared/data/DataRequestRpc.java
@@ -16,10 +16,12 @@
package com.vaadin.shared.data;
-import com.vaadin.shared.annotations.NoLoadingIndicator;
import com.vaadin.shared.annotations.Delayed;
+import com.vaadin.shared.annotations.NoLoadingIndicator;
import com.vaadin.shared.communication.ServerRpc;
+import elemental.json.JsonArray;
+
/**
* RPC interface used for requesting container data to the client.
*
@@ -45,15 +47,13 @@ public interface DataRequestRpc extends ServerRpc {
int firstCachedRowIndex, int cacheSize);
/**
- * Informs the server that an item referenced with a key pinned status has
- * changed. This is a delayed call that happens along with next rpc call to
- * server.
+ * Informs the server that items have been dropped from the client cache.
*
- * @param key
- * key mapping to item
- * @param isPinned
- * pinned status of referenced item
+ * @since 7.6
+ * @param rowKeys
+ * array of dropped keys mapping to items
*/
@Delayed
- public void setPinned(String key, boolean isPinned);
+ @NoLoadingIndicator
+ public void dropRows(JsonArray rowKeys);
}
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridClientRpc.java b/shared/src/com/vaadin/shared/ui/grid/GridClientRpc.java
index 3c6d993482..ac1b1d5a78 100644
--- a/shared/src/com/vaadin/shared/ui/grid/GridClientRpc.java
+++ b/shared/src/com/vaadin/shared/ui/grid/GridClientRpc.java
@@ -15,8 +15,6 @@
*/
package com.vaadin.shared.ui.grid;
-import java.util.Set;
-
import com.vaadin.shared.communication.ClientRpc;
/**
@@ -57,19 +55,4 @@ public interface GridClientRpc extends ClientRpc {
* Command client Grid to recalculate column widths.
*/
public void recalculateColumnWidths();
-
- /**
- * Informs the GridConnector on how the indexing of details connectors has
- * changed.
- *
- * @since 7.5.0
- * @param connectorChanges
- * the indexing changes of details connectors
- * @param fetchId
- * the id of the request for fetching the changes. A negative
- * number indicates a push (not requested by the client side)
- */
- public void setDetailsConnectorChanges(
- Set<DetailsConnectorChange> connectorChanges, int fetchId);
-
}
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridConstants.java b/shared/src/com/vaadin/shared/ui/grid/GridConstants.java
index 0606e4b1cc..5b2ac96975 100644
--- a/shared/src/com/vaadin/shared/ui/grid/GridConstants.java
+++ b/shared/src/com/vaadin/shared/ui/grid/GridConstants.java
@@ -74,4 +74,19 @@ public final class GridConstants implements Serializable {
/** The default cancel button caption in the editor */
public static final String DEFAULT_CANCEL_CAPTION = "Cancel";
+
+ /**
+ * Event ID constant for editor open event
+ */
+ public static final String EDITOR_OPEN_EVENT_ID = "editorOpen";
+
+ /**
+ * Event ID constant for editor move event
+ */
+ public static final String EDITOR_MOVE_EVENT_ID = "editorMove";
+
+ /**
+ * Event ID constant for editor close event
+ */
+ public static final String EDITOR_CLOSE_EVENT_ID = "editorClose";
}
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java
index dca55c11c4..8d64794b41 100644
--- a/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java
@@ -29,14 +29,35 @@ import com.vaadin.shared.data.sort.SortDirection;
*/
public interface GridServerRpc extends ServerRpc {
- void select(List<String> newSelection);
-
- void selectAll();
-
void sort(String[] columnIds, SortDirection[] directions,
boolean userOriginated);
/**
+ * Informs the server that the editor was opened (fresh) on a certain row
+ *
+ * @param rowKey
+ * a key identifying item the editor was opened on
+ */
+ void editorOpen(String rowKey);
+
+ /**
+ * Informs the server that the editor was reopened (without closing it in
+ * between) on another row
+ *
+ * @param rowKey
+ * a key identifying item the editor was opened on
+ */
+ void editorMove(String rowKey);
+
+ /**
+ * Informs the server that the editor was closed
+ *
+ * @param rowKey
+ * a key identifying item the editor was opened on
+ */
+ void editorClose(String rowKey);
+
+ /**
* Informs the server that an item has been clicked in Grid.
*
* @param rowKey
@@ -61,23 +82,6 @@ public interface GridServerRpc extends ServerRpc {
List<String> oldColumnOrder);
/**
- * This is a trigger for Grid to send whatever has changed regarding the
- * details components.
- * <p>
- * The components can't be sent eagerly, since they are generated as a side
- * effect in
- * {@link com.vaadin.data.RpcDataProviderExtension#beforeClientResponse(boolean)}
- * , and that is too late to change the hierarchy. So we need this
- * round-trip to work around that limitation.
- *
- * @since 7.5.0
- * @param fetchId
- * an unique identifier for the request
- * @see com.vaadin.ui.Grid#setDetailsVisible(Object, boolean)
- */
- void sendDetailsComponents(int fetchId);
-
- /**
* Informs the server that the column's visibility has been changed.
*
* @since 7.5.0
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridState.java b/shared/src/com/vaadin/shared/ui/grid/GridState.java
index c23c931683..e51b1a78a7 100644
--- a/shared/src/com/vaadin/shared/ui/grid/GridState.java
+++ b/shared/src/com/vaadin/shared/ui/grid/GridState.java
@@ -19,9 +19,9 @@ package com.vaadin.shared.ui.grid;
import java.util.ArrayList;
import java.util.List;
-import com.vaadin.shared.AbstractComponentState;
import com.vaadin.shared.annotations.DelegateToWidget;
import com.vaadin.shared.data.sort.SortDirection;
+import com.vaadin.shared.ui.TabIndexState;
/**
* The shared state for the {@link com.vaadin.ui.components.grid.Grid} component
@@ -29,7 +29,7 @@ import com.vaadin.shared.data.sort.SortDirection;
* @since 7.4
* @author Vaadin Ltd
*/
-public class GridState extends AbstractComponentState {
+public class GridState extends TabIndexState {
/**
* A description of which of the three bundled SelectionModels is currently
@@ -103,6 +103,20 @@ public class GridState extends AbstractComponentState {
public static final String JSONKEY_CELLSTYLES = "cs";
/**
+ * The key in which a row's description can be found
+ *
+ * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
+ */
+ public static final String JSONKEY_ROWDESCRIPTION = "rd";
+
+ /**
+ * The key in which a cell's description can be found
+ *
+ * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
+ */
+ public static final String JSONKEY_CELLDESCRIPTION = "cd";
+
+ /**
* The key that tells whether details are visible for the row.
*
* @since 7.5.0
@@ -115,6 +129,13 @@ public class GridState extends AbstractComponentState {
public static final String JSONKEY_DETAILS_VISIBLE = "dv";
/**
+ * The key that tells whether row is selected.
+ *
+ * @since
+ */
+ public static final String JSONKEY_SELECTED = "s";
+
+ /**
* Columns in grid.
*/
public List<GridColumnState> columns = new ArrayList<GridColumnState>();
@@ -139,14 +160,6 @@ public class GridState extends AbstractComponentState {
@DelegateToWidget
public HeightMode heightMode = HeightMode.CSS;
- // instantiated just to avoid NPEs
- public List<String> selectedKeys = new ArrayList<String>();
-
- public SharedSelectionMode selectionMode;
-
- /** Whether single select mode can be cleared through the UI */
- public boolean singleSelectDeselectAllowed = true;
-
/** Keys of the currently sorted columns */
public String[] sortColumns = new String[0];
@@ -156,10 +169,12 @@ public class GridState extends AbstractComponentState {
/** The enabled state of the editor interface */
public boolean editorEnabled = false;
- /** Whether row data might contain generated row styles */
- public boolean hasRowStyleGenerator;
- /** Whether row data might contain generated cell styles */
- public boolean hasCellStyleGenerator;
+ /** Buffered editor mode */
+ @DelegateToWidget
+ public boolean editorBuffered = true;
+
+ /** Whether rows and/or cells have generated descriptions (tooltips) */
+ public boolean hasDescriptions;
/** The caption for the save button in the editor */
@DelegateToWidget
diff --git a/shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelServerRpc.java
new file mode 100644
index 0000000000..e7324552f4
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelServerRpc.java
@@ -0,0 +1,55 @@
+/*
+ * 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.shared.ui.grid.selection;
+
+import java.util.List;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * ServerRpc for MultiSelectionModel.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface MultiSelectionModelServerRpc extends ServerRpc {
+
+ /**
+ * Select a list of rows based on their row keys on the server-side.
+ *
+ * @param rowKeys
+ * list of row keys to select
+ */
+ public void select(List<String> rowKeys);
+
+ /**
+ * Deselect a list of rows based on their row keys on the server-side.
+ *
+ * @param rowKeys
+ * list of row keys to deselect
+ */
+ public void deselect(List<String> rowKeys);
+
+ /**
+ * Selects all rows on the server-side.
+ */
+ public void selectAll();
+
+ /**
+ * Deselects all rows on the server-side.
+ */
+ public void deselectAll();
+}
diff --git a/shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelState.java b/shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelState.java
new file mode 100644
index 0000000000..3ffd0d0f93
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/grid/selection/MultiSelectionModelState.java
@@ -0,0 +1,31 @@
+/*
+ * 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.shared.ui.grid.selection;
+
+import com.vaadin.shared.communication.SharedState;
+
+/**
+ * SharedState object for MultiSelectionModel.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class MultiSelectionModelState extends SharedState {
+
+ /* Select All -checkbox status */
+ public boolean allSelected;
+
+}
diff --git a/shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelServerRpc.java
new file mode 100644
index 0000000000..3e2a8ec847
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelServerRpc.java
@@ -0,0 +1,35 @@
+/*
+ * 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.shared.ui.grid.selection;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * ServerRpc for SingleSelectionModel.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public interface SingleSelectionModelServerRpc extends ServerRpc {
+
+ /**
+ * Selects a row on server-side.
+ *
+ * @param rowKey
+ * row key of selected row; {@code null} if deselect
+ */
+ public void select(String rowKey);
+}
diff --git a/shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelState.java b/shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelState.java
new file mode 100644
index 0000000000..719b60b2ba
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/grid/selection/SingleSelectionModelState.java
@@ -0,0 +1,30 @@
+/*
+ * 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.shared.ui.grid.selection;
+
+import com.vaadin.shared.communication.SharedState;
+
+/**
+ * SharedState object for SingleSelectionModel.
+ *
+ * @since
+ * @author Vaadin Ltd
+ */
+public class SingleSelectionModelState extends SharedState {
+
+ /* Allow deselecting rows */
+ public boolean deselectAllowed;
+}
diff --git a/shared/src/com/vaadin/shared/ui/table/TableConstants.java b/shared/src/com/vaadin/shared/ui/table/TableConstants.java
index fd1c61c772..e782492e9d 100644
--- a/shared/src/com/vaadin/shared/ui/table/TableConstants.java
+++ b/shared/src/com/vaadin/shared/ui/table/TableConstants.java
@@ -23,6 +23,7 @@ public class TableConstants implements Serializable {
public static final String FOOTER_CLICK_EVENT_ID = "handleFooterClick";
public static final String COLUMN_RESIZE_EVENT_ID = "columnResize";
public static final String COLUMN_REORDER_EVENT_ID = "columnReorder";
+ public static final String COLUMN_COLLAPSE_EVENT_ID = "columnCollapse";
@Deprecated
public static final String ATTRIBUTE_PAGEBUFFER_FIRST = "pb-ft";