| 1 |
<!DOCTYPE html> |
| 2 |
<html> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Dojo Toolbar Widget Test</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../../../dijit/themes/claro/document.css"; |
| 9 |
@import "../../../../dijit/tests/css/dijitTests.css"; |
| 10 |
|
| 11 |
.flatScreen { |
| 12 |
background-image: url(../../../../dijit/tests/images/flatScreen.gif); height: 32px; width: 32px; |
| 13 |
} |
| 14 |
</style> |
| 15 |
|
| 16 |
|
| 17 |
<link id="themeStyles" rel="stylesheet" href="../../../../dijit/themes/claro/claro.css"/> |
| 18 |
|
| 19 |
|
| 20 |
<script type="text/javascript" src="../../../../dojo/dojo.js" |
| 21 |
data-dojo-config="isDebug: true, async: true, mvc: {debugBindings: true}"></script> |
| 22 |
|
| 23 |
<script type="text/javascript"> |
| 24 |
negativeConverter = { |
| 25 |
format: function(value){ return !value }, |
| 26 |
parse: function(value){ return !value } |
| 27 |
}; |
| 28 |
|
| 29 |
require([ |
| 30 |
"dojox", |
| 31 |
"dojo/parser", |
| 32 |
"dijit/Declaration", |
| 33 |
"dijit/Toolbar", |
| 34 |
"dijit/ToolbarSeparator", |
| 35 |
"dijit/form/Button", |
| 36 |
"dijit/form/DropDownButton", |
| 37 |
"dijit/form/ComboButton", |
| 38 |
"dijit/form/ToggleButton", |
| 39 |
"dijit/ColorPalette", |
| 40 |
"dijit/TooltipDialog", |
| 41 |
"dijit/form/TextBox", |
| 42 |
"dijit/Menu", |
| 43 |
"dijit/MenuItem", |
| 44 |
"dijit/form/TextBox", |
| 45 |
"dijit/form/Select", |
| 46 |
"dijit/form/CheckBox" |
| 47 |
], function(dojox, parser){ |
| 48 |
(cutItemModel = new dojo.Stateful).set("iconClass", "dijitEditorIcon dijitEditorIconCut"); |
| 49 |
(copyItemModel = new dojo.Stateful).set("iconClass", "dijitEditorIcon dijitEditorIconCopy").set("label", "Copy"); |
| 50 |
(boldItemModel = new dojo.Stateful).set("checked", false); |
| 51 |
parser.parse(); |
| 52 |
}); |
| 53 |
</script> |
| 54 |
</head> |
| 55 |
<body class="claro"> |
| 56 |
<script type="dojo/require">at: "dojox/mvc/at"</script> |
| 57 |
<h1 class="testTitle">Toolbar test</h1> |
| 58 |
|
| 59 |
<span data-dojo-type="dijit.Declaration" |
| 60 |
data-dojo-props='widgetClass:"ToolbarSectionStart", defaults:{ label: "Label"}'> |
| 61 |
<span data-dojo-type="dijit.ToolbarSeparator"></span><i>${label}:</i> |
| 62 |
</span> |
| 63 |
|
| 64 |
<h2>Toolbar from markup</h2> |
| 65 |
|
| 66 |
<div id="toolbar1" data-dojo-type="dijit.Toolbar" |
| 67 |
><div data-dojo-type="ToolbarSectionStart" data-dojo-props='label:"Buttons"'></div |
| 68 |
><div id="toolbar1.cut" data-dojo-type="dijit.form.Button" data-dojo-props='showLabel:false, iconClass: at(cutItemModel, "iconClass")'>Cut</div |
| 69 |
><div id="toolbar1.copy" data-dojo-type="dijit.form.Button" |
| 70 |
data-dojo-props='showLabel:true, "*": at(copyItemModel, "*")'>Copy</div |
| 71 |
|
| 72 |
><div data-dojo-type="ToolbarSectionStart" data-dojo-props='label:"Toggles"'></div |
| 73 |
><div id="toolbar1.bold" data-dojo-type="dijit.form.ToggleButton" |
| 74 |
data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconBold", showLabel:false, checked: at(boldItemModel, "checked")'>Bold</div |
| 75 |
><div id="toolbar1.italic" data-dojo-type="dijit.form.ToggleButton" |
| 76 |
data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconItalic", showLabel: true'>Italic</div |
| 77 |
|
| 78 |
></div> |
| 79 |
|
| 80 |
<div style="margin-top:8px;"> |
| 81 |
Icon for "Cut": |
| 82 |
<select data-dojo-type="dijit.form.Select" |
| 83 |
data-dojo-props="value: at(cutItemModel, 'iconClass')"> |
| 84 |
<option value="dijitEditorIcon dijitEditorIconCut">Cut</option> |
| 85 |
<option value="dijitFolderClosed">Folder</option> |
| 86 |
<option value="noteIcon">Note</option> |
| 87 |
<option value="flatScreen">Flat Screen</option> |
| 88 |
</select> |
| 89 |
</div> |
| 90 |
|
| 91 |
<div style="margin-top:8px;"> |
| 92 |
Icon for "Copy": |
| 93 |
<select data-dojo-type="dijit.form.Select" |
| 94 |
data-dojo-props="value: at(copyItemModel, 'iconClass')"> |
| 95 |
<option value="dijitEditorIcon dijitEditorIconCopy">Copy</option> |
| 96 |
<option value="dijitFolderClosed">Folder</option> |
| 97 |
<option value="noteIcon">Note</option> |
| 98 |
<option value="flatScreen">Flat Screen</option> |
| 99 |
</select> |
| 100 |
</div> |
| 101 |
|
| 102 |
<div style="margin-top:8px;"> |
| 103 |
Label for "Copy": |
| 104 |
<select data-dojo-type="dijit.form.Select" |
| 105 |
data-dojo-props="value: at(copyItemModel, 'label')"> |
| 106 |
<option value="Copy">Copy</option> |
| 107 |
<option value="Copy to clipboard...">Copy to clipboard...</option> |
| 108 |
</select> |
| 109 |
</div> |
| 110 |
|
| 111 |
<div style="margin-top:8px;"> |
| 112 |
Change the state for "Bold" (but this check box is free from change in the tool bar): |
| 113 |
<input data-dojo-type="dijit.form.CheckBox" checked |
| 114 |
data-dojo-props="checked: at(boldItemModel, 'checked').direction(at.to)"> |
| 115 |
</div> |
| 116 |
|
| 117 |
<div style="margin-top:8px;"> |
| 118 |
"Italic" should be unselected (directly bound to the tool bar item widget): |
| 119 |
<input data-dojo-type="dijit.form.CheckBox" checked |
| 120 |
data-dojo-props="checked: at(dijit.byId('toolbar1.italic'), 'checked').transform(negativeConverter)"> |
| 121 |
</div> |
| 122 |
</body> |
| 123 |
</html> |