blob: 5a70c4c74b727c234ef01cf3552f9a3fd288adac [file] [log] [blame]
Richard Uhlerb730b782015-07-15 16:01:58 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.ahat;
18
19import java.util.List;
20
21/**
22 * An interface for rendering a page of content to the user.
23 */
24interface Doc extends AutoCloseable {
25 /**
26 * Output the title of the page.
27 */
Richard Uhler1af86f12015-10-29 14:55:00 -070028 void title(String format, Object... args);
Richard Uhlerb730b782015-07-15 16:01:58 -070029
30 /**
31 * Print a line of text for a page menu.
32 */
Richard Uhler1af86f12015-10-29 14:55:00 -070033 void menu(DocString string);
Richard Uhlerb730b782015-07-15 16:01:58 -070034
35 /**
36 * Start a new section with the given title.
37 */
Richard Uhler1af86f12015-10-29 14:55:00 -070038 void section(String title);
Richard Uhlerb730b782015-07-15 16:01:58 -070039
40 /**
41 * Print a line of text in a normal font.
42 */
Richard Uhler1af86f12015-10-29 14:55:00 -070043 void println(DocString string);
Richard Uhlerb730b782015-07-15 16:01:58 -070044
45 /**
46 * Print a line of text in a large font that is easy to see and click on.
47 */
Richard Uhler1af86f12015-10-29 14:55:00 -070048 void big(DocString string);
Richard Uhlerb730b782015-07-15 16:01:58 -070049
50 /**
51 * Start a table with the given columns.
52 *
53 * An IllegalArgumentException is thrown if no columns are provided.
54 *
55 * This should be followed by calls to the 'row' method to fill in the table
56 * contents and the 'end' method to end the table.
57 */
Richard Uhler1af86f12015-10-29 14:55:00 -070058 void table(Column... columns);
Richard Uhlerb730b782015-07-15 16:01:58 -070059
60 /**
61 * Start a table with the following heading structure:
62 * | description | c2 | c3 | ... |
63 * | h1 | h2 | ... | | | |
64 *
65 * Where subcols describes h1, h2, ...
66 * and cols describes c2, c3, ...
67 *
68 * This should be followed by calls to the 'row' method to fill in the table
69 * contents and the 'end' method to end the table.
70 */
Richard Uhler1af86f12015-10-29 14:55:00 -070071 void table(DocString description, List<Column> subcols, List<Column> cols);
Richard Uhlerb730b782015-07-15 16:01:58 -070072
73 /**
74 * Add a row to the currently active table.
75 * The number of values must match the number of columns provided for the
76 * currently active table.
77 */
Richard Uhler1af86f12015-10-29 14:55:00 -070078 void row(DocString... values);
Richard Uhlerb730b782015-07-15 16:01:58 -070079
80 /**
81 * Start a new description list.
82 *
83 * This should be followed by calls to description() and finally a call to
84 * end().
85 */
Richard Uhler1af86f12015-10-29 14:55:00 -070086 void descriptions();
Richard Uhlerb730b782015-07-15 16:01:58 -070087
88 /**
89 * Add a description to the currently active description list.
90 */
Richard Uhler1af86f12015-10-29 14:55:00 -070091 void description(DocString key, DocString value);
Richard Uhlerb730b782015-07-15 16:01:58 -070092
93 /**
94 * End the currently active table or description list.
95 */
Richard Uhler1af86f12015-10-29 14:55:00 -070096 void end();
Richard Uhlerb730b782015-07-15 16:01:58 -070097}