stella.jview
Class JDatabaseDisplay

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by jview.JExitFrame
                          extended by jview.JConfirmExitFrame
                              extended by jview.JBorderFrame
                                  extended by jview.JOpenFrame
                                      extended by jview.JClientFrame
                                          extended by stella.jview.JMasterDisplay
                                              extended by stella.jview.JDatabaseDisplay
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, Remote, EventListener, Accessible, RootPaneContainer, WindowConstants, BorderLabels, ClientLabels, Displayable, PickListener, PsqlTables, ClientObject, ExitCleaning, Initializable, LocalizedAware, LocalizedComposed, Refreshing
Direct Known Subclasses:
JHeaderDisplay, JObjectDisplay, JParameterDisplay, JPhotometryDisplay, JResultsPanel

public abstract class JDatabaseDisplay
extends JMasterDisplay
implements PsqlTables

A class that allows acces to a database, retriving a single data set as a result of a user pick select. The unique ID is used as a select clause and this class provides the data to its daughters. Currently, two tables are accessible:

If the unique identifier makes the where clause
 String unique = pick.getUnique();
 if (unique==null||unique.length()==0) {
     getStatusField().error("No unique field in this pick");
     return true;
 }
 String where = getComposedProperties().getProperty(KEY_OBJID)+
         "='"+unique+"'";
 
If the object name should be processed,
 String unique  = pick.getUnique();
    if (unique == null || unique.length() == 0) {
       getStatusField().error("No unique field in this pick");
       return true;
    }
    String object = lookUp(unique, "done.object", "done", "done.objid")
    String where = getComposedProperties().getProperty(KEY_OBJECT)+
    "='"+object+"'";
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class stella.jview.JMasterDisplay
JMasterDisplay.Show
 
Nested classes/interfaces inherited from class jview.JClientFrame
JClientFrame.ClientListener
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static String DEFUSERNAME
          Default user name for the table.
static String ISODATE
          To allow date formats.
static String KEY_USERNAME
          The key to the user name for db-acces if not default.
 
Fields inherited from class stella.jview.JMasterDisplay
KEY_BINDNAME, KEY_DISABLEWHILELOAD, KEY_REFRESH, KEY_ROBOTPROPS, KEY_ROBOTSEQUENCE, KEY_SWITCHMONITOR, KEY_TELESCOPECHAR
 
Fields inherited from class jview.JClientFrame
CONNECTACTION, DISCONNECTACTION, KEY_CONNECTONINIT, KEY_ICONCONNECT, KEY_ICONDISCONNECT
 
Fields inherited from class jview.JOpenFrame
EMPTYACTION, EXITACTION, EXPORTACTION, KEY_FILEACTIONS, KEY_FILEHOME, OPENACTION, PRINTACTION, SAVEACTION
 
Fields inherited from class jview.JBorderFrame
DATACLEANSE, KEY_ABOUTURL, KEY_ACTIONCLASS, KEY_AIPLOGO, KEY_BIGGERSTRUT, KEY_DATAANALYSER, KEY_EASTALIGNMENT, KEY_FITTERS, KEY_FITTERTIPS, KEY_HELPSIZE, KEY_LESSERSTRUT, KEY_NOLOGO, KEY_NORTHALIGNMENT, KEY_SOUTHALIGNMENT, KEY_WESTALIGNMENT, MODELFITTER
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface stella.sql.PsqlTables
DEFDONETABLE, DEFENVTABLE, DEFOBJID, DEFOBSTABLE, DEFPERMISSIONTABLE, DEFPROPOSALTABLE, DEFREDUCEDTABLE, DEFTARGETTABLE, DEFTASKTABLE, DEFUSERTABLE, KEY_DONETABLE, KEY_ENVTABLE, KEY_OBJID, KEY_OBSTABLE, KEY_PERMISSIONTABLE, KEY_PROPOSALTABLE, KEY_REDUCEDTABLE, KEY_TARGETTABLE, KEY_TASKTABLE, KEY_USERTABLE
 
Fields inherited from interface jview.ClientLabels
KEY_CONNECTERROR, KEY_CONNECTTITLE, KEY_DISCONNECTERROR
 
Fields inherited from interface jview.BorderLabels
KEY_ABOUT, KEY_ABOUTACC, KEY_FILEACCS, KEY_FILEITEMS, KEY_FILEMENU, KEY_FILEMNEMONIC, KEY_HELPMENU, KEY_HELPMNEMONIC, KEY_HELPTITLE, KEY_NOHELP, KEY_NOURLACCESS, KEY_TITLE
 
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
protected JDatabaseDisplay(LocalizedSupplying prop)
          Constructs a generic peripheral from a property container.
protected JDatabaseDisplay(Map<String,String> prop)
          Constructs a generic peripheral from a property container.
 
Method Summary
protected abstract  Map<String,Method> getRequestedFields()
          This method retrieves a mapping of requested data field names to accessor methods.
protected  Map<String,String> getRequestedNames(Set<String> requestkeys)
          In SQL, column names have to be augmented with a leading table name plus '.', if there are equally named columns in the tables queried.
protected  Method getResultSetMethod(String name)
          Returns the method in the result set with the given name, catches exception.
protected abstract  String getTableName()
          Subclasses may override here and suplly multiple table names for joins.
protected  String getUserName()
           
protected  String lookUp(String unique, String uniquecolumn, String table, String lookup)
          Looks up a key in a database.
protected  boolean processExternally(HistoryAware.Pick pick)
          This method should never be called.
protected  Map<String,List<Object>> queryDatabase(String where)
          This method is called from subclasses if they want to retrieve data from the database.
protected  Map<String,List<Object>> queryDatabase(String where, String table)
          This method is called from subclasses if they want to retrieve data from the database.
protected  Map<String,List<Object>> queryDatabase(String where, String table, String order)
          This method is called from subclasses if they want to retrieve data from the database.
protected  Map<String,List<Object>> queryDatabase(String where, String table, String order, int limit)
          This method is called from subclasses if they want to retrieve data from the database.
protected  Map<String,Object> querySingle(String where)
          For convenience, this queries for a single result set.
protected  Map<String,Object> querySingle(String where, String table)
          For convenience, this queries for a single result set.
 void setComposedProperties(LocalizedSupplying prop)
          Sets a LocalizedSupplying object as a composite of the canvas.
 
Methods inherited from class stella.jview.JMasterDisplay
connect, disconnect, execute, execute, getIcon, getRefreshInterval, init, isFixedRate, openFile, processLocally, processPick, processPick, refresh, scanDir
 
Methods inherited from class jview.JClientFrame
abolishConnection, actionPerformed, createConnect, establishConnection, exit, getBottomItems
 
Methods inherited from class jview.JOpenFrame
createCheckBoxMenuItem, createLocalizedCheckBoxMenuItem, createLocalizedMenu, createLocalizedMenuItem, createLocalizedRadioButtonMenuItem, createMenu, createMenuItem, createRadioButtonMenuItem, exportCenter, getExportRepresentation, getHelpActions, getMenus, getOpenFilter, getPrintRepresentation, getSaveFilter, getSaveRepresentation, populateMenu, printCenter, saveFile
 
Methods inherited from class jview.JBorderFrame
analyserListenTo, createButton, createCheckBox, createDataAnalysers, createFitters, createHelp, createLabel, createLocalizedButton, createLocalizedCheckBox, createLocalizedHelp, createLocalizedLabel, createLocalizedRadioButton, createRadioButton, createStatus, getAboutAction, getActiveFit, getBiggerStrut, getComposedProperties, getDataAnalysers, getFitterButtonGroup, getFitterComboBox, getLeftItems, getLesserStrut, getModelFittings, getRepresentation, getRightItems, getStatusField, getTopItems, hasFired, printAlignment, setAlignment, setFired
 
Methods inherited from class jview.JConfirmExitFrame
disposeAndExit, disposeImmediately
 
Methods inherited from class jview.JExitFrame
setVisible
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.LocalizedComposed
getComposedProperties
 
Methods inherited from interface jview.Displayable
getRepresentation
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

KEY_USERNAME

public static final String KEY_USERNAME
The key to the user name for db-acces if not default.

See Also:
Constant Field Values

ISODATE

public static final String ISODATE
To allow date formats.

See Also:
Constant Field Values

DEFUSERNAME

private static final String DEFUSERNAME
Default user name for the table.

See Also:
Constant Field Values
Constructor Detail

JDatabaseDisplay

protected JDatabaseDisplay(LocalizedSupplying prop)
                    throws RemoteException
Constructs a generic peripheral from a property container.

Throws:
RemoteException

JDatabaseDisplay

protected JDatabaseDisplay(Map<String,String> prop)
                    throws RemoteException
Constructs a generic peripheral from a property container.

Throws:
RemoteException
Method Detail

setComposedProperties

public void setComposedProperties(LocalizedSupplying prop)
Sets a LocalizedSupplying object as a composite of the canvas. Defaults the necessary parameter.

Specified by:
setComposedProperties in interface LocalizedAware
Overrides:
setComposedProperties in class JMasterDisplay

lookUp

protected String lookUp(String unique,
                        String uniquecolumn,
                        String table,
                        String lookup)
Looks up a key in a database.


querySingle

protected Map<String,Object> querySingle(String where)
For convenience, this queries for a single result set. We return a mapping of keys to the single objects.


querySingle

protected Map<String,Object> querySingle(String where,
                                         String table)
For convenience, this queries for a single result set. We return a mapping of keys to the single objects.


queryDatabase

protected Map<String,List<Object>> queryDatabase(String where)
This method is called from subclasses if they want to retrieve data from the database. The where clause is directly piped to the sql database. If the where is constructed out of a pick event, either target name or unique queries seam meaningful.


queryDatabase

protected Map<String,List<Object>> queryDatabase(String where,
                                                 String table)
This method is called from subclasses if they want to retrieve data from the database. The where clause is directly piped to the sql database. If the where is constructed out of a pick event, either target name or unique queries seam meaningful.


queryDatabase

protected Map<String,List<Object>> queryDatabase(String where,
                                                 String table,
                                                 String order)
This method is called from subclasses if they want to retrieve data from the database. The where clause is directly piped to the sql database. If the where is constructed out of a pick event, either target name or unique queries seam meaningful.


queryDatabase

protected Map<String,List<Object>> queryDatabase(String where,
                                                 String table,
                                                 String order,
                                                 int limit)
This method is called from subclasses if they want to retrieve data from the database. The where clause is directly piped to the sql database. If the where is constructed out of a pick event, either target name or unique queries seam meaningful.


getUserName

protected String getUserName()

getTableName

protected abstract String getTableName()
Subclasses may override here and suplly multiple table names for joins.


getRequestedFields

protected abstract Map<String,Method> getRequestedFields()
This method retrieves a mapping of requested data field names to accessor methods. If these methods are null, we use the getObject method of the result set, otherwise the specified method is invoked on the result set. It is not allowed to return all data as a select * would allow.


getRequestedNames

protected Map<String,String> getRequestedNames(Set<String> requestkeys)
In SQL, column names have to be augmented with a leading table name plus '.', if there are equally named columns in the tables queried. But, as a painful feature, this table names are skipped from the column names in the result set, if they are unique in the result set. Just to make that clear, because it counter-acts logic:
If you have a select like (name is a cloumn in tab1 and tab2)
 SELECT from tab1,tab2 tab1.name,colonlyin2,colonlyin1 where ...
 
then your result set will have cloumns names
 name,colonlyin2,colonlyin1
 
If you have a select like
 SELECT from tab1,tab2 tab1.name,tab2.name,colonlyin2,colonlyin1
 
then your result set will contain table names, thus
 tab1.name,tab2.name,colonlyin2,colonlyin1
 
This method now stripps unneeded table names from column names.


processExternally

protected boolean processExternally(HistoryAware.Pick pick)
This method should never be called. We return false.

Specified by:
processExternally in class JMasterDisplay

getResultSetMethod

protected Method getResultSetMethod(String name)
Returns the method in the result set with the given name, catches exception.