Package com.actelion.research.gui
Class CompoundCollectionPane<T>
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JScrollPane
-
- com.actelion.research.gui.CompoundCollectionPane<T>
-
- All Implemented Interfaces:
CompoundCollectionListener
,StructureListener
,java.awt.event.ActionListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.ScrollPaneConstants
public class CompoundCollectionPane<T> extends javax.swing.JScrollPane implements java.awt.event.ActionListener, CompoundCollectionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, StructureListener
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description static int
FILE_SUPPORT_NONE
static int
FILE_SUPPORT_OPEN_AND_SAVE_FILES
static int
FILE_SUPPORT_OPEN_FILES
static int
FILE_SUPPORT_SAVE_FILES
-
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
-
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
-
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
-
-
Constructor Summary
Constructors Constructor Description CompoundCollectionPane(CompoundCollectionModel<T> model, boolean isVertical)
This is a visual component to display and edit a compound collection maintained by a CompoundCollectionModel.CompoundCollectionPane(CompoundCollectionModel<T> model, boolean isVertical, int displayMode, int dragAction, int dropAction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
void
collectionUpdated(int fromIndex, int toIndex)
IClipboardHandler
getClipboardHandler()
CompoundCollectionModel<T>
getModel()
void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseDragged(java.awt.event.MouseEvent e)
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)
void
mouseReleased(java.awt.event.MouseEvent e)
void
setClipboardHandler(IClipboardHandler h)
call this in order to get clipboard supportvoid
setCompoundFilter(MoleculeFilter filter)
void
setCreateFragments(boolean createFragments)
Defines whether new created structures are fragments of molecules.void
setEditable(boolean editable)
Defines, whether the list and individual structures can be edited.void
setEnabled(boolean b)
void
setFileSupport(int fileSupport)
Defines, whether the popup menu contains 'Open' and/or 'Save' items.void
setInternalDragAndDropIsMove(boolean b)
Defines the behaviour for internal drag&drop.void
setSelectable(boolean selectable)
void
setSelection(int molIndex)
May be overridden to act on selection changesvoid
setShowValidationError(boolean showError)
Defines whether a large red question mark is shown in case of a structure validation error.void
setStructureSize(int size)
Defines the width or height of individual structure cells, depending on whether the the CompoundCollectionPane is horizontal or vertical, respectively.void
structureChanged(StereoMolecule mol)
-
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
FILE_SUPPORT_NONE
public static final int FILE_SUPPORT_NONE
- See Also:
- Constant Field Values
-
FILE_SUPPORT_OPEN_FILES
public static final int FILE_SUPPORT_OPEN_FILES
- See Also:
- Constant Field Values
-
FILE_SUPPORT_SAVE_FILES
public static final int FILE_SUPPORT_SAVE_FILES
- See Also:
- Constant Field Values
-
FILE_SUPPORT_OPEN_AND_SAVE_FILES
public static final int FILE_SUPPORT_OPEN_AND_SAVE_FILES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompoundCollectionPane
public CompoundCollectionPane(CompoundCollectionModel<T> model, boolean isVertical)
This is a visual component to display and edit a compound collection maintained by a CompoundCollectionModel. Three variations of DefaultCompoundCollectionModel (.Native, .Molecule, and .IDCode) are available, which internally keep molecule instances as Object, StereoMolecule or String, respectively. If one of these default model is used, than the CompoundCollectionPane's T must match this class.- Parameters:
model
-isVertical
-
-
CompoundCollectionPane
public CompoundCollectionPane(CompoundCollectionModel<T> model, boolean isVertical, int displayMode, int dragAction, int dropAction)
-
-
Method Detail
-
getModel
public CompoundCollectionModel<T> getModel()
-
setEnabled
public void setEnabled(boolean b)
- Overrides:
setEnabled
in classjavax.swing.JComponent
-
setInternalDragAndDropIsMove
public void setInternalDragAndDropIsMove(boolean b)
Defines the behaviour for internal drag&drop. The default is false, which means that a dragged structure is copied to the new internal position.- Parameters:
b
-
-
setStructureSize
public void setStructureSize(int size)
Defines the width or height of individual structure cells, depending on whether the the CompoundCollectionPane is horizontal or vertical, respectively. Setting size to 0 (default) causes an automatic behavior with a square cell areas and width and height being implicitly defined by the CompoundCollectionPane component size.
-
setEditable
public void setEditable(boolean editable)
Defines, whether the list and individual structures can be edited.- Parameters:
editable
-
-
setFileSupport
public void setFileSupport(int fileSupport)
Defines, whether the popup menu contains 'Open' and/or 'Save' items. As default both, OPEN and SAVE options are active.- Parameters:
fileSupport
- one of the FILE_SUPPORT_... options
-
setCompoundFilter
public void setCompoundFilter(MoleculeFilter filter)
-
setSelectable
public void setSelectable(boolean selectable)
-
setCreateFragments
public void setCreateFragments(boolean createFragments)
Defines whether new created structures are fragments of molecules.- Parameters:
createFragments
-
-
setShowValidationError
public void setShowValidationError(boolean showError)
Defines whether a large red question mark is shown in case of a structure validation error.- Parameters:
showError
-
-
setClipboardHandler
public void setClipboardHandler(IClipboardHandler h)
call this in order to get clipboard support
-
getClipboardHandler
public IClipboardHandler getClipboardHandler()
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
collectionUpdated
public void collectionUpdated(int fromIndex, int toIndex)
- Specified by:
collectionUpdated
in interfaceCompoundCollectionListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
structureChanged
public void structureChanged(StereoMolecule mol)
- Specified by:
structureChanged
in interfaceStructureListener
-
setSelection
public void setSelection(int molIndex)
May be overridden to act on selection changes- Parameters:
molIndex
-
-
-