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 T
definition
protected Location
dimensions
The physical extent of this PlacementsHolderprotected boolean
dirty
protected java.io.File
file
protected java.lang.String
name
The name of this PlacementsHolderprotected IdentifiableList<Placement>
placements
The list of Placements contained by this PlacementsHolderprotected GeometricPath2D
profile
The 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 void
addPlacement(Placement placement)
Adds a placement to the list of placementsprotected void
commit()
void
dispose()
Cleans-up property change listeners associated with this PlacementsHolderT
getDefinition()
Location
getDimensions()
java.io.File
getFile()
Gets the file where this PlacementsHolder is storedjava.lang.String
getName()
Placement
getPlacement(int index)
Gets the specified placement.IdentifiableList<Placement>
getPlacements()
GeometricPath2D
getProfile()
Gets the profile (physical outline) of this PlacementsHolder.boolean
isDefinition(java.lang.Object definedBy)
Tests to see if this object is defined by anotherboolean
isDirty()
Checks to see if this object has been modifiedvoid
removeAllPlacements()
Removes all placementsvoid
removePlacement(int index)
Removes the placement at the specified indexvoid
removePlacement(Placement placement)
Removes the specified placement from the list of placementsvoid
setDefinition(T definedBy)
Sets the defining objectvoid
setDimensions(Location dimensions)
Sets the dimensions (physical extent) of this PlacementsHolder (contained in the X and Y fields)void
setDirty(boolean dirty)
Sets the state of the dirty flag (used to indicate that this PlacementsHolder has been modified) to the specified valuevoid
setFile(java.io.File file)
Sets the file where this PlacementsHolder will be storedvoid
setName(java.lang.String name)
Sets the name of this PlacementsHoldervoid
setPlacement(int index, Placement placement)
Sets the placement at the specified indexvoid
setPlacements(IdentifiableList<Placement> placements)
Sets the list of placements contained by this PlacementsHoldervoid
setProfile(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:
dispose
in 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:
getDefinition
in interfaceDefinable<T extends PlacementsHolder<T>>
- Returns:
- the defining object
-
setDefinition
public void setDefinition(T definedBy)
Description copied from interface:Definable
Sets the defining object- Specified by:
setDefinition
in interfaceDefinable<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 interfaceDefinable<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 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:
setDirty
in interfaceDefinable<T extends PlacementsHolder<T>>
- Parameters:
dirty
- - the state to set the flag
-
-