SubprocessEngineWindow.java

00001 /* 
00002 ** Author(s): Miguel Calejo
00003 ** Contact:   interprolog@declarativa.com, http://www.declarativa.com
00004 ** Copyright (C) Declarativa, Portugal, 2000-2002
00005 ** Use and distribution, without any warranties, under the terms of the 
00006 ** GNU Library General Public License, readable in http://www.fsf.org/copyleft/lgpl.html
00007 */
00008 package com.declarativa.interprolog.gui;
00009 import com.declarativa.interprolog.*;
00010 
00012 public class SubprocessEngineWindow extends ListenerWindow implements PrologOutputListener{
00013         
00014         public SubprocessEngineWindow(SubprocessEngine e){
00015                 this(e,true);
00016                 setTitle("SubprocessEngine listener");
00017         }
00018         public SubprocessEngineWindow(SubprocessEngine e,boolean autoDisplay){
00019                 super(e,autoDisplay);
00020                 ((SubprocessEngine)engine).addPrologOutputListener(this); // so we get output and prompt "events"
00021         }
00022         public void sendToProlog(){
00023                 String goal = prologInput.getText();
00024                 prologOutput.append(goal+"\n");
00025                 ((SubprocessEngine)engine).sendAndFlushLn(goal);
00026                 focusInput();
00027                 addToHistory();
00028         }
00029         
00030         // PrologOutputListener method:
00031         public void print(String s){
00032                 if (debug) System.out.println("print("+s+")");
00033                 prologOutput.append(s);
00034                 scrollToBottom();
00035         } 
00038         public static void main(String[] args){
00039                 commonMain(args);
00040                 new SubprocessEngineWindow(new SubprocessEngine(prologStartCommand,debug));
00041                
00042         }
00043 
00044 }

Generated on Wed Jul 26 13:30:44 2006 for XSB by  doxygen 1.4.5