org.coode.mansyntax.editor
Class OWLExpressionEditor<O>

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
                      extended by javax.swing.JTextPane
                          extended by org.coode.mansyntax.editor.OWLExpressionEditor<O>
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.DocumentListener, javax.swing.Scrollable, WordMatcher

public class OWLExpressionEditor<O>
extends javax.swing.JTextPane
implements javax.swing.event.DocumentListener, WordMatcher

Author: Matthew Horridge
The University Of Manchester
Bio-Health Informatics Group
Date: 13-Sep-2007

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JEditorPane
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
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
 
Fields inherited from class javax.swing.JEditorPane
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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
OWLExpressionEditor(OWLOntologyManager owlOntologyManager, OWLExpressionParser<O> expressionParser, BidirectionalShortFormProvider provider)
          Constructs an expression editor which uses the specified expression parser to check syntax and generate autocompletions and the specified short form provider to obtain references to entities.
 
Method Summary
 void addKeyword(java.lang.String keyword, javax.swing.text.Style style)
           
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
 void clearKeywords()
           
 java.lang.String convertToString(java.lang.Object chosenObject)
           
 javax.swing.text.Style getAxiomKeywordStyle()
           
 javax.swing.text.Style getClassConstructorKeywordStyle()
           
 OWLEntity getEntityAt(java.awt.Point pt)
           
 OWLClass getOWLClass(java.lang.String name)
           
 OWLDataProperty getOWLDataProperty(java.lang.String name)
           
 OWLDatatype getOWLDatatype(java.lang.String name)
           
 OWLIndividual getOWLIndividual(java.lang.String name)
           
 OWLObjectProperty getOWLObjectProperty(java.lang.String name)
           
 O getParsedObject()
           
 BidirectionalShortFormProvider getProvider()
           
 javax.swing.text.Style getRestrictionKeywordStyle()
           
 boolean getScrollableTracksViewportWidth()
           
 java.lang.String getWordAt(int pos)
           
 java.lang.String getWordAt(java.awt.Point pt)
           
protected  javax.swing.text.Style getWordStyle(java.lang.String word)
           
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 boolean isActivateHyperlinksOnMouseOver()
           
 boolean isHighlightKeywords()
           
 java.util.List<java.lang.Object> match(java.lang.String start)
           
protected  void paintComponent(java.awt.Graphics g)
           
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 void select(int selectionStart, int selectionEnd)
           
 void setActivateHyperlinksOnMouseOver(boolean b)
           
 void setEditable(boolean b)
           
 void setExpressionParser(OWLExpressionParser<O> expressionParser)
           
 void setHighlightKeywords(boolean highlightKeywords)
           
 void setHyperlinkListener(HyperlinkListener hyperlinkListener)
           
 void setupDefaultKeywords()
           
 
Methods inherited from class javax.swing.JTextPane
addStyle, createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, replaceSelection, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getStream, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage, setText
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, 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, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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
 

Constructor Detail

OWLExpressionEditor

public OWLExpressionEditor(OWLOntologyManager owlOntologyManager,
                           OWLExpressionParser<O> expressionParser,
                           BidirectionalShortFormProvider provider)
Constructs an expression editor which uses the specified expression parser to check syntax and generate autocompletions and the specified short form provider to obtain references to entities.

Method Detail

select

public void select(int selectionStart,
                   int selectionEnd)
Overrides:
select in class javax.swing.text.JTextComponent

setExpressionParser

public void setExpressionParser(OWLExpressionParser<O> expressionParser)

setupDefaultKeywords

public void setupDefaultKeywords()

getProvider

public BidirectionalShortFormProvider getProvider()

clearKeywords

public void clearKeywords()

addKeyword

public void addKeyword(java.lang.String keyword,
                       javax.swing.text.Style style)

getRestrictionKeywordStyle

public javax.swing.text.Style getRestrictionKeywordStyle()

getClassConstructorKeywordStyle

public javax.swing.text.Style getClassConstructorKeywordStyle()

getAxiomKeywordStyle

public javax.swing.text.Style getAxiomKeywordStyle()

getParsedObject

public O getParsedObject()
                  throws ParserException
Throws:
ParserException

isHighlightKeywords

public boolean isHighlightKeywords()

setHighlightKeywords

public void setHighlightKeywords(boolean highlightKeywords)

getOWLClass

public OWLClass getOWLClass(java.lang.String name)

getOWLObjectProperty

public OWLObjectProperty getOWLObjectProperty(java.lang.String name)

getOWLDataProperty

public OWLDataProperty getOWLDataProperty(java.lang.String name)

getOWLIndividual

public OWLIndividual getOWLIndividual(java.lang.String name)

getOWLDatatype

public OWLDatatype getOWLDatatype(java.lang.String name)

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

getWordStyle

protected javax.swing.text.Style getWordStyle(java.lang.String word)

match

public java.util.List<java.lang.Object> match(java.lang.String start)
Specified by:
match in interface WordMatcher

convertToString

public java.lang.String convertToString(java.lang.Object chosenObject)
Specified by:
convertToString in interface WordMatcher

setHyperlinkListener

public void setHyperlinkListener(HyperlinkListener hyperlinkListener)

getEntityAt

public OWLEntity getEntityAt(java.awt.Point pt)

getWordAt

public java.lang.String getWordAt(java.awt.Point pt)

getWordAt

public java.lang.String getWordAt(int pos)

setEditable

public void setEditable(boolean b)
Overrides:
setEditable in class javax.swing.text.JTextComponent

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable
Overrides:
getScrollableTracksViewportWidth in class javax.swing.JEditorPane

setActivateHyperlinksOnMouseOver

public void setActivateHyperlinksOnMouseOver(boolean b)

isActivateHyperlinksOnMouseOver

public boolean isActivateHyperlinksOnMouseOver()