Class Widget

java.lang.Object
hec.map.annotations.Widget
Direct Known Subclasses:
AnnotationWidget

public class Widget extends Object
  • Field Details

    • preferredSize

      protected Dimension preferredSize
    • preferredBounds

      protected Rectangle preferredBounds
    • location

      protected Point2D location
    • bounds

      protected Rectangle bounds
  • Constructor Details

    • Widget

      public Widget()
  • Method Details

    • addChild

      public void addChild(Widget w)
    • getChildren

      public List<Widget> getChildren()
    • getLocation

      public Point2D getLocation()
    • isVisible

      public boolean isVisible()
    • getBounds

      public Rectangle getBounds()
    • resolveBounds

      public final void resolveBounds(Point2D location, Rectangle bounds)
      Sets resolved location and bounds of the widget This method is usually called from implementations of Layout interface.
      Parameters:
      location - the resolved location; if null then [0,0] point is used instead
      bounds - the resolved bounds; if null then the preferred bounds are used instead
    • getChildConstraint

      public final Object getChildConstraint(Widget child)
      Returns constraint assigned to a specified child widget.
      Parameters:
      child - the child widget
      Returns:
      the constraint
    • getPreferredSize

      public final Dimension getPreferredSize()
      Returns a preferred size of the widget.
      Returns:
      the preferred size; if null, then no preferred size are set.
    • getPreferredBounds

      public final Rectangle getPreferredBounds()
      Returns a preferred bounds relatively to the location of the widget. If no preferred bounds are set, then it returns a preferred bounds that are calculated from the calculateClientArea method of this widget and location and bounds of the children widgets. This calculated bounds are processed by the minimum and maximum bounds too.

      This method can be called after child widgets are layed out which is assured in method calls of the Layout interface implementation. If preferred bounds are set (check it using isPreferredBoundsSet method), you can call this method at any time.

      Returns:
      the preferred bounds
    • getClientArea

      public final Rectangle getClientArea()
      Returns a client area of the widget.
      Returns:
      the client area
    • paintWidget

      public void paintWidget(Graphics2D g, MapScale mapScale)