import java.util.List;
import be.nikiroo.jvcard.launcher.Main;
-import be.nikiroo.jvcard.resources.StringUtils;
-import be.nikiroo.jvcard.resources.Trans.StringId;
-import be.nikiroo.jvcard.tui.UiColors.Element;
+import be.nikiroo.jvcard.resources.ColorOption;
+import be.nikiroo.jvcard.resources.StringId;
+import be.nikiroo.jvcard.tui.UiColors;
+import be.nikiroo.utils.StringUtils;
import com.googlecode.lanterna.TextColor;
import com.googlecode.lanterna.gui2.AbstractListBox.ListItemRenderer;
*/
public class TextPart {
private String text;
- private Element element;
+ private ColorOption element;
- public TextPart(String text, Element element) {
+ public TextPart(String text, ColorOption element) {
this.text = text;
this.element = element;
}
return text;
}
- public Element getElement() {
+ public ColorOption getElement() {
return element;
}
public TextColor getForegroundColor() {
if (element != null)
- return element.getForegroundColor();
- return Element.DEFAULT.getForegroundColor();
+ return UiColors.getForegroundColor(element);
+ return UiColors.getForegroundColor(ColorOption.DEFAULT);
}
public TextColor getBackgroundColor() {
if (element != null)
- return element.getBackgroundColor();
- return Element.DEFAULT.getBackgroundColor();
+ return UiColors.getBackgroundColor(element);
+ return UiColors.getBackgroundColor(ColorOption.DEFAULT);
}
}
* Will be set to {@code true} if the list box currently
* has input focus, otherwise {@code false}
*/
+ @Override
public void drawItem(TextGUIGraphics graphics,
ActionListBox listBox, int index, Runnable item,
boolean selected, boolean focused) {
addItem(run.toString());
}
setSelectedIndex(index);
-
+
return deleted;
}
*
* @return the text representation
*/
- protected List<TextPart> getLabel(int index, int width, boolean selected,
+ protected List<TextPart> getLabel(int index,
+ @SuppressWarnings("unused") int width, boolean selected,
boolean focused) {
List<TextPart> parts = new LinkedList<TextPart>();
if (selected && focused) {
parts.add(new TextPart("" + lines.getItems().get(index),
- Element.CONTACT_LINE_SELECTED));
+ ColorOption.CONTACT_LINE_SELECTED));
} else {
parts.add(new TextPart("" + lines.getItems().get(index),
- Element.CONTACT_LINE));
+ ColorOption.CONTACT_LINE));
}
return parts;