View Javadoc

1   /*
2    * Created on Apr 26, 2005, Copyright UC Regents
3    */
4   package org.telscenter.pas.navigation;
5   
6   import java.beans.PropertyChangeEvent;
7   import java.beans.PropertyChangeListener;
8   
9   import javax.swing.JPanel;
10  
11  import org.telscenter.pas.beans.PasActivity;
12  import org.telscenter.pas.service.PasProjectServiceProvider;
13  
14  
15  public abstract class PasProjectNavigationPanel extends JPanel implements
16  		PropertyChangeListener {
17  
18  	protected PasActivity[] activities = new PasActivity[0];
19  
20  	protected String projectTitle = "PROJECT TITLE"; //$NON-NLS-1$
21  
22  	protected PasProjectServiceProvider pasProjectServiceProvider;
23  	
24  	public void propertyChange(PropertyChangeEvent evt) {
25  		if (evt.getPropertyName() == "activities") { //$NON-NLS-1$
26  			activities = (PasActivity[]) evt.getNewValue();
27  			addActivityListeners();
28  		} else if (evt.getPropertyName() == "title") { //$NON-NLS-1$
29  			projectTitle = (String) evt.getNewValue();
30  		} else if (evt.getPropertyName() == "steps") { //$NON-NLS-1$
31  			// also updateDisplay()
32  			updateDisplay();
33  		} else {
34  			return;
35  		}
36  		updateDisplay();
37  	}
38  
39  	/***
40  	 * @param activities2
41  	 */
42  	private void addActivityListeners() {
43  		for (int i = 0; i < activities.length; i++) {
44  			activities[i].addPropertyChangeListener("steps", this); //$NON-NLS-1$
45  		}
46  	}
47  
48  	abstract public void updateDisplay();
49  	
50  	abstract public void showFirstStep();
51  	
52  
53  }