arlut.csd.ganymede.client
Class vectorPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--arlut.csd.ganymede.client.vectorPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, JsetValueCallback, java.awt.MenuContainer, java.awt.event.MouseListener, java.lang.Runnable, java.io.Serializable

public class vectorPanel
extends javax.swing.JPanel
implements JsetValueCallback, java.awt.event.ActionListener, java.awt.event.MouseListener, java.lang.Runnable

A GUI vector panel that is designed to be placed inside a containerPanel within the client. This vector panel is intended to support vectors of discrete GUI components that are mapped to elements in a server-side vector db_field, but right now it only supports IP Address fields and edit-in-place containerPanels. Most of the code in this class is dedicated to handling vectors of embedded containerPanels.

Whatever sort of GUI components/database elements this vectorPanel is managing, all GUI components will be wrapped by elementWrapper's, which are responsible for hiding and revealing the GUI component on the user's command.

vectorPanel handles communications with the server to manage the server-side db_field.

See Also:
elementWrapper, containerPanel, invid_field, ip_field, Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  javax.swing.JButton addB
          Button used to add a new element to the vector
(package private)  javax.swing.JPanel centerPanel
          centerPanel holds all of the elementWrappers in a BoxLayout
(package private)  boolean centerPanelAdded
           
(package private)  javax.swing.JMenuItem closeAllMI
           
(package private)  javax.swing.JMenuItem closeLevelMI
           
(package private)  java.util.Vector compVector
          Vector of GUI components held in this vectorPanel.
(package private)  containerPanel container
          Reference to the containerPanel that we are embedded in.
(package private)  boolean debug
           
(package private)  boolean editable
           
(package private)  java.util.Hashtable ewHash
          Hash mapping GUI components added to this vectorPanel to the elementWrappers holding them.
(package private)  javax.swing.JMenuItem expandAllMI
           
(package private)  javax.swing.JMenuItem expandLevelMI
           
(package private)  gclient gc
          Reference to the client's main class.
(package private)  boolean isCreating
           
(package private)  boolean isEditInPlace
           
private  db_field my_field
          Reference to server-side vector invid_field or ip_field.
private  java.lang.Boolean myFieldIsEditable
          Boolean to track editability status of the vector field we are connected to.
(package private)  java.lang.String name
          The name of the invid field we are managing
(package private)  javax.swing.JPopupMenu popupMenu
          Pop-up menu appears when you right-click anywhere inside the panel
protected  windowPanel wp
          Reference to the desktop pane containing the client's internal windows.
 
Fields inherited from class javax.swing.JPanel
defaultLayout, uiClassID
 
Fields inherited from class javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
vectorPanel(db_field field, windowPanel parent, boolean editable, boolean isEditInPlace, containerPanel container, boolean isCreating)
          Constructor
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addElement(java.awt.Component c)
          Adds a new element to the vectorPanel.
 void addElement(java.awt.Component c, boolean invalidateNow)
          Adds a new element to the vectorPanel.
 void addElement(java.lang.String title, java.awt.Component c)
          Adds a new element to the vectorPanel.
 void addElement(java.lang.String title, java.awt.Component c, boolean expand)
          Adds a new element to the vectorPanel.
 void addElement(java.lang.String title, java.awt.Component c, boolean expand, boolean invalidateNow)
          Add a new element to the vectorPanel.
 void addNewElement()
          Creates a new element in the vector db_field this vectorPanel is connected to.
 boolean changeElement(java.lang.Object obj, short index)
          Server dispatch method for value change messages passed us by elementWrappers.
 void closeLevels(boolean recursive)
          Close all the levels
private  void createVectorComponents()
          Talks to the server and populates this vectorPanel with elements corresponding to values held in my_field.
 void deleteElement(elementWrapper ew)
          Removes an element from the vector panel.
 void expandAllLevels()
          Expand all the levels.
 void expandLevels(boolean recursive)
          Expands all closed elementWrappers in this vectorPanel
 boolean isFieldEditable()
          Returns true if the vector field we are connected to is editable.
 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)
          Pop-up menu dispatch.
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void refresh()
          Refreshes the vectorPanel.
 void run()
          This just calls expandAllLevels..
private  void setNormalCursor()
           
private  void setStatus(java.lang.String status)
           
 boolean setValuePerformed(JValueObject v)
          JsetValueCallback implementation method.
private  void setWaitCursor()
           
private  void showErrorMessage(java.lang.String message)
           
private  void showPopupMenu(int x, int y)
           
 
Methods inherited from class javax.swing.JPanel
, getAccessibleContext, getUIClassID, paramString, updateUI, writeObject
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

debug

boolean debug

compVector

java.util.Vector compVector
Vector of GUI components held in this vectorPanel. This vector contains the actual GUI components added to this vector, not the elementWrappers.

myFieldIsEditable

private java.lang.Boolean myFieldIsEditable
Boolean to track editability status of the vector field we are connected to. This member is a Boolean instead of a boolean so that we can distinguish between false and unknown (null).

name

java.lang.String name
The name of the invid field we are managing

ewHash

java.util.Hashtable ewHash
Hash mapping GUI components added to this vectorPanel to the elementWrappers holding them. Used to update the elementWrappers' titles in response to changes in the fields connected to the components.

addB

javax.swing.JButton addB
Button used to add a new element to the vector

centerPanel

javax.swing.JPanel centerPanel
centerPanel holds all of the elementWrappers in a BoxLayout

editable

boolean editable

isEditInPlace

boolean isEditInPlace

centerPanelAdded

boolean centerPanelAdded

my_field

private db_field my_field
Reference to server-side vector invid_field or ip_field. This vectorPanel will communicate with the Ganymede server using this reference to make changes to the vector field.

wp

protected windowPanel wp
Reference to the desktop pane containing the client's internal windows. Used to access some GUI resources and to provide to new containerPanels created for embedded objects.

container

containerPanel container
Reference to the containerPanel that we are embedded in.

gc

gclient gc
Reference to the client's main class.

popupMenu

javax.swing.JPopupMenu popupMenu
Pop-up menu appears when you right-click anywhere inside the panel

closeLevelMI

javax.swing.JMenuItem closeLevelMI

expandLevelMI

javax.swing.JMenuItem expandLevelMI

closeAllMI

javax.swing.JMenuItem closeAllMI

expandAllMI

javax.swing.JMenuItem expandAllMI

isCreating

boolean isCreating
Constructor Detail

vectorPanel

public vectorPanel(db_field field,
                   windowPanel parent,
                   boolean editable,
                   boolean isEditInPlace,
                   containerPanel container,
                   boolean isCreating)
Constructor
Parameters:
field - db_field for this vectorPanel
parent - windowPanel above this vectorPanel
editable - True if field is editable
isEditInPlace - True if object is editInPlace. If this is false, it will make a vector of IPFields.
container - containerPanel this vectorPanel is in
Method Detail

showPopupMenu

private void showPopupMenu(int x,
                           int y)

createVectorComponents

private void createVectorComponents()

Talks to the server and populates this vectorPanel with elements corresponding to values held in my_field. Only called on vectorPanel construction.


addNewElement

public void addNewElement()

Creates a new element in the vector db_field this vectorPanel is connected to. Creates and adds the GUI component for the new element to the vectorPanel.

This is called when the add button is clicked, but there is no reason why it couldn't be called from other places if you wanted to add a new element.


addElement

public void addElement(java.awt.Component c)

Adds a new element to the vectorPanel.

This element gets the default title, and will not be opened in expanded form.

The vectorPanel will be revalidated to trigger a GUI refresh after this element is added.

Parameters:
c - Component to be added

addElement

public void addElement(java.awt.Component c,
                       boolean invalidateNow)

Adds a new element to the vectorPanel.

This element gets the default title, and will not be expanded immediately.

Parameters:
c - Component to be added
invalidateNow - If true, invalidate()/validate() will be called. When adding several components all at once, set this to false.

addElement

public void addElement(java.lang.String title,
                       java.awt.Component c)

Adds a new element to the vectorPanel.

The vectorPanel will be revalidated to trigger a GUI refresh after this element is added.

Parameters:
title - String used in the "title" of the elementWrapper
c - Component to be added

addElement

public void addElement(java.lang.String title,
                       java.awt.Component c,
                       boolean expand)

Adds a new element to the vectorPanel.

This element will be immediately expanded if <expand> is true.

The vectorPanel will be revalidated to trigger a GUI refresh after this element is added.

Parameters:
title - String used in the "title" of the elementWrapper
c - Component to be added
expand - If true, the element will appear pre-opened

addElement

public void addElement(java.lang.String title,
                       java.awt.Component c,
                       boolean expand,
                       boolean invalidateNow)
Add a new element to the vectorPanel.
Parameters:
title - String used in the "title" of the elementWrapper
c - Component to be added
expand - If true, the elementWrapper will be expanded immediately after creation
invalidateNow - If true, invalidate()/validate() will be called. When adding several components all at once, set this to false.

deleteElement

public void deleteElement(elementWrapper ew)
Removes an element from the vector panel.
Parameters:
ew - Component to be removed.

refresh

public void refresh()

Refreshes the vectorPanel.

This will refresh every containerPanel and IPField in this vectorPanel, and will add or remove entries as needed to bring this vectorPanel into synchronization with the field on the server that this vectorPanel is attached to.

New containerPanel elements will always be added to the end of the vector.. we aren't worried about the order of the vector we're handling, just the values and the proper association between the GUI component and the server field.


expandAllLevels

public void expandAllLevels()
Expand all the levels.

expandLevels

public void expandLevels(boolean recursive)

Expands all closed elementWrappers in this vectorPanel

Parameters:
recursive - If true, it will expand any vector panels inside the containerPanels in this vectorPanel as well. The current implementation opens up each level with a separate thread, which may well not be the best way of doing this from a performance/safety perspective.

run

public void run()
This just calls expandAllLevels.. for use in threading this out.
Specified by:
run in interface java.lang.Runnable

closeLevels

public void closeLevels(boolean recursive)
Close all the levels
Parameters:
recursive - If true, close all vectorPanels inside this vectorPanel. This one never spawns another thread.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

setValuePerformed

public boolean setValuePerformed(JValueObject v)

JsetValueCallback implementation method. Any elementWrappers we contain will talk to us using this method, to notify us of element deletion and to pass information to us about IP field value changes.

Specified by:
setValuePerformed in interface JsetValueCallback
Following copied from interface: arlut.csd.JDataComponent.JsetValueCallback
Returns:
true if the callback accepted the change and the GUI component should go ahead and display the change made by the user.

changeElement

public boolean changeElement(java.lang.Object obj,
                             short index)
                      throws java.rmi.RemoteException

Server dispatch method for value change messages passed us by elementWrappers.

Currently used only for IP fields, as embedded containerPanels communicate their field changes directly to the server.


mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Pop-up menu dispatch.
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

setStatus

private final void setStatus(java.lang.String status)

setNormalCursor

private final void setNormalCursor()

setWaitCursor

private final void setWaitCursor()

showErrorMessage

private final void showErrorMessage(java.lang.String message)

isFieldEditable

public boolean isFieldEditable()

Returns true if the vector field we are connected to is editable.

This method will call the server to query the field the first time it is called. It will return the cached result thereafter.