Class Panel

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.util.EventListener, Definable<Panel>

    public class Panel
    extends PlacementsHolder<Panel>
    implements java.beans.PropertyChangeListener
    A Panel is a PlacementsHolder whose main purpose is to hold multiple Board and/or Panel Locations
    • Field Detail

      • LATEST_VERSION

        public static final java.lang.Double LATEST_VERSION
      • id

        @Deprecated
        public java.lang.String id
        Deprecated.
        The Id is now carried by the PanelLocation
      • columns

        @Deprecated
        public java.lang.Integer columns
        Deprecated.
        Panels are no longer define by rows and columns but rather by the location of their children
      • rows

        @Deprecated
        public java.lang.Integer rows
        Deprecated.
        Panels are no longer define by rows and columns but rather by the location of their children
      • xGap

        @Deprecated
        public Length xGap
        Deprecated.
        Panels are no longer define by rows and columns but rather by the location of their children
      • yGap

        @Deprecated
        public Length yGap
        Deprecated.
        Panels are no longer define by rows and columns but rather by the location of their children
      • pseudoPlacementIds

        protected java.util.ArrayList<java.lang.String> pseudoPlacementIds
        A list of Ids that point to placements (fiducials) on the Panel's children that are to be used for panel alignment
      • pseudoPlacements

        protected transient IdentifiableList<Placement> pseudoPlacements
        A list of Placements corresponding to those identified in pseudoPlacementIds. These placements are copies of those on the Panel's children and are only used for panel alignment, i.e, they will never actually be placed.
    • Constructor Detail

      • Panel

        public Panel()
        Default constructor
      • Panel

        public Panel​(java.io.File file)
        Constructs a new Panel
        Parameters:
        file - - the file where this Panel will be stored
      • Panel

        public Panel​(Panel panel)
        Constructs a deep copy of the specified panel
        Parameters:
        panel - - the Panel to copy
    • Method Detail

      • dispose

        public void dispose()
        Removes all the property change listeners associated with this panel. Should be called if this panel instance is no longer needed.
        Overrides:
        dispose in class PlacementsHolder<Panel>
      • getChildren

        public java.util.List<PlacementsHolderLocation<?>> getChildren()
        Returns:
        a list of all the panel's children
      • setChildren

        public void setChildren​(IdentifiableList<PlacementsHolderLocation<?>> children)
        Sets the children of this panel
        Parameters:
        children - - a list of PlacementsHolderLocations that are the children of this panel
      • getChild

        public PlacementsHolderLocation<?> getChild​(int index)
        Gets the specified child of this panel
        Parameters:
        index - - the index of the child
        Returns:
        the child
      • setChild

        public void setChild​(int index,
                             PlacementsHolderLocation<?> child)
        Sets the child at the specified index. This method should only be called from a panel definition's property change listener when an indexed property change event has been fired that adds, modifies, or deletes a child
        Parameters:
        index - - the index of the child to set
        child - - the child to add or modify, set to null to delete the child
        Throws:
        java.lang.UnsupportedOperationException - if called on a panel definition or if the specified child is neither a BoardLocation nor a PanelLocation
      • addChild

        public void addChild​(PlacementsHolderLocation<?> child)
        Adds a child to this panel
        Parameters:
        child - - the child to add
        Throws:
        java.lang.UnsupportedOperationException - if the specified child is neither a BoardLocation nor a PanelLocation
      • removeChild

        public void removeChild​(PlacementsHolderLocation<?> child)
        Removes a child from this panel. This method should only be called on panel definitions.
        Parameters:
        child - - the child to remove
        Throws:
        java.lang.UnsupportedOperationException - if called on a non-panel definition
      • replaceChild

        public void replaceChild​(PlacementsHolderLocation<?> originalChild,
                                 PlacementsHolderLocation<?> newChild)
        Replaces a child of this panel with another. This method should only be called on panel definitions.
        Parameters:
        originalChild - - the child to remove
        newChild - - the child that will replace the original
        Throws:
        java.lang.UnsupportedOperationException - if called on a non-panel definition
      • removeAllChildren

        public void removeAllChildren()
        Removes all children from this panel
      • getPseudoPlacementIds

        public java.util.List<java.lang.String> getPseudoPlacementIds()
        Gets the list of pseudo-placement ids for this panel. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment.
        Returns:
        - the list of pseudo-placement ids
      • setPseudoPlacementIds

        public void setPseudoPlacementIds​(java.util.ArrayList<java.lang.String> pseudoPlacementIds)
        Sets the list of pseudo-placement ids for this panel. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment.
        Parameters:
        pseudoPlacementIds - - the list of pseudo-placement ids
      • getPseudoPlacements

        public java.util.List<Placement> getPseudoPlacements()
        Gets the list of pseudo-placements for this panel. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment.
        Returns:
        - the list of pseudo-placements
      • setPseudoPlacements

        public void setPseudoPlacements​(IdentifiableList<Placement> pseudoPlacements)
        Sets the list of pseudo-placements for this panel. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment.
        Parameters:
        pseudoPlacements - - the list of pseudo-placements
      • getPseudoPlacement

        public Placement getPseudoPlacement​(int index)
        Gets the specified pseudo-placement. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment.
        Parameters:
        index - - specifies the pseudo-placement to get
        Returns:
        the pseudo-placement
      • setPseudoPlacement

        public void setPseudoPlacement​(int index,
                                       Placement pseudoPlacement)
        Sets the pseudo-placement at the specified index. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment. This method should only be called from a panel definition's property change listener when an indexed property change event has been fired that adds, modifies, or deletes a pseudo-placement.
        Parameters:
        index - - the index of the pseudo-placement to set
        pseudoPlacement - - the pseudo-placement to add or modify, set to null to delete the pseudo-placement
        Throws:
        java.lang.UnsupportedOperationException - if called on a panel definition
      • addPseudoPlacement

        public void addPseudoPlacement​(Placement pseudoPlacement)
        Adds a pseudo-placement to the panel. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment. This method should only be called on panel definitions.
        Parameters:
        pseudoPlacement - - the pseudo-placement to add
        Throws:
        java.lang.UnsupportedOperationException - if called on a non-panel definition
      • removePseudoPlacement

        public void removePseudoPlacement​(Placement pseudoPlacement)
        Removes a pseudo-placement from the panel. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment. This method should only be called on panel definitions.
        Parameters:
        pseudoPlacement - - the pseudo-placement to remove
        Throws:
        java.lang.UnsupportedOperationException - if called on a non-panel definition
      • createPseudoPlacement

        public Placement createPseudoPlacement​(java.lang.String pseudoPlacementId)
                                        throws java.lang.Exception
        Creates a pseudo-placement given the pseudo-placement's id. A pseudo-placement is a copy of a placement or fiducial located on one of the panel's descendants that is only used for panel alignment. This method should only be called on panel definitions.
        Parameters:
        pseudoPlacementId - - the id of the pseudo-placement to create
        Returns:
        - the pseudo-placement
        Throws:
        java.lang.Exception - if pseudoPlacementId is invalid
        java.lang.UnsupportedOperationException - if called on a non-panel definition
      • getDescendantPlacementUniqueId

        public java.lang.String getDescendantPlacementUniqueId​(PlacementsHolderLocation<?> placementsParentLocation,
                                                               Placement placement)
        Gets a unique Id for a placement based on its location in the panel's family hierarchy
        Parameters:
        placementsParentLocation - - the placement's parent PlacementsHolderLocation
        placement - - the placement
        Returns:
        - the unique Id
      • getDescendantPlacement

        public Pair<java.util.List<PlacementsHolderLocation<?>>,​Placement> getDescendantPlacement​(java.lang.String placementUniqueId)
        Gets a placement's parent PlacementsHolderLocation and the placement itself given the placement's unique Id. Essentially the inverse of getDescendantPlacementUniqueId
        Parameters:
        placementUniqueId - - the placement's unique Id
        Returns:
        - the placement's parent along with the actual placement
      • isDefinitionUsed

        public boolean isDefinitionUsed​(PlacementsHolder<?> placementsHolder)
        Checks to see if the definition of a placementsHolder is the definition of this panel or or any of its descendants
        Parameters:
        placementsHolder - - the placementsHolder to check
        Returns:
        - true if the definition of placementsHolder is the definition of this panel or or any of its descendants
      • getDescendants

        public java.util.List<PlacementsHolderLocation<?>> getDescendants()
        Returns a flattened list of all descendants of this panel
        Returns:
        - the list of all descendants
      • getDescendantBoardLocations

        public java.util.List<BoardLocation> getDescendantBoardLocations()
        Returns a flattened list of all BoardLocations that are descendants of this panel
        Returns:
        - the list of all BoardLocations
      • getDescendantPanelLocations

        public java.util.List<PanelLocation> getDescendantPanelLocations()
        Returns a flattened list of all PanelLocations that are descendants of this panel
        Returns:
        - the list of all PanelLocations
      • isCheckFiducials

        public boolean isCheckFiducials()
        Returns:
        true if fiducials should be used to align this panel during a job
      • getVersion

        public java.lang.Double getVersion()
        Returns:
        the version number of this panel
      • getInstanceCount

        public int getInstanceCount​(PlacementsHolder<?> placementsHolder)
        Counts the number of instances of a specified PlacementsHolder that occur within the panel's family hierarchy
        Parameters:
        placementsHolder - - the PlacementsHolder to count
        Returns:
        the count
      • isMember

        public boolean isMember​(PlacementsHolder<?> placementsHolder)
        Checks whether the specified PlacementsHolder is a member of this Panel's family hierarchy
        Parameters:
        placementsHolder - - the PlacementsHolder to check
        Returns:
        true if it is a member
      • toString

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