uk.ac.man.bioinf.gui.viewer
Interface AlignmentSelectionModel

All Known Implementing Classes:
NamedAlignmentSelectionModel, NullAlignmentSelectionModel, SingleAlignmentSelectionModel

public interface AlignmentSelectionModel

AlignmentSelectionModel.java This defines the selection model for the JAlignmentViewer. The main three methods of this class, namely stopSelection(), extendSelection() and clearSelection() are called by the JAlignmentViewer, or one of its helper classes and usually considered to be advisory. The model is free to ignore these method calls if it is appropriate behaviour. Created: Mon Apr 10 11:32:26 2000

Version:
$Id: AlignmentSelectionModel.java,v 1.4 2001/04/11 17:04:42 lord Exp $
Author:
Phillip Lord

Method Summary
 void addAlignmentSelectionListener(AlignmentSelectionListener listener)
           
 void clearSelection()
          Clear all the selections in this model
 void extendSelection(SequenceAlignmentPoint point)
          Start a selection at the given point
 SequenceAlignmentRectangle getCurrentSelection()
          Returns the current selection or null if there is no selection.
 int getNumberSelections()
          Get the number of selections.
 SequenceAlignmentRectangle getRectangleAtPoint(SequenceAlignmentPoint point)
          Get the first selection rectangle which surrounds the point, or null if there is not one.
 SequenceAlignmentRectangle[] getRectanglesAtPoint(SequenceAlignmentPoint point)
          Get all selection rectangles which surround this point, or null if there is not one
 SequenceAlignmentRectangle getSelectionAt(int index)
          Gets the given selection.
 boolean isPointSelected(SequenceAlignmentPoint point)
          Is the point within one of the selection rectangles
 boolean isSelecting()
          is the current selection in the process of being selected.
 void removeAlignmentSelectionListener(AlignmentSelectionListener listener)
           
 void stopSelection(SequenceAlignmentPoint point)
          Complete the selection at the given point
 

Method Detail

isSelecting

public boolean isSelecting()
is the current selection in the process of being selected.

Returns:
true is selection is changing

getCurrentSelection

public SequenceAlignmentRectangle getCurrentSelection()
Returns the current selection or null if there is no selection. If there is more than one selection this should return the most recently made selection

Returns:
the selection

getNumberSelections

public int getNumberSelections()
Get the number of selections.

Returns:
the number of selections

getSelectionAt

public SequenceAlignmentRectangle getSelectionAt(int index)
                                          throws IndexOutOfBoundsException
Gets the given selection. The index should reflect the chronological order in which the selections were made, with the smallest index first

Parameters:
index - the index
Returns:
the selection array index at the given index
Throws:
ArrayIndexOutOfBoundsException - if the index is out of bounds
IndexOutOfBoundsException

isPointSelected

public boolean isPointSelected(SequenceAlignmentPoint point)
Is the point within one of the selection rectangles

Parameters:
point - the point
Returns:
true if point is within a rectangle

clearSelection

public void clearSelection()
Clear all the selections in this model


getRectangleAtPoint

public SequenceAlignmentRectangle getRectangleAtPoint(SequenceAlignmentPoint point)
Get the first selection rectangle which surrounds the point, or null if there is not one.

Parameters:
point - the point in question
Returns:
the rectangle surrounding point

getRectanglesAtPoint

public SequenceAlignmentRectangle[] getRectanglesAtPoint(SequenceAlignmentPoint point)
Get all selection rectangles which surround this point, or null if there is not one

Parameters:
point - the point in question
Returns:
the rectangles surrounding point

extendSelection

public void extendSelection(SequenceAlignmentPoint point)
Start a selection at the given point

Parameters:
point - the start of the selection

stopSelection

public void stopSelection(SequenceAlignmentPoint point)
Complete the selection at the given point

Parameters:
point - the point to complete the selection

addAlignmentSelectionListener

public void addAlignmentSelectionListener(AlignmentSelectionListener listener)

removeAlignmentSelectionListener

public void removeAlignmentSelectionListener(AlignmentSelectionListener listener)