/** {@inheritDoc} */ @Override public synchronized void setFrom(PathCellState state) { if (state != null) { closedPath = state.isClosedPath(); editMode = state.isEditMode(); replacePathStyle(state); replaceNodes(state); parent.updatePathUI(); } }
/** * Replace the nodes in this ClientNodePath using the specified PathCellState. * * @param state The PathCellState to use to set the PathNodes in this ClientNodePath. This value * must not be null. */ private void replaceNodes(PathCellState state) { synchronized (pathNodes) { pathNodes.clear(); final int noOfNodes = state.noOfNodeStates(); PathNodeState currentNodeState = null; for (int nodeIndex = 0; nodeIndex < noOfNodes; nodeIndex++) { currentNodeState = state.getPathNodeState(nodeIndex); pathNodes.add( new IndexedPathNode( this, currentNodeState.getPosition(), currentNodeState.getName(), nodeIndex)); } } }
/** * Replace the PathStyle of this ClientNodePath using the specified PathCellState. * * @param state The PathCellState to be used to set the PathStyle. */ private void replacePathStyle(PathCellState state) { pathStyle = state.getPathStyle(); }