Improve UI, take "dirty" check into account, move launcher to Main.java
[jvcard.git] / src / be / nikiroo / jvcard / tui / panes / MainContentList.java
index 79cfb2baa6cec9f9aa482ad504040b9499fc2cb0..83654198f08c127f75d6ab6f1f06de66ca7372d3 100644 (file)
@@ -23,7 +23,7 @@ abstract public class MainContentList extends MainContent implements Runnable {
         * @author niki
         * 
         */
-       protected class TextPart {
+       public class TextPart {
                private String text;
                private Element element;
 
@@ -93,9 +93,10 @@ abstract public class MainContentList extends MainContent implements Runnable {
                                                        ActionListBox listBox, int index, Runnable item,
                                                        boolean selected, boolean focused) {
 
-                                               // TODO: why +5 ?? padding problem?
+                                               // width "-1" to reserve space for the optional vertical
+                                               // scroll bar
                                                List<TextPart> parts = MainContentList.this.getLabel(
-                                                               index, lines.getSize().getColumns() + 5,
+                                                               index, lines.getSize().getColumns() - 1,
                                                                selected, focused);
 
                                                int position = 0;
@@ -105,6 +106,7 @@ abstract public class MainContentList extends MainContent implements Runnable {
                                                        graphics.setBackgroundColor(part
                                                                        .getBackgroundColor());
                                                        String label = part.getText();
+
                                                        graphics.putString(position, 0, label);
                                                        position += label.length();
                                                }
@@ -164,6 +166,11 @@ abstract public class MainContentList extends MainContent implements Runnable {
                return null;
        }
 
+       @Override
+       public int getCount() {
+               return lines.getItemCount();
+       }
+
        /**
         * Return the representation of the selected line, in {@link TextPart}s.
         *