diff --git a/project/view/ConsoleView.java b/project/view/ConsoleView.java new file mode 100644 index 0000000..fec95a7 --- /dev/null +++ b/project/view/ConsoleView.java @@ -0,0 +1,59 @@ + +package view; + +import java.util.List; + +public class ConsoleView { + + public void showWelcome() { + System.out.println("=================================="); + System.out.println(" Data Crawler System"); + System.out.println("=================================="); + } + + public void showMenu() { + System.out.println("\nPlease select:"); + System.out.println("1 - Crawl Changsha Weather"); + System.out.println("2 - Crawl Earthquake Data"); + System.out.println("3 - Crawl News Rank Top 10"); + System.out.println("4 - Crawl All Data"); + System.out.println("5 - List Crawled Files"); + System.out.println("6 - Generate HTML Visualizations"); + System.out.println("h - Show Help"); + System.out.println("0 - Exit"); + System.out.print("Your choice: "); + } + + public void showHelp() { + System.out.println("\n=== Help ==="); + System.out.println("1. Choose 1-4 to crawl data"); + System.out.println("2. Choose 5 to view files"); + System.out.println("3. Choose 6 to generate charts"); + System.out.println("4. Choose 0 to exit"); + System.out.println("============\n"); + } + + public void showMessage(String message) { + System.out.println(message); + } + + public void showError(String error) { + System.err.println("[ERROR] " + error); + } + + public void showDataList(List files) { + if (files.isEmpty()) { + System.out.println("No data files found"); + return; + } + System.out.println("\nCrawled Data Files:"); + for (int i = 0; i < files.size(); i++) { + System.out.println((i + 1) + ". " + files.get(i)); + } + } + + public void showGoodbye() { + System.out.println("\nGoodbye!"); + } +} +