Package com.dassault_systemes.catjdialog

   
Class CATUserDialog

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

Framework : CATJDialog

Module : CATJDialog

Class Description

public class CATUserDialog

The base user dialog graphical component class.

Description:

A User Dialog is a basic JDialog command (XMLDlg file + its controller) that can be reused as a standalone and self-contained dialog.

Making a User Dialog:

To turn a JDialog command into a user dialog requires:
  1. the controller class extends CATUserDialog, and has a constructor with signature:
       <Constructor>(CATDialog iParent, String iName)
       that calls the super (CATUserDialog) constructor with specified XMLDlg filename.
  2. deliver an XMLWidget file in the resources/widget directory of the runtime view.
       that declares the user dialog as a standard component, that may then be reused as a standard JDialog component (instantiation in other XMLDlg files, integration in the CAA UI Builder)

Sample: turning the MyEditor command (MyEditor.XMLDlg file + MyEditor.java controller class) into a user dialog

1- Have the controller extend CATUserDialog

    [...]
    public class MyEditor extends CATUserDialog
    {
        // --- this is the CATDialog constructor
        public MyEditor(CATDialog iParent, String iName)
        {
            // --- call the CATUserDialog constructor with command filename (MyEditor.XMLDlg)
            super(iParent, iName, "MyEditor");
            [...]
        }
        [...]
    }
 

2- Deliver the resources/widget/MyEditor.XMLWidget file:

    <?xml version="1.0"?>
    <Widget
     Description="My editor component"
     Class="com.mypackage.MyEditor"
     Icon="TimeEditor_Icon.gif"
     Preview="TimeEditor_Preview.gif" />
 
    (Icon and Preview attributes are used by the the CAA UI Builder)

Caution with UserDialog usage:
In a UserDialog, public CATDialog class members initialization is forbidden.
Ex:

    public class MyEditor public class CATUserDialog
    {
      public CATTable _mytable;
      public CATTextField _myfield = null;  <-- NO
      [...]
 
Due to a (very) complex calling stack when constructing a user dialog, this would overwrite the field with a null value.

Reusing a User Dialog in other commands:

Other JDialog commands can then reuse your user dialogs exactly the same way they do with standard JDialog components:

Sample: reusing MyEditor as a standard JDialog component in an XMLDlg file

 <?xml version="1.0"?>
   <Frame Name="Test" onCreate="onCreate" [...] >
     <TextField Name="Field" Attribute="_field" Text="please enter text" [...] />
     <MyEditor Name="Editor" MyValue="hello world" onMyEvent="onMyEditorEvent"/>
     [...]
 

   All Implemented Interfaces:
CATIContainerDialog
CATICmdButtons
CATIToolbarHolder
See Also:
CATDialog
Field Summary

Constructor Summary
CATUserDialog(CATDialog iParent, String iName, String iXMLDlgFile)
CATUserDialog()

Method Summary
boolean isUserDialog()
CATDialog getFirstChild()


Field Detail

Constructor Detail

CATUserDialog

    CATUserDialog(CATDialog iParent, String iName, String iXMLDlgFile)

Creates a user dialog object and instantiates the command from the specified XMLDlg filename.

Parameters:
iParent
the parent component
iName
This user dialog name. Here are some rules for this name:
  • It is set in the constructor, and cannot be changed afterwards.
  • The name must be unique for the parent (2 children with the same name are not allowed).
  • The name may not contain any ot the following characters: '.' (dot), ' ' (blank), '_' (underscore)
iXMLDlgFile
the XMLDlg command filename (without extension)

CATUserDialog

    CATUserDialog()

Default constructor to be able to use as a standard controller.


Method Detail

isUserDialog

    boolean isUserDialog()

Returns whether this is used as UserDialog (behaves as a Dialog), or as a simple controller

Returns:
true if it is a UserDialog, false if it is a simple controller.

getFirstChild

    CATDialog getFirstChild()

Returns the first child component.

This method has only a meaning if this is really used as a UserDialog.

Returns:
The first child component.
See Also:
#isUserDialog()


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