Java Code Examples for org.netbeans.api.java.platform.JavaPlatform#getInstallFolders()

The following examples show how to use org.netbeans.api.java.platform.JavaPlatform#getInstallFolders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaFXPlatformJavadoc.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NonNull
private Collection<? extends JavaPlatform> findJavaPlatforms(@NonNull final File jfxrt) {
    final JavaPlatform[] jps = JavaPlatformManager.getDefault().getPlatforms(
            null,
            new Specification(
                "j2se", //NOI18N
                null));
    final Collection<JavaPlatform> res = new ArrayList<JavaPlatform>(jps.length);
    final FileObject jfxrfFo = FileUtil.toFileObject(jfxrt);
    if (jfxrfFo != null) {
        for (JavaPlatform jp : jps) {
            for (FileObject installFolder : jp.getInstallFolders()) {
                if (FileUtil.isParentOf(installFolder, jfxrfFo)) {
                    res.add(jp);
                }
            }
        }
    }
    return res;
}
 
Example 2
Source File: CachingArchiveProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NonNull
private Pair<File,String> mapJarToCtSym(
    @NonNull final File file) {
    if (USE_CT_SYM && NAME_RT_JAR.equals(file.getName())) {
        final FileObject fo = FileUtil.toFileObject(file);
        if (fo != null) {
            for (JavaPlatform jp : JavaPlatformManager.getDefault().getInstalledPlatforms()) {
                for (FileObject jdkFolder : jp.getInstallFolders()) {
                    if (FileUtil.isParentOf(jdkFolder, fo)) {
                        final FileObject ctSym = jdkFolder.getFileObject(PATH_CT_SYM);
                        File ctSymFile;
                        if (ctSym != null && (ctSymFile = FileUtil.toFile(ctSym)) != null) {
                            return Pair.<File,String>of(ctSymFile,PATH_RT_JAR_IN_CT_SYM);
                        }
                    }
                }
            }
        }
    }
    return Pair.<File,String>of(file, null);
}
 
Example 3
Source File: WLDeploymentManager.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private File getJavaBinary() {
    // TODO configurable ? or use the jdk server is running on ?
    JavaPlatform platform = JavaPlatformManager.getDefault().getDefaultPlatform();
    Collection<FileObject> folders = platform.getInstallFolders();
    String javaBinary = Utilities.isWindows() ? "java.exe" : "java"; // NOI18N
    if (folders.size() > 0) {
        FileObject folder = folders.iterator().next();
        File file = FileUtil.toFile(folder);
        if (file != null) {
            javaBinary = file.getAbsolutePath() + File.separator
                    + "bin" + File.separator
                    + (Utilities.isWindows() ? "java.exe" : "java"); // NOI18N
        }
    }
    return new File(javaBinary);
}
 
Example 4
Source File: JavaFxRuntimeInclusion.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns status of the artifact at relative path runtimePath in platform javaPlatform
 * @param javaPlatform the {@link JavaPlatform} where the artifact is to be searched for
 * @param runtimePath relative path to artifact
 * @return status of artifact presence/inclusion in platform
 */
@NonNull
private static Support forRuntime(@NonNull final JavaPlatform javaPlatform, @NonNull final String runtimePath) {
    Parameters.notNull("javaPlatform", javaPlatform);   //NOI18N
    Parameters.notNull("rtPath", runtimePath);   //NOI18N
    for (FileObject installFolder : javaPlatform.getInstallFolders()) {
        final FileObject jfxrtJar = installFolder.getFileObject(runtimePath);
        if (jfxrtJar != null  && jfxrtJar.isData()) {
            final URL jfxrtRoot = FileUtil.getArchiveRoot(jfxrtJar.toURL());
            for (ClassPath.Entry e : javaPlatform.getBootstrapLibraries().entries()) {
                if (jfxrtRoot.equals(e.getURL())) {
                    return Support.INCLUDED;
                }
            }
            return Support.PRESENT;
        }
    }
    return Support.MISSING;
}
 
Example 5
Source File: JavaFxDefaultJavadocImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
@NonNull
public Collection<URI> getDefaultJavadoc(@NonNull final JavaPlatform platform) {
    final List<URI> result = new ArrayList<>();
    final JavadocFilter filter = new JavadocFilter();
    for (FileObject installFolder : platform.getInstallFolders()) {
        for (FileObject file : installFolder.getChildren()) {
            final Collection<? extends URI> roots = filter.accept(file);
            result.addAll(roots);
        }
    }
    if (!result.isEmpty()) {
        return Collections.unmodifiableCollection(result);
    }
    final SpecificationVersion spec = platform.getSpecification().getVersion();
    final String uri = OFFICIAL_JAVADOC.get(spec);
    if (uri != null) {
        try {
            return Collections.singletonList(new URI(uri));
        } catch (URISyntaxException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return Collections.<URI>emptyList();
}
 
Example 6
Source File: JavaUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Search provided Java SE home in installed platformsList.
 * <p/>
 * @param javaHome Java SE home currently selected.
 * @return Returns Java SE platform {@see JavaPlatform} object matching
 *         provided Java SE home or <code>null</code> if no such
 *         installed platform was found.
 */
public static JavaPlatform findInstalledPlatform(
        @NonNull final File javaHome) {
    // Avoid NPEs and troll developer a bit.
    Parameters.notNull("javaHome", javaHome);
    // Scan all install folders of all onstalled platformsList
    // for Java SE home.
    JavaPlatform[] platforms = getInstalledJavaSEPlatforms();
    JavaPlatform javaPlatform = null;
    for (JavaPlatform platform : platforms) {
        for (FileObject fo : platform.getInstallFolders()) {
            if (javaHome.equals(FileUtil.toFile(fo))) {
                javaPlatform = platform;
                break;
            }
        }
        if (javaPlatform != null) {
            break;
        }
    }
    return javaPlatform;        
}
 
Example 7
Source File: JavaUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Search Java SE with provided java home in provided platforms array.
 * <p/>
 * @param javaPlatforms Java SE platforms to search in.
 * @param javaHome      Java SE home to search for.
 * @return Returns Java SE platform {@see JavaPlatform} object matching
 *         provided Java SE home or <code>null</code> if no such
 *         installed platform was found.
 */
public static JavaPlatform findPlatformByJavaHome(
        @NonNull final JavaPlatform[] javaPlatforms,
        @NonNull final File javaHome) {
    // Avoid NPEs and troll developer a bit.
    Parameters.notNull("javaPlatforms", javaPlatforms);
    Parameters.notNull("javaHome", javaHome);
    // Scan all install folders of all onstalled platformsList
    // for Java SE home.
    JavaPlatform javaPlatform = null;
    for (JavaPlatform platform : javaPlatforms) {
        for (FileObject fo : platform.getInstallFolders()) {
            if (javaHome.equals(FileUtil.toFile(fo))) {
                javaPlatform = platform;
                break;
            }
        }
        if (javaPlatform != null) {
            break;
        }
    }
    return javaPlatform;        
}
 
Example 8
Source File: PayaraInstance.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns Java SE platform {@see JavaPlatform} object configured
 * for GlassFfish server.
 * <p/>
 * Current code is not optimal. It does full scan of installed platforms
 * to search for platform installation folder matching java home folder
 * from GlassFfish server instance object.
 * <p/>
 * @return Returns Java SE platform {@see JavaPlatform} object configured
 *         for GlassFfish server or null if no such platform was configured.
 */
public JavaPlatform getJavaPlatform() {
    String javaHome = getJavaHome();
    if (javaHome == null || javaHome.length() == 0) {
        return null;
    }
    JavaPlatform[] platforms
            = JavaPlatformManager.getDefault().getInstalledPlatforms();
    File javaHomeFile = new File(javaHome);
    JavaPlatform javaPlatform = null;
    for (JavaPlatform platform : platforms) {
        for (FileObject fo : platform.getInstallFolders()) {
            if (javaHomeFile.equals(FileUtil.toFile(fo))) {
                javaPlatform = platform;
                break;
            }
        }
        if (javaPlatform != null) {
            break;
        }
    }
    return javaPlatform;
}
 
Example 9
Source File: GlassfishInstance.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns Java SE platform {@see JavaPlatform} object configured
 * for GlassFfish server.
 * <p/>
 * Current code is not optimal. It does full scan of installed platforms
 * to search for platform installation folder matching java home folder
 * from GlassFfish server instance object.
 * <p/>
 * @return Returns Java SE platform {@see JavaPlatform} object configured
 *         for GlassFfish server or null if no such platform was configured.
 */
public JavaPlatform getJavaPlatform() {
    String javaHome = getJavaHome();
    if (javaHome == null || javaHome.length() == 0) {
        return null;
    }
    JavaPlatform[] platforms
            = JavaPlatformManager.getDefault().getInstalledPlatforms();
    File javaHomeFile = new File(javaHome);
    JavaPlatform javaPlatform = null;
    for (JavaPlatform platform : platforms) {
        for (FileObject fo : platform.getInstallFolders()) {
            if (javaHomeFile.equals(FileUtil.toFile(fo))) {
                javaPlatform = platform;
                break;
            }
        }
        if (javaPlatform != null) {
            break;
        }
    }
    return javaPlatform;
}
 
Example 10
Source File: JavaUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Search provided Java SE home in installed platformsList.
 * <p/>
 * @param javaHome Java SE home currently selected.
 * @return Returns Java SE platform {@see JavaPlatform} object matching
 *         provided Java SE home or <code>null</code> if no such
 *         installed platform was found.
 */
public static JavaPlatform findInstalledPlatform(
        @NonNull final File javaHome) {
    // Avoid NPEs and troll developer a bit.
    Parameters.notNull("javaHome", javaHome);
    // Scan all install folders of all onstalled platformsList
    // for Java SE home.
    JavaPlatform[] platforms = getInstalledJavaSEPlatforms();
    JavaPlatform javaPlatform = null;
    for (JavaPlatform platform : platforms) {
        for (FileObject fo : platform.getInstallFolders()) {
            if (javaHome.equals(FileUtil.toFile(fo))) {
                javaPlatform = platform;
                break;
            }
        }
        if (javaPlatform != null) {
            break;
        }
    }
    return javaPlatform;        
}
 
Example 11
Source File: JavaUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Search Java SE with provided java home in provided platforms array.
 * <p/>
 * @param javaPlatforms Java SE platforms to search in.
 * @param javaHome      Java SE home to search for.
 * @return Returns Java SE platform {@see JavaPlatform} object matching
 *         provided Java SE home or <code>null</code> if no such
 *         installed platform was found.
 */
public static JavaPlatform findPlatformByJavaHome(
        @NonNull final JavaPlatform[] javaPlatforms,
        @NonNull final File javaHome) {
    // Avoid NPEs and troll developer a bit.
    Parameters.notNull("javaPlatforms", javaPlatforms);
    Parameters.notNull("javaHome", javaHome);
    // Scan all install folders of all onstalled platformsList
    // for Java SE home.
    JavaPlatform javaPlatform = null;
    for (JavaPlatform platform : javaPlatforms) {
        for (FileObject fo : platform.getInstallFolders()) {
            if (javaHome.equals(FileUtil.toFile(fo))) {
                javaPlatform = platform;
                break;
            }
        }
        if (javaPlatform != null) {
            break;
        }
    }
    return javaPlatform;        
}
 
Example 12
Source File: JavaFxDefaultSourcesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@NonNull
public List<URI> getDefaultSources(@NonNull final JavaPlatform platform) {
    final Collection<? extends FileObject> fos = platform.getInstallFolders();
    if (fos.isEmpty()) {
        return Collections.emptyList();
    }
    final File javaHome = FileUtil.toFile(fos.iterator().next());
    if (javaHome == null) {
        return Collections.emptyList();
    }
    return getFxSources(javaHome);
}
 
Example 13
Source File: J2SEPlatformDefaultJavadocImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<URI> getDefaultJavadoc(@NonNull final JavaPlatform platform) {
    final List<URI> result = new ArrayList<>();
    final JavadocFilter filter = new JavadocFilter();
    for (FileObject folder : platform.getInstallFolders()) {
        for (FileObject file : folder.getChildren()) {
            final Collection<? extends URI> roots = filter.accept(file);
            result.addAll(roots);
        }
    }
    if (!result.isEmpty()) {
        return Collections.unmodifiableList(result);
    }
    String version = platform.getSpecification().getVersion().toString();
    if (!OFFICIAL_JAVADOC.containsKey(version)) {
        LOG.log(Level.WARNING, "unrecognized Java spec version: {0}", version);
    }
    String location = OFFICIAL_JAVADOC.get(version);
    if (location != null) {
        try {
            return Collections.singletonList(new URI(location));
        } catch (URISyntaxException x) {
            LOG.log(Level.INFO, null, x);
        }
    }
    return Collections.emptyList();
}
 
Example 14
Source File: JavaFxRuntimeInclusion.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the classpath entries which should be included into project's classpath
 * to include JavaFX on given platform.
 * @param javaPlatform for which the classpath entries should be created
 * @return the classpath entries separated by {@link java.io.File#pathSeparatorChar} to include
 * to project classpath or an empty string if JavaFX is already a part of the {@link JavaPlatform}s
 * classpath.
 * @throws IllegalArgumentException if given {@link JavaPlatform} does not support JavaFX or
 * the platform is not a valid J2SE platform.
 *
 * <p class="nonnormative">
 * Typical usage of this method is:
 * <pre>
 * {@code
 * if (JavaFxRuntimeInclusion.forPlatform(javaPlatform).isSupported()) {
 *      Set&lt;String&gt; cpEntries = JavaFxRuntimeInclusion.getProjectClassPathExtension(javaPlatform);
 *      if (cpEntries.length > 0) {
 *          appendToProjectClasspath(cpEntries);
 *      }
 * }
 * </pre>
 * </p>
 *
 */
public static Set<String> getProjectClassPathExtension(@NonNull final JavaPlatform javaPlatform) {
    Parameters.notNull("javaPlatform", javaPlatform);   //NOI18N
    if (!SPEC_J2SE.equals(javaPlatform.getSpecification().getName())) {
        final Collection<? extends FileObject> installFolders = javaPlatform.getInstallFolders();
        throw new IllegalArgumentException(
            String.format(
                "Java platform %s (%s) installed in %s is not a valid J2SE platform.",    //NOI18N
                javaPlatform.getDisplayName(),
                javaPlatform.getSpecification(),
                installFolders.isEmpty() ?
                    "???" : //NOI18N
                    FileUtil.getFileDisplayName(installFolders.iterator().next())));
    }
    final JavaFxRuntimeInclusion inclusion = forPlatform(javaPlatform);
    if (!inclusion.isSupported()) {
        return new LinkedHashSet<String>();
    }
    List<String> artifacts = inclusion.getExtensionArtifactPaths();
    if(!artifacts.isEmpty()) {
        Set<String> extensionProp = new LinkedHashSet<String>();
        Iterator<String> i = artifacts.iterator();
        while(i.hasNext()) {
            String artifact = i.next();
            extensionProp.add(
                    String.format(
                        "${%s}/%s",  //NOI18N
                        getPlatformHomeProperty(javaPlatform),
                        artifact));
        }
        return extensionProp; //.toArray(new String[0]);
    }
    return new LinkedHashSet<String>();
}
 
Example 15
Source File: JDKSetupTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Tests the presence of FX SDK components in pre-specified locations
 * inside Mac JDK 7u4 or all-system JDK 7u6+.
 */
public void testFXSDKinJDK() {
    if(!DISABLE_ALL_TESTS) {
        checkJDKVersion();
        assertTrue("JDK version could not be determined.", versionChecked);
        JavaPlatform platform = JavaPlatform.getDefault();
        Collection<FileObject> roots = platform.getInstallFolders();
        if(!JDKpre16 && JDKOSType == OSType.MAC && JDK7u4to5) {
            // Mac JDK 7u4 has new FX SDK directory structure but misses webstart and browser plugins
            assertTrue(fileExists(roots, "lib/ant-javafx.jar"));
            assertTrue(fileExists(roots, "jre/lib/jfxrt.jar"));
            System.out.println(TEST_RESULT + "JDK directory structure OK (WebStart and browser plugins assumed missing).");
        } else {
            if(!JDKpre16 && !JDKpre7u6) {
                // JDK 7u6 and above has new FX SDK directory structure
                FileObject javawsFO = platform.findTool("javaws");
                assertNotNull(javawsFO);
                assertTrue(fileExists(roots, "bin/javaws") || fileExists(roots, "bin/javaws.exe"));
                assertTrue(fileExists(roots, "lib/ant-javafx.jar"));
                assertTrue(fileExists(roots, "jre/lib/jfxrt.jar"));
                assertTrue(fileExists(roots, "jre/lib/deploy.jar"));
                assertTrue(fileExists(roots, "jre/lib/javaws.jar"));
                assertTrue(fileExists(roots, "jre/lib/plugin.jar"));
                System.out.println(TEST_RESULT + "JDK directory structure OK.");
            } else {
                // FX SDK not inside JDK, but JDK should contain WebStart
                //FileObject javawsFO = platform.findTool("javaws");
                //assertNotNull(javawsFO);
                //assertTrue(fileExists(roots, "bin/javaws") || fileExists(roots, "bin/javaws.exe"));
                System.out.println(TEST_RESULT + "JDK directory structure OK.");
            }
        }
    }
}
 
Example 16
Source File: ModuleProperties.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static File getPlatformLocation(JavaPlatform platform) {
    Collection<FileObject> installs = platform.getInstallFolders();
    if (installs.size() == 1) {
        return FileUtil.toFile(installs.iterator().next());
    } else {
        return null;
    }
}
 
Example 17
Source File: BootClassPathImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private PathResourceImplementation createFxCPImpl(JavaPlatform pat) {
    for (FileObject fo : pat.getInstallFolders()) {
        FileObject jdk8 = fo.getFileObject("jre/lib/ext/jfxrt.jar"); // NOI18N
        if (jdk8 == null) {
            FileObject jdk7 = fo.getFileObject("jre/lib/jfxrt.jar"); // NOI18N
            if (jdk7 != null) {
                // jdk7 add the classes on bootclasspath
                if (FileUtil.isArchiveFile(jdk7)) {
                    return ClassPathSupport.createResource(FileUtil.getArchiveRoot(jdk7.toURL()));
                }
            }
        }
    }
    return null;
}
 
Example 18
Source File: J2SEPlatformDefaultSourcesImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@NonNull
public List<URI> getDefaultSources(@NonNull final JavaPlatform platform) {
    final Collection<? extends FileObject> fos = platform.getInstallFolders();
    if (fos.isEmpty()) {
        return Collections.emptyList();
    }
    final File javaHome = FileUtil.toFile(fos.iterator().next());
    if (javaHome == null) {
        return Collections.emptyList();
    }
    return getSources(javaHome, platform.getSpecification().getVersion());
}
 
Example 19
Source File: JavaPlatformSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** 
 * Returns and if necessary creates JavaPlatform of the given Eclipse project.
 * @return null for default platform
 */
public JavaPlatform getJavaPlatform(EclipseProject eclProject, List<String> importProblems) {
    String eclPlfDir = eclProject.getJDKDirectory();
    // eclPlfDir can be null in a case when a JDK was set for an eclipse
    // project in Eclipse then the directory with JDK was deleted from
    // filesystem and then a project is imported into NetBeans
    if (eclPlfDir == null) {
        return null;
    }
    File eclPlfFile = FileUtil.normalizeFile(new File(eclPlfDir));
    if (defaultNetBeansPlatformFile != null && eclPlfFile.equals(defaultNetBeansPlatformFile)) { // use default platform
        return null;
    }
    JavaPlatform nbPlf = null;
    for (JavaPlatform current : getAllPlatforms()) {
        Collection<FileObject> instFolders = current.getInstallFolders();
        if (instFolders.isEmpty()) {
            // ignore
            continue;
        }
        File nbPlfDir = FileUtil.toFile(instFolders.iterator().next());
        if (nbPlfDir.equals(eclPlfFile)) {
            nbPlf = current;
            // found
            break;
        }
    }
    if (nbPlf != null) {
        return nbPlf;
    }
    // If we are not able to find any platform let's use the "broken
    // platform" which can be easily added by user with "Resolve Reference
    // Problems" feature. Such behaviour is much better then using a default
    // platform when user imports more projects.
    FileObject fo = FileUtil.toFileObject(eclPlfFile);
    if (fo != null) {
        try {
            JavaPlatform plat = J2SEPlatformCreator.createJ2SEPlatform(fo);
            JavaPlatform[] platforms = JavaPlatformManager.getDefault().getPlatforms(plat.getDisplayName(), null);
            if (platforms.length > 0) {
                return platforms[0];
            }
            if (plat.findTool("javac") != null) { //NOI18N
                justCreatedPlatforms.add(plat);
                return plat;
            } else {
                importProblems.add(NbBundle.getMessage(Importer.class, "MSG_JRECannotBeUsed", eclProject.getName())); //NOI18N
                return null;
            }
        } catch (IOException ex) {
            importProblems.add("Cannot create J2SE platform for '" + eclPlfFile + "'. " + "Default platform will be used instead."); // XXX I18N
            return null;
        }
    } else {
        importProblems.add(NbBundle.getMessage(Importer.class, "MSG_JDKDoesnExistUseDefault", // NOI18N
                eclProject.getName(), eclPlfFile.getAbsolutePath()));
        return null;
    }
}
 
Example 20
Source File: PlatformsCustomizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void selectPlatform (Node pNode) {
    Component active = null;
    for (Component c : cards.getComponents()) {
        if (c.isVisible() &&
            (c == jPanel1 || c == messageArea)) {
                active = c;
                break;
        }
    }
    final Dimension lastSize = active == null ?
        null :
        active.getSize();
    this.clientArea.removeAll();
    this.messageArea.removeAll();
    this.removeButton.setEnabled (false);
    if (pNode == null) {
        ((CardLayout)cards.getLayout()).last(cards);
        return;
    }
    JComponent target = messageArea;
    JComponent owner = messageArea;
    JavaPlatform platform = pNode.getLookup().lookup(JavaPlatform.class);
    if (pNode != getExplorerManager().getRootContext()) {
        if (platform != null) {
            this.removeButton.setEnabled (canRemove(platform, pNode.getLookup().lookup(DataObject.class)));
            if (!platform.getInstallFolders().isEmpty()) {
                this.platformName.setText(pNode.getDisplayName());
                for (FileObject installFolder : platform.getInstallFolders()) {
                    File file = FileUtil.toFile(installFolder);
                    if (file != null) {
                        this.platformHome.setText (file.getAbsolutePath());
                    }
                }
                target = clientArea;
                owner = jPanel1;
            }
        }
        Component component = null;
        if (pNode.hasCustomizer()) {
            component = pNode.getCustomizer();
        }
        if (component == null) {
            final PropertySheet sp = new PropertySheet();
            sp.setNodes(new Node[] {pNode});
            component = sp;
        }
        addComponent(target, component);
    }
    if (lastSize != null) {
        final Dimension newSize = owner.getPreferredSize();
        final Dimension updatedSize = new Dimension(
            Math.max(lastSize.width, newSize.width),
            Math.max(lastSize.height, newSize.height));
        if (!newSize.equals(updatedSize)) {
            owner.setPreferredSize(updatedSize);
        }
    }
    target.revalidate();
    CardLayout cl = (CardLayout) cards.getLayout();
    if (target == clientArea) {
        cl.first (cards);
    }
    else {
        cl.last (cards);
    }
}