[Biojava-l] Proposal for some changes in the SequencePanel class.

Keith James kdj@sanger.ac.uk
13 May 2002 21:30:09 +0100


>>>>> "Kalle" == Kalle Näslund <Kalle.Naslund@genpat.uu.se> writes:

[..]

    Kalle> To be a bit more precise, the changes would be the
    Kalle> following:

    Kalle> 1. Move all methods from SequenceRenderContext to an inner
    Kalle> class 2. Make SequencePanel accept SymbolLists by chaning
    Kalle> void setSequence( Sequence s ); 3. Change of the method
    Kalle> Sequence getSequence(); to return SymbolList instead, as
    Kalle> one no longer can be sure that we are rendering a
    Kalle> Sequence. ( i assume this can break things )

So SequencePanel would have get/setSymbolList and the inner
SequenceRenderContext would still have get/setSequence and the
SequencePanel would do the necessary cast or wrapping of the
SymbolList?

As both Sequence and Alignment inherit from SymbolList I like the
idea as long as the SequenceRenderContext interface does not change.

However, not all implementations will benefit from having the
SequenceRenderContext methods hidden. E.g. we have an application
which uses the graphicsToSequence and sequenceToGraphics methods in a
listener to implement middle-button-drag scrolling via
SequenceViewerEvents; if you can't convert the symbol coordinate (from
getPos method) to a graphics coordinate then the usefulness of a
SequenceViewerEvent is greatly reduced. The methods to do this are in
SequenceRenderContext.

The graphicsToSequence and sequenceToGraphics methods in
TranslatedSequencePanel and PairwiseSequencePanel need to remain. I
suppose these could chain through to an inner class too. The same goes
for getRange, getDirection and getScale. But then, that accounts for
most of the methods in SequenceRenderContext, so why move them if you
then have to reimplement them by chaining?

As I said, I like the idea of moving from Sequence to
SymbolList. However, most of the panels require the majority of the
SequenceRenderContext methods to be useful in a dynamic application. I
don't think we should fragment the behaviour of the various panels too
much, unless it is very clearly documented.

I don't mean to be too negative - I'm in favour of the change in
theory.

Keith

-- 

-= Keith James - kdj@sanger.ac.uk - http://www.sanger.ac.uk/Users/kdj =-
Pathogen Sequencing Unit, Wellcome Trust Sanger Institute, Cambridge, UK