X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2Fdialogs%2FListSelectDialogBuilder.java;fp=src%2Fcom%2Fgooglecode%2Flanterna%2Fgui2%2Fdialogs%2FListSelectDialogBuilder.java;h=0000000000000000000000000000000000000000;hp=a58d40f6f8a64d456f5916f442a98576e8e069b4;hb=f06c81000632cfb5f525ca458f719338f55f9f66;hpb=a73a906356c971b080c36368e71a15d87e8b8d31 diff --git a/src/com/googlecode/lanterna/gui2/dialogs/ListSelectDialogBuilder.java b/src/com/googlecode/lanterna/gui2/dialogs/ListSelectDialogBuilder.java deleted file mode 100644 index a58d40f..0000000 --- a/src/com/googlecode/lanterna/gui2/dialogs/ListSelectDialogBuilder.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.googlecode.lanterna.gui2.dialogs; - -import com.googlecode.lanterna.TerminalSize; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Dialog builder for the {@code ListSelectDialog} class, use this to create instances of that class and to customize - * them - * @author Martin - */ -public class ListSelectDialogBuilder extends AbstractDialogBuilder, ListSelectDialog> { - private TerminalSize listBoxSize; - private boolean canCancel; - private List content; - - /** - * Default constructor - */ - public ListSelectDialogBuilder() { - super("ListSelectDialog"); - this.listBoxSize = null; - this.canCancel = true; - this.content = new ArrayList(); - } - - @Override - protected ListSelectDialogBuilder self() { - return this; - } - - @Override - protected ListSelectDialog buildDialog() { - return new ListSelectDialog( - title, - description, - listBoxSize, - canCancel, - content); - } - - /** - * Sets the size of the list box in the dialog, scrollbars will be used if there is not enough space to draw all - * items. If set to {@code null}, the dialog will ask for enough space to be able to draw all items. - * @param listBoxSize Size of the list box in the dialog - * @return Itself - */ - public ListSelectDialogBuilder setListBoxSize(TerminalSize listBoxSize) { - this.listBoxSize = listBoxSize; - return this; - } - - /** - * Size of the list box in the dialog or {@code null} if the dialog will ask for enough space to draw all items - * @return Size of the list box in the dialog or {@code null} if the dialog will ask for enough space to draw all items - */ - public TerminalSize getListBoxSize() { - return listBoxSize; - } - - /** - * Sets if the dialog can be cancelled or not (default: {@code true}) - * @param canCancel If {@code true}, the user has the option to cancel the dialog, if {@code false} there is no such - * button in the dialog - * @return Itself - */ - public ListSelectDialogBuilder setCanCancel(boolean canCancel) { - this.canCancel = canCancel; - return this; - } - - /** - * Returns {@code true} if the dialog can be cancelled once it's opened - * @return {@code true} if the dialog can be cancelled once it's opened - */ - public boolean isCanCancel() { - return canCancel; - } - - /** - * Adds an item to the list box at the end - * @param item Item to add to the list box - * @return Itself - */ - public ListSelectDialogBuilder addListItem(T item) { - this.content.add(item); - return this; - } - - /** - * Adds a list of items to the list box at the end, in the order they are passed in - * @param items Items to add to the list box - * @return Itself - */ - public ListSelectDialogBuilder addListItems(T... items) { - this.content.addAll(Arrays.asList(items)); - return this; - } - - /** - * Returns a copy of the list of items in the list box - * @return Copy of the list of items in the list box - */ - public List getListItems() { - return new ArrayList(content); - } -}