IBM DB2 UDB
Plugin Interface
for Extending the Control Center

com.ibm.db2.tools.cc.navigator
Class CCObjectCollectionEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bycom.ibm.db2.tools.cc.navigator.CCObjectCollectionEvent
All Implemented Interfaces:
java.io.Serializable

public class CCObjectCollectionEvent
extends java.util.EventObject

Instances of this class represent one of three types of events that may be triggered by a plugin: Add, Remove and Alter. In addition to the source Object that the EventObject's constructor takes, the CCObjectCollectionEvent takes two extra parameters: an event type and a second Object to serve as what the source is replaced with in the Alter scenario.

To use this class, make the CCObject implementation that represents a folder in the tree extend java.util.Observable. When you wish to add a child to the folder, call notifyObservers with an instance of this class as the argument.

This will notify the Control Center of the event since the Control Center automatically registers itself as an Observer of any CCTableObject that extends Observable. The Control Center will respond to the event by updating the tree and details view.

For example:

  public class Example3Folder extends Observable implements CCTreeObject {
  ...
    public void addChild(Example3Child child) {
       childVector.addElement(child);
       setChanged();
       notifyObservers(new CCObjectCollectionEvent(this,
                                                   CCObjectCollectionEvent.OBJECT_ADDED,
                                                   child));
     }
  ...
  }

See Also:
Observable, Serialized Form

Field Summary
static int OBJECT_ADDED
          An event in which an object was added to a folder in the Control Center tree.
static int OBJECT_ALTERED
          An event in which an object in the Control Center tree had one of its visible attributes changed and the Control Center needs to reflect this.
static int OBJECT_REMOVED
          An event in which an object was removed from a folder in the Control Center tree.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
CCObjectCollectionEvent(java.lang.Object source, int eventType, java.lang.Object arg)
          Constructs an event that represents a change in a collection of CCObjects, such as a folder in the Control Center tree.
 
Method Summary
 java.lang.Object getArg()
          This method returns the argument that was passed in when the event was constructed.
 int getEventType()
          This method returns what type of event this is: an OBJECT_ADDED, OBJECT_REMOVED or OBJECT_ALTERED event.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OBJECT_ADDED

public static final int OBJECT_ADDED
An event in which an object was added to a folder in the Control Center tree.

See Also:
Constant Field Values

OBJECT_REMOVED

public static final int OBJECT_REMOVED
An event in which an object was removed from a folder in the Control Center tree.

See Also:
Constant Field Values

OBJECT_ALTERED

public static final int OBJECT_ALTERED
An event in which an object in the Control Center tree had one of its visible attributes changed and the Control Center needs to reflect this.

See Also:
Constant Field Values
Constructor Detail

CCObjectCollectionEvent

public CCObjectCollectionEvent(java.lang.Object source,
                               int eventType,
                               java.lang.Object arg)
Constructs an event that represents a change in a collection of CCObjects, such as a folder in the Control Center tree. The Control Center observes all CCObjects that extend Observable and responds to CCObjectCollectionEvents by updating the tree and details view. There are three types of events: add, remove, and alter.

Parameters:
source - The source of the event, such as the folder for add and remove events
eventType - Whether the event is due to an object being added, removed or altered
arg - An argument that may be used to specify what object has been added, removed or altered
Method Detail

getArg

public java.lang.Object getArg()
This method returns the argument that was passed in when the event was constructed. It may be the object that was added, removed or altered.

Returns:
the argument used when constructing the event.

getEventType

public int getEventType()
This method returns what type of event this is: an OBJECT_ADDED, OBJECT_REMOVED or OBJECT_ALTERED event.

Returns:
the type of event

IBM DB2 UDB
Plugin Interface
for Extending the Control Center

(C)Copyright IBM Corp. 2002, 2004. All rights reserved.

Links on this page are made available for your convenience and may take you to non-IBM sites. IBM does not warrant any sample code provided on these sites.