|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mortbay.component.Container
public class Container
Container. Static utility for generating containment events from setter methods. The style of usage is:
public void setFoo(Foo foo) { Container.update(this,this.foo,foo,"foo"); this.foo=foo; } public void setBars(Bar[] bars) { Container.update(this,this.bars,bars,"bar"); this.bars=bars; }
Nested Class Summary | |
---|---|
static class |
Container.Event
A Container event. |
static interface |
Container.Listener
Listener. |
Field Summary | |
---|---|
private Object |
_listeners
|
Constructor Summary | |
---|---|
Container()
|
Method Summary | |
---|---|
private void |
add(Object parent,
Object child,
String relationship)
Add a parent child relationship |
void |
addEventListener(Container.Listener listener)
|
private void |
remove(Object parent,
Object child,
String relationship)
remove a parent child relationship |
void |
removeEventListener(Container.Listener listener)
|
void |
update(Object parent,
Object[] oldChildren,
Object[] children,
String relationship)
Update multiple parent to child relationship. |
void |
update(Object parent,
Object oldChild,
Object child,
String relationship)
Update single parent to child relationship. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Object _listeners
Constructor Detail |
---|
public Container()
Method Detail |
---|
public void addEventListener(Container.Listener listener)
public void removeEventListener(Container.Listener listener)
public void update(Object parent, Object oldChild, Object child, String relationship)
parent
- The parent of the child.oldChild
- The previous value of the child. If this is non null and differs from child
, then a remove event is generated.child
- The current child. If this is non null and differs from oldChild
, then an add event is generated.relationship
- The name of the relationshippublic void update(Object parent, Object[] oldChildren, Object[] children, String relationship)
parent
- The parent of the child.oldChildren
- The previous array of children. A remove event is generated for any child in this array but not in the children
array.
This array is modified and children that remain in the new children array are nulled out of the old children array.children
- The current array of children. An add event is generated for any child in this array but not in the oldChildren
array.relationship
- The name of the relationshipprivate void add(Object parent, Object child, String relationship)
parent
- child
- relationship
- private void remove(Object parent, Object child, String relationship)
parent
- child
- relationship
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |