001package myhw3.ui; 002 003public interface UI { 004 /** Displays a menu and calls the menu action corresponding to the user input. 005 * <ul><li> 006 * Displays <code>menu.getPrompt(i)</code> for each menu item <code>i</code>. 007 * </li><li> 008 * Reads a numeric <code>selection</code> from the user. 009 * </li><li> 010 * Calls <code>menu.runAction(selection)</code>. 011 * </li></ul> 012 */ 013 public void processMenu(UIMenu menu); 014 015 /** Displays a form and returns an array of validated responses. 016 * <ul><li> 017 * Displays <code>form.getPrompt(i)</code> for each form item <code>i</code>. 018 * </li><li> 019 * Reads a <code>response</code> from the user, for each form item <code>i</code>, and validates it using <code>form.checkInput(response)</code>. Only valid responses are accepted. 020 * </li><li> 021 * Returns an array of validated responses. 022 * </li></ul> 023 */ 024 public String[] processForm(UIForm form); 025 026 /** Displays the message. */ 027 public void displayMessage(String message); 028 029 /** Displays the error. */ 030 public void displayError(String message); 031}