PIRL.Viewers

## Class Draggable_Rows

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JLayeredPane
        - - PIRL.Viewers.Draggable_Rows

All Implemented Interfaces:
  ImageObserver, MenuContainer, Serializable, Accessible

    public class Draggable_Rows
    extends JLayeredPane

Draggable_Rows manages the display of Components as a stack of draggable rows.

A Draggable_Rows_Layout is used to maintain the display of the components as a single column of rows. All components, regardless of the layer they have been assigned to, are displayed in top-to-bottom order. Any components may be used as row components. These components may have their own functionality, including subcomponents.

A MouseInputListener is attached to the base pane and to each row component and any subcomponents it might have. Whenever a mouse button is pressed in the pane the row component that it falls within is designated the `selected row` and any `registered list selection listeners` are notified. If the shift key modifier is also used then the selected row may be dragged vertically to a new row position. Any `registered row move listeners` are notified whenever the position of a row changes.

See Also:
  `JLayeredPane`, Serialized Form

### Nested Class Summary

Nested Classes
`class` `Draggable_Rows.Draggable_Rows_Layout` Draggable_Rows_Layout is a LayoutManager for a vertical stack of row Components.
`class` `Draggable_Rows.Row_Moved_Event` A Row_Moved_Event carries the information that a component row has moved from one position to another in the pane.

### Nested classes/interfaces inherited from class javax.swing.JLayeredPane

`JLayeredPane.AccessibleJLayeredPane`

### Nested classes/interfaces inherited from class javax.swing.JComponent

`JComponent.AccessibleJComponent`

### Nested classes/interfaces inherited from class java.awt.Container

`Container.AccessibleAWTContainer`

### Nested classes/interfaces inherited from class java.awt.Component

`Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

### Field Summary

Fields
`static String` `ID` Class name and version identification.
`Draggable_Rows.Draggable_Rows_Layout` `Layout_Manager`
`Component` `Selected_Row`

### Fields inherited from class javax.swing.JLayeredPane

`DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER`

### 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

Constructors
Constructor and Description
`Draggable_Rows()` Constructs an empty Draggable_Rows pane.
`Draggable_Rows(Vector rows)` Constructs a Draggable_Rows pane containing a list of row components.

### Method Summary

Methods
`Draggable_Rows` `Add_Row_Moved_Listener(ChangeListener listener)` Adds a row moved listener.
`Draggable_Rows` `Add_Selection_Listener(ListSelectionListener listener)` Adds a list selection listener.
`protected void` `addImpl(Component component, Object constraints, int index)` Adds a component to the pane.
`boolean` `Remove_Row_Moved_Listener(ChangeListener listener)` Removes a row moved listener.
`boolean` `Remove_Selection_Listener(ChangeListener listener)` Removes a list selection listener.
`void` `remove(int index)` Removes an indexed row component from the pane.
`static Point` `Screen_Point(MouseEvent event)` Gets the location of a mouse event relative to the coordinates of the display screen.
`Component` `Selected_Row()` Gets the currently selected row component.
`Draggable_Rows` `Selected_Row(Component component)` Sets the currently selected row component.
`Point` `this_Point(MouseEvent event)` Gets the location of a mouse event relative to the coordinates of this pane.

### Methods inherited from class javax.swing.JLayeredPane

`getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, removeAll, setLayer, setLayer, setPosition`

### 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### ID

    public static final String ID

Class name and version identification.

See Also:
  Constant Field Values

#### Layout_Manager

    public Draggable_Rows.Draggable_Rows_Layout Layout_Manager

#### Selected_Row

    public Component Selected_Row

### Constructor Detail

#### Draggable_Rows

    public Draggable_Rows(Vector rows)

Constructs a Draggable_Rows pane containing a list of row components.

The row components will be be displayed top-to-bottom in the order they occur in the list.

Parameters:
  `rows` - A Vector of Components to be added to the pane.

#### Draggable_Rows

    public Draggable_Rows()

Constructs an empty Draggable_Rows pane.

### Method Detail

#### Selected_Row

    public Draggable_Rows Selected_Row(Component component)

Sets the currently selected row component.

If the specified component is a row component it is selected. Each `registered selection listener` is notified of the change. The ListSelectionEvent sent to each listener will contain this Draggable_Rows as the source and the index of the selected component (for both first and last index). However, because the index of a component might change, (@link #Selected_Row()} is the best way to obtain the currently selected row component.

Parameters:
  `component` - The row component to be selected. If the component is not a row component, or is null, nothing is done.
Returns:
  This Draggable_Rows.

#### Selected_Row

    public Component Selected_Row()

Gets the currently selected row component.

Returns:
  The selected row Component. This will be null if not component is selected.
See Also:
  `Selected_Row(Component)`

#### Add_Selection_Listener

    public Draggable_Rows Add_Selection_Listener(ListSelectionListener listener)

Adds a list selection listener.

Each registered listener is notified whenever the row selection changes.

Parameters:
  `listener` - A ListSelectionListener that will have its valueChanged method called whenever the row selection changes. A duplicate or null listener is not added.
Returns:
  This Draggable_Rows.
See Also:
  `ListSelectionListener`

#### Remove_Selection_Listener

    public boolean Remove_Selection_Listener(ChangeListener listener)

Removes a list selection listener.

Parameters:
  `listener` - The ListSelectionListener to be removed.
Returns:
  true If the listener was removed; false if it was not registered.
See Also:
  `Add_Selection_Listener(ListSelectionListener)`

#### Add_Row_Moved_Listener

    public Draggable_Rows Add_Row_Moved_Listener(ChangeListener listener)

Adds a row moved listener.

Each registered listener is notified whenever a row position changes.

Parameters:
  `listener` - A ChangeListener that will have its stateChanged method called whenever a row position changes. A duplicate or null listener is not added.
Returns:
  This Draggable_Rows.
See Also:
  `ChangeListener`

#### Remove_Row_Moved_Listener

    public boolean Remove_Row_Moved_Listener(ChangeListener listener)

Removes a row moved listener.

Parameters:
  `listener` - The ChangeListener to be removed.
Returns:
  true If the listener was removed; false if it was not registered.
See Also:
  `Add_Row_Moved_Listener(ChangeListener)`

#### remove

    public void remove(int index)

Removes an indexed row component from the pane.

Before the component is removed from the pane it, and any subcomponents, has this pane's mouse event listener removed. If the component being removed is the currently selected row, the `selected row` is reset to null.

Overrides:
  `remove` in class `JLayeredPane`
Parameters:
  `index` - The index of the component to remove. An invalid index is ignored.

#### addImpl

    protected void addImpl(Component component,
               Object constraints,
               int index)

Adds a component to the pane.

Before the component is added, this pane's mouse event listener is added to the component and any subcomponents it might have. The listener is not added if the component is already contained in this pane.

Overrides:
  `addImpl` in class `JLayeredPane`
Parameters:
  `component` - The Component to be added.
  `constraints` - Layout contraints. This is expected to be a layer number Integer.
  `index` - The position in the container's list at which to insert the component, where -1 means append to the end.

#### this_Point

    public Point this_Point(MouseEvent event)

Gets the location of a mouse event relative to the coordinates of this pane.

The event's location point is translated from the coordinates of the event's component to the coordinates of this pane.

Parameters:
  `event` - A MouseEvent.
Returns:
  The mouse event location in this pane's coordinate space.
See Also:
  `SwingUtilities.convertPoint(Component, Point, Component)`

#### Screen_Point

    public static Point Screen_Point(MouseEvent event)

Gets the location of a mouse event relative to the coordinates of the display screen.

The event's location point is translated from the coordinates of the event's component to the coordinates of the display screen.

Parameters:
  `event` - A MouseEvent.
Returns:
  The mouse event location in the display screen's coordinate space.
See Also:
  `SwingUtilities.convertPointToScreen(Point, Component)`