apollo.gui.genomemap
Class FeatureView

java.lang.Object
  extended by apollo.gui.genomemap.LinearView
      extended by apollo.gui.genomemap.ManagedView
          extended by apollo.gui.genomemap.TierView
              extended by apollo.gui.genomemap.FeatureView
All Implemented Interfaces:
ControlledObjectI, TierManagerListener, DropTargetViewI, ManagedViewI, PickViewI, PopupViewI, SelectViewI, TierViewI, ViewI, java.awt.event.AdjustmentListener, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
AnnotationView, ResultView

public abstract class FeatureView
extends TierView
implements PopupViewI, SelectViewI

FeatureView is a View for displaying DrawableSeqFeatures and DrawableFeatureSets (and maybe other Drawables), in linear tiers. It uses a FeatureTierManager to control the layout, and a Transformer for pixel to Base coord transforms. It can have a vertical scrollbar for scrolling tiers. It can do drag and drop.

See Also:
Serialized Form

Field Summary
protected  DrawableSetI dfset
           
protected  java.util.Vector drawables
           
protected  java.awt.Dimension pickSize
           
 
Fields inherited from class apollo.gui.genomemap.TierView
controller, dragSources, rightSide, selectionManager, vScroll, vscrollable
 
Fields inherited from class apollo.gui.genomemap.ManagedView
dropSpaceSize, leadSpaceSize, logger, manager, visibleDrawables
 
Fields inherited from class apollo.gui.genomemap.LinearView
apollo_panel, backgroundColour, debug, foregroundColour, graphics, limitsSet, transformer, transparent, viewBounds, visibilityListeners, visible
 
Fields inherited from interface apollo.gui.genomemap.ViewI
LEFTSIDE, NONE, RIGHTSIDE
 
Constructor Summary
FeatureView(javax.swing.JComponent ap, java.lang.String name, SelectionManager selectionManager)
           
 
Method Summary
 boolean beginTierDrag(java.awt.event.MouseEvent evt)
          Start a tier drag
 void clear()
          sets internal vars to null: fset, dfset, visibleDrawables, graphics should it set them to empty vectors instead of null? T
protected  void clear(boolean justFeatures)
           
 void clearEdges()
           
 void clearFeatures()
          just clears out features from view
 void clearHighlights()
           
protected abstract  javax.swing.JPopupMenu createPopupMenu(ApolloPanelI ap, java.awt.event.MouseEvent evt)
          This is overridden by ResultView and AnnotView - make abstract?
protected  void drawDragRectangle(java.awt.Graphics g)
           
 void endTierDrag(java.awt.event.MouseEvent evt)
          end a tier drag
 void finalize()
           
protected  java.util.Vector findDrawables(java.awt.Rectangle rect, boolean selected_only)
          returns a Vector of Drawable instances that overlap the area of the rectangle passed in The selected_only is ignored: first check children (if its a feature set), if no children hit check self this follows the old logic and you dont have to make 2 calls one with setFlag=false and if that didnt hit then with setFlag=false This is the only way i have seen this used so it seems ok to change.
protected  Selection findFeaturesForSelection(java.awt.Rectangle r, boolean selectParents)
          From PickViewI -
 DrawableSetI getDrawableSet()
          Returns the DrawableFeatureSet that is the top(holder) of all the drawables in the view
 java.awt.Rectangle getPreferredSize()
          This only sets the height to a sensible value.
protected  int getTierYCentre(Drawable dsf)
           
 FeatureSetI getTopModel()
          Returns the topmost model object of the result view, the FeatureSet that holds all of the tiers, (just dfset.getFeatureSet())
 Selection getViewSelection(Selection selection)
          given the entirety of what is currently selected, remove anything that doesn't belong to this view and return the remaining selections.
protected  boolean needsTextAvoidUpdate()
           
 void paintView()
          Just repaints scrollbars
protected  void putScrollAtStart()
          double-check that the feature sets have been initialized
 void select(Selection selection)
          Find the drawables in this view associated with the model in selection and select them.
 void setBounds(java.awt.Rectangle bounds)
          Set the coordinates of the rectangle containing the View.
 void setCentre(int Position)
          Set the centre position.
 void setDrawableSet(DrawableSetI dfset)
          Expects a DrawableFeatureSet (which is a FeatureSetI)
 void setMatchingEdges(int[] edges, boolean state)
           
 void setTextAvoidance(boolean state)
           
 void setXOrientation(int direction)
           
 void setZoomFactor(double factor)
          Set the ZoomFactor along the linear axis
 void showPopupMenu(java.awt.event.MouseEvent evt)
           
 void updateTierDrag(java.awt.event.MouseEvent evt)
          continue a tier drag
 void verticalScrollToSelection()
          SelectViewI?
 void verticalScrollToSelection(java.util.Vector selectedDrawables)
          Scroll to the Selection - move this to FeatureView?
 
Methods inherited from class apollo.gui.genomemap.TierView
addScrollBar, adjustmentValueChanged, allowsTierDrags, changeTierHeight, createDragView, decrementTierHeight, drawablesForDrag, findDrawables, findDrawables, findFeatures, findFeatures, findFeatures, findFeaturesForSelection, findFeaturesForSelection, fireViewEvent, getController, getControllerWindow, getInvertedScrollbarValue, getLowestVisibleTier, getMaxScrollbarValue, getMinScrollbarValue, getScrollbarValue, getVisibleScrollbarValue, handleTierManagerEvent, incrementTierHeight, interpretDrop, interpretDrop, isDownOrientation, isUpOrientation, isValidDragSource, moveScrollbarByWheelAmount, needsAutoRemoval, printScrollValues, registerDragSource, setController, setLowestVisibleTier, setScrollbarValue, setScrollHack, setScrollSide, setScrollValues, setScrollVisibility, setSelectionManager, setTierManager, setVisible, setVScrollable, setYOrientation, updateManagerHeight
 
Methods inherited from class apollo.gui.genomemap.ManagedView
getDropSpaceSize, getLeadSpaceSize, getTierManager, getVisibleDrawables, getYRange, paintDrawables, setDropSpaceSize, setLeadSpaceSize, setTierManager
 
Methods inherited from class apollo.gui.genomemap.LinearView
addViewListener, addVisibilityListener, areLimitsSet, fireViewEvent, getBackgroundColour, getBounds, getCentre, getComponent, getDrawBounds, getForegroundColour, getGraphics, getLimits, getMaximum, getMinimum, getName, getSelectionRectangle, getStrand, getTransform, getVisibleRange, init, isInvalid, isTransparent, isVisible, setBackgroundColour, setComponent, setDebug, setDrawBounds, setForegroundColour, setGraphics, setInvalidity, setLimits, setLimitsSet, setMaximum, setMinimum, setName, setStrand, setTransform, setTransparent, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface apollo.gui.genomemap.TierViewI
allowsTierDrags, createDragView, decrementTierHeight, getLowestVisibleTier, getVisibleDrawables, incrementTierHeight, setLowestVisibleTier
 
Methods inherited from interface apollo.gui.genomemap.ManagedViewI
getTierManager, setTierManager
 
Methods inherited from interface apollo.gui.genomemap.ViewI
addViewListener, areLimitsSet, getBounds, getCentre, getComponent, getLimits, getMaximum, getMinimum, getName, getTransform, getVisibleRange, isInvalid, isTransparent, isVisible, setComponent, setGraphics, setInvalidity, setLimits, setLimitsSet, setMaximum, setMinimum, setName, setTransparent, setVisible
 

Field Detail

pickSize

protected java.awt.Dimension pickSize

dfset

protected DrawableSetI dfset

drawables

protected java.util.Vector drawables
Constructor Detail

FeatureView

public FeatureView(javax.swing.JComponent ap,
                   java.lang.String name,
                   SelectionManager selectionManager)
Method Detail

paintView

public void paintView()
Description copied from class: TierView
Just repaints scrollbars

Specified by:
paintView in interface ViewI
Overrides:
paintView in class TierView

drawDragRectangle

protected void drawDragRectangle(java.awt.Graphics g)

beginTierDrag

public boolean beginTierDrag(java.awt.event.MouseEvent evt)
Description copied from interface: TierViewI
Start a tier drag

Specified by:
beginTierDrag in interface TierViewI
Overrides:
beginTierDrag in class TierView

updateTierDrag

public void updateTierDrag(java.awt.event.MouseEvent evt)
Description copied from interface: TierViewI
continue a tier drag

Specified by:
updateTierDrag in interface TierViewI
Overrides:
updateTierDrag in class TierView

endTierDrag

public void endTierDrag(java.awt.event.MouseEvent evt)
Description copied from interface: TierViewI
end a tier drag

Specified by:
endTierDrag in interface TierViewI
Overrides:
endTierDrag in class TierView

findFeaturesForSelection

protected Selection findFeaturesForSelection(java.awt.Rectangle r,
                                             boolean selectParents)
From PickViewI -

Specified by:
findFeaturesForSelection in class TierView

findDrawables

protected java.util.Vector findDrawables(java.awt.Rectangle rect,
                                         boolean selected_only)
returns a Vector of Drawable instances that overlap the area of the rectangle passed in The selected_only is ignored: first check children (if its a feature set), if no children hit check self this follows the old logic and you dont have to make 2 calls one with setFlag=false and if that didnt hit then with setFlag=false This is the only way i have seen this used so it seems ok to change. Follow up question is it even necasary to check ones self if none of your children have hit? Is it possible for a feature set to get hit with none of the kids getting hit? Yes it is possible - the intron hits the feature set but not its kids Also if all of your kids get hit should you actually figure this out and return the containing feature set? The above leads to some funny behaviour is the tier is collapsed. What ends up getting selected is individual features for those that features that lie directly beneath the click and the entire feature-set for those with the gap directly beneath the click. Decided to fix this by using the loop twice.

Specified by:
findDrawables in class TierView

getDrawableSet

public DrawableSetI getDrawableSet()
Returns the DrawableFeatureSet that is the top(holder) of all the drawables in the view


getTopModel

public FeatureSetI getTopModel()
Returns the topmost model object of the result view, the FeatureSet that holds all of the tiers, (just dfset.getFeatureSet())


setDrawableSet

public void setDrawableSet(DrawableSetI dfset)
Expects a DrawableFeatureSet (which is a FeatureSetI)


setMatchingEdges

public void setMatchingEdges(int[] edges,
                             boolean state)

setXOrientation

public void setXOrientation(int direction)
Overrides:
setXOrientation in class ManagedView

clearEdges

public void clearEdges()

clearHighlights

public void clearHighlights()

select

public void select(Selection selection)
Find the drawables in this view associated with the model in selection and select them. This method is used to deal with external selections (used by ApolloPanel.handleFeatureSelectionEvent)

Specified by:
select in interface SelectViewI

verticalScrollToSelection

public void verticalScrollToSelection()
SelectViewI?

Specified by:
verticalScrollToSelection in interface SelectViewI

verticalScrollToSelection

public void verticalScrollToSelection(java.util.Vector selectedDrawables)
Scroll to the Selection - move this to FeatureView?


getTierYCentre

protected int getTierYCentre(Drawable dsf)

setCentre

public void setCentre(int Position)
Description copied from interface: ViewI
Set the centre position.

Specified by:
setCentre in interface ViewI
Overrides:
setCentre in class LinearView

setBounds

public void setBounds(java.awt.Rectangle bounds)
Description copied from interface: ViewI
Set the coordinates of the rectangle containing the View.

Specified by:
setBounds in interface ViewI
Overrides:
setBounds in class ManagedView
Parameters:
bounds - The rectangle describing the new bounds of the View in parent component coordinates.

setZoomFactor

public void setZoomFactor(double factor)
Description copied from interface: ViewI
Set the ZoomFactor along the linear axis

Specified by:
setZoomFactor in interface ViewI
Overrides:
setZoomFactor in class LinearView

getPreferredSize

public java.awt.Rectangle getPreferredSize()
This only sets the height to a sensible value. It expects the width to be managed by an ApolloLayoutManager.

Specified by:
getPreferredSize in interface ViewI
Overrides:
getPreferredSize in class LinearView

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

clear

public void clear()
sets internal vars to null: fset, dfset, visibleDrawables, graphics should it set them to empty vectors instead of null? T

Specified by:
clear in interface ViewI
Overrides:
clear in class TierView

clearFeatures

public void clearFeatures()
just clears out features from view


clear

protected void clear(boolean justFeatures)

setTextAvoidance

public void setTextAvoidance(boolean state)

needsTextAvoidUpdate

protected boolean needsTextAvoidUpdate()

createPopupMenu

protected abstract javax.swing.JPopupMenu createPopupMenu(ApolloPanelI ap,
                                                          java.awt.event.MouseEvent evt)
This is overridden by ResultView and AnnotView - make abstract?


showPopupMenu

public void showPopupMenu(java.awt.event.MouseEvent evt)
Specified by:
showPopupMenu in interface PopupViewI

getViewSelection

public Selection getViewSelection(Selection selection)
given the entirety of what is currently selected, remove anything that doesn't belong to this view and return the remaining selections. This used to be handled in the Selection class, but it didn't quite work, because the 'source'=='where it was originally selected' which, may or may not be, the same as this view.

Specified by:
getViewSelection in interface TierViewI
Specified by:
getViewSelection in class TierView

putScrollAtStart

protected void putScrollAtStart()
double-check that the feature sets have been initialized

Overrides:
putScrollAtStart in class TierView