01: /*
02: * Javu WingS - Lightweight Java Component Set
03: * Copyright (c) 2005-2007 Krzysztof A. Sadlocha
04: * e-mail: ksadlocha@programics.com
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20:
21: package com.javujavu.javux.wings.text;
22:
23: import java.awt.Color;
24: import java.awt.Rectangle;
25: import com.javujavu.javux.wings.Style;
26: import com.javujavu.javux.wings.WingFont;
27: import com.javujavu.javux.wings.WingTextPane;
28:
29: /**
30: * A class representing the root element in <code>WingTextPane</code>
31: * <br><br>
32: * <b>This class is not thread safe
33: * synchronization is provided by WingTextPane</b>
34: */
35: public class RootNode extends BoxNode {
36: private final WingTextPane owner;
37:
38: public RootNode(WingTextPane owner) {
39: super (null); //owner style
40: this .owner = owner;
41: }
42:
43: public WingTextPane getOwner() {
44: return owner;
45: }
46:
47: public Style getStyle() {
48: return owner.getStyle();
49: }
50:
51: public WingFont getFont() {
52: return owner.getWingFont();
53: }
54:
55: public Color getForeground() {
56: return owner.getForeground();
57: }
58:
59: // public void invalidate()
60: // {
61: // super.invalidate();
62: //// owner.invalidateAndRepaint();
63: // }
64: public Rectangle getBounds() {
65: return bounds;
66: }
67:
68: public boolean isValid() {
69: return valid;
70: }
71: // public int rootPosAtPoint(int x, int y)
72: // {
73: // int r= posAtPoint(nearestX(bounds, x), nearestY(bounds, y));
74: // //prefix correction
75: // if(r>0) r-= 1;
76: // if(r>rootLength()) r= rootLength();
77: // return r;
78: // }
79: }
|