
[ Previous ] [ Index ] [ Next ]


Note: this pattern is not yet ready.
)
from your hablet, its events
do not get shared because they are not in the same MirrorFrame
hierarchy. Because of this, you need to register
the window with the CollObject. [Not
yet written]
| Example |
| public class IDframe extends Frame implements Identifiable, WindowListener |
| Example |
In IDframe:
Collobject mirror;
public IDframe(String L, Collobject mirror)
{
super(L); /* Create a new Frame with the title L */
this.mirror = mirror;
mirror.registerIdentifiable(this);
}
Then, in startInFrame(), (or should this
be in init()?) on the main hablet class, you need to
call this method when creating
the IDframe:
idframe = IDframe("Extra Window",collobject);
(Is this correct? I didn't have sample code for
this part, so I was guessing.) |
| Example |
| This example uses the session's key and the mirror's key to
create a unique ID string, but you can use any other method that will gurantee
a unique ID string.
public String getUniqueId()
|
| Summary of the Example |
public class IDframe extends Frame implements Identifiable, WindowListener
{
Collobject mirror;
public IDframe(String L, Collobject mirror)
{
super(L);
this.mirror = mirror;
mirror.registerIdentifiable(this);
}
public String getUniqueId()
{
return (String) mirror.getSession().key() + "." + (String) mirror.key() + "UNIQUE NAME";
}
public void windowActivated(WindowEvent e)
{
}
public void windowClosed(WindowEvent e)
{
System.out.println("Unregistering Window");
mirror.unregisterIdentifiable(this);
}
public void windowClosing(WindowEvent e)
{
}
public void windowDeactivated(WindowEvent e)
{
}
public void windowDeiconified(WindowEvent e)
{
}
public void windowIconified(WindowEvent e)
{
}
public void windowOpened(WindowEvent e)
{
}
}
The empty methods are necessary to implement WinowListener -- they are
not part of the Identifiable interface.
|
Habanero® is a registered trademark owned by The Board of Trustees of the University of Illinois. Copyright 1996-1998. All rights reserved. Java(TM) is a proprietary trademark owned by Sun Microsystems, Inc.
![]()
The National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign
Contacts page