🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14617

Re: Creating own event mechanism for non-graphical applications

#14617
From: Paul Furbacher [TeamB]
Date: Thu, 19 Aug 1999 00:00
39 lines
2511 bytes
zaf wrote:

> I am interested in using events within a server side application, among
> other things as part of the communication mechanism between threads. All
> documentation I have come across (printed or on-line) talks about creating
> event listeners, to be used in graphical application, such as listening to
> mouse events etc.

You have to read more carefully.
 
> I would appreciate simple code samples, showing the standard procedure of
> creating events and event listeners for non-graphoical applications ,as well
> as suggestions to documentation which may exist on the subject.

The JBuilder "Developer's Guide" presents a very clear discussion
of this in Chapter 30 -- Working With Events.  Beginning on page 30-9
you can read about creating a custom event set for a Timer object.
The author(s) clearly hint at JBCL events, such as that the 
"modelContentChanged" event, which are not explicitly tied to 
"external" events.  Such an event is fired, not by key presses, or 
mouse clicks, but by changes in the content of a model.  It may 
be a key press that initiates the whole chain of events which 
ultimately lead to a modelContentChanged event being fired, 
but you can trigger it programmatically without any key presses 
or mouse clicks.

At the end of the chapter, a pretty thorough list of custom event
sets is given.  If you have JBuilder Pro or greater, you can browse
the JBCL source code to study a good number of them.  But after
a while, the pattern becomes apparent, and it's exactly the same
as outlined in the manual (no surprise).

The trick to orienting your perspective is to generalize mouse clicks
and key presses to "stimuli".  A stimulus can come from the user
interface, a data model, or as in the manual, a timer object.  The
process of designing and implementing an event object is the same.


Paul Furbacher  (TeamB)
Technical Details
Message-ID: <37BC102A.D6FF0267@bilbo.bio.purdue.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7pgc60$45c1@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,5049728f68c1b3c1
X-Google-Attributes: gidf74b3,public
From: "Paul Furbacher [TeamB]" <pf@bilbo.bio.purdue.edu>
Subject: Re: Creating own event mechanism for non-graphical applications
Date: 1999/08/19
Message-ID: <37BC102A.D6FF0267@bilbo.bio.purdue.edu>
X-Deja-AN: 514684018
Content-Transfer-Encoding: 7bit
References: <7pgc60$45c1@forums.borland.com>
Content-Type: text/plain; charset=us-ascii
Organization: Reverse Alchemy, Inc.
Mime-Version: 1.0
Reply-To: pf@bilbo.bio.purdue.edu
Newsgroups: borland.public.jbuilder.java.language