DisambiguationOracle.java
Go to the documentation of this file.
00001 package instruction.gui.internal;
00002 
00003 import java.util.List;
00004 import javax.swing.JPanel;
00005 import instruction.disambiguator.IDisambiguationOracle;
00006 import instruction.gui.dialog.ConceptSelectionDlg;
00007 import instruction.semanticObjects.Instruction;
00008 
00009 public class DisambiguationOracle implements IDisambiguationOracle {
00010 
00011         private JPanel parent = null;
00012         
00013         public DisambiguationOracle(JPanel parent) {
00014                 this.parent = parent;
00015         }
00016         
00017         public String retrieveMeaningOfWord(String word, List<String> meanings,
00018                         Instruction instruction) {
00019                 
00020                 ConceptSelectionDlg dlg = new ConceptSelectionDlg(null);
00021                 
00022                 dlg.getTextInstruction().setText("<html><p>" + instruction.getNLSentence().replaceAll(word, "<u>" + word + "</u>") + "</p></html>");
00023         //      dlg.getLabelWord().setText("\"" + word + "\"");
00024                 dlg.getConceptList().setListData(meanings.toArray(new String[0]));
00025                 dlg.setLocationRelativeTo( parent );
00026                 dlg.setModal(true);
00027                 
00028                 dlg.setVisible(true);
00029                 
00030                 if (dlg.getConceptList().getSelectedValue() == null)
00031                         return null;
00032                 else
00033                         return (String) dlg.getConceptList().getSelectedValue();
00034         }
00035 
00036 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


comp_ehow
Author(s): Moritz Tenorth, Daniel Nyga
autogenerated on Tue Apr 16 2013 00:18:02