com.redhat.rhn.frontend.listview
Class AlphaBar
java.lang.Object
com.redhat.rhn.frontend.listview.AlphaBar
public class AlphaBar
- extends java.lang.Object
AlphaBar, helper class to render a listing of letters/digits that
are contained in a set. For example a a simple text list could be generated
with a list of letters contained within the set passed into the getAlphaList()
method.
CharacterMap charset = new CharacterMap();
charset.add(new Character('A'));
charset.add(new Character('M'));
charset.add(new Character('Z'));
charset.add(new Character('5'));
AlphaBar ab = new AlphaBar("{0}* ", "{0} ");
System.out.println(ab.getAlphaList(charset));
produces the following output:
A* B C D E F G H I J K L M* N O P Q R S T U V W X Y Z* 1 2 3 4 5* 6 7 8 9 0
With each letter highlighted with an * indicating its contained within the set
|
Constructor Summary |
AlphaBar(java.lang.String charEnabledIn,
java.lang.String charDisabledIn)
Public constructor. |
|
Method Summary |
java.lang.String |
getAlphaList(CharacterMap charsEnabled)
get the alphabetical list of enabled and disabled
elements in the alphabet. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AlphaBar
public AlphaBar(java.lang.String charEnabledIn,
java.lang.String charDisabledIn)
- Public constructor. In order for the characters to be
parameterized on a per character basis, the paramters
must include a numbered parameter to indicate where to place
the alphanumeric character within the string if it is or is not
contained within the set.
This simply means you must include a {0} in the string to indicate
where you want the character to go. If the Character is enabled, {1}
represents the starting point in the DataResult of that character.
- Parameters:
charEnabledIn - the MessageFormat style textcharDisabledIn - the MessageFormat style text
getAlphaList
public java.lang.String getAlphaList(CharacterMap charsEnabled)
- get the alphabetical list of enabled and disabled
elements in the alphabet. See above for examples.
- Parameters:
charsEnabled - the set of characters that are
contained within the listview.
- Returns:
- String representation of Alpha bar with the
correct characters enabled.