Ejemplo n.º 1
0
 /**
  *
  * @param _files
  * @return
  */
 public static String[] toStrings(File[] _files) {
     CArray strings = new CArray(String.class);
     for (int i = 0; i < _files.length; i++) {
         if (_files[i] == null) {
             continue;
         }
         strings.insertLast(_files[i].getAbsolutePath());
     }
     return (String[]) strings.getAll();
 }
Ejemplo n.º 2
0
 /**
  *
  * @param _
  * @param _file
  * @return
  */
 public static File[] allFiles(IOut _, File _file) {
     if (_file == null) {
         return null;
     }
     if (_file.isDirectory()) {
         CArray all = new CArray(File.class);
         _allFiles(_, _file, all);
         return (File[]) all.getAll();
     } else {
         return new File[]{_file};
     }
 }
Ejemplo n.º 3
0
 /**
  *
  * @return
  */
 @Override
 public IVItem[] getSelectedItems() {
      IVItem[] _items = items;
     if (_items == null) {
         return new IVItem[0];
     }
     CArray selectedItems = new CArray(IVItem.class);
     for (int i = 0; i < _items.length; i++) {
         IVItem item = _items[i];
         if (item != null && item.isSelected()) {
             selectedItems.insertLast(item);
         }
     }
     return (IVItem[]) selectedItems.getAll();
 }
Ejemplo n.º 4
0
    /**
     *
     * @param _
     * @param _backcall
     * @return
     */
    protected IVItem[] rawItems(IOut _, IBackcall _backcall) {
        final CArray array = new CArray(IVItem.class);
        ICallback callback = new ICallback() {

            @Override
            public Object callback(Object _value) {
                IVItem vi = vItem(_value);
                if (vi != null) {
                    array.insertLast(vi);
                }
                return _value;
            }
        };
        _backcall.backcall(_,callback);
        return (IVItem[]) array.getAll();
    }
Ejemplo n.º 5
0
 private static void _allFiles(IOut _, File _directory, CArray _all) {
     File[] array = _directory.listFiles();
     if (array != null) {
         for (int i = 0; i < array.length; i++) {
             if (_.canceled()) {
                 break;
             }
             _.out(i, array.length);
             File _file = array[i];
             _.out(_file);
             if (_file.isDirectory()) {
                 //_.pushProgress();
                 _allFiles(_, _file, _all);
             //_.popProgress();
             } else {
                 _all.insertLast(_file);
             }
         }
     }
 }