Subversion Repositories Applications.papyrus

Rev

Blame | Last modification | View Log | RSS feed

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

        <title>Dojo Toolbar Widget Test</title>


        <script type="text/javascript" src="../../dojo/dojo.js"
                djConfig="parseOnLoad: true, isDebug: true"></script>
        <script type="text/javascript" src="_testCommon.js"></script>

        <script type="text/javascript">
                dojo.require("dijit.form.Button");
                dojo.require("dijit.ColorPalette");
                dojo.require("dijit.Dialog");
                dojo.require("dijit.Toolbar");
                dojo.require("dijit.form.Button");
                dojo.require("dijit.form.TextBox");
                dojo.require("dijit.Menu");
                dojo.require("dojo.parser");
        </script>

        <!-- programatic creation -->
        <script>
                function init(){
                        dojo.forEach(["toolbar2", "toolbar3", "toolbar4"], function(toolbarId){
                                var toolbar = new dijit.Toolbar({}, dojo.byId(toolbarId));
                                dojo.forEach(["Cut", "Copy", "Paste"], function(label){
                                        var button = new dijit.form.Button({id: toolbarId+"."+label, label: label, iconClass: "dijitEditorIcon dijitEditorIcon"+label, showLabel: (toolbarId == "toolbar2" ? false : true)});
                                        toolbar.addChild(button);
                                });
                        });
                }

                dojo.addOnLoad(init);
        </script>

        <style type="text/css">
                @import "../../dojo/resources/dojo.css";
                @import "css/dijitTests.css";

                .dijitToolbar .dijitButton, .dijitToolbar .dijitDropDownButton { margin: 0px; }
                .dijitToolbar .dijitToggleButtonSelected BUTTON, .dijitToolbar .dijitToggleButtonSelectedHover BUTTON { border-width: 3px; }
        </style>

        <!--    To turn off display of text use showLabel=false attribute on button
                        to turn off display or icon, add your own classes and/or CSS rules -->
        <style>

                .toolbarWithNoImages .dijitButtonContents .dijitInline,
                .toolbarWithNoImages .dijitButtonContents .dijitInline {
                        display: none;
                }

                .menuBar .dijitA11yDownArrow { display: none; }
        </style>

</head>
<body>
        <h1 class="testTitle">Toolbar test</h1>

        <h2>Toolbar from markup</h2>

        <div id="toolbar1" dojoType="dijit.Toolbar"
                        ><div dojoType="dijit.form.Button" id="toolbar1.cut" iconClass="dijitEditorIcon dijitEditorIconCut" showLabel="false">Cut</div
                        ><div dojoType="dijit.form.Button" id="toolbar1.copy" iconClass="dijitEditorIcon dijitEditorIconCopy" showLabel="false">Copy</div
                        ><div dojoType="dijit.form.Button" id="toolbar1.paste" iconClass="dijitEditorIcon dijitEditorIconPaste" showLabel="false">Paste</div

                        ><span dojoType="dijit.ToolbarSeparator"></span

                        ><div dojoType="dijit.form.ToggleButton" id="toolbar1.bold" iconClass="dijitEditorIcon dijitEditorIconBold" showLabel="false">Bold</div
                        ><div dojoType="dijit.form.ToggleButton" id="toolbar1.italic" iconClass="dijitEditorIcon dijitEditorIconItalic" showLabel="false">Italic</div
                        ><div dojoType="dijit.form.ToggleButton" id="toolbar1.underline" iconClass="dijitEditorIcon dijitEditorIconUnderline" showLabel="false">Underline</div
                        ><div dojoType="dijit.form.ToggleButton" id="toolbar1.strikethrough" iconClass="dijitEditorIcon dijitEditorIconStrikethrough" showLabel="false">Strikethrough</div

><!--
                        <span dojoType="dijit.ToolbarSeparator">&nbsp;</span>

                        <span dojo:type="ToolbarButtonGroup" name="justify" defaultButton="justifyleft" preventDeselect="true" showLabel="false">
                                <div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyLeft" name="justify" showLabel="false">Left</div>
                                <div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyRight" name="justify" showLabel="false">Right</div>
                                <div dojoType="dijit.form.ToggleButton" iconClass="dijitEditorIcon dijitEditorIconJustifyCenter" name="justify" showLabel="false">Center</div>
                         </span>

                        --><span dojoType="dijit.ToolbarSeparator">&nbsp;</span

                        ><div dojoType="dijit.form.Button" id="toolbar1.insertorderedlist" iconClass="dijitEditorIcon dijitEditorIconInsertOrderedList" showLabel="false">Ordered list</div
                        ><div dojoType="dijit.form.Button" id="toolbar1.insertunorderedlist" iconClass="dijitEditorIcon dijitEditorIconInsertUnorderedList" showLabel="false">Unordered list</div
                        ><div dojoType="dijit.form.Button" id="toolbar1.indent" iconClass="dijitEditorIcon dijitEditorIconIndent" showLabel="false">Indent</div
                        ><div dojoType="dijit.form.Button" id="toolbar1.outdent" iconClass="dijitEditorIcon dijitEditorIconOutdent" showLabel="false">Outdent</div

                        ><span dojoType="dijit.ToolbarSeparator"></span
                        ><div dojoType="dijit.form.DropDownButton" id="toolbar1.dialog">
                                <span>Login</span>
                                <div dojoType="dijit.TooltipDialog" id="tooltipDlg" title="Enter Login information"
                                        execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
                                        <table>
                                                <tr>
                                                        <td><label for="user">User:</label></td>
                                                        <td><input dojoType=dijit.form.TextBox type="text" name="user" ></td>
                                                </tr>
                                                <tr>
                                                        <td><label for="pwd">Password:</label></td>
                                                        <td><input dojoType=dijit.form.TextBox type="password" name="pwd"></td>
                                                </tr>
                                                <tr>
                                                        <td colspan="2" align="center">
                                                                <button dojoType=dijit.form.Button type="submit" name="submit">Login</button></td>
                                                </tr>
                                        </table>
                                </div
                        ></div
                        ><div dojoType="dijit.form.DropDownButton" id="toolbar1.backcolor" iconClass="dijitEditorIcon dijitEditorIconBackColor" showLabel="false">
                                <span>Background</span>
                                <div dojoType="dijit.ColorPalette" id="toolbar1.colorPalette" style="display: none" palette="3x4" onChange="console.log(this.value);"></div>
                        </div
                        ><div dojoType="dijit.form.DropDownButton" id="toolbar1.forecolor" iconClass="dijitEditorIcon dijitEditorIconForeColor" showLabel="false">
                                <span>Foreground</span>
                                <div dojoType="dijit.ColorPalette" id="toolbar1.colorPalette2" style="display: none" palette="3x4" onChange="console.log(this.value);"></div>
                        </div

                        ><span dojoType="dijit.ToolbarSeparator"></span
                        ><div dojoType="dijit.form.ComboButton" optionsTitle='save options' onClick='console.log("clicked combo save")'>
                                <span>Save</span>
                                <div dojoType="dijit.Menu" id="saveMenu" style="display: none;">
                                        <div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconSave"
                                                onClick="console.log('not actually saving anything, just a test!')">Save</div>
                                        <div dojoType="dijit.MenuItem"
                                                onClick="console.log('not actually saving anything, just a test!')">Save As</div>
                                </div>
                        </div
        ></div>

        <h2>Toolbar that looks like MenuBar</h2>
        <div id="menubar" dojoType="dijit.Toolbar" class="menuBar">
                <div dojoType="dijit.form.DropDownButton">
                        <span>File</span>
                        <div dojoType="dijit.Menu">
                                <div dojoType="dijit.MenuItem">New</div>
                                <div dojoType="dijit.MenuItem">Open</div>
                                <div dojoType="dijit.MenuSeparator"></div>
                                <div dojoType="dijit.MenuItem" iconClass="dijitEditorIconSave">Save</div>
                                <div dojoType="dijit.MenuItem">Save As...</div>
                        </div>
                </div>
                <div dojoType="dijit.form.DropDownButton">
                        <span>Edit</span>
                        <div dojoType="dijit.Menu">
                                <div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconCut"
                                        onClick="console.log('not actually cutting anything, just a test!')">Cut</div>
                                <div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconCopy"
                                        onClick="console.log('not actually copying anything, just a test!')">Copy</div>
                                <div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconPaste"
                                        onClick="console.log('not actually pasting anything, just a test!')">Paste</div>
                        </div>
                </div>
                <div dojoType="dijit.form.DropDownButton">
                        <span>View</span>
                        <div dojoType="dijit.Menu">
                                <div dojoType="dijit.MenuItem">Normal</div>
                                <div dojoType="dijit.MenuItem">Outline</div>
                                <div dojoType="dijit.PopupMenuItem">
                                        <span>Zoom</span>
                                        <div dojoType="dijit.Menu" id="submenu2">
                                                <div dojoType="dijit.MenuItem">50%</div>
                                                <div dojoType="dijit.MenuItem">75%</div>
                                                <div dojoType="dijit.MenuItem">100%</div>
                                                <div dojoType="dijit.MenuItem">150%</div>
                                                <div dojoType="dijit.MenuItem">200%</div>
                                        </div>
                                </div>
                        </div>
                </div>
                <div dojoType="dijit.form.DropDownButton">
                        <span>Help</span>
                        <div dojoType="dijit.Menu">
                                <div dojoType="dijit.MenuItem">Help Topics</div>
                                <div dojoType="dijit.MenuItem">About Dijit</div>
                        </div>
                </div>
        </div>  

        <h2>Toolbar from script</h2>
        <div id="toolbar2"></div>

        <h2>Toolbar with text and icons</h2>
        <div id="toolbar3"></div>

        <h2>Toolbar with text only</h2>
        <div id="toolbar4" class="toolbarWithNoImages"></div>
  </body>
</html>