603N/A/*
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
603N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
603N/A *
603N/A * This code is free software; you can redistribute it and/or modify it
603N/A * under the terms of the GNU General Public License version 2 only, as
603N/A * published by the Free Software Foundation.
603N/A *
603N/A * This code is distributed in the hope that it will be useful, but WITHOUT
603N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
603N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
603N/A * version 2 for more details (a copy is included in the LICENSE file that
603N/A * accompanied this code).
603N/A *
603N/A * You should have received a copy of the GNU General Public License version
603N/A * 2 along with this work; if not, write to the Free Software Foundation,
603N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
603N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
603N/A */
603N/A
603N/A/*
603N/A * @test
603N/A * @bug 4916852
603N/A * @summary Tests BorderLayout encoding
603N/A * @author Sergey Malenkov
603N/A */
603N/A
603N/Aimport java.awt.BorderLayout;
603N/Aimport javax.swing.JLabel;
603N/A
603N/Apublic final class java_awt_BorderLayout extends AbstractTest<BorderLayout> {
603N/A private static final String[] CONSTRAINTS = {
603N/A BorderLayout.NORTH,
603N/A BorderLayout.SOUTH,
603N/A BorderLayout.EAST,
603N/A BorderLayout.WEST,
603N/A BorderLayout.CENTER,
603N/A BorderLayout.PAGE_START,
603N/A BorderLayout.PAGE_END,
603N/A BorderLayout.LINE_START,
603N/A BorderLayout.LINE_END,
603N/A };
603N/A
603N/A public static void main(String[] args) {
603N/A new java_awt_BorderLayout().test(true);
603N/A }
603N/A
603N/A @Override
603N/A protected BorderLayout getObject() {
603N/A BorderLayout layout = new BorderLayout();
603N/A update(layout, BorderLayout.EAST);
603N/A update(layout, BorderLayout.WEST);
603N/A update(layout, BorderLayout.NORTH);
603N/A update(layout, BorderLayout.SOUTH);
603N/A return layout;
603N/A }
603N/A
603N/A @Override
603N/A protected BorderLayout getAnotherObject() {
603N/A BorderLayout layout = getObject();
603N/A update(layout, BorderLayout.CENTER);
603N/A return layout;
603N/A }
603N/A
603N/A @Override
603N/A protected void validate(BorderLayout before, BorderLayout after) {
603N/A super.validate(before, after);
603N/A for (String constraint : CONSTRAINTS) {
6051N/A super.validator.validate(before.getLayoutComponent(constraint),
6051N/A after.getLayoutComponent(constraint));
603N/A }
603N/A }
603N/A
603N/A private static void update(BorderLayout layout, String constraints) {
603N/A layout.addLayoutComponent(new JLabel(constraints), constraints);
603N/A }
603N/A}