X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Ftui%2Fpanes%2FMainContent.java;h=26cd7cb8ae330797e8394f27eb831762480241ac;hb=5ad0e17e7fea1c602cb2638a006424af9c7e33e8;hp=df8731366b37d788e2ab5ff86258e018221fb4da;hpb=fae07ea7af01c64ca1a858db75a615555318d5e2;p=jvcard.git diff --git a/src/be/nikiroo/jvcard/tui/panes/MainContent.java b/src/be/nikiroo/jvcard/tui/panes/MainContent.java index df87313..26cd7cb 100644 --- a/src/be/nikiroo/jvcard/tui/panes/MainContent.java +++ b/src/be/nikiroo/jvcard/tui/panes/MainContent.java @@ -1,5 +1,6 @@ package be.nikiroo.jvcard.tui.panes; +import java.io.IOException; import java.util.List; import be.nikiroo.jvcard.tui.KeyAction; @@ -30,12 +31,28 @@ abstract public class MainContent extends Panel { } /** - * The title to display instead of the application name, or NULL for the + * 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(); + + /** + * The title to display in addition to the application name, or NULL for the * default application name. * * @return the title or NULL */ - abstract public String getTitle(); + public String getTitle() { + return null; + } /** * Returns an error message ready to be displayed if we should ask something @@ -43,39 +60,54 @@ abstract public class MainContent extends Panel { * * @return an error message or NULL */ - abstract public String getExitWarning(); + public String getExitWarning() { + return null; + } /** - * The {@link KeyAction#Mode} that links to this {@link MainContent}. + * 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 linked mode + * @return the error message to display if any */ - abstract public KeyAction.Mode getMode(); + public String move(int x, int y) { + return null; + } /** - * The kind of data displayed by this {@link MainContent}. + * Return the number of items in this {@link MainContent}, or -1 if this + * {@link MainContent} is not countable. * - * @return the kind of data displayed + * @return -1 or the number of present items */ - abstract public KeyAction.DataType getDataType(); + public int getCount() { + return -1; + } /** - * Returns the list of actions and the keys that are bound to it. - * - * @return the list of actions + * Refresh the display according to the actual data (this method should be + * called when the data changed). */ - abstract public List getKeyBindings(); + public void refreshData() { + invalidate(); + } /** - * Move the active cursor (not the text cursor, but the currently active - * item). + * Wake up call when the content is popped-back into view. You should call + * this method when you exit a previous content and come back to this one. * - * @param x - * the horizontal move (< 0 for left, > 0 for right) - * @param y - * the vertical move (< 0 for up, > 0 for down) + * @return a message to display, or NULL * - * @return the error message to display if any + * @throws IOException + * in case of error (the message of the {@link IOException} will + * be displayed to the user) */ - abstract public String move(int x, int y); + public String wakeup() throws IOException { + return null; + } }