operationalizationbox.java

来自「toocom源代码,主要应用在本体匹配方面!」· Java 代码 · 共 57 行

JAVA
57 行
字号
package toocom.ui;

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

/** 
 * This class represents the labeled box used in the form dedicated to the operationalization
 * of axioms.
 *
 * @author Fr閐閞ic F黵st
 */
public class OperationalizationBox extends Box{

	private Axiom a;
	private JComboBox box;
	
	/** Creates a combobox for the given axiom and with the given context of use selected. If
	 *  cou is null, the inferential and explicite context of use is selected. */
	public OperationalizationBox(Language l, Axiom a, ContextOfUse cou){
		super(BoxLayout.X_AXIS);
		this.add(new JLabel(a.getTerm(l)));
		this.box = new JComboBox();
		for(Iterator i = ContextOfUse.getAllAvailableContexts().iterator();i.hasNext();){
			box.addItem(((ContextOfUse) i.next()).getTerm(l));
		}
		this.box.addActionListener(new ActionListener(){
    		public void actionPerformed(ActionEvent e){
    			setContextOfUse();
    		}
    	});
		this.add(box);
		this.a = a;
		if(cou != null){
			if(cou.isInferential()){
				if(cou.isExplicit()) this.box.setSelectedIndex(0);
				else this.box.setSelectedIndex(1);
			}
			else{
				if(cou.isExplicit()) this.box.setSelectedIndex(2);
				else this.box.setSelectedIndex(3);
			}
		}
	}
	
	public void setContextOfUse(){	
		if(this.box.getSelectedIndex() == 0) this.a.setContextOfUse(new ContextOfUse(true,true));
		if(this.box.getSelectedIndex() == 1) this.a.setContextOfUse(new ContextOfUse(true,false));
		if(this.box.getSelectedIndex() == 2) this.a.setContextOfUse(new ContextOfUse(false,true));
		if(this.box.getSelectedIndex() == 3) this.a.setContextOfUse(new ContextOfUse(false,false));
	}
	
}

⌨️ 快捷键说明

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