private void saveNetworkElementChangement() { simulationBox.endEdition(); if (simulationBox.isElementModified()) { if (simulationBox.isAnimationModified()) { } else { SimulationElement modifiedElement = simulationBox.getModifiedElement(); if (isTransit(modifiedElement)) { Transit modifiedTransit = (Transit) modifiedElement; currentTransit.modifyTransit(modifiedTransit.getIdentifier(), modifiedTransit); } else { currentNetwork.modifyNetworkElement(modifiedElement.getIdentifier(), modifiedElement); if (simulationBox.isThereASecondSegment()) { Segment secondSegment = simulationBox.getModifiedSecondWay(); currentNetwork.modifyNetworkElement(secondSegment.getIdentifier(), secondSegment); } } updateNetworkData(); simulationBox.refreshElementsAfterModification(); } } }
private boolean isTransit(SimulationElement modifiedElement) { return modifiedElement.getClass().getSimpleName().equals(TransportNeed.class.getSimpleName()) || modifiedElement.getClass().getSimpleName().equals(Circuit.class.getSimpleName()); }