KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lowagie > text > Document


1 /*
2  * $Id: Document.java 2824 2007-06-03 18:10:21Z blowagie $
3  * $Name$
4  *
5  * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
6  *
7  * The contents of this file are subject to the Mozilla Public License Version 1.1
8  * (the "License"); you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the License.
14  *
15  * The Original Code is 'iText, a free JAVA-PDF library'.
16  *
17  * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
18  * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
19  * All Rights Reserved.
20  * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
21  * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
22  *
23  * Contributor(s): all the names of the contributors are added in the source code
24  * where applicable.
25  *
26  * Alternatively, the contents of this file may be used under the terms of the
27  * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
28  * provisions of LGPL are applicable instead of those above. If you wish to
29  * allow use of your version of this file only under the terms of the LGPL
30  * License and not to allow others to use your version of this file under
31  * the MPL, indicate your decision by deleting the provisions above and
32  * replace them with the notice and other provisions required by the LGPL.
33  * If you do not delete the provisions above, a recipient may use your version
34  * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the MPL as stated above or under the terms of the GNU
38  * Library General Public License as published by the Free Software Foundation;
39  * either version 2 of the License, or any later version.
40  *
41  * This library is distributed in the hope that it will be useful, but WITHOUT
42  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
43  * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
44  * details.
45  *
46  * If you didn't download this code from the following link, you should check if
47  * you aren't using an obsolete version:
48  * http://www.lowagie.com/iText/
49  */

50
51 package com.lowagie.text;
52
53 import java.text.SimpleDateFormat JavaDoc;
54 import java.util.ArrayList JavaDoc;
55 import java.util.Date JavaDoc;
56 import java.util.Iterator JavaDoc;
57
58 /**
59  * A generic Document class.
60  * <P>
61  * All kinds of Text-elements can be added to a <CODE>HTMLDocument</CODE>.
62  * The <CODE>Document</CODE> signals all the listeners when an element has
63  * been added.
64  * <P>
65  * Remark:
66  * <OL>
67  * <LI>Once a document is created you can add some meta information.
68  * <LI>You can also set the headers/footers.
69  * <LI>You have to open the document before you can write content.
70  * <LI>You can only write content (no more meta-formation!) once a document is
71  * opened.
72  * <LI>When you change the header/footer on a certain page, this will be
73  * effective starting on the next page.
74  * <LI>Ater closing the document, every listener (as well as its <CODE>
75  * OutputStream</CODE>) is closed too.
76  * </OL>
77  * Example: <BLOCKQUOTE>
78  *
79  * <PRE>// creation of the document with a certain size and certain margins
80  * <STRONG>Document document = new Document(PageSize.A4, 50, 50, 50, 50);
81  * </STRONG> try {
82  * // creation of the different writers
83  * HtmlWriter.getInstance(<STRONG>document </STRONG>, System.out);
84  * PdfWriter.getInstance(<STRONG>document </STRONG>, new FileOutputStream("text.pdf"));
85  * // we add some meta information to the document
86  * <STRONG>document.addAuthor("Bruno Lowagie"); </STRONG>
87  * <STRONG>document.addSubject("This is the result of a Test."); </STRONG>
88  * // we open the document for writing
89  * <STRONG>document.open(); </STRONG>
90  * <STRONG>document.add(new Paragraph("Hello world"));</STRONG>
91  * } catch(DocumentException de) {
92  * System.err.println(de.getMessage());
93  * }
94  * <STRONG>document.close();</STRONG>
95  * </PRE>
96  *
97  * </BLOCKQUOTE>
98  */

99
100 public class Document implements DocListener {
101     
102     // membervariables
103

104     /** This constant may only be changed by Paulo Soares and/or Bruno Lowagie. */
105     private static final String JavaDoc ITEXT_VERSION = "iText 2.0.4 (by lowagie.com)";
106     
107     /**
108      * Allows the pdf documents to be produced without compression for debugging
109      * purposes.
110      */

111     public static boolean compress = true;
112     
113     /**
114      * When true the file access is not done through a memory mapped file. Use it if the file
115      * is too big to be mapped in your address space.
116      */

117     public static boolean plainRandomAccess = false;
118     
119     /** The DocListener. */
120     private ArrayList JavaDoc listeners = new ArrayList JavaDoc();
121     
122     /** Is the document open or not? */
123     protected boolean open;
124     
125     /** Has the document already been closed? */
126     protected boolean close;
127     
128     // membervariables concerning the layout
129

130     /** The size of the page. */
131     protected Rectangle pageSize;
132     
133     /** margin in x direction starting from the left */
134     protected float marginLeft = 0;
135     
136     /** margin in x direction starting from the right */
137     protected float marginRight = 0;
138     
139     /** margin in y direction starting from the top */
140     protected float marginTop = 0;
141     
142     /** margin in y direction starting from the bottom */
143     protected float marginBottom = 0;
144     
145     protected boolean marginMirroring = false;
146     
147     /** Content of JavaScript onLoad function */
148     protected String JavaDoc javaScript_onLoad = null;
149
150     /** Content of JavaScript onUnLoad function */
151     protected String JavaDoc javaScript_onUnLoad = null;
152
153     /** Style class in HTML body tag */
154     protected String JavaDoc htmlStyleClass = null;
155
156     // headers, footers
157

158     /** Current pagenumber */
159     protected int pageN = 0;
160     
161     /** This is the textual part of a Page; it can contain a header */
162     protected HeaderFooter header = null;
163     
164     /** This is the textual part of the footer */
165     protected HeaderFooter footer = null;
166     
167     /** This is a chapter number in case ChapterAutoNumber is used. */
168     protected int chapternumber = 0;
169     
170     // constructor
171

172     /**
173      * Constructs a new <CODE>Document</CODE> -object.
174  */

175     
176     public Document() {
177         this(PageSize.A4);
178     }
179     
180     /**
181      * Constructs a new <CODE>Document</CODE> -object.
182  *
183      * @param pageSize
184      * the pageSize
185  */

186     
187     public Document(Rectangle pageSize) {
188         this(pageSize, 36, 36, 36, 36);
189     }
190     
191     /**
192      * Constructs a new <CODE>Document</CODE> -object.
193  *
194      * @param pageSize
195      * the pageSize
196      * @param marginLeft
197      * the margin on the left
198      * @param marginRight
199      * the margin on the right
200      * @param marginTop
201      * the margin on the top
202      * @param marginBottom
203      * the margin on the bottom
204  */

205     
206     public Document(Rectangle pageSize, float marginLeft, float marginRight,
207             float marginTop, float marginBottom) {
208         this.pageSize = pageSize;
209         this.marginLeft = marginLeft;
210         this.marginRight = marginRight;
211         this.marginTop = marginTop;
212         this.marginBottom = marginBottom;
213     }
214     
215     // listener methods
216

217     /**
218  * Adds a <CODE>DocListener</CODE> to the <CODE>Document</CODE>.
219  *
220      * @param listener
221      * the new DocListener.
222  */

223     
224     public void addDocListener(DocListener listener) {
225         listeners.add(listener);
226     }
227     
228     /**
229  * Removes a <CODE>DocListener</CODE> from the <CODE>Document</CODE>.
230  *
231      * @param listener
232      * the DocListener that has to be removed.
233  */

234     
235     public void removeDocListener(DocListener listener) {
236         listeners.remove(listener);
237     }
238     
239     // methods implementing the DocListener interface
240

241     /**
242      * Adds an <CODE>Element</CODE> to the <CODE>Document</CODE>.
243  *
244      * @param element
245      * the <CODE>Element</CODE> to add
246      * @return <CODE>true</CODE> if the element was added, <CODE>false
247      * </CODE> if not
248      * @throws DocumentException
249      * when a document isn't open yet, or has been closed
250  */

251     
252     public boolean add(Element element) throws DocumentException {
253         if (close) {
254             throw new DocumentException(
255                     "The document has been closed. You can't add any Elements.");
256         }
257         int type = element.type();
258         if (open) {
259             if (!(type == Element.CHUNK || type == Element.PHRASE
260                     || type == Element.PARAGRAPH || type == Element.TABLE
261                     || type == Element.PTABLE
262                     || type == Element.MULTI_COLUMN_TEXT
263                     || type == Element.ANCHOR || type == Element.ANNOTATION
264                     || type == Element.CHAPTER || type == Element.SECTION
265                     || type == Element.LIST || type == Element.LISTITEM
266                     || type == Element.RECTANGLE || type == Element.JPEG
267                     || type == Element.IMGRAW || type == Element.IMGTEMPLATE
268                     || type == Element.MARKED)) {
269                 throw new DocumentException(
270                         "The document is open; you can only add Elements with content.");
271             }
272         } else {
273             if (!(type == Element.HEADER || type == Element.TITLE
274                     || type == Element.SUBJECT || type == Element.KEYWORDS
275                     || type == Element.AUTHOR || type == Element.PRODUCER
276                     || type == Element.CREATOR || type == Element.CREATIONDATE
277                     || type == Element.MARKED)) {
278                 throw new DocumentException(
279                         "The document is not open yet; you can only add Meta information.");
280             }
281         }
282         boolean success = false;
283         DocListener listener;
284         if (element instanceof ChapterAutoNumber) {
285             chapternumber++;
286             ((ChapterAutoNumber)element).setChapterNumber(chapternumber);
287         }
288         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
289             listener = (DocListener) iterator.next();
290             success |= listener.add(element);
291         }
292         return success;
293     }
294     
295     /**
296  * Opens the document.
297  * <P>
298      * Once the document is opened, you can't write any Header- or
299      * Meta-information anymore. You have to open the document before you can
300      * begin to add content to the body of the document.
301  */

302     
303     public void open() {
304         if (!close) {
305             open = true;
306         }
307         DocListener listener;
308         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
309             listener = (DocListener) iterator.next();
310             listener.setPageSize(pageSize);
311             listener.setMargins(marginLeft, marginRight, marginTop,
312                     marginBottom);
313             listener.open();
314         }
315     }
316     
317     /**
318  * Sets the pagesize.
319  *
320      * @param pageSize
321      * the new pagesize
322  * @return a <CODE>boolean</CODE>
323  */

324     
325     public boolean setPageSize(Rectangle pageSize) {
326         this.pageSize = pageSize;
327         DocListener listener;
328         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
329             listener = (DocListener) iterator.next();
330             listener.setPageSize(pageSize);
331         }
332         return true;
333     }
334     
335     /**
336  * Sets the margins.
337  *
338      * @param marginLeft
339      * the margin on the left
340      * @param marginRight
341      * the margin on the right
342      * @param marginTop
343      * the margin on the top
344      * @param marginBottom
345      * the margin on the bottom
346  * @return a <CODE>boolean</CODE>
347  */

348     
349     public boolean setMargins(float marginLeft, float marginRight,
350             float marginTop, float marginBottom) {
351         this.marginLeft = marginLeft;
352         this.marginRight = marginRight;
353         this.marginTop = marginTop;
354         this.marginBottom = marginBottom;
355         DocListener listener;
356         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
357             listener = (DocListener) iterator.next();
358             listener.setMargins(marginLeft, marginRight, marginTop,
359                     marginBottom);
360         }
361         return true;
362     }
363     
364     /**
365  * Signals that an new page has to be started.
366  *
367      * @return <CODE>true</CODE> if the page was added, <CODE>false</CODE>
368      * if not.
369      * @throws DocumentException
370      * when a document isn't open yet, or has been closed
371  */

372     
373     public boolean newPage() {
374         if (!open || close) {
375             return false;
376         }
377         DocListener listener;
378         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
379             listener = (DocListener) iterator.next();
380             listener.newPage();
381         }
382         return true;
383     }
384     
385     /**
386  * Changes the header of this document.
387  *
388      * @param header
389      * the new header
390  */

391     
392     public void setHeader(HeaderFooter header) {
393         this.header = header;
394         DocListener listener;
395         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
396             listener = (DocListener) iterator.next();
397             listener.setHeader(header);
398         }
399     }
400     
401     /**
402  * Resets the header of this document.
403  */

404     
405     public void resetHeader() {
406         this.header = null;
407         DocListener listener;
408         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
409             listener = (DocListener) iterator.next();
410             listener.resetHeader();
411         }
412     }
413     
414     /**
415  * Changes the footer of this document.
416  *
417      * @param footer
418      * the new footer
419  */

420     
421     public void setFooter(HeaderFooter footer) {
422         this.footer = footer;
423         DocListener listener;
424         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
425             listener = (DocListener) iterator.next();
426             listener.setFooter(footer);
427         }
428     }
429     
430     /**
431  * Resets the footer of this document.
432  */

433     
434     public void resetFooter() {
435         this.footer = null;
436         DocListener listener;
437         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
438             listener = (DocListener) iterator.next();
439             listener.resetFooter();
440         }
441     }
442     
443     /**
444  * Sets the page number to 0.
445  */

446     
447     public void resetPageCount() {
448         pageN = 0;
449         DocListener listener;
450         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
451             listener = (DocListener) iterator.next();
452             listener.resetPageCount();
453         }
454     }
455     
456     /**
457  * Sets the page number.
458  *
459      * @param pageN
460      * the new page number
461  */

462     
463     public void setPageCount(int pageN) {
464         this.pageN = pageN;
465         DocListener listener;
466         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
467             listener = (DocListener) iterator.next();
468             listener.setPageCount(pageN);
469         }
470     }
471     
472     /**
473  * Returns the current page number.
474  *
475  * @return the current page number
476  */

477     
478     public int getPageNumber() {
479         return this.pageN;
480     }
481     
482     /**
483  * Closes the document.
484  * <P>
485      * Once all the content has been written in the body, you have to close the
486      * body. After that nothing can be written to the body anymore.
487  */

488     
489     public void close() {
490         if (!close) {
491             open = false;
492             close = true;
493         }
494         DocListener listener;
495         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
496             listener = (DocListener) iterator.next();
497             listener.close();
498         }
499     }
500     
501     // methods concerning the header or some meta information
502

503     /**
504  * Adds a user defined header to the document.
505  *
506      * @param name
507      * the name of the header
508      * @param content
509      * the content of the header
510  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
511  */

512     
513     public boolean addHeader(String JavaDoc name, String JavaDoc content) {
514         try {
515             return add(new Header(name, content));
516         } catch (DocumentException de) {
517             throw new ExceptionConverter(de);
518         }
519     }
520     
521     /**
522  * Adds the title to a Document.
523  *
524      * @param title
525      * the title
526  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
527  */

528     
529     public boolean addTitle(String JavaDoc title) {
530         try {
531             return add(new Meta(Element.TITLE, title));
532         } catch (DocumentException de) {
533             throw new ExceptionConverter(de);
534         }
535     }
536     
537     /**
538  * Adds the subject to a Document.
539  *
540      * @param subject
541      * the subject
542  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
543  */

544     
545     public boolean addSubject(String JavaDoc subject) {
546         try {
547             return add(new Meta(Element.SUBJECT, subject));
548         } catch (DocumentException de) {
549             throw new ExceptionConverter(de);
550         }
551     }
552     
553     /**
554  * Adds the keywords to a Document.
555  *
556      * @param keywords
557      * adds the keywords to the document
558  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
559  */

560     
561     public boolean addKeywords(String JavaDoc keywords) {
562         try {
563             return add(new Meta(Element.KEYWORDS, keywords));
564         } catch (DocumentException de) {
565             throw new ExceptionConverter(de);
566         }
567     }
568     
569     /**
570  * Adds the author to a Document.
571  *
572      * @param author
573      * the name of the author
574  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
575  */

576     
577     public boolean addAuthor(String JavaDoc author) {
578         try {
579             return add(new Meta(Element.AUTHOR, author));
580         } catch (DocumentException de) {
581             throw new ExceptionConverter(de);
582         }
583     }
584     
585     /**
586  * Adds the creator to a Document.
587  *
588      * @param creator
589      * the name of the creator
590  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
591  */

592     
593     public boolean addCreator(String JavaDoc creator) {
594         try {
595             return add(new Meta(Element.CREATOR, creator));
596         } catch (DocumentException de) {
597             throw new ExceptionConverter(de);
598         }
599     }
600     
601     /**
602  * Adds the producer to a Document.
603  *
604  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
605  */

606     
607     public boolean addProducer() {
608         try {
609             return add(new Meta(Element.PRODUCER, "iText by lowagie.com"));
610         } catch (DocumentException de) {
611             throw new ExceptionConverter(de);
612         }
613     }
614     
615     /**
616  * Adds the current date and time to a Document.
617  *
618  * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
619  */

620     
621     public boolean addCreationDate() {
622         try {
623             /* bugfix by 'taqua' (Thomas) */
624             final SimpleDateFormat JavaDoc sdf = new SimpleDateFormat JavaDoc(
625                     "EEE MMM dd HH:mm:ss zzz yyyy");
626             return add(new Meta(Element.CREATIONDATE, sdf.format(new Date JavaDoc())));
627         } catch (DocumentException de) {
628             throw new ExceptionConverter(de);
629         }
630     }
631     
632     // methods to get the layout of the document.
633

634     /**
635  * Returns the left margin.
636  *
637  * @return the left margin
638  */

639     
640     public float leftMargin() {
641         return marginLeft;
642     }
643     
644     /**
645  * Return the right margin.
646  *
647  * @return the right margin
648  */

649     
650     public float rightMargin() {
651         return marginRight;
652     }
653     
654     /**
655  * Returns the top margin.
656  *
657  * @return the top margin
658  */

659     
660     public float topMargin() {
661         return marginTop;
662     }
663     
664     /**
665  * Returns the bottom margin.
666  *
667  * @return the bottom margin
668  */

669     
670     public float bottomMargin() {
671         return marginBottom;
672     }
673     
674     /**
675  * Returns the lower left x-coordinate.
676  *
677  * @return the lower left x-coordinate
678  */

679     
680     public float left() {
681         return pageSize.getLeft(marginLeft);
682     }
683     
684     /**
685  * Returns the upper right x-coordinate.
686  *
687  * @return the upper right x-coordinate
688  */

689     
690     public float right() {
691         return pageSize.getRight(marginRight);
692     }
693     
694     /**
695  * Returns the upper right y-coordinate.
696  *
697  * @return the upper right y-coordinate
698  */

699     
700     public float top() {
701         return pageSize.getTop(marginTop);
702     }
703     
704     /**
705  * Returns the lower left y-coordinate.
706  *
707  * @return the lower left y-coordinate
708  */

709     
710     public float bottom() {
711         return pageSize.getBottom(marginBottom);
712     }
713     
714     /**
715  * Returns the lower left x-coordinate considering a given margin.
716  *
717      * @param margin
718      * a margin
719  * @return the lower left x-coordinate
720  */

721     
722     public float left(float margin) {
723         return pageSize.getLeft(marginLeft + margin);
724     }
725     
726     /**
727  * Returns the upper right x-coordinate, considering a given margin.
728  *
729      * @param margin
730      * a margin
731  * @return the upper right x-coordinate
732  */

733     
734     public float right(float margin) {
735         return pageSize.getRight(marginRight + margin);
736     }
737     
738     /**
739  * Returns the upper right y-coordinate, considering a given margin.
740  *
741      * @param margin
742      * a margin
743  * @return the upper right y-coordinate
744  */

745     
746     public float top(float margin) {
747         return pageSize.getTop(marginTop + margin);
748     }
749     
750     /**
751  * Returns the lower left y-coordinate, considering a given margin.
752  *
753      * @param margin
754      * a margin
755  * @return the lower left y-coordinate
756  */

757     
758     public float bottom(float margin) {
759         return pageSize.getBottom(marginBottom + margin);
760     }
761     
762     /**
763  * Gets the pagesize.
764      *
765  * @return the page size
766  */

767     
768     public Rectangle getPageSize() {
769         return this.pageSize;
770     }
771     
772     /**
773      * Checks if the document is open.
774      *
775      * @return <CODE>true</CODE> if the document is open
776      */

777     public boolean isOpen() {
778         return open;
779     }
780     
781     /**
782      * Gets the iText version.
783      * This method may only be changed by Paulo Soares and/or Bruno Lowagie.
784      * @return iText version
785      */

786     public static final String JavaDoc getVersion() {
787         return ITEXT_VERSION;
788     }
789
790     /**
791  * Adds a JavaScript onLoad function to the HTML body tag
792  *
793      * @param code
794      * the JavaScript code to be executed on load of the HTML page
795  */

796     
797     public void setJavaScript_onLoad(String JavaDoc code) {
798         this.javaScript_onLoad = code;
799     }
800
801     /**
802  * Gets the JavaScript onLoad command.
803      *
804  * @return the JavaScript onLoad command
805  */

806
807     public String JavaDoc getJavaScript_onLoad() {
808         return this.javaScript_onLoad;
809     }
810
811     /**
812  * Adds a JavaScript onUnLoad function to the HTML body tag
813  *
814      * @param code
815      * the JavaScript code to be executed on unload of the HTML page
816  */

817     
818     public void setJavaScript_onUnLoad(String JavaDoc code) {
819         this.javaScript_onUnLoad = code;
820     }
821
822     /**
823  * Gets the JavaScript onUnLoad command.
824      *
825  * @return the JavaScript onUnLoad command
826  */

827
828     public String JavaDoc getJavaScript_onUnLoad() {
829         return this.javaScript_onUnLoad;
830     }
831
832     /**
833  * Adds a style class to the HTML body tag
834  *
835      * @param htmlStyleClass
836      * the style class for the HTML body tag
837  */

838     
839     public void setHtmlStyleClass(String JavaDoc htmlStyleClass) {
840         this.htmlStyleClass = htmlStyleClass;
841     }
842
843     /**
844  * Gets the style class of the HTML body tag
845  *
846  * @return the style class of the HTML body tag
847  */

848     
849     public String JavaDoc getHtmlStyleClass() {
850         return this.htmlStyleClass;
851     }
852     
853     /**
854      * Set the margin mirroring. It will mirror margins for odd/even pages.
855      * <p>
856      * Note: it will not work with {@link Table}.
857      *
858      * @param marginMirroring
859      * <CODE>true</CODE> to mirror the margins
860      * @return always <CODE>true</CODE>
861      */

862     public boolean setMarginMirroring(boolean marginMirroring) {
863         this.marginMirroring = marginMirroring;
864         DocListener listener;
865         for (Iterator JavaDoc iterator = listeners.iterator(); iterator.hasNext();) {
866             listener = (DocListener) iterator.next();
867             listener.setMarginMirroring(marginMirroring);
868         }
869         return true;
870     }
871     
872     /**
873      * Gets the margin mirroring flag.
874      *
875      * @return the margin mirroring flag
876      */

877     public boolean isMarginMirroring() {
878         return marginMirroring;
879     }
880 }
881
Popular Tags