}
}
as.translate(x,y);
ShapesContainer.this.add(as);
compoundEdit.addEdit(new CreateEdit(ShapesContainer.this,as));
}
}
// Now Copy the connectors
for (int i = 0; i < selectedConnectors.size(); i++) {
Connection connection = (Connection) selectedConnectors.get(i);
if (connection instanceof AbstractShape){
Gate fisrtGate = (Gate) connection.getFirstEndGate();
Gate lastGate = (Gate) connection.getLastEndGate();
Gate newFg = null;
Gate newLg = null;
if ((fisrtGate!=null) && selectedGatedComponent.contains(fisrtGate.getOwner())){
newFg = (Gate) clonedGates.get(fisrtGate);
}
if ((lastGate!=null) && selectedGatedComponent.contains(lastGate.getOwner())){
newLg = (Gate) clonedGates.get(lastGate);
}
AbstractShape newConnector = ((AbstractShape)connection).cloneShape();
newConnector.translate(x,y);
if (newFg != null){
((Connection)newConnector).connect(newFg, true);
compoundEdit.addEdit(new GateConnectEdit( (Connection)newConnector, newFg, true));
}
if (newLg != null){
((Connection)newConnector).connect(newLg, false);
compoundEdit.addEdit(new GateConnectEdit( (Connection)newConnector, newLg, false));
}
// Add it ton container
ShapesContainer.this.add(newConnector);
compoundEdit.addEdit(new CreateEdit(ShapesContainer.this,newConnector));
}
}
compoundEdit.end();
fireUndoableEditUpdate(new UndoableEditEvent(this, compoundEdit));