Home Dojo Dojo-1.0.2 Dojo Toolbar
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Dojo Toolbar

Advertisement
Complete Java Server Faces (JSF) Tutorial - JSF Tutorials. JSF Tutorials at Rose India covers everything you need to know about JSF, This JSF Tutorial contains readable and interesting content organized in proper and sequential manner. Each concept has been explained by simple examples so that you can understand easily and implement immediately into your java web application. It provides coverage of key JSF concepts such as User Interface(UI) components, Renderers, Backing beans, Validators, Converters, Navigation, Event handling, Expession language, Messages etc...

Dojo Toolbar

         

In this section, you will learn about the toolbar and how to create a toolbar in dojo. 

Toolbar : This is a GUI (Graphical User Interface) that is either horizontal row or vertical column of the selected image "buttons" that gives user visible reminder and easy way to select certain application functions or desktop such as: backwards or forwards to pages and saving or printing pages or documents within a browser.

The dijit.Menu is a container for dijit.MenuItem's, so dijit.Toolbar is also container for buttons. In the toolbar contains button-based Dijit, including ComboButtons and DropdownButtons.

Here is the code of Program:

<html>
<title>Toolbar</title>
<head>
  <style type="text/css">
  @import "../resources/dojo.css";
  @import "../dijit/themes/tundra/tundra.css";
  
  </style>

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

  <script type="text/javascript">
 dojo.require("dojo.parser");
 dojo.require("dijit.form.Button");
 dojo.require("dijit.Toolbar");
 function italic() { alert("Italic"); }
 function bold() { alert("Bold!"); }
 function cut() { alert("Cut!"); }
 function copy() { alert("Copy!"); }
 function paste() { alert("Paste!"); }
 dojo.addOnLoad(function() {
 dojo.connect(dojo.byId("toolbar1.italic"),"onclick",italic);
 dojo.connect(dojo.byId("toolbar1.bold"),"onclick",bold);
 dojo.connect(dojo.byId("toolbar1.cut"),"onclick",cut);
 dojo.connect(dojo.byId("toolbar1.copy"),"onclick",copy);
 dojo.connect(dojo.byId("toolbar1.paste"),"onclick",paste);
 });
 </script>

</head>
<body class="tundra">
  <!-- Tags end on line afterwards to eliminate any whitespace -->
  <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>
  
  <!-- The following adds a line between toolbar sections-->
  <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>
</body>
</html>

Output of the Program:

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2011

Ask Questions?    Discuss: Dojo Toolbar  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com