Package org.openpnp.model
Class PlacementsHolder<T extends PlacementsHolder<T>>
- java.lang.Object
-
- org.openpnp.model.AbstractModelObject
-
- org.openpnp.model.PlacementsHolder<T>
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,Definable<T>
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 Summary
Fields Modifier and Type Field Description protected Tdefinitionprotected LocationdimensionsThe physical extent of this PlacementsHolderprotected booleandirtyprotected java.io.Filefileprotected java.lang.StringnameThe name of this PlacementsHolderprotected IdentifiableList<Placement>placementsThe list of Placements contained by this PlacementsHolderprotected GeometricPath2DprofileThe physical outline of this PlacementsHolder-
Fields inherited from class org.openpnp.model.AbstractModelObject
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description PlacementsHolder()Constructs a new PlacementsHolderPlacementsHolder(PlacementsHolder<T> holderToCopy)Constructs a deep copy of the specified PlacementsHolder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPlacement(Placement placement)Adds a placement to the list of placementsprotected voidcommit()voiddispose()Cleans-up property change listeners associated with this PlacementsHolderTgetDefinition()LocationgetDimensions()java.io.FilegetFile()Gets the file where this PlacementsHolder is storedjava.lang.StringgetName()PlacementgetPlacement(int index)Gets the specified placement.IdentifiableList<Placement>getPlacements()GeometricPath2DgetProfile()Gets the profile (physical outline) of this PlacementsHolder.booleanisDefinition(java.lang.Object definedBy)Tests to see if this object is defined by anotherbooleanisDirty()Checks to see if this object has been modifiedvoidremoveAllPlacements()Removes all placementsvoidremovePlacement(int index)Removes the placement at the specified indexvoidremovePlacement(Placement placement)Removes the specified placement from the list of placementsvoidsetDefinition(T definedBy)Sets the defining objectvoidsetDimensions(Location dimensions)Sets the dimensions (physical extent) of this PlacementsHolder (contained in the X and Y fields)voidsetDirty(boolean dirty)Sets the state of the dirty flag (used to indicate that this PlacementsHolder has been modified) to the specified valuevoidsetFile(java.io.File file)Sets the file where this PlacementsHolder will be storedvoidsetName(java.lang.String name)Sets the name of this PlacementsHoldervoidsetPlacement(int index, Placement placement)Sets the placement at the specified indexvoidsetPlacements(IdentifiableList<Placement> placements)Sets the list of placements contained by this PlacementsHoldervoidsetProfile(GeometricPath2D profile)Sets the profile (physical outline) of this PlacementsHolder.-
Methods inherited from class org.openpnp.model.AbstractModelObject
addPropertyChangeListener, addPropertyChangeListener, dumpListeners, fireIndexedPropertyChange, firePropertyChange, isListener, isListener, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openpnp.spi.Definable
propertyChange
-
-
-
-
Field Detail
-
name
protected java.lang.String name
The name of this PlacementsHolder
-
dimensions
protected Location dimensions
The physical extent of this PlacementsHolder
-
placements
protected IdentifiableList<Placement> placements
The list of Placements contained by this PlacementsHolder
-
profile
protected GeometricPath2D profile
The physical outline of this PlacementsHolder
-
definition
protected transient T extends PlacementsHolder<T> definition
-
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:
disposein classAbstractModelObject
-
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 setplacement- - 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-
-
getDefinition
public T getDefinition()
- Specified by:
getDefinitionin interfaceDefinable<T extends PlacementsHolder<T>>- Returns:
- the defining object
-
setDefinition
public void setDefinition(T definedBy)
Description copied from interface:DefinableSets the defining object- Specified by:
setDefinitionin interfaceDefinable<T extends PlacementsHolder<T>>- Parameters:
definedBy- - the definition
-
isDefinition
public boolean isDefinition(java.lang.Object definedBy)
Description copied from interface:DefinableTests to see if this object is defined by another- Specified by:
isDefinitionin interfaceDefinable<T extends PlacementsHolder<T>>- Parameters:
definedBy- - the other object- Returns:
-
isDirty
public boolean isDirty()
Description copied from interface:DefinableChecks to see if this object has been modified- Specified by:
isDirtyin interfaceDefinable<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:
setDirtyin interfaceDefinable<T extends PlacementsHolder<T>>- Parameters:
dirty- - the state to set the flag
-
-