public class UISelect<T> extends UIComponent<UISelect<T>> implements java.lang.Iterable<UISelect.Option<T>>, IGuiText<UISelect<T>>
| Modifier and Type | Class and Description |
|---|---|
static class |
UISelect.Option<T>
The Class Option.
|
class |
UISelect.OptionsContainer |
static class |
UISelect.SelectEvent<T>
Event fired when a
UISelect changes its selected UISelect.Option. |
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate| Modifier and Type | Field and Description |
|---|---|
protected GuiIconProvider |
arrowIcon
Icon used to draw the arrow.
|
protected GuiShape |
arrowShape
Shape used to draw the arrow.
|
protected int |
bgColor
Background color
|
protected FontOptions |
disabledFontOptions
The
FontOptions to use for this UISelect when option is disabled. |
protected com.google.common.base.Predicate<T> |
disablePredicate
Predicate for option disability
|
protected boolean |
expanded
Whether this
UISelect is expanded. |
protected MalisisFont |
font
The
MalisisFont to use for this UISelect. |
protected FontOptions |
fontOptions
The
FontOptions to use for this UISelect. |
protected int |
hoverBgColor
Hovered background color
|
protected FontOptions |
hoveredFontOptions
The
FontOptions to use for this UISelect when option is hovered. |
protected com.google.common.base.Function<T,java.lang.String> |
labelFunction
Function for options label
|
protected java.lang.String |
labelPattern
Pattern to use for options labels.
|
protected int |
maxDisplayedOptions
Max number displayed options.
|
protected int |
maxExpandedWidth
Max width of the option container.
|
protected com.google.common.base.Function<T,? extends UISelect.Option<T>> |
optionFunction
Function for option creation
|
protected com.google.common.collect.FluentIterable<UISelect.Option<T>> |
options
|
protected UISelect.OptionsContainer |
optionsContainer
Container holding the
Options. |
protected int |
optionsHeight
Height of displayed
UISelect.Option box |
protected int |
optionsWidth
Width of displayed
UISelect.Option box |
protected FontOptions |
selectedFontOptions
The
FontOptions to use for this UISelect when option is selected. |
protected UISelect.Option<T> |
selectedOption
Currently selected option index.
|
| Constructor and Description |
|---|
UISelect(MalisisGui gui,
int width)
Instantiates a new
UISelect. |
UISelect(MalisisGui gui,
int width,
java.lang.Iterable<T> values)
Instantiates a new
UISelect. |
| Modifier and Type | Method and Description |
|---|---|
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called first when drawing this
UIComponent. |
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called last when drawing this
UIComponent. |
int |
getBgColor() |
FontOptions |
getDisabledFontOptions()
Gets the disabled
FontOptions. |
MalisisFont |
getFont()
Gets the
MalisisFont. |
FontOptions |
getFontOptions()
Gets the
FontOptions. |
int |
getHoverBgColor() |
FontOptions |
getHoveredFontOptions()
Gets the hovered
FontOptions. |
UISelect.Option<T> |
getOption(T obj)
Gets the
UISelect.Option corresponding to the object. |
FontOptions |
getSelectedFontOptions()
Gets the selected
FontOptions. |
protected int |
getSelectedIndex() |
UISelect.Option<T> |
getSelectedOption()
Gets the currently selected
UISelect.Option. |
T |
getSelectedValue()
Gets the value of the
selectedOption. |
boolean |
isInsideBounds(int x,
int y)
Checks if supplied coordinates are inside this
UIComponent bounds. |
java.util.Iterator<UISelect.Option<T>> |
iterator() |
UISelect<T> |
maxDisplayedOptions(int amount)
Sets the maximum number of options displayed when expanded.
|
boolean |
onClick(int x,
int y)
On click.
|
boolean |
onKeyTyped(char keyChar,
int keyCode)
Called when a key is typed inside
MalisisGui. |
boolean |
onScrollWheel(int x,
int y,
int delta)
On scroll wheel.
|
T |
select(T obj)
Selects the
UISelect.Option for the specified value. |
T |
select(UISelect.Option<T> option)
Selects the
UISelect.Option. |
T |
selectFirst()
Selects the first
UISelect.Option of this UISelect. |
T |
selectLast()
Selects the last
UISelect.Option of this UISelect. |
T |
selectNext()
Select the
UISelect.Option after the currently selected one. |
T |
selectPrevious()
Selects the
UISelect.Option before the currently selected one. |
UISelect<T> |
setBgColor(int bgColor) |
UISelect<T> |
setColors(int bgColor,
int hoverBgColor) |
UISelect<T> |
setDisabledFontOptions(FontOptions options)
Sets the disabled
FontOptions. |
UISelect<T> |
setDisablePredicate(com.google.common.base.Predicate<T> predicate) |
UISelect<T> |
setFont(MalisisFont font)
Sets the
MalisisFont. |
UISelect<T> |
setFontOptions(FontOptions options)
Sets the
FontOptions. |
UISelect<T> |
setHoverBgColor(int hoverBgColor) |
UISelect<T> |
setHoveredFontOptions(FontOptions options)
Sets the hovered
FontOptions. |
UISelect<T> |
setLabelFunction(com.google.common.base.Function<T,java.lang.String> func) |
UISelect<T> |
setLabelPattern(java.lang.String labelPattern)
Sets a pattern that will be used to format the option label.
|
UISelect<T> |
setMaxExpandedWidth(int width)
Sets the max width of the option container.
|
UISelect<T> |
setOptionFunction(com.google.common.base.Function<T,? extends UISelect.Option<T>> func) |
UISelect<T> |
setOptions(java.lang.Iterable<T> values)
|
UISelect<T> |
setSelectedFontOptions(FontOptions options)
Sets the selected
FontOptions. |
void |
setSelectedOption(T obj)
Sets the selected
UISelect.Option from its containing key. |
void |
setSelectedOption(UISelect.Option<T> option)
Sets the selected
UISelect.Option. |
addControlComponent, attachData, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getComponentAt, getData, getGui, getHeight, getIconProvider, getName, getParent, getPropertyString, getRawHeight, getRawWidth, getRenderer, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onButtonPress, onButtonRelease, onDoubleClick, onDrag, onMouseMove, onRightClick, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, self, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterprotected MalisisFont font
MalisisFont to use for this UISelect.protected FontOptions fontOptions
FontOptions to use for this UISelect.protected FontOptions hoveredFontOptions
FontOptions to use for this UISelect when option is hovered.protected FontOptions selectedFontOptions
FontOptions to use for this UISelect when option is selected.protected FontOptions disabledFontOptions
FontOptions to use for this UISelect when option is disabled.protected com.google.common.collect.FluentIterable<UISelect.Option<T>> options
protected UISelect.Option<T> selectedOption
protected int maxExpandedWidth
protected int maxDisplayedOptions
protected boolean expanded
UISelect is expanded.protected UISelect.OptionsContainer optionsContainer
Options.protected int optionsWidth
UISelect.Option boxprotected int optionsHeight
UISelect.Option boxprotected java.lang.String labelPattern
protected com.google.common.base.Function<T,? extends UISelect.Option<T>> optionFunction
protected com.google.common.base.Function<T,java.lang.String> labelFunction
protected com.google.common.base.Predicate<T> disablePredicate
protected int bgColor
protected int hoverBgColor
protected GuiShape arrowShape
protected GuiIconProvider arrowIcon
public UISelect(MalisisGui gui, int width, java.lang.Iterable<T> values)
UISelect.gui - the guiwidth - the widthvalues - the valuespublic UISelect(MalisisGui gui, int width)
UISelect.gui - the guiwidth - the widthpublic MalisisFont getFont()
IGuiTextMalisisFont.public UISelect<T> setFont(MalisisFont font)
IGuiTextMalisisFont.public FontOptions getFontOptions()
IGuiTextFontOptions.getFontOptions in interface IGuiText<UISelect<T>>public UISelect<T> setFontOptions(FontOptions options)
IGuiTextFontOptions.setFontOptions in interface IGuiText<UISelect<T>>options - the font optionspublic FontOptions getHoveredFontOptions()
FontOptions.public UISelect<T> setSelectedFontOptions(FontOptions options)
FontOptions.options - the optionsUISelectpublic FontOptions getSelectedFontOptions()
FontOptions.public UISelect<T> setDisabledFontOptions(FontOptions options)
FontOptions.options - the optionsUISelectpublic FontOptions getDisabledFontOptions()
FontOptions.public UISelect<T> setHoveredFontOptions(FontOptions options)
FontOptions.options - the optionsUISelectpublic int getBgColor()
public int getHoverBgColor()
public UISelect<T> setOptionFunction(com.google.common.base.Function<T,? extends UISelect.Option<T>> func)
public UISelect<T> setLabelFunction(com.google.common.base.Function<T,java.lang.String> func)
public UISelect<T> setDisablePredicate(com.google.common.base.Predicate<T> predicate)
public UISelect<T> setLabelPattern(java.lang.String labelPattern)
labelPattern - the label patternUISelectpublic UISelect<T> setMaxExpandedWidth(int width)
width - the widthUISelectpublic UISelect<T> maxDisplayedOptions(int amount)
amount - the amountUISelectpublic UISelect<T> setOptions(java.lang.Iterable<T> values)
values - the valuesUISelectpublic UISelect.Option<T> getOption(T obj)
UISelect.Option corresponding to the object.obj - the key of the Optionpublic void setSelectedOption(T obj)
UISelect.Option from its containing key.obj - the new selected optionpublic void setSelectedOption(UISelect.Option<T> option)
UISelect.Option.option - the new selected optionpublic UISelect.Option<T> getSelectedOption()
UISelect.Option.public T getSelectedValue()
selectedOption.public T select(UISelect.Option<T> option)
UISelect.Option.option - the optionpublic T select(T obj)
UISelect.Option for the specified value.obj - the objpublic T selectFirst()
UISelect.Option of this UISelect.public T selectLast()
UISelect.Option of this UISelect.public T selectPrevious()
UISelect.Option before the currently selected one.public T selectNext()
UISelect.Option after the currently selected one.protected int getSelectedIndex()
public boolean isInsideBounds(int x,
int y)
UIComponentUIComponent bounds.isInsideBounds in class UIComponent<UISelect<T>>x - the xy - the ypublic void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawBackground in class UIComponent<UISelect<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawForeground in class UIComponent<UISelect<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic boolean onClick(int x,
int y)
UIComponentonClick in class UIComponent<UISelect<T>>x - the xy - the ypublic boolean onScrollWheel(int x,
int y,
int delta)
UIComponentonScrollWheel in class UIComponent<UISelect<T>>x - the xy - the ydelta - the deltapublic boolean onKeyTyped(char keyChar,
int keyCode)
IKeyListenerMalisisGui.onKeyTyped in interface IKeyListeneronKeyTyped in class UIComponent<UISelect<T>>keyChar - the key charkeyCode - the key codepublic java.util.Iterator<UISelect.Option<T>> iterator()
iterator in interface java.lang.Iterable<UISelect.Option<T>>