コード例 #1
0
ファイル: ParticleModel.java プロジェクト: proan/tracker
 /** 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);
   }
 }
コード例 #2
0
ファイル: ParticleModel.java プロジェクト: proan/tracker
 /** 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);
   }
 }
コード例 #3
0
ファイル: ParticleModel.java プロジェクト: proan/tracker
 /**
  * Gets the particle inspector.
  *
  * @return the inspector
  */
 public FunctionTool getInspector() {
   if (trackerPanel == null) return null;
   if (inspector == null) {
     inspector = trackerPanel.getModelBuilder();
     inspector.addPanel(getName(), functionPanel);
     inspector.addPropertyChangeListener(this);
     if (trackerPanel.getTFrame() != null) {
       trackerPanel.getTFrame().addPropertyChangeListener("tab", this); // $NON-NLS-1$
     }
     if (getInitEditor().getValues()[0] == 0) {
       refreshInitialTime();
       getInitEditor().getTable().clearSelection();
     }
   }
   return inspector;
 }
コード例 #4
0
ファイル: ParticleModel.java プロジェクト: proan/tracker
 /**
  * Sets the name. Overrides TTrack method.
  *
  * @param name the name
  */
 public void setName(String name) {
   String prevName = getName();
   super.setName(name);
   if (inspector != null) {
     inspector.renamePanel(prevName, name);
   }
 }
コード例 #5
0
ファイル: ParticleModel.java プロジェクト: proan/tracker
 private void positionInspector() {
   if (inspectorX != Integer.MIN_VALUE) {
     // trackerPanel will select this track when getInspector() is called
     // only if loader has set the showInspector flag (so refreshing is false)
     refreshing = !showInspector;
     loading = true; // prevents setting trackerPanel changed flag
     getInspector();
     refreshing = loading = false;
     TFrame frame = trackerPanel.getTFrame();
     Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
     if (inspectorH != Integer.MIN_VALUE)
       inspector.setSize(inspector.getWidth(), Math.min(inspectorH, dim.height));
     int x = Math.max(frame.getLocation().x + inspectorX, 0);
     x = Math.min(x, dim.width - inspector.getWidth());
     int y = Math.max(frame.getLocation().y + inspectorY, 0);
     y = Math.min(y, dim.height - inspector.getHeight());
     inspector.setLocation(x, y);
     inspectorX = Integer.MIN_VALUE;
   }
 }
コード例 #6
0
ファイル: ParticleModel.java プロジェクト: proan/tracker
  /**
   * 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();
      }
    }
  }