|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
PIRL.Viewers.Draggable_Rows
public class Draggable_Rows
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.
JLayeredPane
,
Serialized FormNested Class Summary | |
---|---|
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 | |
---|---|
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 | |
---|---|
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 | |
---|---|
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ID
public Draggable_Rows.Draggable_Rows_Layout Layout_Manager
public Component Selected_Row
Constructor Detail |
---|
public Draggable_Rows(Vector rows)
The row components will be be displayed top-to-bottom in the order they occur in the list.
rows
- A Vector of Components to be added to the pane.public Draggable_Rows()
Method Detail |
---|
public Draggable_Rows Selected_Row(Component 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.
component
- The row component to be selected. If the component
is not a row component, or is null, nothing is done.
public Component Selected_Row()
Selected_Row(Component)
public Draggable_Rows Add_Selection_Listener(ListSelectionListener listener)
Each registered listener is notified whenever the row selection changes.
listener
- A ListSelectionListener that will have its
valueChanged method called whenever the row selection changes. A
duplicate or null listener is not added.
ListSelectionListener
public boolean Remove_Selection_Listener(ChangeListener listener)
listener
- The ListSelectionListener to be removed.
Add_Selection_Listener(ListSelectionListener)
public Draggable_Rows Add_Row_Moved_Listener(ChangeListener listener)
Each registered listener is notified whenever a row position changes.
listener
- A ChangeListener that will have its
stateChanged method called whenever a row position changes. A
duplicate or null listener is not added.
ChangeListener
public boolean Remove_Row_Moved_Listener(ChangeListener listener)
listener
- The ChangeListener to be removed.
Add_Row_Moved_Listener(ChangeListener)
public void remove(int index)
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.
remove
in class JLayeredPane
index
- The index of the component to remove. An invalid
index is ignored.protected void addImpl(Component component, Object constraints, int index)
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.
addImpl
in class JLayeredPane
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.public Point this_Point(MouseEvent event)
The event's location point is translated from the coordinates of the event's component to the coordinates of this pane.
event
- A MouseEvent.
SwingUtilities.convertPoint(Component, Point, Component)
public static Point Screen_Point(MouseEvent event)
The event's location point is translated from the coordinates of the event's component to the coordinates of the display screen.
event
- A MouseEvent.
SwingUtilities.convertPointToScreen(Point, Component)
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |