public class PherogramArea extends DataArea implements PherogramComponent
PherogramView
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEIGHT_FACTOR |
DISPATCHER_MAP, repaintRequested
Constructor and Description |
---|
PherogramArea(AlignmentContentArea owner,
PherogramAreaModel model)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
<T,U> void |
afterModelChanged(AlignmentModel<T> previous,
AlignmentModel<U> current)
Called if this listener was moved to another instance of
AlignmentModel . |
<T> void |
afterSequenceChange(SequenceChangeEvent<T> e)
Called after a sequence has been inserted, removed or replaced.
|
<T> void |
afterSequenceRenamed(SequenceRenamedEvent<T> e)
Called after a sequence was renamed.
|
<T> void |
afterTokenChange(TokenChangeEvent<T> e)
Called after a single token or a set of tokens has been inserted, removed or replaced.
|
protected SimpleSequenceInterval |
calculatePaintRange(TICPaintEvent e) |
boolean |
copyBaseCallSequence(int startBaseCallIndex,
int endBaseCallIndex)
Copies a part of the base call sequence from the underlying model to the editable sequence this data
area is attached to.
|
double |
getEditableTokenWidth()
Returns the width of the token in the editable sequence at
#getFirstSeqPos() , considering the
current zoom factor. |
PherogramFormats |
getFormats()
Returns the format object that is used to paint the displayed pherogram.
|
double |
getHeight()
Returns the height in pixels considering the current zoom factor this component needs.
|
double |
getLengthAfterEnd()
Returns the length in pixels considering the current zoom factor this component needs to display
data right of the last alignment column.
|
double |
getLengthBeforeStart()
Returns the length in pixels considering the current zoom factor this component needs to display
data left of the first alignment column.
|
PherogramAreaModel |
getModel()
Returns the model providing the base call sequence, the trace curves and the cut positions.
|
TokenPainter |
getRelatedTokenPainter() |
double |
getVerticalScale() |
boolean |
isUpdateEditableSequence()
Indicates whether the editable sequence should be updated if the cut positions of the model
are modified.
|
void |
paintPart(AlignmentPaintEvent e)
Implementations of this method perform the painting of a part of the component.
|
boolean |
setLeftCutPositionBySelection()
Tries to set the left border where the base call sequence is cut off according to the left end of the current
selection.
|
boolean |
setRightCutPositionBySelection()
Tries to set the right border where the base call sequence is cut off according to the right end of the current
selection.
|
void |
setUpdateEditableSequence(boolean updateEditableSequence)
Specifies whether updated of the editable sequence shall be performed by this class automatically,
if the cut positions in the underlying model are changed.
|
void |
setVerticalScale(double value)
Sets the horizontal zoom factor that shall used for displaying the trace curves.
|
java.util.Set<DataAreaListType> |
validLocations()
The result should enumerate all valid locations where the implementing data area is allowed to be located.
|
getLabeledAlignmentArea, getLabeledAlignmentModel, getList, isVisible, setList, setVisible
createLabelSubArea, getLabelSubArea, getOwner, getSize, paint, repaint
addKeyListener, addMouseListener, addMouseWheelListener, assignSize, dispatchEvent, getCurrentToolkit, getKeyListenersSet, getMouseListenersSet, getMouseWheelListenersSet, getSwingComponentClassName, getSwingComponentConstructorParameters, getSWTComponentClassName, getSWTComponentConstructorParameters, getToolkitComponent, hasDefinedSize, hasToolkitComponent, isUpdateOngoing, removeKeyListener, removeMouseListener, removeWheelMouseListener, setToolkitComponent, setUpdateOngoing
public static final int DEFAULT_HEIGHT_FACTOR
public PherogramArea(AlignmentContentArea owner, PherogramAreaModel model)
owner
- the alignment area that will be containing the returned data area instancemodel
- the provider for the pherogram data to be displayed by the returned instance (Note that each
instance of this class needs a separate model instance. model
can anyway be shared with instances
of PherogramTraceCurveView
.)java.lang.IllegalArgumentException
- if model
is already owned by another pherogram areaprotected SimpleSequenceInterval calculatePaintRange(TICPaintEvent e)
public void paintPart(AlignmentPaintEvent e)
AlignmentSubArea
AlignmentArea
is set to contain no subcomponents but to paint its contents directly.
This default implementation always throws an UnsupportedOperationException
. Note that
therefore inherited classes must either overwrite this method or #createComponent()
in
order to return an instance there that does not delegate to this method.
Note that the aim of this method is to allow painting very wide components, which may have a width
larger than Integer.MAX_VALUE
. Therefore painting coordinates are stored as double
values (using Graphics2D
and Rectangle2D.Double
). Implementations should not
calculate pixel coordinates as int
s at any time to avoid overflows, but only use
double
(or possibly long
if necessary).
paintPart
in class AlignmentSubArea
e
- the paint event providing information on the area to be painted, the graphics context
and tool methods.public java.util.Set<DataAreaListType> validLocations()
DataArea
An implementation for a data area could be located everywhere could look like this:
return EnumSet.of(DataAreaListType.TOP, DataAreaListType.BOTTOM, DataAreaListType.SEQUENCE);
validLocations
in class DataArea
public PherogramAreaModel getModel()
PherogramComponent
getModel
in interface PherogramComponent
null
if not model has been specified yetpublic boolean isUpdateEditableSequence()
Note that such updates only affect parts of the editable sequence that are or were associated with
the cut off parts of the pherogram. In a reverse complement operation the editable sequence between
the cut positions will never be updated. This needs to be done in application code e.g. by calling
copyBaseCallSequence(int, int)
.
true
if updated in the editable sequence are performed automatically, false
otherwisecopyBaseCallSequence(int, int)
public void setUpdateEditableSequence(boolean updateEditableSequence)
updateEditableSequence
- Specify true
here, if automatic updated shall be performed from
now on or false
if the editable sequence shall be left unchanged from now onpublic boolean copyBaseCallSequence(int startBaseCallIndex, int endBaseCallIndex)
Note that this method will do nothing, if this instance has not been attached to any sequence yet.
startBaseCallIndex
- the index of the first position in the base call sequence to be copiedendBaseCallIndex
- the index after the last position of the base call sequence to be copiedtrue
if the editable sequence was updated, false
if this area is currently
not attached to any sequenceisUpdateEditableSequence()
public boolean setLeftCutPositionBySelection()
If the right cut position would be located left of the left cut position after this operation, it will
be moved to baseCallIndex
as well. Note that this method does not test if the sequence, this area is
attached to, is contained in the selection. It just relies on the selected columns.
true
if the right cut position was changed according to the selection (or the right cut position),
false
if that was not possible because the current right end of the selection lies outside of the
pherogrampublic boolean setRightCutPositionBySelection()
If the left cut position would be located right of the right cut position after this operation, it will
be moved to baseCallIndex
as well. Note that this method does not test if the sequence, this area is
attached to, is contained in the selection. It just relies on the selected columns.
true
if the right cut position was changed according to the selection (or the right cut position),
false
if that was not possiblepublic double getVerticalScale()
getVerticalScale
in interface PherogramComponent
public void setVerticalScale(double value)
PherogramComponent
setVerticalScale
in interface PherogramComponent
value
- the new zoom factor (must be greater than zero)public PherogramFormats getFormats()
PherogramComponent
getFormats
in interface PherogramComponent
public double getEditableTokenWidth()
#getFirstSeqPos()
, considering the
current zoom factor.public TokenPainter getRelatedTokenPainter()
public double getLengthBeforeStart()
DataArea
Overwrite this method if your component displays additional information left of the alignment.
getLengthBeforeStart
in class DataArea
public double getLengthAfterEnd()
DataArea
Overwrite this method if your component displays additional information right of the alignment.
getLengthAfterEnd
in class DataArea
public double getHeight()
AlignmentSubArea
getHeight
in class AlignmentSubArea
double
value > 0public <T> void afterSequenceChange(SequenceChangeEvent<T> e)
AlignmentModelChangeListener
afterSequenceChange
in interface AlignmentModelChangeListener
e
- the event object containing information on the changepublic <T> void afterSequenceRenamed(SequenceRenamedEvent<T> e)
AlignmentModelChangeListener
afterSequenceRenamed
in interface AlignmentModelChangeListener
e
- the event object containing information on the changepublic <T> void afterTokenChange(TokenChangeEvent<T> e)
AlignmentModelChangeListener
afterTokenChange
in interface AlignmentModelChangeListener
e
- the event object containing information on the changepublic <T,U> void afterModelChanged(AlignmentModel<T> previous, AlignmentModel<U> current)
AlignmentModelChangeListener
AlignmentModel
.
This happens if the alignment model of an AlignmentArea
was changed.
afterModelChanged
in interface AlignmentModelChangeListener
previous
- the alignment model this listener was attached to before the event happenedcurrent
- the new alignment model this listener is attached to now