⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 termsdisplay.java

📁 Semantic Web Ontology Editor
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
//The MIT License//// Copyright (c) 2004 Mindswap Research Group, University of Maryland, College Park//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions://// The above copyright notice and this permission notice shall be included in// all copies or substantial portions of the Software.//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS// IN THE SOFTWARE.package org.mindswap.swoop;import java.awt.BorderLayout;import java.awt.Component;import java.awt.Font;import java.awt.GridLayout;import java.awt.Point;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.awt.event.KeyListener;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.awt.event.MouseMotionListener;import java.beans.PropertyChangeEvent;import java.beans.PropertyVetoException;import java.beans.VetoableChangeListener;import java.io.File;import java.io.StringWriter;import java.net.URI;import java.util.ArrayList;import java.util.Collection;import java.util.Collections;import java.util.Comparator;import java.util.HashSet;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.Set;import java.util.TreeSet;import java.util.Vector;import javax.swing.AbstractButton;import javax.swing.Box;import javax.swing.BoxLayout;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JCheckBoxMenuItem;import javax.swing.JComboBox;import javax.swing.JEditorPane;import javax.swing.JLabel;import javax.swing.JList;import javax.swing.JMenu;import javax.swing.JMenuItem;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPopupMenu;import javax.swing.JScrollPane;import javax.swing.JSplitPane;import javax.swing.JTabbedPane;import javax.swing.JTextField;import javax.swing.JTree;import javax.swing.ListModel;import javax.swing.SwingUtilities;import javax.swing.event.ChangeEvent;import javax.swing.event.ChangeListener;import javax.swing.event.DocumentEvent;import javax.swing.event.DocumentListener;import javax.swing.event.HyperlinkEvent;import javax.swing.event.HyperlinkListener;import javax.swing.event.ListSelectionEvent;import javax.swing.event.ListSelectionListener;import javax.swing.event.TreeSelectionEvent;import javax.swing.event.TreeSelectionListener;import javax.swing.text.Document;import javax.swing.tree.DefaultMutableTreeNode;import javax.swing.tree.TreeModel;import javax.swing.tree.TreePath;import org.mindswap.pellet.PelletOptions;import org.mindswap.pellet.utils.Timer;import org.mindswap.swoop.annotea.AnnoteaRenderer;import org.mindswap.swoop.change.ChangeLog;import org.mindswap.swoop.popup.PopupAddClass;import org.mindswap.swoop.popup.PopupExplanation;import org.mindswap.swoop.popup.PopupNew;import org.mindswap.swoop.reasoner.PelletReasoner;import org.mindswap.swoop.reasoner.SwoopRDFSReasoner;import org.mindswap.swoop.reasoner.SwoopReasoner;import org.mindswap.swoop.reasoner.SwoopToldReasoner;import org.mindswap.swoop.renderer.SwoopCellRenderer;import org.mindswap.swoop.renderer.SwoopEditableRenderer;import org.mindswap.swoop.renderer.SwoopEntityRenderer;import org.mindswap.swoop.renderer.SwoopRenderer;import org.mindswap.swoop.renderer.entity.AbstractSyntaxEntityRenderer;import org.mindswap.swoop.renderer.entity.ConciseFormatEntityRenderer;import org.mindswap.swoop.renderer.entity.RDFXMLEntityRenderer;import org.mindswap.swoop.renderer.entity.TurtleEntityRenderer;import org.mindswap.swoop.renderer.entity.graph.GraphPanel;import org.mindswap.swoop.utils.PluginLoader;import org.mindswap.swoop.utils.SwoopCache;import org.mindswap.swoop.utils.XPointers;import org.mindswap.swoop.utils.explain.DatatypeExplanationHTMLSerializer;import org.mindswap.swoop.utils.explain.OWLVocabularyExplanationDeposit;import org.mindswap.swoop.utils.explain.RDFSVocabularyExplanationDeposit;import org.mindswap.swoop.utils.explain.RDFVocabularyExplanationDeposit;import org.mindswap.swoop.utils.explain.VocabularyExplanationHTMLSerializer;import org.mindswap.swoop.utils.explain.XSDDatatypeExplanationDeposit;import org.mindswap.swoop.utils.ui.AlphaListRenderer;import org.mindswap.swoop.utils.ui.BrowserControl;import org.mindswap.swoop.utils.ui.ComparatorFrame;import org.mindswap.swoop.utils.ui.EntityComparator;import org.mindswap.swoop.utils.ui.SwoopIcons;import org.mindswap.swoop.utils.ui.turtle2RDF.Turtle2RDFConverter;import org.semanticweb.owl.io.RendererException;import org.semanticweb.owl.io.vocabulary.OWLVocabularyAdapter;import org.semanticweb.owl.io.vocabulary.RDFSVocabularyAdapter;import org.semanticweb.owl.io.vocabulary.RDFVocabularyAdapter;import org.semanticweb.owl.io.vocabulary.XMLSchemaSimpleDatatypeVocabulary;import org.semanticweb.owl.model.OWLClass;import org.semanticweb.owl.model.OWLDataProperty;import org.semanticweb.owl.model.OWLDescription;import org.semanticweb.owl.model.OWLEntity;import org.semanticweb.owl.model.OWLException;import org.semanticweb.owl.model.OWLIndividual;import org.semanticweb.owl.model.OWLNamedObject;import org.semanticweb.owl.model.OWLObjectProperty;import org.semanticweb.owl.model.OWLOntology;import org.semanticweb.owl.model.OWLProperty;import org.semanticweb.owl.model.OWLSubClassAxiom;import org.semanticweb.owl.model.change.ChangeVisitor;import org.semanticweb.owl.model.change.OntologyChange;import org.semanticweb.owl.model.change.RemoveEntity;import org.semanticweb.owl.model.helper.OntologyHelper;import org.xngr.browser.editor.XmlEditorPane;import org.semanticweb.owl.rules.OWLRuleIVariable;import org.semanticweb.owl.rules.OWLRuleObjectPropertyAtom;/** * @author Aditya Kalyanpur * */public class TermsDisplay extends SwoopDisplayPanel implements ActionListener, MouseListener, KeyListener, MouseMotionListener, DocumentListener, ChangeListener, ListSelectionListener, HyperlinkListener, TreeSelectionListener, SwoopModelListener {		/*	 * Global UI objects	 */	JButton lookupBtn;	JButton addClassBtn, addPropBtn, addIndBtn, addGCIBtn, remTermBtn, renameTermBtn;	JButton prevBtn, nextBtn;	JPanel termEditButtonPane, termListPanel, termDisplayEditPane;	JButton applyChangesBtn, undoChangesBtn;	JTextField lookupFld;	JPopupMenu popupMenu;	JMenuItem openBrowserMenu;	Font tahoma = new Font("Tahoma", Font.PLAIN, 11);    	JList termList;	public JTabbedPane termTabPane, termDisplayPane;	JCheckBox showImportChk, showQNamesChk, termEditableChk, showIconsChk, searchAllChk;	JCheckBoxMenuItem debugChk, debugGlassChk, debugBlackChk;	JCheckBox showInheritedChk;	JComboBox reasonerCombo;	JTree[] trees = new JTree[2];	OWLOntology classTreeOfOntology, propTreeOfOntology;	JComboBox filterCombo;	JTabbedPane advancedPane;	SwoopSearch lookupPanel, referencePanel;	URI treeEntityURI;	JLabel warningEditLbl;		//Dave: added to support xsd datatype rendering/ owl vocabulary rendering		XSDDatatypeExplanationDeposit    myXSDDatatypeExplanations  = XSDDatatypeExplanationDeposit.getInstance();	OWLVocabularyExplanationDeposit  myOWLVocabExplanations     = OWLVocabularyExplanationDeposit.getInstance();	RDFSVocabularyExplanationDeposit myRDFSVocabExplanations    = RDFSVocabularyExplanationDeposit.getInstance();	RDFVocabularyExplanationDeposit  myRDFVocabExplanations     = RDFVocabularyExplanationDeposit.getInstance();		public final static String[] filterNames= {	    "Show All",	    "Show Individuals",	    "Show Classes",	    "Show Properties",		"Show GCIs",		//****************************************		//Added for Econnections		//****************************************		 "Show Foreign Entities",		//***************************************//	    "Show DataProperties",//	    "Show ObjectProperties",	};	public final static int FILTER_COUNT =  filterNames.length;;		/*	 * Important public fields	 */	SwoopModel swoopModel;	// model shared by all swoop components	SwoopFrame swoopHandler; // handler for SwoopFrame instance	TreeRenderer treeRenderer; // renders class and property trees  	AnnoteaRenderer annoteaRenderer; // renders entity annotations 	OWLNamedObject[][] historyEntity; // history of OWL objects rendered (used by back, next buttons)	boolean historyImports[]; // history of show_imports (corresponding to historyEntity) 	public ComparatorFrame comparator; // resource holder 	int historyCtr; // counter for history array	boolean rightClicked = false; // used by popup menu 	boolean enableLogging = true; // toggle enable logging of changes	boolean historyTraversing = false; // used to disable certain listeners while traversing history	String urlClicked = ""; // used by popup menu	SwoopCache listCache; // cache for alphabetical term list		/*	 * A list of renderers associated with each tab. The list contains SwoopEntityRenderer	 * objects and the index of renderers correspond to index of tabs	 */	public List renderers = new ArrayList();		/*	 * A list of editors associated with each tab. The list contains JEditorPane	 * objects and the index of editors correspond to index of tabs	 */	public List editors = new ArrayList();		/*	 * List of reasoners avaliable	 */	List reasoners = new ArrayList();		// constructor	public TermsDisplay(SwoopFrame swf, SwoopModel swoopModel) {					this.swoopModel = swoopModel;		this.swoopHandler = swf;		this.treeRenderer = new TreeRenderer(swoopModel, swoopHandler);		this.lookupPanel = new SwoopSearch(swoopModel, this, "Lookup Results");		this.referencePanel = new SwoopSearch(swoopModel, this, "Reference Results");		historyCtr = -1;		historyEntity = new OWLNamedObject[9999][2]; // current size limitation of history		historyImports = new boolean[9999];		comparator = new ComparatorFrame(this);				listCache = new SwoopCache();		setupUI();		setupPopupMenu();		this.refreshEditorMode();			}				public void setupUI () {				//panel for lookup button, field and history buttons		JPanel topbtnPanel = new JPanel();		topbtnPanel.setLayout(new GridLayout(1,4));				try {			// load history button images			SwoopIcons swoopIcons = new SwoopIcons();			ImageIcon prevIcon = (ImageIcon) SwoopIcons.prevIcon;			if (SwoopIcons.prevIcon!=null) prevBtn = new JButton(prevIcon);			else prevBtn = new JButton("Previous");			prevBtn.setFont(tahoma);			prevBtn.addActionListener(this);			prevBtn.setEnabled(false);			prevBtn.addMouseMotionListener(this);			ImageIcon nextIcon = (ImageIcon) SwoopIcons.nextIcon;			if ( SwoopIcons.nextIcon!=null) nextBtn = new JButton(nextIcon);			else nextBtn = new JButton("Next");			nextBtn.setFont(tahoma);			nextBtn.addActionListener(this);			nextBtn.setEnabled(false);			nextBtn.addMouseMotionListener(this);		}		catch (Exception ex) {			ex.printStackTrace();		}				// create history panel		JPanel histPanel = new JPanel();		histPanel.setLayout(new GridLayout(1,2));		histPanel.add(prevBtn);		histPanel.add(nextBtn);		for (int ctr=0; ctr<3; ctr++) topbtnPanel.add(new JLabel(""));		topbtnPanel.add(histPanel, "East");				lookupBtn = new JButton("Lookup");		lookupBtn.setFont(tahoma);		lookupBtn.addActionListener(this);				lookupFld = new JTextField();		lookupFld.setFont(new Font(swoopModel.getFontFace(), Font.PLAIN, 11));		lookupFld.addActionListener(this);		searchAllChk = new JCheckBox("All Ontologies?");		searchAllChk.setFont(tahoma);		searchAllChk.setSelected(swoopModel.isLookupAllOnts());		searchAllChk.addActionListener(this);				// panel for term list and description pane		JPanel centerPanel = new JPanel();		centerPanel.setLayout(new GridLayout(1,1));		JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);		splitPane.setOneTouchExpandable(true);				// if termlist is already created and re-drawn, save sel-index		int termIndex = -1;		if (termList!=null) {			termIndex = termList.getSelectedIndex();		}					// creation of term list		termList = new JList();		termList.addListSelectionListener(this);		termList.addMouseMotionListener(this);		termList.addMouseListener(this);		termList.addKeyListener(this);		termList.setCellRenderer(new SwoopCellRenderer(swoopModel));		termList.setFont(new Font(swoopModel.getFontFace(), Font.PLAIN, 11));//		termList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);		JScrollPane termListPane = new JScrollPane(termList);				// create alphabetical list pane		JPanel alphaPane = new JPanel();		alphaPane.setLayout(new BorderLayout());		alphaPane.add(termListPane, "Center");		filterCombo = new JComboBox();		filterCombo.setFont(tahoma);				filterCombo.setRenderer(new AlphaListRenderer());				for( int i = 0; i < FILTER_COUNT; i++ ) {		    filterCombo.addItem(filterNames[i]);		}		filterCombo.addActionListener(this);		filterCombo.setSelectedItem(swoopModel.getTermListFilter());		alphaPane.add(filterCombo, "North");				// create tabbed pane for terms - tree hierarchy		termTabPane = new JTabbedPane();		termTabPane.addTab("Class Tree", new JScrollPane());		termTabPane.addTab("Property Tree", new JScrollPane());		termTabPane.addTab("List", alphaPane);		termTabPane.setFont(tahoma);		termTabPane.addChangeListener(this);				// add termlist and tabpane to termPanel		JPanel termPanel = new JPanel();		termPanel.setLayout(new BorderLayout());		//termPanel.setOneTouchExpandable(true);				JPanel termTabPanel = new JPanel();		termTabPanel.setLayout(new BorderLayout());		JPanel lookupPanel = new JPanel();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -