Class ProteinSegmentDomain

All Implemented Interfaces:
javax.accessibility.Accessible, CoolPrint, Domain2D, Drawing, java.awt.image.ImageObserver, java.awt.MenuContainer, java.util.Observer,

public class ProteinSegmentDomain
extends TwoEndsDraggableDomain
implements Domain2D, java.util.Observer

Graphical representation of a protein segment. This is actually meant to represent protein domains, but rbde already uses this name. The segment is represented by an large ellipse in which the name, and range of residues in the segment are written. The spacer of this domain enterely determines the dimension on the page. The size of the elipse that represent the protein segment is calculated directly from the spacer.

Fabien Campagne
See Also:
Serialized Form

Field Summary
Fields inherited from class edu.mssm.crover.domain2d.TwoEndsDomain
delta_end, delta_start, end, first, last, position, quickDraw, rgf, rgra, rmf, solver, start
Fields inherited from class edu.mssm.crover.domain2d.PrintablePanel
Fields inherited from class javax.swing.JComponent
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
ProteinSegmentDomain(ResidueModelFactory rmf, ResidueGlyphFactory rgf, ResidueGlyphRenderingAttributes rgra)
Method Summary
 java.awt.Point centerOf(java.awt.Component comp)
protected  void computePreferredSize()
 java.awt.geom.Point2D getDirection()
          Returns the direction of the spacer (normalized).
 int getEndResidueIndex()
 float getRadius()
          Returns the radius of the circle that represents this domain.
 java.awt.geom.Point2D getSpacer()
 int getStartResidueIndex()
 java.lang.String getURL()
          URL of the document linked to this ProteinSegmentDomain.
 void hideFirst(boolean hs)
          Loop spacer adustements require that the last residue of the last domain and the first residue of the next domain not to be displayed/controlled by the other domains.
 void hideLast(boolean hs)
          see hideFirst.
 void layoutResidues()
          Layout the residues in the domain.
 void paintComponent(java.awt.Graphics g)
 void setDirection(java.awt.geom.Point2D direction)
          Sets the direction vector for this domain.
 void setDragging(boolean state)
          Enable/disable the dragging of a domain.
 void setModel(ProteinSegmentModel model)
 void setRange(BiologicalSequence seq, int start, int end)
          Instructs the domain to render the part of sequence seq made of the residues between start and end, extremities included.
 void setSpacer(java.awt.geom.Point2D spacer)
          Sets the spacer of the protein domain.
 void setURL(java.lang.String URL)
          Sets the URL of a document to which this ProteinSegmentDomain links.
 void Update(java.util.Observable o, java.lang.Object arg)
Methods inherited from class edu.mssm.crover.domain2d.TwoEndsDraggableDomain
dispose, setDBSDebug, setListener
Methods inherited from class edu.mssm.crover.domain2d.TwoEndsDomain
calculateDeltas, connectEnd, connectPosition, connectStart, finalize, firstResiduePos, getComp, getComponent, getId, getLocation, getSurface, getX, getY, isOptimizedDrawingEnabled, lastResiduePos, paintBrushing, paintSelection, position, setId, setLocation, setLocation, suggestLocation, suggestLocation, syncLocation, update, useResidueModelFactory
Methods inherited from class edu.mssm.crover.domain2d.PrintablePanel
coolPrint, recurseSVGPrint, svgPrint
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.mssm.crover.domain2d.Domain2D
calculateDeltas, connectEnd, connectPosition, connectStart, dispose, firstResiduePos, getComp, getId, lastResiduePos, position, setId, useResidueModelFactory
Methods inherited from interface edu.mssm.crover.domain2d.Drawing
getComponent, getParent, getSurface, suggestLocation, suggestLocation
Methods inherited from interface java.util.Observer

Constructor Detail


public ProteinSegmentDomain()


public ProteinSegmentDomain(ResidueModelFactory rmf,
                            ResidueGlyphFactory rgf,
                            ResidueGlyphRenderingAttributes rgra)
Method Detail


public void setDragging(boolean state)
Description copied from interface: Domain2D
Enable/disable the dragging of a domain. Most of the time this is a convenient method to access the DBS model and turn the dragging on/off.

Specified by:
setDragging in interface Domain2D
See Also:


public void hideFirst(boolean hs)
Description copied from interface: Domain2D
Loop spacer adustements require that the last residue of the last domain and the first residue of the next domain not to be displayed/controlled by the other domains. To do so, the loop domain uses hideFirst and hideLast on its previous and follower domain.

Specified by:
hideFirst in interface Domain2D
hideFirst in class TwoEndsDomain


public void hideLast(boolean hs)
Description copied from interface: Domain2D
see hideFirst.

Specified by:
hideLast in interface Domain2D
hideLast in class TwoEndsDomain


public void setModel(ProteinSegmentModel model)


public java.awt.Point centerOf(java.awt.Component comp)


public void layoutResidues()
Description copied from interface: Domain2D
Layout the residues in the domain. Determine the size of the domain and set it. After this method has executed the positions of the first and last residue are know relatively to the domain position.

Specified by:
layoutResidues in interface Domain2D
See Also:
Domain2D.firstResiduePos(), Domain2D.lastResiduePos()


public void setRange(BiologicalSequence seq,
                     int start,
                     int end)
              throws InvalidRange
Description copied from interface: Domain2D
Instructs the domain to render the part of sequence seq made of the residues between start and end, extremities included.
Calling this method could be expensive as the number of residues may be altered and the layout recalculated. Implementors are advised to optimize their code to enable a dynamic adjustement of the range of the domain provided by the diagram editor (yet to be written). Interestingly, it has to be noted that this kind of dynamic adjustement is likely to translate the range over the sequence, add or remove a residue from the range. So some implementations can be choosen to accomodate these local changes that will reuse the previous layout and residues (from the previous invocation of setRange()).

Specified by:
setRange in interface Domain2D


public int getStartResidueIndex()


public int getEndResidueIndex()


public void setSpacer(java.awt.geom.Point2D spacer)
Sets the spacer of the protein domain. The spacer directly determines the dimensions of the rendering.

Specified by:
setSpacer in interface Domain2D


public java.awt.geom.Point2D getSpacer()


public void setDirection(java.awt.geom.Point2D direction)
Description copied from interface: Domain2D
Sets the direction vector for this domain. Some domain display depend on the value of direction (general direction of drawing), other do not. The choice is left to the domain implementor. Helices should adjust to allow rotations of the domain. Loops are highly constrained by surrounding domains and aesthetic constrained, so are unlikely to adjust their display to this parameter.

Specified by:
setDirection in interface Domain2D


public java.lang.String getURL()
URL of the document linked to this ProteinSegmentDomain. A url can be linked to this segment in one of two ways:
  • setURL was called previously
  • the PrintablePanelSVG_ANCHOR_HREF_PROPERTY property has been set on this JComponent segment.

    null or String encoding an URL.

  • setURL

    public void setURL(java.lang.String URL)
    Sets the URL of a document to which this ProteinSegmentDomain links. Also sets the client property SVG_ANCHOR_HREF_PROPERTY on this component so that PrintablePanel can create a link when exporting to SVG.


    public java.awt.geom.Point2D getDirection()
    Returns the direction of the spacer (normalized).

    Specified by:
    getDirection in interface Domain2D


    public float getRadius()
    Returns the radius of the circle that represents this domain.


    public void Update(java.util.Observable o,
                       java.lang.Object arg)


    public void paintComponent(java.awt.Graphics g)
    paintComponent in class javax.swing.JComponent


    protected void computePreferredSize()

    Copyright @ 2003 Mount Sinai School of Medicine. All Rights Reserved.