Tutorial: Basic Receptors, Part II
Here we will look at a couple basic list viewer receptors, an image viewer receptor, and introduce the concept of membranes.
List Viewer
The list viewer is a simple display of a signal, flattened into a columnar display. The list viewer must be configured to listen to a specific semantic type. This is done by double-clicking on the receptor, which brings up the following dialog:
In the above dialog, we see that the list viewer is being configured to display signals with semantic type "LoggerMessage". Recall that this semantic type has the structure:
- Logger Message
- DateTime
- Text Message
- Text
- Value
- Text
When we add our "Hello World" receptor, which emits LoggerMessage types, we can see them accumulating in the list viewer's window:
This simple example illustrates how a semantic type's structure is flattened so that we can see the structure in a columnar display.
Note that double-clicking on a line will emit a signal whose contents is reconstructed from the selected line. We will demonstrate how this feature is used in the RSS Feed Reader applet.
Tabbed List Viewer
The tabbed list viewer is useful for combining multiple semantic type lists into a single tabbed window. The tabbed list viewer receptor must be configured to listen to the desired semantic types, again by double-clicking on the receptor, which brings up the configuration dialog:
In the above dialog, we have configured the viewer to give us system events (log, debug, error, and exception messages) in a tabbed window (again, using the Hello World receptor as an example use case):
Again, this a somewhat contrived example. We will see a much more useful example in the tutorial on the RSS Feed Reader applet.
Image Viewer
The image viewer receptor is a simple scaling image viewer. This receptor listens to "ImageFilename" semantic types and will display any image associated with a signal containing this protocol. Also, if you drag and drop an image file onto the HOPE surface, it is packaged into this semantic type and therefore the viewer will display the image, for example:
The image displayed in the viewer is always the most recently ImageFilename semantic type. But what if we want to display more than one image at a time? One solution is to use "membranes," which is introduced next.
Membranes
Membranes is a feature of HOPE that is derived from Membrane Computing. Membranes allow for the creation of "computational islands" in which you have control over the semantic type signals that "permeate" the membrane in both directions. We will give a very simple introductory example of using membranes to isolate ImageFilename semantic signals.
Using a Membrane to Display Images in Different Viewers
First, place two Image Viewer receptors on the surface:
Next, create a membrane around each receptor. This is done by left-click-drag to select the desired receptors, in this case, only one receptor, so we perform the selection process twice:
We now have two separate "computational islands" albeit there really is not particular computation being performed here!
Next, if we drag and drop an image file inside a particular membrane, we will be able to view the two images in separate windows:
The receptors inside a membrane are isolated from each other because signals cannot traverse a membrane unless the membrane is explicitly made permeable (moving in, moving out, or both) to that signal. Here are some of the features of membranes and ways to interact with them:
- Membranes can be made permeable to signals moving into the membrane, moving out of the membrane, or both.
- Membranes can be nested
- Membranes can be "dissolved" by grabbing the membrane's central nub and shaking it left-right.
- Receptors inside a membrane can be removed from the membrane (potentially into the outer membrane) by grabbing the receptor and shaking it up-down.
- Receptors can be added to a membrane by grabbing the receptor and moving it inside of an existing membrane.
Next: Thumbnail Creator / Carousel Viewer Applet