use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method onMoveComplete.
@Override
public boolean onMoveComplete() {
boolean completeResult = true;
final Collection<WiresShape> shapes = selectedShapes;
if (!shapes.isEmpty()) {
shapes.iterator().next().getWiresManager();
for (final WiresShape shape : shapes) {
if (!shape.getControl().onMoveComplete()) {
completeResult = false;
}
}
}
final Collection<WiresConnector> connectors = selectedConnectors;
if (!connectors.isEmpty()) {
// Update connectors and connections.
for (final WiresConnector connector : connectors) {
if (!connector.getWiresConnectorHandler().getControl().onMoveComplete()) {
completeResult = false;
}
}
}
delta = new Point2D(0, 0);
return completeResult;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method accept.
@Override
public boolean accept() {
final Collection<WiresShape> shapes = selectedShapes;
if (!shapes.isEmpty()) {
final WiresManager wiresManager = shapes.iterator().next().getWiresManager();
final Point2D[] shapeCandidateLocations = new Point2D[shapes.size()];
int i = 0;
for (final WiresShape shape : shapes) {
shapeCandidateLocations[i] = shape.getControl().getContainmentControl().getCandidateLocation();
i++;
}
final WiresShape[] shapesArray = toArray(shapes);
final WiresContainer parent = getSharedParent();
boolean completeResult = (null != parent) && wiresManager.getContainmentAcceptor().acceptContainment(parent, shapesArray);
if (completeResult) {
completeResult = wiresManager.getLocationAcceptor().accept(shapesArray, shapeCandidateLocations);
}
return completeResult;
}
return false;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method getSharedParent.
@Override
public WiresContainer getSharedParent() {
final Collection<WiresShape> shapes = selectedShapes;
if (shapes.isEmpty()) {
return null;
}
final WiresContainer shared = shapes.iterator().next().getControl().getParentPickerControl().getParent();
for (final WiresShape shape : shapes) {
final WiresContainer parent = shape.getControl().getParentPickerControl().getParent();
if (parent != shared) {
return null;
}
}
return shared;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresConnectionControlImpl method checkAllowAndShowMagnets.
private boolean checkAllowAndShowMagnets(final String colorKey) {
final WiresShape prim = null != colorKey ? m_shape_color_map.get(colorKey) : null;
m_colorKey = colorKey;
if (isConnectionAllowed(prim)) {
showMagnets(prim);
return true;
}
return false;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class ColorMapBackedPicker method addShapes.
protected void addShapes(final NFastArrayList<WiresShape> shapes) {
for (int j = 0; j < shapes.size(); j++) {
final WiresShape prim = shapes.get(j);
if (m_options.shapesToSkip.contains(prim)) {
continue;
}
final MultiPath multiPath = prim.getPath();
drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BODY), true);
addSupplementaryPaths(prim);
if (m_options.hotspotsEnabled) {
drawShape(m_colorKeyRotor.next(), m_options.hotspotWidth, new PickerPart(prim, PickerPart.ShapePart.BORDER_HOTSPOT), false);
// need to be able to detect the difference between the actual border selection and the border hotspot
drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BORDER), false);
}
if ((prim.getChildShapes() != null) && !prim.getChildShapes().isEmpty()) {
addShapes(prim.getChildShapes());
}
}
}
Aggregations