public class PositionList extends java.lang.Object implements java.lang.Iterable<MultiStagePosition>
| Modifier and Type | Class and Description |
|---|---|
static class |
PositionList.PosListIterator
Provides an iterator for a PositionList.
|
| Constructor and Description |
|---|
PositionList()
Constructor of navigation list of positions for the Stages.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(javax.swing.event.ChangeListener listener)
Adds a changeListener to this PositionList.
|
void |
addPosition(int in0,
MultiStagePosition pos)
Insert a position into the list.
|
void |
addPosition(MultiStagePosition pos)
Adds a new position to the list.
|
void |
clearAllPositions()
Empties the list.
|
java.lang.String |
generateLabel()
Helper method to generate unique label when inserting a new position.
|
java.lang.String |
generateLabel(java.lang.String proposal)
Generates a label for a new Position.
|
int |
getNumberOfPositions()
Returns the number of positions contained within the list.
|
MultiStagePosition |
getPosition(int idx)
Returns multi-stage position associated with the position index.
|
MultiStagePosition |
getPositionCopy(int idx)
Returns a copy of the multi-stage position associated with the position index.
|
int |
getPositionIndex(java.lang.String posLabel)
Returns position index associated with the position name.
|
MultiStagePosition[] |
getPositions()
Returns an array of positions contained in the list.
|
boolean |
isLabelUnique(java.lang.String label)
Verify that the new label is unique.
|
java.util.Iterator<MultiStagePosition> |
iterator() |
void |
load(java.io.File file)
Load position list from a file.
|
void |
load(java.lang.String path)
Load position list from a file.
|
static PositionList |
newInstance(PositionList aPl)
This looks like a static copy constructor.
|
void |
notifyChangeListeners()
Notifies all changeListeners to the list that something changed.
|
void |
removeChangeListener(javax.swing.event.ChangeListener listener)
Removes the given listener.
|
void |
removePosition(int idx)
Removes a specific position based on the index.
|
void |
replacePosition(int index,
MultiStagePosition pos)
Replaces position in the list with the new position.
|
void |
replaceWithPropertyMap(PropertyMap map)
replaces the content of this PositionList with the content of the given PropertyMap.
|
void |
save(java.io.File file)
Save list to a file.
|
void |
save(java.lang.String path)
Save list to a file.
|
void |
setLabel(int idx,
java.lang.String label)
Assigns a label to the position index.
|
void |
setPositions(MultiStagePosition[] posArray)
Initialize the entire array by passing an array of multi-stage positions.
|
PropertyMap |
toPropertyMap()
Creates a PropertyMap from this PositionList.
|
public PositionList()
public static PositionList newInstance(PositionList aPl)
aPl - input positionlistpublic void addChangeListener(javax.swing.event.ChangeListener listener)
listener - Will fire when the list changespublic void removeChangeListener(javax.swing.event.ChangeListener listener)
listener - Removes the specified listener.public void notifyChangeListeners()
public MultiStagePosition getPosition(int idx)
idx - - position indexpublic MultiStagePosition getPositionCopy(int idx)
idx - - position indexpublic int getPositionIndex(java.lang.String posLabel)
posLabel - - label (name) of the positionpublic void addPosition(MultiStagePosition pos)
pos - - multi-stage positionpublic void addPosition(int in0,
MultiStagePosition pos)
in0 - - place in the list where the position should be insertedpos - - multi-stage positionpublic void replacePosition(int index,
MultiStagePosition pos)
index - index of the position to be replacedpos - - multi-stage positionpublic int getNumberOfPositions()
public void clearAllPositions()
public void removePosition(int idx)
idx - - position indexpublic void setPositions(MultiStagePosition[] posArray)
posArray - - array of multi-stage positionspublic MultiStagePosition[] getPositions()
public void setLabel(int idx,
java.lang.String label)
idx - - position indexlabel - - new label (name)public PropertyMap toPropertyMap()
public void replaceWithPropertyMap(PropertyMap map) throws java.io.IOException
map - PropertyMap whose content will replace this PositionListjava.io.IOException - appears to be never thrown. TODO: Remove?public java.lang.String generateLabel()
public java.lang.String generateLabel(java.lang.String proposal)
proposal - user-supplied suggestionpublic boolean isLabelUnique(java.lang.String label)
label - - proposed labelpublic void save(java.io.File file)
throws java.io.IOException
file - destination; recommended suffix is ".json".java.io.IOException - can happen while saving to diskpublic void save(java.lang.String path)
throws java.io.IOException
path - destination; recommended suffix is ".json".java.io.IOException - can happen while saving to diskpublic void load(java.io.File file)
throws java.io.IOException
file - source JSON file, usually ".txt" or ".json".java.io.IOException - can happen while saving to diskpublic void load(java.lang.String path)
throws java.io.IOException
path - source JSON file, usually ".txt" or ".json".java.io.IOException - can happen while reading from diskpublic java.util.Iterator<MultiStagePosition> iterator()
iterator in interface java.lang.Iterable<MultiStagePosition>