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

📄 axiomsframe.java

📁 toocom源代码,主要应用在本体匹配方面!
💻 JAVA
字号:
package toocom.ui;

import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
import java.lang.*;
import toocom.ocgl.*;

/**
 * This class represents the graphical window used for building the axioms.
 * It is composed of an object AxiomsPanel which allows to show and act on an
 * axiom as a graph, and an AxiomsToolBar which provides the different actions
 * that can be done on the axiom. The class AxiomsFrame provides the functions
 * for the communication between the AxiomsToolBar and the AxiomsPanel.
 *
 * @author Fr閐閞ic F黵st
 * @author Nicolas Roy
 * @author Matthieu Legall
 * @author Dounia K閐a
 */
public class AxiomsFrame extends JPanel {	

	private MainFrame mf;
	private AxiomsToolBar atb;
	private AxiomsPanel ap;
	private JTextArea text;

	public void setPrimitiveMode(int mode){
		ap.setPrimitiveMode(mode);
	}

	public void startDrawingHelp() {
		ap.startDrawingHelp();
	}

	public void stopDrawingHelp() {
		ap.stopDrawingHelp();
	}

	public void clear() {
		ap.clear();
	}

	public void loadAxiom(Axiom a){
		ap.loadAxiom(a);
		atb.setEnable(true);
	}

	public void removeAxiom() {
		ap.removeAxiom();
	}

	public void newAxiom() {
		ap.newAxiom();
		atb.setEnable(true);
	}

	public Axiom getCurrentAxiom(){
		return (ap.getCurrentAxiom());
	}
	
	public void logicalForm(){
		Axiom a = ap.getCurrentAxiom();
		if(a != null){
			JDialog logicalFrame = new JDialog(mf,a.getTerm(mf.getOntologyLanguage()) + Constants.LOGICAL_FORM);
			logicalFrame.setSize(new Dimension(mf.getWidth()/2,mf.getHeight()/3));
			logicalFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			JTextArea text = new JTextArea();
			text.setEditable(false);
			text.append(a.toString(mf.getOntologyLanguage()));
			text.setLineWrap(true);
			JScrollPane scrollPanel = new JScrollPane(text);
			logicalFrame.getContentPane().add(scrollPanel);
		    logicalFrame.setResizable(true);
		    logicalFrame.setVisible(true);
		}
	}
	
	public void setNote(){
		ap.getCurrentAxiom().setNote(text.getText());
		text = null;
	}
	
	public void note(){
		Axiom a = ap.getCurrentAxiom();
		if(a != null){
			JDialog noteFrame = new JDialog(mf,a.getTerm(mf.getOntologyLanguage()) + Constants.NOTE);
			noteFrame.setSize(new Dimension(mf.getWidth()/2,mf.getHeight()/3));
			noteFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			noteFrame.addWindowListener(new WindowAdapter(){
				public void windowClosed(WindowEvent e){
					setNote();
				}
			});
			text = new JTextArea();
			text.setEditable(true);
			text.append(a.getNote());
			text.setLineWrap(true);
			JScrollPane scrollPanel = new JScrollPane(text);
			noteFrame.getContentPane().add(scrollPanel);
		    noteFrame.setResizable(true);
		    noteFrame.setVisible(true);
		}
	}
	
	public AxiomsFrame(MainFrame mf){
		super();
		this.mf = mf;
		this.setLayout(new BorderLayout());
		atb = new AxiomsToolBar(this);
		ap = new AxiomsPanel(mf);
    	this.add(atb, BorderLayout.NORTH);
    	this.add(ap, BorderLayout.CENTER);
    	atb.setEnable(true);
    	atb.setEnabled(true);
	}
	
}

⌨️ 快捷键说明

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