Page tree

MagicDraw 19.0 LTR SP3 Documentation


On this page

‘message’ Method

message(String message) : void. This method will create a Message dialog. 

The code example is shown below:

$dialog.message("Click OK to close dialog")


The output will be as follows:

The Message dialog.

‘confirm’ Method

confirm(String message) : boolean. This method will create a Confirmation dialog. It will return the Boolean value ‘true’ when you click  or ‘false’ when you click  in the dialog. 

The code example is shown below:

#if($dialog.confirm("Do you want to generate section A?"))
#end


The output will be as follows:

The Confirmation dialog.

‘input’ Method

Input dialog with text

input(String message) : String. This method will create an Input dialog from a message. It will return the input values as Strings when you click  or ‘null’ when you click  in the dialog. 

The code example is shown below:

#set ($userText = $dialog.input("Enter your name"))
#if ($userText)
Your name is $userText
#else
Please specify your name
#end


The output will be as follows:

The Input dialog with text.

Input dialog with text and initial value

input(String message, String initialValue) : String. This method will create a message and add an initial value in an Input dialog. It will return the input values as Strings when you click  or ‘null’ when you click

The code example is shown below:

#set ($userText = $dialog.input("Enter a date", "Sep28,2016"))
Date is $userText


The output will be as follows:

The Input dialog with text and an initial value.

Input dialog with text and initial value Array

input(String message, Collection options) : String. This method will create a message and add initial value arrays in an Input dialog. It will return the input values as Strings when you click  or ‘null’ when you click

The code example is shown below:

#set ($selectedOption = $dialog.input("Choose your favorite fruit", ["Apple", "Orange", "Banana"]))
Your favorite fruit is $selectedOption


The output will be as follows:

The Input dialog with text and initial value arrays.

‘sort’ Method

Sort and Enable dialog

sort(Collection list) : Collection. This method will create a Sort and Enable dialog from collections. It will return a collection of the newly sorted results when you click  or return the original collection when you click

The code example is shown below:

#foreach ($diagram in $dialog.sort($Diagram))
$diagram.name
#end


The output will be as follows:

The Sort and Enable dialog.

Sort and Enable dialog with text

sort(String message, Collection list). This method will create a Sort and Enable dialog from text and collections. It will return a collection of the newly sorted results when you click  or return the original collection when you click

The code example is shown below:

#foreach ($diagram in $dialog.sort("Rearrange diagram for presentation report",$Diagram))
$diagram.name
#end


The output will be as follows:

The Sort and Enable dialog with text.


'select' Method

Default Selection dialog

select(Collection list) : Collection. This method will create a Selection dialog from a collection. Items in the collection will be listed in the Selection dialog. You can select the items and click to return a collection of the selected items or null when you click .

The code example is shown below:

#foreach ($class in $dialog.select($Diagram))
$diagram.name
#end


The output will be as follows:

The Selection dialog.

Selection dialog with a title

select(Collection list, String title) : Collection. This method will create a Selection dialog with a specified dialog title. The default Selection dialog title is Selection. You can select the items and click  to return a collection of the selected items or null if you click .

The code example is shown below:

#foreach ($diagram in $dialog.select($Diagram, "Selection Dialog"))
$diagram.name
#end


The output will be as follows:

The Selection dialog with title.

Selection dialog without selection

select(Collection list, String title, Boolean defaultSelected) : Collection. This method will create a Selection dialog from the collection without selecting the items in the dialog. You can specify whether all listed items will be selected or not. The default value for defaultSelected is true. Otherwise, all listed items will not be selected. You can select the items and click to return a collection of the selected items or null if you click .

The code example is shown below:

#foreach ($diagram in $dialog.select($Diagram, "Selection unchecked Dialog", false))
$diagram.name
#end


The output will be as follows:

The Selection dialog without selection.

Selection dialog with description text

select(Collection list, String title, Boolean defaultSelected, String dialogText) : Collection. This method will create a Selection dialog from the collection. You can insert description text in the dialog to show the dialog behavior or more details of the listed items. The default value for the dialogText String is null. You can select the items and click  to return a collection of the selected items or null if you click .

The code example is shown below:

#foreach ($diagram in $dialog.select($Diagram,“Select all feature”, false, "Please select your required element"))
$diagram.name
#end


The output will be as follows:

The Selection dialog with text.
  • No labels