1 |
/* View.java -- |
/* View.java -- |
2 |
Copyright (C) 2002, 2004 Free Software Foundation, Inc. |
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package javax.swing.text; |
package javax.swing.text; |
40 |
|
|
41 |
import java.awt.Container; |
import java.awt.Container; |
70 |
|
|
71 |
public abstract void paint(Graphics g, Shape s); |
public abstract void paint(Graphics g, Shape s); |
72 |
|
|
73 |
public void setParent(View a) |
public void setParent(View parent) |
74 |
{ |
{ |
75 |
parent = a; |
this.parent = parent; |
76 |
} |
} |
77 |
|
|
78 |
public View getParent() |
public View getParent() |
88 |
|
|
89 |
public Container getContainer() |
public Container getContainer() |
90 |
{ |
{ |
91 |
|
View parent = getParent(); |
92 |
return parent != null ? parent.getContainer() : null; |
return parent != null ? parent.getContainer() : null; |
93 |
} |
} |
94 |
|
|
103 |
} |
} |
104 |
|
|
105 |
public abstract float getPreferredSpan(int axis); |
public abstract float getPreferredSpan(int axis); |
106 |
|
|
107 |
|
public int getResizeWeight(int axis) |
108 |
|
{ |
109 |
|
return 0; |
110 |
|
} |
111 |
|
|
112 |
|
public float getMaximumSpan(int axis) |
113 |
|
{ |
114 |
|
if (getResizeWeight(axis) <= 0) |
115 |
|
return getPreferredSpan(axis); |
116 |
|
|
117 |
|
return Integer.MAX_VALUE; |
118 |
|
} |
119 |
|
|
120 |
|
public float getMinimumSpan(int axis) |
121 |
|
{ |
122 |
|
if (getResizeWeight(axis) <= 0) |
123 |
|
return getPreferredSpan(axis); |
124 |
|
|
125 |
|
return Integer.MAX_VALUE; |
126 |
|
} |
127 |
|
|
128 |
|
public void setSize(float width, float height) |
129 |
|
{ |
130 |
|
// The default implementation does nothing. |
131 |
|
} |
132 |
|
|
133 |
public float getAlignment(int axis) |
public float getAlignment(int axis) |
134 |
{ |
{ |
137 |
|
|
138 |
public AttributeSet getAttributes() |
public AttributeSet getAttributes() |
139 |
{ |
{ |
140 |
return elt.getAttributes(); |
return getElement().getAttributes(); |
141 |
} |
} |
142 |
|
|
143 |
public boolean isVisible() |
public boolean isVisible() |
157 |
|
|
158 |
public ViewFactory getViewFactory() |
public ViewFactory getViewFactory() |
159 |
{ |
{ |
160 |
|
View parent = getParent(); |
161 |
return parent != null ? parent.getViewFactory() : null; |
return parent != null ? parent.getViewFactory() : null; |
162 |
} |
} |
163 |
|
|
196 |
|
|
197 |
public int getStartOffset() |
public int getStartOffset() |
198 |
{ |
{ |
199 |
return elt.getStartOffset(); |
return getElement().getStartOffset(); |
200 |
} |
} |
201 |
|
|
202 |
public int getEndOffset() |
public int getEndOffset() |
203 |
{ |
{ |
204 |
return elt.getEndOffset(); |
return getElement().getEndOffset(); |
205 |
} |
} |
206 |
|
|
207 |
public Shape getChildAllocation(int index, Shape a) |
public Shape getChildAllocation(int index, Shape a) |
234 |
|
|
235 |
return null; |
return null; |
236 |
} |
} |
237 |
|
|
238 |
|
/** |
239 |
|
* @since 1.3 |
240 |
|
*/ |
241 |
|
public Graphics getGraphics() |
242 |
|
{ |
243 |
|
return getContainer().getGraphics(); |
244 |
|
} |
245 |
} |
} |
246 |
|
|