Class VariableBar
java.lang.Object
com.github.stefvanschie.inventoryframework.pane.Pane
com.github.stefvanschie.inventoryframework.pane.component.util.VariableBar
- All Implemented Interfaces:
Flippable,Orientable
- Direct Known Subclasses:
PercentageBar,Slider
A variable bar for UI elements that require some sort of bar
- Since:
- 0.5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
Pane.PriorityNested classes/interfaces inherited from interface com.github.stefvanschie.inventoryframework.pane.Orientable
Orientable.Orientation -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final @NotNull OutlinePaneThe green and the red parts of the sliderprotected final @NotNull OutlinePaneThe green and the red parts of the sliderprotected booleanWhether the pane is flipped horizontally or verticallyprotected booleanWhether the pane is flipped horizontally or verticallyprotected @NotNull Orientable.OrientationThe orientation of the sliderprotected floatThe value this slider is at. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVariableBar(int length, int height) protectedVariableBar(int x, int y, int length, int height) protectedVariableBar(int x, int y, int length, int height, @NotNull Pane.Priority priority) protectedVariableBar(int x, int y, int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new variable barprotectedVariableBar(int x, int y, int length, int height, @NotNull Plugin plugin) Creates a new variable barprotectedVariableBar(int length, int height, @NotNull Plugin plugin) Creates a new variable barprotectedVariableBar(@NotNull Slot slot, int length, int height) Creates a new variable barprotectedVariableBar(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority) Creates a new variable barprotectedVariableBar(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new variable barprotectedVariableBar(@NotNull Slot slot, int length, int height, @NotNull Plugin plugin) Creates a new variable bar -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyContents(@NotNull VariableBar copy) Applies the contents of this variable bar onto the provided copy of this variable bar.voidclear()Clears the entire pane of any items/panes.voiddisplay(@NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventoryvoidflipHorizontally(boolean flipHorizontally) Sets whether this pane should flip its items horizontallyvoidflipVertically(boolean flipVertically) Sets whether this pane should flip its items vertically@NotNull Collection<GuiItem> getItems()Gets all the items in this pane and all underlying panes.@NotNull Orientable.OrientationGets the orientation of this outline pane@NotNull Collection<Pane> getPanes()Gets all the panes in this panes, including any child panes from other panes.booleanGets whether this pane's items are flipped horizontallybooleanGets whether this pane's items are flipped verticallyvoidsetBackgroundItem(@NotNull GuiItem item) Sets the background itemvoidsetFillItem(@NotNull GuiItem item) Sets the fill item (foreground)voidsetHeight(int height) Set the height of this panevoidsetLength(int length) Set the length of this panevoidsetOrientation(@NotNull Orientable.Orientation orientation) Sets the orientation of this outline paneprotected voidsetValue(float value) Sets the value of this bar.Methods inherited from class com.github.stefvanschie.inventoryframework.pane.Pane
callOnClick, click, copy, createBorder, createBorder, findMatchingItem, getHeight, getLength, getPriority, getSlot, getUUID, getX, getY, isVisible, load, loadItem, loadItem, matchesItem, registerProperty, setOnClick, setPriority, setSlot, setVisible, setX, setY
-
Field Details
-
fillPane
The green and the red parts of the slider -
backgroundPane
The green and the red parts of the slider -
value
protected float valueThe value this slider is at. This is a value between 0 and 1 (both inclusive). -
orientation
The orientation of the slider -
flipHorizontally
protected boolean flipHorizontallyWhether the pane is flipped horizontally or vertically -
flipVertically
protected boolean flipVerticallyWhether the pane is flipped horizontally or vertically
-
-
Constructor Details
-
VariableBar
Creates a new variable bar- Parameters:
length- the length of the barheight- the height of the barplugin- the plugin that will be the owner for this variable bar's items- Since:
- 0.10.8
- See Also:
-
VariableBar
protected VariableBar(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Plugin plugin) Creates a new variable bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the barpriority- the priority of the barplugin- the plugin that will be the owner for this variable bar's items- Since:
- 0.10.8
- See Also:
-
VariableBar
protected VariableBar(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority, @NotNull @NotNull Plugin plugin) Creates a new variable bar- Parameters:
x- the x coordinate of the bary- the y coordinate of the barlength- the length of the barheight- the height of the barpriority- the priority of the barplugin- the plugin that will be the owner for this variable bar's items- Since:
- 0.10.8
- See Also:
-
VariableBar
protected VariableBar(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Plugin plugin) Creates a new variable bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the barplugin- the plugin that will be the owner for this variable bar's items- Since:
- 0.10.8
- See Also:
-
VariableBar
Creates a new variable bar- Parameters:
x- the x coordinate of the bary- the y coordinate of the barlength- the length of the barheight- the height of the barplugin- the plugin that will be the owner for this variable bar's items- Since:
- 0.10.8
- See Also:
-
VariableBar
protected VariableBar(int length, int height) -
VariableBar
protected VariableBar(@NotNull @NotNull Slot slot, int length, int height, @NotNull @NotNull Pane.Priority priority) Creates a new variable bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the barpriority- the priority of the bar- Since:
- 0.10.8
-
VariableBar
protected VariableBar(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority) -
VariableBar
Creates a new variable bar- Parameters:
slot- the slot of the barlength- the length of the barheight- the height of the bar- Since:
- 0.10.8
-
VariableBar
protected VariableBar(int x, int y, int length, int height)
-
-
Method Details
-
setValue
protected void setValue(float value) Sets the value of this bar. The value has to be in (0,1). If not, this method will throw anIllegalArgumentException.- Parameters:
value- the new value.- Throws:
IllegalArgumentException- when the value is out of range- Since:
- 0.9.5
-
setLength
public void setLength(int length) Description copied from class:PaneSet the length of this pane -
setHeight
public void setHeight(int height) Description copied from class:PaneSet the height of this pane -
applyContents
Applies the contents of this variable bar onto the provided copy of this variable bar. This variable bar will not be modified.- Parameters:
copy- the copy of the variable bar- Since:
- 0.6.2
-
setOrientation
Description copied from interface:OrientableSets the orientation of this outline pane- Specified by:
setOrientationin interfaceOrientable- Parameters:
orientation- the new orientation
-
display
public void display(@NotNull @NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Description copied from class:PaneHas to set all the items in the right spot inside the inventory- Specified by:
displayin classPane- Parameters:
inventoryComponent- the inventory component in which the items should be displayedpaneOffsetX- the pane's offset on the x axispaneOffsetY- the pane's offset on the y axismaxLength- the maximum length of the panemaxHeight- the maximum height of the pane
-
setFillItem
Sets the fill item (foreground)- Parameters:
item- the new item- Since:
- 0.5.0
-
setBackgroundItem
Sets the background item- Parameters:
item- the new item- Since:
- 0.5.0
-
getItems
Description copied from class:PaneGets all the items in this pane and all underlying panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.) -
getPanes
Description copied from class:PaneGets all the panes in this panes, including any child panes from other panes. The returned collection is not guaranteed to be mutable or to be a view of the underlying data. (So changes to the gui are not guaranteed to be visible in the returned value.) -
flipHorizontally
public void flipHorizontally(boolean flipHorizontally) Description copied from interface:FlippableSets whether this pane should flip its items horizontally- Specified by:
flipHorizontallyin interfaceFlippable- Parameters:
flipHorizontally- whether the pane should flip items horizontally
-
flipVertically
public void flipVertically(boolean flipVertically) Description copied from interface:FlippableSets whether this pane should flip its items vertically- Specified by:
flipVerticallyin interfaceFlippable- Parameters:
flipVertically- whether the pane should flip items vertically
-
getOrientation
Description copied from interface:OrientableGets the orientation of this outline pane- Specified by:
getOrientationin interfaceOrientable- Returns:
- the orientation
-
isFlippedHorizontally
public boolean isFlippedHorizontally()Description copied from interface:FlippableGets whether this pane's items are flipped horizontally- Specified by:
isFlippedHorizontallyin interfaceFlippable- Returns:
- true if the items are flipped horizontally, false otherwise
-
isFlippedVertically
public boolean isFlippedVertically()Description copied from interface:FlippableGets whether this pane's items are flipped vertically- Specified by:
isFlippedVerticallyin interfaceFlippable- Returns:
- true if the items are flipped vertically, false otherwise
-
clear
public void clear()Description copied from class:PaneClears the entire pane of any items/panes. Underlying panes will not be cleared.
-