Class sunsoft.jws.visual.rt.base.Group
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sunsoft.jws.visual.rt.base.Group

java.lang.Object
   |
   +----sunsoft.jws.visual.rt.base.AttributeManager
           |
           +----sunsoft.jws.visual.rt.base.Group

public class Group
extends AttributeManager
The base class for every kind of group.

The attributes available for this class are listed below. In the type column, type names beginning with "sunsoft.jws.visual.rt" have been abbreviated to begin with "rt".

    name            type                      default value
    -----------------------------------------------------------------------
    visible         java.lang.Boolean         true
Check the super class for additional attributes.

Variable Index

 o FORWARD
This flag is set for forwarded attributes in a group.
 o FORWARD_REMOVE
This flag is set for forwarded attributes that will be removed during initialization if the group's container does not define the attribute.
 o RESTORE_CURSOR
This constant can be passed to the setCursor call.

Constructor Index

 o Group()
All the attributes used by this group must be defined in the constructor.

Method Index

 o addAttributeForward(AttributeManager)
Adds the attribute manager to the list of forwards.
 o addComponentAttributes()
Compatibility method - do not use!
 o addDialogAttributes()
Compatibility method - do not use!
 o addForwardedAttributes()
Adds a set of attributes to this group that are suitable for forwarding to a frame, dialog or panel.
 o addFrameAttributes()
Compatibility method - do not use!
 o addOperations(Operations)
Add an operations class.
 o addPanelAttributes()
Compatibility method - do not use!
 o create()
Create the group.
 o createGroup()
Called during group creation.
 o destroy()
Destroy the group.
 o destroyGroup()
Called during the destroy operation.
 o exit()
Exit the application with no error code.
 o exit(int)
Exit the application.
 o get(String)
Get the value of a named attribute.
 o getApplet()
Accessor method for the applet.
 o getBase()
Returns the base group.
 o getChild(String)
Looks up a named child group of this group.
 o getChildList()
Returns an enumerated list of this group's children.
 o getCmdLineArgs()
Accessor method for the command line arguments.
 o getFrame()
Returns the first frame found while traversing up the group tree.
 o getFullName()
Returns a hierarchy name based on the group tree.
 o getGroup()
Returns this group (overrides the behavior of getGroup as defined in AttributeManager).
 o getOnGroup(String)
May be overridden by sub-groups that store attribute values themselves, and do not depend on the group superclass to store them.
 o getParentGroup()
Returns this group's parent.
 o getRegistry()
Accessor method for the registry.
 o getTopLevel()
Accessor method for the top level frame.
 o getUserTypeName()
Returns a type name for this group to be used by visual java.
 o handleEvent(Message, Event)
May be overridden by subclasses that want to get notified when AWT events that are sent by the gui components.
 o handleMessage(Message)
May be overridden by subclasses that want to act on messages that are sent to the group.
 o hasBase()
Returns true if this group is either the base group or is a descendant of the base group.
 o hasStarted()
Returns true if the base group has been started.
 o hide()
Hides the group by setting the visible attribute to false.
 o hideGroup()
May be overridden by group subclasses that want to know when the group becomes non-visible.
 o initGroup()
Called during initialization.
 o initialize()
Initialize the group.
 o initRoot()
initRoot must be overridden in group subclasses to initialize the shadow tree.
 o isBase()
Returns true if this group is the base group.
 o isBaseWindow(Window)
Returns true if the given window this group's base window.
 o isInitialized()
Returns true if the group is currently initialized.
 o isShowing()
Returns true if the group is currently showing.
 o isStarted()
Returns true if the group is currently started.
 o isVisible()
Returns true if the visible attributes of the group and all of its parents are all set to true.
 o layoutMode()
Called when Visual Java switches to layout mode.
 o postMessage(Message)
Posts a message to this group.
 o postMessageToParent(Message)
Posts a message to this group's parent.
 o preValidate()
Called after addNotify and before the window is reshaped.
 o previewMode()
Called when Visual Java switches to preview mode.
 o removeOperations(Operations)
Remove an operations class.
 o resolveFullName(String)
Find a component from its full path name.
 o resolveGroup(String)
Recursively looks for a named sub-group of this group.
 o set(String, Object)
Set the value of a named attribute.
 o setCursor(int)
Sets the cursor for all of the group's frames to the given cursor value.
 o setEnvironmentInfo(Applet, String[])
Sets the environment information for the group.
 o setOnGroup(String, Object)
May be overridden by sub-groups that want notification when attributes are changed.
 o setTopLevel(Frame)
Sets the top level frame for the group.
 o show()
Shows the group by setting the visible attribute to true.
 o show(boolean)
Calls show or hide, depending on the value of cond.
 o showGroup()
May be overridden by group subclasses that want to know when the group becomes visible.
 o start()
This method should not be overridden by group subclasses.
 o startGroup()
May be overridden by group subclasses that want to be informed when the application is starting.
 o stop()
This method should not be overridden by group subclasses.
 o stopGroup()
May be overridden by group subclasses that want to be informed when the application is stopping.
 o windowDestroy(Message)
Called when a WINDOW_DESTROY event is received by this group.

Variables

 o FORWARD
  public final static int FORWARD
This flag is set for forwarded attributes in a group.
 o FORWARD_REMOVE
  public final static int FORWARD_REMOVE
This flag is set for forwarded attributes that will be removed during initialization if the group's container does not define the attribute.
 o RESTORE_CURSOR
  public final static int RESTORE_CURSOR
This constant can be passed to the setCursor call. It indicates that the cursor should be restored to its previous value.

Constructors

 o Group
  public Group()
All the attributes used by this group must be defined in the constructor. setOnGroup is called at initialization for all the attributes. If the attribute has not been set prior to initialization, setOnGroup is called with the default value.

Methods

 o initialize
  public void initialize()
Initialize the group. The shadow tree for the group is created during initialization.
Overrides:
initialize in class AttributeManager
 o isInitialized
  public boolean isInitialized()
Returns true if the group is currently initialized.
 o initRoot
  protected abstract Root initRoot()
initRoot must be overridden in group subclasses to initialize the shadow tree. The return value must be the root of the newly initialized shadow tree.
 o initGroup
  protected void initGroup()
Called during initialization. It is called just after initRoot is called, but before the sub-groups are initialized and before the attributes are sent to the setOnGroup method. initGroup is only called once in the lifetime of the Group. This is because groups cannot be uninitialized. Anything that needs to be cleaned up should be created in createGroup instead of initGroup, and then can be cleaned up in destroyGroup. createGroup and destroyGroup may be called multiple times during the lifetime of a group.
 o getUserTypeName
  protected String getUserTypeName()
Returns a type name for this group to be used by visual java. May be overridden in sub-classes to give more useful names.
Overrides:
getUserTypeName in class AttributeManager
 o show
  public void show(boolean cond)
Calls show or hide, depending on the value of cond.
 o show
  public void show()
Shows the group by setting the visible attribute to true.
 o hide
  public void hide()
Hides the group by setting the visible attribute to false.
 o isVisible
  public boolean isVisible()
Returns true if the visible attributes of the group and all of its parents are all set to true.
 o isShowing
  public boolean isShowing()
Returns true if the group is currently showing.
 o showGroup
  protected void showGroup()
May be overridden by group subclasses that want to know when the group becomes visible. It is called just before the group becomes visible. The group will already be initialized and created at this point.
 o hideGroup
  protected void hideGroup()
May be overridden by group subclasses that want to know when the group becomes non-visible. It is called just before the group becomes non-visible.
 o create
  public void create()
Create the group. Creating the group causes all the AWT components to be created. Also, the createGroup method is called during group creation.
Overrides:
create in class AttributeManager
 o createGroup
  protected void createGroup()
Called during group creation. Groups can be created and destroyed multiple times during their lifetime. Anything that is created in createGroup should be cleaned up in destroyGroup. createGroup is called just after the group has been created. Anything that needs to be done before the group is created should be done in initGroup.
 o destroy
  public void destroy()
Destroy the group. This will destroy all AWT components, but does not destroy the shadow tree or the group tree. The group can be created again after a destroy by calling the "create" method.
Overrides:
destroy in class AttributeManager
 o destroyGroup
  protected void destroyGroup()
Called during the destroy operation. Groups can be created and destroyed multiple times during their lifetime. Anything that has been created in createGroup should be cleaned up in destroyGroup. destroyGroup is called just before the group is destroyed.
 o start
  public void start()
This method should not be overridden by group subclasses. The "startGroup" method should be overridden instead.
 o startGroup
  protected void startGroup()
May be overridden by group subclasses that want to be informed when the application is starting. This method is only called after the entire application has been initialized and created. For applets, startGroup is called whenever start is called on the applet.
 o isStarted
  public boolean isStarted()
Returns true if the group is currently started.
 o stop
  public void stop()
This method should not be overridden by group subclasses. The "stopGroup" method should be overridden instead.
 o stopGroup
  protected void stopGroup()
May be overridden by group subclasses that want to be informed when the application is stopping. This method will be called before a destroy is done. For applets, stopGroup is called whenever stop is called on the applet.
 o hasStarted
  protected boolean hasStarted()
Returns true if the base group has been started.
 o getChild
  public Group getChild(String name)
Looks up a named child group of this group. Not recursive.
 o getChildList
  public Enumeration getChildList()
Returns an enumerated list of this group's children. The list is cloned because the caller might use it for removing child groups from this group.
 o getParentGroup
  public Group getParentGroup()
Returns this group's parent.
 o getGroup
  public Group getGroup()
Returns this group (overrides the behavior of getGroup as defined in AttributeManager).
Overrides:
getGroup in class AttributeManager
 o getFullName
  public String getFullName()
Returns a hierarchy name based on the group tree.
Overrides:
getFullName in class AttributeManager
 o resolveFullName
  public AttributeManager resolveFullName(String name)
Find a component from its full path name.
Overrides:
resolveFullName in class AttributeManager
 o resolveGroup
  public Group resolveGroup(String name)
Recursively looks for a named sub-group of this group.
 o addOperations
  public synchronized void addOperations(Operations ops)
Add an operations class.
 o removeOperations
  public synchronized void removeOperations(Operations ops)
Remove an operations class.
 o postMessageToParent
  public void postMessageToParent(Message msg)
Posts a message to this group's parent. This method should be used when sending a message from within this group.
Overrides:
postMessageToParent in class AttributeManager
 o postMessage
  public void postMessage(Message msg)
Posts a message to this group. This method should be used when sending a message to this group.
Overrides:
postMessage in class AttributeManager
 o handleMessage
  public boolean handleMessage(Message msg)
May be overridden by subclasses that want to act on messages that are sent to the group. Typically, messages are either AWT events that have been translated to messages, or they are messages that have been sent by other groups. super.handleMessage should be called for any messages that aren't handled. If super.handleMessage is not called, then handleEvent will not be called.

The default implementation of handleMessage returns "true". This means that no events will be passed up the group tree, unless a subclass overrides this method to return "false". AWT events are not propagated regardless of the return value from handleEvent.

If you want a message to go to the parent group, override handleMessage to return false for that message.

If you want an AWT event to go to the parent group, you need to call postMessageToParent() with the event message.

Overrides:
handleMessage in class AttributeManager
 o handleEvent
  public boolean handleEvent(Message msg,
                             Event evt)
May be overridden by subclasses that want to get notified when AWT events that are sent by the gui components. The return value should be true for handled events, and super.handleEvent should be called for unhandled events. If super.handleEvent is not called, then the specific event handling methods will not be called.

The message's target is set to the shadow that sent the event. The event's target is set to the AWT component that sent the event.

The following more specific methods may also be overridden:

public boolean mouseDown(Message msg, Event evt, int x, int y);
public boolean mouseDrag(Message msg, Event evt, int x, int y);
public boolean mouseUp(Message msg, Event evt, int x, int y);
public boolean mouseMove(Message msg, Event evt, int x, int y);
public boolean mouseEnter(Message msg, Event evt, int x, int y);
public boolean mouseExit(Message msg, Event evt, int x, int y);
public boolean keyDown(Message msg, Event evt, int key);
public boolean keyUp(Message msg, Event evt, int key);
public boolean action(Message msg, Event evt, Object what);
public boolean gotFocus(Message msg, Event evt, Object what);
public boolean lostFocus(Message msg, Event evt, Object what);
Overrides:
handleEvent in class AttributeManager
 o exit
  public void exit()
Exit the application with no error code.
 o exit
  public void exit(int errCode)
Exit the application. Calls exit on the parent if there is a parent. Only calls System.exit() if there is no applet.
 o windowDestroy
  protected void windowDestroy(Message msg)
Called when a WINDOW_DESTROY event is received by this group. The default behavior for WINDOW_DESTROY events is to set the visible attribute to false for the target of the event. If the target of the event is the main window, then set this group's visible attribute to false. If this group is the base group, then exit the application.
 o addAttributeForward
  protected void addAttributeForward(AttributeManager mgr)
Adds the attribute manager to the list of forwards. When an attribute is set and is flagged FORWARD, the value for the attribute will be forwarded to every matching attribute manager in the list of forwards.
 o addForwardedAttributes
  protected void addForwardedAttributes()
Adds a set of attributes to this group that are suitable for forwarding to a frame, dialog or panel.
 o addComponentAttributes
  protected void addComponentAttributes()
Compatibility method - do not use!
 o addPanelAttributes
  protected void addPanelAttributes()
Compatibility method - do not use!
 o addFrameAttributes
  protected void addFrameAttributes()
Compatibility method - do not use!
 o addDialogAttributes
  protected void addDialogAttributes()
Compatibility method - do not use!
 o get
  public Object get(String key)
Get the value of a named attribute.
Overrides:
get in class AttributeManager
 o getOnGroup
  protected Object getOnGroup(String key)
May be overridden by sub-groups that store attribute values themselves, and do not depend on the group superclass to store them. This method should be overridden instead of "get". Any attributes handled in setOnGroup where super.setOnGroup is not called must also be handled in getOnGroup.

The default implementation of getOnGroup retrieves the value from the attribute table.

The reason that "getOnGroup" should be overridden instead of "get" is that "getOnGroup" is guaranteed not to be called until the group class is initialized. This means that initRoot will always be called before any calls to getOnGroup are made.

Also, this method is only for attributes that are defined in the sub-groups. It is not called for forwarded attributes.

 o set
  public void set(String key,
                  Object value)
Set the value of a named attribute.
Overrides:
set in class AttributeManager
 o setOnGroup
  protected void setOnGroup(String key,
                            Object value)
May be overridden by sub-groups that want notification when attributes are changed. This method should be overridden instead of "set". Any attributes handled in setOnGroup where super.setOnGroup is not called must also be handled in getOnGroup.

The default implementation of setOnGroup puts the value in the attribute table.

The reason that "setOnGroup" should be overridden instead of "set" is that "setOnGroup" is guaranteed not to be called until the group class is initialized. This means that initRoot will always be called before any calls to setOnGroup are made.

During initialization, "setOnGroup" will be called for all the group's attributes even if they have not be changed from the default value. But for attributes that have the DEFAULT flag set, "setOnGroup" will only be called if the value of the attribute has changed from the default.

Also, this method is only called when attributes defined in the sub-groups are updated. It is not called for forwarded attributes.

 o isBase
  public boolean isBase()
Returns true if this group is the base group.
 o isBaseWindow
  protected boolean isBaseWindow(Window win)
Returns true if the given window this group's base window.
 o hasBase
  public boolean hasBase()
Returns true if this group is either the base group or is a descendant of the base group.
 o getBase
  public Group getBase()
Returns the base group.
 o setEnvironmentInfo
  public void setEnvironmentInfo(Applet applet,
                                 String args[])
Sets the environment information for the group. This method should be invoked only on the top-most group in the application. Invoking setEnvironmentInfo and setTopLevel on a group makes it the base group.
 o setTopLevel
  public void setTopLevel(Frame topLevel)
Sets the top level frame for the group. This method should be invoked only on the top most group in the application. Invoking setEnvironmentInfo and setTopLevel on a group makes it the base group.
 o setCursor
  public void setCursor(int cursor)
Sets the cursor for all of the group's frames to the given cursor value. Calls setCursor on all the child groups.
 o getApplet
  public Applet getApplet()
Accessor method for the applet. Null is returned when you're not running as an applet.
 o getCmdLineArgs
  public String[] getCmdLineArgs()
Accessor method for the command line arguments. Null is returned when you're not running from the command line.
 o getFrame
  public Frame getFrame()
Returns the first frame found while traversing up the group tree. If no frame is found, then the top level frame is returned.
 o getTopLevel
  public Frame getTopLevel()
Accessor method for the top level frame. This will not return null providing that the base group has been initialized properly.
 o getRegistry
  public Registry getRegistry()
Accessor method for the registry. The registry is created when the application starts.
 o layoutMode
  public void layoutMode()
Called when Visual Java switches to layout mode.
Overrides:
layoutMode in class AttributeManager
 o previewMode
  public void previewMode()
Called when Visual Java switches to preview mode.
Overrides:
previewMode in class AttributeManager
 o preValidate
  public void preValidate()
Called after addNotify and before the window is reshaped.
Overrides:
preValidate in class AttributeManager

All Packages  Class Hierarchy  This Package  Previous  Next  Index