Package snap.view

Class ShapeView

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
CloseBox

public class ShapeView extends View
A View subclass to render shapes.
  • Field Details

  • Constructor Details

    • ShapeView

      public ShapeView()
      Constructor.
    • ShapeView

      public ShapeView(Shape aShape)
      Constructor.
  • Method Details

    • getShape

      public Shape getShape()
      Returns the shape.
    • setShape

      public void setShape(Shape aShape)
      Sets the shape.
    • isFillWidth

      public boolean isFillWidth()
      Returns whether to fit shape width to view width.
    • setFillWidth

      public void setFillWidth(boolean aValue)
      Sets whether to fill shape width to view width.
    • isFillHeight

      public boolean isFillHeight()
      Returns whether to fit shape height to view height.
    • setFillHeight

      public void setFillHeight(boolean aValue)
      Sets whether to fill shape height to view height.
    • isFillSize

      public boolean isFillSize()
      Returns whether to fit shape to view bounds.
    • setFillSize

      public void setFillSize(boolean aValue)
      Sets whether to fill shape to view bounds.
    • sizeToShape

      public void sizeToShape()
      Resizes view to shape size.
    • getBoundsShape

      public Shape getBoundsShape()
      Override to return path as bounds shape.
      Overrides:
      getBoundsShape in class View
    • getPrefWidthImpl

      protected double getPrefWidthImpl(double aH)
      Calculates the preferred width.
      Overrides:
      getPrefWidthImpl in class View
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Calculates the preferred height.
      Overrides:
      getPrefHeightImpl in class View
    • toXML

      public XMLElement toXML(XMLArchiver anArchiver)
      XML archival.
      Specified by:
      toXML in interface XMLArchiver.Archivable
      Overrides:
      toXML in class View
    • fromXML

      public Object fromXML(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Specified by:
      fromXML in interface XMLArchiver.Archivable
      Overrides:
      fromXML in class View