View Javadoc
1 /* 2 * Created on Nov 3, 2003 3 * 4 * To change the template for this generated file go to 5 * Window>Preferences>Java>Code Generation>Code and Comments 6 */ 7 package portaview; 8 9 import java.util.Observable; 10 import java.util.Observer; 11 12 import portaview.model.PortaViewModel; 13 14 /*** 15 * Controller to update the remote PortaView when user assigns an album to it. 16 * This controller is associated with each remote PortaView registered in the master PortaView. 17 * @author William Lee 18 */ 19 public class RemoteUpdateController implements Observer 20 { 21 private PortaViewModel model = null; 22 23 /*** 24 * Constructs the controller with a given PortaViewModel that it observes. 25 * @param pvm model to observe. 26 */ 27 public RemoteUpdateController(PortaViewModel pvm) 28 { 29 model = pvm; 30 pvm.addObserver(this); 31 } 32 33 /*** 34 * Update the remote PortaView when the update happens in the PortaViewModel. Note 35 * that if this is the current PortaView, we do nothing, since the model is already 36 * updated and we do not have to do this again. 37 * @see java.util.Observer#update(java.util.Observable, java.lang.Object) 38 */ 39 public void update(Observable o, Object arg) 40 { 41 if (!(o instanceof PortaViewModel)) 42 return; 43 PortaViewModel pvm = (PortaViewModel) o; 44 if (pvm.equals(Registry.getMainApplication().getThisPortaViewModel())) 45 { 46 // If the name equals the current portaview do nothing 47 return; 48 } 49 else 50 { 51 Registry.getClient().updateRemotePortaView(pvm); 52 } 53 54 } 55 56 /*** 57 * @return 58 */ 59 public PortaViewModel getModel() 60 { 61 return model; 62 } 63 64 /*** 65 * @param model 66 */ 67 public void setModel(PortaViewModel model) 68 { 69 this.model = model; 70 } 71 72 }

This page was automatically generated by Maven