public class LabelledSequenceRenderer extends AbstractChangeable implements SequenceRenderer
Experimental: This should probably delegate the label-drawing to a little LabelRenderer interface, and have the option of rendering trailing as well as leading labels.
SequenceRenderer.RendererForwarder
Modifier and Type | Field and Description |
---|---|
static ChangeType |
RENDERER |
static ChangeType |
VALUES |
Constructor and Description |
---|
LabelledSequenceRenderer()
Creates new LabelledSequenceRenderer with default width and depth;
|
LabelledSequenceRenderer(double minWidth,
double minDepth)
Creates new LabelledSequenceRenderer with the specified width and depth.
|
LabelledSequenceRenderer(String label,
SequenceRenderer renderer) |
Modifier and Type | Method and Description |
---|---|
void |
addLabelString(String text)
Add a piece of text to this renderer's label
|
protected ChangeSupport |
generateChangeSupport()
Called the first time a ChangeSupport object is needed.
|
double |
getDepth(SequenceRenderContext sRC)
Retrieve the depth of this renderer when rendering src.
|
Color |
getFillColor()
Get the background color of the label area.
|
double |
getMinimumLeader(SequenceRenderContext sRC)
Retrieve the minimum leading distance for this renderer when rendering src.
|
double |
getMinimumTrailer(SequenceRenderContext sRC)
Retrieve the minimum trailing distance for this renderer when rendering src.
|
Color |
getTextColor()
Get the color of the label text
|
void |
paint(Graphics2D g,
SequenceRenderContext sRC)
Render a portion (possibly all) of the information for src to g, displaying
all of the data that would fall within seqBox.
|
SequenceViewerEvent |
processMouseEvent(SequenceRenderContext sRC,
MouseEvent mE,
List path)
Produce a SequenceViewerEvent in response to a mouse gesture.
|
void |
removeLabelString(String text)
Remove a piece of text from the label
|
void |
setFillColor(Color c)
Set the background color of the label area.
|
void |
setRenderer(SequenceRenderer sR)
Set the child renderer responsible for drawing the contents of this track
|
void |
setTextColor(Color c)
Set the color of the label text
|
void |
toggleSelectionStatus() |
addChangeListener, addChangeListener, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
public static final ChangeType RENDERER
public static final ChangeType VALUES
public LabelledSequenceRenderer()
public LabelledSequenceRenderer(String label, SequenceRenderer renderer)
public LabelledSequenceRenderer(double minWidth, double minDepth)
protected ChangeSupport generateChangeSupport()
AbstractChangeable
generateChangeSupport
in class AbstractChangeable
public void setRenderer(SequenceRenderer sR) throws ChangeVetoException
ChangeVetoException
public void addLabelString(String text) throws ChangeVetoException
ChangeVetoException
public void removeLabelString(String text) throws ChangeVetoException
ChangeVetoException
public void toggleSelectionStatus() throws ChangeVetoException
ChangeVetoException
public double getMinimumLeader(SequenceRenderContext sRC)
SequenceRenderer
The leading distance may vary between sequence panels - for example based upon sequence length.
getMinimumLeader
in interface SequenceRenderer
sRC
- the SequenceRenderContext to return info forpublic double getMinimumTrailer(SequenceRenderContext sRC)
SequenceRenderer
The trailing distance may vary between sequence panels - for example based upon sequence length.
getMinimumTrailer
in interface SequenceRenderer
sRC
- the SequenceRenderContext to return info forpublic double getDepth(SequenceRenderContext sRC)
SequenceRenderer
The depth may vary between sequence panels - for example based upon sequence length. Each line of information in the SequenceRendererContext only renders a region of the sequence. The depth for one complete line may be different from that for another due to the sequence having more or less information in that region to show. For example, a feature renderer implementation may chose to collapse down to a depth of zero pixels if there are no features to render within a region.
getDepth
in interface SequenceRenderer
sRC
- the SequenceRenderContext to return info forpublic SequenceViewerEvent processMouseEvent(SequenceRenderContext sRC, MouseEvent mE, List path)
SequenceRenderer
A SequenceRenderer that performs any form of coordinate remapping should ensure that it appropriately transforms the mouse event. However, in the SequenceViewerEvent returned, the MouseEvent should be in untransformed coordinates.
The SequenceRenderer implementation should append itself to the path list before constructing the SequenceViewerEvent.
processMouseEvent
in interface SequenceRenderer
sRC
- the SequenceRenderContext currently in scopemE
- a MouseEvent that caused this requestpath
- the List of SequenceRenderer instances passed through so farpublic void setFillColor(Color c)
public Color getFillColor()
public void setTextColor(Color c)
public Color getTextColor()
public void paint(Graphics2D g, SequenceRenderContext sRC)
SequenceRenderer
paint
in interface SequenceRenderer
g
- the Graphics2D to render tosRC
- the SequenceRenderContext that encapsulates the information to renderCopyright © 2014 BioJava. All rights reserved.