Exemplo n.º 1
0
  /**
   * The constructor constructs all of the elements of this <tt>AbstractPaneItem</tt>.
   *
   * @param key the key for this <tt>AbstractPaneItem</tt> that the superclass uses to generate
   *     strings
   */
  public SharedDirPaneItem() {
    super(TITLE, LABEL);

    sharingPanel.setFileFilter(
        new FileFilter() {
          //		    private final FileManager fileManager = GuiCoreMediator.getFileManager();
          public boolean accept(File pathname) {
            return true;
            //                return fileManager.isFolderShareable(pathname, false);
          }
        });
    sharingPanel.getTree().setRootVisible(false);
    sharingPanel.getTree().setShowsRootHandles(true);

    JPanel buttonPanel = new JPanel(new BorderLayout());
    buttonPanel.setBorder(new EmptyBorder(0, 4, 0, 0));
    JPanel buttons = new JPanel(new BorderLayout());
    buttons.add(
        new JButton(new SelectSharedDirectoryAction(sharingPanel, sharingPanel)),
        BorderLayout.NORTH);
    buttons.add(Box.createVerticalStrut(4), BorderLayout.CENTER);
    buttons.add(new JButton(new RemoveSharedDirectoryAction(sharingPanel)), BorderLayout.SOUTH);
    buttonPanel.add(buttons, BorderLayout.NORTH);
    sharingPanel.addEastPanel(buttonPanel);
    add(sharingPanel);
  }
Exemplo n.º 2
0
 /**
  * Defines the abstract method in <tt>AbstractPaneItem</tt>.
  *
  * <p>Sets the options for the fields in this <tt>PaneItem</tt> when the window is shown.
  */
 @SuppressWarnings("deprecation")
 @Override
 public void initOptions() {
   File[] dirs = null; // OldLibrarySettings.DIRECTORIES_TO_SHARE.getValueAsArray();
   initialFoldersToShare = new HashSet<File>(Arrays.asList(dirs));
   //		initialFoldersToExclude = GuiCoreMediator.getFileManager().getFolderNotToShare();
   sharingPanel.setRoots(dirs);
   sharingPanel.setFoldersToExclude(initialFoldersToExclude);
 }
Exemplo n.º 3
0
 boolean isAlreadyGoingToBeShared(File dir) {
   if (sharingPanel.getFoldersToExclude().contains(dir)) {
     return false;
   }
   for (File folder : sharingPanel.getRootsToShare()) {
     if (FileUtils.isAncestor(folder, dir)) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 4
0
 /** Adds a directory to the internal list, resetting 'dirty' only if it wasn't dirty already. */
 void addAndKeepDirtyStatus(Set<File> foldersToShare, Set<File> foldersToExclude) {
   for (File folder : foldersToShare) {
     sharingPanel.addRoot(folder);
   }
   sharingPanel.addFoldersToExclude(foldersToExclude);
 }
Exemplo n.º 5
0
 public void resetDirtyState() {
   initialFoldersToShare = sharingPanel.getRootsToShare();
   initialFoldersToExclude = sharingPanel.getFoldersToExclude();
 }
Exemplo n.º 6
0
 public boolean isDirty() {
   return !initialFoldersToShare.equals(sharingPanel.getRootsToShare())
       || !initialFoldersToExclude.equals(sharingPanel.getFoldersToExclude());
 }
Exemplo n.º 7
0
 /** Returns the folders to exclude. */
 public Set<File> getDirectorieToExclude() {
   return sharingPanel.getFoldersToExclude();
 }
Exemplo n.º 8
0
 /** Gets all folders to share. */
 public Set<File> getDirectoriesToShare() {
   return sharingPanel.getRootsToShare();
 }