@Override public Object getValueAt(int row, int col) { if (col == 0 && row == 0) { return new File(".."); } if (row == 0) return ""; if (col == 0) { return currentFiles[row - 1]; } Song song = getSong(currentFiles[row - 1]); String feature = features.get(col - 1); if (song == null) return ""; return song.getAttribute(feature); }
private void setAttributeToChildren(File file, String feature, String value) { if (file.isDirectory()) { File[] files = file.listFiles(fileFilter); if (files != null) { for (File f : files) { setAttributeToChildren(f, feature, value); } } } boolean shouldWriteValue = false; Song song = getSong(file); if (song == null || doOverwrite || !Utils.stringNotNullOrEmpty(song.getAttribute(feature))) shouldWriteValue = true; if (shouldWriteValue) setFeature(file, feature, value); }
private void setFeature(File file, String feature, String value) { Song song = getSong(file); String oldValue = null; if (song == null) { song = new Song(file); songs.add(song); Modification mod = new Modification(song); changeList.add(mod); } oldValue = song.getAttribute(feature); song.setAttribute(feature, value); if (!value.equals(oldValue)) { Modification change = new Modification(getSong(file), feature, value, oldValue); changeList.add(change); } }