|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbibliothek.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.
| Nested Class Summary | |
|---|---|
static interface |
DefaultChoice.Entry<V>
|
| Constructor Summary | |
|---|---|
DefaultChoice(DockController controller)
Creates a new choice, adding additional entries if there are any extensions. |
|
| Method Summary | |
|---|---|
DefaultChoice.Entry<V> |
add(String id,
String text,
boolean textIsKey,
V value)
Adds an entry to this Choice. |
DefaultChoice.Entry<V> |
add(String id,
String text,
V value)
Like add(String, String, boolean, Object) with codeIsKey set to false |
void |
addChoiceListener(ChoiceListener listener)
Adds a listener to this choice. |
DefaultChoice.Entry<V> |
addLinked(String id,
String text,
V value)
Like add(String, String, boolean, Object) with codeIsKey set to true |
protected boolean |
equals(V a,
V b)
Checks the equality of a and b. |
protected void |
fireInserted(int start,
int end)
Calls ChoiceListener.inserted(Choice, int, int) on all listeners
that are currently known. |
protected void |
fireRemoved(int start,
int end)
Calls ChoiceListener.removed(Choice, int, int) on all listeners
that are currently known. |
protected void |
fireUpdated(int start,
int end)
Calls ChoiceListener.updated(Choice, int, int) on all listeners
that are currently known. |
String |
getDefaultChoice()
Gets the standard choice. |
DefaultChoice.Entry<V> |
getEntry(int index)
Gets all the data that is stored at index. |
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 |
removeChoiceListener(ChoiceListener listener)
Removes the listener listener from this choice. |
void |
setController(DockController controller)
Informs this Choice that it is now used for displaying items for
controller. |
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 addChoiceListener(ChoiceListener listener)
Choice
addChoiceListener in interface Choicelistener - the new listener, not nullpublic void removeChoiceListener(ChoiceListener listener)
Choicelistener from this choice.
removeChoiceListener in interface Choicelistener - the listener to remove
protected void fireInserted(int start,
int end)
ChoiceListener.inserted(Choice, int, int) on all listeners
that are currently known.
start - the index of the first entryend - the index of the last entry
protected void fireRemoved(int start,
int end)
ChoiceListener.removed(Choice, int, int) on all listeners
that are currently known.
start - the index of the first entryend - the index of the last entry
protected void fireUpdated(int start,
int end)
ChoiceListener.updated(Choice, int, int) on all listeners
that are currently known.
start - the index of the first entryend - the index of the last entrypublic void setController(DockController controller)
ChoiceChoice that it is now used for displaying items for
controller.
setController in interface Choicecontroller - the controller in whose realm this Choice is currently
used, can be nullpublic void remove(int index)
index - the index of the entry to remove
public DefaultChoice.Entry<V> add(String id,
String text,
V value)
add(String, String, boolean, Object) with codeIsKey set to false
id - the id of the new entrytext - the text of the new entryvalue - the optional value
public DefaultChoice.Entry<V> addLinked(String id,
String text,
V value)
add(String, String, boolean, Object) with codeIsKey set to true
id - the id of the new entrytext - the text of the new entryvalue - the optional value
public DefaultChoice.Entry<V> add(String id,
String text,
boolean textIsKey,
V value)
Choice.
id - the id of the new entrytext - the text of the new entrytextIsKey - if true, then text is interpreted as a key for a TextManager,
otherwise it is just textvalue - the optional value
public String getId(int index)
Choiceindex'th choice.
getId in interface Choiceindex - the index of the choice
public String getText(int index)
Choiceindex'th choice.
getText in interface Choiceindex - the index of the choice
public V getValue(int index)
index'th entry.
index - the index of the entry
public DefaultChoice.Entry<V> getEntry(int index)
index.
index - the index of some 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 nullb - 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 nullpublic V identifierToValue(String id)
id.
id - the id to search
idpublic int size()
Choice
size in interface Choicepublic 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 Choicenull identifierpublic void setDefaultChoice(String defaultChoice)
defaultChoice - the default valuepublic String getDefaultChoice()
Choice
getDefaultChoice in interface Choicenull is only
allowed if Choice.isNullEntryAllowed() returns true
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||