FileDocCategorySizeDatePackage
PersistentSetPanel.javaAPI DocExample1333Sat Feb 01 06:05:04 GMT 1997imaginary.gui

PersistentSetPanel.java

/**
 * A panel that holds zero or more PersistentPanel objects and
 * responds to changes in PersistentSet objects.
 */
package imaginary.gui;

import imaginary.persist.RemoteLockHolder;
import imaginary.persist.RemotePersistent;
import imaginary.persist.RemotePersistentSet;
import imaginary.util.RemoteObservable;
import imaginary.util.RemoteObserver;
import java.awt.Panel;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public abstract class PersistentSetPanel extends Panel
implements ChangeObserver, RemoteObserver {
    private RemoteLockHolder    lock_holder = null;
    private RemotePersistentSet observed    = null;

    public PersistentSetPanel(RemoteLockHolder h)
    throws RemoteException {
	super();
	UnicastRemoteObject.exportObject(this);
	observed = null;
    }

    public PersistentSetPanel(RemoteLockHolder h, RemotePersistentSet p)
    throws RemoteException {
	super();
	UnicastRemoteObject.exportObject(this);
	observed = p;
	lock_holder = h;
	p.addObserver(this);
    }

    protected RemoteLockHolder getLockHolder() {
	return lock_holder;
    }
    
    public RemotePersistentSet getObserved() {
	return observed;
    }

    public void update(RemoteObservable target, Object arg) {
	ChangeMonitor.postChange(this);
    }
}