org.PingOO.DLAI.lib.PWidget
Class PObserver

java.lang.Object
  |
  +--org.PingOO.DLAI.lib.PWidget.PObserver

public class PObserver
extends java.lang.Object

An observer for Containers (PComponent and JComponents) that updates them when needed.
Since some components as the JWindow are not JComponents, the function apply to a large type (Container).

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)

Inner Class Summary
protected  class PObserver.DefaultPAdapter
          Default PAdapter for this PObserver.
 
Field Summary
 PListener defaultPListener
          Default PAdapter for this observer.
private static PEventListenerList listenerList
          The shared listener list.
protected static java.util.Vector observerVector
           
protected  java.awt.Container parent
          The parent component of this observer.
 
Constructor Summary
PObserver()
          Creates a new observer without component;
PObserver(java.awt.Container component)
          Creates a new observer for components in this widget.
 
Method Summary
 void addPListener(PListener listener)
          Adds a listener to the list.
 java.awt.Container getParent()
          Return the component linked with this observer.
static void removeAll()
          
Make sure there is no more PComponent left, for when they are unregistered, they will not be able to respond the PEvents anymore.
 void removePListener(PListener listener)
          Removes a listener from the list.
 void setParent(java.awt.Container component)
          Set the component linked with this observer.
 void unregister()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

observerVector

protected static java.util.Vector observerVector

parent

protected java.awt.Container parent
The parent component of this observer.

listenerList

private static PEventListenerList listenerList
The shared listener list.

defaultPListener

public final PListener defaultPListener
Default PAdapter for this observer.
Constructor Detail

PObserver

public PObserver()
Creates a new observer without component;

PObserver

public PObserver(java.awt.Container component)
Creates a new observer for components in this widget.
Parameters:
component - The component to be linked with this observer.
Method Detail

unregister

public void unregister()

getParent

public java.awt.Container getParent()
Return the component linked with this observer.
Returns:
The component linked with this observer, or null if this obeserver is not linked with any component.

setParent

public void setParent(java.awt.Container component)
Set the component linked with this observer.
Parameters:
component - the new component to link with this observer.

removeAll

public static void removeAll()

Make sure there is no more PComponent left, for when they are unregistered, they will not be able to respond the PEvents anymore.

addPListener

public void addPListener(PListener listener)
Adds a listener to the list.
Parameters:
listener - The listener to be added.

removePListener

public void removePListener(PListener listener)
Removes a listener from the list.
Parameters:
listener - The listener to be removed.