Package com.zaranux.client.java.io

Examples of com.zaranux.client.java.io.File


   
    for(TreeNode node : movingNodes )
    {
      if(! (node instanceof FileSystemNode)) continue;
      final FileSystemNode fromNode  = (FileSystemNode)node;
      final File fromFile = fromNode.getFile();
      String dirPath = toDirecotry.getFile().getAbsolutePath();
      final String toDirPath = (dirPath.endsWith("/")) ? dirPath : dirPath + "/";
      final File toFile = new File( toDirPath + "/" + fromFile.getName());
      fromExplorerPanel.setStatus("Moving " + fromFile.getAbsolutePath() + " to " + toDirPath );

      if(fromExplorerPanel != toExplorerPanel)
      {
        toExplorerPanel.setStatus("Moving " + fromFile.getAbsolutePath() + "to " + toDirPath);
View Full Code Here


    {
      if(! (node instanceof DirectoryNode)) continue;
     
      final DirectoryNode dn_parent = (DirectoryNode) node;

      final File f_parent = dn_parent.getFile();
      String parent = f_parent.getAbsolutePath();
      if(!parent.endsWith("/")) parent += "/";
      final String path = parent + DEFAULT_DIRNAME +"/";

      final File f = new File(path);
      //f.setLastModified(123);
      // be optimistic and show the new file created in the explorer and them make the call to actually create it.
      final DirectoryNode d_child = new DirectoryNode(f);
     
      // inform the user about the action in progress
      filesystemTreeGrid.setStatus("Creating " + path + " ... ");
     
       //add a child in tree if the directory is expanded before
       //otherwise the new directory is added in background and
       //when user expand the node, he can see new node there.
      if(dn_parent.isExpandedBefore())   
      {
       
        filesystemTreeGrid.getData().add(d_child,dn_parent);

        //  keep it disabled until it is actually created.
        d_child.setEnabled(false);     

        filesystemTreeGrid.redraw();

      }

      f.mkdir(new AsyncCallback<Boolean>() {

        public void onSuccess(Boolean result) {
          if(result) {// creating folder succeed
            if(dn_parent.isExpandedBefore())
            {
              String tooltip =  f.lastModified()+ ",Size:" + 0 + " (bytes)";
              d_child.setToolTip(tooltip);
              //filesystemTreeGrid.setFields();
              d_child.setEnabled(true);
              int row = filesystemTreeGrid.getRecordIndex(d_child);
              filesystemTreeGrid.startEditing(row, 0, true);
View Full Code Here

     
   
      renaming = true;
      final FileSystemNode fsn =  ((FileSystemNode) event.getRecord()).downcast();
      final File f_old = new File(fsn.getPath());
      final File f_new = new File(fsn.getDirectory() + s_newName);
     
      final String s_oldpath= f_old.getAbsolutePath();
      final String s_newpath=f_new.getAbsolutePath();
     
      explorerPanel.setStatus("Renaming "+ s_oldpath + " to " + s_newpath );
      // keep it disabled till the actual resource rename is done ..
      fsn.setEnabled(false);
View Full Code Here

    {
      if(! (node instanceof DirectoryNode)) continue;
     
      final DirectoryNode dn_parent = (DirectoryNode) node;

      final File f_parent = dn_parent.getFile();
     
      //making path of new File
      String parent = f_parent.getAbsolutePath();
      if(!parent.endsWith("/")) parent += "/";
      final String path = parent + DEFAULT_FILENAME ;

      final File f = new File(path);
      // be optimistic and show the new file created in the explorer and them make the call to actually create it.
      final FileNode f_child = new FileNode(f);
     
      // inform the user about the action in progress
      filesystemTreeGrid.setStatus("Creating " + path + " ... ");
     
      if(dn_parent.isExpandedBefore())   
      {
       
        filesystemTreeGrid.getData().add(f_child,dn_parent);
        filesystemTreeGrid.redraw();
       
        // keep it disabled until it is actually created.
        f_child.setEnabled(false);
      }
     
     

      f.createNewFile(new AsyncCallback<Boolean>() {
        public void onSuccess(Boolean result) {
          if(result) {// creating folder succeed
            if(dn_parent.isExpandedBefore()){     
              String tooltip =  f.lastModified()+ ",Size:" + 0 + " (bytes)";
              f_child.setToolTip(tooltip);
              //filesystemTreeGrid.setFields();
              // now it is created , then enable it
              f_child.setEnabled(true)
              int row = filesystemTreeGrid.getRecordIndex(f_child);
View Full Code Here

      if(! (node instanceof FileSystemNode)) continue;
      // if selected nodes are root they will fail in servers side, no need to add
      //     check for performance reason ...
      final FileSystemNode fsNode = (FileSystemNode) node;
     
      final File f = fsNode.getFile();
      TypedFile tf = new TypedFile(f);
     
      Log.debug("Selected = " + f.getAbsolutePath());

     
      if(tf.isSound())
        sounds.add(f.getAbsolutePath());
      else if(tf.isImage())
        images.add(f.getAbsolutePath());
      else if(tf.isExecutable())
      {
        Program program = tf.getProgram();
        if(program != null) filesystemTreeGrid.run(program);
      }
View Full Code Here

     
      // if selected nodes are root they will fail in servers side, no need to add
      //     check for performance reason ...
      final FileSystemNode fsNode = (FileSystemNode) node;
     
      final File f = fsNode.getFile();
      // TODO: could not find a way to hide a node .. needed for delete ..
      //hide it so user thinks it is actually deleted
      //explorerNode.hide();
     
      // inform the user about the action in progress
   
      filesystemTreeGrid.setStatus("Deleteing " + f.getAbsolutePath() + " ... ");
      //notify("Deleting " + path + " ...");
      //parent.appendChild(selectedNode);
     
      f.delete(new AsyncCallback<Boolean>(){
        public void onSuccess(Boolean success)
        {
          if(success)
          {
            // actually remove it from the tree
            filesystemTreeGrid.removeData(fsNode);
            filesystemTreeGrid.setStatus(f.getAbsolutePath() + " is successfully removed.");
          }else
          {
            filesystemTreeGrid.setStatus("Unable to remove " + f.getAbsolutePath() + ".");
            Log.error( "Unable to remove " );
          }
        }
        public void onFailure(Throwable caught)
        {
          filesystemTreeGrid.setStatus("Failed to remove " + f.getAbsolutePath() + ".");
          // In log include the details
          Log.error("Failed to remove " + " (" + caught + ")");
        }
      });
    }
View Full Code Here

    return getAttribute(ATT_CLASS);
  }
 
  public void rename(String newpath) {
    setPath(newpath);
    setNodeName(fileName(new File(newpath)));
  }
View Full Code Here

    final String folderName = getAbsolutePath( args[0] );
   
    if(args[0] != "" && !(getCurrentDirectory().equalsIgnoreCase( folderName )))
    {
    File f = new File(folderName + "/fold");
     
    f.delete(new AsyncCallback<Boolean>() {

      public void onFailure(Throwable caught) {
        System.out.print( "Failed to delete " + folderName, callback );
      }
View Full Code Here

  }
  @Override
  protected void execute(final AsyncCallback<Boolean> callback) {

    final String absolutePath = getAbsolutePath(path);
    File f = new File(absolutePath);
    f.isFile(new AsyncCallback<Boolean>()
          {
            public void onSuccess(Boolean b)
            {
              if(b)
              {
View Full Code Here

      callback.onSuccess(true);
      return;
    }else // cd directory
    {
      final String absolutePath = getAbsolutePath(args[0]);
      File f = new File(absolutePath);
      Log.debug("File : " +f);
      f.isDirectory(new AsyncCallback<Boolean>()
          {
            public void onSuccess(Boolean b)
            {
              if(b)
              {
View Full Code Here

TOP

Related Classes of com.zaranux.client.java.io.File

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.