Kernel Prolog with Fluent based Builtins

tarau.jinnigui
Class GuiEngine

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--tarau.jinnigui.GuiEngine
Direct Known Subclasses:
JinniConsole

public class GuiEngine
extends java.awt.Panel
implements IOPeer, java.lang.Runnable

Simple GUI interface to Jinni. To be extended:-)

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
private  java.awt.Container container
           
(package private)  java.lang.Thread goalThread
           
(package private)  java.awt.TextField inputField
           
private static int instance_ctr
           
private  java.awt.TextArea outputArea
           
(package private)  java.awt.TextField readField
           
(package private)  java.lang.Thread readThread
           
static int textHeight
           
static int textWidth
           
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
GuiEngine(java.awt.Container container)
          Creates the Frame together with its program thread and it's Prolog code represented as a trivial java class.
 
Method Summary
 boolean action(java.awt.Event evt, java.lang.Object arg)
          Acts on events from TextFields
private  boolean addReader(java.lang.Thread readThread)
          Registers a reader thread to operate on readField
(package private)  void changeFocus(java.awt.TextField from, java.awt.TextField to)
          Swtiches between '?-' query input and Prolog read(X) operations.
(package private)  void clean_up_goal()
           
 void destroy()
          Executes when the applet is destroyed.
 java.lang.String firstQuery()
          Initializes Jinni input area with this
 java.lang.String getInfo()
           
private  java.lang.String getReadString()
          returns a String read from readField
 void halt()
           
 boolean handleEvent(java.awt.Event event)
           
(package private)  void initPeer()
          Notifies class IO that we are an GUI mode.
private  void initThis()
          Frame specific initialization
 void print(java.lang.String s)
          Gives the illusion to output routines in class IO that they are printing to a console.
 void println(java.lang.String s)
           
 java.lang.String readln()
          Reads a string.
(package private)  void resetPeer()
           
 void run()
          Avoids spurious reinitialisation.
 void show_document(java.net.URL url, java.lang.String target)
           
 void stop()
          Executes when the applet is stopped.
 void traceln(java.lang.String s)
           
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getCursorTarget, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, nextFocus, paint, paintComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printOneComponent, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setCursor, setFocusOwner, setFont, setLayout, transferFocus, update, updateCursor, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

container

private java.awt.Container container

inputField

java.awt.TextField inputField

readField

java.awt.TextField readField

outputArea

private java.awt.TextArea outputArea

textHeight

public static int textHeight

textWidth

public static int textWidth

instance_ctr

private static int instance_ctr

goalThread

java.lang.Thread goalThread

readThread

java.lang.Thread readThread
Constructor Detail

GuiEngine

public GuiEngine(java.awt.Container container)
Creates the Frame together with its program thread and it's Prolog code represented as a trivial java class. Note that the translatiom lib.pro->lib.java->lib.class is the simplest way to get Prolog code fetched into the the application
Method Detail

print

public void print(java.lang.String s)
Gives the illusion to output routines in class IO that they are printing to a console.
Specified by:
print in interface IOPeer
See Also:
IO

println

public void println(java.lang.String s)
Specified by:
println in interface IOPeer

traceln

public void traceln(java.lang.String s)
Specified by:
traceln in interface IOPeer

show_document

public void show_document(java.net.URL url,
                          java.lang.String target)

firstQuery

public java.lang.String firstQuery()
Initializes Jinni input area with this

initThis

private void initThis()
Frame specific initialization

initPeer

void initPeer()
Notifies class IO that we are an GUI mode.

resetPeer

void resetPeer()

run

public void run()
Avoids spurious reinitialisation.
Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Executes when the applet is stopped.

destroy

public void destroy()
Executes when the applet is destroyed. Cleans up goal threads.

halt

public void halt()
Specified by:
halt in interface IOPeer

clean_up_goal

void clean_up_goal()

changeFocus

void changeFocus(java.awt.TextField from,
                 java.awt.TextField to)
Swtiches between '?-' query input and Prolog read(X) operations.

addReader

private boolean addReader(java.lang.Thread readThread)
Registers a reader thread to operate on readField

getReadString

private java.lang.String getReadString()
returns a String read from readField

readln

public java.lang.String readln()
Reads a string. Suspends and resumes the caller thread until the string is available.
Specified by:
readln in interface IOPeer

action

public boolean action(java.awt.Event evt,
                      java.lang.Object arg)
Acts on events from TextFields
Overrides:
action in class java.awt.Component

handleEvent

public boolean handleEvent(java.awt.Event event)
Overrides:
handleEvent in class java.awt.Component

getInfo

public java.lang.String getInfo()

Kernel Prolog with Fluent based Builtins