KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > custom > StyledTextPrintOptions


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt.custom;
12
13 /**
14  * Use StyledTextPrintOptions to specify printing options for the
15  * StyledText.print(Printer, StyledTextPrintOptions) API.
16  * <p>
17  * The following example prints a right aligned page number in the footer,
18  * sets the job name to "Example" and prints line background colors but no other
19  * formatting:
20  * </p>
21  * <pre>
22  * StyledTextPrintOptions options = new StyledTextPrintOptions();
23  * options.footer = "\t\t&lt;page&gt;";
24  * options.jobName = "Example";
25  * options.printLineBackground = true;
26  *
27  * Runnable runnable = styledText.print(new Printer(), options);
28  * runnable.run();
29  * </pre>
30  * @since 2.1
31  */

32 public class StyledTextPrintOptions {
33     /**
34      * Page number placeholder constant for use in <code>header</code>
35      * and <code>footer</code>. Value is <code>&lt;page&gt;</code>
36      */

37     public static final String JavaDoc PAGE_TAG = "<page>";
38     /**
39      * Separator constant for use in <code>header</code> and
40      * <code>footer</code>. Value is <code>\t</code>
41      */

42     public static final String JavaDoc SEPARATOR = "\t";
43     /**
44      * Formatted text to print in the header of each page.
45      * <p>"left '\t' center '\t' right"</p>
46      * <p>left, center, right = &lt;page&gt; | #CDATA</p>
47      * <p>Header and footer are defined as three separate regions for arbitrary
48      * text or the page number placeholder &lt;page&gt;
49      * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
50      * left aligned, centered and right aligned. They are separated by a tab
51      * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
52      */

53     public String JavaDoc header = null;
54     /**
55      * Formatted text to print in the footer of each page.
56      * <p>"left '\t' center '\t' right"</p>
57      * <p>left, center, right = &lt;page&gt; | #CDATA</p>
58      * <p>Header and footer are defined as three separate regions for arbitrary
59      * text or the page number placeholder &lt;page&gt;
60      * (<code>StyledTextPrintOptions.PAGE_TAG</code>). The three regions are
61      * left aligned, centered and right aligned. They are separated by a tab
62      * character (<code>StyledTextPrintOptions.SEPARATOR</code>).
63      */

64     public String JavaDoc footer = null;
65     /**
66      * Name of the print job.
67      */

68     public String JavaDoc jobName = null;
69     
70     /**
71      * Print the text foreground color. Default value is <code>false</code>.
72      */

73     public boolean printTextForeground = false;
74     /**
75      * Print the text background color. Default value is <code>false</code>.
76      */

77     public boolean printTextBackground = false;
78     /**
79      * Print the font styles. Default value is <code>false</code>.
80      */

81     public boolean printTextFontStyle = false;
82     /**
83      * Print the line background color. Default value is <code>false</code>.
84      */

85     public boolean printLineBackground = false;
86     
87     /**
88      * Print line numbers. Default value is <code>false</code>.
89      *
90      * @since 3.3
91      */

92     public boolean printLineNumbers = false;
93     
94     
95 }
96
Popular Tags