Class WidgetItem


  • public class WidgetItem
    extends Object
    An item that is being represented in a Widget.
    • Constructor Detail

      • WidgetItem

        public WidgetItem​(int id,
                          int quantity,
                          Rectangle canvasBounds,
                          Widget widget,
                          @Nullable
                          Rectangle draggingCanvasBounds)
    • Method Detail

      • getCanvasBounds

        public Rectangle getCanvasBounds()
        Get the area where the widget item is drawn on the canvas, accounting for drag
        Returns:
      • getCanvasBounds

        public Rectangle getCanvasBounds​(boolean dragging)
        Get the area where the widget item is drawn on the canvas
        Parameters:
        dragging - whether the returned area should account for widget drag
        Returns:
      • getCanvasLocation

        public Point getCanvasLocation()
        Gets the upper-left coordinate of where the widget is being drawn on the canvas, accounting for drag.
        Returns:
        the upper-left coordinate of where this widget is drawn
      • getId

        public int getId()
        The ID of the item represented.
        See Also:
        ItemID
      • getQuantity

        public int getQuantity()
        The quantity of the represented item.
      • getWidget

        public Widget getWidget()
        The widget which contains this item.
      • getDraggingCanvasBounds

        @Nullable
        public Rectangle getDraggingCanvasBounds()
        The canvas bounds for the widget, if it is being dragged.