com.denova.ui
Class ListEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.denova.ui.ListEditor
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable
Direct Known Subclasses:
FileGroupsListEditor

public class ListEditor
extends javax.swing.JPanel
implements java.lang.Runnable

Edit a list. Defaults to a list of strings.
For other object types override the functions:

Author:
DeNova Copyright © 1997-2008 DeNova All rights reserved worldwide.
See Also:
Serialized Form

Field Summary
 
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
ListEditor()
          Manage a list through a Swing GUI.
 
Method Summary
protected  java.lang.Object addItem()
           
protected  java.util.List addItems()
           
protected  java.lang.Object editItem(java.lang.Object item)
           
 void fromString(java.lang.String s)
          Convert the single string to an array list of strings.
 javax.swing.JButton getAddButton()
          Gets the Add button.
 javax.swing.JButton getDeleteButton()
          Gets the Delete button.
 javax.swing.JButton getEditButton()
          Gets the Edit button.
 java.util.Vector getItems()
          Gets the items.
 javax.swing.JList getList()
          Gets the list of items.
 boolean isEditingItemsEnabled()
          Gets whether the user can edit the items in the list.
protected  boolean isItemDeletable(java.lang.Object item)
           
 void run()
           
 void setEditingItemsEnabled(boolean editingItemsEnabled)
          Sets whether the user can edit the items in the list.
 void setItems(java.util.Vector newItems)
          Sets the items to appear in the list.
 void showDialog()
          Displays the dialog box to the user without a title.
 void showDialog(java.lang.String title)
          Displays the dialog box to the user with a title.
 java.lang.String toString()
          Convert each group to a string.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
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, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListEditor

public ListEditor()
Manage a list through a Swing GUI.

Method Detail

setItems

public void setItems(java.util.Vector newItems)
Sets the items to appear in the list.

Parameters:
newItems - is an array list of items in the list

getItems

public java.util.Vector getItems()
Gets the items.

Returns:
the items in the list as an array list.

getList

public javax.swing.JList getList()
Gets the list of items.

Returns:
the items in the list as a JList.

getAddButton

public javax.swing.JButton getAddButton()
Gets the Add button.

Returns:
the Add button as a JButton so you can manage it (e.g., enable, disable, etc.)

getEditButton

public javax.swing.JButton getEditButton()
Gets the Edit button.

Returns:
the Edit button as a JButton so you can manage it (e.g., enable, disable, etc.)

getDeleteButton

public javax.swing.JButton getDeleteButton()
Gets the Delete button.

Returns:
the Delete button as a JButton so you can manage it (e.g., enable, disable, etc.)

addItems

protected java.util.List addItems()

addItem

protected java.lang.Object addItem()

editItem

protected java.lang.Object editItem(java.lang.Object item)

isItemDeletable

protected boolean isItemDeletable(java.lang.Object item)

isEditingItemsEnabled

public boolean isEditingItemsEnabled()
Gets whether the user can edit the items in the list.

Returns:
true if the user can edit the items.

setEditingItemsEnabled

public void setEditingItemsEnabled(boolean editingItemsEnabled)
Sets whether the user can edit the items in the list.

Parameters:
editingItemsEnabled - true if the user can edit the items

toString

public java.lang.String toString()
Convert each group to a string.

After the conversion add the strings to an array list of strings, and then convert that array list to a single string.

Overrides:
toString in class java.awt.Component
Returns:
The entire list of groups as a single string.

fromString

public void fromString(java.lang.String s)
Convert the single string to an array list of strings.

Then convert each of those strings to a group, and add the groups to an array list.

Parameters:
s - the string that contains all the groups.

run

public void run()
Specified by:
run in interface java.lang.Runnable

showDialog

public void showDialog()
Displays the dialog box to the user without a title.


showDialog

public void showDialog(java.lang.String title)
Displays the dialog box to the user with a title.

Parameters:
title - the title for the dialog box