List of usage examples for java.io File isHidden
public boolean isHidden()
From source file:com.lfv.lanzius.server.LanziusServer.java
private void menuChoiceLoadConfiguration() { if (isSwapping) return;/*from w w w. j a v a 2s . c o m*/ log.info("Menu: Load configuration"); JFileChooser fc = new JFileChooser("data/configurations"); fc.setDialogTitle("Load configuration..."); fc.setMultiSelectionEnabled(false); fc.setFileFilter(new FileFilter() { public boolean accept(File f) { return !f.isHidden() && (f.isDirectory() || f.getName().endsWith(".xml")); } public String getDescription() { return "Configuration (*.xml)"; } }); int returnVal = JFileChooser.APPROVE_OPTION; if (Config.SERVER_AUTOLOAD_CONFIGURATION == null) returnVal = fc.showOpenDialog(frame); if (returnVal == JFileChooser.APPROVE_OPTION) { File file; if (Config.SERVER_AUTOLOAD_CONFIGURATION == null) file = fc.getSelectedFile(); else file = new File(Config.SERVER_AUTOLOAD_CONFIGURATION); log.info("Loading configuration " + file); if (file.exists()) { if (buildConfigurationDocument(file)) { isConfigLoaded = true; updateView(); } else JOptionPane.showMessageDialog(frame, "Invalid configuration file! Make sure that all required tags are defined!", "Error!", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog(frame, "Unable to load configuration! File not found!", "Error!", JOptionPane.ERROR_MESSAGE); } }
From source file:ome.services.blitz.repo.PublicRepositoryI.java
private List<FileSet> processImportContainers(List<ImportContainer> containers, List<String> names, boolean showOriginalFiles, Principal currentUser) { List<FileSet> rv = new ArrayList<FileSet>(); for (ImportContainer ic : containers) { FileSet set = new FileSet(); OriginalFile oFile;//from ww w. j a v a2 s. c o m set.importableImage = true; set.fileName = ic.getFile().getAbsolutePath(); set.parentFile = getOriginalFile(getRelativePath(ic.getFile()), ic.getFile().getName(), currentUser); if (set.parentFile == null) { set.parentFile = createOriginalFile(ic.getFile()); } set.hidden = ic.getFile().isHidden(); set.dir = ic.getFile().isDirectory(); set.reader = ic.getReader(); set.imageCount = ic.getBfImageCount().intValue(); set.usedFiles = new ArrayList<IObject>(); List<String> iFileList = Arrays.asList(ic.getUsedFiles()); for (String iFile : iFileList) { removeNameFromFileList(iFile, names); if (showOriginalFiles) { File f = new File(iFile); oFile = getOriginalFile(getRelativePath(f), f.getName(), currentUser); if (oFile != null) { set.usedFiles.add(oFile); } else { set.usedFiles.add(createOriginalFile(f)); } } } int i = 0; set.imageList = new ArrayList<Image>(); List<String> iNames = ic.getBfImageNames(); for (Pixels pix : ic.getBfPixels()) { Image image; String imageName; pix = createPixels(pix); imageName = iNames.get(i); if (imageName == null) { imageName = NONAMESET.value; } else if (imageName.equals("")) { imageName = NONAMESET.value; } image = getImage(set.fileName, i, currentUser); if (image == null) { image = createImage(imageName, pix); } set.imageList.add(image); i++; } rv.add(set); } // Add the left over files in the directory as OrignalFile objects if (names.size() > 0) { for (String iFile : names) { File f = new File(iFile); FileSet set = new FileSet(); OriginalFile oFile; set.importableImage = false; set.fileName = iFile; set.parentFile = getOriginalFile(getRelativePath(f), f.getName(), currentUser); if (set.parentFile == null) { set.parentFile = createOriginalFile(f); } set.hidden = f.isHidden(); set.dir = f.isDirectory(); set.imageCount = 0; set.usedFiles = new ArrayList<IObject>(); if (showOriginalFiles) { oFile = getOriginalFile(getRelativePath(f), f.getName(), currentUser); if (oFile != null) { set.usedFiles.add(oFile); } else { set.usedFiles.add(createOriginalFile(f)); } } set.imageList = new ArrayList<Image>(); rv.add(set); } } return rv; }
From source file:com.mss.mirage.recruitment.ConsultantAction.java
private static void indexFile(IndexWriter writer, File f) throws IOException { if (f.isHidden() || !f.exists() || !f.canRead()) { return;//from w ww. java 2 s . c o m } //System.out.println("Indexing " + f.getCanonicalPath()); Document doc = new Document(); doc.add(Field.Text("contents", new FileReader(f))); //doc.add(Field.Keyword("filename", f..getCanonicalPath())); doc.add(Field.Keyword("filename", f.getAbsolutePath())); writer.addDocument(doc); }
From source file:com.sentaroh.android.SMBExplorer.SMBExplorerMain.java
@SuppressLint("SimpleDateFormat") static public FileListItem createNewFilelistItem(File tfli, int sdc, int ll) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); FileListItem fi = null;/* www .jav a 2 s . co m*/ if (tfli.canRead()) { if (tfli.isDirectory()) { fi = new FileListItem(tfli.getName(), sdf.format(tfli.lastModified()) + ", ", true, 0, 0, false, tfli.canRead(), tfli.canWrite(), tfli.isHidden(), tfli.getParent(), ll); fi.setSubDirItemCount(sdc); } else { String tfs = MiscUtil.convertFileSize(tfli.length()); fi = new FileListItem(tfli.getName(), sdf.format(tfli.lastModified()) + "," + tfs, false, tfli.length(), tfli.lastModified(), false, tfli.canRead(), tfli.canWrite(), tfli.isHidden(), tfli.getParent(), ll); } } else { if (tfli.isDirectory()) { fi = new FileListItem(tfli.getName(), sdf.format(tfli.lastModified()) + ", ", true, 0, 0, false, tfli.canRead(), tfli.canWrite(), tfli.isHidden(), tfli.getParent(), ll); fi.setSubDirItemCount(0); } else { String tfs = MiscUtil.convertFileSize(tfli.length()); fi = new FileListItem(tfli.getName(), sdf.format(tfli.lastModified()) + "," + tfs, false, tfli.length(), tfli.lastModified(), false, tfli.canRead(), tfli.canWrite(), tfli.isHidden(), tfli.getParent(), ll); } } return fi; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java
/** * Implemented as specified by the {@link TreeViewer} interface. * @see TreeViewer#browse(TreeImageDisplay, DataObject, boolean) *///from w ww.ja v a 2s. c om public void browse(TreeImageDisplay node, DataObject data, boolean withThumbnails) { NodesFinder finder; Set<TreeImageDisplay> nodes; Iterator<TreeImageDisplay> i; Browser browser = model.getSelectedBrowser(); if (node == null) { if (browser == null) return; if (data instanceof DatasetData) { finder = new NodesFinder((DataObject) data); browser.accept(finder); nodes = finder.getNodes(); ExperimenterData exp = null; MetadataViewer mv = model.getMetadataViewer(); int size = nodes.size(); if (size == 1) { i = nodes.iterator(); TreeImageDisplay parent; mv.setSelectionMode(size == 1); int mode = model.getDisplayMode(); while (i.hasNext()) { node = i.next(); if (mode == TreeViewer.EXPERIMENTER_DISPLAY) { parent = BrowserFactory.getDataOwner(node); exp = (ExperimenterData) parent.getUserObject(); } else parent = EditorUtil.getDataGroup(node); browser.loadExperimenterData(parent, node); if (exp == null) exp = model.getUserDetails(); node.setExpanded(true); mv.setRootObject(node.getUserObject(), exp.getId(), browser.getSecurityContext(node)); browser.onSelectedNode(null, node, false); break; } } } else if (data instanceof PlateData) { finder = new NodesFinder((DataObject) data); browser.accept(finder); nodes = finder.getNodes(); if (nodes.size() > 0) { //node found. model.browsePlates(nodes, withThumbnails); } } else if (data instanceof ImageData) { finder = new NodesFinder((DataObject) data); browser.accept(finder); nodes = finder.getNodes(); ExperimenterData exp; MetadataViewer mv = model.getMetadataViewer(); int size = nodes.size(); if (size == 1) { i = nodes.iterator(); TreeImageDisplay parent, expNode; mv.setSelectionMode(size == 1); while (i.hasNext()) { node = i.next(); parent = node.getParentDisplay(); expNode = BrowserFactory.getDataOwner(node); exp = expNode == null ? null : (ExperimenterData) expNode.getUserObject(); if (exp == null) exp = model.getUserDetails(); node.setExpanded(true); //mv.setRootObject(node.getUserObject(), exp.getId()); List l = parent.getChildrenDisplay(); Iterator j = l.iterator(); List leaves = new ArrayList(); while (j.hasNext()) { TreeImageDisplay o = (TreeImageDisplay) j.next(); leaves.add(o.getUserObject()); } DataBrowser db = DataBrowserFactory.getDataBrowser(model.getSecurityContext(node), null, parent.getUserObject(), leaves, parent); if (db == null) return; db.addPropertyChangeListener(controller); db.setDisplayMode(model.getDisplayMode()); view.displayBrowser(db); db.activate(); model.setDataViewer(db); browser.setSelectedDisplay(node); } } } return; } ActionCmd actionCmd = null; Object uo = node.getUserObject(); if (uo instanceof ProjectData) { model.browseProject(node); } else if (uo instanceof DatasetData) { if (browser != null) browser.loadExperimenterData(BrowserFactory.getDataOwner(node), node); } else if (uo instanceof ScreenData) { if (data instanceof PlateData) { //Find node finder = new NodesFinder((DataObject) data); browser.accept(finder); nodes = finder.getNodes(); if (nodes.size() > 0) { //node found. TreeImageDisplay[] values = new TreeImageDisplay[nodes.size()]; i = nodes.iterator(); int index = 0; TreeImageDisplay n; while (i.hasNext()) { n = i.next(); node = n.getParentDisplay(); values[index] = n; index++; } browser.setSelectedDisplays(values, true); model.browsePlates(nodes, withThumbnails); } } else if (data instanceof ScreenData) { //Find node finder = new NodesFinder((DataObject) data); browser.accept(finder); nodes = finder.getNodes(); if (nodes.size() > 0) { //node found. TreeImageDisplay[] values = new TreeImageDisplay[nodes.size()]; i = nodes.iterator(); int index = 0; TreeImageDisplay n; while (i.hasNext()) { n = i.next(); node = n.getParentDisplay(); values[index] = n; index++; } browser.setSelectedDisplays(values, true); } } } else if (uo instanceof TagAnnotationData) { TagAnnotationData tag = (TagAnnotationData) uo; if (!TagAnnotationData.INSIGHT_TAGSET_NS.equals(tag.getNameSpace())) model.browseTag(node); } else if (uo instanceof ImageData) { if (TreeViewerAgent.runAsPlugin() == TreeViewer.IMAGE_J) { actionCmd = new ViewInPluginCmd(this, TreeViewer.IMAGE_J); } else { actionCmd = new ViewCmd(this, true); } } else if (node instanceof TreeImageTimeSet) { model.browseTimeInterval((TreeImageTimeSet) node); } else if (uo instanceof PlateData) { List<TreeImageDisplay> plates = new ArrayList<TreeImageDisplay>(); List l = node.getChildrenDisplay(); if (l == null || l.size() == 0) { plates.add(node); } if (l.size() == 1) { plates.add((TreeImageDisplay) l.get(0)); } model.browsePlates(plates, withThumbnails); } else if (uo instanceof PlateAcquisitionData) { List<TreeImageDisplay> plates = new ArrayList<TreeImageDisplay>(); plates.add(node); model.browsePlates(plates, withThumbnails); } else if (uo instanceof File) { File f = (File) uo; if (f.isDirectory() && !f.isHidden()) { List l = node.getChildrenDisplay(); if (l != null && l.size() > 0) { Set leaves = new HashSet(); i = l.iterator(); Object object; TreeImageDisplay child; while (i.hasNext()) { child = (TreeImageDisplay) i.next(); object = child.getUserObject(); if (object instanceof ImageData) leaves.add(object); } if (leaves.size() > 0) setLeaves((TreeImageSet) node, leaves); } } } else if (uo instanceof FileData) { FileData fa = (FileData) uo; if (!fa.isHidden()) { if (fa.isDirectory() || fa instanceof MultiImageData) { model.getSelectedBrowser().loadExperimenterData(BrowserFactory.getDataOwner(node), node); } else { //Import, register and view. } } } fireStateChange(); if (actionCmd != null) actionCmd.execute(); }