git://git.nikiroo.be
/
jvcard.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update lanterna, fix bugs, implement save...
[jvcard.git]
/
src
/
be
/
nikiroo
/
jvcard
/
tui
/
panes
/
MainContentList.java
diff --git
a/src/be/nikiroo/jvcard/tui/panes/MainContentList.java
b/src/be/nikiroo/jvcard/tui/panes/MainContentList.java
index 79cfb2baa6cec9f9aa482ad504040b9499fc2cb0..38b775c2998af5986cf06e31440bd663b42d90d5 100644
(file)
--- a/
src/be/nikiroo/jvcard/tui/panes/MainContentList.java
+++ b/
src/be/nikiroo/jvcard/tui/panes/MainContentList.java
@@
-23,7
+23,7
@@
abstract public class MainContentList extends MainContent implements Runnable {
* @author niki
*
*/
* @author niki
*
*/
- p
rotected
class TextPart {
+ p
ublic
class TextPart {
private String text;
private Element element;
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) {
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(
List<TextPart> parts = MainContentList.this.getLabel(
- index, lines.getSize().getColumns()
+ 5
,
+ index, lines.getSize().getColumns()
- 1
,
selected, focused);
int position = 0;
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.setBackgroundColor(part
.getBackgroundColor());
String label = part.getText();
+
graphics.putString(position, 0, label);
position += label.length();
}
graphics.putString(position, 0, label);
position += label.length();
}
@@
-150,6
+152,17
@@
abstract public class MainContentList extends MainContent implements Runnable {
public void setSelectedIndex(int index) {
lines.setSelectedIndex(index);
}
public void setSelectedIndex(int index) {
lines.setSelectedIndex(index);
}
+
+
+ /**
+ * Return the default content separator for text fields.
+ *
+ * @return the separator
+ */
+ public String getSeparator() {
+ // we could use: " ", "┃", "│"...
+ return "┃";
+ }
@Override
public void run() {
@Override
public void run() {
@@
-164,6
+177,11
@@
abstract public class MainContentList extends MainContent implements Runnable {
return null;
}
return null;
}
+ @Override
+ public int getCount() {
+ return lines.getItemCount();
+ }
+
/**
* Return the representation of the selected line, in {@link TextPart}s.
*
/**
* Return the representation of the selected line, in {@link TextPart}s.
*