Package com.dassault_systemes.catjdialog

   
Class CATDocumentManager

 
Class Hierarchy
java.lang.Object
  |
  +-com.dassault_systemes.catjdialog.CATCallbackSource
        |
        +-com.dassault_systemes.catjdialog.CATDialog
              |
              +-com.dassault_systemes.catjdialog.CATDocumentManager
Class Location

Framework : CATJDialog

Module : CATJDialog

Class Description

public class CATDocumentManager

The document manager graphical component.

Description:

This is the root container component, managed by the framework, and that is in charge of:

Introducing Commands:

A JDialog command is the standalone unitary application page or panel.
It is defined by a XMLDlg file in the runtime view, and a controller object (that is an object that responds to user interactions and reacts in the specified way).
See the CAA Use Case "Creating a Command" for details.

Commands Life Cycle:

At any time, the root document manager manages a stack of commands.
In the general case, the document manager only displays the last command in the stack (there is no other way for the user to view/access another command from the stack than the last one).

From an application, it is possible to:

Example: Here is a piece of code that plays with the document manager life cycle methods:
 [...]
 CATDialog aComponent...
 boolean activate...
 boolean stack...
 boolean unstack...
 // --- retrieve the document manager
 CATDocumentManager docMgr = CATDocumentManager.getDocumentManager(aComponent);
 if(activate)
 {
     // --- activate 'MyCommand' with document '/the/brown/fox/jumps'
     docMgr.activate("MyCommand", "/the/brown/fox/jumps");
 }
 else if(stack)
 {
     // --- stack 'MyModalCommand' with no document
     docMgr.stack("MyModalCommand", null);
 }
 else if(unstack)
 {
     // --- unstack the current command (most probably me!)
     docMgr.unstack();
 }
 

Commands Document:

When instantiating a command, it is given a document. This is a string argument that can serve any purpose for initializing the command context.
The application can be notified whenever the command document changes thoughout its life cycle.

Example: Here is an example of a command controller that retreives its document on creation, and registers to 'document changed' notifications from the document manager:

 [...]
 public class MyCommandControler
 {
     // --- the callback method associated to the 'Create' notification from the topmost command component
     public void onCreate(CATDialog iDialog, CATNotification iNotification, Object iData)
     {
         // --- retreive my document
         String mydocument = CATDocumentManager.getDocument(iDialog);
         if(mydocument != null && mydocument.equals("/the/brown/fox/jumps"))
         {
             [...]
         }
         // --- register to document change
         CATDocumentManager.registerToDocumentChanged(iDialog, this, "onDocumentChanged", null);
     }
     // --- the callback method associated to the 'document changed' notification from the document manager
     public void onDocumentChanged(CATDialog iDialog, CATNotification iNotification, Object iData)
     {
         // --- retreive my document
         String mydocument = CATDocumentManager.getDocument(iDialog);
         [...]
     }
     [...]
 }
 

CATDocumentManager Properties:

CATDocumentManager Notifications:

   All Implemented Interfaces:
Serializable
Field Summary

Constructor Summary
CATDocumentManager(CATDialog iParent, String iName, CATSession iSession, boolean iAutoKill)
CATDocumentManager(CATDialog iParent, String iName, CATSession iSession)
CATDocumentManager(CATDialog iParent, String iName)

Method Summary
CATDocumentManager getDocumentManager(CATDialog iDialog)
CATDialog getCommand(CATDialog iDialog)
String getCommandName(CATDialog iDialog)
String getDocument(CATDialog iDialog)
void registerToDocumentChanged(CATDialog iDialog, Object iListener, String iMethod, Object iData)
boolean allowsViews(CATDialog iFrom)
CATDialog activate(String iCommand, String iDocument)
CATDialog stack(String iCommand, String iDocument)
CATDialog stackReplace(String iCommand, String iDocument)
CATDialog stack(Class iClass, String iDocument)
void unstack()
CATDialog getActiveCommand()
CATDialog getCommand()
String getCommandDocument(CATDialog iCommandChild)
CATDialog getCommandRoot(CATDialog iCommandChild)
CATNotification getActiveCommandChangedNotification()
void MessageBox(String iTitle, String iDetails, int iSeverity)
void errorBox(CATError iError, String iApplication, int iSeverity)
boolean isDisplayed()
boolean isChildDisplayed(CATDialog iChild)
boolean displayChild(CATDialog iChild)
Reader getResource(String iPath)
CATSession getSession()


Field Detail

Constructor Detail

CATDocumentManager

    CATDocumentManager(CATDialog iParent, String iName, CATSession iSession, boolean iAutoKill)

Creates a document manager.

This may be used by client applications only when overloading this class.

Parameters:
iParent
The parent component.
iName
The document manager name.
iSession
The user session.
iAutoKill
Defines whether this document manager is 'autokill-able' (closes itself when its stack is empty)

CATDocumentManager

    CATDocumentManager(CATDialog iParent, String iName, CATSession iSession)

Creates a non-autokillable document manager.

This may be used by client applications only when overloading this class.

Parameters:
iParent
The parent component.
iName
The document manager name.
iSession
The user session.

CATDocumentManager

    CATDocumentManager(CATDialog iParent, String iName)

Creates a non-autokill document manager.

This may be used by client applications only when overloading this class.

Parameters:
iParent
The parent component.
iName
The document manager name.

Method Detail

getDocumentManager

    CATDocumentManager getDocumentManager(CATDialog iDialog)

Helper method that returns the document manager for a component (it navigates in component hierarchy to find the DocumentManager).

Parameters:
iDialog
A component object that is in the command hierarchy.
Returns:
The first document manager father of the given component.

getCommand

    CATDialog getCommand(CATDialog iDialog)

Helper method that returns the command component that contains the child iDialog.

Parameters:
iDialog
A component object that is in the command hierarchy
Returns:
The top component of the command that has the given component as child.

getCommandName

    String getCommandName(CATDialog iDialog)

Helper method that returns the command name (name of the XMLDlg file) of the given command component

Parameters:
iDialog
The topmost command component.
Returns:
The command name (XMLDlg filename without extension).

getDocument

    String getDocument(CATDialog iDialog)

Helper method that returns the document of the command that contains the child iDialog.

Parameters:
iDialog
a component object that is in the command hierarchy
Returns:
The command document.

registerToDocumentChanged

    void registerToDocumentChanged(CATDialog iDialog, Object iListener, String iMethod, Object iData)

Helper method that registers to 'DocumentChanged' notification on the command that contains the child iDialog.

Parameters:
iDialog
A component object that is in the command hierarchy.
iListener
The listener object.
iMethod
The callback method.
iData
The callback data.
See Also:
CATCallbackSource

allowsViews

    boolean allowsViews(CATDialog iFrom)

Helper method that determines whether the underlying document manager is able to handle multiple activate containers.

When activating a command in such a document manager, the command does not destroy current ones but is displayed into a new self container

Parameters:
iFrom
A component that belongs to the source command.
Returns:
true if a document managing multiple activate containers was found; false otherwise.

activate

    CATDialog activate(String iCommand, String iDocument)

This method controls commands life cycle.

It first cleans up the stack, then instantiates and adds a new command (from its XMLDlg file) to the document manager stack:

Parameters:
iCommand
The command name, that is the XMLDlg filename (without its extension).
iDocument
The document to initialize the command with.
Returns:
The top component from the instantiated command.

stack

    CATDialog stack(String iCommand, String iDocument)

This method controls commands life cycle.

It instantiates and adds a new command (from its XMLDlg file) to the document manager stack:

Parameters:
iCommand
The command name, that is the XMLDlg filename (without its extension).
iDocument
The document to initialize the command with.
Returns:
The top component from the instantiated command.

stackReplace

    CATDialog stackReplace(String iCommand, String iDocument)

This method controls commands life cycle.

It replaces the last command in the stack with a new one:

Parameters:
iCommand
The command name, that is the XMLDlg filename (without its extension).
iDocument
The document to initialize the command with.
Returns:
The top component from the instantiated command.

stack

    CATDialog stack(Class iClass, String iDocument)

This method controls commands life cycle.

It instantiates and adds a new CATUserDialog command to the document manager stack:

Parameters:
iClass
The CATUserDialog class to instantiate.
iDocument
The document to initialize the command with.
Returns:
The top component from the instantiated command.
See Also:
CATUserDialog

unstack

    void unstack()

This method controls commands life cycle.

It removes the last command from the document manager stack:


getActiveCommand

    CATDialog getActiveCommand()

Returns the top component of the current active command.

Returns:
The top component of the current active command.

getCommand

    CATDialog getCommand()

Returns the top component of the current active command.

Returns:
The top component of the current active command.

getCommandDocument

    String getCommandDocument(CATDialog iCommandChild)

Returns the document associated to the command whose specified component is a child.

Parameters:
iCommandChild
A component object that is in the command hierarchy.
Returns:
The command document.

getCommandRoot

    CATDialog getCommandRoot(CATDialog iCommandChild)

Returns the top component of the command whose specified component is a child.

Parameters:
iCommandChild
A component object that is in the command hierarchy.
Returns:
The top component of the matching command.

getActiveCommandChangedNotification

    CATNotification getActiveCommandChangedNotification()

The active command changed notification.

This notification is sent by the document manager each time the active command changes.

Returns:
The active command changed notification.

MessageBox

    void MessageBox(String iTitle, String iDetails, int iSeverity)

Displays the specified message in an appropriate dialog.

Parameters:
iTitle
the message title
iDetails
the message details
iSeverity
the message severity (CATError.INFO, CATError.WARNING or CATError.ERROR)

errorBox

    void errorBox(CATError iError, String iApplication, int iSeverity)

Displays the specified error in an appropriate dialog.

Parameters:
iError
the error to display
iApplication
the application ID
iSeverity
the error severity (CATError.INFO, CATError.WARNING or CATError.ERROR)

isDisplayed

    boolean isDisplayed()

Determines whether this component is displayed on screen or not.

Returns:
true if this component is displayed on screen; false otherwise.

isChildDisplayed

    boolean isChildDisplayed(CATDialog iChild)

Determines whether the child component is displayed by this component.

Parameters:
iChild
The child component to check.
Returns:
true if the specified child component is displayed by this component; false otherwise.

displayChild

    boolean displayChild(CATDialog iChild)

Tries to display the given child component.

Parameters:
iChild
The child component to display.
Returns:
the status of the attempt (true = succeeded / false = failed).

getResource

    Reader getResource(String iPath)

Gets a resource as a stream.

Parameters:
iPath
is a relative path in the runtime view.
Returns:
A stream object.

getSession

    CATSession getSession()

Returns the user session object.

Returns:
The user session object.


Copyright © 2000, Dassault Systèmes. All rights reserved