Class SequenceViewerExtension
- java.lang.Object
-
- com.biomatters.geneious.publicapi.plugin.SequenceViewerExtension
-
public abstract class SequenceViewerExtension extends java.lang.Object
An extension which provides extra functionality in the sequence/alignment/contig viewer. The Sequence Viewer is the plugin bundled with Geneious that is responsible for providing the "Sequence View", "Alignment View", "Contig View". Extensions can provide- a custom component (via
getComponent()
) which can be positioned below or adjacent to the main sequence viewer display or within annotation or statistics controls - custom statistics (via
getStatistics
) - sequence viewer toolbar actions (via
getToolbarActions()
)
SequenceViewerExtension.Factory.createSequenceViewerExtension(DocumentViewer, com.biomatters.geneious.publicapi.documents.AnnotatedPluginDocument[], PropertyRetrieverAndEditor)
- Since:
- API 4.60 (Geneious 5.6.0)
- a custom component (via
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SequenceViewerExtension.ComponentLocation
A location in the sequence viewer for the component returned fromcreateComponent()
specified bygetComponentLocation()
static class
SequenceViewerExtension.Factory
A type of plugin for creating extensions to the sequence viewer returned fromGeneiousPlugin.getSequenceViewerExtensionFactories()
static class
SequenceViewerExtension.PropertyRetrieverAndEditor
Provides methods for querying the sequence viewer about the status of various things and for requesting that the sequence viewer change its state.static class
SequenceViewerExtension.SequenceAnnotationWrapper
Wraps aSequenceAnnotation
and provides extra information about the location (sequence, track) of the annotation.static class
SequenceViewerExtension.StateFrequencies<T extends jebl.evolution.sequences.State>
Provides frequencies of nucleotides or amino acidsstatic class
SequenceViewerExtension.StatisticsFactory
A convenience Factory for creating statistics.static class
SequenceViewerExtension.StatisticsSection
One or more lines of statistics that show up in the statistics section of the sequence viewer.
-
Constructor Summary
Constructors Constructor Description SequenceViewerExtension()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addComponentLocationChangedListener(org.virion.jam.util.SimpleListener listener)
Adds a listener to be notified when the value returned fromgetComponentLocation()
changesvoid
addComponentPositionActions(GeneiousActionToolbar toolbar, SequenceViewerExtension.ComponentLocation... locations)
Adds little buttons to a toolbar to control the location (seegetComponentLocation()
) of the component (seegetComponent()
) in the sequence viewer.void
addComponentPositionPopInOrOutAction(GeneiousActionToolbar toolbar, SequenceViewerExtension.ComponentLocation inLocation, SequenceViewerExtension.ComponentLocation outLocation)
Adds a little button to the toolbar to control the location (seegetComponentLocation()
) of the component (seegetComponent()
) in the sequence viewer.protected javax.swing.JComponent
createComponent()
javax.swing.JComponent
getComponent()
boolean
getComponentFillAvailableSpace()
SequenceViewerExtension.ComponentLocation
getComponentLocation()
SequenceViewerExtension.ComponentLocation
getDefaultComponentLocation()
ExtendedPrintable
getExtendedPrintable()
Returns an ExtendedPrintable which describes how this extension should be printed.abstract java.lang.String
getName()
java.util.List<SequenceViewerExtension.StatisticsSection>
getStatistics(SequenceViewerExtension.PropertyRetrieverAndEditor propertyRetriever, jebl.util.ProgressListener progressListener)
Generates one or more sections of statistics to be displayed in the statistics controls section.java.util.List<GeneiousAction>
getToolbarActions()
Get a list of other actions associated with extension which will be displayed in the sequence viewer toolbar.java.lang.String
getUniqueId()
void
setComponentLocation(SequenceViewerExtension.ComponentLocation location)
Sets the current location for this component.
-
-
-
Method Detail
-
getName
public abstract java.lang.String getName()
- Returns:
- a name describing this extension. This is used in the print dialog when selecting which part of the sequence viewer to print
-
getStatistics
public java.util.List<SequenceViewerExtension.StatisticsSection> getStatistics(SequenceViewerExtension.PropertyRetrieverAndEditor propertyRetriever, jebl.util.ProgressListener progressListener)
Generates one or more sections of statistics to be displayed in the statistics controls section. Rather than implementing a factory and extension classes to create statistics, plugins may wish to instead implement aSequenceViewerExtension.StatisticsFactory
which is a simpler API for plugins which just provide statistics.- Parameters:
propertyRetriever
- for obtaining properties about the current state of the sequence viewer. The implementation should take the selection (available viagetSelectionForStatistics
) into accountprogressListener
- for reporting progress and checking if statistics should be cancelled. It is important that an implementation cancel promptly or it can hang the sequence viewer when the user tries to edit.- Returns:
- the statistics or an empty list to provide no statistics
- Since:
- API 4.700 (Geneious 7.0.0)
-
getDefaultComponentLocation
public SequenceViewerExtension.ComponentLocation getDefaultComponentLocation()
- Returns:
- the default location the component returned from
createComponent()
will be displayed at. The user can choose to customize the location ifaddComponentPositionActions
oraddComponentPositionPopInOrOutAction
is used.
-
getComponentFillAvailableSpace
public boolean getComponentFillAvailableSpace()
- Returns:
- true if the component returned from
getComponent()
should expand to fill all available space
-
getComponentLocation
public final SequenceViewerExtension.ComponentLocation getComponentLocation()
- Returns:
- the location for the component returned from
createComponent()
will be displayed at. The user can choose to customize the location ifaddComponentPositionActions
oraddComponentPositionPopInOrOutAction
is used. Alternatively the extension can create its own controls to manage this itself
-
addComponentLocationChangedListener
public void addComponentLocationChangedListener(org.virion.jam.util.SimpleListener listener)
Adds a listener to be notified when the value returned fromgetComponentLocation()
changes- Parameters:
listener
- the listener to be notified
-
setComponentLocation
public void setComponentLocation(SequenceViewerExtension.ComponentLocation location)
Sets the current location for this component. The sequence viewer automatically calls this to restore the state the user last set.- Parameters:
location
- the current location for this component.
-
addComponentPositionActions
public void addComponentPositionActions(GeneiousActionToolbar toolbar, SequenceViewerExtension.ComponentLocation... locations)
Adds little buttons to a toolbar to control the location (seegetComponentLocation()
) of the component (seegetComponent()
) in the sequence viewer. Consider usingaddComponentPositionPopInOrOutAction
instead if you want your component to have only 2 possible locations.- Parameters:
toolbar
- the toolbar to add buttons tolocations
- possible locations for this component.- See Also:
addComponentPositionPopInOrOutAction(com.biomatters.geneious.publicapi.components.GeneiousActionToolbar, com.biomatters.geneious.publicapi.plugin.SequenceViewerExtension.ComponentLocation, com.biomatters.geneious.publicapi.plugin.SequenceViewerExtension.ComponentLocation)
-
addComponentPositionPopInOrOutAction
public void addComponentPositionPopInOrOutAction(GeneiousActionToolbar toolbar, SequenceViewerExtension.ComponentLocation inLocation, SequenceViewerExtension.ComponentLocation outLocation)
Adds a little button to the toolbar to control the location (seegetComponentLocation()
) of the component (seegetComponent()
) in the sequence viewer.- Parameters:
toolbar
- the toolbar to add buttons toinLocation
- the location of this component when it is popped in. EitherSequenceViewerExtension.ComponentLocation.AnnotationControls
orSequenceViewerExtension.ComponentLocation.StatisticsControls
outLocation
- the location of this component with it is popped out. EitherSequenceViewerExtension.ComponentLocation.AdjacentToControls
orSequenceViewerExtension.ComponentLocation.BelowSequenceViewer
- Since:
- API 4.61 (Geneious 5.6.1)
- See Also:
addComponentPositionActions(com.biomatters.geneious.publicapi.components.GeneiousActionToolbar, com.biomatters.geneious.publicapi.plugin.SequenceViewerExtension.ComponentLocation...)
-
getToolbarActions
public java.util.List<GeneiousAction> getToolbarActions()
Get a list of other actions associated with extension which will be displayed in the sequence viewer toolbar. The toolbar buttons will be ordered according to their toolbar positions which can be set usingGeneiousActionOptions.setToolbarPosition(double)
The default implementation returns an empty list.- Returns:
- actions list. may be null or empty.
- Since:
- API 4.600 (Geneious 6.0.0)
- See Also:
ActionProvider.getOtherActions()
-
getUniqueId
public java.lang.String getUniqueId()
- Returns:
- a unique ID for this extension type. The default implementation returns the fully qualified class name.
-
createComponent
protected javax.swing.JComponent createComponent()
- Returns:
- the component displayed in the sequence viewer at the location returned from
getComponentLocation()
. May be null for no component.
-
getComponent
public final javax.swing.JComponent getComponent()
- Returns:
- the component returned from
createComponent()
, caching it so thatcreateComponent()
is only called once.
-
getExtendedPrintable
public ExtendedPrintable getExtendedPrintable()
Returns an ExtendedPrintable which describes how this extension should be printed. The default implementation wraps the result ofgetComponent()
in an ExtendedPrintable usingExtendedPrintable.Factory.createExtendedPrintable(javax.swing.JComponent)
- Returns:
- an ExtendedPrintable which describes how this extension should be printed or null if this extension is not suitable for printing.
-
-