project35.soa.ontology.views
Class DefaultOntologyViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by project35.soa.ontology.views.DefaultOntologyViewer
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, OntologyViewer, OntologyViewListener, ServiceClass

public class DefaultOntologyViewer
extends javax.swing.JDialog
implements java.awt.event.ActionListener, OntologyViewer, OntologyViewListener

this is the default viewer used to render terms provided by ontology sources. The default viewer supports a number of views:

in addition, it has support for terms that have help web pages; the web pages are rendered in an HTML panel.

The Default Ontology Viewer determines what views to present by determining what other marker interfaces are implemented by the OntologySource. by default, all ontology sources can be rendered as lists. if they implement project35.soa.ontology.sources.TreeOntologySource then they can be rendered as a tree. if they implement project35.soa.ontology.sources.DictionaryDescriptionSupport then the viewer will support a dictionary view. if they implement project35.soa.ontology.sources.OntologyCaching then the viewer will feature an "Update" button, provided the source indicates it needs updating. Sources that implement project35.soa.ontology.sources.ImageDescriptionSupport will be rendered with a picture thumbnail view. if they implement project35.soa.ontology.sources.URLDescriptionSupport then the viewer will add an HTML panel for showing the web pages for the currently selected term in the current view.


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.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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  OntologyView currentView
           
protected  ListView listView
           
protected  OntologyContext ontologyContext
           
protected  OntologySource ontologySource
           
protected  java.util.ArrayList ontologyViews
           
protected  PictureView pictureView
           
protected  OntologyTerm[] selectedOntologyTerms
           
protected  javax.swing.JTextArea sourceDescription
           
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DefaultOntologyViewer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void addOntologyView(OntologyView ontologyView)
           
 void buildUI()
           
 boolean canViewSource(Project35FormContext project35FormContext, OntologySource source)
          determines if this Viewer class is capable of rendering terms supplied by a given ontology source.
protected  void close()
           
protected  javax.swing.JPanel createButtonPanel()
           
 Parameter[] getInitialisationParameters()
           
 java.lang.String getName()
           
 OntologyServiceMetaData getOntologyServiceMetaData(Project35FormContext project35FormContext)
           
 OntologyTermProvenance getOntologyTermProvenance(Project35FormContext project35FormContext, OntologyTerm ontologyTerm)
           
 OntologyTerm[] getRelatedTerms(Project35FormContext project35FormContext, OntologyRelationshipType relationshipType, OntologyTerm ontologyTerm)
           
 OntologyTerm[] getSelectedOntologyTerms(Project35FormContext project35FormContext)
           
 void initialiseService(java.net.URL resourceDirectory, Parameter[] initialisationParameters)
           
 boolean isWorking()
           
protected  void reset()
           
 void setLastSelectedTerm(OntologyTerm ontologyTerm)
          sets the last term that was selected in the view
 void setMarkupFormField(boolean markupFormField)
          this is meant to allow the viewer to either markup a form field or simply record the selected terms in the OntologyContext
 void setOntologySource(Project35FormContext project35FormContext, OntologySource ontologySource)
          method called by Project35 to help establish the ontology source being rendered by the viewer class.
 void setOntologyTermSelectionListener(OntologyTermSelectionListener ontologyTermSelectionListener)
           
 void setOntologyView(OntologyView ontologyView, boolean allowOtherViews)
           
 void setShowReset(boolean showReset)
           
 void setVisible(boolean isVisible)
          public void show() { if (isShowing() == false) { super.setVisible(true); } //end if () }
 void showProvenance(boolean flag)
           
 java.lang.String test()
          this is a diagnostic method to retrieve any errors that may have occurred when the viewer was initially created.
 void useListView(boolean allowOther)
           
 void useTreeView(boolean allowOther)
           
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, 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, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listView

protected ListView listView

currentView

protected OntologyView currentView

pictureView

protected PictureView pictureView

ontologyViews

protected java.util.ArrayList ontologyViews

sourceDescription

protected javax.swing.JTextArea sourceDescription

ontologySource

protected OntologySource ontologySource

ontologyContext

protected OntologyContext ontologyContext

selectedOntologyTerms

protected OntologyTerm[] selectedOntologyTerms
Constructor Detail

DefaultOntologyViewer

public DefaultOntologyViewer()
Method Detail

buildUI

public void buildUI()

createButtonPanel

protected javax.swing.JPanel createButtonPanel()

getOntologyServiceMetaData

public OntologyServiceMetaData getOntologyServiceMetaData(Project35FormContext project35FormContext)
Specified by:
getOntologyServiceMetaData in interface OntologyViewer

setMarkupFormField

public void setMarkupFormField(boolean markupFormField)
this is meant to allow the viewer to either markup a form field or simply record the selected terms in the OntologyContext


showProvenance

public void showProvenance(boolean flag)

setShowReset

public void setShowReset(boolean showReset)

addOntologyView

public void addOntologyView(OntologyView ontologyView)

useTreeView

public void useTreeView(boolean allowOther)

useListView

public void useListView(boolean allowOther)

setOntologyView

public void setOntologyView(OntologyView ontologyView,
                            boolean allowOtherViews)

getInitialisationParameters

public Parameter[] getInitialisationParameters()
Specified by:
getInitialisationParameters in interface ServiceClass

initialiseService

public void initialiseService(java.net.URL resourceDirectory,
                              Parameter[] initialisationParameters)
                       throws java.lang.Exception
Specified by:
initialiseService in interface ServiceClass
Throws:
java.lang.Exception

getName

public java.lang.String getName()
Overrides:
getName in class java.awt.Component

setOntologySource

public void setOntologySource(Project35FormContext project35FormContext,
                              OntologySource ontologySource)
                       throws java.lang.Exception
Description copied from interface: OntologyViewer
method called by Project35 to help establish the ontology source being rendered by the viewer class. The ontology context helps the viewer ask questions about what else might be on the form. This information could be used to limit what relevant terms are displayed to end users.

Specified by:
setOntologySource in interface OntologyViewer
Throws:
java.lang.Exception

canViewSource

public boolean canViewSource(Project35FormContext project35FormContext,
                             OntologySource source)
Description copied from interface: OntologyViewer
determines if this Viewer class is capable of rendering terms supplied by a given ontology source.

Specified by:
canViewSource in interface OntologyViewer

isWorking

public boolean isWorking()
Specified by:
isWorking in interface OntologyViewer

test

public java.lang.String test()
Description copied from interface: OntologyViewer
this is a diagnostic method to retrieve any errors that may have occurred when the viewer was initially created.

Specified by:
test in interface OntologyViewer

getRelatedTerms

public OntologyTerm[] getRelatedTerms(Project35FormContext project35FormContext,
                                      OntologyRelationshipType relationshipType,
                                      OntologyTerm ontologyTerm)
Specified by:
getRelatedTerms in interface OntologyViewer

getOntologyTermProvenance

public OntologyTermProvenance getOntologyTermProvenance(Project35FormContext project35FormContext,
                                                        OntologyTerm ontologyTerm)
Specified by:
getOntologyTermProvenance in interface OntologyViewer

getSelectedOntologyTerms

public OntologyTerm[] getSelectedOntologyTerms(Project35FormContext project35FormContext)
Specified by:
getSelectedOntologyTerms in interface OntologyViewer

setOntologyTermSelectionListener

public void setOntologyTermSelectionListener(OntologyTermSelectionListener ontologyTermSelectionListener)
Specified by:
setOntologyTermSelectionListener in interface OntologyViewer

actionPerformed

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

close

protected void close()

reset

protected void reset()

setVisible

public void setVisible(boolean isVisible)
public void show() { if (isShowing() == false) { super.setVisible(true); } //end if () }

Specified by:
setVisible in interface OntologyViewer
Overrides:
setVisible in class java.awt.Component

setLastSelectedTerm

public void setLastSelectedTerm(OntologyTerm ontologyTerm)
Description copied from interface: OntologyViewListener
sets the last term that was selected in the view

Specified by:
setLastSelectedTerm in interface OntologyViewListener
Parameters:
ontologyTerm - the last selected ontology term