/** * Adds the specified files to the list of import data. * * @param files The files to import. */ private void insertFiles(Map<File, StatusLabel> files) { if (files == null || files.size() == 0) { statusLabel.setText("No files to import."); return; } components = new HashMap<File, FileImportComponent>(); totalFiles = files.size(); String text = "Importing " + totalFiles + " file"; if (totalFiles > 1) text += "s"; statusLabel.setText(text); Entry entry; Iterator i = files.entrySet().iterator(); FileImportComponent c; JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); int index = 0; p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); File f; DatasetData d = dataset; Object node = refNode; if (folderAsContainer) { node = null; d = new DatasetData(); d.setName(file.getName()); } while (i.hasNext()) { entry = (Entry) i.next(); f = (File) entry.getKey(); c = new FileImportComponent(f, folderAsContainer, browsable, group, singleGroup); if (f.isFile()) { c.setLocation(data, d, node); c.setParent(this); } c.showContainerLabel(showContainerLabel); c.setType(getType()); attachListeners(c); c.setStatusLabel((StatusLabel) entry.getValue()); if (index % 2 == 0) c.setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN); else c.setBackground(UIUtilities.BACKGROUND_COLOUR_ODD); components.put((File) entry.getKey(), c); p.add(c); index++; } removeAll(); pane = EditorUtil.createTaskPane(""); pane.setCollapsed(false); setNumberOfImport(); IconManager icons = IconManager.getInstance(); pane.setIcon(icons.getIcon(IconManager.DIRECTORY)); Font font = pane.getFont(); pane.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2)); pane.add(p); double[][] size = {{TableLayout.FILL}, {TableLayout.PREFERRED}}; setLayout(new TableLayout(size)); add(pane, "0, 0"); validate(); repaint(); }
/** Increases the number of imports. */ void increaseNumberOfImport() { importCount++; setNumberOfImport(); }