Servis-Rhino 4211B Guia do Utilizador Página 138

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 298
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 137
Dojo GUI Development
Dojo development can be performed in HTML or in JavaScript.
Other alternative development environments include IBM's Integration Designer and IBM's
Worklight Studio products.
Loading Dojo
Dojo does not automatically pull packages into the browser environment. That would be far too
much data to transmit and would bloat the browser unnecessarily. Instead, Dojo delegates the
choice of which packages to include to the developer through the use of the require() function
call. Throughout this book we will not show the use of require() and it is assumed that the
reader will remember to include the appropriate packages where necessary.
In a web page that is going to use Dojo, Dojo must be bootstrapped. An example of this would be:
<script type="text/javascript" src=".../dojo.js" data-dojo-config="async: true, parseOnLoad: true">
</script>
We also have the option of loading Dojo from one of the public distribution web sites such as
Google.
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js" data-dojo-config="async:
true"></script>
The version of Dojo currently loaded can be found with the dojo.version object. This also has
a toString() method to report the version currently in use.
An illustrative sample HTML file for loading Dojo might be:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Page Title</title>
<script type="text/javascript" src="/dojoRoot/dojo/dojo.js" data-dojo-config="async: true,
parseOnLoad: true"></script>
<link rel="stylesheet" href="/dojoRoot/dojo/resources/dojo.css" />
<link rel="stylesheet" href="/dojoRoot/dijit/themes/claro/claro.css" />
<link rel="stylesheet"
href="/dojoRoot/dojox/grid/resources/claroGrid.css" />
</head>
<body class="claro">
</body>
</html>
A corresponding JavaScript sample file might be:
require(
[
"dojo/ready"
],
function (ready) {
ready(function () {
});
});
// End of file
When a page contains HTML and Dojo, the HTML is parsed by the browser and will show in its
native form. After this, the Dojo parser can jump in and the result is that the DOM will be updated
to reflect the changes. This can result in a transitory period where ugly HTML that has not yet been
styled by Dojo can be shown in the browser. One of the easiest ways to handle this is to surround
the content of the page with a <div id="main" style="visibility: hidden">. This
will mean the content will not be shown. When Dojo is ready, it can then execute:
domStyle.set("main", "visibility", "visible");
Page 138
Vista de página 137
1 2 ... 133 134 135 136 137 138 139 140 141 142 143 ... 297 298

Comentários a estes Manuais

Sem comentários