You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.8 KiB
59 lines
1.8 KiB
|
|
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!");
|
|
}
|
|
}
|
|
|
|
|