Package com.zaranux.client.java.io

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


  protected void execute(final AsyncCallback<Boolean> callback) {
    String[] args = getArgs();
    String name = args[0];
    String dir = getCurrentDirectory(); // current directory
     
    File f= new File(dir);
   
      f.mkdir(new AsyncCallback<Boolean>() {

        public void onFailure(Throwable T) {
          System.out.print( "making new directory failed.", callback );
        }
View Full Code Here


    // remote filesystem
   
    File[] files = new File[args.length];
    for(int i = 0; i < args.length; i++)
    {
      files[i] = new File(args[i]);
    }
   
    vStack.addMember((new FilesystemComponent(this,files)).getWidget());
    //local filesystem
    vStack.addMember((new FilesystemComponent(this,false)).getWidget());
View Full Code Here

  protected void main(String[] args) {
    // for now we process just the first argument
    // TODO:  go through all arguents and show their attributes in seperate tabs.
    if(args.length < 1) return;
    File[] files = new File[1];
    files[0] = new File(args[0]);
   
    final ACLComponent  aclComponent = new ACLComponent(files,this);
   
    IButton saveButton = new IButton("Save")
    //saveButton.setLeft(300); 
View Full Code Here

   
    setWidget(textArea, 450,350);

    this.filePath = args[0];
   
    final File f = new File(filePath);
    f.exists(new AsyncCallback<Boolean>()
      {
        public void onSuccess(Boolean  b)
        {
          if(b)
          {
            setStatus("Opening " + filePath + " ...");
            FileInputStream fis = new FileInputStream(filePath);
            br = new InputStreamReader(fis);
           
            //br = new BufferedReader(  isr);
            // first show the widget .. and ..
            // and then read the lines and populate it ..
            //readAllLines();
            readAllContent();
          }else
          {
            f.createNewFile(new AsyncCallback<Boolean>()
            {
              public void onSuccess(Boolean  b)
              {
                if(b)
                {
View Full Code Here

     * @return The file represented by <code>str</code>.
     */
    public static File createFile(String str)
    throws ParseException
    {
        return new File(str);
    }
View Full Code Here

  private RemoteFilesystemTreeData(File[] files)
  {
    setModelType(TreeModelType.CHILDREN);
    TreeNode hiddenRoot = new TreeNode();
    setRoot(hiddenRoot);
    DirectoryNode fsRemoteRoot = new DirectoryNode(new File("/"));

    add(fsRemoteRoot, hiddenRoot);

    if(files != null)
    {
      for(File file:files)
      {

        String path = file.getAbsolutePath();
       
        if(path.startsWith("/"))
          path = path.substring(1);
        if(path.startsWith("@"))
        {
          path = "@/" + path.substring(1);
        }
       
        String[] segments = path.split("/");
        DirectoryNode parent = fsRemoteRoot;
        if(segments != null)
        {
          String pathName = "";
          for(int i =0; i< segments.length; i++) // String segment:segments)
          {
            if(!segments[i].equals(""))
            {
              if(!(i == 1 && segments[0].equals("@")))
                pathName += "/";
              pathName += segments[i];
              DirectoryNode child = new DirectoryNode(new File(pathName));
              add(child,parent);
              this.openFolder(parent);
              parent = child;
            }
          }
View Full Code Here

  private LocalFilesystemTreeData()
  {
    setModelType(TreeModelType.CHILDREN);
    TreeNode hiddenRoot = new TreeNode();
    setRoot(hiddenRoot);
    DirectoryNode fsLocalRoot = new DirectoryNode(new File("file:///"));
    add(fsLocalRoot, hiddenRoot);
  }
View Full Code Here

    for(final  ListGridRecord node : nodes)
    {
      if(! (node instanceof FileSystemNode)) continue;
      final FileSystemNode fsNode = (FileSystemNode) node;
     
      final File f = fsNode.getFile();
     
      files.add(f.getAbsolutePath());
    }
   
    Attributes attributes = new Attributes(files.toArray(new String[0]));
    filesystemTreeGrid.run(attributes);
   
View Full Code Here

    final TextBox path = new TextBox();
   
    final TextArea textArea = new TextArea();
      Button readButton = new Button("Read", new ClickHandler() {
          public void onClick(ClickEvent event) {
            File file = new File(path.getText());
            FileInputStream fis = new FileInputStream(file);
            InputStreamReader isr = new InputStreamReader(fis);
          char[] cbuf = new char[100 * 1024];
          textArea.setText("");
          readAll(textArea, cbuf, isr);
View Full Code Here

    if(!(event.getNode() instanceof DirectoryNode)) return;
   
    final DirectoryNode parentDir = (DirectoryNode) event.getNode();
    if(parentDir.isExpandedBefore()) return; // already expanded
     
    final File parentFile = parentDir.getFile();

    parentFile.list(new AsyncCallback<String[]>()
    {
     
      public void onSuccess(final String[] list)
      {

        parentDir.expanded();
        for(String fd : list)
        {
          //fd : "[df] , filename , lastModified , size"
          String fd_props[] = fd.split(" \\| ");
          if(fd_props==null || fd_props.length!=4)
          {
            Log.error("Wrong entry : " + fd);
          }

          boolean isDirecotory = fd_props[0].equals("d");
          String name = fd_props[1];
          String lastModified = fd_props[2];
          String size = fd_props[3];
         
          FileSystemNode fsn = null;
          String path = parentFile.getAbsolutePath();
          path = path.endsWith("/") ? path : path + "/";
          if(isDirecotory)
          {
            fsn  = new DirectoryNode(new File(path + name)) ;
          }else // File
          {
            fsn = new FileNode(new File(path + name));
         

          //set Field for rename. Input is for tooltip
          String tooltip = lastModified + ",Size:" + size + " (bytes)";
          filesystemTreeGrid.setFields();
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.