edu.mssm.crover.domain2d
Class ResidueGlyph

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--edu.mssm.crover.domain2d.PrintablePanel
                                |
                                +--edu.mssm.crover.domain2d.ResidueGlyph
All Implemented Interfaces:
javax.accessibility.Accessible, CoolPrint, Drawing, java.awt.image.ImageObserver, java.awt.MenuContainer, java.util.Observer, java.io.Serializable
Direct Known Subclasses:
EllipsisGlyph

public class ResidueGlyph
extends PrintablePanel
implements java.util.Observer, Drawing

A ResidueGlyph is the visual representation of a residue. Each instance represents a ResidueModel.

See Also:
Serialized Form

Field Summary
protected  int border
           
static int CIRCLE_SHAPE
          Circular shape.
protected  boolean numbering
           
static int OCTAGONAL_SHAPE
          Octagonal shape.
protected  ConstrainedPoint position
           
static int RECT_SHAPE
          rectangular shape.
protected  java.awt.Stroke singleLineStroke
           
 
Fields inherited from class edu.mssm.crover.domain2d.PrintablePanel
SVG_ANCHOR_HREF_PROPERTY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ResidueGlyph(ResidueModel sharedResidueModel)
          Builds a glyph with a border.
ResidueGlyph(ResidueModel sharedResidueModel, int border)
          Builds a glyph from a model.
 
Method Summary
 boolean contains(int x, int y)
          Redefines the clickable limit of the glyph component.
 void dispose()
          Dispose of this drawing.
protected  void finalize()
           
 ConstrainedPoint firstResiduePos()
           
 java.awt.Component getComponent()
          Returns the component associated with this drawing.
 ResidueModel getModel()
          Returns the model this glyph represents.
 java.awt.geom.Rectangle2D getRenderingBox()
          Returns the box in which the glyph rendering is being done.
 boolean getSelectionState()
          Gets the selection state.
 DrawingSurface getSurface()
          Returns null.
 ConstrainedPoint lastResiduePos()
           
 void paintComponent(java.awt.Graphics g)
           
 ConstrainedPoint position()
          Returns the position of this drawing, inside its direct container.
 void setDefaults(ResidueGlyphRenderingAttributes attributes)
          Reads and initialize the rendering attributes from the default attributes.
 void setDrawNumbering(boolean show)
           
 void setLocation(int x, int y)
           
 void setLocation(java.awt.Point p)
           
 void setModel(ResidueModel new_model)
          Sets the model this glyph represents.
 void setOutline(boolean outline)
          Select the outline drawing mode.
 void setSelected(boolean state)
          Sets the selection state.
 void suggestLocation(int x, int y)
          Suggest a new location for this drawing, inside its container.
 void suggestLocation(java.awt.Point p)
          Suggest a new location for this drawing, inside its container.
 void update(java.awt.Graphics g)
           
 void update(java.util.Observable o, java.lang.Object arg)
           
 
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, 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, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, 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
 
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, getLocation, 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.Drawing
getParent
 

Field Detail

border

protected int border

singleLineStroke

protected java.awt.Stroke singleLineStroke

CIRCLE_SHAPE

public static final int CIRCLE_SHAPE
Circular shape.

See Also:
Constant Field Values

RECT_SHAPE

public static final int RECT_SHAPE
rectangular shape.

See Also:
Constant Field Values

OCTAGONAL_SHAPE

public static final int OCTAGONAL_SHAPE
Octagonal shape. Not implemented.

See Also:
Constant Field Values

position

protected ConstrainedPoint position

numbering

protected boolean numbering
Constructor Detail

ResidueGlyph

public ResidueGlyph(ResidueModel sharedResidueModel)
Builds a glyph with a border. The border is the total component dimension from which is removed the glyph rendering (x0,y0) to (wg,hg).


ResidueGlyph

public ResidueGlyph(ResidueModel sharedResidueModel,
                    int border)
Builds a glyph from a model.

Method Detail

setDefaults

public void setDefaults(ResidueGlyphRenderingAttributes attributes)
Reads and initialize the rendering attributes from the default attributes.


getComponent

public java.awt.Component getComponent()
Description copied from interface: Drawing
Returns the component associated with this drawing.

Specified by:
getComponent in interface Drawing

setSelected

public void setSelected(boolean state)
Sets the selection state.


getSelectionState

public boolean getSelectionState()
Gets the selection state.

Returns:
true When the glyph is selected, false otherwise.

getModel

public ResidueModel getModel()
Returns the model this glyph represents.


setOutline

public void setOutline(boolean outline)
Select the outline drawing mode. The drawing shapes can be filled or simply outlined.

Parameters:
outline - True when outline mode is desired, false for filled shapes.

dispose

public void dispose()
Description copied from interface: Drawing
Dispose of this drawing. Frees all the ressources associated with the drawing, notify any observable the drawing registered with that it can be removed from the observer list.

Specified by:
dispose in interface Drawing

setModel

public void setModel(ResidueModel new_model)
Sets the model this glyph represents.


update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JComponent

paintComponent

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

setLocation

public void setLocation(int x,
                        int y)
Overrides:
setLocation in class java.awt.Component

setLocation

public void setLocation(java.awt.Point p)
Overrides:
setLocation in class java.awt.Component

position

public ConstrainedPoint position()
Description copied from interface: Drawing
Returns the position of this drawing, inside its direct container.

Specified by:
position in interface Drawing

firstResiduePos

public ConstrainedPoint firstResiduePos()

lastResiduePos

public ConstrainedPoint lastResiduePos()

getSurface

public DrawingSurface getSurface()
Returns null. getSurface is used by he BrushingMouseListener to force a repaint of the DrawingSurface when the dragging just finished. Dragging a ResidueGlyph does not require to repaint the whole surface in these circumstances, but exception (last residue of a loop or domain which spacer depends on this position). For these exceptions, inherit from this class and override getSurface to return the domain's getSurface result.

Specified by:
getSurface in interface Drawing
See Also:
for details .

suggestLocation

public void suggestLocation(java.awt.Point p)
Description copied from interface: Drawing
Suggest a new location for this drawing, inside its container.

Specified by:
suggestLocation in interface Drawing

suggestLocation

public void suggestLocation(int x,
                            int y)
Description copied from interface: Drawing
Suggest a new location for this drawing, inside its container.

Specified by:
suggestLocation in interface Drawing

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable

setDrawNumbering

public void setDrawNumbering(boolean show)

getRenderingBox

public java.awt.geom.Rectangle2D getRenderingBox()
Returns the box in which the glyph rendering is being done. This box excludes the border of the residue glyph. This duplicates ResidueGlyphFactory.getRenderingBox() and should return the same rectangle when all the glyphs are the same size.


contains

public boolean contains(int x,
                        int y)
Redefines the clickable limit of the glyph component. The new limit matches the rendering box of this residue glyph.

Overrides:
contains in class javax.swing.JComponent
Returns:
True when the point (x,y) lies inside the rendering box, False otherwise.


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