JBox and JNoModalBox methods
JBox methods
The JBox class specializes the JSet class and is used to implement modal dialog boxes. It contains the following method:
show ()
return boolean
This displays the dialog box in modal form (that is to say, all other operations are blocked whilst the dialog box is open). It returns true if the user clicks on the "OK" button and false if the user clicks on the "Cancel" button (or the cross in the top right-hand corner used to close the dialog box).
JNoModalBox methods
The JNoModalBox class specializes the JSet class and is used to implement non-modal dialog boxes. It contains the following methods:
setCallback(ident: in
String, profileName: in String,
operationName: in String)
This is used to position the operationName callback on the profile used as a parameter on the box object.
If the identifier is a button identifier, the "operationName" is called when you click on the button.
If the identifier is a list, the callback is called when you double-click on an element in the list.
Note: In this case, the "ident" refers to another model element.
addButton (ident: in String, label: in String,
profileName:
in String,
operationName: in String,
width: in integer)
addButtonBitmap (ident: in String, label: in String,
profileName:
in String,
operationName:
in String)
These methods are used to respectively add a button and a bitmap to a call back. The complete path must be provided for the bitmap.
When the callback is activated, only the JNoModalBox object is known. If the user wishes to store another usage context (for example, the object on which the command has been run), then the "appendUserData", "getUserData" and "eraseUserData" methods, detailed in the "JSet complementary methods" theme of this section, should be used. If the object is destroyed, then it is removed from the user data list.
show (consultMode: in boolean)
This displays the dialog box in non-modal form (that is to say, the dialog box does not block other operations).
If consultMode has been set, then
Objecteering changes over to consultation mode, and an egg-timer appears in the
dialog boxes (except the current JNoModalBox).
hide ()
This hides the dialog box.
JNoModalBox also contains operations used to associate callbacks to a JTree. The "setCallback" method is used to position the callback by default on the JTree, which is then triggered by double-clicking on one of the tree's leaves.
setTreeSelectionCallback(ident: in String,
profileName : in String,
operationName: in String)
This is used to position an "operationName" callback. This callback is related to the "ident" identifying JTree, and is triggered by the selection of one of the tree's nodes.
setTreeExpandCallback (ident: in String,
profileName : in String,
operationName: in String)
This is used to set the "operationName" callback. This callback is related to the
"ident" identifying JTree, and is triggered by the expansion of a
node (double-click on a node which has children, or on the "+" symbol
adjoining the node).
setTreeExpandGhostItemCallback(ident: in String,
profileName : in String,
operationName: in String)
This is used to set an "operationName" callback. This callback is related to the "ident" identifying JTree, and is triggered by the expansion of a particular node, namely "GhostItem". This node simulates the existence of a child (for further information, please see "JTree and JTreeItem methods").
setTreeShrinkCallback(ident: in String,
profileName : in String,
operationName: in String)
This sets an
"operationName" callback. This callback is related to the "ident" identifying JTree,
and is triggered by the shrinking of a branch (double-clicking on a node whose
children are visible, or on the "-" symbol adjoining the node).
JNoModalBox drag and drop methods
Object JNoModalBox::addDropZone
(in String ident, // field identifier
in
String label, // field title
in
Object initial, // initial value
in
int width) // width
This adds and returns a drag and drop field which resembles those you can see in standard windows. Unlike other fields, it is not editable, but accepts drops of objects from the explorer.
This field as the "ident" identifier with the "label" label contains the "initial" object (which can be void) and is of "width" width.
Note: Before being able to be used, at least one call to the appendAllowedMetaclass method must be carried out (see below).
Example
JObjectField f = box.addDropField("drarDropField",
"Drop field", null, 200);
f.appendAllowedMetaclass("NameSpace")
//
allow drop of Class, Package, Enumerate, …
To create a drop field without the standard "target" bitmap, use the following method:
JObjectField JnoModalBox::addDropField
(in String ident, // field identifier
in String label, // field title
in Object initial, // initial value
in int width) // width
JObjectField JNoModalBox::getDropField
(in string ident_i )
This returns the droppable field called "ident_i" or void if no droppable field of this name exists.
void JObjectField::appendAllowedMetaclass(in String
aMetaclassName)
This indicates that a drag and drop from a "aMetaclassName" class or child class object is authorized. "aMetaclassName" is the name of a metaclass you wish to allow the user to drop in the field. All metaclass names except "Object" are valid.
Warning: If this method is never called on the drag and drop field, no drag and drop operations are authorized.
Object JObjectField::getValue()
This returns the object which has been dropped in the field.
JObjectField::setValue(in Object obj)
This changes the dropped object it "obj" is from a metaclass authorizing drops. If "obj" is void, this empties the field.
boolean JObjectField::acceptDropOf(in Object obj)
This returns true if the field accepts the object in question. It checks that the object's metaclass is either part of or inherits from one of the authorized metaclasses.