arlut.csd.ganymede.client
Class querybox

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--javax.swing.JDialog
                                |
                                +--arlut.csd.ganymede.client.querybox
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

class querybox
extends javax.swing.JDialog
implements java.awt.event.ActionListener, java.awt.event.ItemListener

This class implements a modal dialog that is popped up to generate a Query object that will be used by the rest of the ganymede.client package to submit the query to the server for handling.

Once an instance of querybox is constructed, the client code will call myShow() to pop up the dialog and retrieve the Query object.

If the user chooses not to submit a Query after all, myShow() will return null.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Inner classes inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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 addButton
           
(package private)  javax.swing.JCheckBox allBox
           
(package private)  javax.swing.JComboBox baseChoice
           
private  java.util.Hashtable baseIDHash
           
(package private)  java.lang.String baseName
           
(package private)  javax.swing.JButton CancelButton
           
(package private)  java.awt.CardLayout card_layout
           
(package private)  javax.swing.JPanel card_panel
           
(package private) static boolean debug
           
(package private)  javax.swing.JCheckBox editBox
           
(package private)  boolean editOnly
           
(package private)  java.util.Vector fieldChoices
           
private  java.util.Hashtable fieldHash
           
(package private)  java.util.Vector fields
           
(package private)  java.awt.GridBagConstraints gbc
           
(package private)  java.awt.GridBagLayout gbl
           
(package private)  gclient gc
           
(package private)  javax.swing.JPanel inner_choice
           
private  java.util.Hashtable myHash
           
private  java.util.Hashtable nameHash
           
(package private)  javax.swing.JButton OkButton
           
(package private)  OptionsPanel optionsPanel
           
(package private)  Query query
           
(package private)  javax.swing.JPanel query_Buttons
           
(package private)  javax.swing.JPanel query_panel
           
(package private)  java.awt.Image queryIcon
           
(package private)  javax.swing.JButton removeButton
           
(package private)  javax.swing.JPanel returnedPanel
           
(package private)  java.util.Vector Rows
           
(package private)  BaseDump selectedBase
           
(package private)  java.util.Hashtable shortHash
           
(package private)  boolean showAllItems
           
(package private)  javax.swing.JTabbedPane tabPane
           
(package private)  javax.swing.JPanel titledPanel
           
 
Fields inherited from class javax.swing.JDialog
accessibleContext, defaultCloseOperation, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
base, keepBlocking, modal, nameCounter, resizable, serialVersionUID, title
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, state, warningString, weakThis, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, 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, name, 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 javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
querybox(BaseDump defaultBase, gclient gc, java.awt.Frame parent, java.lang.String DialogTitle)
          Primary constructor.
querybox(gclient gc, java.awt.Frame parent, java.lang.String myTitle)
          Alternate Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This is the standard ActionListener callback method.
private  void addRow()
           
private  Query createQuery()
          This internal method takes the current state of the rows in the main query composition panel and generates an appropriate Query structure from them.

Note that this is a private method..
private  void doQuery()
           
(package private)  BaseDump getBaseFromName(java.lang.String name)
           
(package private)  BaseDump getBaseFromShort(short id)
           
(package private)  BaseDump getBaseFromShort(java.lang.Short id)
           
private  void getEmbedded(java.util.Vector fields, java.lang.String basePrefix, java.lang.Short lowestBase, java.util.Vector Embedded)
          A companion to the prior resetFieldChoices method.
(package private)  java.lang.String getFieldFromEmbedded(java.lang.String name)
           
(package private)  java.lang.Short getIdFromName(java.lang.String name)
          This method returns the Short id of the Base that corresponds to the field with name <name>.

This is used to support embedded fields..
(package private)  FieldTemplate getTemplateFromName(java.lang.String name)
           
 void itemStateChanged(java.awt.event.ItemEvent e)
          This is the standard ItemListener callback method.
private  void mapBaseNamesToTemplates(short id)
           
(package private)  void mapEmbeddedToField(java.lang.String name, java.lang.String fieldName)
           
(package private)  void mapNameToBase(java.lang.String name, BaseDump base)
           
private  void mapNameToId(java.lang.String name, java.lang.Short id)
          This method maps the name of a (possibly embedded) field to the Short id of the Base that it belongs to.

This is used to support embedded fields..
(package private)  void mapNameToTemplate(java.lang.String name, FieldTemplate template)
           
 void myshow()
          This is the main interface to the querybox, and is used to synchronously display the querybox and return the Query generated by it.

private  void removeRow()
           
private  void resetFieldChoices()
          This method updates the fieldChoices vector to contain a list of Strings corresponding to fields in the selectedBase that can be chosen in QueryRow's.
 Query setFields(Query someQuery)
          This method sets what fields should be returned by the Query.
private  void unregister()
          This method makes sure that any JdateField's contained in the querybox pop down their calendar dialogs.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, createRootPaneException, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setLocationRelativeTo, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
, addNotify, conditionalShow, constructComponentName, dispose, disposeImpl, getTitle, hide, hideAndDisposeHandler, initIDs, interruptBlocking, isModal, isResizable, setModal, setResizable, setTitle, show
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, eventEnabled, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postProcessKeyEvent, postWindowEvent, preProcessKeyEvent, processEvent, readObject, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, toBack, toFront, transferFocus, writeObject
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

debug

static final boolean debug

tabPane

javax.swing.JTabbedPane tabPane

optionsPanel

OptionsPanel optionsPanel

gc

gclient gc

shortHash

java.util.Hashtable shortHash

baseIDHash

private java.util.Hashtable baseIDHash

fieldHash

private java.util.Hashtable fieldHash

nameHash

private java.util.Hashtable nameHash

myHash

private java.util.Hashtable myHash

OkButton

javax.swing.JButton OkButton

CancelButton

javax.swing.JButton CancelButton

addButton

javax.swing.JButton addButton

removeButton

javax.swing.JButton removeButton

gbl

java.awt.GridBagLayout gbl

gbc

java.awt.GridBagConstraints gbc

titledPanel

javax.swing.JPanel titledPanel

returnedPanel

javax.swing.JPanel returnedPanel

query_Buttons

javax.swing.JPanel query_Buttons

card_panel

javax.swing.JPanel card_panel

query_panel

javax.swing.JPanel query_panel

inner_choice

javax.swing.JPanel inner_choice

editBox

javax.swing.JCheckBox editBox

allBox

javax.swing.JCheckBox allBox

baseChoice

javax.swing.JComboBox baseChoice

card_layout

java.awt.CardLayout card_layout

fieldChoices

java.util.Vector fieldChoices

Rows

java.util.Vector Rows

fields

java.util.Vector fields

selectedBase

BaseDump selectedBase

baseName

java.lang.String baseName

editOnly

boolean editOnly

showAllItems

boolean showAllItems

query

Query query

queryIcon

java.awt.Image queryIcon
Constructor Detail

querybox

public querybox(BaseDump defaultBase,
                gclient gc,
                java.awt.Frame parent,
                java.lang.String DialogTitle)
Primary constructor.
Parameters:
defaultBase - The object base that will be initially selected. May be null.
gc - A gclient used to get access to client caches
parent - The frame that this querybox is to be connected to.
DialogTitle - The title for this dialog.

querybox

public querybox(gclient gc,
                java.awt.Frame parent,
                java.lang.String myTitle)
Alternate Constructor. Used when no default query is provided
Parameters:
gc - A gclient used to get access to client caches
parent - The frame that this querybox is to be connected to.
DialogTitle - The title for this dialog.
Method Detail

myshow

public void myshow()
This is the main interface to the querybox, and is used to synchronously display the querybox and return the Query generated by it.


resetFieldChoices

private void resetFieldChoices()
This method updates the fieldChoices vector to contain a list of Strings corresponding to fields in the selectedBase that can be chosen in QueryRow's. We are a little fancy here, in that we include fields from embedded objects.

getEmbedded

private void getEmbedded(java.util.Vector fields,
                         java.lang.String basePrefix,
                         java.lang.Short lowestBase,
                         java.util.Vector Embedded)
A companion to the prior resetFieldChoices method. It allows fields with references to embedded objects to display the appropriate sub-fields. It is a recursive method, and can handle any number of layers of embedding. The fields are stored in a 'global' vector (as strings)

createQuery

private Query createQuery()
This internal method takes the current state of the rows in the main query composition panel and generates an appropriate Query structure from them.

Note that this is a private method.. our 'Ok' handler will call this method before hiding this dialog, at which time myShow will return the Query produced by this method.

setFields

public Query setFields(Query someQuery)
This method sets what fields should be returned by the Query. Note that this should only be called if the user has explicitly requested a non-standard list of return fields, as the server will automatically hide a bunch of undesired fields if we have not called addField() on a newly constructed Query object.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This is the standard ActionListener callback method. This method catches events from the various buttons used by querybox.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener

doQuery

private void doQuery()

unregister

private void unregister()
This method makes sure that any JdateField's contained in the querybox pop down their calendar dialogs.

removeRow

private void removeRow()

addRow

private void addRow()

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
This is the standard ItemListener callback method. This method catches events from Checkboxes and various choice components.
Specified by:
itemStateChanged in interface java.awt.event.ItemListener
See Also:
ItemListener

mapNameToId

private void mapNameToId(java.lang.String name,
                         java.lang.Short id)
This method maps the name of a (possibly embedded) field to the Short id of the Base that it belongs to.

This is used to support embedded fields.. as getEmbedded() recurses down through the embedded base hierarchy under selectedBase, it records the Base for each embedded field as it goes along creating names for the embedded fields.

getIdFromName

java.lang.Short getIdFromName(java.lang.String name)
This method returns the Short id of the Base that corresponds to the field with name <name>.

This is used to support embedded fields.. as getEmbedded() recurses down through the embedded base hierarchy under selectedBase, it records the Base for each embedded field as it goes along creating names for the embedded fields.

mapBaseNamesToTemplates

private void mapBaseNamesToTemplates(short id)

mapNameToTemplate

void mapNameToTemplate(java.lang.String name,
                       FieldTemplate template)

getTemplateFromName

FieldTemplate getTemplateFromName(java.lang.String name)

mapEmbeddedToField

void mapEmbeddedToField(java.lang.String name,
                        java.lang.String fieldName)

getFieldFromEmbedded

java.lang.String getFieldFromEmbedded(java.lang.String name)

mapNameToBase

void mapNameToBase(java.lang.String name,
                   BaseDump base)

getBaseFromName

BaseDump getBaseFromName(java.lang.String name)

getBaseFromShort

BaseDump getBaseFromShort(java.lang.Short id)

getBaseFromShort

BaseDump getBaseFromShort(short id)