summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorAnsku <Ansku@users.noreply.github.com>2017-08-17 09:32:48 +0300
committerTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-08-17 09:32:48 +0300
commit6e30d6b7d6c918a7cf7e9b9367261c8f86b8259b (patch)
treeaa31a1636455f618694d517377fb5814e17329d3 /client/src
parent97fa55d3d447098bbf605054b1ccfa08a848dc3e (diff)
downloadvaadin-framework-6e30d6b7d6c918a7cf7e9b9367261c8f86b8259b.tar.gz
vaadin-framework-6e30d6b7d6c918a7cf7e9b9367261c8f86b8259b.zip
Resize should work within Grid details row (#9799)
Fixes #7341
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/GridConnector.java73
-rwxr-xr-xclient/src/main/java/com/vaadin/client/widgets/Grid.java13
2 files changed, 82 insertions, 4 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/GridConnector.java
index 05f488a027..9cbafdbe21 100644
--- a/client/src/main/java/com/vaadin/client/connectors/GridConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/GridConnector.java
@@ -52,6 +52,8 @@ import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.AbstractHasComponentsConnector;
import com.vaadin.client.ui.ConnectorFocusAndBlurHandler;
import com.vaadin.client.ui.SimpleManagedLayout;
+import com.vaadin.client.ui.layout.ElementResizeEvent;
+import com.vaadin.client.ui.layout.ElementResizeListener;
import com.vaadin.client.widget.escalator.events.RowHeightChangedEvent;
import com.vaadin.client.widget.escalator.events.RowHeightChangedHandler;
import com.vaadin.client.widget.grid.CellReference;
@@ -496,17 +498,67 @@ public class GridConnector extends AbstractHasComponentsConnector
private final Map<String, ComponentConnector> idToDetailsMap = new HashMap<String, ComponentConnector>();
private final Map<String, Integer> idToRowIndex = new HashMap<String, Integer>();
+ private final Map<Element, ScheduledCommand> elementToResizeCommand = new HashMap<Element, Scheduler.ScheduledCommand>();
+ private final ElementResizeListener detailsRowResizeListener = new ElementResizeListener() {
+
+ @Override
+ public void onElementResize(ElementResizeEvent e) {
+ if (elementToResizeCommand.containsKey(e.getElement())) {
+ Scheduler.get().scheduleFinally(
+ elementToResizeCommand.get(e.getElement()));
+ }
+ }
+ };
+
+ /* calculated when the first details row is opened */
+ private Double spacerCellBorderHeights = null;
@Override
public Widget getDetails(int rowIndex) {
String id = getId(rowIndex);
- if (id == null) {
+ if (id == null || !hasDetailsOpen(rowIndex)) {
return null;
}
ComponentConnector componentConnector = idToDetailsMap.get(id);
idToRowIndex.put(id, rowIndex);
- return componentConnector.getWidget();
+ Widget widget = componentConnector.getWidget();
+ getLayoutManager().addElementResizeListener(widget.getElement(),
+ detailsRowResizeListener);
+ elementToResizeCommand.put(widget.getElement(),
+ createResizeCommand(rowIndex, widget.getElement()));
+
+ return widget;
+ }
+
+ private ScheduledCommand createResizeCommand(final int rowIndex,
+ final Element element) {
+ return new ScheduledCommand() {
+
+ @Override
+ public void execute() {
+ // It should not be possible to get here without calculating
+ // the spacerCellBorderHeights or without having the details
+ // row open, nor for this command to be triggered while
+ // layout is running, but it's safer to check anyway.
+ if (spacerCellBorderHeights != null
+ && !getLayoutManager().isLayoutRunning()
+ && hasDetailsOpen(rowIndex)) {
+ double height = getLayoutManager().getOuterHeightDouble(
+ element) + spacerCellBorderHeights;
+ getWidget().setDetailsHeight(rowIndex, height);
+ }
+ }
+ };
+ }
+
+ private boolean hasDetailsOpen(int rowIndex) {
+ JsonObject row = getWidget().getDataSource().getRow(rowIndex);
+ if (row.hasKey(GridState.JSONKEY_DETAILS_VISIBLE)) {
+ String id = row.getString(GridState.JSONKEY_DETAILS_VISIBLE);
+ return id != null && !id.isEmpty();
+ }
+ return false;
}
@Override
@@ -519,8 +571,16 @@ public class GridConnector extends AbstractHasComponentsConnector
getLayoutManager().setNeedsMeasureRecursively(componentConnector);
getLayoutManager().layoutNow();
- return getLayoutManager().getOuterHeightDouble(
- componentConnector.getWidget().getElement());
+ Element element = componentConnector.getWidget().getElement();
+ if (spacerCellBorderHeights == null) {
+ // If theme is changed, new details generator is created from
+ // scratch, so this value doesn't need to be updated elsewhere.
+ spacerCellBorderHeights = WidgetUtil
+ .getBorderTopAndBottomThickness(
+ element.getParentElement());
+ }
+
+ return getLayoutManager().getOuterHeightDouble(element);
}
/**
@@ -568,6 +628,11 @@ public class GridConnector extends AbstractHasComponentsConnector
}
for (String id : removedDetails) {
+ Element element = idToDetailsMap.get(id).getWidget()
+ .getElement();
+ elementToResizeCommand.remove(element);
+ getLayoutManager().removeElementResizeListener(element,
+ detailsRowResizeListener);
idToDetailsMap.remove(id);
idToRowIndex.remove(id);
}
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java
index c76ea3e436..21d7d0ae5d 100755
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -9118,6 +9118,19 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
}
/**
+ * Update details row height.
+ *
+ * @since
+ * @param rowIndex
+ * the index of the row for which to update details height
+ * @param height
+ * new height of the details row
+ */
+ public void setDetailsHeight(int rowIndex, double height) {
+ escalator.getBody().setSpacer(rowIndex, height);
+ }
+
+ /**
* Requests that the column widths should be recalculated.
* <p>
* The actual recalculation is not necessarily done immediately so you
914/stable28 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/appinfo/database.xml
blob: c3cfb9e1c88161785d06f82f1df6b2ad078da557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
	<name>*dbname*</name>
	<create>true</create>
	<overwrite>false</overwrite>
	<charset>utf8</charset>
	<table>
		<name>*dbprefix*share_external</name>
		<declaration>
			<field>
				<name>id</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<autoincrement>1</autoincrement>
				<length>4</length>
			</field>
			<field>
				<name>parent</name>
				<type>integer</type>
				<default>-1</default>
				<length>4</length>
			</field>
			<field>
				<name>share_type</name>
				<type>integer</type>
				<length>4</length>
			</field>
			<field>
				<name>remote</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>512</length>
				<comments>Url of the remove owncloud instance</comments>
			</field>
			<field>
				<name>remote_id</name>
				<type>integer</type>
				<default>-1</default>
				<notnull>true</notnull>
				<length>4</length>
			</field>
			<field>
				<name>share_token</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
				<comments>Public share token</comments>
			</field>
			<field>
				<name>password</name>
				<type>text</type>
				<notnull>false</notnull>
				<length>64</length>
				<comments>Optional password for the public share</comments>
			</field>
			<field>
				<name>name</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
				<comments>Original name on the remote server</comments>
			</field>
			<field>
				<name>owner</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
				<comments>User that owns the public share on the remote server</comments>
			</field>
			<field>
				<name>user</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>64</length>
				<comments>Local user which added the external share</comments>
			</field>
			<field>
				<name>mountpoint</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>4000</length>
				<comments>Full path where the share is mounted</comments>
			</field>
			<field>
				<name>mountpoint_hash</name>
				<type>text</type>
				<notnull>true</notnull>
				<length>32</length>
				<comments>md5 hash of the mountpoint</comments>
			</field>
			<field>
				<name>accepted</name>
				<type>integer</type>
				<default>0</default>
				<notnull>true</notnull>
				<length>4</length>
			</field>
			<index>
				<name>sh_external_user</name>
				<field>
					<name>user</name>
					<sorting>ascending</sorting>
				</field>
			</index>
			<index>
				<name>sh_external_mp</name>
				<unique>true</unique>
				<field>
					<name>user</name>
					<sorting>ascending</sorting>
				</field>
				<field>
					<name>mountpoint_hash</name>
					<sorting>ascending</sorting>
				</field>
			</index>
		</declaration>
	</table>
</database>