public class SequenceIndexArea extends DataArea
You would usually use this component in the head area of an AlignmentArea
but it is possible to
insert it at any position.
The labeling interval if this area is calculated from the space needed to label the highest index in the associated alignment model. Note that due to rounding effects the label interval may vary by one depending on the zoom factor.
Modifier and Type | Field and Description |
---|---|
static double |
DASH_LENGTH_FACTOR
The length of a dash
|
static java.awt.Stroke |
DASH_STROKE
The stroke used to paint the dashes
|
static int |
DEFAULT_FIRST_INDEX
The default value returned by
getFirstIndex() if it has not been changed. |
static double |
LABEL_LEFT_DISTANCE_FACTOR
The distance of the labels to their dash
|
static double |
LABEL_TOP_DISTANCE_FACTOR
The distance of the labels to the border of the component
|
static double |
LABELED_DASH_LENGTH_FACTOR
The length of a dash with a label
|
DISPATCHER_MAP, repaintRequested
Constructor and Description |
---|
SequenceIndexArea(AlignmentContentArea owner)
Creates a new instance of this class using the parent alignment area of
owner as the labeled area. |
SequenceIndexArea(AlignmentContentArea owner,
AlignmentArea labeledArea)
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.
|
int |
getFirstIndex()
Returns the index that will be displayed for the first column of the alignment area.
|
double |
getHeight()
Returns the height in pixels considering the current zoom factor this component needs.
|
void |
paintPart(AlignmentPaintEvent e)
Implementations of this method perform the painting of a part of the component.
|
void |
setFirstIndex(int firstIndex)
Sets a new index that will be displayed for the first column of the alignment area.
|
java.util.Set<DataAreaListType> |
validLocations()
The result should enumerate all valid locations where the implementing data area is allowed to be located.
|
getLabeledAlignmentArea, getLabeledAlignmentModel, getLengthAfterEnd, getLengthBeforeStart, 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_FIRST_INDEX
getFirstIndex()
if it has not been changed.public static final java.awt.Stroke DASH_STROKE
public static final double DASH_LENGTH_FACTOR
public static final double LABELED_DASH_LENGTH_FACTOR
public static final double LABEL_TOP_DISTANCE_FACTOR
public static final double LABEL_LEFT_DISTANCE_FACTOR
public SequenceIndexArea(AlignmentContentArea owner, AlignmentArea labeledArea)
owner
- the alignment area that is going to contain this data arealabeledArea
- the alignment area displays the sequence which is labeled by the new instance
(If null
is specified here, the parent alignment area of owner
will be assumed.)public SequenceIndexArea(AlignmentContentArea owner)
owner
as the labeled area.owner
- the alignment area that is going to contain this data areapublic 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 int getFirstIndex()
The default value is 1. Note that the methods of AlignmentArea
and associated classes will always
use 0 as the index of the first column no matter which value is set here. It is used for the GUI output
of this data area only.
public void setFirstIndex(int firstIndex)
The methods of AlignmentArea
and associated classes will always use 0 as the index of the first
column no matter which value is specified here. It is used for the GUI output of this data area only.
firstIndex
- the new index display for the first columnpublic double getHeight()
AlignmentSubArea
getHeight
in class AlignmentSubArea
double
value > 0public <T> void afterSequenceChange(SequenceChangeEvent<T> e)
AlignmentModelChangeListener
e
- the event object containing information on the changepublic <T> void afterSequenceRenamed(SequenceRenamedEvent<T> e)
AlignmentModelChangeListener
e
- the event object containing information on the changepublic <T> void afterTokenChange(TokenChangeEvent<T> e)
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.
previous
- the alignment model this listener was attached to before the event happenedcurrent
- the new alignment model this listener is attached to now