01 /*
02 * Licensed to the Apache Software Foundation (ASF) under one
03 * or more contributor license agreements. See the NOTICE file
04 * distributed with this work for additional information
05 * regarding copyright ownership. The ASF licenses this file
06 * to you under the Apache License, Version 2.0 (the
07 * "License"); you may not use this file except in compliance
08 * with the License. You may obtain a copy of the License at
09 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 *
20 */
21 package org.apache.qpid.tools.utils;
22
23 import java.util.List;
24
25 public interface Console
26 {
27 public enum CellFormat
28 {
29 CENTRED, LEFT, RIGHT
30 }
31
32 public static String ROW_DIVIDER = "*divider";
33
34 public void print(String... message);
35
36 public void println(String... message);
37
38 public String readln();
39
40 /**
41 * Reads and parses the command line.
42 *
43 *
44 * @return The next command or null
45 */
46 public String[] readCommand();
47
48 public CommandParser getCommandParser();
49
50 public void setCommandParser(CommandParser parser);
51
52 /**
53 *
54 * Prints the list of String nicely.
55 *
56 * +-------------+
57 * | Heading |
58 * +-------------+
59 * | Item 1 |
60 * | Item 2 |
61 * | Item 3 |
62 * +-------------+
63 *
64 * @param hasTitle should list[0] be used as a heading
65 * @param list The list of Strings to display
66 */
67 public void displayList(boolean hasTitle, String... list);
68
69 /**
70 *
71 * Prints the list of String nicely.
72 *
73 * +----------------------------+
74 * | Heading |
75 * +----------------------------+
76 * | title | title | ..
77 * +----------------------------+
78 * | Item 2 | value 2 | ..
79 * +----------------------------+ (*divider)
80 * | Item 3 | value 2 | ..
81 * +----------------------------+
82 *
83 * @param title The title to display if any
84 * @param entries the entries to display in a map.
85 */
86 void printMap(String title, List<List> entries);
87
88
89 public void close();
90 }
|