|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.opengl.gui.Component
com.threerings.opengl.gui.TextComponent
com.threerings.opengl.gui.Label
com.threerings.opengl.gui.ComboBox
public class ComboBox
Displays a selected value and allows that value to be changed by selecting from a popup menu.
| Nested Class Summary | |
|---|---|
protected static class |
ComboBox.ComboMenuItem
|
protected class |
ComboBox.ComboPopupMenu
|
static class |
ComboBox.DefaultFormatter
The default formatter for a ComboBox. |
static interface |
ComboBox.Formatter
Formats the items held in a ComboBox into their icon and label. |
static class |
ComboBox.Item
Used for displaying a label that is associated with a particular non-displayable value. |
| Nested classes/interfaces inherited from class com.threerings.opengl.gui.Label |
|---|
Label.Fit |
| Field Summary | |
|---|---|
protected int |
_columns
Our preferred number of rows and columns for the popup menu. |
protected ComboBox.Formatter |
_formatter
Our item formatter. |
protected List<ComboBox.ComboMenuItem> |
_items
The list of items in this combo box. |
protected ComboBox.ComboPopupMenu |
_menu
A cached popup menu containing our items. |
protected Dimension |
_psize
Our cached preferred size. |
protected int |
_rows
Our preferred number of rows and columns for the popup menu. |
protected int |
_selidx
The index of the currently selected item. |
| Fields inherited from class com.threerings.opengl.gui.Label |
|---|
_label |
| Fields inherited from class com.threerings.opengl.gui.TextComponent |
|---|
_effcols, _effsizes, _haligns, _lineSpacings, _teffects, _textfacts, _valigns |
| Fields inherited from class com.threerings.opengl.gui.Component |
|---|
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES |
| Fields inherited from interface com.threerings.opengl.gui.Selectable |
|---|
SELECT |
| Fields inherited from interface com.threerings.opengl.gui.UIConstants |
|---|
BOTTOM, CENTER, DEFAULT_SIZE, DEFAULT_SPACING, GLOW, HORIZONTAL, LEFT, NORMAL, OUTLINE, OVERLAPPING, PLAIN, RIGHT, SHADOW, TOP, VERTICAL |
| Constructor Summary | |
|---|---|
ComboBox(GlContext ctx)
Creates an empty combo box. |
|
ComboBox(GlContext ctx,
Iterable<?> items)
Creates a combo box with the supplied set of items. |
|
ComboBox(GlContext ctx,
Object[] items)
Creates a combo box with the supplied set of items. |
|
| Method Summary | |
|---|---|
void |
addItem(int index,
Object item)
Inserts an item into our list of items at the specified position (zero being before all other items and so forth). |
void |
addItem(Object item)
Appends an item to our list of items. |
protected void |
clearCache()
|
void |
clearItems()
Removes all items from this combo box. |
protected Dimension |
computePreferredSize(int whint,
int hhint)
Computes and returns a preferred size for this component. |
boolean |
dispatchEvent(Event event)
Instructs this component to process the supplied event. |
protected void |
format(Label label,
Object item)
Format the specified label. |
protected String |
getDefaultStyleConfig()
Returns the name of the default config to be used for all instances of this component. |
Object |
getItem(int index)
Returns the item at the specified index. |
int |
getItemCount()
Returns the number of items in this combo box. |
protected List<Object> |
getItems()
Get the raw list of items. |
Object |
getSelected()
Get the selected item, if any. |
int |
getSelectedIndex()
Get the index of the selected item, or -1. |
Object |
getSelectedItem()
Deprecated. |
Object |
getSelectedValue()
Requires that the combo box be configured with ComboBox.Item items, returns the ComboBox.Item.value of the currently selected item. |
Object |
getValue(int index)
Returns the value at the specified index, the item must be an instance of ComboBox.Item. |
void |
selectItem(int index)
Deprecated. |
protected void |
selectItem(int index,
long when,
int modifiers)
|
void |
selectItem(Object item)
Deprecated. |
void |
selectValue(Object value)
Requires that the combo box be configured with ComboBox.Item items, selects the item with a
ComboBox.Item.value equal to the supplied value. |
void |
setFormatter(ComboBox.Formatter formatter)
Set the formatter that determines how items are labeled. |
void |
setItems(Iterable<?> items)
Replaces any existing items in this combo box with the supplied items. |
void |
setItems(Object[] items)
Replaces any existing items in this combo box with the supplied items. |
void |
setPreferredDimensions(int rows,
int columns)
Sets the preferred number of columns in the popup menu. |
void |
setSelected(Object item)
Set the selected item. |
void |
setSelectedIndex(int index)
Set the index of the selected item. |
| Methods inherited from class com.threerings.opengl.gui.Label |
|---|
getFit, getIcon, getIconTextGap, getLabelRenderer, getText, layout, renderComponent, setFit, setIcon, setIconTextGap, setOrientation, setPreferredWidth, setText, setTextRotation |
| Methods inherited from class com.threerings.opengl.gui.TextComponent |
|---|
getEffectColor, getEffectSize, getHorizontalAlignment, getLabelRendererConfig, getLineSpacing, getTextEffect, getTextFactory, getTextFactory, getVerticalAlignment, updateFromStyleConfig |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ComboBox.Formatter _formatter
protected int _selidx
protected List<ComboBox.ComboMenuItem> _items
protected ComboBox.ComboPopupMenu _menu
protected Dimension _psize
protected int _rows
protected int _columns
| Constructor Detail |
|---|
public ComboBox(GlContext ctx)
public ComboBox(GlContext ctx,
Object[] items)
Object.toString()
for each item will be displayed in the list.
public ComboBox(GlContext ctx,
Iterable<?> items)
Object.toString()
for each item will be displayed in the list.
| Method Detail |
|---|
public void setFormatter(ComboBox.Formatter formatter)
public void addItem(Object item)
Object.toString() for the item
will be displayed in the list.
public void addItem(int index,
Object item)
Object.toString() for the item will be
displayed in the list.
public void setItems(Iterable<?> items)
public void setItems(Object[] items)
public Object getSelected()
Selectable
getSelected in interface Selectable<Object>public void setSelected(Object item)
Selectable
setSelected in interface Selectable<Object>public int getSelectedIndex()
Selectable
getSelectedIndex in interface Selectable<Object>public void setSelectedIndex(int index)
Selectable
setSelectedIndex in interface Selectable<Object>@Deprecated public Object getSelectedItem()
public Object getSelectedValue()
ComboBox.Item items, returns the ComboBox.Item.value of the currently selected item.
@Deprecated public void selectItem(int index)
@Deprecated public void selectItem(Object item)
public void selectValue(Object value)
ComboBox.Item items, selects the item with a
ComboBox.Item.value equal to the supplied value.
public int getItemCount()
public Object getItem(int index)
public Object getValue(int index)
ComboBox.Item.
public void clearItems()
public void setPreferredDimensions(int rows,
int columns)
public boolean dispatchEvent(Event event)
Componentsuper.dispatchEvent for events that they did not "consume".
dispatchEvent in class Componentprotected String getDefaultStyleConfig()
Component
getDefaultStyleConfig in class Label
protected Dimension computePreferredSize(int whint,
int hhint)
Component
computePreferredSize in class Label
protected void selectItem(int index,
long when,
int modifiers)
protected void clearCache()
protected void format(Label label,
Object item)
protected List<Object> getItems()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||