68230d490eeb98e3bb612f323fd91533f73caeef
1 package be
.nikiroo
.jvcard
.tui
.panes
;
5 import be
.nikiroo
.jvcard
.tui
.KeyAction
;
7 import com
.googlecode
.lanterna
.gui2
.Direction
;
8 import com
.googlecode
.lanterna
.gui2
.LinearLayout
;
9 import com
.googlecode
.lanterna
.gui2
.Panel
;
12 * This class represents the main content that you can see in this application
13 * (i.e., everything but the title and the actions keys is a {@link Panel}
14 * extended from this class).
19 abstract public class MainContent
extends Panel
{
21 public MainContent() {
25 public MainContent(Direction dir
) {
27 LinearLayout layout
= new LinearLayout(dir
);
29 setLayoutManager(layout
);
33 * The kind of data displayed by this {@link MainContent}.
35 * @return the kind of data displayed
37 abstract public KeyAction
.DataType
getDataType();
40 * Returns the list of actions and the keys that are bound to it.
42 * @return the list of actions
44 abstract public List
<KeyAction
> getKeyBindings();
47 * The title to display in addition to the application name, or NULL for the
48 * default application name.
50 * @return the title or NULL
52 public String
getTitle() {
57 * Returns an error message ready to be displayed if we should ask something
58 * to the user before exiting.
60 * @return an error message or NULL
62 public String
getExitWarning() {
67 * Move the active cursor (not the text cursor, but the currently active
71 * the horizontal move (< 0 for left, > 0 for right)
73 * the vertical move (< 0 for up, > 0 for down)
75 * @return the error message to display if any
77 public String
move(int x
, int y
) {
82 * Return the number of items in this {@link MainContent}, or -1 if this
83 * {@link MainContent} is not countable.
85 * @return -1 or the number of present items
87 public int getCount() {
92 * Refresh the display according to the actual data (this method should be
93 * called when the data changed).
95 public void refreshData() {