use of org.eclipse.sapphire.ui.diagram.layout.ConnectionHashKey in project liferay-ide by liferay.
the class WorkflowDefinitionLayoutPersistenceService method _addConnectionToPersistenceCache.
private void _addConnectionToPersistenceCache(DiagramConnectionPart connPart) {
ConnectionHashKey connKey = ConnectionHashKey.createKey(connPart);
_connectionBendPoints.put(connKey, connPart.getBendpoints());
if (connPart.getLabelPosition() != null) {
_connectionLabelPositions.put(connKey, new Point(connPart.getLabelPosition()));
} else {
_connectionLabelPositions.put(connKey, new Point(-1, -1));
}
}
use of org.eclipse.sapphire.ui.diagram.layout.ConnectionHashKey in project liferay-ide by liferay.
the class WorkflowDefinitionLayoutPersistenceService method _isConnectionLayoutChanged.
private boolean _isConnectionLayoutChanged(DiagramConnectionPart connPart) {
// Detect whether the connection bendpoints have been changed.
List<Point> bendpoints = connPart.getBendpoints();
Point labelPosition = connPart.getLabelPosition();
ConnectionHashKey key = ConnectionHashKey.createKey(connPart);
boolean changed = false;
if (_connectionBendPoints.containsKey(key)) {
List<Point> oldBendpoints = _connectionBendPoints.get(key);
if (bendpoints.size() != oldBendpoints.size()) {
changed = true;
} else {
for (int i = 0; i < bendpoints.size(); i++) {
Point newPt = bendpoints.get(i);
Point oldPt = oldBendpoints.get(i);
if ((newPt.getX() != oldPt.getX()) || (newPt.getY() != oldPt.getY())) {
changed = true;
break;
}
}
}
if (!bendpoints.equals(oldBendpoints)) {
changed = true;
}
} else {
changed = true;
}
if (!changed && _connectionLabelPositions.containsKey(key)) {
Point oldLabelPosition = _connectionLabelPositions.get(key);
if ((labelPosition != null) && !labelPosition.equals(oldLabelPosition)) {
changed = true;
}
} else {
changed = true;
}
return changed;
}
Aggregations