3 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
4 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
6 * This file is part of Jalview.
8 * Jalview is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
21 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
22 <title>4.3. 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 4. Settings"><link rel="previous" href="project.html" title="4.2. Projects"><link rel="next" href="whitespace.html" title="4.3.2. 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 I. Jalopy core"><link rel="chapter" href="installation.html" title="Chapter 1. Installation"><link rel="chapter" href="build.html" title="Chapter 2. Building"><link rel="chapter" href="usage.html" title="Chapter 3. Usage"><link rel="chapter" href="settings.html" title="Chapter 4. Settings"><link rel="part" href="part-plugins.html" title="Part II. Plug-ins"><link rel="chapter" href="plugin-ant.html" title="Chapter 5. Ant Plug-in task"><link rel="chapter" href="plugin-console.html" title="Chapter 6. Console Application"><link rel="chapter" href="plugin-eclipse.html" title="Chapter 7. Eclipse Plug-in"><link rel="chapter" href="plugin-jbuilder.html" title="Chapter 8. JBuilder OpenTool"><link rel="chapter" href="plugin-jdev.html" title="Chapter 9. JDeveloper Extension"><link rel="chapter" href="plugin-jedit.html" title="Chapter 10. jEdit Plug-in"><link rel="chapter" href="plugin-netbeans.html" title="Chapter 11. NetBeans/Sun ONE Studio module"><link rel="appendix" href="dependencies.html" title="Appendix A. Library Dependencies"><link rel="appendix" href="license-bsd.html" title="Appendix B. The Jalopy BSD License"><link rel="appendix" href="license-antlr.html" title="Appendix C. ANTLR SOFTWARE RIGHTS"><link rel="appendix" href="license-apache.html" title="Appendix D. The Apache Software License, Version 1.1"><link rel="appendix" href="license-gnu.html" title="Appendix E. GNU GENERAL PUBLIC LICENSE Version 2, June 1991"><link rel="appendix" href="license-gnu-doc.html" title="Appendix F. GNU Free Documentation License Version 1.1, March 2000"><link rel="appendix" href="license-common-public.html" title="Appendix G. Common Public License Version 1.0"><link rel="appendix" href="license-sun-public.html" title="Appendix H. 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. Braces"><link rel="subsection" href="whitespace.html" title="4.3.2. White Space"><link rel="subsection" href="indentation.html" title="4.3.3. Indentation"><link rel="subsection" href="wrapping.html" title="4.3.4. Wrapping"><link rel="subsection" href="separation.html" title="4.3.5. Blank Lines"><link rel="subsection" href="comments.html" title="4.3.6. Comments"><link rel="subsection" href="imports.html" title="4.3.7. Imports"><link rel="subsection" href="environment.html" title="4.3.8. Environment"><link rel="subsection" href="javadoc.html" title="4.3.9. Javadoc"><link rel="subsection" href="header.html" title="4.3.10. Header"><link rel="subsection" href="footer.html" title="4.3.11. Footer"><link rel="subsection" href="sorting.html" title="4.3.12. Sorting"><link rel="subsection" href="misc.html" title="4.3.13. Misc">
23 <meta name="description" content="Jalopy Java Source Code Formatter Beautifier Pretty Printer">
24 <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))'>
25 </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> •
26 <a href="./download.html" class="navlink">Download</a> •
27 <a href="./docs.html" class="navlink">Documentation</a> •
28 <a href="./plugins.html" class="navlink">Plug-ins</a> •
29 <a href="./links.html" class="navlink">Links</a> •
30 <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> |
31 <a href="./history.html" class="navlink2">History</a> |
32 <a href="./manual.html" class="navlink2">Manual</a> |
33 <a href="./faq.html" class="navlink2">FAQ</a> |
34 <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">
35 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. Printer</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="project.html">Prev</a> </td><th width="60%" align="center">Chapter 4. Settings</th><td width="20%" align="right"> <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. Printer</h2></div></div><div></div></div><a class="indexterm" name="d0e1088"></a><p>
36 Lets you control all printer related settings.
37 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="braces"></a>4.3.1. Braces</h3></div></div><div></div></div><a class="indexterm" name="d0e1097"></a><p>
38 Controls the handling of curly braces (the Java block delimeters).
39 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="braces-style"></a>4.3.1.1. General</h4></div></div><div></div></div><a class="indexterm" name="d0e1105"></a><p>
40 Controls how the enclosing block delimeters - left and right curly
41 brace - are printed. You can either choose from a predefined set of common
42 styles or build one on your own.
43 </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. Styles</h5></div></div><div></div></div><p>
44 Controls which brace style will be used to lay out blocks.
45 </p><div class="itemizedlist"><ul type="disc"><li><p><a name="braces-style-c"></a>
47 </p><a class="indexterm" name="d0e1121"></a><p>
48 Selects the C brace style. This style is sometimes called "Allman style" or "BSD style".
49 </p><div class="example"><a name="ex-brace-style-c"></a><p class="title"><b>Example 4.1. C style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
51 <span class="bold"><b>{</b></span>
53 <span class="bold"><b>}</b></span>
55 <span class="bold"><b>{</b></span>
56 System.err.println("Finished");
57 <span class="bold"><b>}</b></span>
58 </pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-sun"></a>
60 </p><a class="indexterm" name="d0e1151"></a><p>
61 Selects the Sun brace style. Sometimes called "K&R style".
62 </p><div class="example"><a name="ex-brace-style-sun"></a><p class="title"><b>Example 4.2. Sun style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
63 if (!isDone) <span class="bold"><b>{</b></span>
65 <span class="bold"><b>}</b></span> else <span class="bold"><b>{</b></span>
66 System.err.println("Finished");
67 <span class="bold"><b>}</b></span>
68 </pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-gnu"></a>
70 </p><a class="indexterm" name="d0e1181"></a><p>
71 Selects the GNU brace style.
72 </p><div class="example"><a name="ex-brace-style-gnu"></a><p class="title"><b>Example 4.3. GNU style</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
74 <span class="bold"><b>{</b></span>
76 <span class="bold"><b>}</b></span>
78 <span class="bold"><b>{</b></span>
79 System.err.println("Finished");
80 <span class="bold"><b>}</b></span>
81 </pre></td></tr></table></div><p></p></li><li><p><a name="braces-style-custom"></a>
83 </p><a class="indexterm" name="d0e1211"></a><p>
84 Selecting this option will enable you to freely choose between the different brace
85 style options discussed below.
86 </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. Wrapping</h5></div></div><div></div></div><a class="indexterm" name="d0e1223"></a><p>
87 Controls the brace wrapping options.
88 </p><div class="itemizedlist"><ul type="disc"><li><p>
89 Newline before left brace
91 If enabled, always prints a newline before the left curly brace.
93 Newline after right brace
95 If enabled, prints a newline after the left curly brace (when possible).
97 Treat class/method blocks different
99 It is common in the Java developer community to have the opening brace
100 at the end of the line of the keyword for all types of blocks (Sun brace style).
101 One may find the C++ convention of treating class/interface and method/constructor
102 blocks different from other blocks useful. With this switch you can achieve
103 exactly that: if enabled, class/interface and method/constructor blocks are
104 then always printed in C brace style (newline before left brace).
105 </p></li><li><p><a name="braces-different-wrapped"></a>
106 Treat class/method blocks different if wrapped
108 With this switch enabled, the opening brace for class/interface or
109 method/constructor blocks will always be printed on a new line (C style), if
110 either the parameter list spawns several lines and a <tt class="literal">throws</tt>
111 clause follows, or one of the possible clauses (<tt class="literal">extends</tt>,
112 <tt class="literal">implements</tt>, <tt class="literal">throws</tt>) was wrapped.
113 </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. Whitespace</h5></div></div><div></div></div><a class="indexterm" name="d0e1266"></a><p>
114 Controls the indentation whitespace for the left and right curly brace.
115 </p><div class="itemizedlist"><ul type="disc"><li><p>
118 Number of spaces to print before the left curly brace.
122 Number of spaces to print after the left curly brace.
126 Number of spaces to print after the right curly brace.
127 </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. Misc</h4></div></div><div></div></div><p>
128 Controls miscellaneous brace options.
129 </p><div class="sect4" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="braces-insert"></a>4.3.1.2.1. Insert braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1297"></a><p>
130 Per definition braces are superfluous on single statements, but it is
131 a common recommendation that braces should be always used in such cases.
132 With this option, you can specify whether missing braces for single
133 statements should be inserted for the control statements <tt class="function">if</tt>,
134 <tt class="function">for</tt>, <tt class="function">while</tt> and <tt class="function">do-while</tt>.
136 Enabling this option for <tt class="function">while</tt> statements would render
137 </p><div class="example"><a name="ex-brace-insertion"></a><p class="title"><b>Example 4.4. Brace insertion</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
140 </pre></td></tr></table><p>
142 </p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
147 </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. Remove braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1334"></a><p>
148 It is permittable to remove braces in case they are superfluous. This not only
149 applies to the control statements <tt class="function">if</tt>, <tt class="function">for</tt>,
150 <tt class="function">while</tt> and <tt class="function">do-while</tt>, but also to every
151 block in general (remember a block is just a sequence of statements,
152 local class declarations and local variable declaration statements within
154 </p><div class="example"><a name="ex-brace-removal"></a><p class="title"><b>Example 4.5. Brace removal</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
155 for (int i = 0; i < 100; i++)
159 </pre></td></tr></table><p>
161 </p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
162 for (int i = 0; i < 100; i++)
164 </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. Empty braces</h5></div></div><div></div></div><a class="indexterm" name="d0e1366"></a><a class="indexterm" name="d0e1369"></a><p>
165 Controls how empty braces should be handled. If no option is selected,
166 they are left untouched.
167 </p><div class="example"><a name="ex-brace-empty"></a><p class="title"><b>Example 4.6. Empty braces</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
174 catch (IOException ignored)
178 </pre></td></tr></table></div><p>
179 All options don't apply to class/interface and method/constructor bodies but
180 are only used for control statements and blocks.
181 </p><div class="itemizedlist"><ul type="disc"><li><p><a name="braces-empty-statement"></a>
182 Insert empty statement
183 <a class="indexterm" name="d0e1387"></a>
184 <a class="indexterm" name="d0e1393"></a>
187 Inserts an empty statement to make it obvious for the reader that the empty braces
189 </p><div class="example"><a name="ex-braces-empty-statement"></a><p class="title"><b>Example 4.7. Empty braces with empty statement</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
196 catch (IOException ignored)
198 <span class="bold"><b>;</b></span>
201 </pre></td></tr></table></div></li></ul></div><div class="itemizedlist"><ul type="disc"><li><p>
203 </p><p><a name="braces-empty-cuddle"></a>
204 Cuddles the braces. They will be printed right after the control statement.
205 <a class="indexterm" name="d0e1413"></a>
206 <a class="indexterm" name="d0e1419"></a>
207 </p><div class="example"><a name="ex-braces-empty-cuddle"></a><p class="title"><b>Example 4.8. Cuddled empty braces</b></p><table border="0" bgcolor="#E0E0E0" class="shade"><tr><td><pre class="programlisting">
214 catch (IOException ignored) <span class="bold"><b>{}</b></span>
216 </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> </td><td width="20%" align="center"><a accesskey="u" href="settings.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="whitespace.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.2. Projects </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 4.3.2. 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">
217 Copyright © 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&type=1" width="1" height="1" border="0" hspace="0" vspace="0" alt=""></body></html>