Commits

Anonymous committed 1d80b77

I forgot a file

  • Participants
  • Parent commits d75e503

Comments (0)

Files changed (1)

File tailog/src/magmax/tailog/gui/ModelFileTree.java

+package magmax.tailog.gui;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import javax.swing.table.AbstractTableModel;
+
+public class ModelFileTree extends AbstractTableModel {
+	ArrayList<File> list = new ArrayList<File>();
+	String[] headers = new String[] { "File" };
+
+	@Override
+	public int getColumnCount() {
+		return headers.length;
+	}
+
+	@Override
+	public String getColumnName(int colIndex) {
+		return headers[colIndex];
+	}
+
+	@Override
+	public int getRowCount() {
+		return list.size();
+	}
+
+	@Override
+	public Object getValueAt(int rowIndex, int columnIndex) {
+		return list.get(rowIndex).getName();
+	}
+
+	public String getTooltip(int rowIndex) {
+		return list.get(rowIndex).getAbsolutePath();
+	}
+
+	public void addFile(File file) {
+		list.add(file);
+		fireTableRowsInserted(list.size() - 1, list.size() - 1);
+	}
+
+	public void removeFile(int rowIndex) {
+		list.remove(rowIndex);
+		fireTableRowsDeleted(rowIndex, rowIndex);
+	}
+}