Index: graph/lib/apichanges.xml =================================================================== RCS file: /cvs/graph/lib/apichanges.xml,v retrieving revision 1.23 diff -u -r1.23 apichanges.xml --- graph/lib/apichanges.xml 25 Jun 2007 14:10:16 -0000 1.23 +++ graph/lib/apichanges.xml 20 Jul 2007 10:00:12 -0000 @@ -330,6 +330,20 @@ + + + + BorderSupport.getSwingBorder method introduced + + + + + + BorderSupport.getSwingBorder method introduced to acquired a Swing border from a library border. + + + + Index: graph/lib/manifest.mf =================================================================== RCS file: /cvs/graph/lib/manifest.mf,v retrieving revision 1.13 diff -u -r1.13 manifest.mf --- graph/lib/manifest.mf 25 Jun 2007 14:10:16 -0000 1.13 +++ graph/lib/manifest.mf 20 Jul 2007 10:00:12 -0000 @@ -1,4 +1,4 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.api.visual OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visual/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 2.5 +OpenIDE-Module-Specification-Version: 2.6 Index: graph/lib/src/org/netbeans/api/visual/border/BorderSupport.java =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/api/visual/border/BorderSupport.java,v retrieving revision 1.2 diff -u -r1.2 BorderSupport.java --- graph/lib/src/org/netbeans/api/visual/border/BorderSupport.java 13 Feb 2007 07:37:48 -0000 1.2 +++ graph/lib/src/org/netbeans/api/visual/border/BorderSupport.java 20 Jul 2007 10:00:12 -0000 @@ -19,6 +19,7 @@ package org.netbeans.api.visual.border; import org.netbeans.modules.visual.border.ResizeBorder; +import org.netbeans.modules.visual.border.SwingBorder; /** * This class contains support method for working with borders. @@ -37,6 +38,16 @@ */ public static boolean isOuterResizeBorder (Border border) { return border instanceof ResizeBorder && ((ResizeBorder) border).isOuter (); + } + + /** + * Returns a swing border of a border created using BorderFactory.createSwingBorder or Widget.setBorder(javax.swing.border.Border). + * @param border the widget border + * @return Swing border if possible; otherwise null + * @since 2.6 + */ + public static javax.swing.border.Border getSwingBorder (Border border) { + return border instanceof SwingBorder ? ((SwingBorder) border).getSwingBorder () : null; } } Index: graph/lib/src/org/netbeans/modules/visual/border/SwingBorder.java =================================================================== RCS file: /cvs/graph/lib/src/org/netbeans/modules/visual/border/SwingBorder.java,v retrieving revision 1.3 diff -u -r1.3 SwingBorder.java --- graph/lib/src/org/netbeans/modules/visual/border/SwingBorder.java 14 Nov 2006 10:04:25 -0000 1.3 +++ graph/lib/src/org/netbeans/modules/visual/border/SwingBorder.java 20 Jul 2007 10:00:12 -0000 @@ -49,5 +49,9 @@ public boolean isOpaque () { return false; } + + public javax.swing.border.Border getSwingBorder () { + return swingBorder; + } } Index: graph/lib/test/unit/src/apichanges/SwingBorderGetterTest.java =================================================================== RCS file: graph/lib/test/unit/src/apichanges/SwingBorderGetterTest.java diff -N graph/lib/test/unit/src/apichanges/SwingBorderGetterTest.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ graph/lib/test/unit/src/apichanges/SwingBorderGetterTest.java 20 Jul 2007 10:00:12 -0000 @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun + * Microsystems, Inc. All Rights Reserved. + */ +package apichanges; + +import org.netbeans.junit.NbTestCase; +import org.netbeans.api.visual.widget.Scene; +import org.netbeans.api.visual.border.BorderSupport; + +import javax.swing.border.BevelBorder; +import javax.swing.border.Border; + +/** + * Test for issue #103456 - BorderSupport.getSwingBorder method introduced + * @author David Kaspar + */ +public class SwingBorderGetterTest extends NbTestCase { + + public SwingBorderGetterTest (String name) { + super (name); + } + + public void testGetter () { + Scene scene = new Scene (); + BevelBorder originalBorder = new BevelBorder (BevelBorder.RAISED); + scene.setBorder (originalBorder); + Border foundBorder = BorderSupport.getSwingBorder (scene.getBorder ()); + assertEquals (originalBorder, foundBorder); + } + +}