private void setDocument(final URL document, boolean load) throws IOException { final Cursor cu = switchCursor(waitc); try { log.info(document); final URL old = this.document; this.firePropertyChange("document", old, this.document = document); setFile(this.document); url.setText(this.document == null ? "{null}" : this.document.toString()); if (!load) return; cm.deregister(tactics.getCurves()); final ComputedTrajectorySet cts; if (this.document == null) cts = null; else { final IONode n = new JCurlSerializer().read(this.document); final IOTrajectories it = (IOTrajectories) n; final TrajectorySet ts = it.trajectories().get(0); cts = (ComputedTrajectorySet) ts; } change.discardAllEdits(); if (cts != null) cts.setCurrentTime(currentTime); tactics.setCurves(cts); broomSwing.setBroom(tactics.getBroom()); cm.register(cts); setModified(false); } finally { switchCursor(cu); } }
private final void save(final TrajectorySet cts, final File dst) throws IOException { final Cursor cu = switchCursor(waitc); try { final IOTrajectories t = new IOTrajectories(); // TODO add annotations t.trajectories().add(cts); new JCurlSerializer().write(t, dst, JDKSerializer.class); } finally { switchCursor(cu); } }