1 |
/* GridBagLayout - Layout manager for components according to GridBagConstraints |
/* GridBagLayout - Layout manager for components according to GridBagConstraints |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003 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 java.awt; |
package java.awt; |
40 |
|
|
41 |
import java.io.Serializable; |
import java.io.Serializable; |
42 |
|
import java.util.Hashtable; |
43 |
|
|
44 |
/** |
/** |
45 |
* Stub implementation. |
* @author Michael Koch <konqueror@gmx.de> |
46 |
*/ |
*/ |
47 |
public class GridBagLayout |
public class GridBagLayout |
48 |
implements Serializable, LayoutManager2 |
implements Serializable, LayoutManager2 |
49 |
{ |
{ |
50 |
static final long serialVersionUID = 8838754796412211005L; |
private static final long serialVersionUID = 8838754796412211005L; |
51 |
|
|
52 |
|
protected static final int MINSIZE = 1; |
53 |
|
protected static final int PREFERREDSIZE = 2; |
54 |
|
protected static final int MAXGRIDSIZE = 512; |
55 |
|
|
56 |
|
protected Hashtable comptable; |
57 |
|
protected GridBagConstraints layoutInfo; |
58 |
|
protected GridBagConstraints defaultConstraints = new GridBagConstraints(); |
59 |
|
|
60 |
|
public double[] columnWeights; |
61 |
|
public int[] columnWidths; |
62 |
|
public double[] rowWeights; |
63 |
|
public int[] rowHeights; |
64 |
|
|
65 |
|
// FIXME: How should this class look like ? |
66 |
|
//protected GridBagLayoutInfo layoutInfo; |
67 |
|
public GridBagLayout () |
68 |
|
{ |
69 |
|
// Do nothing here. |
70 |
|
} |
71 |
|
|
72 |
|
public void addLayoutComponent (String name, Component component) |
73 |
|
{ |
74 |
|
// do nothing here. |
75 |
|
} |
76 |
|
|
77 |
|
public void addLayoutComponent (Component component, Object constraints) |
78 |
|
{ |
79 |
|
if (!(constraints instanceof GridBagConstraints)) |
80 |
|
throw new IllegalArgumentException(); |
81 |
|
|
82 |
|
setConstraints (component, (GridBagConstraints) constraints); |
83 |
|
} |
84 |
|
|
85 |
|
public void removeLayoutComponent (Component component) |
86 |
|
{ |
87 |
|
comptable.remove (component); |
88 |
|
} |
89 |
|
|
90 |
|
public Dimension preferredLayoutSize (Container parent) |
91 |
|
{ |
92 |
|
if (layoutInfo == null) |
93 |
|
layoutContainer (parent); |
94 |
|
|
95 |
|
throw new Error ("Not implemented"); |
96 |
|
} |
97 |
|
|
98 |
public void addLayoutComponent(String name, Component component) |
public Dimension minimumLayoutSize (Container parent) |
99 |
{ |
{ |
100 |
|
if (layoutInfo == null) |
101 |
|
layoutContainer (parent); |
102 |
|
|
103 |
|
throw new Error ("Not implemented"); |
104 |
} |
} |
105 |
|
|
106 |
public void removeLayoutComponent(Component component) |
public Dimension maximumLayoutSize (Container target) |
107 |
{ |
{ |
108 |
|
throw new Error ("Not implemented"); |
109 |
} |
} |
110 |
|
|
111 |
public Dimension preferredLayoutSize(Container parent) |
public void layoutContainer (Container parent) |
112 |
{ |
{ |
113 |
return null; |
arrangeGrid (parent); |
114 |
} |
} |
115 |
|
|
116 |
public Dimension minimumLayoutSize(Container parent) |
public float getLayoutAlignmentX (Container target) |
117 |
{ |
{ |
118 |
return null; |
throw new Error ("Not implemented"); |
119 |
} |
} |
120 |
|
|
121 |
public void layoutContainer(Container parent) |
public float getLayoutAlignmentY (Container target) |
122 |
{ |
{ |
123 |
|
throw new Error ("Not implemented"); |
124 |
} |
} |
125 |
|
|
126 |
public void addLayoutComponent(Component component, Object contraint) |
public void invalidateLayout (Container target) |
127 |
{ |
{ |
128 |
|
this.layoutInfo = null; |
129 |
|
} |
130 |
|
|
131 |
|
protected void adjustForGravity (GridBagConstraints gbc, Rectangle rect) |
132 |
|
{ |
133 |
|
throw new Error ("Not implemented"); |
134 |
|
} |
135 |
|
|
136 |
|
protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect) |
137 |
|
{ |
138 |
|
adjustForGravity (gbc, rect); |
139 |
|
} |
140 |
|
|
141 |
|
protected void arrangeGrid (Container parent) |
142 |
|
{ |
143 |
|
throw new Error ("Not implemented"); |
144 |
|
} |
145 |
|
|
146 |
|
protected void ArrangeGrid (Container parent) |
147 |
|
{ |
148 |
|
arrangeGrid (parent); |
149 |
|
} |
150 |
|
|
151 |
|
public void setConstraints (Component component, |
152 |
|
GridBagConstraints constraints) |
153 |
|
{ |
154 |
|
comptable.put (component, constraints); |
155 |
|
} |
156 |
|
|
157 |
|
public GridBagConstraints getConstraints (Component component) |
158 |
|
{ |
159 |
|
GridBagConstraints constraints = lookupConstraints (component); |
160 |
|
|
161 |
|
if (constraints == null) |
162 |
|
return null; |
163 |
|
|
164 |
|
return (GridBagConstraints) constraints.clone(); |
165 |
} |
} |
166 |
|
|
167 |
public Dimension maximumLayoutSize(Container target) |
protected GridBagConstraints lookupConstraints (Component component) |
168 |
{ |
{ |
169 |
return null; |
return (GridBagConstraints) comptable.get (component); |
170 |
} |
} |
171 |
|
|
172 |
public float getLayoutAlignmentX(Container target) |
public int[][] getLayoutDimensions () |
173 |
{ |
{ |
174 |
return 0.0f; |
throw new Error ("Not implemented"); |
175 |
} |
} |
176 |
|
|
177 |
public float getLayoutAlignmentY(Container target) |
public Point getLayoutOrigin () |
178 |
{ |
{ |
179 |
return 0.0f; |
throw new Error ("Not implemented"); |
180 |
} |
} |
181 |
|
|
182 |
public void invalidateLayout(Container target) |
public double[][] getLayoutWeights () |
183 |
{ |
{ |
184 |
|
throw new Error ("Not implemented"); |
185 |
} |
} |
186 |
|
|
187 |
public void setConstraints(Component comp, GridBagConstraints constraints) |
public Point location (int x, int y) |
188 |
{ |
{ |
189 |
|
throw new Error ("Not implemented"); |
190 |
} |
} |
191 |
} |
} |