|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.extension.gui.dock.preference.preferences.choice.DefaultChoice<V>
V
- the kind of values this choice managespublic class DefaultChoice<V>
A default implementation of Choice
, provides text, id and objects
for every possible choice.
Constructor Summary | |
---|---|
DefaultChoice(DockController controller)
Creates a new choice, adding additional entries if there are any extensions. |
Method Summary | |
---|---|
void |
add(String id,
String text,
V value)
Adds an entry to this Choice . |
protected boolean |
equals(V a,
V b)
Checks the equality of a and b . |
String |
getDefaultChoice()
Gets the standard choice. |
String |
getId(int index)
Gets a unique identifier for the index 'th choice. |
String |
getText(int index)
Gets a name for the index' th choice. |
V |
getValue(int index)
Gets the value associated with the index 'th entry. |
V |
identifierToValue(String id)
Search the value for the entry width identifier id . |
int |
indexOfIdentifier(String id)
Searches the entry with the identifier id . |
int |
indexOfValue(V value)
Searches the index of the entry that contains value . |
boolean |
isNullEntryAllowed()
Tells whether the user choose nothing. |
void |
remove(int index)
Removes the index'th entry of this choice. |
void |
setDefaultChoice(String defaultChoice)
Sets the default choice for this choice. |
void |
setNullEntryAllowed(boolean nullEntryAllowed)
Sets whether the null -entry is allowed, the null -entry
describes the non existing selection. |
int |
size()
Gets the number of available choices. |
String |
valueToIdentifier(V value)
Searches the identifier for an entry which contains value ,
this method uses equals(Object, Object) to decide whether two
values are equal. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultChoice(DockController controller)
controller
- the realm in which this choice is used, can be null
Method Detail |
---|
public void remove(int index)
index
- the index of the entry to removepublic void add(String id, String text, V value)
Choice
.
id
- the id of the new entrytext
- the text of the new entryvalue
- the optional valuepublic String getId(int index)
Choice
index
'th choice.
getId
in interface Choice
index
- the index of the choice
public String getText(int index)
Choice
index'
th choice.
getText
in interface Choice
index
- the index of the choice
public V getValue(int index)
index
'th entry.
index
- the index of the entry
public int indexOfIdentifier(String id)
id
.
id
- some id, might be null
public int indexOfValue(V value)
value
. This
method uses equals(Object, Object)
to compare two objects.
value
- the value to search
value
can't be found or
is null
protected boolean equals(V a, V b)
a
and b
.
a
- some value, might be null
b
- some value, might be null
true
if a
and b
are equalpublic String valueToIdentifier(V value)
value
,
this method uses equals(Object, Object)
to decide whether two
values are equal.
value
- the value to search
null
if value
is null
public V identifierToValue(String id)
id
.
id
- the id to search
id
public int size()
Choice
size
in interface Choice
public void setNullEntryAllowed(boolean nullEntryAllowed)
null
-entry is allowed, the null
-entry
describes the non existing selection.
nullEntryAllowed
- true
if no selection is allowedpublic boolean isNullEntryAllowed()
Choice
isNullEntryAllowed
in interface Choice
null
identifierpublic void setDefaultChoice(String defaultChoice)
defaultChoice
- the default valuepublic String getDefaultChoice()
Choice
getDefaultChoice
in interface Choice
null
is only
allowed if Choice.isNullEntryAllowed()
returns true
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |