/** Removes this particle from all panels that draw it. Overrides TTrack method. */ public void delete() { FunctionTool modelBuilder = null; if (trackerPanel != null && trackerPanel.modelBuilder != null) { ArrayList<ParticleModel> list = trackerPanel.getDrawables(ParticleModel.class); if (list.size() == 1) modelBuilder = trackerPanel.modelBuilder; } super.delete(); if (modelBuilder != null) { modelBuilder.setVisible(false); } }
/** Cleans up associated resources when this track is deleted or cleared. */ protected void cleanup() { super.cleanup(); if (inspector != null) { trackerPanel.removePropertyChangeListener("data", this); // $NON-NLS-1$ inspector.removePanel(getName()); inspector.removePropertyChangeListener(this); if (trackerPanel.getTFrame() != null) { trackerPanel.getTFrame().removePropertyChangeListener("tab", this); // $NON-NLS-1$ } if (inspector.isEmpty()) inspector.setVisible(false); } }
/** * Responds to property change events. * * @param e the property change event */ public void propertyChange(PropertyChangeEvent e) { super.propertyChange(e); if (trackerPanel == null) return; String name = e.getPropertyName(); // System.out.println(name); if (name.equals("function") && !loading) { // $NON-NLS-1$ trackerPanel.changed = true; } else if (name.equals("tab") && inspector != null) { // $NON-NLS-1$ if (trackerPanel != null && e.getNewValue() == trackerPanel && trackerPanel.isModelBuilderVisible) { inspector.setVisible(true); } else if (inspector.isVisible()) { inspector.setVisible(false); trackerPanel.isModelBuilderVisible = true; } } else if (name.equals("selectedtrack") // $NON-NLS-1$ && e.getNewValue() == this && inspector != null && !inspector.getSelectedName().equals(getName())) { inspector.setSelectedPanel(getName()); } if (name.equals("function") // $NON-NLS-1$ || name.equals("starttime") // $NON-NLS-1$ || name.equals("frameduration") // $NON-NLS-1$ || name.equals("startframe") // $NON-NLS-1$ || name.equals("stepsize")) { // $NON-NLS-1$ lastValidFrame = -1; } if (name.equals("transform")) { // $NON-NLS-1$ // workaround to prevent infinite loop ImageCoordSystem coords = trackerPanel.getCoords(); if (!(coords instanceof ReferenceFrame && ((ReferenceFrame) coords).getOriginTrack() == this)) { lastValidFrame = -1; } } if (!refreshing && isModelsVisible()) { if (name.equals("function")) { // $NON-NLS-1$ repaint(); } else if (name.equals("adjusting")) { // $NON-NLS-1$ refreshStepsLater = (Boolean) e.getNewValue(); if (!refreshStepsLater) { // stopped adjusting, so refresh steps refreshSteps(); } } if (name.equals("transform")) { // $NON-NLS-1$ // workaround to prevent infinite loop ImageCoordSystem coords = trackerPanel.getCoords(); if (!(coords instanceof ReferenceFrame && ((ReferenceFrame) coords).getOriginTrack() == this)) { refreshSteps(); } } else if (name.equals("starttime") // $NON-NLS-1$ || name.equals("frameduration") // $NON-NLS-1$ || name.equals("startframe")) { // $NON-NLS-1$ refreshInitialTime(); refreshSteps(); } else if (name.equals("stepsize")) { // $NON-NLS-1$ refreshSteps(); } } }