]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_2_1-src/src/com/ibm/richtext/awtui/TabRuler.java
icu4jsrc
[Dictionary.git] / jars / icu4j-4_2_1-src / src / com / ibm / richtext / awtui / TabRuler.java
1 /*\r
2  * (C) Copyright IBM Corp. 1998-2007.  All Rights Reserved.\r
3  *\r
4  * The program is provided "as is" without any warranty express or\r
5  * implied, including the warranty of non-infringement and the implied\r
6  * warranties of merchantibility and fitness for a particular purpose.\r
7  * IBM will not be liable for any damages suffered by you as a result\r
8  * of using the Program. In no event will IBM be liable for any\r
9  * special, indirect or consequential damages or lost profits even if\r
10  * IBM has been advised of the possibility of their occurrence. IBM\r
11  * will not be liable for any third party claims against you.\r
12  */\r
13 package com.ibm.richtext.awtui;\r
14 \r
15 import java.awt.Color;\r
16 import java.awt.Component;\r
17 import java.awt.Dimension;\r
18 import java.awt.Graphics;\r
19 \r
20 import com.ibm.richtext.textpanel.MTextPanel;\r
21 import com.ibm.richtext.uiimpl.TabRulerImpl;\r
22 import com.ibm.richtext.styledtext.MTabRuler;\r
23 \r
24 /**\r
25  * TabRuler is an implementation of MTabRulerComponent in an AWT component.\r
26  */\r
27 public final class TabRuler extends Component implements MTabRulerComponent {\r
28     \r
29     /**\r
30      * For serialization\r
31      */\r
32     private static final long serialVersionUID = -8418099860214866635L;\r
33     //static final String COPYRIGHT =\r
34     //            "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";\r
35     private TabRulerImpl fImpl;\r
36     \r
37     /**\r
38      * Create a new TabRuler.\r
39      * @param baseline the y-coordinate of the ruler's baseline\r
40      * @param origin the x-coordinate in this Component where\r
41      *     the left margin appears\r
42      * @param textPanel the MTextPanel to listen to.  This TabRuler\r
43      *     will reflect the MTextPanel's paragraph styles, and update\r
44      *     the paragraph styles when manipulated.\r
45      */\r
46     public TabRuler(int baseline, int origin, MTextPanel textPanel) {\r
47         \r
48         fImpl = new TabRulerImpl(baseline, origin, textPanel, this);\r
49     }\r
50     \r
51     /**\r
52      * Listen to the given MTextPanel and reflect its changes,\r
53      * and update its paragraph styles when TabRuler is\r
54      * manipulated.\r
55      * @param textPanel the MTextPanel to listen to\r
56      */\r
57     public void listenToTextPanel(MTextPanel textPanel) {\r
58 \r
59         fImpl.listenToTextPanel(textPanel);\r
60     }\r
61     \r
62     /**\r
63      * Return the background color of this TabRuler.\r
64      * @return the background color of this TabRuler\r
65      */\r
66     public Color getBackColor() {\r
67 \r
68         return fImpl.getBackColor();\r
69     }\r
70     \r
71     /**\r
72      * Set the background color of this TabRuler.\r
73      * @param backColor the new background color of this TabRuler\r
74      */\r
75     public void setBackColor(Color backColor) {\r
76 \r
77         fImpl.setBackColor(backColor);\r
78     }\r
79     \r
80     /**\r
81      * Return the MTabRuler represented by this TabRuler.\r
82      * @return the MTabRuler represented by this TabRuler\r
83      */\r
84     public MTabRuler getRuler() {\r
85         \r
86         return fImpl.getRuler();\r
87     }\r
88 \r
89     /**\r
90      * Return the leading margin of this TabRuler.\r
91      * @return the leading margin of this TabRuler\r
92      */\r
93     public int getLeadingMargin() {\r
94         \r
95         return fImpl.getLeadingMargin();\r
96     }\r
97 \r
98     /**\r
99      * Return the first line indent of this TabRuler.\r
100      * @return the first line indent of this TabRuler\r
101      */\r
102     public int getFirstLineIndent() {\r
103         \r
104         return fImpl.getFirstLineIndent();\r
105     }\r
106 \r
107     /**\r
108      * Return the trailing margin of this TabRuler.\r
109      * @return the trailing margin of this TabRuler\r
110      */\r
111     public final int getTrailingMargin() {\r
112         \r
113         return fImpl.getTrailingMargin();\r
114     }\r
115     \r
116     // The following are Component methods which need to be delegated to\r
117     // the implementation:\r
118     \r
119     public void paint(Graphics g) {\r
120         \r
121         fImpl.paint(g);\r
122     }\r
123     \r
124     public Dimension getPreferredSize() {\r
125         \r
126         return fImpl.getPreferredSize();\r
127     }\r
128 \r
129     public Dimension getMinimumSize() {\r
130         \r
131         return fImpl.getMinimumSize();\r
132     }\r
133 }\r