tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r947328 - in /websites/production/tapestry/content: cache/main.pageCache dom.html
Date Sun, 12 Apr 2015 19:20:13 GMT
Author: buildbot
Date: Sun Apr 12 19:20:13 2015
New Revision: 947328

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/cache/main.pageCache
    websites/production/tapestry/content/dom.html

Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/tapestry/content/dom.html
==============================================================================
--- websites/production/tapestry/content/dom.html (original)
+++ websites/production/tapestry/content/dom.html Sun Apr 12 19:20:13 2015
@@ -67,15 +67,7 @@
   </div>
 
 <div id="content">
-<div id="ConfluenceContent"><h1 id="DOM-DocumentObjectModel">Document Object
Model</h1>
-
-<p>Tapestry 5 takes a very different approach to markup generation than most other
frameworks. Components render out a Document Object Model (DOM). This is a tree of nodes representing
elements, attributes and text within a document.</p>
-
-<p>Once all rendering is complete, the DOM tree is streamed to the client.</p>
-
-<p>The <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/MarkupWriter.html">MarkupWriter</a>
interface allows the majority of component code to treat the generation of output as a stream.
In reality, MarkupWriter is more like a cursor into the DOM tree, and the DOM may ultimately
be operated upon in a random access manner (rather than the serial (or buffered) approach
used in Tapestry 4).</p>
-
-<div class="navmenu" style="float:right; width:30%; background:white; margin:3px; padding:3px">
+<div id="ConfluenceContent"><h1 id="DOM-DocumentObjectModel">Document Object
Model</h1><p>Tapestry 5 takes a very different approach to markup generation than
most other frameworks. Components render out a Document Object Model (DOM). This is a tree
of nodes representing elements, attributes and text within a document.</p><p>Once
all rendering is complete, the DOM tree is streamed to the client.</p><p>The <a
shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/MarkupWriter.html">MarkupWriter</a>
interface allows the majority of component code to treat the generation of output as a stream.
In reality, MarkupWriter is more like a cursor into the DOM tree, and the DOM may ultimately
be operated upon in a random access manner (rather than the serial (or buffered) approach
used in Tapestry 4).</p><div class="navmenu" style="float:right; width:30%; background:white;
margin:3px; padding:3px">
     <div class="aui-message hint shadowed information-macro">
                     <p class="title">A Note For Tapestry 4 Users</p>
                             <span class="aui-icon icon-hint">Icon</span>
@@ -84,65 +76,12 @@
 <p>In Tapestry 4, markup generation was based on generating a character stream. At
the lowest level, the fact that the output was in a markup format such as HTML, XHTML or WML
was not known. Higher levels, such as the IMarkupWriter interface (and its implementations)
provide the concept of markup generation: elements, attributes, start tags and end tags. This
technique breaks down when two elements are peers, and not in a parent/child relationship.
For example, the rendering of a FieldLabel component is affected by its companion TextField
component. Handling these cases in Tapestry 4 required a number of kludges and special cases.</p>
                     </div>
     </div>
-</div>
-
-<h1 id="DOM-DOMClasses">DOM Classes</h1>
-
-<p>The implementation of this DOM is part of Tapestry, despite the fact that several
third-party alternatives exist. This represents a desire to limit dependencies for the framework,
but also the Tapestry DOM is streamlined for initial creation, and a limited amount of subsequent
modification. Most DOM implementations are more sophisticated than needed for Tapestry, with
greater support for querying (often using XPath) and manipulation.</p>
-
-<p>Once the Document object is created, you don't directly create new DOM objects;
instead, each DOM object includes methods that create new sub-objects. This primarily applies
to the Element class, which can be a container of text, comments and other elements.</p>
-
-<h2 id="DOM-Document">Document</h2>
-
-<p>The <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/dom/Document.html">Document
Object</a> represents the an entire document, which is to say, an entire response to
be sent to the client.</p>
-
-<p>Documents will have a single root element. The newRootElement() method is used to
create the root element for the document.</p>
-
-<p>The Document class also has methods for setting and getting the DTD, adding comments
and text, and finding an element based on a path of element names.</p>
-
-<h2 id="DOM-Element">Element</h2>
-
-<p>An <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/dom/Element.html">Element
Object</a> represents an element of the document. Elements may have attributes, and
they may themselves contain other elements, as well as text and comments.</p>
-
-<p>The Element class has methods for searching, traversing and manipulating the DOM
after it is built.</p>
-
-<h1 id="DOM-DOMManipulation">DOM Manipulation</h1>
-
-<p>A powerful feature of Tapestry 5 is the ability to manipulate the structure and
ordering of the DOM after it has been rendered. For example, this can be used to alter the
output of a component that may otherwise be outside of your control.</p>
-
-<p>DOM manipulation is surprisingly fast, too.</p>
-
-<p>Methods on Node (and Element, which is a subclass of Node) allow an existing node
to be moved relative to an Element. Nodes may be moved before or after the Element, or may
be moved inside an Element at the top (the first child) or the bottom (the last child).</p>
-
-<p>Element's <code>attribute</code> method adds a new attribute name/value
pair to the Element. If an existing attribute with the specified name already exists, then
then the new value is ignored. This has implications when different pieces of code try to
add attributes to an Element ... the first to add an attribute will "win". Conversely, the
<code>forceAttributes</code> method can be used to update or remove an attribute.</p>
-
-<p>In addition, the children of an Element may be removed or a Node (and all of its
children) removed entirely.</p>
-
-<p>Finally, an Element may "pop": the Element is removed and replaced with its children.</p>
-
-<h1 id="DOM-MarkupWriter">MarkupWriter</h1>
-
-<p>The <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/MarkupWriter.html">MarkupWriter
interface</a> allows the structure of the document to be built while maintaining a streaming
metaphor.</p>
-
-<h2 id="DOM-element()andend()methods">element() and end() methods</h2>
-
-<p>Calls to element() create a new element within the tree, and may provide attributes
for the new element as well. Calls to write(), writeln() and writef() write text nodes within
the current element. <em>Every call to element() should be matched with a call to end()</em>,
which is used to move the current node up one level.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-
-  writer.element(&quot;img&quot;, &quot;src&quot;, &quot;icon.png&quot;,
&quot;width&quot;, 20, &quot;height&quot;, 20, alt, &quot;*&quot;);
+</div><h1 id="DOM-DOMClasses">DOM Classes</h1><p>The implementation
of this DOM is part of Tapestry, despite the fact that several third-party alternatives exist.
This represents a desire to limit dependencies for the framework, but also the Tapestry DOM
is streamlined for initial creation, and a limited amount of subsequent modification. Most
DOM implementations are more sophisticated than needed for Tapestry, with greater support
for querying (often using XPath) and manipulation.</p><p>Once the Document object
is created, you don't directly create new DOM objects; instead, each DOM object includes methods
that create new sub-objects. This primarily applies to the Element class, which can be a container
of text, comments and other elements.</p><h2 id="DOM-Document">Document</h2><p>The
<a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/dom/Document.html">Document
Object</a> represents the an entire document, which is to say, a
 n entire response to be sent to the client.</p><p>Documents will have a single
root element. The newRootElement() method is used to create the root element for the document.</p><p>The
Document class also has methods for setting and getting the DTD, adding comments and text,
and finding an element based on a path of element names.</p><h2 id="DOM-Element">Element</h2><p>An
<a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/dom/Element.html">Element
Object</a> represents an element of the document. Elements may have attributes, and
they may themselves contain other elements, as well as text and comments.</p><p>The
Element class has methods for searching, traversing and manipulating the DOM after it is built.</p><h1
id="DOM-DOMManipulation/Rewriting">DOM Manipulation/Rewriting</h1><p>A powerful
feature of Tapestry 5 is the ability to manipulate the structure and ordering of the DOM after
it has been rendered. For example, this can
  be used to alter the output of a component that may otherwise be outside of your control.</p><p>DOM
manipulation is surprisingly fast, too.</p><p>Methods on Node (and Element, which
is a subclass of Node) allow an existing node to be moved relative to an Element. Nodes may
be moved before or after the Element, or may be moved inside an Element at the top (the first
child) or the bottom (the last child).</p><p>Element's <code>attribute</code>
method adds a new attribute name/value pair to the Element. If an existing attribute with
the specified name already exists, then then the new value is ignored. This has implications
when different pieces of code try to add attributes to an Element ... the first to add an
attribute will "win". Conversely, the <code>forceAttributes</code> method can
be used to update or remove an attribute.</p><p>In addition, the children of an
Element may be removed or a Node (and all of its children) removed entirely.</p><p>Finally,
an Element may "pop": the E
 lement is removed and replaced with its children.</p><h1 id="DOM-MarkupWriter">MarkupWriter</h1><p>The
<a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/MarkupWriter.html">MarkupWriter
interface</a> allows the structure of the document to be built while maintaining a streaming
metaphor.</p><h2 id="DOM-element()andend()methods">element() and end() methods</h2><p>Calls
to element() create a new element within the tree, and may provide attributes for the new
element as well. Calls to write(), writeln() and writef() write text nodes within the current
element. <em>Every call to element() should be matched with a call to end()</em>,
which is used to move the current node up one level.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 writer.element(&quot;img&quot;, &quot;src&quot;, &quot;icon.png&quot;,
&quot;width&quot;, 20, &quot;height&quot;, 20, alt, &quot;*&quot;);
   writer.end();
 ]]></script>
-</div></div>
-
-<p>Note that end() must be called here, even though the &lt;img&gt; element
is empty (has no body). If the call to end() is omitted, then later elements created by calls
to element() will be nested <em>inside</em> the &lt;img&gt; element, which
is not desired.</p>
-
-<p>Again, <strong>every call to element() must be matched with a call to end()</strong>:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  writer.element(&quot;select&quot;, &quot;name&quot;, &quot;choice&quot;);
+</div></div><p>Note that end() must be called here, even though the &lt;img&gt;
element is empty (has no body). If the call to end() is omitted, then later elements created
by calls to element() will be nested <em>inside</em> the &lt;img&gt; element,
which is not desired.</p><p>Again, <strong>every call to element() must
be matched with a call to end()</strong>:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 writer.element(&quot;select&quot;, &quot;name&quot;, &quot;choice&quot;);
   
   for (String name : optionsNames)
   {
@@ -153,40 +92,11 @@
   
   writer.end();
 ]]></script>
-</div></div>
-
-<h2 id="DOM-attributes()">attributes()</h2>
-
-<p>Adds additional name/value pairs to the current element.</p>
-
-<p>When a value is null, no attribute is added.</p>
-
-<p>When a new name conflicts with an existing name, the new value is ignored. This
gives precedence to the first value specified for an attribute over any subsequent value.</p>
-
-<h2 id="DOM-write()">write()</h2>
-
-<p>The write() method writes text inside the current element. It scans the provided
text for XML control characters ('&lt;', '&gt;', and '&amp;') and converts them
to their XML entity equivalents ('&lt;', '&gt;', and '&amp;'). The result is correct,
safe, HTML/XML output even when the content (which may come from a template, or from an external
source such as a database) contains such problematic characters.</p>
-
-<h2 id="DOM-writef()">writef()</h2>
-
-<p>The writef() method formats an number of arguments. It uses a java.util.Formatter.
It is a convenience for formatting that ultimately invokes write().</p>
-
-<h2 id="DOM-writeRaw()">writeRaw()</h2>
-
-<p>The writeRaw() method writes unfiltered text into the DOM. When the DOM is rendered
to markup, the provided string is written to the output stream exactly as-is. Care should
be taken, as this can easily result invalid markup, or even markup that is not well formed.</p>
-
-<h2 id="DOM-comment()">comment()</h2>
-
-<p>Adds an XML comment. The comment delimiters will be supplied by Tapestry:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent
pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-
-  writer.comment(&quot;Start of JS Menu code&quot;);
+</div></div><h2 id="DOM-attributes()">attributes()</h2><p>Adds
additional name/value pairs to the current element.</p><p>When a value is null,
no attribute is added.</p><p>When a new name conflicts with an existing name,
the new value is ignored. This gives precedence to the first value specified for an attribute
over any subsequent value.</p><h2 id="DOM-write()">write()</h2><p>The
write() method writes text inside the current element. It scans the provided text for XML
control characters ('&lt;', '&gt;', and '&amp;') and converts them to their XML
entity equivalents ('&lt;', '&gt;', and '&amp;'). The result is correct, safe,
HTML/XML output even when the content (which may come from a template, or from an external
source such as a database) contains such problematic characters.</p><h2 id="DOM-writef()">writef()</h2><p>The
writef() method formats an number of arguments. It uses a java.util.Formatter. It is a convenience
for formatting that ultimately invokes write().</p><h2 id="DOM-
 writeRaw()">writeRaw()</h2><p>The writeRaw() method writes unfiltered text
into the DOM. When the DOM is rendered to markup, the provided string is written to the output
stream exactly as-is. Care should be taken, as this can easily result invalid markup, or even
markup that is not well formed.</p><h2 id="DOM-comment()">comment()</h2><p>Adds
an XML comment. The comment delimiters will be supplied by Tapestry:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 writer.comment(&quot;Start of JS Menu code&quot;);
   
 ]]></script>
-</div></div>
-</div>
+</div></div></div>
 </div>
 
 <div class="clearer"></div>



Mime
View raw message