1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <!DOCTYPE chapter PUBLIC |
---|
3 | "-//Dawid Weiss//DTD DocBook V3.1-Based Extension for XML and graphics inclusion//EN" |
---|
4 | "../../../../lib/docbook/preprocess/dweiss-docbook-extensions.dtd"> |
---|
5 | <!-- |
---|
6 | $Id$ |
---|
7 | |
---|
8 | Copyright (C) 2007 Jari Hakkinen, Peter Johansson, Nicklas Nordborg, Martin Svensson |
---|
9 | |
---|
10 | This file is part of BASE - BioArray Software Environment. |
---|
11 | Available at http://base.thep.lu.se/ |
---|
12 | |
---|
13 | BASE is free software; you can redistribute it and/or |
---|
14 | modify it under the terms of the GNU General Public License |
---|
15 | as published by the Free Software Foundation; either version 3 |
---|
16 | of the License, or (at your option) any later version. |
---|
17 | |
---|
18 | BASE is distributed in the hope that it will be useful, |
---|
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | GNU General Public License for more details. |
---|
22 | |
---|
23 | You should have received a copy of the GNU General Public License |
---|
24 | along with this program; if not, write to the Free Software |
---|
25 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
26 | Boston, MA 02111-1307, USA. |
---|
27 | --> |
---|
28 | |
---|
29 | <chapter id="documentation"> |
---|
30 | <?dbhtml dir="write_doc"?> |
---|
31 | <title>Write documentation</title> |
---|
32 | |
---|
33 | <sect1 id="documentation.docbook"> |
---|
34 | <title>User, administrator and developer documentation with Docbook</title> |
---|
35 | |
---|
36 | <para> |
---|
37 | This chapter is for those who intent to contribute to the BASE2 user documentation. |
---|
38 | The chapter contains explanations of how the documentation is organized, what the |
---|
39 | different parts is about and other things that will make it easier to know |
---|
40 | where to insert new text. |
---|
41 | </para> |
---|
42 | <para> |
---|
43 | The documentation is written with the docbook standard, which is a bunch of defined XML |
---|
44 | elements and XSLT style sheets that are used to format the text. Later on in this chapter |
---|
45 | is a reference, over those docbook elements that are recommended to use when writing BASE2 |
---|
46 | documentation. Further information about docbook can be found in the on-line version of |
---|
47 | O'Reilly's |
---|
48 | <ulink url="http://www.docbook.org/tdg/en/html/">DocBook: The Definitive Guide</ulink> |
---|
49 | by Norman Walsh and Leonard Muellner. |
---|
50 | </para> |
---|
51 | |
---|
52 | |
---|
53 | <sect2 id="docbook.layout"> |
---|
54 | <title>Documentation layout</title> |
---|
55 | <para> |
---|
56 | The book, which is the main element in this docbook documentation, is divided into four |
---|
57 | separated parts, depending on who the information is directed to. What kind of |
---|
58 | documentation each one of these parts contains or should contain is described here |
---|
59 | below. |
---|
60 | </para> |
---|
61 | <variablelist> |
---|
62 | <varlistentry> |
---|
63 | <term>Overview documentation</term> |
---|
64 | <listitem> |
---|
65 | <para> |
---|
66 | The overview part contains, like the name says, an overview of BASE2. |
---|
67 | For example an explanation about what the purpose with BASE2 is, the terms |
---|
68 | that are used in the program and other general things that anyone that is |
---|
69 | interested in the program wants/needs to know before exploring it further. |
---|
70 | </para> |
---|
71 | </listitem> |
---|
72 | </varlistentry> |
---|
73 | <varlistentry> |
---|
74 | <term>User documentation</term> |
---|
75 | <listitem> |
---|
76 | <para> |
---|
77 | This part contains information that are relevant for the common BASE2-user. |
---|
78 | More or less should everything that a power user role or an user role needs |
---|
79 | to know be included here. |
---|
80 | </para> |
---|
81 | </listitem> |
---|
82 | </varlistentry> |
---|
83 | <varlistentry> |
---|
84 | <term>Administrator documentation</term> |
---|
85 | <listitem> |
---|
86 | <para> |
---|
87 | Things that only an administrator-role can do is documented in this part. It |
---|
88 | can be how to install the program, how to configure the server for best |
---|
89 | performance or other subjects that are related to the administration. |
---|
90 | </para> |
---|
91 | </listitem> |
---|
92 | </varlistentry> |
---|
93 | <varlistentry> |
---|
94 | <term>Developer documentation</term> |
---|
95 | <listitem> |
---|
96 | <para> |
---|
97 | Documentation concerning the participation of BASE2 development should be placed |
---|
98 | in this part, e.g. coding standards, the java doc from the source code, how |
---|
99 | to develop a plugin etc. |
---|
100 | </para> |
---|
101 | </listitem> |
---|
102 | </varlistentry> |
---|
103 | </variablelist> |
---|
104 | </sect2> |
---|
105 | |
---|
106 | |
---|
107 | <sect2 id="docbook.begin"> |
---|
108 | <title>Getting started</title> |
---|
109 | <para> |
---|
110 | Before writing any documentation in BASE2 there are a couple of things, some |
---|
111 | rules and standards, to have in mind. |
---|
112 | </para> |
---|
113 | <sect3 id="docbook.begin.sourcefiles"> |
---|
114 | <title>Organization of source files</title> |
---|
115 | <para> |
---|
116 | The source files of the documentation are located in |
---|
117 | <filename class='directory'><base-dir>/doc/src/docbook</filename>. |
---|
118 | The different parts of the documentation are organized into separate folders and |
---|
119 | each one of the folders contains one index file and one file for each chapter in |
---|
120 | that part. The index file joins the chapters, in current part/folder, together and |
---|
121 | does not really contain any text. The documentation root directory also contains an |
---|
122 | <filename class='headerfile'>index.xml</filename> |
---|
123 | file which joins the index files from the different parts together. |
---|
124 | </para> |
---|
125 | <figure id="docbook.figures.fileorganization"> |
---|
126 | <title>The organization of documentation files</title> |
---|
127 | <screenshot> |
---|
128 | <mediaobject> |
---|
129 | <imageobject> |
---|
130 | <imagedata fileref="figures/fileorganization.png" format="PNG" /> |
---|
131 | </imageobject> |
---|
132 | </mediaobject> |
---|
133 | </screenshot> |
---|
134 | </figure> |
---|
135 | <sect4 id="docbook.begin.sourcefiles.newfile"> |
---|
136 | <title>Create new chapter/file</title> |
---|
137 | <para> |
---|
138 | Most files in the documentation, except the index files, represents a chapter. |
---|
139 | Here is how to create a new chapter and include it in the main documentation: |
---|
140 | <orderedlist numeration='arabic' spacing='compact'> |
---|
141 | <listitem> |
---|
142 | <para> |
---|
143 | Create a new XML-file in the folder for the part where the new chapter |
---|
144 | should be included. Give it a name that is quite similar to the |
---|
145 | new chapter's title but use <userinput>_</userinput> instead of |
---|
146 | blank space and keep it down to one or a few words. |
---|
147 | </para> |
---|
148 | </listitem> |
---|
149 | <listitem> |
---|
150 | <para> |
---|
151 | Begin to write the chapter's body, here is an example: |
---|
152 | <example id="docbook.examples.chapterbody"> |
---|
153 | <title>Example of a chapter</title> |
---|
154 | <programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?> |
---|
155 | <!DOCTYPE chapter PUBLIC |
---|
156 | "-//Dawid Weiss//DTD DocBook V3.1-Based Extension for XML and graphics inclusion//EN" |
---|
157 | "../../../../lib/docbook/preprocess/dweiss-docbook-extensions.dtd"> |
---|
158 | |
---|
159 | <chapter id="example_chapter"> |
---|
160 | <?dbhtml dir="folder name to put the chapter's files in"?> |
---|
161 | <title>Example of a chapter </title> |
---|
162 | <para> |
---|
163 | … |
---|
164 | </para> |
---|
165 | <sect1 id="example_chapter.sect1"> |
---|
166 | <title>Example of top level section </title> |
---|
167 | <para> |
---|
168 | … |
---|
169 | </para> |
---|
170 | <sect2 id="example_chapter.sect1.sect2"> |
---|
171 | <title>Example of second level section </title> |
---|
172 | <para> |
---|
173 | … |
---|
174 | </para> |
---|
175 | <sect3 id="example_chapter.sect1.sect2.sect3"> |
---|
176 | <title>Example of third level section</title> |
---|
177 | <para> |
---|
178 | … |
---|
179 | </para> |
---|
180 | </sect3> |
---|
181 | </sect2> |
---|
182 | </sect1> |
---|
183 | </chapter></programlisting> |
---|
184 | </example> |
---|
185 | </para> |
---|
186 | <note> |
---|
187 | <para> |
---|
188 | Do not forget to include the |
---|
189 | <sgmltag>dbhtml</sgmltag> |
---|
190 | tag with the attribute |
---|
191 | <sgmltag class="attribute">dir</sgmltag> |
---|
192 | set to the value that the chapter's output folder should have as a |
---|
193 | name. |
---|
194 | </para> |
---|
195 | </note> |
---|
196 | </listitem> |
---|
197 | <listitem> |
---|
198 | <para> |
---|
199 | The last step is to get the new chapter included in the documentation. This is done by including the file's name in |
---|
200 | the file |
---|
201 | <filename>index.xml</filename> |
---|
202 | that's located in the current part's folder. |
---|
203 | The following example |
---|
204 | shows how the chapter that was created above is included in the user |
---|
205 | documentation part. |
---|
206 | </para> |
---|
207 | <example id="docbook.examples.include_chapter"> |
---|
208 | <title>Include a chapter</title> |
---|
209 | <programlisting language="xml:nogutter:nocontrols"><part id="userdoc"> |
---|
210 | <title>User documentation</title> |
---|
211 | <include file= "about.xml"/> |
---|
212 | <include file="webclient.xml"/> |
---|
213 | <include file="project_permission.xml"/> |
---|
214 | <include file="trashcan.xml"/> |
---|
215 | <include file="file_system.xml"/> |
---|
216 | <include file="jobs.xml"/> |
---|
217 | <include file="reporters.xml"/> |
---|
218 | <include file="annotations.xml"/> |
---|
219 | <include file="protocols.xml"/> |
---|
220 | <include file="hardware.xml"/> |
---|
221 | <include file="example_chapter.xml"/> |
---|
222 | <include file="software.xml"/> |
---|
223 | <include file="array_lims.xml"/> |
---|
224 | <include file="biomaterials.xml"/> |
---|
225 | <include file="experiments_analysis.xml"/> |
---|
226 | <include file="import_export_data.xml"/> |
---|
227 | </part></programlisting> |
---|
228 | </example> |
---|
229 | <note> |
---|
230 | <title>Order of chapters</title> |
---|
231 | <para> |
---|
232 | The chapters will come in the same order as they are included in |
---|
233 | the index file. |
---|
234 | </para> |
---|
235 | </note> |
---|
236 | </listitem> |
---|
237 | </orderedlist> |
---|
238 | Now it's only to go ahead with the documentation writing. |
---|
239 | </para> |
---|
240 | </sect4> |
---|
241 | </sect3> |
---|
242 | |
---|
243 | <sect3 id="docbook.begin.chunking"> |
---|
244 | <title>Controlling chunking</title> |
---|
245 | <para> |
---|
246 | We have configured docbook to create a new subdirectory for each |
---|
247 | <sgmltag class="starttag">chapter</sgmltag> and a new output file for each |
---|
248 | <sgmltag class="starttag">sect1</sgmltag> tag. In most cases this |
---|
249 | gives each page a relatively good size. Not too long and not too short. |
---|
250 | However, if a chapter contains many small <sgmltag class="starttag">sect1</sgmltag> |
---|
251 | sections (for example, <xref linkend="resources"/>), you end up with many |
---|
252 | pages with just a few lines of text on each page. This is not so |
---|
253 | good and can be avoided by adding <sgmltag class="attribute">chunked="0"</sgmltag> |
---|
254 | as an attribute to the <sgmltag class="starttag">chapter</sgmltag> tag, for example: |
---|
255 | </para> |
---|
256 | <programlisting language="xml"><chapter id="resources" chunked="0"></programlisting> |
---|
257 | <para> |
---|
258 | This will stop the chunking of <sgmltag class="starttag">sect1</sgmltag> |
---|
259 | sections in this chapter. |
---|
260 | </para> |
---|
261 | |
---|
262 | <para> |
---|
263 | On the other |
---|
264 | hand, if you have a <sgmltag class="starttag">sect1</sgmltag> |
---|
265 | that contains many long <sgmltag class="starttag">sect2</sgmltag> |
---|
266 | sections you might want to put each <sgmltag class="starttag">sect2</sgmltag> |
---|
267 | section in a separate chunk: |
---|
268 | </para> |
---|
269 | <programlisting language="xml"><sect1 id="sect.with.large.sect2" chunked="1"></programlisting> |
---|
270 | |
---|
271 | </sect3> |
---|
272 | |
---|
273 | <sect3 id="docbook.begin.id"> |
---|
274 | <title> |
---|
275 | The |
---|
276 | <sgmltag class="attribute">id</sgmltag> |
---|
277 | attribute |
---|
278 | </title> |
---|
279 | <para> |
---|
280 | Common to all elements is that they have an <sgmltag class="attribute">id</sgmltag> |
---|
281 | attribute that can be used to identify the |
---|
282 | element with. The value must be unique for the entire documentation. |
---|
283 | Most of the elements that are used inside the BASE2 documentation do not |
---|
284 | need to have an id if they do not are used in any cross references from other part of |
---|
285 | the text. |
---|
286 | </para> |
---|
287 | <para> |
---|
288 | There are some elements that always should have the |
---|
289 | <sgmltag class="attribute">id</sgmltag> |
---|
290 | set. Which these elements are and how the |
---|
291 | <sgmltag class="attribute">id</sgmltag> |
---|
292 | should look like for each one of those is described below. All values should be as |
---|
293 | short as possible and associated to the current element. The |
---|
294 | <sgmltag class="attribute">id</sgmltag> |
---|
295 | value should only consist of the lowercase characters a-z, '_' instead of blank |
---|
296 | spaces and '.' to symbolize the different levels in the document. |
---|
297 | <variablelist> |
---|
298 | <varlistentry> |
---|
299 | <term>chapter</term> |
---|
300 | <listitem> |
---|
301 | <para> |
---|
302 | The chapter should have an |
---|
303 | <sgmltag class="attribute">id</sgmltag> |
---|
304 | that is identical or almost identical to the chapter's title. |
---|
305 | <synopsis>chapter_title</synopsis> |
---|
306 | </para> |
---|
307 | </listitem> |
---|
308 | </varlistentry> |
---|
309 | <varlistentry> |
---|
310 | <term>sect1-sect5</term> |
---|
311 | <listitem> |
---|
312 | <para> |
---|
313 | The creation of a section's id is done by using the upper level's id |
---|
314 | and add the section's title or a part of the title. For |
---|
315 | <sect2> it should be like this; |
---|
316 | <synopsis>chapter_title.sect1_title.sect2_title</synopsis> |
---|
317 | </para> |
---|
318 | </listitem> |
---|
319 | </varlistentry> |
---|
320 | <varlistentry> |
---|
321 | <term>examples</term> |
---|
322 | <listitem> |
---|
323 | <para> |
---|
324 | The naming of an example's |
---|
325 | <sgmltag class="attribute">id</sgmltag> |
---|
326 | is a bit different compare to the chapter's and section's id. It |
---|
327 | should begin with the chapter's id followed by |
---|
328 | <userinput>examples</userinput> |
---|
329 | and the caption of the example. |
---|
330 | <synopsis>chapter_title.examples.example_caption</synopsis> |
---|
331 | </para> |
---|
332 | </listitem> |
---|
333 | </varlistentry> |
---|
334 | <varlistentry> |
---|
335 | <term>figures</term> |
---|
336 | <listitem> |
---|
337 | <para> |
---|
338 | The figure's |
---|
339 | <sgmltag class="attribute">id</sgmltag> |
---|
340 | should have the following layout |
---|
341 | <synopsis>chapter_title.figures.figure_name</synopsis> |
---|
342 | </para> |
---|
343 | </listitem> |
---|
344 | </varlistentry> |
---|
345 | </variablelist> |
---|
346 | </para> |
---|
347 | </sect3> |
---|
348 | <sect3 id="docbook.begin.helptext"> |
---|
349 | <title>Mark help texts</title> |
---|
350 | <para> |
---|
351 | This documentation is also use to create the help texts that show up |
---|
352 | in the web client when clicking on the question mark icons. |
---|
353 | The parts of the text that also should be used as help texts in the web must be |
---|
354 | inside |
---|
355 | <sgmltag class="starttag">helptext</sgmltag> |
---|
356 | tags. These texts will be exported to a XML-file at the same time as the |
---|
357 | HTML-documentation is generated. The generated XML-file is compatible with the help |
---|
358 | text importer in BASE2 and will be imported when running the update script or |
---|
359 | installation script. |
---|
360 | </para> |
---|
361 | <note> |
---|
362 | <para> |
---|
363 | The |
---|
364 | <sgmltag class="starttag">helptext</sgmltag> |
---|
365 | must be outside the |
---|
366 | <sgmltag class="starttag">para</sgmltag> |
---|
367 | tag but inside a |
---|
368 | <sgmltag class="starttag">sect</sgmltag> |
---|
369 | tag to work properly. Do not put any <sgmltag class="starttag">sect</sgmltag> |
---|
370 | tags inside the helptext. This will make the automatic chapter and section |
---|
371 | numbering confused. |
---|
372 | </para> |
---|
373 | </note> |
---|
374 | <para> |
---|
375 | The tag supports the following attributes |
---|
376 | <variablelist> |
---|
377 | <varlistentry> |
---|
378 | <term> |
---|
379 | <sgmltag class="attribute">external_id</sgmltag> |
---|
380 | </term> |
---|
381 | <listitem> |
---|
382 | <para> |
---|
383 | Is used to identify and to find a help text in the web client. |
---|
384 | BASE2's web client already has several IDs to help texts defined, |
---|
385 | it could therefore be a good idea to have a look in the |
---|
386 | program to see if there already is an external id to use for the |
---|
387 | particular help text. |
---|
388 | </para> |
---|
389 | </listitem> |
---|
390 | </varlistentry> |
---|
391 | <varlistentry> |
---|
392 | <term> |
---|
393 | <sgmltag class="attribute">title</sgmltag> |
---|
394 | </term> |
---|
395 | <listitem> |
---|
396 | <para> |
---|
397 | Is directly connected to the name/title property for a help text |
---|
398 | item in BASE2. |
---|
399 | </para> |
---|
400 | </listitem> |
---|
401 | </varlistentry> |
---|
402 | <varlistentry> |
---|
403 | <term> |
---|
404 | <sgmltag class="attribute">webonly</sgmltag> |
---|
405 | </term> |
---|
406 | <listitem> |
---|
407 | <para> |
---|
408 | If set to a non-zero value, the contents of the tag |
---|
409 | will not be outputted in the HTML or PDF documentation. |
---|
410 | This is useful for minor functionality that is not |
---|
411 | important enough to be mentioned in the documentation but has |
---|
412 | a help icon in the web client. |
---|
413 | </para> |
---|
414 | </listitem> |
---|
415 | </varlistentry> |
---|
416 | </variablelist> |
---|
417 | </para> |
---|
418 | <example id="docbook.examples.helptexttag"> |
---|
419 | <title>How to use the help text tag</title> |
---|
420 | <programlisting language="xml"><sect1> |
---|
421 | <helptext external_id="helptexts.external.id" title="The title"> |
---|
422 | The text that also should be used as a helptext in the program. |
---|
423 | <seeother> |
---|
424 | <other external_id="other.external.id"> |
---|
425 | Related info here...</other> |
---|
426 | </seeother> |
---|
427 | </helptext> |
---|
428 | </sect1></programlisting> |
---|
429 | </example> |
---|
430 | |
---|
431 | <sect4 id="docbook.begin.helptext.nohelp"> |
---|
432 | <title>Skip parts of a help text</title> |
---|
433 | <para> |
---|
434 | From time to time, it may happen that you find that |
---|
435 | some parts of the text inside a <sgmltag class="starttag">helptext</sgmltag> |
---|
436 | tag does not make sense. It may, for example, be a reference to |
---|
437 | an image or an example, or a link to another chapter or |
---|
438 | section. Put a <sgmltag class="starttag">nohelp</sgmltag> |
---|
439 | tag around the problematic part to avoid it from beeing |
---|
440 | outputted to the help texts. |
---|
441 | </para> |
---|
442 | <programlisting language="xml"><nohelp>see <xref linkend="chapter11" /></nohelp></programlisting> |
---|
443 | </sect4> |
---|
444 | |
---|
445 | <sect4 id="docbook.begin.helptext.link"> |
---|
446 | <title>Link to other help texts</title> |
---|
447 | |
---|
448 | <para> |
---|
449 | You can use <sgmltag class="starttag">seeother</sgmltag> and |
---|
450 | <sgmltag class="starttag">other</sgmltag> |
---|
451 | to create links between different help texts. The |
---|
452 | <sgmltag class="starttag">seeother</sgmltag> |
---|
453 | tag does not have any attributes and is just a container for one or more |
---|
454 | <sgmltag class="starttag">other</sgmltag> tags. Each tag requires a single attribute. |
---|
455 | </para> |
---|
456 | <variablelist> |
---|
457 | <varlistentry> |
---|
458 | <term> |
---|
459 | <sgmltag class="attribute">external_id</sgmltag> |
---|
460 | </term> |
---|
461 | <listitem> |
---|
462 | <para> |
---|
463 | The external ID of the other help text to link to. |
---|
464 | </para> |
---|
465 | </listitem> |
---|
466 | </varlistentry> |
---|
467 | </variablelist> |
---|
468 | |
---|
469 | <programlisting language="xml"><seeother> |
---|
470 | <other external_id="userpreferences.password">Change password</other> |
---|
471 | <other external_id="userpreferences.other">Other information</other> |
---|
472 | </seeother></programlisting> |
---|
473 | |
---|
474 | <para> |
---|
475 | We recommend that you place the links at the end of the |
---|
476 | help text section. The links will not show up in the HTML or PDF version. |
---|
477 | </para> |
---|
478 | </sect4> |
---|
479 | |
---|
480 | <sect4 id="docbook.begin.helptext.import"> |
---|
481 | <title>Import help texts into BASE</title> |
---|
482 | |
---|
483 | <para> |
---|
484 | Import the generated XML-file manually by uploading it from the |
---|
485 | <filename class="directory">data</filename> |
---|
486 | directory to the BASE-server's file system and then use the help text importer |
---|
487 | plugin to import the help text items from that file. |
---|
488 | </para> |
---|
489 | |
---|
490 | <para> |
---|
491 | The help texts can also be imported by running the TestHelp |
---|
492 | test program. In short, here are the commands you need to |
---|
493 | import the help texts: |
---|
494 | </para> |
---|
495 | |
---|
496 | <programlisting>ant docbook |
---|
497 | ant test |
---|
498 | cd build/test |
---|
499 | ./run.sh TestHelp</programlisting> |
---|
500 | </sect4> |
---|
501 | |
---|
502 | </sect3> |
---|
503 | <sect3 id="docbook.begin.generate"> |
---|
504 | <title>Generate output</title> |
---|
505 | |
---|
506 | <sect4 id="docbook.begin.generate.requirements"> |
---|
507 | <title>Requirements</title> |
---|
508 | <para> |
---|
509 | Those who have checked out the documentation source from repository or got the |
---|
510 | source from a distribution package needs to compile it to get the PDF and HTML |
---|
511 | documentation files. The compilation of the documentation source requires, beside Ant, that the XML-parser |
---|
512 | Xsltproc is installed on the local computer. More information about |
---|
513 | XsltProc and how it is installed, can be found at |
---|
514 | <ulink url="http://xmlsoft.org/XSLT/index.html"></ulink>. |
---|
515 | </para> |
---|
516 | <note> |
---|
517 | <para> |
---|
518 | There is an xml-parser in newer java-versions that can be used instead of |
---|
519 | XsltProc but the compilation will most likely take much much longer time. |
---|
520 | Therefore it's not recommended to be used when generating/compiling the |
---|
521 | documentation in BASE 2. |
---|
522 | </para> |
---|
523 | </note> |
---|
524 | </sect4> |
---|
525 | <sect4 id="docbook.begin.generate.compile"> |
---|
526 | <title>Compile - generate output files</title> |
---|
527 | <para> |
---|
528 | There are two different types of format that is generated from the documentation |
---|
529 | source. The format to view the documentation on-line will be the one with |
---|
530 | chunked HTML pages where each chapter and section of first level are on separate |
---|
531 | pages/files. The other format is a PDF-file that are most useful for printing |
---|
532 | and distribution. Those two types of output are generated with the ant-target: |
---|
533 | <command>ant docbook</command>. This documentation is also generated with |
---|
534 | <command>ant dist</command>, which will put the output files in the right location for distribution with |
---|
535 | BASE 2. |
---|
536 | </para> |
---|
537 | </sect4> |
---|
538 | </sect3> |
---|
539 | </sect2> |
---|
540 | |
---|
541 | <sect2 id="docbook.usedtags"> |
---|
542 | <title>Docbook tags to use</title> |
---|
543 | <para> |
---|
544 | The purpose with this section is to give an overview of those docbook elements that are |
---|
545 | most common in this documentation and to give some example on how they should be used. |
---|
546 | There will not be any detailed explanation of the tags here, instead the reader is |
---|
547 | recommended to get more information from |
---|
548 | <ulink url="http://www.docbook.org/tdg/en/html/docbook.html"> |
---|
549 | Docbook's documentation |
---|
550 | </ulink> |
---|
551 | or other references. |
---|
552 | </para> |
---|
553 | <sect3 id="docbook.usedtags.text"> |
---|
554 | <title>Text elements</title> |
---|
555 | <para> |
---|
556 | |
---|
557 | </para> |
---|
558 | <informaltable frame="none"> |
---|
559 | <tgroup cols="3" rowsep="1" colsep="1"> |
---|
560 | <colspec align="left" /> |
---|
561 | <colspec align="center" /> |
---|
562 | <colspec align="left" /> |
---|
563 | <thead> |
---|
564 | <row> |
---|
565 | <entry>Define</entry> |
---|
566 | <entry>Element to use</entry> |
---|
567 | <entry>Comments</entry> |
---|
568 | </row> |
---|
569 | </thead> |
---|
570 | <tbody> |
---|
571 | <row> |
---|
572 | <entry>Chapter</entry> |
---|
573 | <entry> |
---|
574 | <sgmltag class="starttag">chapter</sgmltag> |
---|
575 | </entry> |
---|
576 | <entry> |
---|
577 | <para> |
---|
578 | See |
---|
579 | <xref linkend="docbook.examples.chapterbody" /> |
---|
580 | </para> |
---|
581 | </entry> |
---|
582 | </row> |
---|
583 | <row> |
---|
584 | <entry>Title</entry> |
---|
585 | <entry> |
---|
586 | <sgmltag class="starttag">title</sgmltag> |
---|
587 | </entry> |
---|
588 | <entry> |
---|
589 | <xref linkend="docbook.examples.chapterbody" /> |
---|
590 | shows how this can be implemented |
---|
591 | </entry> |
---|
592 | </row> |
---|
593 | <row> |
---|
594 | <entry>Paragraph</entry> |
---|
595 | <entry> |
---|
596 | <sgmltag class="starttag">para</sgmltag> |
---|
597 | </entry> |
---|
598 | <entry>Used almost everywhere around real text.</entry> |
---|
599 | </row> |
---|
600 | <row> |
---|
601 | <entry>Top-level subsection</entry> |
---|
602 | <entry> |
---|
603 | <sgmltag class="starttag">sect1</sgmltag> |
---|
604 | </entry> |
---|
605 | <entry> |
---|
606 | See |
---|
607 | <xref linkend="docbook.begin.id" /> |
---|
608 | </entry> |
---|
609 | </row> |
---|
610 | <row> |
---|
611 | <entry>Second level section</entry> |
---|
612 | <entry> |
---|
613 | <sgmltag class="starttag">sect2</sgmltag> |
---|
614 | </entry> |
---|
615 | <entry> |
---|
616 | See |
---|
617 | <xref linkend="docbook.begin.id" /> |
---|
618 | </entry> |
---|
619 | </row> |
---|
620 | <row> |
---|
621 | <entry>Third level section</entry> |
---|
622 | <entry> |
---|
623 | <sgmltag class="starttag">sect3</sgmltag> |
---|
624 | </entry> |
---|
625 | <entry> |
---|
626 | See |
---|
627 | <xref linkend="docbook.begin.id" /> |
---|
628 | </entry> |
---|
629 | </row> |
---|
630 | <row> |
---|
631 | <entry>Fourth level section</entry> |
---|
632 | <entry> |
---|
633 | <sgmltag class="starttag">sect4</sgmltag> |
---|
634 | </entry> |
---|
635 | <entry></entry> |
---|
636 | </row> |
---|
637 | <row> |
---|
638 | <entry>Fith level section</entry> |
---|
639 | <entry> |
---|
640 | <sgmltag class="starttag">sect5</sgmltag> |
---|
641 | </entry> |
---|
642 | <entry></entry> |
---|
643 | </row> |
---|
644 | </tbody> |
---|
645 | </tgroup> |
---|
646 | </informaltable> |
---|
647 | |
---|
648 | <sect4 id="docbook.usedtags.text.keywords"> |
---|
649 | <title>Code elements</title> |
---|
650 | <para> |
---|
651 | These elements should be used to mark up words and phrases that have a special |
---|
652 | meaning in a coding environment, like method names, class names and |
---|
653 | user inputs, etc. |
---|
654 | </para> |
---|
655 | <informaltable frame="none"> |
---|
656 | <tgroup cols="3" rowsep="1" colsep="1"> |
---|
657 | <colspec align="left" /> |
---|
658 | <colspec align="center" /> |
---|
659 | <colspec align="left" /> |
---|
660 | <thead> |
---|
661 | <row> |
---|
662 | <entry>Define</entry> |
---|
663 | <entry>Element to use</entry> |
---|
664 | <entry>Comment</entry> |
---|
665 | </row> |
---|
666 | </thead> |
---|
667 | <tbody> |
---|
668 | <row> |
---|
669 | <entry>Class name</entry> |
---|
670 | <entry> |
---|
671 | <sgmltag class="starttag">classname</sgmltag> |
---|
672 | </entry> |
---|
673 | <entry> |
---|
674 | The name of a (Java) class. |
---|
675 | <sgmltag class="attribute">docapi</sgmltag>-attribute |
---|
676 | can be used to link the class to it's javadoc(only |
---|
677 | html-version). This is done by setting the attribute to the |
---|
678 | package name of the class, like |
---|
679 | <synopsis>net.sf.basedb.core</synopsis> |
---|
680 | </entry> |
---|
681 | </row> |
---|
682 | <row> |
---|
683 | <entry>Interface name</entry> |
---|
684 | <entry> |
---|
685 | <sgmltag class="starttag">interfacename</sgmltag> |
---|
686 | </entry> |
---|
687 | <entry> |
---|
688 | The name of an (Java) interface. Has a |
---|
689 | <sgmltag class="attribute">docapi</sgmltag>-attribute |
---|
690 | which has the same functionality as in |
---|
691 | <sgmltag>classname</sgmltag> above. |
---|
692 | </entry> |
---|
693 | </row> |
---|
694 | <row> |
---|
695 | <entry>User input</entry> |
---|
696 | <entry> |
---|
697 | <sgmltag class="starttag">userinput</sgmltag> |
---|
698 | </entry> |
---|
699 | <entry>Text that is entered by a user.</entry> |
---|
700 | </row> |
---|
701 | <row> |
---|
702 | <entry>Variable name</entry> |
---|
703 | <entry> |
---|
704 | <sgmltag class="starttag">varname</sgmltag> |
---|
705 | </entry> |
---|
706 | <entry>The name of a variable in a program.</entry> |
---|
707 | </row> |
---|
708 | <row> |
---|
709 | <entry>Constant</entry> |
---|
710 | <entry> |
---|
711 | <sgmltag class="starttag">constant</sgmltag> |
---|
712 | </entry> |
---|
713 | <entry>The name of a variable in a program.</entry> |
---|
714 | </row> |
---|
715 | <row> |
---|
716 | <entry>Method definition</entry> |
---|
717 | <entry> |
---|
718 | <sgmltag class="starttag">methodsynopsis</sgmltag> |
---|
719 | </entry> |
---|
720 | <entry> |
---|
721 | See |
---|
722 | <xref linkend="docbook.examples.methodimpl" /> |
---|
723 | </entry> |
---|
724 | </row> |
---|
725 | <row> |
---|
726 | <entry>Modifier of a method</entry> |
---|
727 | <entry> |
---|
728 | <sgmltag class="starttag">modifier</sgmltag> |
---|
729 | </entry> |
---|
730 | <entry> |
---|
731 | See |
---|
732 | <xref linkend="docbook.examples.methodimpl" /> |
---|
733 | </entry> |
---|
734 | </row> |
---|
735 | <row> |
---|
736 | <entry>Classification of return value</entry> |
---|
737 | <entry> |
---|
738 | <sgmltag class="starttag">type</sgmltag> |
---|
739 | </entry> |
---|
740 | <entry> |
---|
741 | See |
---|
742 | <xref linkend="docbook.examples.methodimpl" /> |
---|
743 | </entry> |
---|
744 | </row> |
---|
745 | <row> |
---|
746 | <entry>Method name</entry> |
---|
747 | <entry> |
---|
748 | <sgmltag class="starttag">methodname</sgmltag> |
---|
749 | </entry> |
---|
750 | <entry> |
---|
751 | See |
---|
752 | <xref linkend="docbook.examples.methodimpl" /> |
---|
753 | </entry> |
---|
754 | </row> |
---|
755 | <row> |
---|
756 | <entry>No parameter/type</entry> |
---|
757 | <entry> |
---|
758 | <sgmltag class="starttag">void</sgmltag> |
---|
759 | </entry> |
---|
760 | <entry> |
---|
761 | See |
---|
762 | <xref linkend="docbook.examples.methodimpl" /> |
---|
763 | </entry> |
---|
764 | </row> |
---|
765 | <row> |
---|
766 | <entry>Define a parameter</entry> |
---|
767 | <entry> |
---|
768 | <sgmltag class="starttag">methodparam</sgmltag> |
---|
769 | </entry> |
---|
770 | <entry> |
---|
771 | See |
---|
772 | <xref linkend="docbook.examples.methodimpl1" /> |
---|
773 | </entry> |
---|
774 | </row> |
---|
775 | <row> |
---|
776 | <entry>Parameter type</entry> |
---|
777 | <entry> |
---|
778 | <sgmltag class="starttag">type</sgmltag> |
---|
779 | </entry> |
---|
780 | <entry> |
---|
781 | See |
---|
782 | <xref linkend="docbook.examples.methodimpl1" /> |
---|
783 | </entry> |
---|
784 | </row> |
---|
785 | <row> |
---|
786 | <entry>Parameter name</entry> |
---|
787 | <entry> |
---|
788 | <sgmltag class="starttag">parameter</sgmltag> |
---|
789 | </entry> |
---|
790 | <entry> |
---|
791 | See |
---|
792 | <xref linkend="docbook.examples.methodimpl1" /> |
---|
793 | </entry> |
---|
794 | </row> |
---|
795 | </tbody> |
---|
796 | </tgroup> |
---|
797 | </informaltable> |
---|
798 | <para> |
---|
799 | Follow one of the examples below to insert a method definition in the document. |
---|
800 | </para> |
---|
801 | <example id="docbook.examples.methodimpl"> |
---|
802 | <title> |
---|
803 | Method with no arguments and a return value |
---|
804 | </title> |
---|
805 | <programlisting language="xml"> |
---|
806 | <methodsynopsis language="java"> |
---|
807 | <modifier>public</modifier> |
---|
808 | <type>Plugin.MainType</type> |
---|
809 | <methodname>getMainType</methodname> |
---|
810 | <void /> |
---|
811 | </methodsynopsis> |
---|
812 | </programlisting> |
---|
813 | </example> |
---|
814 | <example id="docbook.examples.methodimpl1"> |
---|
815 | <title> |
---|
816 | Method with arguments and no return value |
---|
817 | </title> |
---|
818 | <programlisting language="xml"> |
---|
819 | <methodsynopsis language="java"> |
---|
820 | <modifier>public</modifier> |
---|
821 | <void /> |
---|
822 | <methodname>init</methodname> |
---|
823 | <methodparam> |
---|
824 | <type>SessionControl</type> |
---|
825 | <parameter>sc</parameter> |
---|
826 | </methodparam> |
---|
827 | <methodparam> |
---|
828 | <type>ParameterValues</type> |
---|
829 | <parameter>configuration</parameter> |
---|
830 | </methodparam> |
---|
831 | <methodparam> |
---|
832 | <type>ParameterValues</type> |
---|
833 | <parameter>job</parameter> |
---|
834 | </methodparam> |
---|
835 | </methodsynopsis> |
---|
836 | </programlisting> |
---|
837 | </example> |
---|
838 | |
---|
839 | </sect4> |
---|
840 | <sect4 id="docbook.usedtags.text.gui"> |
---|
841 | <title>Gui elements</title> |
---|
842 | <para> |
---|
843 | Docbook has some elements that can be used to symbolize gui items in a program. |
---|
844 | Following list contains the ones that are most common in this document. |
---|
845 | </para> |
---|
846 | <informaltable frame="none"> |
---|
847 | <tgroup cols="3" rowsep="1" colsep="1"> |
---|
848 | <colspec align="left" /> |
---|
849 | <colspec align="center" /> |
---|
850 | <colspec align="left" /> |
---|
851 | <thead> |
---|
852 | <row> |
---|
853 | <entry>Define</entry> |
---|
854 | <entry>Element to use</entry> |
---|
855 | <entry>Comment</entry> |
---|
856 | </row> |
---|
857 | </thead> |
---|
858 | <tbody> |
---|
859 | <row> |
---|
860 | <entry>Button</entry> |
---|
861 | <entry> |
---|
862 | <sgmltag class="starttag">guibutton</sgmltag> |
---|
863 | </entry> |
---|
864 | <entry></entry> |
---|
865 | </row> |
---|
866 | <row> |
---|
867 | <entry>Label</entry> |
---|
868 | <entry> |
---|
869 | <sgmltag class="starttag">guilabel</sgmltag> |
---|
870 | </entry> |
---|
871 | <entry></entry> |
---|
872 | </row> |
---|
873 | <row> |
---|
874 | <entry>Menu choice</entry> |
---|
875 | <entry> |
---|
876 | <sgmltag class="starttag">menuchoice</sgmltag> |
---|
877 | </entry> |
---|
878 | <entry></entry> |
---|
879 | </row> |
---|
880 | <row> |
---|
881 | <entry>Menu</entry> |
---|
882 | <entry> |
---|
883 | <sgmltag class="starttag">guimenu</sgmltag> |
---|
884 | </entry> |
---|
885 | <entry></entry> |
---|
886 | </row> |
---|
887 | <row> |
---|
888 | <entry>Submenu</entry> |
---|
889 | <entry> |
---|
890 | <sgmltag class="starttag">guisubmenu</sgmltag> |
---|
891 | </entry> |
---|
892 | <entry></entry> |
---|
893 | </row> |
---|
894 | <row> |
---|
895 | <entry>Menu item</entry> |
---|
896 | <entry> |
---|
897 | <sgmltag class="starttag">guimenuitem</sgmltag> |
---|
898 | </entry> |
---|
899 | <entry></entry> |
---|
900 | </row> |
---|
901 | <row> |
---|
902 | <entry>Icon</entry> |
---|
903 | <entry> |
---|
904 | <sgmltag class="starttag">guiicon</sgmltag> |
---|
905 | </entry> |
---|
906 | <entry></entry> |
---|
907 | </row> |
---|
908 | </tbody> |
---|
909 | </tgroup> |
---|
910 | </informaltable> |
---|
911 | <para> |
---|
912 | <xref linkend="docbook.examples.guielements" /> |
---|
913 | shows how the menu choice in figure |
---|
914 | <xref linkend="docbook.figures.menuchoice" /> |
---|
915 | can be described. |
---|
916 | </para> |
---|
917 | <figure id="docbook.figures.menuchoice"> |
---|
918 | <title>Menu choice</title> |
---|
919 | <screenshot> |
---|
920 | <mediaobject> |
---|
921 | <imageobject> |
---|
922 | <imagedata |
---|
923 | fileref="figures/menuchoice.png" format="PNG" |
---|
924 | /> |
---|
925 | </imageobject> |
---|
926 | </mediaobject> |
---|
927 | </screenshot> |
---|
928 | </figure> |
---|
929 | <example id="docbook.examples.guielements"> |
---|
930 | <title>Describe a menu choice</title> |
---|
931 | <programlisting language="xml"> |
---|
932 | <menuchoice> |
---|
933 | <guimenu>Administrate</guimenu> |
---|
934 | <guisubmenu>Plugins</guisubmenu> |
---|
935 | <guimenuitem>Types</guimenuitem> |
---|
936 | </menuchoice> |
---|
937 | </programlisting> |
---|
938 | <para> |
---|
939 | In the text it will look like this: |
---|
940 | <menuchoice> |
---|
941 | <guimenu>Administrate</guimenu> |
---|
942 | <guisubmenu>Plugins</guisubmenu> |
---|
943 | <guimenuitem>Types</guimenuitem> |
---|
944 | </menuchoice> |
---|
945 | </para> |
---|
946 | </example> |
---|
947 | </sect4> |
---|
948 | </sect3> |
---|
949 | <sect3 id="docbook.usedtags.images"> |
---|
950 | <title>Images and figures</title> |
---|
951 | <para> |
---|
952 | Images and figures are normally implemented like the following example. The |
---|
953 | image-file must be located in |
---|
954 | <filename class="directory">doc/src/docbook/figures</filename>, |
---|
955 | otherwise the image will not be visible in the generated output files. |
---|
956 | </para> |
---|
957 | |
---|
958 | <example id="docbook.examples.screenshot"> |
---|
959 | <title>Screen-shot in the documentation</title> |
---|
960 | <para> |
---|
961 | <xref linkend="webclient.figures.homepage" /> |
---|
962 | is implemented with the following code |
---|
963 | </para> |
---|
964 | <programlisting language="xml"><figure id="docbook.figures.menuchoice"> |
---|
965 | <title>The home page</title> |
---|
966 | <screenshot> |
---|
967 | <mediaobject> |
---|
968 | <imageobject> |
---|
969 | <imagedata |
---|
970 | scalefit="1" |
---|
971 | width="100%" |
---|
972 | fileref="figures/homapage.png" format="PNG" |
---|
973 | /> |
---|
974 | </imageobject> |
---|
975 | </mediaobject> |
---|
976 | </screenshot> |
---|
977 | </figure></programlisting> |
---|
978 | </example> |
---|
979 | <warning> |
---|
980 | <para> |
---|
981 | When using images in docbook you will always have problems with image |
---|
982 | resolution and scaling. Since we are generating output for both HTML |
---|
983 | and PDF it is even worse. What we have found to work is this: |
---|
984 | |
---|
985 | <itemizedlist> |
---|
986 | <listitem> |
---|
987 | <para> |
---|
988 | The screenshots must be saved without any resolution information |
---|
989 | in them, or with the resolution set to 96 dpi. We have configured PDF to |
---|
990 | use 96 dpi instead of 72 dpi to make the HTML and PDF output |
---|
991 | look as similar as possible. |
---|
992 | </para> |
---|
993 | </listitem> |
---|
994 | |
---|
995 | <listitem> |
---|
996 | <para> |
---|
997 | Scaling in HTML has been disabled. The images will always be the |
---|
998 | same size (number of pixels) as they actually are. Please, do not |
---|
999 | make the screenshots too wide! |
---|
1000 | |
---|
1001 | <tip> |
---|
1002 | <para> |
---|
1003 | Change your BASE preferences, see |
---|
1004 | <xref linkend="webclient.configuration.preferences" />, |
---|
1005 | to a smaller font size or use the zoom functionality in the web |
---|
1006 | browser to make more information fit in the same image width. |
---|
1007 | </para> |
---|
1008 | </tip> |
---|
1009 | |
---|
1010 | </para> |
---|
1011 | </listitem> |
---|
1012 | |
---|
1013 | <listitem> |
---|
1014 | <para> |
---|
1015 | For small images, less than the width of the PDF page, |
---|
1016 | do not specify scaling factors or widths. |
---|
1017 | </para> |
---|
1018 | </listitem> |
---|
1019 | |
---|
1020 | <listitem> |
---|
1021 | <para> |
---|
1022 | Images that are wider than the PDF page will be clipped. To |
---|
1023 | prevent this you must add the following attributes to the |
---|
1024 | <sgmltag class="starttag">imagedata</sgmltag> tag: |
---|
1025 | <code>scalefit="1" width="100%"</code>. This will scale down |
---|
1026 | the image so that it fits the available width. |
---|
1027 | </para> |
---|
1028 | </listitem> |
---|
1029 | |
---|
1030 | <listitem> |
---|
1031 | <para> |
---|
1032 | If you still need to scale the image differently in the PDF use |
---|
1033 | the <sgmltag>width</sgmltag> and <sgmltag>depth</sgmltag> |
---|
1034 | attributes. |
---|
1035 | </para> |
---|
1036 | </listitem> |
---|
1037 | </itemizedlist> |
---|
1038 | </para> |
---|
1039 | </warning> |
---|
1040 | </sect3> |
---|
1041 | <sect3 id="docbook.usedtags.examples"> |
---|
1042 | <title>Examples and program listing</title> |
---|
1043 | <para> |
---|
1044 | Following describes how to insert an example in the documentation.The examples in |
---|
1045 | this document are often some kind of program listing but they can still be examples |
---|
1046 | of something else. |
---|
1047 | </para> |
---|
1048 | <warning> |
---|
1049 | <title>Use spaces instead of tabs for indentation</title> |
---|
1050 | <para> |
---|
1051 | Use spaces for indentation in program listing, this is because of the |
---|
1052 | tab-indentations will sooner or later cause corrupt text. |
---|
1053 | </para> |
---|
1054 | </warning> |
---|
1055 | |
---|
1056 | <itemizedlist> |
---|
1057 | <listitem> |
---|
1058 | <simpara> |
---|
1059 | The verbatim text is splitted into several lines if the text contains |
---|
1060 | more then 80 characters. This could give the text an unwanted look and |
---|
1061 | it's therefore recommended to manually insert new lines to have controll |
---|
1062 | over layout of the text |
---|
1063 | </simpara> |
---|
1064 | </listitem> |
---|
1065 | <listitem> |
---|
1066 | <simpara> |
---|
1067 | We have added support for syntax highlightning of program |
---|
1068 | examples in the HTML version. To enable it add a |
---|
1069 | <sgmltag class="attribute">language</sgmltag> |
---|
1070 | attribute with one of the following values: <constant>java</constant>, |
---|
1071 | <constant>xml</constant> or <constant>sql</constant>. The highlightning engine |
---|
1072 | support more languages. To add support for those in docbook, change |
---|
1073 | the <filename>customized.chunked.xsl</filename> file. The syntax highlightning |
---|
1074 | engine doesn't handle markup inside the <sgmltag class="starttag">programlisting</sgmltag> |
---|
1075 | tag very well. You should avoid that. By default, java program examples |
---|
1076 | include line numbering, but not xml examples. To disable line numbering |
---|
1077 | for java add <constant>:nogutter</constant> to the <sgmltag>language</sgmltag> |
---|
1078 | attribute: <constant><programlisting language="java:nogutter"></constant>. |
---|
1079 | To enable line numbering for xml add <constant>:gutter</constant> to the <sgmltag>language</sgmltag> |
---|
1080 | attribute: <constant><programlisting language="xml:gutter"></constant>. |
---|
1081 | </simpara> |
---|
1082 | </listitem> |
---|
1083 | </itemizedlist> |
---|
1084 | |
---|
1085 | <example id="docbook.examples.example"> |
---|
1086 | <title>Example in the documentation</title> |
---|
1087 | <para> |
---|
1088 | This shows how |
---|
1089 | <xref linkend="net.sf.basedb.core.plugin.Plugin.getAbout" /> |
---|
1090 | is written in the corresponding XML-file. |
---|
1091 | </para> |
---|
1092 | <programlisting language="xml"> |
---|
1093 | <example id="net.sf.basedb.core.plugin.Plugin.getAbout"> |
---|
1094 | <title>A typical implementation stores this information |
---|
1095 | in a static field</title> |
---|
1096 | <programlisting language="java"> |
---|
1097 | private static final About about = new AboutImpl |
---|
1098 | ( |
---|
1099 | "Spot images creator", |
---|
1100 | "Converts a full-size scanned image into smaller preview jpg " + |
---|
1101 | "images for each individual spot.", |
---|
1102 | "2.0", |
---|
1103 | "2006, Department of Theoretical Physics, Lund University", |
---|
1104 | null, |
---|
1105 | "base@thep.lu.se", |
---|
1106 | "http://base.thep.lu.se" |
---|
1107 | ); |
---|
1108 | |
---|
1109 | public About getAbout() |
---|
1110 | { |
---|
1111 | return about; |
---|
1112 | } |
---|
1113 | </programlisting> |
---|
1114 | </example> |
---|
1115 | </programlisting> |
---|
1116 | </example> |
---|
1117 | </sect3> |
---|
1118 | <sect3 id="docbook.usedtags.admonitions"> |
---|
1119 | <title>Admonitions</title> |
---|
1120 | <para> |
---|
1121 | The admonitions that are used in this document can be found in the table below. |
---|
1122 | </para> |
---|
1123 | <informaltable frame="none"> |
---|
1124 | <tgroup cols="3" rowsep="1" colsep="1"> |
---|
1125 | <colspec align="left" /> |
---|
1126 | <colspec align="center" /> |
---|
1127 | <colspec align="left" /> |
---|
1128 | <thead> |
---|
1129 | <row> |
---|
1130 | <entry>Define</entry> |
---|
1131 | <entry>Element to use</entry> |
---|
1132 | <entry>Comment</entry> |
---|
1133 | </row> |
---|
1134 | </thead> |
---|
1135 | <tbody> |
---|
1136 | <row> |
---|
1137 | <entry>Warning text</entry> |
---|
1138 | <entry> |
---|
1139 | <sgmltag class="starttag">warning</sgmltag> |
---|
1140 | </entry> |
---|
1141 | <entry></entry> |
---|
1142 | </row> |
---|
1143 | <row> |
---|
1144 | <entry>Notification text</entry> |
---|
1145 | <entry> |
---|
1146 | <sgmltag class="starttag">note</sgmltag> |
---|
1147 | </entry> |
---|
1148 | <entry></entry> |
---|
1149 | </row> |
---|
1150 | <row> |
---|
1151 | <entry>A tip</entry> |
---|
1152 | <entry> |
---|
1153 | <sgmltag class="starttag">tip</sgmltag> |
---|
1154 | </entry> |
---|
1155 | <entry></entry> |
---|
1156 | </row> |
---|
1157 | <row> |
---|
1158 | <entry>Important text</entry> |
---|
1159 | <entry> |
---|
1160 | <sgmltag class="starttag">important</sgmltag> |
---|
1161 | </entry> |
---|
1162 | <entry></entry> |
---|
1163 | </row> |
---|
1164 | <row> |
---|
1165 | <entry>Something to be cautious about</entry> |
---|
1166 | <entry> |
---|
1167 | <sgmltag class="starttag">caution</sgmltag> |
---|
1168 | </entry> |
---|
1169 | <entry></entry> |
---|
1170 | </row> |
---|
1171 | </tbody> |
---|
1172 | </tgroup> |
---|
1173 | </informaltable> |
---|
1174 | </sect3> |
---|
1175 | <sect3 id="docbook.usedtags.lists"> |
---|
1176 | <title>Lists</title> |
---|
1177 | <para> |
---|
1178 | Following items can be used to define different kind of lists in the documentation. |
---|
1179 | Some common elements for the lists are also described here. |
---|
1180 | </para> |
---|
1181 | <informaltable frame="none"> |
---|
1182 | <tgroup cols="3" rowsep="1" colsep="1"> |
---|
1183 | <colspec align="left" /> |
---|
1184 | <colspec align="center" /> |
---|
1185 | <colspec align="left" /> |
---|
1186 | <thead> |
---|
1187 | <row> |
---|
1188 | <entry>Define</entry> |
---|
1189 | <entry>Element</entry> |
---|
1190 | <entry>Comment</entry> |
---|
1191 | </row> |
---|
1192 | </thead> |
---|
1193 | <tbody> |
---|
1194 | <row> |
---|
1195 | <entry>None-ordered list</entry> |
---|
1196 | <entry> |
---|
1197 | <sgmltag class="starttag">itemizedlist</sgmltag> |
---|
1198 | </entry> |
---|
1199 | <entry></entry> |
---|
1200 | </row> |
---|
1201 | <row> |
---|
1202 | <entry>Term definition list</entry> |
---|
1203 | <entry> |
---|
1204 | <sgmltag class="starttag">variablelist</sgmltag> |
---|
1205 | </entry> |
---|
1206 | <entry></entry> |
---|
1207 | </row> |
---|
1208 | <row> |
---|
1209 | <entry>Ordered list</entry> |
---|
1210 | <entry> |
---|
1211 | <sgmltag class="starttag">orderedlist</sgmltag> |
---|
1212 | </entry> |
---|
1213 | <entry></entry> |
---|
1214 | </row> |
---|
1215 | <row> |
---|
1216 | <entry>List item</entry> |
---|
1217 | <entry> |
---|
1218 | <sgmltag class="starttag">listitem</sgmltag> |
---|
1219 | </entry> |
---|
1220 | <entry></entry> |
---|
1221 | </row> |
---|
1222 | </tbody> |
---|
1223 | </tgroup> |
---|
1224 | </informaltable> |
---|
1225 | <para>The example below shows how to create a list for term definition in the text.</para> |
---|
1226 | <example id="docbook.examples.variablelist"> |
---|
1227 | <title>Example how to write a variable list</title> |
---|
1228 | <programlisting language="xml"> |
---|
1229 | <variablelist> |
---|
1230 | <varlistentry> |
---|
1231 | <term>Term1</term> |
---|
1232 | <listitem> |
---|
1233 | <para> |
---|
1234 | Definition/explanation of the term |
---|
1235 | </para> |
---|
1236 | </listitem> |
---|
1237 | </varlistentry> |
---|
1238 | |
---|
1239 | <varlistentry> |
---|
1240 | <term>Term2</term> |
---|
1241 | <listitem> |
---|
1242 | <para> |
---|
1243 | Definition/explanation of the term |
---|
1244 | </para> |
---|
1245 | </listitem> |
---|
1246 | </varlistentry> |
---|
1247 | </variablelist></programlisting> |
---|
1248 | </example> |
---|
1249 | </sect3> |
---|
1250 | |
---|
1251 | <sect3 id="docbook.usedtags.links"> |
---|
1252 | <title>Link elements</title> |
---|
1253 | <para></para> |
---|
1254 | <informaltable frame="none"> |
---|
1255 | <tgroup cols="3" rowsep="1" colsep="1"> |
---|
1256 | <colspec align="left" /> |
---|
1257 | <colspec align="center" /> |
---|
1258 | <colspec align="left" /> |
---|
1259 | <thead> |
---|
1260 | <row> |
---|
1261 | <entry>Define</entry> |
---|
1262 | <entry>Element</entry> |
---|
1263 | <entry>Comment</entry> |
---|
1264 | </row> |
---|
1265 | </thead> |
---|
1266 | <tbody> |
---|
1267 | <row> |
---|
1268 | <entry>Cross reference</entry> |
---|
1269 | <entry> |
---|
1270 | <sgmltag class="starttag">xref linkend=""</sgmltag> |
---|
1271 | </entry> |
---|
1272 | <entry>Use this to linke to other parts of the document.</entry> |
---|
1273 | </row> |
---|
1274 | <row> |
---|
1275 | <entry>Cross reference with own text</entry> |
---|
1276 | <entry> |
---|
1277 | <sgmltag class="starttag">link</sgmltag> |
---|
1278 | </entry> |
---|
1279 | <entry> |
---|
1280 | Can be used as an alternative to |
---|
1281 | <sgmltag>xref</sgmltag> |
---|
1282 | </entry> |
---|
1283 | </row> |
---|
1284 | <row> |
---|
1285 | <entry>External URLs</entry> |
---|
1286 | <entry> |
---|
1287 | <sgmltag class="starttag">ulink url=""</sgmltag> |
---|
1288 | </entry> |
---|
1289 | <entry></entry> |
---|
1290 | </row> |
---|
1291 | </tbody> |
---|
1292 | </tgroup> |
---|
1293 | </informaltable> |
---|
1294 | <example id="docbook.examples.links"> |
---|
1295 | <title>Links</title> |
---|
1296 | <programlisting language="xml"> |
---|
1297 | <xref linkend="docbook.usedtags.links" /> |
---|
1298 | <link linkend="docbook.usedtags.links">Link to this section</link> |
---|
1299 | <ulink url="http://base.thep.lu.se">Base2's homepage</ulink> |
---|
1300 | </programlisting> |
---|
1301 | <para> |
---|
1302 | The first element will autogenerate the linked section's/chapter's title as a |
---|
1303 | hyperlinked text. As an alternative to |
---|
1304 | <sgmltag>xref</sgmltag> |
---|
1305 | is |
---|
1306 | <sgmltag>link</sgmltag> |
---|
1307 | that lets you write your own hyperlinked text. The third and last one should be |
---|
1308 | used to link to any URL outside the document. |
---|
1309 | </para> |
---|
1310 | </example> |
---|
1311 | </sect3> |
---|
1312 | </sect2> |
---|
1313 | |
---|
1314 | </sect1> |
---|
1315 | |
---|
1316 | <sect1 id="documentation.magicdraw"> |
---|
1317 | <title>Create UML diagrams with MagicDraw</title> |
---|
1318 | |
---|
1319 | <para> |
---|
1320 | UML or UML-like diagrams are used to document the relationship of |
---|
1321 | classes in the Core API. To create the diagrams we use the community edition (version 12.5) |
---|
1322 | of a program called MagicDraw. This is a Java program and it should be possible |
---|
1323 | to run it on any platform which has at least a Java 1.5 runtime. |
---|
1324 | To get more information about MagicDraw and to download the program |
---|
1325 | go to their website: |
---|
1326 | <ulink url="http://www.magicdraw.com/">http://www.magicdraw.com/</ulink> |
---|
1327 | </para> |
---|
1328 | |
---|
1329 | |
---|
1330 | <sect2 id="magicdraw.organisation"> |
---|
1331 | <title>Organisation</title> |
---|
1332 | |
---|
1333 | <para> |
---|
1334 | All classes and diagrams are in a single UML file. It can be |
---|
1335 | found at <filename><base-dir>/doc/src/uml/base.mdzip</filename> |
---|
1336 | </para> |
---|
1337 | |
---|
1338 | <para> |
---|
1339 | Everything in MagicDraw has been organised into packages and |
---|
1340 | modules. At the top we have the <code>Core layer</code> and |
---|
1341 | the <code>Data layer</code>. The <code>Java</code> moduled is |
---|
1342 | for classes that related to the Java programming language, such |
---|
1343 | as <code>Map</code> and <code>Set</code> that are not pre-defined |
---|
1344 | by MagicDraw. |
---|
1345 | </para> |
---|
1346 | |
---|
1347 | <figure id="magicdraw.figures.organisation"> |
---|
1348 | <title>MagicDraw organisation</title> |
---|
1349 | <screenshot> |
---|
1350 | <mediaobject> |
---|
1351 | <imageobject> |
---|
1352 | <imagedata |
---|
1353 | fileref="figures/magicdraw/organisation.png" format="PNG" /> |
---|
1354 | </imageobject> |
---|
1355 | </mediaobject> |
---|
1356 | </screenshot> |
---|
1357 | </figure> |
---|
1358 | </sect2> |
---|
1359 | |
---|
1360 | <sect2 id="magicdraw.classes"> |
---|
1361 | <title>Classes</title> |
---|
1362 | <para> |
---|
1363 | New classes should be added to one of the subpackages inside |
---|
1364 | the <code>Data layer/Classes</code> or <code>Core layer/Classes</code> |
---|
1365 | modules. It is very simple: |
---|
1366 | </para> |
---|
1367 | |
---|
1368 | <orderedlist> |
---|
1369 | <listitem> |
---|
1370 | <para> |
---|
1371 | Select the subpackage in the overview and click with the right mouse button. |
---|
1372 | </para> |
---|
1373 | </listitem> |
---|
1374 | <listitem> |
---|
1375 | <para> |
---|
1376 | Select the |
---|
1377 | <menuchoice> |
---|
1378 | <guimenu>New element</guimenu> |
---|
1379 | <guimenuitem>Class</guimenuitem> |
---|
1380 | </menuchoice> |
---|
1381 | menu item in the menu that pops up. |
---|
1382 | </para> |
---|
1383 | </listitem> |
---|
1384 | <listitem> |
---|
1385 | <para> |
---|
1386 | The overview will expand to add a new class. Enter the name of the class |
---|
1387 | and press enter. |
---|
1388 | </para> |
---|
1389 | </listitem> |
---|
1390 | </orderedlist> |
---|
1391 | |
---|
1392 | <sect3 id="magicdraw.classes.data"> |
---|
1393 | <title>Data layer classes</title> |
---|
1394 | |
---|
1395 | <para> |
---|
1396 | If you added a class to the data layer you also need to |
---|
1397 | record some important information. |
---|
1398 | </para> |
---|
1399 | |
---|
1400 | <itemizedlist> |
---|
1401 | <listitem> |
---|
1402 | <para> |
---|
1403 | The database table the data is stored in |
---|
1404 | </para> |
---|
1405 | </listitem> |
---|
1406 | <listitem> |
---|
1407 | <para> |
---|
1408 | If the second-level cache is enabled or not |
---|
1409 | </para> |
---|
1410 | </listitem> |
---|
1411 | <listitem> |
---|
1412 | <para> |
---|
1413 | If proxies are enabled or not |
---|
1414 | </para> |
---|
1415 | </listitem> |
---|
1416 | <listitem> |
---|
1417 | <para> |
---|
1418 | The superclass |
---|
1419 | </para> |
---|
1420 | </listitem> |
---|
1421 | <listitem> |
---|
1422 | <para> |
---|
1423 | Implemented interfaces |
---|
1424 | </para> |
---|
1425 | </listitem> |
---|
1426 | <listitem> |
---|
1427 | <para> |
---|
1428 | Simple properties, ie. strings, numbers, dates |
---|
1429 | </para> |
---|
1430 | </listitem> |
---|
1431 | <listitem> |
---|
1432 | <para> |
---|
1433 | Associations to other classes |
---|
1434 | </para> |
---|
1435 | </listitem> |
---|
1436 | </itemizedlist> |
---|
1437 | |
---|
1438 | <para> |
---|
1439 | To achive this we have slightly altered the meaning of some UML symbols. |
---|
1440 | For example we use the access modified symbols (+, ~ and -) to indicate |
---|
1441 | if a property is updatable or not. |
---|
1442 | </para> |
---|
1443 | |
---|
1444 | <sect4 id="magicdraw.classes.data.tags"> |
---|
1445 | <title>Setting tagged values</title> |
---|
1446 | |
---|
1447 | <para> |
---|
1448 | Some of the information needed is specified as <emphasis>tagged values</emphasis> |
---|
1449 | that can be attached to a class. |
---|
1450 | Double-click on the new class to bring up it's properties dialog |
---|
1451 | box. Switch to the <guilabel>Tags</guilabel> configuration page. |
---|
1452 | We have defined the following tags: |
---|
1453 | </para> |
---|
1454 | |
---|
1455 | <variablelist> |
---|
1456 | <varlistentry> |
---|
1457 | <term><guilabel>table</guilabel></term> |
---|
1458 | <listitem> |
---|
1459 | <para> |
---|
1460 | The name of the database table where the items should be stored. |
---|
1461 | </para> |
---|
1462 | </listitem> |
---|
1463 | </varlistentry> |
---|
1464 | <varlistentry> |
---|
1465 | <term><guilabel>cache</guilabel></term> |
---|
1466 | <listitem> |
---|
1467 | <para> |
---|
1468 | The number of items to store in the second-level cache of Hibernate. |
---|
1469 | Only specify a value if caching should be enabled. |
---|
1470 | </para> |
---|
1471 | </listitem> |
---|
1472 | </varlistentry> |
---|
1473 | <varlistentry> |
---|
1474 | <term><guilabel>proxy</guilabel></term> |
---|
1475 | <listitem> |
---|
1476 | <para> |
---|
1477 | A boolean flag to indicate if proxies should be used or not. |
---|
1478 | </para> |
---|
1479 | </listitem> |
---|
1480 | </varlistentry> |
---|
1481 | <varlistentry> |
---|
1482 | <term><guilabel>extends</guilabel></term> |
---|
1483 | <listitem> |
---|
1484 | <para> |
---|
1485 | Select the superclass of this class. |
---|
1486 | </para> |
---|
1487 | </listitem> |
---|
1488 | </varlistentry> |
---|
1489 | <varlistentry> |
---|
1490 | <term><guilabel>implements</guilabel></term> |
---|
1491 | <listitem> |
---|
1492 | <para> |
---|
1493 | Specify which interfaces the class implements. To save space |
---|
1494 | we use the following one-letter abbreviations: |
---|
1495 | </para> |
---|
1496 | |
---|
1497 | <itemizedlist> |
---|
1498 | <listitem><para>A = AnnotatableData</para></listitem> |
---|
1499 | <listitem><para>B = BatchableData</para></listitem> |
---|
1500 | <listitem><para>D = DiskConsumableData</para></listitem> |
---|
1501 | <listitem><para>E = ExtendableData</para></listitem> |
---|
1502 | <listitem><para>F = FileAttachableData</para></listitem> |
---|
1503 | <listitem><para>N = NameableData</para></listitem> |
---|
1504 | <listitem><para>O = OwnableData</para></listitem> |
---|
1505 | <listitem><para>R = RemoveableData</para></listitem> |
---|
1506 | <listitem><para>S = ShareableData</para></listitem> |
---|
1507 | <listitem><para>T = SystemData</para></listitem> |
---|
1508 | </itemizedlist> |
---|
1509 | </listitem> |
---|
1510 | </varlistentry> |
---|
1511 | </variablelist> |
---|
1512 | |
---|
1513 | <figure id="magicdraw.figures.classtags"> |
---|
1514 | <title>Setting tagged values</title> |
---|
1515 | <screenshot> |
---|
1516 | <mediaobject> |
---|
1517 | <imageobject> |
---|
1518 | <imagedata |
---|
1519 | scalefit="1" width="100%" |
---|
1520 | fileref="figures/magicdraw/classtags.png" format="PNG" /> |
---|
1521 | </imageobject> |
---|
1522 | </mediaobject> |
---|
1523 | </screenshot> |
---|
1524 | </figure> |
---|
1525 | </sect4> |
---|
1526 | |
---|
1527 | <sect4 id="magicdraw.classes.data.properties"> |
---|
1528 | <title>Specifying simple properties for a class</title> |
---|
1529 | <para> |
---|
1530 | Simple properties are strings, numbers, dates, etc. that are part of an object. |
---|
1531 | Properties are entered as attributes of the class. The easiest way to enter |
---|
1532 | properties are by typing directly in a diagram. It can also be done |
---|
1533 | from the <guilabel>Attributes</guilabel> configuration page. |
---|
1534 | </para> |
---|
1535 | |
---|
1536 | <para> |
---|
1537 | Each attribute must have information about: |
---|
1538 | </para> |
---|
1539 | |
---|
1540 | <itemizedlist> |
---|
1541 | <listitem> |
---|
1542 | <para> |
---|
1543 | The name of the attribute, ie. the name of the get/set method without the |
---|
1544 | get or set part and starting with a lowercase letter. |
---|
1545 | </para> |
---|
1546 | </listitem> |
---|
1547 | <listitem> |
---|
1548 | <para> |
---|
1549 | The data type: enter or select the Java object type in the |
---|
1550 | <guilabel>Type</guilabel> selection list. |
---|
1551 | </para> |
---|
1552 | </listitem> |
---|
1553 | <listitem> |
---|
1554 | <para> |
---|
1555 | If null values are allowed or not: specify a multiplicity of 1 if a |
---|
1556 | non-null value is required. |
---|
1557 | </para> |
---|
1558 | </listitem> |
---|
1559 | <listitem> |
---|
1560 | <para> |
---|
1561 | If it is modifiable or not. From the <guilabel>Visibility</guilabel> |
---|
1562 | list, select one of the following: |
---|
1563 | </para> |
---|
1564 | |
---|
1565 | <itemizedlist> |
---|
1566 | <listitem> |
---|
1567 | <para> |
---|
1568 | public (+): the attribute is modifiable. This translates to public get and set methods. |
---|
1569 | </para> |
---|
1570 | </listitem> |
---|
1571 | <listitem> |
---|
1572 | <para> |
---|
1573 | package (~): the attribute can only be set once. This translates to public get and set methods |
---|
1574 | and an <code>update="false"</code> tag in the Hibernate mapping. |
---|
1575 | </para> |
---|
1576 | </listitem> |
---|
1577 | <listitem> |
---|
1578 | <para> |
---|
1579 | private (-): the attribute is private (will this ever be used?). |
---|
1580 | This translates to package private get and set methods. |
---|
1581 | </para> |
---|
1582 | </listitem> |
---|
1583 | </itemizedlist> |
---|
1584 | |
---|
1585 | </listitem> |
---|
1586 | </itemizedlist> |
---|
1587 | |
---|
1588 | <figure id="magicdraw.figures.attributes"> |
---|
1589 | <title>Class attributes</title> |
---|
1590 | <screenshot> |
---|
1591 | <mediaobject> |
---|
1592 | <imageobject> |
---|
1593 | <imagedata |
---|
1594 | scalefit="1" width="100%" |
---|
1595 | fileref="figures/magicdraw/attributes.png" format="PNG" /> |
---|
1596 | </imageobject> |
---|
1597 | </mediaobject> |
---|
1598 | </screenshot> |
---|
1599 | </figure> |
---|
1600 | </sect4> |
---|
1601 | |
---|
1602 | <sect4 id="magicdraw.classes.data.associations"> |
---|
1603 | <title>Associations to other classes</title> |
---|
1604 | |
---|
1605 | <para> |
---|
1606 | Associations to other classes are easiest created from |
---|
1607 | a diagram view by drawing an <guilabel>Association</guilabel> |
---|
1608 | link between the two classes. The ends should be given a name, |
---|
1609 | multiplicity and visibility should be selected. For the visibility |
---|
1610 | we use the same options as for attributes, but with a slightly different |
---|
1611 | interpretation. |
---|
1612 | </para> |
---|
1613 | |
---|
1614 | <itemizedlist> |
---|
1615 | <listitem> |
---|
1616 | <para> |
---|
1617 | public (+): the association is modifiable. This translates to public get and |
---|
1618 | set methods for many-to-one associations. Many-to-many associations must have a |
---|
1619 | package private set method since the set or map must never be replaced. |
---|
1620 | </para> |
---|
1621 | </listitem> |
---|
1622 | |
---|
1623 | <listitem> |
---|
1624 | <para> |
---|
1625 | package (~): same as public but the association cannot be changed once it has |
---|
1626 | been created. For many-to-one associations an <code>update="false"</code> tag in |
---|
1627 | the Hibernate mapping should be used. For many-to-many association there is |
---|
1628 | no corresponding tag. It will be the responsibility of the core to make sure |
---|
1629 | no modifications are done. |
---|
1630 | </para> |
---|
1631 | </listitem> |
---|
1632 | |
---|
1633 | <listitem> |
---|
1634 | <para> |
---|
1635 | private (-): this is the inverse end of an association. Only used for one-to-many |
---|
1636 | and many-to-many associations and translates to package private get and set |
---|
1637 | methods. |
---|
1638 | </para> |
---|
1639 | </listitem> |
---|
1640 | </itemizedlist> |
---|
1641 | |
---|
1642 | <para> |
---|
1643 | If the association involves a join table (many-to-many) the name of that |
---|
1644 | table should be entered as a tagged value to the association. |
---|
1645 | </para> |
---|
1646 | |
---|
1647 | <para> |
---|
1648 | If the association have values attached to it, use the |
---|
1649 | <guilabel>Association class</guilabel> link type and enter information about |
---|
1650 | the values in the attached class. |
---|
1651 | </para> |
---|
1652 | |
---|
1653 | </sect4> |
---|
1654 | |
---|
1655 | <para> |
---|
1656 | A lot more can be said about this, but |
---|
1657 | it is probably better to have a look at already existing diagrams if you have |
---|
1658 | any questions. The authentication overview shown below is one of the most |
---|
1659 | complex diagrams that involves many different links. |
---|
1660 | </para> |
---|
1661 | |
---|
1662 | <figure id="magicdraw.figures.realexample"> |
---|
1663 | <title>Authentication UML diagram</title> |
---|
1664 | <screenshot> |
---|
1665 | <mediaobject> |
---|
1666 | <imageobject> |
---|
1667 | <imagedata |
---|
1668 | scalefit="1" width="100%" |
---|
1669 | fileref="figures/uml/datalayer.authentication.png" format="PNG" /> |
---|
1670 | </imageobject> |
---|
1671 | </mediaobject> |
---|
1672 | </screenshot> |
---|
1673 | </figure> |
---|
1674 | |
---|
1675 | </sect3> |
---|
1676 | |
---|
1677 | <sect3 id="magicdraw.classes.core"> |
---|
1678 | <title>Core layer classes</title> |
---|
1679 | <para> |
---|
1680 | TODO |
---|
1681 | </para> |
---|
1682 | </sect3> |
---|
1683 | |
---|
1684 | </sect2> |
---|
1685 | |
---|
1686 | <sect2 id="magicdraw.diagrams"> |
---|
1687 | <title>Diagrams</title> |
---|
1688 | |
---|
1689 | <sect3 id="magicdraw.diagrams.create"> |
---|
1690 | <title>Create a new diagram</title> |
---|
1691 | |
---|
1692 | <para> |
---|
1693 | New diagrams should be added to one of the subpackages inside |
---|
1694 | the <code>Data layer/Diagrams</code> or <code>Core layer/Diagrams</code> |
---|
1695 | modules. It is very simple: |
---|
1696 | </para> |
---|
1697 | |
---|
1698 | <orderedlist> |
---|
1699 | <listitem> |
---|
1700 | <para> |
---|
1701 | Select the subpackage in the overview and click with the right mouse button. |
---|
1702 | </para> |
---|
1703 | </listitem> |
---|
1704 | <listitem> |
---|
1705 | <para> |
---|
1706 | Select the |
---|
1707 | <menuchoice> |
---|
1708 | <guimenu>New diagram</guimenu> |
---|
1709 | <guimenuitem>Class diagram</guimenuitem> |
---|
1710 | </menuchoice> |
---|
1711 | menu item in the menu that pops up. |
---|
1712 | </para> |
---|
1713 | </listitem> |
---|
1714 | <listitem> |
---|
1715 | <para> |
---|
1716 | The overview will expand to add a new diagram. A new empty diagram |
---|
1717 | frame is also opened on the right part of the screen. Enter the name of the diagram |
---|
1718 | and press enter. |
---|
1719 | </para> |
---|
1720 | </listitem> |
---|
1721 | </orderedlist> |
---|
1722 | |
---|
1723 | <note> |
---|
1724 | <title>Only class diagrams are fully supported</title> |
---|
1725 | <para> |
---|
1726 | The community edition of MagicDraw only has full support for |
---|
1727 | class diagrams. The other diagram types has limitations, in the number of |
---|
1728 | objects that can be created. |
---|
1729 | </para> |
---|
1730 | </note> |
---|
1731 | |
---|
1732 | <para> |
---|
1733 | To display a class in a diagram, simply select the class in the overview |
---|
1734 | and drag it into to the diagram. |
---|
1735 | </para> |
---|
1736 | </sect3> |
---|
1737 | |
---|
1738 | <sect3 id="magicdraw.diagrams.appearance"> |
---|
1739 | <title>Visual appearance and style</title> |
---|
1740 | |
---|
1741 | <para> |
---|
1742 | We have defined several different display style for classes. To set a |
---|
1743 | style for a class right click on it in a diagram and select the |
---|
1744 | <menuchoice><guimenuitem>Symbol properties</guimenuitem></menuchoice> |
---|
1745 | menu item. In the bottom of the |
---|
1746 | popup, use the <guilabel>Apply style</guilabel> selection list to select |
---|
1747 | one of the predefined styles. |
---|
1748 | </para> |
---|
1749 | |
---|
1750 | <itemizedlist> |
---|
1751 | <listitem> |
---|
1752 | <para> |
---|
1753 | Data class: Use this style for all primary data classes in a diagram. It will |
---|
1754 | display all info that we are interested in. |
---|
1755 | </para> |
---|
1756 | </listitem> |
---|
1757 | <listitem> |
---|
1758 | <para> |
---|
1759 | External class: Use this style for related classes that are actaully part of |
---|
1760 | another diagram. This style will hide all information except the class name. |
---|
1761 | This style can be used for both data layer and core layer classes. |
---|
1762 | </para> |
---|
1763 | </listitem> |
---|
1764 | <listitem> |
---|
1765 | <para> |
---|
1766 | Association class: Use this style for classes that hold information |
---|
1767 | related to an association between two other classes. Classes with this |
---|
1768 | style are displayed in a different color. This style can be used for both |
---|
1769 | data layer and core layer classes. |
---|
1770 | </para> |
---|
1771 | </listitem> |
---|
1772 | </itemizedlist> |
---|
1773 | </sect3> |
---|
1774 | |
---|
1775 | <sect3 id="magicdraw.diagrams.save"> |
---|
1776 | <title>Save diagram as image</title> |
---|
1777 | <para> |
---|
1778 | When the diagram is complete, save it as a PNG image in the |
---|
1779 | <filename class="directory"><base-dir>/doc/src/docbook/figures/uml</filename> |
---|
1780 | directory. |
---|
1781 | </para> |
---|
1782 | </sect3> |
---|
1783 | </sect2> |
---|
1784 | |
---|
1785 | </sect1> |
---|
1786 | |
---|
1787 | <sect1 id="documentation.javadoc"> |
---|
1788 | <title>Javadoc</title> |
---|
1789 | |
---|
1790 | <para> |
---|
1791 | Existing Javadoc documentation is available online at: |
---|
1792 | <ulink url="http://base.thep.lu.se/chrome/site/doc/api/index.html" |
---|
1793 | >http://base.thep.lu.se/chrome/site/doc/api/index.html</ulink>. |
---|
1794 | </para> |
---|
1795 | |
---|
1796 | <para> |
---|
1797 | The BASE API is devided into four different parts on the package level. |
---|
1798 | </para> |
---|
1799 | |
---|
1800 | <itemizedlist> |
---|
1801 | <listitem> |
---|
1802 | <para> |
---|
1803 | Public API - All classes and methods in the package are public. May be |
---|
1804 | used by client applications and plug-ins. In general, backwards compatibility |
---|
1805 | will be maintained. |
---|
1806 | </para> |
---|
1807 | </listitem> |
---|
1808 | |
---|
1809 | <listitem> |
---|
1810 | <para> |
---|
1811 | Extension API - All classes and methods in the package intended for |
---|
1812 | internal extensions only. Not part of the public API and should not be used |
---|
1813 | by client applications or plug-in. |
---|
1814 | </para> |
---|
1815 | </listitem> |
---|
1816 | |
---|
1817 | <listitem> |
---|
1818 | <para> |
---|
1819 | Internal API - All classes and methods in the package are internal. Should |
---|
1820 | never be used by client application or plug-ins. |
---|
1821 | </para> |
---|
1822 | </listitem> |
---|
1823 | |
---|
1824 | <listitem> |
---|
1825 | <para> |
---|
1826 | Mixed Public and Internal API - Contains a mix of public and internal |
---|
1827 | classes. Check the javadoc for each class/method before using it. |
---|
1828 | </para> |
---|
1829 | </listitem> |
---|
1830 | |
---|
1831 | </itemizedlist> |
---|
1832 | <para> |
---|
1833 | Introduction to the Base API and it's parts can be |
---|
1834 | found on the start page of Base Javadoc. Plugin developers and other external developers |
---|
1835 | should pay most attention to the public API. What we consider to be the public part of the API is discussed in |
---|
1836 | <xref linkend="api_overview.public_api" />. |
---|
1837 | </para> |
---|
1838 | |
---|
1839 | <sect2 id="javadoc.writing"> |
---|
1840 | <title>Writing javadoc</title> |
---|
1841 | <para> |
---|
1842 | This section only covers Javadoc comments, how to write proper none-Javadoc comments |
---|
1843 | are described in |
---|
1844 | <xref linkend="core_ref.rules.style" /> |
---|
1845 | </para> |
---|
1846 | <para> |
---|
1847 | General information about Javadoc and how it is written in a proper way can be found |
---|
1848 | at |
---|
1849 | <ulink url="http://java.sun.com/j2se/javadoc/writingdoccomments/index.html"> |
---|
1850 | http://java.sun.com/j2se/javadoc/writingdoccomments/index.html</ulink>. |
---|
1851 | The rule when coding in Base is that all packages, classes, interfaces, public |
---|
1852 | methods and public attributes must be commented in Javadoc style. It is also |
---|
1853 | recommended that private and protected methods has some comments, but maybe not as |
---|
1854 | detailed as the public ones. Below follow more specific details what to have in mind |
---|
1855 | when writing Javadoc in the Base project. |
---|
1856 | </para> |
---|
1857 | <variablelist> |
---|
1858 | <varlistentry> |
---|
1859 | <term>General</term> |
---|
1860 | <listitem> |
---|
1861 | <para> |
---|
1862 | General things that are common for all Javadocs comments in Base. |
---|
1863 | </para> |
---|
1864 | <itemizedlist> |
---|
1865 | <listitem> |
---|
1866 | <para>All comments should be in English.</para> |
---|
1867 | </listitem> |
---|
1868 | <listitem> |
---|
1869 | <para>Do not start each new line of comment with a star.</para> |
---|
1870 | </listitem> |
---|
1871 | <listitem> |
---|
1872 | <para> |
---|
1873 | If a comment only should be shown in the internal documentation |
---|
1874 | and not in the public, it should be tagged with |
---|
1875 | <synopsis>@base.internal</synopsis> |
---|
1876 | </para> |
---|
1877 | </listitem> |
---|
1878 | </itemizedlist> |
---|
1879 | </listitem> |
---|
1880 | </varlistentry> |
---|
1881 | |
---|
1882 | <varlistentry> |
---|
1883 | <term>Package comments</term> |
---|
1884 | <listitem> |
---|
1885 | <para> |
---|
1886 | Package comments should be placed in a file named <filename>package.html</filename> |
---|
1887 | in the source code directory. |
---|
1888 | </para> |
---|
1889 | |
---|
1890 | <important> |
---|
1891 | <title>Is the package public or internal?</title> |
---|
1892 | <para> |
---|
1893 | This information should be added in the <filename>package.html</filename> |
---|
1894 | file. You must also modify the <filename>build.xml</filename> file. |
---|
1895 | The <emphasis>doc.javadoc</emphasis> target contains |
---|
1896 | <sgmltag class="starttag">group</sgmltag> tags which lists all |
---|
1897 | packages that are part of each group. |
---|
1898 | </para> |
---|
1899 | </important> |
---|
1900 | |
---|
1901 | </listitem> |
---|
1902 | </varlistentry> |
---|
1903 | |
---|
1904 | <varlistentry> |
---|
1905 | <term>Class and interface comments</term> |
---|
1906 | <listitem> |
---|
1907 | <para> |
---|
1908 | A comment for a class or interface should start with a general |
---|
1909 | description. The class comment should then give information about what |
---|
1910 | the class can be used for, while an interface comment more should inform |
---|
1911 | which kinds of classes that are supposed to implement the interface. |
---|
1912 | </para> |
---|
1913 | <variablelist> |
---|
1914 | <varlistentry> |
---|
1915 | <term><synopsis>@author</synopsis></term> |
---|
1916 | <listitem> |
---|
1917 | <para>The first name of the author(s) of the class.</para> |
---|
1918 | </listitem> |
---|
1919 | </varlistentry> |
---|
1920 | <varlistentry> |
---|
1921 | <term><synopsis>@version</synopsis></term> |
---|
1922 | <listitem> |
---|
1923 | <para>From which version of Base the class is available.</para> |
---|
1924 | </listitem> |
---|
1925 | </varlistentry> |
---|
1926 | <varlistentry> |
---|
1927 | <term><synopsis>@see</synopsis></term> |
---|
1928 | <listitem> |
---|
1929 | <para>Optional. Links to some related subjects.</para> |
---|
1930 | </listitem> |
---|
1931 | </varlistentry> |
---|
1932 | <varlistentry> |
---|
1933 | <term><synopsis>@base.modified</synopsis></term> |
---|
1934 | <listitem> |
---|
1935 | <para> |
---|
1936 | Optional. Some classes has this tag too. This is for give the |
---|
1937 | class-file a time stamp when it is checked in to subversion. |
---|
1938 | </para> |
---|
1939 | </listitem> |
---|
1940 | </varlistentry> |
---|
1941 | </variablelist> |
---|
1942 | </listitem> |
---|
1943 | </varlistentry> |
---|
1944 | |
---|
1945 | <varlistentry> |
---|
1946 | <term>Method comments</term> |
---|
1947 | <listitem> |
---|
1948 | <para> |
---|
1949 | A method comment should start with a general description of the method |
---|
1950 | and what it does. The following tags must be present in this order: |
---|
1951 | </para> |
---|
1952 | <variablelist> |
---|
1953 | <varlistentry> |
---|
1954 | <term> |
---|
1955 | <synopsis>@param</synopsis></term> |
---|
1956 | <listitem> |
---|
1957 | <para> |
---|
1958 | One tag for each parameter of the method. Make sure to tell |
---|
1959 | what values are allowed and what will happen if a disallowed |
---|
1960 | value is passed. |
---|
1961 | </para> |
---|
1962 | </listitem> |
---|
1963 | </varlistentry> |
---|
1964 | <varlistentry> |
---|
1965 | <term><synopsis>@return</synopsis></term> |
---|
1966 | <listitem> |
---|
1967 | <para> |
---|
1968 | What is returned by the method. Make sure to tell what |
---|
1969 | values can be returned (ie. if it can be null). |
---|
1970 | </para> |
---|
1971 | </listitem> |
---|
1972 | </varlistentry> |
---|
1973 | <varlistentry> |
---|
1974 | <term><synopsis>@throws</synopsis></term> |
---|
1975 | <listitem> |
---|
1976 | <para> |
---|
1977 | One tag for each exception that the method can throw and |
---|
1978 | describe when and why it will be thrown. |
---|
1979 | </para> |
---|
1980 | </listitem> |
---|
1981 | </varlistentry> |
---|
1982 | <varlistentry> |
---|
1983 | <term> |
---|
1984 | <synopsis>@since</synopsis> |
---|
1985 | </term> |
---|
1986 | <listitem> |
---|
1987 | <para> |
---|
1988 | Use only this tag together with methods added in a later |
---|
1989 | version then the one the class was created in. It holds which |
---|
1990 | version the method first was available in. |
---|
1991 | </para> |
---|
1992 | </listitem> |
---|
1993 | </varlistentry> |
---|
1994 | <varlistentry> |
---|
1995 | <term> |
---|
1996 | <synopsis>@see</synopsis></term> |
---|
1997 | <listitem> |
---|
1998 | <para> |
---|
1999 | Optional. Link to relevant information, one tag for each |
---|
2000 | link. |
---|
2001 | </para> |
---|
2002 | </listitem> |
---|
2003 | </varlistentry> |
---|
2004 | </variablelist> |
---|
2005 | </listitem> |
---|
2006 | </varlistentry> |
---|
2007 | |
---|
2008 | <varlistentry> |
---|
2009 | <term>Attribute comments</term> |
---|
2010 | <listitem> |
---|
2011 | <para> |
---|
2012 | If the attribute is a static final, describe what the attribute is for |
---|
2013 | an where it is typically used. Other attributes can often be explained |
---|
2014 | through their getter and setter methods. |
---|
2015 | </para> |
---|
2016 | </listitem> |
---|
2017 | </varlistentry> |
---|
2018 | </variablelist> |
---|
2019 | </sect2> |
---|
2020 | </sect1> |
---|
2021 | </chapter> |
---|