/** This adds the mass and initial time parameters to the function panel. */ protected void createMassAndTimeParameters() { Parameter param = new Parameter("m", String.valueOf(getMass())); // $NON-NLS-1$ param.setNameEditable(false); param.setDescription( TrackerRes.getString("ParticleModel.Parameter.Mass.Description")); // $NON-NLS-1$ getParamEditor().addObject(param, false); param = new Parameter("t", "0"); // $NON-NLS-1$ //$NON-NLS-2$ param.setNameEditable(false); param.setDescription( TrackerRes.getString("ParticleModel.Parameter.InitialTime.Description")); // $NON-NLS-1$ functionPanel.getInitEditor().addObject(param, false); getParamEditor() .addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if ("m".equals(e.getOldValue())) { // $NON-NLS-1$ Parameter param = (Parameter) getParamEditor().getObject("m"); // $NON-NLS-1$ if (ParticleModel.super.getMass() != param.getValue()) { setMass(param.getValue()); } } } }); getInitEditor() .addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (refreshing) return; if ("t".equals(e.getOldValue()) && trackerPanel != null) { // $NON-NLS-1$ Parameter param = (Parameter) getInitEditor().getObject("t"); // $NON-NLS-1$ VideoClip clip = trackerPanel.getPlayer().getVideoClip(); double timeOffset = param.getValue() * 1000 - clip.getStartTime(); double dt = trackerPanel.getPlayer().getMeanStepDuration(); int n = clip.getStartFrameNumber(); boolean mustRound = timeOffset % dt > 0; n += clip.getStepSize() * (int) Math.round(timeOffset / dt); setStartFrame(n); if (getStartFrame() != n || mustRound) Toolkit.getDefaultToolkit().beep(); } } }); }
/** * Gets the initial value editor. * * @return the editor */ public InitialValueEditor getInitEditor() { return functionPanel.getInitEditor(); }
/** * Gets the initial values. * * @return initial values */ public double[] getInitialValues() { return functionPanel.getInitEditor().getValues(); }