Search in sources :

Example 1 with ConnectionHashKey

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));
    }
}
Also used : ConnectionHashKey(org.eclipse.sapphire.ui.diagram.layout.ConnectionHashKey) Point(org.eclipse.sapphire.ui.Point)

Example 2 with ConnectionHashKey

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;
}
Also used : ConnectionHashKey(org.eclipse.sapphire.ui.diagram.layout.ConnectionHashKey) Point(org.eclipse.sapphire.ui.Point) ConnectionBendpoint(com.liferay.ide.kaleo.core.model.ConnectionBendpoint) Point(org.eclipse.sapphire.ui.Point)

Aggregations

Point (org.eclipse.sapphire.ui.Point)2 ConnectionHashKey (org.eclipse.sapphire.ui.diagram.layout.ConnectionHashKey)2 ConnectionBendpoint (com.liferay.ide.kaleo.core.model.ConnectionBendpoint)1