Skip to content
This repository was archived by the owner on Dec 31, 2020. It is now read-only.

Commit 71cf6e3

Browse files
committed
Increase version to snapshot
1 parent 0ff4fe7 commit 71cf6e3

File tree

4 files changed

+60
-2
lines changed

4 files changed

+60
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Official releases of this add-on are available at Vaadin Directory. For Maven in
6060

6161
## Release notes
6262

63+
### Version 0.3.1 (TBD)
64+
- TBD
65+
6366
### Version 0.3.0 (2016-05-18)
6467
- Possibility to move and resize already added children
6568
- Adds animate option to allow nice transitions when moving children

gridstack-addon/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>org.vaadin.alump.gridstack</groupId>
66
<artifactId>gridstack-addon</artifactId>
77
<packaging>bundle</packaging>
8-
<version>0.3.0</version>
8+
<version>0.3.1-SNAPSHOT</version>
99
<name>GridStack Add-on</name>
1010

1111
<properties>

gridstack-addon/src/main/java/org/vaadin/alump/gridstack/client/GridStackLayoutConnector.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@
3030
import com.vaadin.shared.Connector;
3131
import com.vaadin.shared.ui.Connect;
3232
import com.vaadin.shared.ui.LayoutClickRpc;
33+
import org.vaadin.alump.gridstack.client.shared.GridStackChildOptions;
3334
import org.vaadin.alump.gridstack.client.shared.GridStackMoveData;
3435
import org.vaadin.alump.gridstack.client.shared.GridStackServerRpc;
3536
import org.vaadin.alump.gridstack.client.shared.GridStackLayoutState;
3637

3738
import java.util.ArrayList;
39+
import java.util.Collections;
40+
import java.util.Comparator;
3841
import java.util.List;
3942
import java.util.logging.Logger;
4043

@@ -43,6 +46,8 @@ public class GridStackLayoutConnector extends AbstractLayoutConnector {
4346

4447
private transient final static Logger LOGGER = Logger.getLogger(GridStackLayoutConnector.class.getName());
4548

49+
private final static int CONVERT_NEGATIVE_IN_COMPARE = 10000;
50+
4651
@Override
4752
public void init() {
4853
super.init();
@@ -97,6 +102,7 @@ public void onStateChanged(StateChangeEvent event) {
97102

98103
if(getWidget().isInitialized() && event.hasPropertyChanged("childOptions")) {
99104
getWidget().batchUpdate();
105+
//for(Connector connector : getChildConnectorsInCoordinateOrder()) {
100106
for(Connector connector : getState().childOptions.keySet()) {
101107
Widget widget = ((ComponentConnector)connector).getWidget();
102108
getWidget().updateChild(widget, getState().childOptions.get(connector));
@@ -105,6 +111,55 @@ public void onStateChanged(StateChangeEvent event) {
105111
}
106112
}
107113

114+
/* Uncomment this if connectors have to updated in coordinate order
115+
private List<Connector> getChildConnectorsInCoordinateOrder() {
116+
List<Connector> list = new ArrayList<Connector>();
117+
for(Connector connector : getState().childOptions.keySet()) {
118+
list.add(connector);
119+
}
120+
121+
Collections.sort(list, childConnectorComparator);
122+
123+
return list;
124+
}
125+
126+
private transient final Comparator<Connector> childConnectorComparator = new Comparator<Connector>() {
127+
@Override
128+
public int compare(Connector a, Connector b) {
129+
GridStackChildOptions aOptions = getState().childOptions.get(a);
130+
GridStackChildOptions bOptions = getState().childOptions.get(b);
131+
132+
int aY = aOptions.y;
133+
if(aY < 0) {
134+
aY = CONVERT_NEGATIVE_IN_COMPARE;
135+
}
136+
137+
int bY = bOptions.y;
138+
if(bY < 0) {
139+
bY = CONVERT_NEGATIVE_IN_COMPARE;
140+
}
141+
142+
int comp = Integer.compare(aY, bY);
143+
if(comp == 0) {
144+
145+
int aX = aOptions.x;
146+
if(aX < 0) {
147+
aX = CONVERT_NEGATIVE_IN_COMPARE;
148+
}
149+
150+
int bX = bOptions.x;
151+
if(bX < 0) {
152+
bX = CONVERT_NEGATIVE_IN_COMPARE;
153+
}
154+
155+
comp = Integer.compare(aX, bX);
156+
}
157+
158+
return comp;
159+
}
160+
};
161+
*/
162+
108163
@Override
109164
public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
110165

gridstack-demo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>org.vaadin.alump.gridstack</groupId>
66
<artifactId>gridstack-demo</artifactId>
77
<packaging>war</packaging>
8-
<version>0.3.0</version>
8+
<version>0.3.1-SNAPSHOT</version>
99
<name>GridStack Add-on Demo</name>
1010

1111
<properties>

0 commit comments

Comments
 (0)