Package gov.nasa.jsc.mct.importExport.utilities

Examples of gov.nasa.jsc.mct.importExport.utilities.CustomFileChooser


    public List<File> selectFiles(Component source){
      AbstractComponent targetComponent = currentContext.getSelectedManifestations()
                .iterator().next().getManifestedComponent();
      //Initialize the file chooser with the current user
      User user = PlatformAccess.getPlatform().getCurrentUser();
        final CustomFileChooser fileChooser = new CustomFileChooser();
       
        //add the list of owners and set selection to current owner
        fileChooser.addOwners(Arrays.asList(RoleAccess.getAllUsers()));
        fileChooser.setOwner(user.getUserId());
      
        fileChooser.setDialogTitle(bundle.getString("import_message")
        + targetComponent.getDisplayName());
        fileChooser.setApproveButtonText(bundle.getString("import_button"));
       
        fileChooser.setFileSelectionMode(FileChooser.FILES_AND_DIRECTORIES);

        fileChooser.setFileFilter(new XMLFileFilter());
        fileChooser.setMultiSelectionEnabled(true);
       
        if (source == null) return null;
        int returnVal = fileChooser.showOpenDialog(source);

        if (returnVal == FileChooser.APPROVE_OPTION) {
            File[] rootFileOrDir = fileChooser.getSelectedFiles();
            List<File> files = Utilities.filterSelectedFiles(Arrays.asList(rootFileOrDir));    
            //set the owner
            owner = fileChooser.getOwner();
            return files;
        }
        return null;
    }
View Full Code Here


    public List<File> selectFiles(Component source){
      AbstractComponent targetComponent = currentContext.getWindowManifestation()
          .getManifestedComponent();
      //Initialize the file chooser with the current user
      User user = PlatformAccess.getPlatform().getCurrentUser();
        final CustomFileChooser fileChooser = new CustomFileChooser();
       
        //add the list of owners and set selection to current owner
        fileChooser.addOwners(Arrays.asList(RoleAccess.getAllUsers()));
        fileChooser.setOwner(user.getUserId());
      
        fileChooser.setDialogTitle(bundle.getString("import_message")
        + targetComponent.getDisplayName());
        fileChooser.setApproveButtonText(bundle.getString("import_button"));
       
        fileChooser.setFileSelectionMode(FileChooser.FILES_AND_DIRECTORIES);

        fileChooser.setFileFilter(new XMLFileFilter());
        fileChooser.setMultiSelectionEnabled(true);
       
        if (source == null) return null;
        int returnVal = fileChooser.showOpenDialog(source);

        if (returnVal == FileChooser.APPROVE_OPTION) {
            File[] rootFileOrDir = fileChooser.getSelectedFiles();
            List<File> files = Utilities.filterSelectedFiles(Arrays.asList(rootFileOrDir));    
            //set the owner
            owner = fileChooser.getOwner();
            return files;
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of gov.nasa.jsc.mct.importExport.utilities.CustomFileChooser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.