de.esprit.common.gui

## Class ZList<E>

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JList<E>
        - - de.esprit.common.gui.ZList<E>

- All Implemented Interfaces:
    Steppable, Clearable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.Scrollable
  Direct Known Subclasses:
    ActivityList, ClientList, ClientZList, DBRecordList, EmailAddrList, JavaVersionList, PathRegistrationList

      public class ZList<E>
      extends javax.swing.JList<E>
      implements Clearable, Steppable

  This is JList provides a set of standard Actions (see getActionXX()). Furthermore you may set an action that is fired on a double-click. The list implements `Steppable` so that you can attach a Stepper Gui.
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JList

      `javax.swing.JList.AccessibleJList, javax.swing.JList.DropLocation`

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

      `javax.swing.JComponent.AccessibleJComponent`

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

      `java.awt.Container.AccessibleAWTContainer`

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

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

  - ### Field Summary

    - ### Fields inherited from class javax.swing.JList

      `HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP`

    - ### 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
    `ZList()`
    `ZList(ZListModel<E> model)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAllItems(java.util.Collection items)`
    `void` | `addAllItems(E[] items)`
    `void` | `addIndexChangeListener(IndexChangeEvent.Listener l)`
    `int` | `addItem(E item)`
    `int` | `addItem(int index, E item)`
    `void` | `addListDataListener(javax.swing.event.ListDataListener l)`
    `void` | `adjustSelection(int rowIndex)` Adjusts the selection such that the given index is selected.
    `void` | `clear()` Clears the content
    `boolean` | `contains(java.lang.Object obj)`
    `protected javax.swing.ListSelectionModel` | `createSelectionModel()`
    `protected void` | `doOnDoubleClick(java.util.List<E> selectedItems)` This method is called when a mouse double-click was detected on the list component.
    `void` | `first()`
    `ZAction` | `getActionClear()`
    `ZAction` | `getActionDelete()`
    `ZAction` | `getActionMoveDown()`
    `ZAction` | `getActionMoveUp()`
    `java.util.List<E>` | `getAllItems()`
    `java.util.Comparator` | `getComparator()`
    `int` | `getCurrentIndex()`
    `E` | `getFirstItem()`
    `java.lang.Object` | `getItem(int index)`
    `int` | `getItemCount()`
    `E` | `getLastItem()`
    `ZListModel<E>` | `getModel()`
    `ModifyFlag` | `getModifyFlag()`
    `int` | `getRecordCount()`
    `E` | `getSelectedItem()`
    `java.util.List<E>` | `getSelectedItems()` Returns the selected Objects as an array.
    `IndexSelectionModel` | `getSelectionModel()`
    `boolean` | `hasMultipleSelection()`
    `boolean` | `hasSingleSelection()`
    `int` | `indexOf(java.lang.Object item)` Returns the index of the first occurrence of the given object.
    `boolean` | `isChangeConfirmed()`
    `boolean` | `isEmpty()`
    `boolean` | `isLocked()`
    `boolean` | `isModified()`
    `boolean` | `isNumb()` Tells whether the ListModel is in numb state
    `boolean` | `isSortAscending()`
    `void` | `last()`
    `void` | `load()`
    `void` | `loadFrom(java.util.Collection<E> objects)`
    `void` | `loadFrom(E[] objects)`
    `protected boolean` | `matchesTypedString(java.lang.Object obj, java.lang.String typedStr)`
    `boolean` | `next()`
    `boolean` | `previous()`
    `void` | `removeIndexChangeListener(IndexChangeEvent.Listener l)`
    `int` | `removeItem(E item)` Deletes the given object reference from the list.
    `int` | `removeItem(E item, boolean isAdjustSelection)` Same as `removeItem(Object)` but adjusts the selection to the next available object.
    `void` | `removeItem(int index)` Deletes the object at the given index from the list.
    `void` | `removeItem(int index, boolean isAdjustSelection)` Same as `removeItem(int)` but adjusts the selection to the next available object.
    `void` | `removeListDataListener(javax.swing.event.ListDataListener l)`
    `void` | `removeSelectedItem(boolean isAdjustSelection)`
    `int` | `replaceItem(E item)` Replaces the item in the list.
    `int` | `replaceOrAddItem(E item)` Replaces the item in the list or adds it if it could not be found.
    `void` | `scrollToRow(int rowIndex)` Scrolls to the given row index to make it visible.
    `void` | `selectAllItems()`
    `void` | `selectItem(E item)`
    `void` | `selectItem(int index)`
    `void` | `selectItems(E[] items)`
    `void` | `selectItems(java.util.List<E> items)`
    `void` | `setComparator(java.util.Comparator cmp)`
    `boolean` | `setCurrentIndex(int i)`
    `void` | `setDoubleClickAction(java.awt.event.ActionListener doubleClickListener)` Adds a listener to react on double clicks.
    `void` | `setItem(int index, E item)` Sets the item at the given index
    `void` | `setLocked(boolean isLocked)`
    `void` | `setModified(boolean state)`
    `void` | `setModifyFlag(ModifyFlag flag)`
    `void` | `setNumb(boolean isNumb)` Sets the underlying ListModel in a numb state where it does not fire any events.
    `void` | `setSelectedIndex(int index)` Allows for programmatically selecting an item at the specified index.
    `void` | `setSelectionMode(ListSelectionMode mode)`
    `void` | `setSortAscending(boolean isAscending)`

    - ### Methods inherited from class javax.swing.JList

      `addListSelectionListener, addSelectionInterval, clearSelection, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectedValuesList, getSelectionBackground, getSelectionForeground, getSelectionMode, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setEnabled, 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, 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`

- - ### Constructor Detail

    - #### ZList

          public ZList()

    - #### ZList

          public ZList(ZListModel<E> model)

  - ### Method Detail

    - #### hasSingleSelection

          public final boolean hasSingleSelection()

    - #### hasMultipleSelection

          public final boolean hasMultipleSelection()

    - #### setSelectionMode

          public final void setSelectionMode(ListSelectionMode mode)

    - #### isSortAscending

          public final boolean isSortAscending()

    - #### setSortAscending

          public final void setSortAscending(boolean isAscending)

    - #### setComparator

          public final void setComparator(java.util.Comparator cmp)

    - #### getComparator

          public final java.util.Comparator getComparator()

    - #### getActionDelete

          public final ZAction getActionDelete()

    - #### getActionClear

          public final ZAction getActionClear()

    - #### getActionMoveUp

          public final ZAction getActionMoveUp()

    - #### getActionMoveDown

          public final ZAction getActionMoveDown()

    - #### createSelectionModel

          protected final javax.swing.ListSelectionModel createSelectionModel()

      Overrides:
        `createSelectionModel` in class `javax.swing.JList<E>`

    - #### getSelectionModel

          public final IndexSelectionModel getSelectionModel()

      Overrides:
        `getSelectionModel` in class `javax.swing.JList<E>`

    - #### addIndexChangeListener

          public final void addIndexChangeListener(IndexChangeEvent.Listener l)

      Specified by:
        `addIndexChangeListener` in interface `Steppable`

    - #### removeIndexChangeListener

          public final void removeIndexChangeListener(IndexChangeEvent.Listener l)

    - #### getModel

          public ZListModel<E> getModel()

      Overrides:
        `getModel` in class `javax.swing.JList<E>`

    - #### getModifyFlag

          public final ModifyFlag getModifyFlag()

    - #### getItem

          public final java.lang.Object getItem(int index)

    - #### getFirstItem

          public final E getFirstItem()

    - #### getLastItem

          public final E getLastItem()

    - #### getAllItems

          public final java.util.List<E> getAllItems()

    - #### setModifyFlag

          public final void setModifyFlag(ModifyFlag flag)

    - #### setModified

          public final void setModified(boolean state)

    - #### isModified

          public final boolean isModified()

    - #### load

          public void load()
                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### loadFrom

          public void loadFrom(java.util.Collection<E> objects)

    - #### loadFrom

          public void loadFrom(E[] objects)

    - #### isEmpty

          public final boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Steppable`

    - #### getItemCount

          public final int getItemCount()

    - #### contains

          public final boolean contains(java.lang.Object obj)

    - #### clear

          public void clear()

      Description copied from interface: `Clearable`
      Clears the content
      Specified by:
        `clear` in interface `Clearable`

    - #### addAllItems

          public final void addAllItems(java.util.Collection items)

    - #### addAllItems

          public void addAllItems(E[] items)

    - #### addItem

          public int addItem(E item)

    - #### addItem

          public int addItem(int index,
                    E item)

    - #### replaceItem

          public final int replaceItem(E item)

      Replaces the item in the list.
      Returns:
        the index where the item was added or replaced.

    - #### replaceOrAddItem

          public final int replaceOrAddItem(E item)

      Replaces the item in the list or adds it if it could not be found.
      Returns:
        true if the item was found in the list.

    - #### setItem

          public final void setItem(int index,
                     E item)

      Sets the item at the given index

    - #### removeItem

          public int removeItem(E item)

      Deletes the given object reference from the list.
      Returns:
        the index where the item was found

    - #### removeItem

          public int removeItem(E item,
                       boolean isAdjustSelection)

      Same as `removeItem(Object)` but adjusts the selection to the next available object.

    - #### removeItem

          public void removeItem(int index)

      Deletes the object at the given index from the list. Any selection is adjusted accordingly.

    - #### removeItem

          public void removeItem(int index,
                        boolean isAdjustSelection)

      Same as `removeItem(int)` but adjusts the selection to the next available object.

    - #### removeSelectedItem

          public final void removeSelectedItem(boolean isAdjustSelection)

    - #### indexOf

          public final int indexOf(java.lang.Object item)

      Returns the index of the first occurrence of the given object.

    - #### adjustSelection

          public final void adjustSelection(int rowIndex)

      Adjusts the selection such that the given index is selected. If the given index does not exist (due to removal of an item) and a previous item exists, then that one will be selected.

    - #### setSelectedIndex

          public final void setSelectedIndex(int index)

      Allows for programmatically selecting an item at the specified index. The list will automatically scroll to the selected item to make it visible.
      Overrides:
        `setSelectedIndex` in class `javax.swing.JList<E>`

    - #### getSelectedItem

          public final E getSelectedItem()

    - #### getSelectedItems

          public final java.util.List<E> getSelectedItems()

      Returns the selected Objects as an array.

    - #### selectItem

          public final void selectItem(int index)

    - #### selectItem

          public final void selectItem(E item)

    - #### selectItems

          public final void selectItems(java.util.List<E> items)

    - #### selectItems

          public final void selectItems(E[] items)

    - #### selectAllItems

          public final void selectAllItems()

    - #### setLocked

          public final void setLocked(boolean isLocked)

    - #### isLocked

          public final boolean isLocked()

    - #### setNumb

          public final void setNumb(boolean isNumb)

      Sets the underlying ListModel in a numb state where it does not fire any events. This increases performance in mass-manipulations

    - #### isNumb

          public final boolean isNumb()

      Tells whether the ListModel is in numb state

    - #### setDoubleClickAction

          public final void setDoubleClickAction(java.awt.event.ActionListener doubleClickListener)

      Adds a listener to react on double clicks.

    - #### addListDataListener

          public final void addListDataListener(javax.swing.event.ListDataListener l)

    - #### removeListDataListener

          public final void removeListDataListener(javax.swing.event.ListDataListener l)

    - #### matchesTypedString

          protected boolean matchesTypedString(java.lang.Object obj,
                                   java.lang.String typedStr)

    - #### getRecordCount

          public int getRecordCount()

      Specified by:
        `getRecordCount` in interface `Steppable`

    - #### isChangeConfirmed

          public boolean isChangeConfirmed()

      Specified by:
        `isChangeConfirmed` in interface `Steppable`

    - #### first

          public void first()

      Specified by:
        `first` in interface `Steppable`

    - #### last

          public void last()

      Specified by:
        `last` in interface `Steppable`

    - #### next

          public boolean next()

      Specified by:
        `next` in interface `Steppable`

    - #### previous

          public boolean previous()

      Specified by:
        `previous` in interface `Steppable`

    - #### setCurrentIndex

          public boolean setCurrentIndex(int i)

      Specified by:
        `setCurrentIndex` in interface `Steppable`

    - #### getCurrentIndex

          public int getCurrentIndex()

      Specified by:
        `getCurrentIndex` in interface `Steppable`

    - #### scrollToRow

          public final void scrollToRow(int rowIndex)

      Scrolls to the given row index to make it visible.

    - #### doOnDoubleClick

          protected void doOnDoubleClick(java.util.List<E> selectedItems)

      This method is called when a mouse double-click was detected on the list component.
      Parameters:
        `selectedItems` - the values currently selected in the list.

Copyright © 2014 EsprIT-Systems. All Rights Reserved.