Class PlacementsHolder<T extends PlacementsHolder<T>>

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener, Definable<T>
    Direct Known Subclasses:
    Board, Panel

    public abstract class PlacementsHolder<T extends PlacementsHolder<T>>
    extends AbstractModelObject
    implements Definable<T>, java.beans.PropertyChangeListener
    A PlacementsHolder is an abstraction of an object that has physical 2D extent and contains Placements
    • Field Detail

      • name

        protected java.lang.String name
        The name of this PlacementsHolder
      • dimensions

        protected Location dimensions
        The physical extent of this PlacementsHolder
      • profile

        protected GeometricPath2D profile
        The physical outline of this PlacementsHolder
      • file

        protected transient java.io.File file
      • dirty

        protected transient boolean dirty
    • Constructor Detail

      • PlacementsHolder

        public PlacementsHolder()
        Constructs a new PlacementsHolder
      • PlacementsHolder

        public PlacementsHolder​(PlacementsHolder<T> holderToCopy)
        Constructs a deep copy of the specified PlacementsHolder
        Parameters:
        holderToCopy -
    • Method Detail

      • commit

        protected void commit()
      • dispose

        public void dispose()
        Cleans-up property change listeners associated with this PlacementsHolder
        Overrides:
        dispose in class AbstractModelObject
      • getName

        public java.lang.String getName()
        Returns:
        the name of this PlacementsHolder
      • setName

        public void setName​(java.lang.String name)
        Sets the name of this PlacementsHolder
        Parameters:
        name - - the name to set
      • getDimensions

        public Location getDimensions()
        Returns:
        the dimensions (physical extent) of this PlacementsHolder (contained in the X and Y fields)
      • setDimensions

        public void setDimensions​(Location dimensions)
        Sets the dimensions (physical extent) of this PlacementsHolder (contained in the X and Y fields)
        Parameters:
        dimensions -
      • getProfile

        public GeometricPath2D getProfile()
        Gets the profile (physical outline) of this PlacementsHolder. If no profile has been defined, a rectangle is returned based on the set dimensions.
        Returns:
        - the profile
      • setProfile

        public void setProfile​(GeometricPath2D profile)
        Sets the profile (physical outline) of this PlacementsHolder.
        Parameters:
        profile - - the profile of this PlacementsHolder
      • getPlacements

        public IdentifiableList<Placement> getPlacements()
        Returns:
        a list of placements contained by this PlacementsHolder
      • setPlacements

        public void setPlacements​(IdentifiableList<Placement> placements)
        Sets the list of placements contained by this PlacementsHolder
        Parameters:
        placements - - the list of placements to set
      • getPlacement

        public Placement getPlacement​(int index)
        Gets the specified placement.
        Parameters:
        index - - the index of the placement to get
        Returns:
        the placement
      • setPlacement

        public void setPlacement​(int index,
                                 Placement placement)
        Sets the placement at the specified index
        Parameters:
        index - - the index of the placement to set
        placement - - the placement to set or null to remove the placement at the specified index
      • addPlacement

        public void addPlacement​(Placement placement)
        Adds a placement to the list of placements
        Parameters:
        placement - - the placement to add
      • removePlacement

        public void removePlacement​(Placement placement)
        Removes the specified placement from the list of placements
        Parameters:
        placement - - the placement to remove
      • removePlacement

        public void removePlacement​(int index)
        Removes the placement at the specified index
        Parameters:
        index - - the index of the placement to remove
      • removeAllPlacements

        public void removeAllPlacements()
        Removes all placements
      • getFile

        public java.io.File getFile()
        Gets the file where this PlacementsHolder is stored
        Returns:
      • setFile

        public void setFile​(java.io.File file)
        Sets the file where this PlacementsHolder will be stored
        Parameters:
        file -
      • setDefinition

        public void setDefinition​(T definedBy)
        Description copied from interface: Definable
        Sets the defining object
        Specified by:
        setDefinition in interface Definable<T extends PlacementsHolder<T>>
        Parameters:
        definedBy - - the definition
      • isDefinition

        public boolean isDefinition​(java.lang.Object definedBy)
        Description copied from interface: Definable
        Tests to see if this object is defined by another
        Specified by:
        isDefinition in interface Definable<T extends PlacementsHolder<T>>
        Parameters:
        definedBy - - the other object
        Returns:
      • isDirty

        public boolean isDirty()
        Description copied from interface: Definable
        Checks to see if this object has been modified
        Specified by:
        isDirty in interface Definable<T extends PlacementsHolder<T>>
        Returns:
        true if this PlacementsHolder has been modified
      • setDirty

        public void setDirty​(boolean dirty)
        Sets the state of the dirty flag (used to indicate that this PlacementsHolder has been modified) to the specified value
        Specified by:
        setDirty in interface Definable<T extends PlacementsHolder<T>>
        Parameters:
        dirty - - the state to set the flag