GATE
Version 3.1-2270

com.ontotext.gate.vr
Class OntologyEditorImpl

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 gate.creole.AbstractVisualResource
                      extended by com.ontotext.gate.vr.OntologyEditorImpl
All Implemented Interfaces:
OntologyEditor, CreoleListener, GateListener, ObjectModificationListener, Resource, FeatureBearer, NameBearer, VisualResource, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class OntologyEditorImpl
extends AbstractVisualResource
implements OntologyEditor, CreoleListener, ObjectModificationListener

Implementation of an ontology editor

See Also:
Serialized Form

Nested Class Summary
protected  class OntologyEditorImpl.KnowledgeBaseTreeCellRenderer
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int POSITION_X
          the position of the editor (x)
static int POSITION_Y
          the position of the editor (y)
static int SIZE_X
          the size of the editor (x)
static int SIZE_Y
          the size of the editor (y)
 
Fields inherited from class gate.creole.AbstractVisualResource
features
 
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
OntologyEditorImpl()
           
 
Method Summary
 void addSubClass(ClassNode root, String className, String classComment)
          addSubClass given a ClassNode and the resulting info from the dialog
 void addSubClass(int x, int y)
          Invokes an add sub class dialog in position x,y
 int AskWannaSave(Taxonomy o, int x, int y)
          Wanna Save Dialog invocation. currently the x and y parameters are not used since the option pane is by default initialized with position setLocationRelativeTo(parentComponent)
 void cleanup()
          Does nothing now, but meant to clear all internal data
 void closeOntologies(Vector list)
          close list of ontologies
 void closeOntology(Taxonomy o, int x, int y)
          close an ontology. invoke AreYouSureDialog if the ontology has been changed.
 void createOntology(String name, String sourceURI, String theURL, String comment)
          Creates a new ontology
 void datastoreClosed(CreoleEvent e)
          Called when a DataStore has been closed
 void datastoreCreated(CreoleEvent e)
          Called when a DataStore has been created
 void datastoreOpened(CreoleEvent e)
          Called when a DataStore has been opened
 void deleteOntology(Taxonomy o, int x, int y)
          delete an ontology. invoke if the ontology has been changed. currently deleteOntology works as closeOntology. does not delete the file.
 void editClassURI(TClass c, int x, int y)
          edit the URI of an ontology class
 void editURI(Taxonomy o, int x, int y)
          edit the URI of an ontology
 void fileClose(int x, int y, Vector ontologies)
          invoke a mutiple selection close dialog with a list of ontologies.
 void fileExit()
          checks for unsaved ontologies and disposes the main panel
 void fileNew(int x, int y)
          inovke a 'new ontology dialog'
 void fileOpen(int x, int y)
          Acts on choosing Open from the File menu.
 void fileSave(int x, int y, Vector ontologies)
          invoke a mutiple selection save dialog with a list of ontologies.
 Set getAllURIs()
          Gets all URIs that are present at the moment as ontology URIs.
 Set getAllURIs(Taxonomy o)
          retrieve a set of all the URIs in an ontology
 Vector getModifiedOntologies()
          Get Modified Ontologies
 String getName()
          Returns the name of this resource
 Taxonomy getOntology()
          Gets the loaded ontology
 Vector getOntologyList()
          Gets the list of ontologies currently in the editor
 Resource init()
          Initialise this resource, and return it.
 void objectCreated(ObjectModificationEvent e)
           
 void objectDeleted(ObjectModificationEvent e)
           
 void objectModified(ObjectModificationEvent e)
           
 void ontologySelected(Taxonomy o)
          Is called when an ontology has been selected from the ontology list
 void processGateEvent(GateEvent e)
          Called when a Gate event has occured
 void removeClass(ClassNode node)
          Removes the node/class
 void renameClass(TClass c, ClassNode n, int x, int y)
          Renames a class
 void renameOntology(Taxonomy o, int x, int y)
          rename an ontology. if the x and y coordinates are not set, then the default position is LocationRelativeTo the ontologies list.
 void resourceLoaded(CreoleEvent e)
          Called when a new Resource has been loaded into the system
 void resourceRenamed(Resource resource, String oldName, String newName)
          Called when the creole register has renamed a resource.1
 void resourceUnloaded(CreoleEvent e)
          Called when a Resource has been removed from the system
 void saveAsOntology(Taxonomy o, int x, int y)
          invoke a saveas dialog for this ontology and save it to the location specified
 void saveOntologies(Vector list)
          Save a list of ontologies.
 void saveOntology(Taxonomy o)
          save this ontology
 void setHandle(Handle handle)
          Used by the main GUI to tell this VR what handle created it.
 void setName(String name)
          Sets the name of this resource
 void setOntology(Taxonomy o)
          Sets ontology to be loaded in the editor
 void setOntologyList(Vector list)
          Sets the list of ontologies to be loaded in the editor
 void setTarget(Object target)
          Called by the GUI when this viewer/editor has to initialise itself for a specific object.
 void visualize()
          Visualizes the editor
 
Methods inherited from class gate.creole.AbstractVisualResource
getFeatures, getParameterValue, setFeatures, setParameterValue, setParameterValues
 
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, 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, 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
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 

Field Detail

SIZE_X

public static final int SIZE_X
the size of the editor (x)

See Also:
Constant Field Values

SIZE_Y

public static final int SIZE_Y
the size of the editor (y)

See Also:
Constant Field Values

POSITION_X

public static final int POSITION_X
the position of the editor (x)

See Also:
Constant Field Values

POSITION_Y

public static final int POSITION_Y
the position of the editor (y)

See Also:
Constant Field Values
Constructor Detail

OntologyEditorImpl

public OntologyEditorImpl()
Method Detail

ontologySelected

public void ontologySelected(Taxonomy o)
Is called when an ontology has been selected from the ontology list

Specified by:
ontologySelected in interface OntologyEditor
Parameters:
o - the selected ontology

addSubClass

public void addSubClass(int x,
                        int y)
Invokes an add sub class dialog in position x,y

Specified by:
addSubClass in interface OntologyEditor
Parameters:
x - the x coordinate of the dialog
y - the y coordinate of the dialog

addSubClass

public void addSubClass(ClassNode root,
                        String className,
                        String classComment)
addSubClass given a ClassNode and the resulting info from the dialog

Specified by:
addSubClass in interface OntologyEditor
Parameters:
root - the node which is root to the sub class being added
className - the name from the dialog
classComment - the comment from the dialog

removeClass

public void removeClass(ClassNode node)
Removes the node/class

Specified by:
removeClass in interface OntologyEditor
Parameters:
node - the node to be removed

renameClass

public void renameClass(TClass c,
                        ClassNode n,
                        int x,
                        int y)
Renames a class

Specified by:
renameClass in interface OntologyEditor
Parameters:
c - the class to be renamed
n - the class node associated with the class
x - coords
y - coords

visualize

public void visualize()
Visualizes the editor

Specified by:
visualize in interface OntologyEditor

createOntology

public void createOntology(String name,
                           String sourceURI,
                           String theURL,
                           String comment)
                    throws ResourceInstantiationException
Creates a new ontology

Specified by:
createOntology in interface OntologyEditor
Parameters:
name - the name of the ontology
sourceURI -
theURL -
comment -
Throws:
ResourceInstantiationException

setOntology

public void setOntology(Taxonomy o)
Sets ontology to be loaded in the editor

Specified by:
setOntology in interface OntologyEditor
Parameters:
o - the ontology to be loaded

getOntology

public Taxonomy getOntology()
Description copied from interface: OntologyEditor
Gets the loaded ontology

Specified by:
getOntology in interface OntologyEditor
Returns:
the current ontology in the editor

setOntologyList

public void setOntologyList(Vector list)
Description copied from interface: OntologyEditor
Sets the list of ontologies to be loaded in the editor

Specified by:
setOntologyList in interface OntologyEditor
Parameters:
list - the list of ontologies

getOntologyList

public Vector getOntologyList()
Description copied from interface: OntologyEditor
Gets the list of ontologies currently in the editor

Specified by:
getOntologyList in interface OntologyEditor
Returns:
the list of ontologies

setTarget

public void setTarget(Object target)
Description copied from class: AbstractVisualResource
Called by the GUI when this viewer/editor has to initialise itself for a specific object.

Specified by:
setTarget in interface VisualResource
Overrides:
setTarget in class AbstractVisualResource
Parameters:
target - the object (be it a Resource, DataStore or whatever) this viewer has to display

setHandle

public void setHandle(Handle handle)
Description copied from class: AbstractVisualResource
Used by the main GUI to tell this VR what handle created it. The VRs can use this information e.g. to add items to the popup for the resource.

Specified by:
setHandle in interface VisualResource
Overrides:
setHandle in class AbstractVisualResource

init

public Resource init()
              throws ResourceInstantiationException
Description copied from class: AbstractVisualResource
Initialise this resource, and return it.

Specified by:
init in interface Resource
Overrides:
init in class AbstractVisualResource
Throws:
ResourceInstantiationException

cleanup

public void cleanup()
Description copied from class: AbstractVisualResource
Does nothing now, but meant to clear all internal data

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class AbstractVisualResource

setName

public void setName(String name)
Description copied from interface: NameBearer
Sets the name of this resource

Specified by:
setName in interface NameBearer
Overrides:
setName in class Component

getName

public String getName()
Description copied from interface: NameBearer
Returns the name of this resource

Specified by:
getName in interface NameBearer
Overrides:
getName in class Component

getModifiedOntologies

public Vector getModifiedOntologies()
Get Modified Ontologies

Specified by:
getModifiedOntologies in interface OntologyEditor
Returns:
list of the modified ontologies

saveOntologies

public void saveOntologies(Vector list)
Save a list of ontologies.

Specified by:
saveOntologies in interface OntologyEditor
Parameters:
list - a list of ontologies to be saved

closeOntologies

public void closeOntologies(Vector list)
                     throws ResourceInstantiationException
close list of ontologies

Specified by:
closeOntologies in interface OntologyEditor
Parameters:
list - a list of ontologies to be saved
Throws:
ResourceInstantiationException

saveOntology

public void saveOntology(Taxonomy o)
                  throws ResourceInstantiationException
save this ontology

Specified by:
saveOntology in interface OntologyEditor
Parameters:
o - the ontology to be saved
Throws:
ResourceInstantiationException

saveAsOntology

public void saveAsOntology(Taxonomy o,
                           int x,
                           int y)
                    throws ResourceInstantiationException
invoke a saveas dialog for this ontology and save it to the location specified

Specified by:
saveAsOntology in interface OntologyEditor
Parameters:
o - the ontology to be saved
x - the x coordinate of the save as dialog
y - the y coordinate of the save as dialog
Throws:
ResourceInstantiationException

renameOntology

public void renameOntology(Taxonomy o,
                           int x,
                           int y)
rename an ontology. if the x and y coordinates are not set, then the default position is LocationRelativeTo the ontologies list.

Specified by:
renameOntology in interface OntologyEditor
Parameters:
o - the ontology to be renamed
x - the x coordinate of the rename dialog
y - the y coordinate of the rename dialog

deleteOntology

public void deleteOntology(Taxonomy o,
                           int x,
                           int y)
                    throws ResourceInstantiationException
delete an ontology. invoke if the ontology has been changed. currently deleteOntology works as closeOntology. does not delete the file. even asks for saving it if modified.

Specified by:
deleteOntology in interface OntologyEditor
Parameters:
o - the ontology to be deleted
x - x coordinate of the option pane to be invoked
y - y coordinate of the option pane to be invoked
Throws:
ResourceInstantiationException

editURI

public void editURI(Taxonomy o,
                    int x,
                    int y)
edit the URI of an ontology

Specified by:
editURI in interface OntologyEditor
Parameters:
o - the ontology to be edited
x - coords of the dialog
y - coords of the dialog

editClassURI

public void editClassURI(TClass c,
                         int x,
                         int y)
edit the URI of an ontology class

Specified by:
editClassURI in interface OntologyEditor
Parameters:
c - class to be edited
x - coords of the dialog
y - coords of the dialog

getAllURIs

public Set getAllURIs()
Description copied from interface: OntologyEditor
Gets all URIs that are present at the moment as ontology URIs.

Specified by:
getAllURIs in interface OntologyEditor
Returns:
all the uris that are available in the editor

getAllURIs

public Set getAllURIs(Taxonomy o)
retrieve a set of all the URIs in an ontology

Specified by:
getAllURIs in interface OntologyEditor
Parameters:
o - the ontology
Returns:
set of all the URIs in the ontology

closeOntology

public void closeOntology(Taxonomy o,
                          int x,
                          int y)
                   throws ResourceInstantiationException
close an ontology. invoke AreYouSureDialog if the ontology has been changed.

Specified by:
closeOntology in interface OntologyEditor
Parameters:
o - the ontology to be closed
x - x coordinate of the option pane to be invoked
y - y coordinate of the option pane to be invoked
Throws:
ResourceInstantiationException

fileExit

public void fileExit()
checks for unsaved ontologies and disposes the main panel

Specified by:
fileExit in interface OntologyEditor

fileOpen

public void fileOpen(int x,
                     int y)
              throws ResourceInstantiationException
Description copied from interface: OntologyEditor
Acts on choosing Open from the File menu.

Specified by:
fileOpen in interface OntologyEditor
Parameters:
x - the x coordinate of the invocation
y - the y coordinate of the invocation
Throws:
ResourceInstantiationException - if something goes wrong with the loading.

fileSave

public void fileSave(int x,
                     int y,
                     Vector ontologies)
invoke a mutiple selection save dialog with a list of ontologies.

Specified by:
fileSave in interface OntologyEditor
Parameters:
x - coords of the dialog
y - coords of the dialog
ontologies - the list of ontologies to be optionally saved

fileClose

public void fileClose(int x,
                      int y,
                      Vector ontologies)
invoke a mutiple selection close dialog with a list of ontologies.

Specified by:
fileClose in interface OntologyEditor
Parameters:
x - coords of the dialog
y - coords of the dialog
ontologies - the list of ontologies to be optionally closed

fileNew

public void fileNew(int x,
                    int y)
inovke a 'new ontology dialog'

Specified by:
fileNew in interface OntologyEditor
Parameters:
x - coords of the dialog
y - coords of the dialog

AskWannaSave

public int AskWannaSave(Taxonomy o,
                        int x,
                        int y)
Wanna Save Dialog invocation. currently the x and y parameters are not used since the option pane is by default initialized with position setLocationRelativeTo(parentComponent)

Specified by:
AskWannaSave in interface OntologyEditor
Parameters:
o - the ontology to be saved or not
x - x coordinate of the WannaSaveDialog to be invoked
y - y coordinate of the WannaSaveDialog to be invoked
Returns:
the result of the option pane execution

resourceLoaded

public void resourceLoaded(CreoleEvent e)
Called when a new Resource has been loaded into the system

Specified by:
resourceLoaded in interface CreoleListener

resourceUnloaded

public void resourceUnloaded(CreoleEvent e)
Called when a Resource has been removed from the system

Specified by:
resourceUnloaded in interface CreoleListener

datastoreOpened

public void datastoreOpened(CreoleEvent e)
Called when a DataStore has been opened

Specified by:
datastoreOpened in interface CreoleListener

datastoreCreated

public void datastoreCreated(CreoleEvent e)
Called when a DataStore has been created

Specified by:
datastoreCreated in interface CreoleListener

datastoreClosed

public void datastoreClosed(CreoleEvent e)
Called when a DataStore has been closed

Specified by:
datastoreClosed in interface CreoleListener

resourceRenamed

public void resourceRenamed(Resource resource,
                            String oldName,
                            String newName)
Called when the creole register has renamed a resource.1

Specified by:
resourceRenamed in interface CreoleListener

processGateEvent

public void processGateEvent(GateEvent e)
Description copied from interface: GateListener
Called when a Gate event has occured

Specified by:
processGateEvent in interface GateListener

objectCreated

public void objectCreated(ObjectModificationEvent e)
Specified by:
objectCreated in interface ObjectModificationListener

objectDeleted

public void objectDeleted(ObjectModificationEvent e)
Specified by:
objectDeleted in interface ObjectModificationListener

objectModified

public void objectModified(ObjectModificationEvent e)
Specified by:
objectModified in interface ObjectModificationListener

GATE
Version 3.1-2270