summaryrefslogtreecommitdiff
path: root/tools/ahat/src/Doc.java
blob: 7fa70de915bebd7cb6506455220be65acb53e879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.ahat;

import java.util.List;

/**
 * An interface for rendering a page of content to the user.
 */
interface Doc extends AutoCloseable {
  /**
   * Output the title of the page.
   */
  public void title(String format, Object... args);

  /**
   * Print a line of text for a page menu.
   */
  public void menu(DocString string);

  /**
   * Start a new section with the given title.
   */
  public void section(String title);

  /**
   * Print a line of text in a normal font.
   */
  public void println(DocString string);

  /**
   * Print a line of text in a large font that is easy to see and click on.
   */
  public void big(DocString string);

  /**
   * Start a table with the given columns.
   *
   * An IllegalArgumentException is thrown if no columns are provided.
   *
   * This should be followed by calls to the 'row' method to fill in the table
   * contents and the 'end' method to end the table.
   */
  public void table(Column... columns);

  /**
   * Start a table with the following heading structure:
   *   |  description  |  c2  | c3 | ... |
   *   | h1 | h2 | ... |      |    |     |
   *
   * Where subcols describes h1, h2, ...
   * and cols describes c2, c3, ...
   *
   * This should be followed by calls to the 'row' method to fill in the table
   * contents and the 'end' method to end the table.
   */
  public void table(DocString description, List<Column> subcols, List<Column> cols);

  /**
   * Add a row to the currently active table.
   * The number of values must match the number of columns provided for the
   * currently active table.
   */
  public void row(DocString... values);

  /**
   * Start a new description list.
   *
   * This should be followed by calls to description() and finally a call to
   * end().
   */
  public void descriptions();

  /**
   * Add a description to the currently active description list.
   */
  public void description(DocString key, DocString value);

  /**
   * End the currently active table or description list.
   */
  public void end();
}