1 |
/* ComponentView.java -- |
/* ComponentView.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 |
|
|
41 |
import java.awt.Graphics; |
import java.awt.Graphics; |
42 |
import java.awt.Shape; |
import java.awt.Shape; |
43 |
|
|
44 |
|
/** |
45 |
|
* A {@link View} implementation that is able to render arbitrary |
46 |
|
* {@link Components}. This uses the attribute |
47 |
|
* {@link StyleConstants#ComponentAttribute} to determine the |
48 |
|
* <code>Component</code> that should be rendered. This <code>Component</code> |
49 |
|
* becomes a direct child of the <code>JTextComponent</code> that contains |
50 |
|
* this <code>ComponentView</code>, so this view must not be shared between |
51 |
|
* multiple <code>JTextComponent</code>s. |
52 |
|
* |
53 |
|
* @author original author unknown |
54 |
|
* @author Roman Kennke (roman@kennke.org) |
55 |
|
*/ |
56 |
public class ComponentView extends View |
public class ComponentView extends View |
57 |
{ |
{ |
58 |
public ComponentView(Element elem) |
/** |
59 |
{ |
* Creates a new instance of <code>ComponentView</code> for the specified |
60 |
super(elem); |
* <code>Element</code>. |
61 |
} |
* |
62 |
|
* @param elem the element that this <code>View</code> is rendering |
63 |
protected Component createComponent() |
*/ |
64 |
{ |
public ComponentView(Element elem) |
65 |
return null; |
{ |
66 |
} |
super(elem); |
67 |
|
} |
68 |
public float getAlignment(int axis) |
|
69 |
{ |
/** |
70 |
return 0; |
* Creates the <code>Component</code> that this <code>View</code> is |
71 |
} |
* rendering. The <code>Component</code> is determined using |
72 |
|
* the {@link StyleConstants#ComponentAttribute} of the associated |
73 |
public final Component getComponent() |
* <code>Element</code>. |
74 |
{ |
* |
75 |
return null; |
* @return the component that is rendered |
76 |
} |
*/ |
77 |
|
protected Component createComponent() |
78 |
public float getMaximumSpan(int axis) |
{ |
79 |
{ |
return null; |
80 |
return 0; |
} |
81 |
} |
|
82 |
|
/** |
83 |
|
* Returns the alignment of this <code>View</code> along the specified axis. |
84 |
|
* |
85 |
|
* @param axis either {@link View#X_AXIS} or {@link View#Y_AXIS} |
86 |
|
* |
87 |
|
* @return the alignment of this <code>View</code> along the specified axis |
88 |
|
*/ |
89 |
|
public float getAlignment(int axis) |
90 |
|
{ |
91 |
|
return 0; |
92 |
|
} |
93 |
|
|
94 |
|
/** |
95 |
|
* Returns the <code>Component</code> that is rendered by this |
96 |
|
* <code>ComponentView</code>. |
97 |
|
* |
98 |
|
* @return the <code>Component</code> that is rendered by this |
99 |
|
* <code>ComponentView</code> |
100 |
|
*/ |
101 |
|
public final Component getComponent() |
102 |
|
{ |
103 |
|
return null; |
104 |
|
} |
105 |
|
|
106 |
|
/** |
107 |
|
* Returns the maximum span of this <code>View</code> along the specified |
108 |
|
* axis. |
109 |
|
* |
110 |
|
* This will return {@link Component#getMaximumSize()} for the specified |
111 |
|
* axis. |
112 |
|
* |
113 |
|
* @return the maximum span of this <code>View</code> along the specified |
114 |
|
* axis |
115 |
|
*/ |
116 |
|
public float getMaximumSpan(int axis) |
117 |
|
{ |
118 |
|
return 0; |
119 |
|
} |
120 |
|
|
121 |
public float getMinimumSpan(int axis) |
public float getMinimumSpan(int axis) |
122 |
{ |
{ |