All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class PinBoard extends Control
A JavaFX component where items can be pinned at a position.
  • Property Details

  • Constructor Details

    • PinBoard

      public PinBoard()
      Default constructor.
  • Method Details

    • setHbarPolicy

      public void setHbarPolicy(ScrollPane.ScrollBarPolicy policy)
      Sets the horizontal scrollbar policy of the PinBoardSkin's ScrollPane.
      Parameters:
      policy - the scrollbar policy to set
    • setVbarPolicy

      public void setVbarPolicy(ScrollPane.ScrollBarPolicy policy)
      Sets the vertical scrollbar policy of the PinBoardSkin's ScrollPane.
      Parameters:
      policy - the ScrollBarPolicy to set
    • clear

      public void clear()
      Clears the PinBoard by removing all items and resetting the area property. This method must be called from the JavaFX Application Thread.
    • refresh

      public void refresh()
      Refreshes the PinBoard skin.

      This method is used to refresh the visual representation of the PinBoard. It checks if the skin associated with the PinBoard is an instance of PinBoardSkin and then calls the PinBoardSkin.refresh() method to update the nodes displayed on the board.

    • dispose

      public void dispose()
      Disposes the PinBoardSkin instance. Stops the refresher and disposes the superclass.
    • createDefaultSkin

      protected Skin<PinBoard> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Control
    • areaProperty

      public ReadOnlyObjectProperty<Rectangle2D> areaProperty()
      Returns the read-only property that represents the area of the PinBoard.
      See Also:
    • getItems

      public ObservableList<PinBoard.Item> getItems()
      Returns an unmodifiable observable list of items.
      Returns:
      An unmodifiable observable list of items.
    • getScrollPosition

      public com.dua3.utility.data.Pair<Double,Double> getScrollPosition()
      Retrieves the current scroll position of the PinBoard.
      Returns:
      a Pair containing the horizontal and vertical scroll positions
    • setScrollPosition

      public void setScrollPosition(double hValue, double vValue)
      Sets the scroll position of the PinBoardSkin's ScrollPane.
      Parameters:
      hValue - the horizontal scroll value to set
      vValue - the vertical scroll value to set
    • setScrollPosition

      public void setScrollPosition(com.dua3.utility.data.Pair<Double,Double> scrollPosition)
      Sets the scroll position of the PinBoardSkin's ScrollPane.
      Parameters:
      scrollPosition - a Pair containing the horizontal and vertical scroll positions
    • scrollTo

      public void scrollTo(PinBoard.PositionInItem pos)
      Scrolls the PinBoard to the specified position within an item.
      Parameters:
      pos - the position within an item to scroll to
    • getItemAt

      public Optional<PinBoard.Item> getItemAt(double x, double y)
      Get Item at point.
      Parameters:
      x - x-coordinate (relative to viewport)
      y - y-coordinate (relative to viewport)
      Returns:
      Optional containing the item at (x,y)
    • getPositionInItem

      public Optional<PinBoard.PositionInItem> getPositionInItem(double x, double y)
      Get Item at point and coordinates transformed to item coordinates.
      Parameters:
      x - x-coordinate (relative to viewport)
      y - y-coordinate (relative to viewport)
      Returns:
      Optional containing the item and the transformed coordinates
    • pinBottom

      public void pinBottom(String name, Supplier<Node> nodeSupplier, Dimension2D dimension)
      Add item at the bottom, centered horizontally.
      Parameters:
      name - item name
      nodeSupplier - supplier (factory) for item node
      dimension - item dimension
    • getArea

      public Rectangle2D getArea()
      Returns the area of the PinBoard.
      Returns:
      The Rectangle2D representing the area of the PinBoard.
    • pin

      public void pin(PinBoard.Item item)
      Pins the given item or collection of items to the PinBoard.
      Parameters:
      item - The item to be pinned. Can be a single item or a collection of items to be pinned together.
    • pin

      public void pin(Collection<PinBoard.Item> itemsToPin)
      Pins the given collection of items to the PinBoard.
      Parameters:
      itemsToPin - The collection of items to be pinned.
    • toString

      public String toString()
      Overrides:
      toString in class Node