Add text-image control and separate Edit/View contact
[jvcard.git] / src / be / nikiroo / jvcard / tui / panes / MainContent.java
index df8731366b37d788e2ab5ff86258e018221fb4da..68230d490eeb98e3bb612f323fd91533f73caeef 100644 (file)
@@ -30,41 +30,38 @@ abstract public class MainContent extends Panel {
        }
 
        /**
-        * 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.
+        * The kind of data displayed by this {@link MainContent}.
         * 
-        * @return an error message or NULL
+        * @return the kind of data displayed
         */
-       abstract public String getExitWarning();
+       abstract public KeyAction.DataType getDataType();
 
        /**
-        * The {@link KeyAction#Mode} that links to this {@link MainContent}.
+        * Returns the list of actions and the keys that are bound to it.
         * 
-        * @return the linked mode
+        * @return the list of actions
         */
-       abstract public KeyAction.Mode getMode();
+       abstract public List<KeyAction> getKeyBindings();
 
        /**
-        * The kind of data displayed by this {@link MainContent}.
+        * The title to display in addition to the application name, or NULL for the
+        * default application name.
         * 
-        * @return the kind of data displayed
+        * @return the title or NULL
         */
-       abstract public KeyAction.DataType getDataType();
+       public String getTitle() {
+               return null;
+       }
 
        /**
-        * Returns the list of actions and the keys that are bound to it.
+        * Returns an error message ready to be displayed if we should ask something
+        * to the user before exiting.
         * 
-        * @return the list of actions
+        * @return an error message or NULL
         */
-       abstract public List<KeyAction> getKeyBindings();
+       public String getExitWarning() {
+               return null;
+       }
 
        /**
         * Move the active cursor (not the text cursor, but the currently active
@@ -77,5 +74,25 @@ abstract public class MainContent extends Panel {
         * 
         * @return the error message to display if any
         */
-       abstract public String move(int x, int y);
+       public String move(int x, int y) {
+               return null;
+       }
+
+       /**
+        * Return the number of items in this {@link MainContent}, or -1 if this
+        * {@link MainContent} is not countable.
+        * 
+        * @return -1 or the number of present items
+        */
+       public int getCount() {
+               return -1;
+       }
+
+       /**
+        * Refresh the display according to the actual data (this method should be
+        * called when the data changed).
+        */
+       public void refreshData() {
+               invalidate();
+       }
 }