project35.desktopDeployment
Class RecordView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by project35.desktopDeployment.RecordView
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class RecordView
extends javax.swing.JPanel
implements java.awt.event.ActionListener

this is the class that renders the form for the currently selected record. It is the UI component that appears on the right portion of a Project35 Dialog


Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)
See Also:
Serialized Form

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
protected  RecordModel recordModel
           
protected  RecordNameProvider recordNameProvider
           
 
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
RecordView(Project35FormContext project35FormContext)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void addChangeListener(javax.swing.event.ChangeListener aChangeListener)
           
 java.lang.String applyRecordModelValidationServices()
           
 void cancel()
           
 void changeFont(java.awt.Font font)
           
 void done()
           
 void enableContextHelp(boolean newEnableContextHelpValue)
          enables context sensitive help
 void forceRefresh()
           
 javax.swing.JPanel getButtonPanel()
           
 java.util.ArrayList getFieldViews()
           
 javax.swing.text.JTextComponent getFocusObject()
           
 ListFieldModel getListModelNeedingReference()
           
 OntologyContext getOntologyContext()
           
 RecordModel getRecordModel()
           
 java.lang.String getSelectedText()
          returns the selected text in the field that has focus.
 DataFieldView getTextFieldWithFocus()
          returns the field that has the current focus.
 java.lang.Object getTopLevelWindow()
           
 boolean isDirty()
           
 void keepValues()
           
 boolean nodesAddedOrDeleted()
           
 void refreshList(java.lang.String listFieldName)
          refreshes the target list field.
 void setChangeListener(javax.swing.event.ChangeListener changeListener)
          change listener here will be the touch type ontology listener which will be activated whenever the new model is set
 void setIncludeButtonPanel(boolean includeButtonPanel)
           
 void setListModelNeedingReference(java.lang.String referenceRecordType, ListFieldModel listModelNeedingReference)
          if the user presses the "Reference" button on a list field, she will cause the list field needing a reference to be registered with the record view.
 void setModel(RecordNameProvider recordNameProvider)
           
 void setNodesAddedOrDeleted(boolean nodesAddedOrDeleted)
          used as an indicator for resetting save changes
 void setOntologyContext(OntologyContext ontologyContext)
           
 void setPluginSelectorComponent(PluginSelectorComponent _pluginSelectorComponent)
           
 void setTopLevelRecord(RecordModel topLevelRecordModel)
          sets the top level record.
 void setTopLevelWindow(java.lang.Object topLevelWindow)
          in some cases, we may want the field views to have a handle on the top level window (eg Project35Dialog, TabletProject35Dialog).
 void setViewPort(javax.swing.JViewport vp)
           
 void updateDateFields()
           
 java.lang.String validateEditFields(boolean highlightErrors)
           
 java.lang.String validateIndividualFields(boolean highlightErrors)
           
 
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

recordNameProvider

protected RecordNameProvider recordNameProvider

recordModel

protected RecordModel recordModel
Constructor Detail

RecordView

public RecordView(Project35FormContext project35FormContext)
Method Detail

getListModelNeedingReference

public ListFieldModel getListModelNeedingReference()

getFieldViews

public java.util.ArrayList getFieldViews()
Returns:
the list of fields for the model being viewed

getButtonPanel

public javax.swing.JPanel getButtonPanel()

getOntologyContext

public OntologyContext getOntologyContext()

setChangeListener

public void setChangeListener(javax.swing.event.ChangeListener changeListener)
change listener here will be the touch type ontology listener which will be activated whenever the new model is set


getRecordModel

public RecordModel getRecordModel()

nodesAddedOrDeleted

public boolean nodesAddedOrDeleted()

getTextFieldWithFocus

public DataFieldView getTextFieldWithFocus()
returns the field that has the current focus. This is important in paste operations to indicate which field to paste the value into

Returns:
the field with focus

getSelectedText

public java.lang.String getSelectedText()
returns the selected text in the field that has focus. Casting is used because not all edit fields (CombinationFieldView, RadioFieldView) are associated with copy/paste operations

Returns:
selected text in the currently focused field.

getTopLevelWindow

public java.lang.Object getTopLevelWindow()

getFocusObject

public javax.swing.text.JTextComponent getFocusObject()

setOntologyContext

public void setOntologyContext(OntologyContext ontologyContext)

setViewPort

public void setViewPort(javax.swing.JViewport vp)

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener aChangeListener)

setTopLevelWindow

public void setTopLevelWindow(java.lang.Object topLevelWindow)
in some cases, we may want the field views to have a handle on the top level window (eg Project35Dialog, TabletProject35Dialog). in the case of TabletProject35Dialog, we want it such that when ontology services are activated, there are no popup dialogs. instead, pass the top level window a new "view" to put in a card layout


setIncludeButtonPanel

public void setIncludeButtonPanel(boolean includeButtonPanel)

setPluginSelectorComponent

public void setPluginSelectorComponent(PluginSelectorComponent _pluginSelectorComponent)

setListModelNeedingReference

public void setListModelNeedingReference(java.lang.String referenceRecordType,
                                         ListFieldModel listModelNeedingReference)
if the user presses the "Reference" button on a list field, she will cause the list field needing a reference to be registered with the record view. This causes RecordView to render a special form section indicating that a field is waiting to reference a model


setNodesAddedOrDeleted

public void setNodesAddedOrDeleted(boolean nodesAddedOrDeleted)
used as an indicator for resetting save changes

Parameters:
nodesAddedOrDeleted - true if nodes have been added or deleted. otherwise false

enableContextHelp

public void enableContextHelp(boolean newEnableContextHelpValue)
enables context sensitive help

Parameters:
newEnableContextHelpValue - true if fields should be sensitive to context help; otherwise false

forceRefresh

public void forceRefresh()

setModel

public void setModel(RecordNameProvider recordNameProvider)

updateDateFields

public void updateDateFields()

setTopLevelRecord

public void setTopLevelRecord(RecordModel topLevelRecordModel)
sets the top level record. RecordView has to know this record when it becomes the currently displayed model. When the top level model is shown, the delete key must be disabled

Parameters:
topLevelRecordModel - the root model of the experiment file

refreshList

public void refreshList(java.lang.String listFieldName)
refreshes the target list field. This is used when you import records into a list. RecordView has to update to show changes in the list.

Parameters:
listFieldName - the name of the list field

changeFont

public void changeFont(java.awt.Font font)

validateIndividualFields

public java.lang.String validateIndividualFields(boolean highlightErrors)

validateEditFields

public java.lang.String validateEditFields(boolean highlightErrors)

isDirty

public boolean isDirty()

done

public void done()
          throws Project35Exception
Throws:
Project35Exception

applyRecordModelValidationServices

public java.lang.String applyRecordModelValidationServices()

keepValues

public void keepValues()
                throws Project35Exception
Throws:
Project35Exception

actionPerformed

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

cancel

public void cancel()