1 |
/******************************************************************************* |
= |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2005 IBM Corporation and others. |
|
2 |
* Copyright (c) 2000, 2005 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
|
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
|
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
|
7 |
* |
8 |
* Contributors: |
|
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
|
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
|
10 |
*******************************************************************************/ |
|
|
|
11 |
/******************************************************************************* |
|
|
|
12 |
* Additions/modifications to this source file by Oracle America, Inc. 2011 |
|
|
|
13 |
*******************************************************************************/ |
11 |
package org.eclipse.swt.layout; |
|
14 |
package org.eclipse.swt.layout; |
12 |
|
|
15 |
|
13 |
import org.eclipse.swt.*; |
<> |
16 |
import org.eclipse.swt.SWT; |
14 |
import org.eclipse.swt.graphics.*; |
|
17 |
import org.eclipse.swt.graphics.Point; |
|
|
|
18 |
import org.eclipse.swt.graphics.Rectangle; |
15 |
import org.eclipse.swt.widgets.*; |
|
19 |
import org.eclipse.swt.widgets.Canvas; |
|
|
|
20 |
import org.eclipse.swt.widgets.Composite; |
|
|
|
21 |
import org.eclipse.swt.widgets.Control; |
|
|
|
22 |
import org.eclipse.swt.widgets.Layout; |
16 |
|
= |
23 |
|
|
|
|
24 |
|
17 |
/** |
|
25 |
/** |
18 |
* Instances of this class determine the size and position of the |
|
26 |
* Instances of this class determine the size and position of the |
19 |
* children of a <code>Composite</code> by placing them either in |
|
27 |
* children of a <code>Composite</code> by placing them either in |
20 |
* horizontal rows or vertical columns within the parent <code>Composite</code>. |
|
28 |
* horizontal rows or vertical columns within the parent <code>Composite</code>. |
21 |
* <p> |
|
29 |
* <p> |
22 |
* <code>RowLayout</code> aligns all controls in one row if the |
|
30 |
* <code>RowLayout</code> aligns all controls in one row if the |
23 |
* <code>type</code> is set to horizontal, and one column if it is |
|
31 |
* <code>type</code> is set to horizontal, and one column if it is |
24 |
* set to vertical. It has the ability to wrap, and provides configurable |
|
32 |
* set to vertical. It has the ability to wrap, and provides configurable |
25 |
* margins and spacing. <code>RowLayout</code> has a number of configuration |
|
33 |
* margins and spacing. <code>RowLayout</code> has a number of configuration |
26 |
* fields. In addition, the height and width of each control in a |
|
34 |
* fields. In addition, the height and width of each control in a |
27 |
* <code>RowLayout</code> can be specified by setting a <code>RowData</code> |
|
35 |
* <code>RowLayout</code> can be specified by setting a <code>RowData</code> |
28 |
* object into the control using <code>setLayoutData ()</code>. |
|
36 |
* object into the control using <code>setLayoutData ()</code>. |
29 |
* </p> |
|
37 |
* </p> |
30 |
* <p> |
|
38 |
* <p> |
31 |
* The following example code creates a <code>RowLayout</code>, sets all |
|
39 |
* The following example code creates a <code>RowLayout</code>, sets all |
32 |
* of its fields to non-default values, and then sets it into a |
|
40 |
* of its fields to non-default values, and then sets it into a |
33 |
* <code>Shell</code>. |
|
41 |
* <code>Shell</code>. |
34 |
* <pre> |
|
42 |
* <pre> |
35 |
* RowLayout rowLayout = new RowLayout(); |
|
43 |
* RowLayout rowLayout = new RowLayout(); |
36 |
* rowLayout.wrap = false; |
|
44 |
* rowLayout.wrap = false; |
37 |
* rowLayout.pack = false; |
|
45 |
* rowLayout.pack = false; |
38 |
* rowLayout.justify = true; |
|
46 |
* rowLayout.justify = true; |
39 |
* rowLayout.type = SWT.VERTICAL; |
|
47 |
* rowLayout.type = SWT.VERTICAL; |
40 |
* rowLayout.marginLeft = 5; |
|
48 |
* rowLayout.marginLeft = 5; |
41 |
* rowLayout.marginTop = 5; |
|
49 |
* rowLayout.marginTop = 5; |
42 |
* rowLayout.marginRight = 5; |
|
50 |
* rowLayout.marginRight = 5; |
43 |
* rowLayout.marginBottom = 5; |
|
51 |
* rowLayout.marginBottom = 5; |
44 |
* rowLayout.spacing = 0; |
|
52 |
* rowLayout.spacing = 0; |
45 |
* shell.setLayout(rowLayout); |
|
53 |
* shell.setLayout(rowLayout); |
46 |
* </pre> |
|
54 |
* </pre> |
47 |
* If you are using the default field values, you only need one line of code: |
|
55 |
* If you are using the default field values, you only need one line of code: |
48 |
* <pre> |
|
56 |
* <pre> |
49 |
* shell.setLayout(new RowLayout()); |
|
57 |
* shell.setLayout(new RowLayout()); |
50 |
* </pre> |
|
58 |
* </pre> |
51 |
* </p> |
|
59 |
* </p> |
52 |
* |
|
60 |
* |
53 |
* @see RowData |
|
61 |
* |
54 |
*/ |
|
62 |
*/ |
55 |
public final class RowLayout extends Layout { |
<> |
63 |
public final class RowLayout |
|
|
|
64 |
extends Layout |
|
|
|
65 |
{ |
56 |
|
= |
66 |
|
57 |
/** |
|
67 |
/** |
58 |
* type specifies whether the layout places controls in rows or |
|
68 |
* type specifies whether the layout places controls in rows or |
59 |
* columns. |
|
69 |
* columns. |
60 |
* |
|
70 |
* |
61 |
* The default value is HORIZONTAL. |
|
71 |
* The default value is HORIZONTAL. |
62 |
* |
|
72 |
* |
63 |
* Possible values are: |
|
73 |
* Possible values are: |
64 |
* |
|
74 |
* |
65 |
* HORIZONTAL: Position the controls horizontally from left to right |
|
75 |
* HORIZONTAL: Position the controls horizontally from left to right |
66 |
* VERTICAL: Position the controls vertically from top to bottom |
|
76 |
* VERTICAL: Position the controls vertically from top to bottom |
67 |
* |
|
77 |
* |
68 |
* @since 2.0 |
|
78 |
* @since 2.0 |
69 |
*/ |
|
79 |
*/ |
70 |
public int type = SWT.HORIZONTAL; |
|
80 |
public int type = SWT.HORIZONTAL; |
71 |
|
|
81 |
|
72 |
/** |
|
82 |
/** |
73 |
* marginWidth specifies the number of pixels of horizontal margin |
|
83 |
* marginWidth specifies the number of pixels of horizontal margin |
74 |
* that will be placed along the left and right edges of the layout. |
|
84 |
* that will be placed along the left and right edges of the layout. |
75 |
* |
|
85 |
* |
76 |
* The default value is 0. |
|
86 |
* The default value is 0. |
77 |
* |
|
87 |
* |
78 |
* @since 3.0 |
|
88 |
* @since 3.0 |
79 |
*/ |
|
89 |
*/ |
80 |
public int marginWidth = 0; |
|
90 |
public int marginWidth = 0; |
81 |
|
|
91 |
|
82 |
/** |
|
92 |
/** |
83 |
* marginHeight specifies the number of pixels of vertical margin |
|
93 |
* marginHeight specifies the number of pixels of vertical margin |
84 |
* that will be placed along the top and bottom edges of the layout. |
|
94 |
* that will be placed along the top and bottom edges of the layout. |
85 |
* |
|
95 |
* |
86 |
* The default value is 0. |
|
96 |
* The default value is 0. |
87 |
* |
|
97 |
* |
88 |
* @since 3.0 |
|
98 |
* @since 3.0 |
89 |
*/ |
|
99 |
*/ |
90 |
public int marginHeight = 0; |
|
100 |
public int marginHeight = 0; |
91 |
|
|
101 |
|
92 |
/** |
|
102 |
/** |
93 |
* spacing specifies the number of pixels between the edge of one cell |
|
103 |
* spacing specifies the number of pixels between the edge of one cell |
94 |
* and the edge of its neighbouring cell. |
|
104 |
* and the edge of its neighbouring cell. |
95 |
* |
|
105 |
* |
96 |
* The default value is 3. |
|
106 |
* The default value is 3. |
97 |
*/ |
|
107 |
*/ |
98 |
public int spacing = 3; |
|
108 |
public int spacing = 3; |
99 |
|
|
109 |
|
100 |
/** |
|
110 |
/** |
101 |
* wrap specifies whether a control will be wrapped to the next |
|
111 |
* wrap specifies whether a control will be wrapped to the next |
102 |
* row if there is insufficient space on the current row. |
|
112 |
* row if there is insufficient space on the current row. |
103 |
* |
|
113 |
* |
104 |
* The default value is true. |
|
114 |
* The default value is true. |
105 |
*/ |
|
115 |
*/ |
106 |
public boolean wrap = true; |
|
116 |
public boolean wrap = true; |
107 |
|
|
117 |
|
108 |
/** |
|
118 |
/** |
109 |
* pack specifies whether all controls in the layout take |
|
119 |
* pack specifies whether all controls in the layout take |
110 |
* their preferred size. If pack is false, all controls will |
|
120 |
* their preferred size. If pack is false, all controls will |
111 |
* have the same size which is the size required to accommodate the |
|
121 |
* have the same size which is the size required to accommodate the |
112 |
* largest preferred height and the largest preferred width of all |
|
122 |
* largest preferred height and the largest preferred width of all |
113 |
* the controls in the layout. |
|
123 |
* the controls in the layout. |
114 |
* |
|
124 |
* |
115 |
* The default value is true. |
|
125 |
* The default value is true. |
116 |
*/ |
|
126 |
*/ |
117 |
public boolean pack = true; |
|
127 |
public boolean pack = true; |
118 |
|
|
128 |
|
119 |
/** |
|
129 |
/** |
120 |
* fill specifies whether the controls in a row should be |
|
130 |
* fill specifies whether the controls in a row should be |
121 |
* all the same height for horizontal layouts, or the same |
|
131 |
* all the same height for horizontal layouts, or the same |
122 |
* width for vertical layouts. |
|
132 |
* width for vertical layouts. |
123 |
* |
|
133 |
* |
124 |
* The default value is false. |
|
134 |
* The default value is false. |
125 |
* |
|
135 |
* |
126 |
* @since 3.0 |
|
136 |
* @since 3.0 |
127 |
*/ |
|
137 |
*/ |
128 |
public boolean fill = false; |
|
138 |
public boolean fill = false; |
129 |
|
|
139 |
|
130 |
/** |
|
140 |
/** |
131 |
* justify specifies whether the controls in a row should be |
|
141 |
* justify specifies whether the controls in a row should be |
132 |
* fully justified, with any extra space placed between the controls. |
|
142 |
* fully justified, with any extra space placed between the controls. |
133 |
* |
|
143 |
* |
134 |
* The default value is false. |
|
144 |
* The default value is false. |
135 |
*/ |
|
145 |
*/ |
136 |
public boolean justify = false; |
|
146 |
public boolean justify = false; |
137 |
|
|
147 |
|
138 |
/** |
|
148 |
/** |
139 |
* marginLeft specifies the number of pixels of horizontal margin |
|
149 |
* marginLeft specifies the number of pixels of horizontal margin |
140 |
* that will be placed along the left edge of the layout. |
|
150 |
* that will be placed along the left edge of the layout. |
141 |
* |
|
151 |
* |
142 |
* The default value is 3. |
|
152 |
* The default value is 3. |
143 |
*/ |
|
153 |
*/ |
144 |
public int marginLeft = 3; |
|
154 |
public int marginLeft = 3; |
145 |
|
|
155 |
|
146 |
/** |
|
156 |
/** |
147 |
* marginTop specifies the number of pixels of vertical margin |
|
157 |
* marginTop specifies the number of pixels of vertical margin |
148 |
* that will be placed along the top edge of the layout. |
|
158 |
* that will be placed along the top edge of the layout. |
149 |
* |
|
159 |
* |
150 |
* The default value is 3. |
|
160 |
* The default value is 3. |
151 |
*/ |
|
161 |
*/ |
152 |
public int marginTop = 3; |
|
162 |
public int marginTop = 3; |
153 |
|
|
163 |
|
154 |
/** |
|
164 |
/** |
155 |
* marginRight specifies the number of pixels of horizontal margin |
|
165 |
* marginRight specifies the number of pixels of horizontal margin |
156 |
* that will be placed along the right edge of the layout. |
|
166 |
* that will be placed along the right edge of the layout. |
157 |
* |
|
167 |
* |
158 |
* The default value is 3. |
|
168 |
* The default value is 3. |
159 |
*/ |
|
169 |
*/ |
160 |
public int marginRight = 3; |
|
170 |
public int marginRight = 3; |
161 |
|
|
171 |
|
162 |
/** |
|
172 |
/** |
163 |
* marginBottom specifies the number of pixels of vertical margin |
|
173 |
* marginBottom specifies the number of pixels of vertical margin |
164 |
* that will be placed along the bottom edge of the layout. |
|
174 |
* that will be placed along the bottom edge of the layout. |
165 |
* |
|
175 |
* |
166 |
* The default value is 3. |
|
176 |
* The default value is 3. |
167 |
*/ |
|
177 |
*/ |
168 |
public int marginBottom = 3; |
|
178 |
public int marginBottom = 3; |
169 |
|
|
179 |
|
|
|
-+ |
180 |
public Canvas m_canvas = null; |
|
|
= |
181 |
|
170 |
/** |
|
182 |
/** |
171 |
* Constructs a new instance of this class. |
|
183 |
* Constructs a new instance of this class. |
172 |
*/ |
|
184 |
*/ |
173 |
public RowLayout () { |
<> |
185 |
public RowLayout() |
|
|
|
186 |
{ |
174 |
} |
= |
187 |
} |
175 |
|
|
188 |
|
176 |
/** |
|
189 |
/** |
177 |
* Constructs a new instance of this class given the type. |
|
190 |
* Constructs a new instance of this class given the type. |
178 |
* |
|
191 |
* |
179 |
* @param type the type of row layout |
|
192 |
* @param type the type of row layout |
180 |
* |
|
193 |
* |
181 |
* @since 2.0 |
|
194 |
* @since 2.0 |
182 |
*/ |
|
195 |
*/ |
183 |
public RowLayout (int type) { |
<> |
196 |
public RowLayout(int type) |
|
|
|
197 |
{ |
184 |
this.type = type; |
= |
198 |
this.type = type; |
185 |
} |
|
199 |
} |
186 |
|
|
200 |
|
187 |
protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { |
<> |
201 |
protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) |
|
|
|
202 |
{ |
188 |
Point extent; |
= |
203 |
Point extent; |
189 |
if (type == SWT.HORIZONTAL) { |
<> |
204 |
if (type == SWT.HORIZONTAL) |
|
|
|
205 |
{ |
190 |
extent = layoutHorizontal (composite, false, (wHint != SWT.DEFAULT) && wrap, wHint, flushCache); |
= |
206 |
extent = layoutHorizontal(composite, false, (wHint != SWT.DEFAULT) && wrap, wHint, flushCache); |
|
|
<> |
207 |
} |
191 |
} else { |
|
208 |
else |
|
|
|
209 |
{ |
192 |
extent = layoutVertical (composite, false, (hHint != SWT.DEFAULT) && wrap, hHint, flushCache); |
= |
210 |
extent = layoutVertical(composite, false, (hHint != SWT.DEFAULT) && wrap, hHint, flushCache); |
193 |
} |
|
211 |
} |
194 |
if (wHint != SWT.DEFAULT) extent.x = wHint; |
<> |
212 |
if (wHint != SWT.DEFAULT) |
|
|
|
213 |
extent.x = wHint; |
195 |
if (hHint != SWT.DEFAULT) extent.y = hHint; |
|
214 |
if (hHint != SWT.DEFAULT) |
|
|
|
215 |
extent.y = hHint; |
196 |
return extent; |
= |
216 |
return extent; |
197 |
} |
|
217 |
} |
198 |
|
|
218 |
|
199 |
Point computeSize (Control control, boolean flushCache) { |
<> |
219 |
Point computeSize(Control control, boolean flushCache) |
|
|
|
220 |
{ |
|
|
|
221 |
if (!flushCache) |
|
|
|
222 |
return control.getSize(); |
200 |
int wHint = SWT.DEFAULT, hHint = SWT.DEFAULT; |
= |
223 |
int wHint = SWT.DEFAULT, hHint = SWT.DEFAULT; |
201 |
RowData data = (RowData) control.getLayoutData (); |
|
224 |
RowData data = (RowData) control.getLayoutData(); |
202 |
if (data != null) { |
<> |
225 |
if (data != null) |
|
|
|
226 |
{ |
203 |
wHint = data.width; |
= |
227 |
wHint = data.width; |
204 |
hHint = data.height; |
|
228 |
hHint = data.height; |
205 |
} |
|
229 |
} |
206 |
return control.computeSize (wHint, hHint, flushCache); |
|
230 |
return control.computeSize(wHint, hHint, flushCache); |
207 |
} |
|
231 |
} |
208 |
|
|
232 |
|
209 |
protected boolean flushCache (Control control) { |
<> |
233 |
protected boolean flushCache(Control control) |
|
|
|
234 |
{ |
210 |
return true; |
= |
235 |
return true; |
211 |
} |
|
236 |
} |
212 |
|
|
237 |
|
213 |
String getName () { |
<> |
238 |
String getName() |
|
|
|
239 |
{ |
214 |
String string = getClass ().getName (); |
= |
240 |
String string = getClass().getName(); |
215 |
int index = string.lastIndexOf ('.'); |
|
241 |
int index = string.lastIndexOf('.'); |
216 |
if (index == -1) return string; |
<> |
242 |
if (index == -1) |
|
|
|
243 |
return string; |
217 |
return string.substring (index + 1, string.length ()); |
= |
244 |
return string.substring(index + 1, string.length()); |
218 |
} |
|
245 |
} |
219 |
|
|
246 |
|
220 |
protected void layout (Composite composite, boolean flushCache) { |
<> |
247 |
public void layout(Composite composite, boolean flushCache) |
|
|
|
248 |
{ |
|
|
= |
249 |
// MDO - we perform our own size calculations before calling layout |
|
|
|
250 |
// so there is no need to redo the computation |
|
|
-+ |
251 |
flushCache = false; |
221 |
Rectangle clientArea = composite.getClientArea (); |
= |
252 |
Rectangle clientArea = composite.getClientArea(); |
222 |
if (type == SWT.HORIZONTAL) { |
<> |
253 |
if (type == SWT.HORIZONTAL) |
|
|
|
254 |
{ |
223 |
layoutHorizontal (composite, true, wrap, clientArea.width, flushCache); |
= |
255 |
layoutHorizontal(composite, true, wrap, clientArea.width, flushCache); |
|
|
<> |
256 |
} |
224 |
} else { |
|
257 |
else |
|
|
|
258 |
{ |
225 |
layoutVertical (composite, true, wrap, clientArea.height, flushCache); |
= |
259 |
layoutVertical(composite, true, wrap, clientArea.height, flushCache); |
226 |
} |
|
260 |
} |
227 |
} |
|
261 |
} |
228 |
|
|
262 |
|
229 |
Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int width, boolean flushCache) { |
<> |
263 |
void layoutHorizontalCenter(Control child) |
|
|
|
264 |
{ |
|
|
|
265 |
Rectangle bounds = child.getBounds(); |
|
|
|
266 |
int width = bounds.width; |
230 |
int count = 0; |
|
267 |
|
|
|
|
268 |
Rectangle canvasBounds = m_canvas.getBounds(); |
|
|
|
269 |
int canvasWidth = canvasBounds.width; |
|
|
= |
270 |
|
|
|
-+ |
271 |
canvasWidth -= bounds.x; |
|
|
|
272 |
canvasWidth -= (marginRight + marginWidth); |
|
|
|
273 |
bounds.x = bounds.x + ((canvasWidth - width) / 2); |
|
|
|
274 |
child.setBounds(bounds); |
|
|
|
275 |
} |
|
|
= |
276 |
|
|
|
-+ |
277 |
void layoutHorizontalRight(Control child) |
|
|
|
278 |
{ |
|
|
|
279 |
Rectangle bounds = child.getBounds(); |
|
|
= |
280 |
|
|
|
-+ |
281 |
Rectangle canvasBounds = m_canvas.getBounds(); |
|
|
|
282 |
bounds.x = canvasBounds.width - (marginRight + marginWidth + bounds.width); |
|
|
= |
283 |
|
|
|
-+ |
284 |
child.setBounds(bounds); |
|
|
|
285 |
} |
|
|
= |
286 |
|
231 |
Control [] children = composite.getChildren (); |
<> |
287 |
void layoutVerticalCenter(Control child) |
|
|
|
288 |
{ |
|
|
|
289 |
Rectangle bounds = child.getBounds(); |
232 |
for (int i=0; i<children.length; i++) { |
|
290 |
int height = bounds.height; |
|
|
= |
291 |
|
|
|
-+ |
292 |
Rectangle canvasBounds = m_canvas.getBounds(); |
|
|
|
293 |
int canvasHeight = canvasBounds.height; |
|
|
= |
294 |
|
|
|
-+ |
295 |
canvasHeight -= bounds.y; |
|
|
|
296 |
canvasHeight -= (marginBottom + marginHeight); |
|
|
|
297 |
bounds.y = bounds.y + ((canvasHeight - height) / 2); |
|
|
= |
298 |
|
|
|
-+ |
299 |
child.setBounds(bounds); |
|
|
|
300 |
} |
|
|
= |
301 |
|
|
|
-+ |
302 |
void layoutVerticalBottom(Control child) |
|
|
|
303 |
{ |
|
|
|
304 |
Rectangle bounds = child.getBounds(); |
|
|
= |
305 |
|
|
|
-+ |
306 |
Rectangle canvasBounds = m_canvas.getBounds(); |
|
|
= |
307 |
|
|
|
-+ |
308 |
bounds.y = canvasBounds.height - (marginBottom + marginHeight + bounds.height); |
|
|
= |
309 |
|
|
|
-+ |
310 |
child.setBounds(bounds); |
|
|
|
311 |
} |
|
|
= |
312 |
|
|
|
-+ |
313 |
void layoutVerticalAlignment(Control child) |
|
|
|
314 |
{ |
|
|
|
315 |
if (m_canvas == null) |
|
|
|
316 |
{ |
|
|
|
317 |
return; |
|
|
|
318 |
} |
|
|
= |
319 |
|
|
|
-+ |
320 |
if ((child instanceof IAlign) == false) |
|
|
|
321 |
{ |
|
|
|
322 |
return; |
|
|
|
323 |
} |
|
|
= |
324 |
|
|
|
<> |
325 |
IAlign iAlign = (IAlign) child; |
|
|
|
326 |
int align = iAlign.getVerticalAlign(); |
|
|
|
327 |
if (align == IAlign.ALIGNMENT_VERTICAL_CENTER) |
|
|
|
328 |
{ |
233 |
Control control = children [i]; |
|
329 |
layoutVerticalCenter(child); |
234 |
RowData data = (RowData) control.getLayoutData (); |
|
330 |
} |
|
|
|
331 |
else if (align == IAlign.ALIGNMENT_VERTICAL_BOTTOM) |
|
|
|
332 |
{ |
|
|
|
333 |
layoutVerticalBottom(child); |
|
|
|
334 |
} |
|
|
|
335 |
} |
|
|
= |
336 |
|
|
|
<> |
337 |
void layoutAlignment(Control child) |
|
|
|
338 |
{ |
235 |
if (data == null || !data.exclude) { |
|
339 |
if (m_canvas == null) |
|
|
|
340 |
{ |
236 |
children [count++] = children [i]; |
|
341 |
return; |
237 |
} |
= |
342 |
} |
|
|
|
343 |
|
|
|
-+ |
344 |
if ((child instanceof IAlign) == false) |
|
|
|
345 |
{ |
|
|
|
346 |
return; |
238 |
} |
= |
347 |
} |
|
|
|
348 |
|
|
|
-+ |
349 |
IAlign iAlign = (IAlign) child; |
|
|
|
350 |
int align = iAlign.getAlign(); |
|
|
|
351 |
if (align == IAlign.ALIGNMENT_HORIZONTAL_CENTER) |
|
|
|
352 |
{ |
|
|
|
353 |
layoutHorizontalCenter(child); |
|
|
|
354 |
} |
|
|
|
355 |
else if (align == IAlign.ALIGNMENT_HORIZONTAL_RIGHT) |
|
|
|
356 |
{ |
|
|
|
357 |
layoutHorizontalRight(child); |
|
|
|
358 |
} |
|
|
|
359 |
} |
|
|
= |
360 |
|
|
|
-+ |
361 |
Point layoutHorizontal(Composite composite, boolean move, boolean wrap, int width, boolean flushCache) |
|
|
|
362 |
{ |
|
|
|
363 |
Control[] children = composite.getChildren(); |
|
|
|
364 |
int count = children.length; |
|
|
= |
365 |
// for (int i=0; i<children.length; i++) { |
|
|
|
366 |
// Control control = children [i]; |
|
|
|
367 |
// RowData data = (RowData) control.getLayoutData (); |
|
|
|
368 |
// if (data == null || !data.exclude) { |
|
|
|
369 |
// children [count++] = children [i]; |
|
|
|
370 |
// } |
|
|
|
371 |
// } |
239 |
int childWidth = 0, childHeight = 0, maxHeight = 0; |
|
372 |
int childWidth = 0, childHeight = 0, maxHeight = 0; |
240 |
if (!pack) { |
<> |
373 |
if (!pack) |
|
|
|
374 |
{ |
241 |
for (int i=0; i<count; i++) { |
|
375 |
for (int i = 0; i < count; i++) |
|
|
|
376 |
{ |
242 |
Control child = children [i]; |
= |
377 |
Control child = children[i]; |
243 |
Point size = computeSize (child, flushCache); |
|
378 |
Point size = computeSize(child, flushCache); |
244 |
childWidth = Math.max (childWidth, size.x); |
|
379 |
childWidth = Math.max(childWidth, size.x); |
245 |
childHeight = Math.max (childHeight, size.y); |
|
380 |
childHeight = Math.max(childHeight, size.y); |
246 |
} |
|
381 |
} |
247 |
maxHeight = childHeight; |
|
382 |
maxHeight = childHeight; |
248 |
} |
|
383 |
} |
249 |
int clientX = 0, clientY = 0; |
|
384 |
int clientX = 0, clientY = 0; |
250 |
if (move) { |
<> |
385 |
if (move) |
|
|
|
386 |
{ |
251 |
Rectangle rect = composite.getClientArea (); |
= |
387 |
Rectangle rect = composite.getClientArea(); |
252 |
clientX = rect.x; |
|
388 |
clientX = rect.x; |
253 |
clientY = rect.y; |
|
389 |
clientY = rect.y; |
254 |
} |
|
390 |
} |
255 |
int [] wraps = null; |
|
391 |
int[] wraps = null; |
256 |
boolean wrapped = false; |
|
392 |
boolean wrapped = false; |
257 |
Rectangle [] bounds = null; |
|
393 |
Rectangle[] bounds = null; |
258 |
if (move && (justify || fill)) { |
<> |
394 |
if (move && (justify || fill)) |
|
|
|
395 |
{ |
259 |
bounds = new Rectangle [count]; |
= |
396 |
bounds = new Rectangle[count]; |
260 |
wraps = new int [count]; |
|
397 |
wraps = new int[count]; |
261 |
} |
|
398 |
} |
262 |
int maxX = 0, x = marginLeft + marginWidth, y = marginTop + marginHeight; |
|
399 |
int maxX = 0, x = marginLeft + marginWidth, y = marginTop + marginHeight; |
263 |
for (int i=0; i<count; i++) { |
<> |
400 |
for (int i = 0; i < count; i++) |
|
|
|
401 |
{ |
264 |
Control child = children [i]; |
= |
402 |
Control child = children[i]; |
265 |
if (pack) { |
<> |
403 |
if (pack) |
|
|
|
404 |
{ |
266 |
Point size = computeSize (child, flushCache); |
= |
405 |
Point size = computeSize(child, flushCache); |
267 |
childWidth = size.x; |
|
406 |
childWidth = size.x; |
268 |
childHeight = size.y; |
|
407 |
childHeight = size.y; |
|
|
|
408 |
// only add spacing if the child takes up space |
|
|
-+ |
409 |
if (childWidth <= 0) |
|
|
|
410 |
{ |
|
|
|
411 |
continue; |
269 |
} |
= |
412 |
} |
|
|
<> |
413 |
} |
270 |
if (wrap && (i != 0) && (x + childWidth > width)) { |
|
414 |
if (wrap && (i != 0) && (x + childWidth > width)) |
|
|
|
415 |
{ |
271 |
wrapped = true; |
= |
416 |
wrapped = true; |
272 |
if (move && (justify || fill)) wraps [i - 1] = maxHeight; |
<> |
417 |
if (move && (justify || fill)) |
|
|
|
418 |
wraps[i - 1] = maxHeight; |
273 |
x = marginLeft + marginWidth; |
= |
419 |
x = marginLeft + marginWidth; |
274 |
y += spacing + maxHeight; |
|
420 |
y += spacing + maxHeight; |
|
|
<> |
421 |
if (pack) |
275 |
if (pack) maxHeight = 0; |
|
422 |
maxHeight = 0; |
276 |
} |
= |
423 |
} |
277 |
if (pack || fill) { |
<> |
424 |
if (pack || fill) |
|
|
|
425 |
{ |
278 |
maxHeight = Math.max (maxHeight, childHeight); |
= |
426 |
maxHeight = Math.max(maxHeight, childHeight); |
279 |
} |
|
427 |
} |
280 |
if (move) { |
<> |
428 |
if (move) |
|
|
|
429 |
{ |
281 |
int childX = x + clientX, childY = y + clientY; |
= |
430 |
int childX = x + clientX, childY = y + clientY; |
282 |
if (justify || fill) { |
<> |
431 |
if (justify || fill) |
|
|
|
432 |
{ |
283 |
bounds [i] = new Rectangle (childX, childY, childWidth, childHeight); |
= |
433 |
bounds[i] = new Rectangle(childX, childY, childWidth, childHeight); |
|
|
<> |
434 |
} |
284 |
} else { |
|
435 |
else |
|
|
|
436 |
{ |
285 |
child.setBounds (childX, childY, childWidth, childHeight); |
= |
437 |
child.setBounds(childX, childY, childWidth, childHeight); |
286 |
} |
|
438 |
} |
287 |
} |
|
439 |
} |
288 |
x += spacing + childWidth; |
|
440 |
x += spacing + childWidth; |
289 |
maxX = Math.max (maxX, x); |
|
441 |
maxX = Math.max(maxX, x); |
290 |
} |
|
442 |
} |
291 |
maxX = Math.max (clientX + marginLeft + marginWidth, maxX - spacing); |
|
443 |
maxX = Math.max(clientX + marginLeft + marginWidth, maxX - spacing); |
|
|
<> |
444 |
if (!wrapped) |
292 |
if (!wrapped) maxX += marginRight + marginWidth; |
|
445 |
maxX += marginRight + marginWidth; |
293 |
if (move && (justify || fill)) { |
|
446 |
if (move && (justify || fill)) |
|
|
|
447 |
{ |
294 |
int space = 0, margin = 0; |
= |
448 |
int space = 0, margin = 0; |
295 |
if (!wrapped) { |
<> |
449 |
if (!wrapped) |
|
|
|
450 |
{ |
296 |
space = Math.max (0, (width - maxX) / (count + 1)); |
= |
451 |
space = Math.max(0, (width - maxX) / (count + 1)); |
297 |
margin = Math.max (0, ((width - maxX) % (count + 1)) / 2); |
|
452 |
margin = Math.max(0, ((width - maxX) % (count + 1)) / 2); |
|
|
<> |
453 |
} |
298 |
} else { |
|
454 |
else |
|
|
|
455 |
{ |
299 |
if (fill || justify) { |
|
456 |
if (fill || justify) |
|
|
|
457 |
{ |
300 |
int last = 0; |
= |
458 |
int last = 0; |
|
|
<> |
459 |
if (count > 0) |
301 |
if (count > 0) wraps [count - 1] = maxHeight; |
|
460 |
wraps[count - 1] = maxHeight; |
302 |
for (int i=0; i<count; i++) { |
|
461 |
for (int i = 0; i < count; i++) |
|
|
|
462 |
{ |
303 |
if (wraps [i] != 0) { |
|
463 |
if (wraps[i] != 0) |
|
|
|
464 |
{ |
304 |
int wrapCount = i - last + 1; |
= |
465 |
int wrapCount = i - last + 1; |
305 |
if (justify) { |
<> |
466 |
if (justify) |
|
|
|
467 |
{ |
306 |
int wrapX = 0; |
= |
468 |
int wrapX = 0; |
307 |
for (int j=last; j<=i; j++) { |
<> |
469 |
for (int j = last; j <= i; j++) |
|
|
|
470 |
{ |
308 |
wrapX += bounds [j].width + spacing; |
= |
471 |
wrapX += bounds[j].width + spacing; |
309 |
} |
|
472 |
} |
310 |
space = Math.max (0, (width - wrapX) / (wrapCount + 1)); |
|
473 |
space = Math.max(0, (width - wrapX) / (wrapCount + 1)); |
311 |
margin = Math.max (0, ((width - wrapX) % (wrapCount + 1)) / 2); |
|
474 |
margin = Math.max(0, ((width - wrapX) % (wrapCount + 1)) / 2); |
312 |
} |
|
475 |
} |
313 |
for (int j=last; j<=i; j++) { |
<> |
476 |
for (int j = last; j <= i; j++) |
|
|
|
477 |
{ |
|
|
|
478 |
if (justify) |
314 |
if (justify) bounds [j].x += (space * (j - last + 1)) + margin; |
|
479 |
bounds[j].x += (space * (j - last + 1)) + margin; |
|
|
|
480 |
if (fill) |
315 |
if (fill) bounds [j].height = wraps [i]; |
|
481 |
bounds[j].height = wraps[i]; |
316 |
} |
= |
482 |
} |
317 |
last = i + 1; |
|
483 |
last = i + 1; |
318 |
} |
|
484 |
} |
319 |
} |
|
485 |
} |
320 |
} |
|
486 |
} |
321 |
} |
|
487 |
} |
322 |
for (int i=0; i<count; i++) { |
<> |
488 |
for (int i = 0; i < count; i++) |
|
|
|
489 |
{ |
323 |
if (!wrapped) { |
|
490 |
if (!wrapped) |
|
|
|
491 |
{ |
|
|
|
492 |
if (justify) |
324 |
if (justify) bounds [i].x += (space * (i + 1)) + margin; |
|
493 |
bounds[i].x += (space * (i + 1)) + margin; |
|
|
|
494 |
if (fill) |
325 |
if (fill) bounds [i].height = maxHeight; |
|
495 |
bounds[i].height = maxHeight; |
326 |
} |
= |
496 |
} |
327 |
children [i].setBounds (bounds [i]); |
|
497 |
children[i].setBounds(bounds[i]); |
328 |
} |
|
498 |
} |
329 |
} |
|
499 |
} |
|
|
|
500 |
|
|
|
-+ |
501 |
for (int i = 0; i < count; i++) |
|
|
|
502 |
{ |
|
|
|
503 |
Control child = children[i]; |
|
|
|
504 |
layoutVerticalAlignment(child); |
|
|
|
505 |
} |
330 |
return new Point (maxX, y + maxHeight + marginBottom + marginHeight); |
= |
506 |
return new Point(maxX, y + maxHeight + marginBottom + marginHeight); |
331 |
} |
|
507 |
} |
332 |
|
|
508 |
|
333 |
Point layoutVertical (Composite composite, boolean move, boolean wrap, int height, boolean flushCache) { |
<> |
509 |
Point layoutVertical(Composite composite, boolean move, boolean wrap, int height, boolean flushCache) |
334 |
int count = 0; |
|
510 |
{ |
335 |
Control [] children = composite.getChildren (); |
= |
511 |
Control[] children = composite.getChildren(); |
|
|
<> |
512 |
int count = children.length; |
336 |
for (int i=0; i<children.length; i++) { |
|
513 |
// for (int i=0; i<children.length; i++) { |
337 |
Control control = children [i]; |
|
514 |
// Control control = children [i]; |
338 |
RowData data = (RowData) control.getLayoutData (); |
|
515 |
// RowData data = (RowData) control.getLayoutData (); |
339 |
if (data == null || !data.exclude) { |
|
516 |
// if (data == null || !data.exclude) { |
340 |
children [count++] = children [i]; |
|
517 |
// children [count++] = children [i]; |
341 |
} |
|
518 |
// } |
342 |
} |
|
519 |
// } |
343 |
int childWidth = 0, childHeight = 0, maxWidth = 0; |
= |
520 |
int childWidth = 0, childHeight = 0, maxWidth = 0; |
344 |
if (!pack) { |
<> |
521 |
if (!pack) |
|
|
|
522 |
{ |
345 |
for (int i=0; i<count; i++) { |
|
523 |
for (int i = 0; i < count; i++) |
|
|
|
524 |
{ |
346 |
Control child = children [i]; |
= |
525 |
Control child = children[i]; |
347 |
Point size = computeSize (child, flushCache); |
|
526 |
Point size = computeSize(child, flushCache); |
348 |
childWidth = Math.max (childWidth, size.x); |
|
527 |
childWidth = Math.max(childWidth, size.x); |
349 |
childHeight = Math.max (childHeight, size.y); |
|
528 |
childHeight = Math.max(childHeight, size.y); |
350 |
} |
|
529 |
} |
351 |
maxWidth = childWidth; |
|
530 |
maxWidth = childWidth; |
352 |
} |
|
531 |
} |
353 |
int clientX = 0, clientY = 0; |
|
532 |
int clientX = 0, clientY = 0; |
354 |
if (move) { |
<> |
533 |
if (move) |
|
|
|
534 |
{ |
355 |
Rectangle rect = composite.getClientArea (); |
= |
535 |
Rectangle rect = composite.getClientArea(); |
356 |
clientX = rect.x; |
|
536 |
clientX = rect.x; |
357 |
clientY = rect.y; |
|
537 |
clientY = rect.y; |
358 |
} |
|
538 |
} |
359 |
int [] wraps = null; |
|
539 |
int[] wraps = null; |
360 |
boolean wrapped = false; |
|
540 |
boolean wrapped = false; |
361 |
Rectangle [] bounds = null; |
|
541 |
Rectangle[] bounds = null; |
362 |
if (move && (justify || fill)) { |
<> |
542 |
if (move && (justify || fill)) |
|
|
|
543 |
{ |
363 |
bounds = new Rectangle [count]; |
= |
544 |
bounds = new Rectangle[count]; |
364 |
wraps = new int [count]; |
|
545 |
wraps = new int[count]; |
365 |
} |
|
546 |
} |
366 |
int maxY = 0, x = marginLeft + marginWidth, y = marginTop + marginHeight; |
|
547 |
int maxY = 0, x = marginLeft + marginWidth, y = marginTop + marginHeight; |
367 |
for (int i=0; i<count; i++) { |
<> |
548 |
for (int i = 0; i < count; i++) |
|
|
|
549 |
{ |
368 |
Control child = children [i]; |
= |
550 |
Control child = children[i]; |
369 |
if (pack) { |
<> |
551 |
if (pack) |
|
|
|
552 |
{ |
370 |
Point size = computeSize (child, flushCache); |
= |
553 |
Point size = computeSize(child, flushCache); |
371 |
childWidth = size.x; |
|
554 |
childWidth = size.x; |
372 |
childHeight = size.y; |
|
555 |
childHeight = size.y; |
|
|
|
556 |
// only add spacing if the child takes up space |
|
|
-+ |
557 |
if (childHeight <= 0) |
|
|
|
558 |
{ |
|
|
|
559 |
continue; |
373 |
} |
= |
560 |
} |
|
|
<> |
561 |
} |
374 |
if (wrap && (i != 0) && (y + childHeight > height)) { |
|
562 |
if (wrap && (i != 0) && (y + childHeight > height)) |
|
|
|
563 |
{ |
375 |
wrapped = true; |
= |
564 |
wrapped = true; |
376 |
if (move && (justify || fill)) wraps [i - 1] = maxWidth; |
<> |
565 |
if (move && (justify || fill)) |
|
|
|
566 |
wraps[i - 1] = maxWidth; |
377 |
x += spacing + maxWidth; |
= |
567 |
x += spacing + maxWidth; |
378 |
y = marginTop + marginHeight; |
|
568 |
y = marginTop + marginHeight; |
|
|
<> |
569 |
if (pack) |
379 |
if (pack) maxWidth = 0; |
|
570 |
maxWidth = 0; |
380 |
} |
= |
571 |
} |
381 |
if (pack || fill) { |
<> |
572 |
if (pack || fill) |
|
|
|
573 |
{ |
382 |
maxWidth = Math.max (maxWidth, childWidth); |
= |
574 |
maxWidth = Math.max(maxWidth, childWidth); |
383 |
} |
|
575 |
} |
384 |
if (move) { |
<> |
576 |
if (move) |
|
|
|
577 |
{ |
385 |
int childX = x + clientX, childY = y + clientY; |
= |
578 |
int childX = x + clientX, childY = y + clientY; |
386 |
if (justify || fill) { |
<> |
579 |
if (justify || fill) |
|
|
|
580 |
{ |
387 |
bounds [i] = new Rectangle (childX, childY, childWidth, childHeight); |
= |
581 |
bounds[i] = new Rectangle(childX, childY, childWidth, childHeight); |
|
|
<> |
582 |
} |
388 |
} else { |
|
583 |
else |
|
|
|
584 |
{ |
389 |
child.setBounds (childX, childY, childWidth, childHeight); |
= |
585 |
child.setBounds(childX, childY, childWidth, childHeight); |
390 |
} |
|
586 |
} |
391 |
} |
|
587 |
} |
392 |
y += spacing + childHeight; |
|
588 |
y += spacing + childHeight; |
393 |
maxY = Math.max (maxY, y); |
|
589 |
maxY = Math.max(maxY, y); |
394 |
} |
|
590 |
} |
395 |
maxY = Math.max (clientY + marginTop + marginHeight, maxY - spacing); |
|
591 |
maxY = Math.max(clientY + marginTop + marginHeight, maxY - spacing); |
|
|
<> |
592 |
if (!wrapped) |
396 |
if (!wrapped) maxY += marginBottom + marginHeight; |
|
593 |
maxY += marginBottom + marginHeight; |
397 |
if (move && (justify || fill)) { |
|
594 |
if (move && (justify || fill)) |
|
|
|
595 |
{ |
398 |
int space = 0, margin = 0; |
= |
596 |
int space = 0, margin = 0; |
399 |
if (!wrapped) { |
<> |
597 |
if (!wrapped) |
|
|
|
598 |
{ |
400 |
space = Math.max (0, (height - maxY) / (count + 1)); |
= |
599 |
space = Math.max(0, (height - maxY) / (count + 1)); |
401 |
margin = Math.max (0, ((height - maxY) % (count + 1)) / 2); |
|
600 |
margin = Math.max(0, ((height - maxY) % (count + 1)) / 2); |
|
|
<> |
601 |
} |
402 |
} else { |
|
602 |
else |
|
|
|
603 |
{ |
403 |
if (fill || justify) { |
|
604 |
if (fill || justify) |
|
|
|
605 |
{ |
404 |
int last = 0; |
= |
606 |
int last = 0; |
|
|
<> |
607 |
if (count > 0) |
405 |
if (count > 0) wraps [count - 1] = maxWidth; |
|
608 |
wraps[count - 1] = maxWidth; |
406 |
for (int i=0; i<count; i++) { |
|
609 |
for (int i = 0; i < count; i++) |
|
|
|
610 |
{ |
407 |
if (wraps [i] != 0) { |
|
611 |
if (wraps[i] != 0) |
|
|
|
612 |
{ |
408 |
int wrapCount = i - last + 1; |
= |
613 |
int wrapCount = i - last + 1; |
409 |
if (justify) { |
<> |
614 |
if (justify) |
|
|
|
615 |
{ |
410 |
int wrapY = 0; |
= |
616 |
int wrapY = 0; |
411 |
for (int j=last; j<=i; j++) { |
<> |
617 |
for (int j = last; j <= i; j++) |
|
|
|
618 |
{ |
412 |
wrapY += bounds [j].height + spacing; |
= |
619 |
wrapY += bounds[j].height + spacing; |
413 |
} |
|
620 |
} |
414 |
space = Math.max (0, (height - wrapY) / (wrapCount + 1)); |
|
621 |
space = Math.max(0, (height - wrapY) / (wrapCount + 1)); |
415 |
margin = Math.max (0, ((height - wrapY) % (wrapCount + 1)) / 2); |
|
622 |
margin = Math.max(0, ((height - wrapY) % (wrapCount + 1)) / 2); |
416 |
} |
|
623 |
} |
417 |
for (int j=last; j<=i; j++) { |
<> |
624 |
for (int j = last; j <= i; j++) |
|
|
|
625 |
{ |
|
|
|
626 |
if (justify) |
418 |
if (justify) bounds [j].y += (space * (j - last + 1)) + margin; |
|
627 |
bounds[j].y += (space * (j - last + 1)) + margin; |
|
|
|
628 |
if (fill) |
419 |
if (fill) bounds [j].width = wraps [i]; |
|
629 |
bounds[j].width = wraps[i]; |
420 |
} |
= |
630 |
} |
421 |
last = i + 1; |
|
631 |
last = i + 1; |
422 |
} |
|
632 |
} |
423 |
} |
|
633 |
} |
424 |
} |
|
634 |
} |
425 |
} |
|
635 |
} |
426 |
for (int i=0; i<count; i++) { |
<> |
636 |
for (int i = 0; i < count; i++) |
|
|
|
637 |
{ |
427 |
if (!wrapped) { |
|
638 |
if (!wrapped) |
|
|
|
639 |
{ |
|
|
|
640 |
if (justify) |
428 |
if (justify) bounds [i].y += (space * (i + 1)) + margin; |
|
641 |
bounds[i].y += (space * (i + 1)) + margin; |
|
|
|
642 |
if (fill) |
429 |
if (fill) bounds [i].width = maxWidth; |
|
643 |
bounds[i].width = maxWidth; |
430 |
} |
= |
644 |
} |
431 |
children [i].setBounds (bounds [i]); |
|
645 |
children[i].setBounds(bounds[i]); |
432 |
} |
|
646 |
} |
433 |
} |
|
647 |
} |
|
|
|
648 |
|
|
|
-+ |
649 |
for (int i = 0; i < count; i++) |
|
|
|
650 |
{ |
|
|
|
651 |
Control child = children[i]; |
|
|
|
652 |
layoutAlignment(child); |
|
|
|
653 |
} |
434 |
return new Point (x + maxWidth + marginRight + marginWidth, maxY); |
= |
654 |
return new Point(x + maxWidth + marginRight + marginWidth, maxY); |
435 |
} |
|
655 |
} |
436 |
|
|
656 |
|
437 |
public String toString () { |
<> |
657 |
public String toString() |
|
|
|
658 |
{ |
438 |
String string = getName ()+" {"; |
= |
659 |
String string = getName() + " {"; |
439 |
string += "type="+((type != SWT.HORIZONTAL) ? "SWT.VERTICAL" : "SWT.HORIZONTAL")+" "; |
|
660 |
string += "type=" + ((type != SWT.HORIZONTAL) ? "SWT.VERTICAL": "SWT.HORIZONTAL") + " "; |
|
|
<> |
661 |
if (marginWidth != 0) |
440 |
if (marginWidth != 0) string += "marginWidth="+marginWidth+" "; |
|
662 |
string += "marginWidth=" + marginWidth + " "; |
|
|
|
663 |
if (marginHeight != 0) |
441 |
if (marginHeight != 0) string += "marginHeight="+marginHeight+" "; |
|
664 |
string += "marginHeight=" + marginHeight + " "; |
|
|
|
665 |
if (marginLeft != 0) |
442 |
if (marginLeft != 0) string += "marginLeft="+marginLeft+" "; |
|
666 |
string += "marginLeft=" + marginLeft + " "; |
|
|
|
667 |
if (marginTop != 0) |
443 |
if (marginTop != 0) string += "marginTop="+marginTop+" "; |
|
668 |
string += "marginTop=" + marginTop + " "; |
|
|
|
669 |
if (marginRight != 0) |
444 |
if (marginRight != 0) string += "marginRight="+marginRight+" "; |
|
670 |
string += "marginRight=" + marginRight + " "; |
|
|
|
671 |
if (marginBottom != 0) |
445 |
if (marginBottom != 0) string += "marginBottom="+marginBottom+" "; |
|
672 |
string += "marginBottom=" + marginBottom + " "; |
|
|
|
673 |
if (spacing != 0) |
446 |
if (spacing != 0) string += "spacing="+spacing+" "; |
|
674 |
string += "spacing=" + spacing + " "; |
447 |
string += "wrap="+wrap+" "; |
= |
675 |
string += "wrap=" + wrap + " "; |
448 |
string += "pack="+pack+" "; |
|
676 |
string += "pack=" + pack + " "; |
449 |
string += "fill="+fill+" "; |
|
677 |
string += "fill=" + fill + " "; |
450 |
string += "justify="+justify+" "; |
|
678 |
string += "justify=" + justify + " "; |
451 |
string = string.trim(); |
|
679 |
string = string.trim(); |
452 |
string += "}"; |
|
680 |
string += "}"; |
453 |
return string; |
|
681 |
return string; |
454 |
} |
|
682 |
} |
455 |
} |
|
683 |
} |