P4UiComponentSummary
Protege Developer Docs: UI Components
This page describes some of the more useful UI components available for developers working with Protege 4, 5 or newer versions.
Back to Protege Developer Documentation
Packages
There are many standard UI components, as part of the core Protege framework and more specific components for managing OWL objects in the OWL editor kit.
All UI classes can be found in the following packages:
- org.protege.editor.core.ui and its subpackages for core generic ui components
- org.protege.editor.owl.ui and its subpackages for owl specific ui components
Components
Core components
Actions
Create menu items using a plugin mechanism (see PluginTypes#EditorKitMenuAction for details).
Errors
Display a dialog to the user when an exception needs to be reported.
use: org.protege.editor.core.ui.error.ErrorLogPanel
ErrorLogPanel.showErrorDialog(Exception e)
Lists
Protege-style JLists that have support for sections, and items with buttons on the right hand side for deleting, editing etc
implement: org.protege.editor.core.ui.list.MList
example: org.protege.editor.core.ui.list.RemovableObjectList
Preferences
Create preferences panels for your plugins (see PluginTypes#preferencespanel for details).
Wizards
A dialog with a series of pages to guide the user through a set of tasks with a certain set of steps.
implement: org.protege.editor.core.ui.wizard.Wizard
example: org.protege.editor.owl.ui.ontology.wizard.create.CreateOntologyWizard
Icons
Get a selection of icons that are found in the icons/ folder in the core plugin.
Icons.getIcon("error.png")
Dialogs
Provides some handy static dialog/validating dialog (VerifyingOptionPane) creation methods.
use: org.protege.editor.core.ui.util.JOptionPaneEx
NativeBrowserLauncher
Show a url in the default native browser for the users OS.
NativeBrowserLauncher.openURL(String url);
ComponentFactory
Provides a series of static methods to create some standard Swing components with Protege default look and feel.
CheckTable
A table that supports selection checkboxes in the first column with a "check all" option
CheckList
File dialogs
Provides a number of native file selectors for loading or saving files.
use: org.protege.editor.core.ui.util.UIUtil
FilePathPanel/FileURIPanel
An editor with a built in file selection dialog (as used by Open ontology dialogs etc)
LinkLabel
A label that acts like a hyperlink
OWL Specific components
Many of the OWL components are very specific, but a number can be reused in your own application.
Expression Editor
A text editor that allows OWL objects to be created. It provides content parsing, autocompletion, validation and rendering of existing OWL objects using the The type of object that is supported depends on the OWLExpressionChecker that is provided in the constructor (eg OWLDescriptionChecker).
use: org.protege.editor.owl.ui.clsdescriptioneditor.ExpressionEditor
example of use: org.protege.editor.owl.ui.editor.OWLDescriptionExpressionEditor
OWLClassDescriptionEditor
A tabbed component that can take any number of OWLDescriptionEditors as tabs and can be used to create OWL expressions
OWLEntityFindPanel
A component that, given another component that implements Findable will allow a search based on entity name.
OWL Frame lists
See Frame views to see what the component looks like.
An extension of MList (see #Lists above) that contains axioms and provides additional functionality (such as right click items). This list is used in all of the default entity description views and others. A frame list is initialised with an OWLFrame that contains sections (OWLFrameSections), each of which contains rows (OWLFrameSectionRows). An example of an OWLFrame is org.protege.editor.owl.ui.frame.OWLClassDescriptionFrame
All the work in using a frame list is likely to be in creating/specifying the AbstractOWLFrameSections that its frame contains.
use: org.protege.editor.owl.ui.framelist.OWLFrameList2
many examples of OWLFrameSections are available in org.protege.editor.owl.ui.frame
Views
Views are implemented as plugins (see PluginTypes#ViewComponent for more details).
Rename entities UI
use: org.protege.editor.owl.ui.rename.RenameEntityPanel
Renderering / renderers
Various string renderers and cell renderers are available in the org.protege.editor.owl.ui.renderer package. You can get renderings for OWLObjects and OWLEntities directly from the OWLModelManager as this will use the cache and also ensures the rendering is consistent with the defaults selected for the rest of P4.
Most components described here already use the OWL cell renderers
OWL Entity selectors
Selectors for each type of entity are available in the org.protege.editor.owl.ui.selector package. You can get pull up a selector dialog more easily by using #UIHelper.pickOWLClass() etc.
example: org.protege.editor.owl.ui.selector.OWLClassSelectorPanel
OWL Icons
Same as #Icons but gets its icon images from the icons/ folder in the owl plugin.
OWL object trees
Take a hierarchy provider and render a JTree with the correct cell renderer and default protege behaviour.
use: org.protege.editor.owl.ui.tree.OWLModelManagerTree
OWLComponentFactory
Get selectors and editors for OWL Objects.
This can be retrieved from the OWLWorkspace.getOWLComponentFactory().
UIHelper
Provides many useful static methods.
use: org.protege.editor.owl.ui.UIHelper
Behaviours
Many of these behaviours can be added to views/components.
To be documented - for now, search for the interfaces usage.
Draggable
Deleteable/Copyable
Findable
CreateNewChild/SiblingTarget
Back to Protege Developer Documentation