get the html header comment right!
[jalview.git] / utils / jalopy / docs / printer.html
index 62e881d..2248952 100755 (executable)
  * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
 -->
+    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+  <html><head>
+      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+   <title>4.3.&nbsp;Printer</title><link rel="stylesheet" href="site.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="manual.html" title="Jalopy User Manual"><link rel="up" href="settings.html" title="Chapter&nbsp;4.&nbsp;Settings"><link rel="previous" href="project.html" title="4.2.&nbsp;Projects"><link rel="next" href="whitespace.html" title="4.3.2.&nbsp;White Space"><link rel="preface" href="dedication.html" title="Dedication"><link rel="preface" href="acknowledge.html" title="Acknowledgements"><link rel="preface" href="introduction.html" title="Introduction"><link rel="part" href="part-core.html" title="Part&nbsp;I.&nbsp;Jalopy core"><link rel="chapter" href="installation.html" title="Chapter&nbsp;1.&nbsp;Installation"><link rel="chapter" href="build.html" title="Chapter&nbsp;2.&nbsp;Building"><link rel="chapter" href="usage.html" title="Chapter&nbsp;3.&nbsp;Usage"><link rel="chapter" href="settings.html" title="Chapter&nbsp;4.&nbsp;Settings"><link rel="part" href="part-plugins.html" title="Part&nbsp;II.&nbsp;Plug-ins"><link rel="chapter" href="plugin-ant.html" title="Chapter&nbsp;5.&nbsp;Ant Plug-in task"><link rel="chapter" href="plugin-console.html" title="Chapter&nbsp;6.&nbsp;Console Application"><link rel="chapter" href="plugin-eclipse.html" title="Chapter&nbsp;7.&nbsp;Eclipse Plug-in"><link rel="chapter" href="plugin-jbuilder.html" title="Chapter&nbsp;8.&nbsp;JBuilder OpenTool"><link rel="chapter" href="plugin-jdev.html" title="Chapter&nbsp;9.&nbsp;JDeveloper Extension"><link rel="chapter" href="plugin-jedit.html" title="Chapter&nbsp;10.&nbsp;jEdit Plug-in"><link rel="chapter" href="plugin-netbeans.html" title="Chapter&nbsp;11.&nbsp;NetBeans/Sun ONE Studio module"><link rel="appendix" href="dependencies.html" title="Appendix&nbsp;A.&nbsp;Library Dependencies"><link rel="appendix" href="license-bsd.html" title="Appendix&nbsp;B.&nbsp;The Jalopy BSD License"><link rel="appendix" href="license-antlr.html" title="Appendix&nbsp;C.&nbsp;ANTLR SOFTWARE RIGHTS"><link rel="appendix" href="license-apache.html" title="Appendix&nbsp;D.&nbsp;The Apache Software License, Version 1.1"><link rel="appendix" href="license-gnu.html" title="Appendix&nbsp;E.&nbsp;GNU GENERAL PUBLIC LICENSE Version 2, June 1991"><link rel="appendix" href="license-gnu-doc.html" title="Appendix&nbsp;F.&nbsp;GNU Free Documentation License Version 1.1, March 2000"><link rel="appendix" href="license-common-public.html" title="Appendix&nbsp;G.&nbsp;Common Public License Version 1.0"><link rel="appendix" href="license-sun-public.html" title="Appendix&nbsp;H.&nbsp;SUN PUBLIC LICENSE Version 1.0"><link rel="index" href="ix01.html" title="Index"><link rel="subsection" href="printer.html#braces" title="4.3.1.&nbsp;Braces"><link rel="subsection" href="whitespace.html" title="4.3.2.&nbsp;White Space"><link rel="subsection" href="indentation.html" title="4.3.3.&nbsp;Indentation"><link rel="subsection" href="wrapping.html" title="4.3.4.&nbsp;Wrapping"><link rel="subsection" href="separation.html" title="4.3.5.&nbsp;Blank Lines"><link rel="subsection" href="comments.html" title="4.3.6.&nbsp;Comments"><link rel="subsection" href="imports.html" title="4.3.7.&nbsp;Imports"><link rel="subsection" href="environment.html" title="4.3.8.&nbsp;Environment"><link rel="subsection" href="javadoc.html" title="4.3.9.&nbsp;Javadoc"><link rel="subsection" href="header.html" title="4.3.10.&nbsp;Header"><link rel="subsection" href="footer.html" title="4.3.11.&nbsp;Footer"><link rel="subsection" href="sorting.html" title="4.3.12.&nbsp;Sorting"><link rel="subsection" href="misc.html" title="4.3.13.&nbsp;Misc">
+      <meta name="description" content="Jalopy Java Source Code Formatter Beautifier Pretty Printer"> 
+      <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://jalopy.sf.net" r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://jalopy.sf.net" r (n 0 s 0 v 0 l 0))'> 
+    </head><body id="toppage" bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table width="700" border="0" cellpadding="0" cellspacing="0" align="left"><tbody><tr><td><table cellpadding="0" cellspacing="0" width="100%" style="border:1px solid #336699"><tbody><tr><td height="16"></td></tr><tr><td bgcolor="#3399cc" height="1"></td></tr><tr style="border:none"><td style="border:none"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="logo">JALOPY</td><td class="sublogo" valign="bottom">Java Source Code Formatter Beautifier Pretty Printer</td></tr></tbody></table></td></tr><tr><td bgcolor="#3399cc" height="1"></td></tr><tr><td height="10"></td></tr><tr><td bgcolor="#ff8000" height="4"></td></tr><tr><td height="20" bgcolor="#336699" style="color:#ffffff;padding-left:10px"><a href="./index.html" class="navlink">Overview</a> &#149;
+                    <a href="./download.html" class="navlink">Download</a> &#149;
+                    <a href="./docs.html" class="navlink">Documentation</a> &#149;
+                    <a href="./plugins.html" class="navlink">Plug-ins</a> &#149;
+                    <a href="./links.html" class="navlink">Links</a> &#149;
+                    <a href="./contact.html" class="navlink">Contact</a></td></tr><tr><td height="1" bgcolor="#ffffff"></td></tr></tbody></table></td></tr><tr valign="top"><td valign="top" bgcolor="#ffffff"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td height="20" bgcolor="#faebd7" style="padding-left:15px"><a href="./features.html" class="navlink2">Features</a> |
+                    <a href="./history.html" class="navlink2">History</a> |
+                    <a href="./manual.html" class="navlink2">Manual</a> |
+                    <a href="./faq.html" class="navlink2">FAQ</a> |
+                    <a href="./api/index.html" class="navlink2">Javadoc</a></td></tr><tr><td height="20" bgcolor="#ffffff"></td></tr><tr><td bgcolor="#eeeecc" height="17" align="right" style="font-size:10px;padding-right:3px">
+                    This page generated: <strong>June 8 2004</strong></td></tr></tbody></table><table border="0" width="100%" cellspacing="0" cellpadding="5"><tr><td><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.3.&nbsp;Printer</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="project.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;Settings</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="whitespace.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="printer"></a>4.3.&nbsp;Printer</h2></div></div><div></div></div><a class="indexterm" name="d0e1088"></a><p>
+Lets you control all printer related settings.
+</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="braces"></a>4.3.1.&nbsp;Braces</h3></div></div><div></div></div><a class="indexterm" name="d0e1097"></a><p>
+Controls the handling of curly braces (the Java block delimeters).
+</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="braces-style"></a>4.3.1.1.&nbsp;General</h4></div></div><div></div></div><a class="indexterm" name="d0e1105"></a><p>
+Controls how the enclosing block delimeters - left and right curly
+brace - are printed. You can either choose from a predefined set of common
+styles or build one on your own.
+</p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-style-styles"></a>4.3.1.1.1.&nbsp;Styles</h5></div></div><div></div></div><p>
+Controls which brace style will be used to lay out blocks.
+</p><div class="itemizedlist"><ul type="disc"><li><p><a name="braces-style-c"></a>
+C style
+</p><a class="indexterm" name="d0e1121"></a><p>
+Selects the C brace style. This style is sometimes called "Allman style" or "BSD style".
+</p><div class="example"><a name="ex-brace-style-c"></a><p class="title"><b>Example&nbsp;4.1.&nbsp;C style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+if (!isDone)
+<span class="bold"><b>{</b></span>
+    doSomething();
+<span class="bold"><b>}</b></span>
+else
+<span class="bold"><b>{</b></span>
+    System.err.println("Finished");
+<span class="bold"><b>}</b></span>
+</pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-sun"></a>
+Sun style
+</p><a class="indexterm" name="d0e1151"></a><p>
+Selects the Sun brace style. Sometimes called "K&amp;R style".
+</p><div class="example"><a name="ex-brace-style-sun"></a><p class="title"><b>Example&nbsp;4.2.&nbsp;Sun style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+if (!isDone) <span class="bold"><b>{</b></span>
+    doSomething();
+<span class="bold"><b>}</b></span> else <span class="bold"><b>{</b></span>
+    System.err.println("Finished");
+<span class="bold"><b>}</b></span>
+</pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-gnu"></a>
+GNU style
+</p><a class="indexterm" name="d0e1181"></a><p>
+Selects the GNU brace style.
+</p><div class="example"><a name="ex-brace-style-gnu"></a><p class="title"><b>Example&nbsp;4.3.&nbsp;GNU style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+if (!isDone)
+  <span class="bold"><b>{</b></span>
+    doSomething();
+  <span class="bold"><b>}</b></span>
+else
+  <span class="bold"><b>{</b></span>
+    System.err.println("Finished");
+  <span class="bold"><b>}</b></span>
+</pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-custom"></a>
+Custom style
+</p><a class="indexterm" name="d0e1211"></a><p>
+Selecting this option will enable you to freely choose between the different brace
+style options discussed below.
+</p></li></ul></div></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-wrapping"></a>4.3.1.1.2.&nbsp;Wrapping</h5></div></div><div></div></div><a class="indexterm" name="d0e1223"></a><p>
+Controls the brace wrapping options.
+</p><div class="itemizedlist"><ul type="disc"><li><p>
+Newline before left brace
+</p><p>
+If enabled, always prints a newline before the left curly brace.
+</p></li><li><p>
+Newline after right brace
+</p><p>
+If enabled, prints a newline after the left curly brace (when possible).
+</p></li><li><p>
+Treat class/method blocks different
+</p><p>
+It is common in the Java developer community to have the opening brace
+at the end of the line of the keyword for all types of blocks (Sun brace style).
+One may find the C++ convention of treating class/interface and method/constructor
+blocks different from other blocks useful. With this switch you can achieve
+exactly that: if enabled, class/interface and method/constructor blocks are
+then always printed in C brace style (newline before left brace).
+</p></li><li><p><a name="braces-different-wrapped"></a>
+Treat class/method blocks different if wrapped
+</p><p>
+With this switch enabled, the opening brace for class/interface or
+method/constructor blocks will always be printed on a new line (C style), if
+either the parameter list spawns several lines and a <tt class="literal">throws</tt>
+clause follows, or one of the possible clauses (<tt class="literal">extends</tt>,
+<tt class="literal">implements</tt>, <tt class="literal">throws</tt>) was wrapped.
+</p></li></ul></div></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-whitespace"></a>4.3.1.1.3.&nbsp;Whitespace</h5></div></div><div></div></div><a class="indexterm" name="d0e1266"></a><p>
+Controls the indentation whitespace for the left and right curly brace.
+</p><div class="itemizedlist"><ul type="disc"><li><p>
+Before left brace
+</p><p>
+Number of spaces to print before the left curly brace.
+</p></li><li><p>
+After left brace
+</p><p>
+Number of spaces to print after the left curly brace.
+</p></li><li><p>
+After right brace
+</p><p>
+Number of spaces to print after the right curly brace.
+</p></li></ul></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="braces-misc"></a>4.3.1.2.&nbsp;Misc</h4></div></div><div></div></div><p>
+Controls miscellaneous brace options.
+</p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-insert"></a>4.3.1.2.1.&nbsp;Insert braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1297"></a><p>
+Per definition braces are superfluous on single statements, but it is
+a common recommendation that braces should be always used in such cases.
+With this option, you can specify whether missing braces for single
+statements should be inserted for the control statements <tt class="function">if</tt>,
+<tt class="function">for</tt>, <tt class="function">while</tt> and <tt class="function">do-while</tt>.
+</p><p>
+Enabling this option for <tt class="function">while</tt> statements would render
+</p><div class="example"><a name="ex-brace-insertion"></a><p class="title"><b>Example&nbsp;4.4.&nbsp;Brace insertion</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+while (!isDone)
+    doSomething();
+</pre></td></tr></table><p>
+into
+</p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+while (!isDone)
+{
+    doSomething();
+}
+</pre></td></tr></table></div><p></p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-remove"></a>4.3.1.2.2.&nbsp;Remove braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1334"></a><p>
+It is permittable to remove braces in case they are superfluous. This not only
+applies to the control statements <tt class="function">if</tt>, <tt class="function">for</tt>,
+<tt class="function">while</tt> and <tt class="function">do-while</tt>, but also to every
+block in general (remember a block is just a sequence of statements,
+local class declarations and local variable declaration statements within
+braces).
+</p><div class="example"><a name="ex-brace-removal"></a><p class="title"><b>Example&nbsp;4.5.&nbsp;Brace removal</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+for (int i = 0; i &lt; 100; i++)
+{
+    sum += value[i];
+}
+</pre></td></tr></table><p>
+would become
+</p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+for (int i = 0; i &lt; 100; i++)
+    sum += value[i];
+</pre></td></tr></table></div><p></p></div><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-empty"></a>4.3.1.2.3.&nbsp;Empty braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1366"></a><a class="indexterm" name="d0e1369"></a><p>
+Controls how empty braces should be handled. If no option is selected,
+they are left untouched.
+</p><div class="example"><a name="ex-brace-empty"></a><p class="title"><b>Example&nbsp;4.6.&nbsp;Empty braces</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+if (in != null)
+{
+    try
+    {
+        in.close();
+    }
+    catch (IOException ignored)
+    {
+    }
+}
+</pre></td></tr></table></div><p>
+All options don't apply to class/interface and method/constructor bodies but
+are only used for control statements and blocks.
+</p><div class="itemizedlist"><ul type="disc"><li><p><a name="braces-empty-statement"></a>
+Insert empty statement
+<a class="indexterm" name="d0e1387"></a>
+<a class="indexterm" name="d0e1393"></a>
+
+</p><p>
+Inserts an empty statement to make it obvious for the reader that the empty braces
+are intentional.
+</p><div class="example"><a name="ex-braces-empty-statement"></a><p class="title"><b>Example&nbsp;4.7.&nbsp;Empty braces with empty statement</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+if (in != null)
+{
+    try
+    {
+        in.close();
+    }
+    catch (IOException ignored)
+    {
+        <span class="bold"><b>;</b></span>
+    }
+}
+</pre></td></tr></table></div></li></ul></div><div class="itemizedlist"><ul type="disc"><li><p>
+Cuddle braces
+</p><p><a name="braces-empty-cuddle"></a>
+Cuddles the braces. They will be printed right after the control statement.
+<a class="indexterm" name="d0e1413"></a>
+<a class="indexterm" name="d0e1419"></a>
+</p><div class="example"><a name="ex-braces-empty-cuddle"></a><p class="title"><b>Example&nbsp;4.8.&nbsp;Cuddled empty braces</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
+if (in != null)
+{
+    try
+    {
+        in.close();
+    }
+    catch (IOException ignored) <span class="bold"><b>{}</b></span>
+}
+</pre></td></tr></table></div><p></p></li></ul></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="project.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="settings.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="whitespace.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.2.&nbsp;Projects&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;4.3.2.&nbsp;White Space</td></tr></table></div></td></tr></table></td></tr><tr><td bgcolor="#eeeecc" height="17" style="font-size:9px;padding-left:5px"><a href="#toppage">to top</a></td></tr><tr><td height="30"><br></td></tr><tr><td height="3"></td></tr><tr><td bgcolor="#336699" height="1"></td></tr><tr><td height="1"></td></tr><tr><td bgcolor="#336699" height="16"></td></tr><tr><td bgcolor="#ff9966" height="4"></td></tr><tr><td class="footer" align="center" height="15" valign="middle">
+            Copyright &copy; 2001-2004, <a class="footer" href="./contact.html">Marco Hunsicker</a>. All rights reserved. Hosted by <a href="http://sourceforge.net">SourceForge.net</a></td></tr></tbody></table><img src="http://sourceforge.net/sflogo.php?group_id=45216&amp;type=1" width="1" height="1" border="0" hspace="0" vspace="0" alt=""></body></html>