artoflife pre0.1.0-dev

org.artoflife.gui.scope
Class IndividualImagePanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.artoflife.gui.scope.IndividualImagePanel
All Implemented Interfaces:
java.util.EventListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, org.scopemvc.view.util.ModelBindable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, org.scopemvc.core.PropertyView, org.scopemvc.view.swing.Refreshable, java.io.Serializable, org.scopemvc.core.View
Direct Known Subclasses:
ScalableIndividualImagePanel

public class IndividualImagePanel
extends javax.swing.JComponent
implements org.scopemvc.core.PropertyView, org.scopemvc.view.util.ModelBindable, org.scopemvc.view.swing.Refreshable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.ItemSelectable

A bound Scope component that binds to an Individual model property and paints its PaintablePhenotype as an Image filling the panel.

Fires Controls on single and double mouse clicks. Also fires ItemEvent on single-click.

Acts as a drag source but not a drop target.

Author:
Steve Meyfroidt
See Also:
Serialized Form
To do:
have another property to paint the image as "selected" in which case draw images with margins else can't outline with selection border

Field Summary
protected static int BORDER_WIDTH
          Size of border round each record in pixels.
protected  java.awt.event.ItemListener itemListener
          Support firing ItemEvents when click this panel.
 
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
IndividualImagePanel()
           
 
Method Summary
 void addItemListener(java.awt.event.ItemListener l)
           
 java.lang.Object getBoundModel()
           
 org.scopemvc.core.Controller getController()
           
 java.awt.Point getDragOffset()
           
protected  java.awt.Dimension getImageSize()
           
 java.lang.Object[] getSelectedObjects()
           
 org.scopemvc.core.Selector getSelector()
           
 java.lang.Object getViewValue()
           
 java.awt.Dimension getVisibleImageSize()
          Method getImageSize.
 boolean isAntialias()
           
 boolean isSelected()
           
 void issueControl(org.scopemvc.core.Control control)
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Fire ActionEvent when double-clicked (control's parameter is the individual).
 void mouseDragged(java.awt.event.MouseEvent e)
          Recognise drags by looking for a MousePressed followed by MouseDrag for a certain time after the press.
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
          Change selected and fire Control when pressed (single-clicked).
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics g)
           
protected  void processItemEvent(java.awt.event.ItemEvent e)
           
 void refresh()
           
 void removeItemListener(java.awt.event.ItemListener l)
           
 void setAntialias(boolean antialias)
           
 void setBoundModel(java.lang.Object inModel)
           
 void setController(org.scopemvc.core.Controller controller)
           
 void setDoubleClickControlId(java.lang.String controlId)
           
 void setSelected(boolean selected)
           
 void setSelector(org.scopemvc.core.Selector inSelector)
           
 void setSelectorString(java.lang.String inSelectorString)
           
 void setSingleClickControlId(java.lang.String controlId)
           
 void updateFromProperty(java.lang.Object inValue, boolean inReadOnly)
           
 void validationFailed(java.lang.Exception inException)
           
 void validationSuccess()
           
 
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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BORDER_WIDTH

protected static final int BORDER_WIDTH
Size of border round each record in pixels. Selection borders are painted here.

See Also:
Constant Field Values

itemListener

protected transient java.awt.event.ItemListener itemListener
Support firing ItemEvents when click this panel.

Constructor Detail

IndividualImagePanel

public IndividualImagePanel()
Method Detail

getBoundModel

public final java.lang.Object getBoundModel()
Specified by:
getBoundModel in interface org.scopemvc.core.View

setBoundModel

public final void setBoundModel(java.lang.Object inModel)
Specified by:
setBoundModel in interface org.scopemvc.core.View

getSelector

public final org.scopemvc.core.Selector getSelector()
Specified by:
getSelector in interface org.scopemvc.core.PropertyView

setSelector

public final void setSelector(org.scopemvc.core.Selector inSelector)
Specified by:
setSelector in interface org.scopemvc.core.PropertyView

setSelectorString

public final void setSelectorString(java.lang.String inSelectorString)

updateFromProperty

public void updateFromProperty(java.lang.Object inValue,
                               boolean inReadOnly)
Specified by:
updateFromProperty in interface org.scopemvc.view.util.ModelBindable
Parameters:
inValue - is an Image to display, or null
inReadOnly - ignored

getViewValue

public java.lang.Object getViewValue()
Specified by:
getViewValue in interface org.scopemvc.view.util.ModelBindable

validationFailed

public void validationFailed(java.lang.Exception inException)
Specified by:
validationFailed in interface org.scopemvc.view.util.ModelBindable

validationSuccess

public void validationSuccess()
Specified by:
validationSuccess in interface org.scopemvc.view.util.ModelBindable

setController

public void setController(org.scopemvc.core.Controller controller)
Specified by:
setController in interface org.scopemvc.core.View

getController

public org.scopemvc.core.Controller getController()
Specified by:
getController in interface org.scopemvc.core.View

issueControl

public void issueControl(org.scopemvc.core.Control control)
Specified by:
issueControl in interface org.scopemvc.core.View

refresh

public void refresh()
Specified by:
refresh in interface org.scopemvc.view.swing.Refreshable

paint

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

getImageSize

protected java.awt.Dimension getImageSize()

isAntialias

public boolean isAntialias()

setAntialias

public void setAntialias(boolean antialias)

isSelected

public boolean isSelected()

setSelected

public void setSelected(boolean selected)

setSingleClickControlId

public void setSingleClickControlId(java.lang.String controlId)

setDoubleClickControlId

public void setDoubleClickControlId(java.lang.String controlId)

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Change selected and fire Control when pressed (single-clicked). Also record the timestamp of this event which might signal the start of a drag.

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Fire ActionEvent when double-clicked (control's parameter is the individual). Single-clicks are implicitly handled during mousePressed in order to ensure that there is a selection if dragging is initiated after mousePressed.

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Recognise drags by looking for a MousePressed followed by MouseDrag for a certain time after the press.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

getVisibleImageSize

public java.awt.Dimension getVisibleImageSize()
Method getImageSize.

Returns:
Dimension

getDragOffset

public java.awt.Point getDragOffset()

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
Specified by:
addItemListener in interface java.awt.ItemSelectable

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
Specified by:
removeItemListener in interface java.awt.ItemSelectable

processItemEvent

protected void processItemEvent(java.awt.event.ItemEvent e)

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable
Returns:
array of length 1 containing shown Individual
See Also:
ItemSelectable.getSelectedObjects()

artoflife pre0.1.0-dev

Copyright © 2002 the Art Of Life team. All Rights Reserved.