Class WidgetItem


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

      Constructors 
      Constructor Description
      WidgetItem​(int id, int quantity, int index, java.awt.Rectangle canvasBounds, Widget widget, java.awt.Rectangle draggingCanvasBounds)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.Rectangle getCanvasBounds()
      Get the area where the widget item is drawn on the canvas, accounting for drag
      java.awt.Rectangle getCanvasBounds​(boolean dragging)
      Get the area where the widget item is drawn on the canvas
      Point getCanvasLocation()
      Gets the upper-left coordinate of where the widget is being drawn on the canvas, accounting for drag.
      java.awt.Rectangle getDraggingCanvasBounds()
      The canvas bounds for the widget, if it is being dragged.
      int getId()
      The ID of the item represented.
      int getIndex()
      The index position of this WidgetItem inside its parents WidgetItem array.
      int getQuantity()
      The quantity of the represented item.
      Widget getWidget()
      The widget which contains this item.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WidgetItem

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

      • getCanvasBounds

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

        public java.awt.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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getId

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

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

        public int getIndex()
        The index position of this WidgetItem inside its parents WidgetItem array.
        See Also:
        Widget.getWidgetItems()
      • getWidget

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

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