Commits

Anonymous committed 2cdf4c5

well.. NOW I remove the erroneous package

Comments (0)

Files changed (5)

tailog-tester/src/magmax/tailog/gui/ModelChangedLinesTest.java

 import java.io.FileWriter;
 import java.io.IOException;
 
-import magmax.taillog.gui.ModelChangedLines;
+import magmax.tailog.gui.ModelChangedLines;
 
 import org.junit.Before;
 import org.junit.Test;

tailog/src/magmax/tailog/gui/MainWindow.java

+package magmax.tailog.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JSeparator;
+import javax.swing.JTable;
+import javax.swing.JTree;
+
+public class MainWindow {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		new MainWindow();
+	}
+
+	private JFrame mainFrame;
+	private JTable mainTable;
+	private ModelChangedLines mainModel;
+
+	private MainWindow() {
+		createMainFrame();
+		createMenu();
+		createFileBar();
+		createDesktop();
+		showMainFrame();
+	}
+
+	private void createMainFrame() {
+		mainFrame = new JFrame("Tailog");
+	}
+
+	private void showMainFrame() {
+		mainFrame.setVisible(true);
+		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+	}
+
+	private void createDesktop() {
+		mainModel = new ModelChangedLines();
+		mainTable = new JTable(mainModel);
+		mainTable.setPreferredSize(new Dimension(600, 400));
+		mainFrame.getContentPane().add(mainTable, BorderLayout.CENTER);
+		mainFrame.pack();
+	}
+
+	private void createMenu() {
+		JMenuBar menubar = new JMenuBar();
+
+		menubar.add(getMenuFile());
+		menubar.add(getWindowFile());
+
+		menubar.setVisible(true);
+		mainFrame.getContentPane().add(menubar, BorderLayout.PAGE_START);
+		mainFrame.pack();
+	}
+
+	private JMenu getWindowFile() {
+		JMenu result = new JMenu("Window");
+
+		JMenuItem open = new JMenuItem("Tile");
+		open.setAction(new TileWindowsAction());
+		result.add(open);
+
+		return result;
+	}
+
+	private class TileWindowsAction extends AbstractAction {
+
+		@Override
+		public void actionPerformed(ActionEvent arg0) {
+
+		}
+
+	}
+
+	private void createFileBar() {
+		JTree tree = new JTree();
+
+		tree.setVisible(true);
+		mainFrame.getContentPane().add(tree, BorderLayout.WEST);
+		mainFrame.pack();
+	}
+
+	private class OpenWatcherWindowAction extends AbstractAction {
+		private static final long serialVersionUID = 1L;
+
+		public OpenWatcherWindowAction() {
+			super("Open");
+		}
+
+		@Override
+		public void actionPerformed(ActionEvent e) {
+			JFileChooser chooser = new JFileChooser();
+			if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {
+				File file = chooser.getSelectedFile();
+				try {
+					mainModel.addFile(file);
+				} catch (IOException e1) {
+					// TODO Auto-generated catch block
+					e1.printStackTrace();
+				}
+			}
+		}
+	}
+
+	private class CloseAction extends AbstractAction {
+		private static final long serialVersionUID = 1L;
+
+		public CloseAction() {
+			super("Close");
+		}
+
+		@Override
+		public void actionPerformed(ActionEvent e) {
+			mainFrame.setVisible(false);
+			mainFrame.dispose();
+		}
+	}
+
+	private JMenu getMenuFile() {
+		JMenu result = new JMenu("File");
+
+		JMenuItem open = new JMenuItem("Open");
+		open.setAction(new OpenWatcherWindowAction());
+		result.add(open);
+
+		JSeparator sep = new JSeparator();
+		result.add(sep);
+
+		JMenuItem close = new JMenuItem("Close");
+		close.setAction(new CloseAction());
+		result.add(close);
+		return result;
+	}
+
+}

tailog/src/magmax/tailog/gui/ModelChangedLines.java

+package magmax.tailog.gui;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Observable;
+import java.util.Observer;
+
+import javax.swing.table.AbstractTableModel;
+
+import magmax.tailog.fileaccess.FileWatcher;
+import magmax.tailog.fileaccess.FileWatcherScheduler;
+
+public class ModelChangedLines extends AbstractTableModel implements Observer {
+	private static final long serialVersionUID = 1L;
+	private ArrayList<ModelLine> lines = new ArrayList<ModelLine>();
+	private String[] headers = new String[] { "File", "Log Line" };
+
+	@Override
+	public Class<?> getColumnClass(int columnIndex) {
+		return String.class;
+	}
+
+	@Override
+	public String getColumnName(int column) {
+		return headers[column];
+	}
+
+	@Override
+	public int getColumnCount() {
+		return headers.length;
+	}
+
+	@Override
+	public int getRowCount() {
+		return lines.size();
+	}
+
+	@Override
+	public Object getValueAt(int rowIndex, int columnIndex) {
+		ModelLine line = lines.get(rowIndex);
+		switch (columnIndex) {
+		case 0:
+			return line.filename;
+		case 1:
+			return line.line;
+		}
+		return null;
+	}
+
+	@Override
+	public synchronized void update(Observable o, Object arg) {
+		FileWatcher watcher = (FileWatcher) o;
+		int size = lines.size();
+		lines.add(new ModelLine(watcher.getFile().getName(), arg.toString()));
+		fireTableRowsInserted(size, size);
+	}
+
+	public synchronized void addDateLine() {
+		Calendar calendar = Calendar.getInstance();
+		int size = lines.size();
+		lines.add(new ModelLine("", "------  " + calendar.getTime()
+				+ "  ------"));
+		fireTableRowsInserted(size, size);
+	}
+
+	public void clear() {
+		lines.clear();
+	}
+
+	public void addFile(File file) throws IOException {
+		FileWatcher watcher = new FileWatcher(file);
+		watcher.addObserver(this);
+
+		FileWatcherScheduler scheduler = new FileWatcherScheduler(watcher);
+	}
+
+	private class ModelLine {
+		public String filename = "";
+		public String line = "";
+
+		public ModelLine(String filename, String line) {
+			super();
+			this.filename = filename;
+			this.line = line;
+		}
+	}
+}

tailog/src/magmax/tailog/taillog/gui/MainWindow.java

-package magmax.taillog.gui;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JSeparator;
-import javax.swing.JTable;
-import javax.swing.JTree;
-
-public class MainWindow {
-
-	/**
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		new MainWindow();
-	}
-
-	private JFrame mainFrame;
-	private JTable mainTable;
-	private ModelChangedLines mainModel;
-
-	private MainWindow() {
-		createMainFrame();
-		createMenu();
-		createFileBar();
-		createDesktop();
-		showMainFrame();
-	}
-
-	private void createMainFrame() {
-		mainFrame = new JFrame("Tailog");
-	}
-
-	private void showMainFrame() {
-		mainFrame.setVisible(true);
-		mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-	}
-
-	private void createDesktop() {
-		mainModel = new ModelChangedLines();
-		mainTable = new JTable(mainModel);
-		mainTable.setPreferredSize(new Dimension(600, 400));
-		mainFrame.getContentPane().add(mainTable, BorderLayout.CENTER);
-		mainFrame.pack();
-	}
-
-	private void createMenu() {
-		JMenuBar menubar = new JMenuBar();
-
-		menubar.add(getMenuFile());
-		menubar.add(getWindowFile());
-
-		menubar.setVisible(true);
-		mainFrame.getContentPane().add(menubar, BorderLayout.PAGE_START);
-		mainFrame.pack();
-	}
-
-	private JMenu getWindowFile() {
-		JMenu result = new JMenu("Window");
-
-		JMenuItem open = new JMenuItem("Tile");
-		open.setAction(new TileWindowsAction());
-		result.add(open);
-
-		return result;
-	}
-
-	private class TileWindowsAction extends AbstractAction {
-
-		@Override
-		public void actionPerformed(ActionEvent arg0) {
-
-		}
-
-	}
-
-	private void createFileBar() {
-		JTree tree = new JTree();
-
-		tree.setVisible(true);
-		mainFrame.getContentPane().add(tree, BorderLayout.WEST);
-		mainFrame.pack();
-	}
-
-	private class OpenWatcherWindowAction extends AbstractAction {
-		private static final long serialVersionUID = 1L;
-
-		public OpenWatcherWindowAction() {
-			super("Open");
-		}
-
-		@Override
-		public void actionPerformed(ActionEvent e) {
-			JFileChooser chooser = new JFileChooser();
-			if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {
-				File file = chooser.getSelectedFile();
-				try {
-					mainModel.addFile(file);
-				} catch (IOException e1) {
-					// TODO Auto-generated catch block
-					e1.printStackTrace();
-				}
-			}
-		}
-	}
-
-	private class CloseAction extends AbstractAction {
-		private static final long serialVersionUID = 1L;
-
-		public CloseAction() {
-			super("Close");
-		}
-
-		@Override
-		public void actionPerformed(ActionEvent e) {
-			mainFrame.setVisible(false);
-			mainFrame.dispose();
-		}
-	}
-
-	private JMenu getMenuFile() {
-		JMenu result = new JMenu("File");
-
-		JMenuItem open = new JMenuItem("Open");
-		open.setAction(new OpenWatcherWindowAction());
-		result.add(open);
-
-		JSeparator sep = new JSeparator();
-		result.add(sep);
-
-		JMenuItem close = new JMenuItem("Close");
-		close.setAction(new CloseAction());
-		result.add(close);
-		return result;
-	}
-
-}

tailog/src/magmax/tailog/taillog/gui/ModelChangedLines.java

-package magmax.taillog.gui;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Observable;
-import java.util.Observer;
-
-import javax.swing.table.AbstractTableModel;
-
-import magmax.tailog.fileaccess.FileWatcher;
-import magmax.tailog.fileaccess.FileWatcherScheduler;
-
-public class ModelChangedLines extends AbstractTableModel implements Observer {
-	private static final long serialVersionUID = 1L;
-	private ArrayList<ModelLine> lines = new ArrayList<ModelLine>();
-	private String[] headers = new String[] { "File", "Log Line" };
-
-	@Override
-	public Class<?> getColumnClass(int columnIndex) {
-		return String.class;
-	}
-
-	@Override
-	public String getColumnName(int column) {
-		return headers[column];
-	}
-
-	@Override
-	public int getColumnCount() {
-		return headers.length;
-	}
-
-	@Override
-	public int getRowCount() {
-		return lines.size();
-	}
-
-	@Override
-	public Object getValueAt(int rowIndex, int columnIndex) {
-		ModelLine line = lines.get(rowIndex);
-		switch (columnIndex) {
-		case 0:
-			return line.filename;
-		case 1:
-			return line.line;
-		}
-		return null;
-	}
-
-	@Override
-	public synchronized void update(Observable o, Object arg) {
-		FileWatcher watcher = (FileWatcher) o;
-		int size = lines.size();
-		lines.add(new ModelLine(watcher.getFile().getName(), arg.toString()));
-		fireTableRowsInserted(size, size);
-	}
-
-	public synchronized void addDateLine() {
-		Calendar calendar = Calendar.getInstance();
-		int size = lines.size();
-		lines.add(new ModelLine("", "------  " + calendar.getTime()
-				+ "  ------"));
-		fireTableRowsInserted(size, size);
-	}
-
-	public void clear() {
-		lines.clear();
-	}
-
-	public void addFile(File file) throws IOException {
-		FileWatcher watcher = new FileWatcher(file);
-		watcher.addObserver(this);
-
-		FileWatcherScheduler scheduler = new FileWatcherScheduler(watcher);
-	}
-
-	private class ModelLine {
-		public String filename = "";
-		public String line = "";
-
-		public ModelLine(String filename, String line) {
-			super();
-			this.filename = filename;
-			this.line = line;
-		}
-	}
-}