I think Ruetzel, Andreas wrote:
> Hello,
> 
> I have some questions around events and integration Jess facts in
> Java-GUI
> 
> Im running Jess Version 6.0. evaluation copy

Note that straightening out some of the inconsistencies in the
JessEvent machinery has been a focus of the last few 6.1 releases. 

> This is the simple example I like to run:

[ Long example deleted ]

> 1. With the scriptlib the code runs. And rule fire. But no Jessevent is
> generated. What is wrong with code?

No idea why an explicit "batch scriptlib" has any effect. Perhaps
you've done something odd with the installation -- putting Jess 6.0 in
the JDK/lib/ext directory, for example, qualifies as "weird". There's
a little information about installing later versions of Jess as
standard extensions in the 6.1 release notes.

As far as why your event listener doesn't see any events: because you
have to set the Rete objects event mask using setEventMask to include
the DEFRULE_FIRED event you're interested in. The manual covers this
fairly clearly.

> 
> 2. Most code examples given by ernest like facts.clp and pumps.clp code
> Java-GUI inside of Jess.
>     I prefere to code my GUI in a JAVA-IDE and only the rules and facts
> inside JESS.

No problem with that.

>     
>       I started and code in Java like this:
>       Lub = new Choice();
>       cLub.addItem("lub");
>       cLub.addItem("dry");
>  
>       How can I access the items from Jess? Can I access them via
> Fact-ID-No. or do I have to store and fetch them?
> 

Precisely the same way as you'd access them from any Java code outside
of the method that created them. You have to give Jess some way to
get a handle to the Choice object. There are a millions ways to do
that: storing it in a static member variable, using store() to
pass an explicit reference to Jess, setting a defglobal to point to
it... there are any number of different ways.


> 3. And the other way around: Jess produce some facts during the run I
> like to show in textfields. How can I perform this. Code is appreciated.
> 

If Jess has a reference to the relevant TextField, then it can just
set the text the way any Java code would -- by calling
setText. Perhaps the LHS of a rule would match the facts, and the RHS
would call setText in response.

        (?someTextField setText "The text")
        
> 4. As I unterstand the JessListener it observes an event like rulefired.
> Can I observe more specifically only facts and rules I'm interested?
> 

No, but the RHS of a rule can call a Java method as a way of telling
your Java code that it has fired.

--------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to