java.lang.Object
me.despical.inventoryframework.pane.Pane
me.despical.inventoryframework.pane.component.util.VariableBar
All Implemented Interfaces:
Flippable, Orientable
Direct Known Subclasses:
PercentageBar, Slider

public abstract class VariableBar extends Pane implements Orientable, Flippable
A variable bar for UI elements that require some sort of bar
Since:
1.0.1

Created at 04.09.2020

Author:
Despical
  • Field Details

    • fillPane

      @NotNull protected final @NotNull OutlinePane fillPane
      The green and the red parts of the slider
    • backgroundPane

      @NotNull protected final @NotNull OutlinePane backgroundPane
      The green and the red parts of the slider
    • value

      protected float value
      The value this slider is at. This is a value between 0 and 1 (both inclusive).
    • orientation

      @NotNull protected @NotNull Orientable.Orientation orientation
      The orientation of the slider
    • flipHorizontally

      protected boolean flipHorizontally
      Whether the pane is flipped horizontally or vertically
    • flipVertically

      protected boolean flipVertically
      Whether the pane is flipped horizontally or vertically
  • Constructor Details

    • VariableBar

      protected VariableBar(int length, int height)
    • VariableBar

      protected VariableBar(int x, int y, int length, int height, @NotNull @NotNull Pane.Priority priority)
    • VariableBar

      protected VariableBar(int x, int y, int length, int height)
  • Method Details

    • setLength

      public void setLength(int length)
      Description copied from class: Pane
      Set the length of this pane
      Overrides:
      setLength in class Pane
      Parameters:
      length - the new length
    • setHeight

      public void setHeight(int height)
      Description copied from class: Pane
      Set the height of this pane
      Overrides:
      setHeight in class Pane
      Parameters:
      height - the new height
    • display

      public void display(@NotNull @NotNull Gui gui, @NotNull @NotNull org.bukkit.inventory.Inventory inventory, @NotNull @NotNull org.bukkit.inventory.PlayerInventory playerInventory, 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 class Pane
      Parameters:
      gui - the gui for which we're rendering
      inventory - the inventory that the items should be displayed in
      playerInventory - the player's inventory
      paneOffsetX - the pane's offset on the x axis
      paneOffsetY - the pane's offset on the y axis
      maxLength - the maximum length of the pane
      maxHeight - the maximum height of the pane
    • setX

      public void setX(int x)
      Description copied from class: Pane
      Set the x coordinate of this pane
      Overrides:
      setX in class Pane
      Parameters:
      x - the new x coordinate
    • setY

      public void setY(int y)
      Description copied from class: Pane
      Set the y coordinate of this pane
      Overrides:
      setY in class Pane
      Parameters:
      y - the new y coordinate
    • setFillItem

      public void setFillItem(@NotNull @NotNull GuiItem item)
      Sets the fill item (foreground)
      Parameters:
      item - the new item
      Since:
      1.0.1
    • setBackgroundItem

      public void setBackgroundItem(@NotNull @NotNull GuiItem item)
      Sets the background item
      Parameters:
      item - the new item
      Since:
      1.0.1
    • getItems

      @NotNull public @NotNull Collection<GuiItem> 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.)
      Specified by:
      getItems in class Pane
      Returns:
      all items
    • getPanes

      @NotNull public @NotNull Collection<Pane> 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.)
      Specified by:
      getPanes in class Pane
      Returns:
      all panes
    • flipHorizontally

      public void flipHorizontally(boolean flipHorizontally)
      Description copied from interface: Flippable
      Sets whether this pane should flip its items horizontally
      Specified by:
      flipHorizontally in interface Flippable
      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 interface Flippable
      Parameters:
      flipVertically - whether the pane should flip items vertically
    • getOrientation

      @NotNull public @NotNull Orientable.Orientation getOrientation()
      Description copied from interface: Orientable
      Gets the orientation of this outline pane
      Specified by:
      getOrientation in interface Orientable
      Returns:
      the orientation
    • setOrientation

      public void setOrientation(@NotNull @NotNull Orientable.Orientation orientation)
      Description copied from interface: Orientable
      Sets the orientation of this outline pane
      Specified by:
      setOrientation in interface Orientable
      Parameters:
      orientation - the new orientation
    • isFlippedHorizontally

      public boolean isFlippedHorizontally()
      Description copied from interface: Flippable
      Gets whether this pane's items are flipped horizontally
      Specified by:
      isFlippedHorizontally in interface Flippable
      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 interface Flippable
      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.
      Specified by:
      clear in class Pane