apollo.gui
Class Selection

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by apollo.util.FeatureList
                  extended by apollo.gui.Selection
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class Selection
extends FeatureList

Manages a selection of objects(a vector of SelectionItems), and for SelectableI's controls their selection state. A Selection may have both parent and child. getSelectionDescendedFromModel(SeqFeat,true) will filter out parent child redundnancies. This is used in AnnotationEditor

See Also:
Serialized Form

Field Summary
static int FEATURE
           
static int SET
           
 
Fields inherited from class apollo.util.FeatureList
logger
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Selection()
          Vector of SeqFeatureI data of SelectionItems, for convenience
Selection(FeatureList feats, java.lang.Object source)
           
 
Method Summary
 void add(FeatureList feats, java.lang.Object source)
           
 void add(FeatureList feats, java.lang.Object source, boolean deselectIfAlreadySelected)
           
 void add(Selection selection)
           
 void add(Selection selection, boolean deselectIfAlreadySelected)
           
 void add(SelectionItem item)
          I took out the boolean force, add is always an add and if its already it does nothing, in other words have it always be force == true, i dont think force==false was used at all Took out the return value of SelectionItem - dont think it was used.
 void add(SelectionItem item, boolean deselectIfAlreadySelected)
           
 void clear()
          This does deselection.
 boolean containsFeature(SeqFeatureI sf)
          Returns true if there is a SelectionItem in Selection with sf
 FeatureList getListDescendedFromModel(SeqFeatureI model, boolean check)
           
 java.util.Vector getSelected()
          Vector of SelectionItems
 FeatureList getSelectedData()
          Returns vector of selection items data of selection (SeqFeatureI's) change this to return FeatureList
 SeqFeatureI getSelectedData(int i)
          The data of the selection items is a SeqFeatureI, model not drawable
 java.util.Vector getSelectedVector()
           
 java.util.HashSet getSelectedVisualTypes()
          Returns a HashSet of Strings that is the unique set of visual types for the selection.
 Selection getSelectionDescendedFromModel(SeqFeatureI model)
          Return a sub-Selection of the current Selection that are descendants of SeqFeatureI model.
 Selection getSelectionDescendedFromModel(SeqFeatureI model, boolean checkForRedundantDescendants)
          Return a sub-Selection of the current Selection that are descendants of SeqFeatureI model.
 SelectionItem getSelectionItem(int i)
           
 SelectionItem getSelectionItem(SeqFeatureI sf)
           
 void removeFeature(SeqFeatureI feat)
           
 int size()
           
 
Methods inherited from class apollo.util.FeatureList
add, addAlignable, addAll, addAllFeatures, addFeature, addFeaturePair, addVector, cloneList, featureIterator, filterForFeaturePairs, first, getAlignable, getAllFeaturePairLeaves, getAllLeaves, getConsolidatedFeatures, getFeatsWithAlignments, getFeatsWithinRefSeqRegion, getFeature, getFeaturePair, getFeatWithName, getParents, getRangeOfWholeList, getUniqueHitNames, last, setAlignablesOnly, setDoUniqueCheck, setFeaturePairsOnly, sortByStart, toVector
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

FEATURE

public static final int FEATURE
See Also:
Constant Field Values

SET

public static final int SET
See Also:
Constant Field Values
Constructor Detail

Selection

public Selection()
Vector of SeqFeatureI data of SelectionItems, for convenience


Selection

public Selection(FeatureList feats,
                 java.lang.Object source)
Method Detail

add

public void add(SelectionItem item)
I took out the boolean force, add is always an add and if its already it does nothing, in other words have it always be force == true, i dont think force==false was used at all Took out the return value of SelectionItem - dont think it was used. No longer checks if the new item descends from or is the ancestor of anything in the selection - too slow on big selections. This is done on demand with getSelectionDescendedFromModel(model,true)


add

public void add(SelectionItem item,
                boolean deselectIfAlreadySelected)

add

public void add(FeatureList feats,
                java.lang.Object source,
                boolean deselectIfAlreadySelected)

add

public void add(FeatureList feats,
                java.lang.Object source)

add

public void add(Selection selection,
                boolean deselectIfAlreadySelected)

add

public void add(Selection selection)

removeFeature

public void removeFeature(SeqFeatureI feat)
Overrides:
removeFeature in class FeatureList

getSelected

public java.util.Vector getSelected()
Vector of SelectionItems


getListDescendedFromModel

public FeatureList getListDescendedFromModel(SeqFeatureI model,
                                             boolean check)

getSelectionDescendedFromModel

public Selection getSelectionDescendedFromModel(SeqFeatureI model)
Return a sub-Selection of the current Selection that are descendants of SeqFeatureI model. This should replace getSelectionForSource as it is independent of which view the selection originally came from.


getSelectionDescendedFromModel

public Selection getSelectionDescendedFromModel(SeqFeatureI model,
                                                boolean checkForRedundantDescendants)
Return a sub-Selection of the current Selection that are descendants of SeqFeatureI model. This should replace getSelectionForSource as it is independent of which view the selection originally came from. If checkForRedundantDescendants is true then selection items whose parents/ancestors are already selected are filtered out. (Should the descend check be a separate method?) return a feat list?


containsFeature

public boolean containsFeature(SeqFeatureI sf)
Returns true if there is a SelectionItem in Selection with sf


getSelectedData

public FeatureList getSelectedData()
Returns vector of selection items data of selection (SeqFeatureI's) change this to return FeatureList


getSelectedVector

public java.util.Vector getSelectedVector()

getSelectedData

public SeqFeatureI getSelectedData(int i)
The data of the selection items is a SeqFeatureI, model not drawable


getSelectionItem

public SelectionItem getSelectionItem(int i)

getSelectionItem

public SelectionItem getSelectionItem(SeqFeatureI sf)

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Overrides:
size in class java.util.ArrayList

clear

public void clear()
This does deselection. deselect() is called on all the SelectionItems which handle deselection

Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List
Overrides:
clear in class java.util.ArrayList

getSelectedVisualTypes

public java.util.HashSet getSelectedVisualTypes()
Returns a HashSet of Strings that is the unique set of visual types for the selection. This is not the logical types. SeqFeature.getType returns the logical type. DetailInfo.getPropertyType maps the logical type to the visual type. The visual type is what is displayed in the evidence panel and tiers window. Should this take in strand? put this in FeatureList?