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.Priority
Nested classes/interfaces inherited from interface com.github.stefvanschie.inventoryframework.pane.Orientable
Orientable.Orientation
-
Field Summary
Modifier and TypeFieldDescriptionprotected final @NotNull OutlinePane
The green and the red parts of the sliderprotected final @NotNull OutlinePane
The green and the red parts of the sliderprotected boolean
Whether the pane is flipped horizontally or verticallyprotected boolean
Whether the pane is flipped horizontally or verticallyprotected @NotNull Orientable.Orientation
The orientation of the sliderprotected float
The value this slider is at. -
Constructor Summary
ModifierConstructorDescriptionprotected
VariableBar
(int length, int height) protected
VariableBar
(int x, int y, int length, int height) protected
VariableBar
(int x, int y, int length, int height, @NotNull Pane.Priority priority) protected
VariableBar
(int x, int y, int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new variable barprotected
VariableBar
(int x, int y, int length, int height, @NotNull Plugin plugin) Creates a new variable barprotected
VariableBar
(int length, int height, @NotNull Plugin plugin) Creates a new variable barprotected
VariableBar
(@NotNull Slot slot, int length, int height) Creates a new variable barprotected
VariableBar
(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority) Creates a new variable barprotected
VariableBar
(@NotNull Slot slot, int length, int height, @NotNull Pane.Priority priority, @NotNull Plugin plugin) Creates a new variable barprotected
VariableBar
(@NotNull Slot slot, int length, int height, @NotNull Plugin plugin) Creates a new variable bar -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyContents
(@NotNull VariableBar copy) Applies the contents of this variable bar onto the provided copy of this variable bar.void
clear()
Clears the entire pane of any items/panes.void
display
(@NotNull InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) Has to set all the items in the right spot inside the inventoryvoid
flipHorizontally
(boolean flipHorizontally) Sets whether this pane should flip its items horizontallyvoid
flipVertically
(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.Orientation
Gets the orientation of this outline pane@NotNull Collection
<Pane> getPanes()
Gets all the panes in this panes, including any child panes from other panes.boolean
Gets whether this pane's items are flipped horizontallyboolean
Gets whether this pane's items are flipped verticallyvoid
setBackgroundItem
(@NotNull GuiItem item) Sets the background itemvoid
setFillItem
(@NotNull GuiItem item) Sets the fill item (foreground)void
setHeight
(int height) Set the height of this panevoid
setLength
(int length) Set the length of this panevoid
setOrientation
(@NotNull Orientable.Orientation orientation) Sets the orientation of this outline paneprotected void
setValue
(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:Pane
Set the length of this pane -
setHeight
public void setHeight(int height) Description copied from class:Pane
Set 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:Orientable
Sets the orientation of this outline pane- Specified by:
setOrientation
in 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:Pane
Has to set all the items in the right spot inside the inventory- Specified by:
display
in 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:Pane
Gets 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:Pane
Gets 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:Flippable
Sets whether this pane should flip its items horizontally- Specified by:
flipHorizontally
in interfaceFlippable
- Parameters:
flipHorizontally
- whether the pane should flip items horizontally
-
flipVertically
public void flipVertically(boolean flipVertically) Description copied from interface:Flippable
Sets whether this pane should flip its items vertically- Specified by:
flipVertically
in interfaceFlippable
- Parameters:
flipVertically
- whether the pane should flip items vertically
-
getOrientation
Description copied from interface:Orientable
Gets the orientation of this outline pane- Specified by:
getOrientation
in interfaceOrientable
- Returns:
- the orientation
-
isFlippedHorizontally
public boolean isFlippedHorizontally()Description copied from interface:Flippable
Gets whether this pane's items are flipped horizontally- Specified by:
isFlippedHorizontally
in interfaceFlippable
- Returns:
- true if the items are flipped horizontally, false otherwise
-
isFlippedVertically
public boolean isFlippedVertically()Description copied from interface:Flippable
Gets whether this pane's items are flipped vertically- Specified by:
isFlippedVertically
in interfaceFlippable
- Returns:
- true if the items are flipped vertically, false otherwise
-
clear
public void clear()Description copied from class:Pane
Clears the entire pane of any items/panes. Underlying panes will not be cleared.
-