X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Ftui%2Fpanes%2FMainContent.java;fp=src%2Fbe%2Fnikiroo%2Fjvcard%2Ftui%2Fpanes%2FMainContent.java;h=df8731366b37d788e2ab5ff86258e018221fb4da;hb=fae07ea7af01c64ca1a858db75a615555318d5e2;hp=0000000000000000000000000000000000000000;hpb=a3b510ab4bf89a7a2a05f3851ffe0f030b8a78f4;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/tui/panes/MainContent.java b/src/be/nikiroo/jvcard/tui/panes/MainContent.java new file mode 100644 index 0000000..df87313 --- /dev/null +++ b/src/be/nikiroo/jvcard/tui/panes/MainContent.java @@ -0,0 +1,81 @@ +package be.nikiroo.jvcard.tui.panes; + +import java.util.List; + +import be.nikiroo.jvcard.tui.KeyAction; + +import com.googlecode.lanterna.gui2.Direction; +import com.googlecode.lanterna.gui2.LinearLayout; +import com.googlecode.lanterna.gui2.Panel; + +/** + * This class represents the main content that you can see in this application + * (i.e., everything but the title and the actions keys is a {@link Panel} + * extended from this class). + * + * @author niki + * + */ +abstract public class MainContent extends Panel { + + public MainContent() { + super(); + } + + public MainContent(Direction dir) { + super(); + LinearLayout layout = new LinearLayout(dir); + layout.setSpacing(0); + setLayoutManager(layout); + } + + /** + * The title to display instead of the application name, or NULL for the + * default application name. + * + * @return the title or NULL + */ + abstract public String getTitle(); + + /** + * Returns an error message ready to be displayed if we should ask something + * to the user before exiting. + * + * @return an error message or NULL + */ + abstract public String getExitWarning(); + + /** + * The {@link KeyAction#Mode} that links to this {@link MainContent}. + * + * @return the linked mode + */ + abstract public KeyAction.Mode getMode(); + + /** + * The kind of data displayed by this {@link MainContent}. + * + * @return the kind of data displayed + */ + abstract public KeyAction.DataType getDataType(); + + /** + * Returns the list of actions and the keys that are bound to it. + * + * @return the list of actions + */ + abstract public List getKeyBindings(); + + /** + * Move the active cursor (not the text cursor, but the currently active + * item). + * + * @param x + * the horizontal move (< 0 for left, > 0 for right) + * @param y + * the vertical move (< 0 for up, > 0 for down) + * + * @return the error message to display if any + */ + abstract public String move(int x, int y); +}