public boolean accept(String _f) { return (_f == null) ? false : accept(new File(_f)); }
public static FileFormat findFileFormat(final FileFormat[] _fts, final File _file) { final int nb = _fts.length; for (int i = 0; i < nb; i++) { final BuFileFilter filter = _fts[i].createFileFilter(); if (filter.accept(_file)) { return _fts[i]; } } return null; }
public void saveFile(String _path, DjaGrid _grid) { try { DjaLoadSaveInterface ls = null; for (int i = 0; i < EXTENSIONS.length; i++) { DjaLoadSaveInterface lsi = DjaLoadSaveLib.get(EXTENSIONS[i]); if ((lsi != null) && (lsi.getFilter().accept(_path))) { ls = lsi; break; } } if (ls == null) throw new Exception("No filter found"); ls.save(new File(_path), _grid.getObjects()); getMainMenuBar().addRecentFile(_path, "graphe"); } catch (Exception ex) { new BuDialogMessage(getApp(), getInformationsSoftware(), "Can not save " + _path + "\n" + ex.getMessage()) .activate(); } }
public void openFile(String _path) { try { DjaLoadSaveInterface ls = null; for (int i = 0; i < EXTENSIONS.length; i++) { DjaLoadSaveInterface lsi = DjaLoadSaveLib.get(EXTENSIONS[i]); if ((lsi != null) && (lsi.getFilter().accept(_path))) { ls = lsi; break; } } if (ls == null) throw new Exception("No filter found"); DjaGridInteractive grille = new DjaGridInteractive(true, ls.load(new File(_path))); nbdoc_++; DjaFrame f = new DjaFrame(this, _path, grille, false); f.setLocation(155 + nbdoc_ * 25, -15 + nbdoc_ * 25); addInternalFrame(f); getMainMenuBar().addRecentFile(_path, "graphe"); } catch (Exception ex) { new BuDialogMessage(getApp(), getInformationsSoftware(), "Can not open " + _path + "\n" + ex.getMessage()) .activate(); } }
if ((_filter == null) || _filter.accept(f)) { files[nb_files] = f; nb_files++;