author | lana |
Tue, 23 May 2017 21:11:42 +0000 | |
changeset 45187 | 331a6542b5b8 |
parent 23010 | 6dadb192ad81 |
permissions | -rw-r--r-- |
1279
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
17148
diff
changeset
|
2 |
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
1279
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
4 |
* |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
8 |
* |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
14 |
* |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
18 |
* |
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
1279
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
22 |
*/ |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
23 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
24 |
/* |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
25 |
* @test |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
26 |
* @bug 4916852 |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
27 |
* @summary Tests BorderLayout encoding |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
28 |
* @author Sergey Malenkov |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
29 |
*/ |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
30 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
31 |
import java.awt.BorderLayout; |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
32 |
import javax.swing.JLabel; |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
33 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
34 |
public final class java_awt_BorderLayout extends AbstractTest<BorderLayout> { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
35 |
private static final String[] CONSTRAINTS = { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
36 |
BorderLayout.NORTH, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
37 |
BorderLayout.SOUTH, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
38 |
BorderLayout.EAST, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
39 |
BorderLayout.WEST, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
40 |
BorderLayout.CENTER, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
41 |
BorderLayout.PAGE_START, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
42 |
BorderLayout.PAGE_END, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
43 |
BorderLayout.LINE_START, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
44 |
BorderLayout.LINE_END, |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
45 |
}; |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
46 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
47 |
public static void main(String[] args) { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
48 |
new java_awt_BorderLayout().test(true); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
49 |
} |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
50 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
51 |
@Override |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
52 |
protected BorderLayout getObject() { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
53 |
BorderLayout layout = new BorderLayout(); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
54 |
update(layout, BorderLayout.EAST); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
55 |
update(layout, BorderLayout.WEST); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
56 |
update(layout, BorderLayout.NORTH); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
57 |
update(layout, BorderLayout.SOUTH); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
58 |
return layout; |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
59 |
} |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
60 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
61 |
@Override |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
62 |
protected BorderLayout getAnotherObject() { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
63 |
BorderLayout layout = getObject(); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
64 |
update(layout, BorderLayout.CENTER); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
65 |
return layout; |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
66 |
} |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
67 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
68 |
@Override |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
69 |
protected void validate(BorderLayout before, BorderLayout after) { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
70 |
super.validate(before, after); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
71 |
for (String constraint : CONSTRAINTS) { |
17148
bb5fff33bf49
8007458: [findbugs] One more beans issue, with ReflectionUtils
malenkov
parents:
5506
diff
changeset
|
72 |
super.validator.validate(before.getLayoutComponent(constraint), |
bb5fff33bf49
8007458: [findbugs] One more beans issue, with ReflectionUtils
malenkov
parents:
5506
diff
changeset
|
73 |
after.getLayoutComponent(constraint)); |
1279
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
74 |
} |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
75 |
} |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
76 |
|
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
77 |
private static void update(BorderLayout layout, String constraints) { |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
78 |
layout.addLayoutComponent(new JLabel(constraints), constraints); |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
79 |
} |
09ac82fafd79
4916852: RFE: LTP: BorderLayout Persistence Delegate should use 1.5 API
malenkov
parents:
diff
changeset
|
80 |
} |