|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel issrg.utils.gui.xml.AddDelList
public abstract class AddDelList
This class is an abstract class and is a general purpose list editing component. Implements methods from ActionListener, ListSelectionListener and MouseListener.
This class extends a JPanel, and places a JListBox and three
JButton
s for adding/deleting/modifying entries in the listBox.
It is designed as an abstract class so that each class that uses it will, specify its own needs for adding/deleting/modifying.
This Class is one of the Basic Building blocks of the Policy Editor, as many classes implement it in some way or another.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
javax.swing.JButton |
addButton
The Add Button Variable |
javax.swing.JPanel |
addDisplay
Panels needed in order to construct the final output of the AddDelList. |
java.awt.GridBagConstraints |
constraints
Constraints for the GridBagLayout. |
javax.swing.JButton |
deleteButton
The Delete Button Variable |
javax.swing.JPanel |
deleteDisplay
Panels needed in order to construct the final output of the AddDelList. |
javax.swing.JMenuItem[] |
items
List of Items that appear in the popupMenu. |
javax.swing.JList |
listBox
The List Box Variable |
javax.swing.JPanel |
listBoxDisplay
Panels needed in order to construct the final output of the AddDelList. |
protected java.lang.String[] |
listData
The Data Elements Contained in the listBox, initialised to zero, so as not to have available selections in the listbox, when the list is empty. |
javax.swing.JPopupMenu |
popupMenu
A pop-up Menu, that appears on right clicking in the ListBox. |
javax.swing.JButton |
replaceButton
The Replace Button Variable |
javax.swing.JPanel |
replaceDisplay
Panels needed in order to construct the final output of the AddDelList. |
javax.swing.JScrollPane |
scrollList
Scroll Pane Variable, to enable list scrolling |
protected static int |
sizeOfPopupMenu
Declaration that the size of the popup menu used is going to be of 1 item. |
javax.swing.JPanel |
viewDisplay
Panels needed in order to construct the final output of the AddDelList. |
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 | |
---|---|
AddDelList()
Sets the Layout for this GUI Component, and adds the contents created in the getContentPanel() method. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent av)
On clicking of a button the respective abstract methods are then called. |
void |
addComponent(java.awt.Component component,
javax.swing.JPanel pane,
int row,
int column,
int width,
int height,
int anchor,
double weightx,
double weighty,
int fill)
Method that adds a component to a JPanel when the Layout is of GridBagLayout Type. |
abstract void |
addItem()
An abstract method that is called when an item is to be added to a list. |
int |
convertYToRow(int y)
Method that given the Y-Coordinate, will return the corresponding value in the JList (listBox) |
abstract void |
deleteItem()
An abstract method that is called when an item is to be removed from a list. |
javax.swing.JPanel |
getContentPanel()
A JPanel containing the basic panel. |
java.lang.String[] |
getListData()
A method that gets the data of the list component. |
int |
getSelectedIndex()
Returns the Selected index of the List Component |
abstract void |
itemSelected()
An abstract method that is called when an item is Selected from a list. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
javax.swing.JPanel |
removeAddButton()
A method to remove the Add Button from the panel given by the getContentPanel() method. |
javax.swing.JPanel |
removeDeleteButton()
A method to remove the Delete Button from the panel given by the getContentPanel() method. |
javax.swing.JPanel |
removeListBox()
A method to remove the listBox JList from the panel given by the getContentPanel() method. |
javax.swing.JPanel |
removeReplaceButton()
A method to remove the Replace Button from the panel given by the getContentPanel() method. |
abstract void |
replaceItem()
An abstract method that is called when an item is to be replaced from a list. |
void |
setCaption(java.lang.String internalName,
java.lang.String internationalName)
Sets the text the component will show. |
void |
setListData(java.lang.String[] arguments)
A method that sets the data to be displayed in the list component |
void |
setSelectedIndex(int idx)
Sets the Selected index of the List Component |
void |
valueChanged(javax.swing.event.ListSelectionEvent e)
When a list selection occurs this method is executed, and updates the functionality of the buttons in order to specify what the user can / can not press. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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, 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, 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, hide, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public javax.swing.JButton addButton
public javax.swing.JButton deleteButton
public javax.swing.JButton replaceButton
public javax.swing.JList listBox
public javax.swing.JScrollPane scrollList
public javax.swing.JPanel viewDisplay
public javax.swing.JPanel addDisplay
public javax.swing.JPanel deleteDisplay
public javax.swing.JPanel replaceDisplay
public javax.swing.JPanel listBoxDisplay
public javax.swing.JPopupMenu popupMenu
public javax.swing.JMenuItem[] items
This was implemented, as to clear Selection from a list may be hard or impossible, when the rows in the list are full (Even when the scroll bar can be used).
protected static int sizeOfPopupMenu
public java.awt.GridBagConstraints constraints
protected java.lang.String[] listData
Constructor Detail |
---|
public AddDelList()
Method Detail |
---|
public javax.swing.JPanel getContentPanel()
public void valueChanged(javax.swing.event.ListSelectionEvent e)
valueChanged
in interface javax.swing.event.ListSelectionListener
e
- the ListSelectionEventpublic abstract void itemSelected()
public abstract void addItem()
public abstract void replaceItem()
public abstract void deleteItem()
public void actionPerformed(java.awt.event.ActionEvent av)
The ListBox can also be made to clear its selection, by right clicking on the listbox and clicking on the clear selection pop up menu.
actionPerformed
in interface java.awt.event.ActionListener
public int convertYToRow(int y)
y
- The Y-Coordinate.
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public javax.swing.JPanel removeAddButton()
public javax.swing.JPanel removeReplaceButton()
public javax.swing.JPanel removeDeleteButton()
public javax.swing.JPanel removeListBox()
public void setCaption(java.lang.String internalName, java.lang.String internationalName)
internalName
- The internal name used in the program.internationalName
- The international name to set the text to.public void setListData(java.lang.String[] arguments)
arguments
- An array of strings to set the List Data.public java.lang.String[] getListData()
public int getSelectedIndex()
public void setSelectedIndex(int idx)
idx
- An integer with the wanted index of the selected Value in the List.public void addComponent(java.awt.Component component, javax.swing.JPanel pane, int row, int column, int width, int height, int anchor, double weightx, double weighty, int fill)
component
- The component to add the the JPanel.pane
- The JPanel to add the component on.row
- The Row to start placing the component in.column
- The Column to start placing the component in.width
- The amount of rows the component can be placed on.height
- The amount of columns the component can be placed on.anchor
- The anchor GridBagLayout constraints.weightx
- The proportion to grow in the x direction.weighty
- The proportion to grow in the y direction.fill
- The Directions GridBagLayout Constant for which to fill.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |