Escolar Documentos
Profissional Documentos
Cultura Documentos
iii
iv Developing with Dojo widgets
Chapter 1. Developing with the EGL Dojo widgets
The Dojo widgets for EGL Rich UI are a set of Dojo widgets that are ready to use
in an EGL Rich UI application.
The Dojo Toolkit is an open source toolkit that contains JavaScript™ widgets. For
more information about the Dojo Toolkit, see http://dojotoolkit.org.
The ready-to-use EGL Dojo widgets represent a set of commonly used widgets that
extend the Rich UI widget library.
The EGL Rich UI Dojo widget download file is located on EGL Café. To use this
version of the EGL Rich UI Dojo widgets, you must have Rational Business
Developer, version 7.5.1.4 installed.
Note: Simply double-clicking one of the EGL files, opens the sample with the
default EGL source editor.
The following example shows a simple application that contains a Dojo button:
Handler DojoButtonSample Type RUIHandler { initialUI = [ MyFirstButton ]}
MyFirstButton dojo.widgets.DojoButton { text = "Button" };
end
Related concepts
“Preparation for using the EGL Dojo widgets”
“Migrating from EGL Dojo version 0.6.0 to version 0.7.1.1”
“Themes to use with your application” on page 3
Related tasks
“Coding an application by using Dojo widgets” on page 5
Related reference
Chapter 2, “Dojo widget library,” on page 7
The current EGL Dojo widgets version 0.7.1.1 are for Rational Business Developer
version 7.5.1.4. Any existing EGL applications using the version 0.6.0 widgets may
require a change. That said, the current API has been firmly defined and will not
experience significant changes in future releases.
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
You might use a local version of the toolkit instead of a remote version for many
reasons. To learn about the advantages and disadvantages of local and remote
access, see Table 1.
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
You can use three themes: Nihilo, Soria, and Tundra. The following examples show
the look of each theme. If you do not specify a theme, Tundra is the default.
Soria
The examples in this document uses the Tundra theme. To set a theme, use the
DojoLib library from the initialization of your primary Rich UI handler.
function start()
DojoLib.setTheme("soria");
end
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
To create a Rich UI handler, click File → New → Rich UI Handler. Use the Rich UI
Handler wizard to complete the creation of the Rich UI Handler part.
After the Rich UI Handler part is created, you can start to code your application
by using the Rich UI editor. The following example shows a simple application
that contains a button:
import dojo.widgets.DojoLib;
DojoAccordionContainer
The DojoAccordionContainer widget contains a set of panes in one pane of the
user interface. When an action is taken for an individual interface, another pane in
the interface is displayed. Each pane is defined by using the DojoContentPane
widget.
7
Properties
duration
The amount of time for the content pane to open after it is selected. The
value is in milliseconds.
selection
Specifies the pane that initially opens
width The total width of the container
height The total height of the container
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
“Preparation for using the EGL Dojo widgets” on page 2
Related reference
“DojoContentPane”
Chapter 2, “Dojo widget library,” on page 7
DojoContentPane
The DojoContentPane defines the content of a tab pane. You must use this widget
with either the DojoAccordionContainer or DojoTabContainer widgets.
Properties
children
Specifies the contents on the tab pane, such as an EGL box widget
closable
Indicates whether the tab can be closed. Valid values are true and false.
selected
Indicates the tab that is initially active when the page is displayed. Valid
values are true and false. If true is specified for multiple tabs, the last tab
with selected=true is displayed.
title The name that is displayed on the tab
Example
The following example shows the code and outcome for the DojoTabContainer and
DojoContentPane widgets.
blueBox Box {background="#0099FF",height="100%",columns=1,
children = [new HTML {marginLeft=10, paddingTop=11,
text = "List of townhouses "}
DojoTabContainer {width="100%",height=300,
tabPosition=positionCombo.values[positionCombo.selection],
onTabSelected ::= TabSelected,onTabRemoved ::= TabRemoved,
children =[
new DojoContentPane {title="Apartments",children=[yellowDiv] },
new DojoContentPane {title="Houses",closable=true,children=[orangeDiv] },
new DojoContentPane {title="Townhouses",selected=true,children=[blueBox] }]
};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
DojoBarGraph
The DojoBarGraph widget creates bar graphs. Use this widget to create vertical or
horizontal bar graphs.
Properties
barGap
The gap, in number of pixels, between the bars. The default value is 5.
data Required. The data that the graph represents. Data must be in array
format.
height The total height of the graph
themeColor
The color of the graph. You can use blue, red, cyan, green, orange, and
purple. The default value is blue.
vertical
Indicates whether the bars are vertical or horizontal. The default value is
true.
true The bars are vertical.
false The bars are horizontal.
width The total width of the graph
Example
The following example shows the code and output for a bar graph that contains
four columns:
dbg DojoBarGraph {barGap=5,vertical=true, data=[4, 1,5,3], ThemeColor="blue",
width=350, height=350};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoBubbleChart
The DojoBubbleChart widget creates bubble charts. Use this widget to show the
relationship of three different sets of data.
Properties
data Required. The data that the chart represents. Data must be in array format.
themeColor
The background color of the chart
height The total height of the graph, specified in number of pixels. The default
value is 350.
BubbleChartData
Defines the data to be contained in a bubble chart.
Properties
color The fill color of the bubble
size The size of the bubble
tooltip
The text that is displayed when the cursor is positioned over the bubble
x The value of the horizontal axis of the graph
y The value of the vertical axis of the graph
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
“DojoBubbleChart” on page 9
DojoButton
The DojoButton widget creates a button that invokes a function in response to a
user’s click.
Properties
text The text label for the button
width The width of the button
Events
onClick
Specifies an event that is to occur when the button is pressed
Example
The following example shows the code and outcome for a button that is labeled
″My Button″.
new DojoButton {text="My Button"}
DojoCheckbox
The DojoCheckbox widget creates check boxes.
Properties
selected
Indicates that the check box can be selected. Valid values are true and
false.
text The text label for the check box
Events
onChange
Specifies an event that is to occur when the button is pressed. This event is
a Rich UI event.
Example
The following example shows the code and outcome for a check box.
DojoCheckbox {text = "My Checkbox", selected = true};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoColorPalette
The DojoColorPalette widget creates a color palette.
Properties
small The size of the palette
True The palette is three rows and four columns
False The palette is seven rows and ten columns
value The color that is currently selected
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoComboBox
The DojoComboBox widget creates combination boxes.
Example
The following example shows the code and output for a combination box that
contains three items.
ComboBox DojoComboBox{values=["Dogs","Cats","Birds"],value="Cats"};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoContextMenu
You can use the DojoContextMenu widget to create a context menu that is invoked
by a right-mouse click.
Properties
children
Contains an array of DojoMenuItem records; each record represents a
choice on the menu.
text The text label for the menu box
targets
An array of Box widgets
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“DojoMenu” on page 17
“DojoMenuItem” on page 17
DojoCurrencyTextBox
The DojoCurrencyTextBox widget creates text input fields that supply numeric
currency values.
Properties
value The value of the input field
currency
The currency to be used. See ISO-4217 for list of valid currency codes.
International Organization for Standardization (ISO) standards are on the
following Web site: http://www.iso.org/iso/.
Example
The following example shows the code and output for the DojoCurrencyTextBox
widget.
textField DojoCurrencyTextBox{ value="$100.00",currency="USD"};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
http://www.iso.org/iso/support/currency_codes_list-1.htm
DojoDateTextBox
The DojoDateTextBox widget creates a date input field.
Properties
errorMessage
The message that is displayed when the input is not valid
formatLength
The format of the displayed data; for example, Monday, March 16, 2009
versus 2009/03/16 versus 03/09. The length of the date might be restricted
by region and available storage. Specify a value of short, medium, long,
and full.
value The value of the entered date
Functions
setValue
Example
The following example shows the code and output for the DojoDateTextBox
widget.
dateBox DojoDateTextBox{errorMessage="The format of the date is incorrect.",
formatLength="long"};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoDialog
The DojoDialog widget creates a pop-up dialog box.
Functions
showDialog
Opens the dialog box. You can close the box by clicking the x on the right
top corner, or by pressing the Esc key.
hideDialog
Hides the dialog box
Example
The following example shows the code and output for the DojoDialog widget. The
example contains HTML text and a button.
new DojoDialog{title="Test Dialog Box",innerBox=box};
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoGrid
The DojoGrid widget displays data in a table.
Events
onGridRowClick
The action to occur when the row is selected
Functions
addRow
Adds a row to the table
removeRow
Removes a row from the table
Example
The following example shows the code and output for the DojoGrid widget.
DojoGrid {marginLeft=20, behaviors = [ addEditors, centerColumns ],
headerBehaviors = [ resize, centerColumns ],
columns = [new DojoGridColumn {name="SelectQuote",displayName="X",width=17},
new DojoGridColumn {name="Symbol"},
new DojoGridColumn {name="Quote",displayName="Price"},
new DojoGridColumn {name="NumShares", displayName="Shares"}],
data = [new Stock{Symbol="Company1",Quote=100,NumShares=4,SelectQuote=false},
new Stock{Symbol="Company2",Quote=200,NumShares=100,SelectQuote=false},
new Stock{Symbol="Company3",Quote=200,NumShares=15,SelectQuote=false},
new Stock{Symbol="Company4",Quote=120,NumShares=10,SelectQuote=true},
new Stock{Symbol="Company5",Quote=200,NumShares=20,SelectQuote=false}]}
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoHorizonalSlider
The DojoHorizonalSlider widget creates a horizontal ruler.
Properties
maximum
The maximum value of the ruler
minimum
The minimum value of the ruler
Example
The following example shows the code and outcome for a horizontal slider.
DojoHorizontalSlider { width="300",value="80",step="10",showLabels=true}
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoLineGraph
The DojoLineGraph widget displays line graphs.
Properties
data The data that is plotted on the graph
height The height of the graph in pixels
maxX The maximum value to be displayed at the left of the x axis of the graph.
Default is based on number of elements in data property.
maxY The maximum value to be displayed at the top of the y axis of the graph.
Default is based on value of data property.
minX The minimum value to be displayed at the right of the x axis of the graph.
Defaults to 0.
minY The minimum value to be displayed at the bottom of the y axis of the
graph. Defaults to 0.
showMarkers
Defines whether a marker (point) is shown on the line for the data that is
being graphed. Valid values are true and false.
true A marker is shown on the line for each of the items being graphed.
false A marker is not shown on the line for each of the items being
graphed.
showShadows
Defines if a shadow for the graph line is shown. Valid values are true and
false.
true Graph shadow is shown.
false Graph shadow is not shown.
tension
Sets the curvature of the graph
Example
The following example shows the code and output for a line graph.
new DojoLineGraph{data=[1.5, 2.8, 5.4, 3.6, 6 ,7.9 ], themeColor="blue",
showMarkers=false, showShadows=false, tension="0",
width="400", height="400" };
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoMenu
Use the DojoMenu widget with one or more DojoMenuItem widgets to create
menu items. To create complex menus, you can nest the DojoMenu and
DojoMenuItem widgets.
Properties
children
An array of records that contains information to put into the menu. Specify
as children=(array_name as any[]), where array_name is the name of the
array.
text The text label for the menu box
Events
onMenuItemSelected
The event that is called when a menu item is selected
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“DojoMenuItem”
DojoMenuItem
The DojoMenuItem widget describes the items that are associated with a menu.
Code a DojoMenuItem widget for each menu item.
Properties
disabled
Indicates whether the menu item is disabled. If a menu item is disabled, it
is gray. Valid values are true and false.
Example
The following example shows the code and output for a menu item that contains
three items.
DojoMenu {text = "Edit", children =
[DojoMenuItem {text="Cut",onClick ::= handleCut,iconClass="dijitEditorIcon dijitEditorIconCut"},
DojoMenuItem {text="Copy",onClick ::=handleCopy,iconClass="dijitEditorIcon dijitEditorIconCopy"},
DojoMenuItem {text="Paste",disabled=true,iconClass="dijitEditorIcon dijitEditorIconPaste"},
DojoMenuItem {text="Paste Special",children =[
DojoMenu {children =[createMenuItem("As HTML"),createMenuItem("As plain text")]}
]}
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“DojoMenu” on page 17
DojoPieChart
Use the DojoPieChart widget with one or more PieChartData records to create pie
charts.
Properties
data The name of the PieChartData record that contains the data for the pie
chart
fontColor
The color of the pie chart. It can be blue, red, cyan, green, orange, or
purple.
height The height of the pie chart, in pixels
labelOffSet
The offset of the labels from the center. For a radius of 100, a value of
value of 40 is optimal.
radius The radius of the pie chart, in pixels. A value of 100 is optimal.
width The total width of the pie chart, in pixels
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“PieChartData” on page 19
Properties
color The color that is associated with the section of the chart that you are
defining
fontColor
The color of the font for the text label
text The text that is to be placed inside the section
y The numeric value that was used to calculate the amount of space this data
record occupies in the chart related to the other data records.
Example
The following example shows the code and output for a pie chart that contains
four sections. A PieChartData record defines each section.
DojoPieChart {radius=100,width="300",height="300",
labelOffset=50,fontColor="black",
data = [
new PieChartData{ y=1, text="SUVs",color="green"},
new PieChartData{ y=2, text="sedans",color="yellow"},
new PieChartData{ y=2, text="hybrids",color="#3300FF"},
new PieChartData{ y=2, text="hatchbacks",color="#9900FF"}]
}
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“DojoPieChart” on page 18
DojoProgressBar
The DojoProgressBar widget displays progress bars.
Properties
maximum
The maximum value of the progress
progress
The current progress
width The width of the progress bar
Example
The following example shows the code and output for a progress bar.
dpb DojoProgressBar{maximum="100",progress="50",width="300"};
DojoRadioGroup
Use the DojoRadioGroup widget to define radio buttons.
Properties
options
The text label for the button
selected
Specifies whether the radio button can be selected. Valid values are true
and false.
vertical
Specifies whether the list of buttons is horizontal or vertical. Valid values
are true and false.
Example
The following example shows the code and outcome for a group of radio buttons,
which are labeled soda, coffee, and tea.
radio DojoRadioGroup {vertical=true,options=["soda","coffee","tea" ],selected="coffee",onChange ::=chooseDrink };
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoTabContainer
The DojoTabContainer widget creates tab folders.
Properties
children
An array of DojoContentPane widgets that represent the tabs
height The height of the tab folder, in pixels
selection
Returns the index of the currently selected tab
tabPosition
The position of the tab locations. Valid values are top, left, bottom, and
right.
width The width of the tab folder, in pixels
Events
onTabSelected
The event that occurs when the tab is selected
DojoTimeTextBox
The DojoTimeTextBox creates a time input field.
Properties
clickableIncrement
The increment that is shown on the time selection menu. Increments range
from 5 minutes to a full day. The default value is 15 minutes. For example:
TIMEBOX_ONE_QUARTER
The increment is 15 minutes.
TIMEBOX_HALF_HOUR
The increment is 30 minutes.
TIMEBOX_FULL_DAY
The increment is 24 hours.
errorMessage
The message that is displayed when the input is not valid
timePattern
The expected format pattern for the time to be entered
TIMEBOX_FORMAT_12HR
The time format is between 12:00 - 11:59 AM and 12:00-11:59 PM.
TIMEBOX_FORMAT_24HR
The time format is 0 - 24.
value The value of the time that is selected
visibleIncrement
The increment in which the time is displayed in the time selection menu.
The difference between the times that are displayed and what is shown
when someone clicks the input field.
visibleRange
The range of the times to be displayed in the time selection menu at one
time. To view additional times, use the scroll bar.
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoTitlePane
The DojoTitlePane widget creates a collapsible container with a title bar.
Functions
setContent
Specifies the pane that is to be displayed
setTitle
Specifies the title of the pane
toggle Opens and closes the pane
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related reference
Chapter 2, “Dojo widget library,” on page 7
DojoTree
The DojoTree widget works with an array of DojoTreeNode records to create trees.
Properties
children
Identifies the nodes that compose a tree. Points to an array of
DojoTreeNode records that define the tree nodes.
text The name of a top-level root node
Events
onClick
Specifies an event that is to occur when the tree node is clicked
Functions
addTreeNode
Adds a tree node to the tree
removeTreeNode
Removes a tree node from the tree
updateTreeNode
Changes a tree node in the tree
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“DojoTreeNode” on page 23
Properties
children
Define the sub-elements of the node, enclose the sub-elements in brackets,
and separate each DojoTreeNode record with a comma.
children = [ new DojoTreeNode { id = node_id, text = node_text },
new DojoTreeNode { id = node_id, text = node_name }
]
id The required identifier for this tree node
text The name of the node
Example
The following example shows the code and output for a tree diagram that contains
two nodes: North America and Europe. The nodes are defined by the TreeNode
record, which is pointed to by the treeNodes property.
DojoTree { text="World",onClick ::= handleCity,children=[
DojoTreeNode {id="NA",text="North America",children=[
DojoTreeNode {id="CA",text="Canada"},
DojoTreeNode {id="US",text="USA"} ]},
DojoTreeNode {id="EU",text="Europe",children= [
DojoTreeNode {id="GR",text="Greece"},
DojoTreeNode {id="IT",text="Italy"}]}
Related concepts
Chapter 1, “Developing with the EGL Dojo widgets,” on page 1
Related references
Chapter 2, “Dojo widget library,” on page 7
“DojoTree” on page 22
25