Mashup Designer for Mozilla Prism Apps
Mashups
It’s been called the essence of Web 2.0. It’s the ability to combine pieces of different web sites to create something new, something meaningful. Something for you and the people who have your tastes. Your social network. Not some mass market portal built by corporate programmers who think that they know you and your personal tastes.
Referred to as a composite web site by some and Mashup site by others, we call it amalgamating web data through the process of transcoding. Whatever. It’s about giving you the data that you want on your mobile phone or desktop browser. It’s Web 2.0. It’s about you.
Mozilla Prism Apps
Integrated into your desktop, they provide you with easy access to important information. Any piece of web data, it’s there at a glance. No need to launch your browser. No need to scroll a web page to find that chunk of important data. No clicking. It’s always there. No need to refresh. It constantly updates itself. It’s your Mozilla Prism App powered by <alt> Mashup technologies and infused with a bit of AJAX.
Screen Cast and PDF Version
A screen cast of the Mashup Designer for Mozilla Prism Apps is available here:
http://altmobile.com/Screencasts/1173873451589.html
If you are viewing an HTML version of this document, some images may have been corrupted during the conversion process. For best viewing, a PDF version is available here:
http://altmobile.com/pdf/Mashup%20Designer%20for%20Mozilla%20Prism%20Apps.pdf
Mozilla Prism App Designer Features
The Mashup Designer for Mozilla Prism Apps extends the reach of our Mashup development tools to include Mozilla Prism Apps as deployment clients.
To
understand the underlying technology of our Mashup tools—and in
fact to build a Mashup App—you will use our StableDOM technology.
The StableDOM product documentation is located at
http://altmobile.com/pdf/StableDOM.pdf.
The XML Transcoding product documentation is located at
http://altmobile.com/pdf/XML%20Transcoding.pdf.
Review the DOM Browser product document to understand how to create
enterprise Mashups that integrate SQL data, Web Services data, and
HTML content. It is located at
http://altmobile.com/pdf/DOM%20Browser.pdf.
And finally, our Mashup monitoring and metadata implementation is
documented here: http://altmobile.com/pdf/Mashup%20Tools.pdf.
Leveraging the StableDOM and code generation technologies, our Mashup Designer for Mozilla Prism Apps provides the following major capabilities:
An Opera or Firefox browser-based design tool.
Fill-in-the-blank form to define your Mashup content properties.
Fill-in-the-blank form to define your App layout styles.
Fill-in-the-blank form to define your page properties.
Fill-in-the-blank form to define your AJAX properties.
Testing a prototype of your App accessing live data.
Generation of your App files.
The following is a screen shot of the Mashup Designer for Mozilla Prism Apps when first launched:

Defining Content Style Properties
The Mashup Designer for Mozilla Prism Apps allows you to define the following content properties:
Background color.
Foreground color.
Background image color.
Font family.
Font size.
Text-to-Speech options.
The following screen shot shows the content properties section of Mashup Designer:

Defining App Layout Styles
The Mashup Designer for Mozilla Prism Apps allows you to define the following App layout styles:
No footer. This option will remove the CSS property border-top of the footer. The “flip” icon will remain and is unchanged.
Footer updated with time stamp. On each update from the Mashup server, a JavaScript will update the footer with the local time. This ensures that the App user will know when the last content update took place.
Footer with static HTML. This will default to the following HTML:
<a href='http://altmobile.com'>ALT</a> mashup technologies and <a href='http://wiki.mozilla.org/WebRunner'>Mozilla</a> Prism
You should probably place your company support information or the App name and version.
The following screen shot shows the App layout styles section of the Designer:

Defining Page Properties
The Mashup Designer for Mozilla Prism Apps allows you to define the following Page properties:
Page Title.
The
official Mozilla Prism App configuration documentation is located at
the following URL: http://wiki.mozilla.orgWebRunner.

Defining AJAX Properties
The Mashup Designer for Mozilla Prism Apps allows you to define the following AJAX properties:
Mashup server URL. This field is auto-populated with the value of the Mozilla Prism Object Server URL. This is a special Object Server as is discussed later. This specified URL is used in the JavaScript source code generation to support AJAX calls to the Mashup server.
App content refresh specified in minutes. This field is auto-populated with the value of one minute. It is important to specify a realistic value as not to overwhelm the Mashup server’s resources and consequently the servers from which it fetches its data. This number is used in the JavaScript source code generation to support a JavaScript timer used by AJAX calls to the Mashup server.
The AJAX JavaScript source code to access the Mashup Server, update the content area of the App, and set a JavaScript timer. This allows you to quickly change any of XMLHTTP properties such as setting any custom headers.

Testing Your Mashup App
As an App can be constrained to provide a fixed size canvas, it is important to correctly size your App to contain all your data. Rather than delaying testing the fit of your content until deployment, the Mashup Designer for Mozilla Prism Apps provides a resizable App Prototype which displays the Mashup content.
To fetch the Mashup content and place it into the App Prototype, select the “Fetch Content” link as highlighted in this screen shot:

You can then resize the App Prototype to ensure your content fits. The width and height data – expressed in pixels—is placed in the title bar of the App Prototype for easy reference. The App Prototype is highlighted in this screen shot:

And a resized App Prototype is displayed in this screen shot:

Generating Your Mashup App Files
The Mashup Designer for Mozilla Prism Apps generates a unique directory containing:
The webapp.ini file specifying your Mashup App properties.
Images for the “switch” button, content, configuration, icon images. These are based on our cross platform look and feel.
A JavaScript file named mashupWorld.js containing the AJAX code needed to fetch and display the Mashup data. It also contains the behavior needed to change the configuration information.
A CSS file named mashupWorld.css containing rules for the generic Mashup App such as colors, fonts and layout.
A CSS file named designer-generated.css containing the size information calculated from the App Prototype size. It also sets the body CSS properties for the font-size, font-family, and color as specified in the Designer.
The index.html file containing the static portions of the Mashup App.
The .webapp file containing the previously mentioned files ready for deployment.
This service is accessed through the “Generate Prism App” link as highlighted in this screen shot:

The browser will display the location of your Mozilla Prism App as seen here:

Here is a screen shot of the directory with the Mashup App files:

A screen shot of the "front" of a sample Mashup App is seen here:

And, the "back" of the Mashup App looks like this:

The sample Mashup App demonstrates several important concepts and provides the skeleton needed for you to create aesthetically pleasing Mashup Apps:
The segmentation of the App into two visual areas: the content area and the status/control area.
In the sample Mashup App, the status/control area contains marketing information and the configuration "switch". Rather than static marketing information, e-commerce Apps might fetch a banner ad. The web advertisement association or Google/Yahoo will probably define a special banner ad size for Apps much as they have done for mobile ads.
More importantly it’s best to specify Mashup related data such as the last time data was fetched, for example, or perhaps the Mashup title or version.
A configuration “panel”. Enterprise users will want to define a standard configuration look and feel.
A start and stop capability. The generic Mashup App internally uses a JavaScript timer to invoke the AJAX code to fetch the Mashup data. The generated JavaScript code will remove any previously set timers.
The URL of the Mashup server providing content to this App. Internally, the generated Mashup App will store this URL in a temporary JavaScript variable.
The interval to refresh the content. As mentioned earlier, it is important to fetch at reasonable intervals. Internally, the generated Mashup App will store the refresh increment in a temporary JavaScript variable.
After starting, the time of the last Mashup update will be displayed on the configuration as seen in this screenshot:

Launching the Mashup Designer for Mozilla Prism Apps
As mentioned earlier, the Mashup Designer for Mozilla Prism Apps extends the reach of our Mashup development tools to include Mozilla Prism Apps as deployment clients. To launch the Designer, you should have already created a Mashup and generated the Dynamic XSL.
The
StableDOM HTML transcoding product documentation is located at
http://altmobile.com/pdf/StableDOM.pdf.
The XML Transcoding product documentation is located at
http://altmobile.com/pdf/XML%20Transcoding.pdf.
Review the DOM Browser product document to understand how to create
enterprise Mashups that integrate SQL data, Web Services data, and
HTML content. It is located at
http://altmobile.com/pdf/DOM%20Browser.pdf.
And finally, our Mashup monitoring and metadata implementation is
documented here: http://altmobile.com/pdf/Mashup%20Tools.pdf.
Once a Dynamic XSL has been created, you should launch a Mozilla Prism App Object Server by selecting the menu item “Mozilla Prism Object Server…” from the popup menu as seen in the following screen shot:


Much like a normal Object Server provides a micro web server enabling remote access to the XML or XSL content of the text editor—transcoding as needed from remote sites—the Mozilla Prism Object Server also allows you to launch a micro web server. This is seen in this screen shot:

In the above screen shot, you see how to launch an Object Server on a specific port. Unix users will be alerted about using restricted ports.
Review
the DOM Browser product document to understand how to use the Object
Server functionality: http://altmobile.com/pdf/DOM%20Browser.pdf.
In addition to all the features, HTTP debugging/monitoring, and manageability of a standard Object Server, the Mozilla Prism App Object Server provides the following additional capabilities:
Generates the Mashup Designer for Mozilla Prism Apps web page customized to support App development.
Launches Opera 9—which should be your default web browser—to view the Mashup Designer web page using the Opera command line API.
Implements the previously described “Fetch Content” service which is accessible through the Mashup Designer for Mozilla Prism Apps. The Fetch Content service returns the first child element of the BODY element generated by the Dynamic XSL. As such, it is important that your deployment Mashup server performs a similar element stripping or your JavaScript client does this. This is also a concern for any global CSS rules that your Mashup defines.
To reinforce this concept, let’s visualize a hypothetical XHTML document that was generated by a Dynamic XSL Mashup:

Since we want to dynamically update just the App’s content area and not the entire canvas, the Mozilla Prism App Object Server will just return the highlighted elements. Also note that the table element defines its border explicitly rather than defining a global CSS rule. This is highlighted in this screen shot:

Of course, an inline CSS rule would also work.
Implements the previously described "Generate App" service which is accessible through the Mashup Designer for Mozilla Prism Apps.
The Mashup Development Process for Mozilla Prism Apps
To create Mashup Apps, you should follow these steps:
If you are a web developer who prefers to use WYSIWYG HTML editors such as found in popular blog tools, then
Define your Mashup content by launching the StableDOM Browser from the "Mashup" menu as seen here:

This will launch the StableDOM browser enabling you to navigate to the remote URL just as you would with a traditional desktop web browser. Here is a screen shot of the StableDOM Browser:

The
StableDOM
Browser
differs than the HTML
Transformation Browser--
which is described later in the enterprise XML developer section-- in
that the HTML
Transformation Browser and
its engine extract remote HTML content and transform that content to
the target document language. So for example, if the remote content
is an HTML table and the target document is a WML document, then the
HTML
Transformation Browser
and its engine will dynamically create a WML table. The StableDOM
Browser
and its engine will not perform any node or content adaptation and
will only extract the remote HTML content. Both browsers use a
similar user interface, though.
Generate the semantic metadata for the remote HTML element by selecting the menu item "Display Transcoding Metadata for xxx" (where xxx will be the element name) from the popup menu as seen here:

A window will be displayed containing the metadata as seen here:

You
may tweak the XPath statement defined in the RDF metadata to best
locate the HTML element.
Launch the Mashup Monitor from the "Mashups" menu as seen here:

Drag and drop the RDF metadata onto the Mashup Monitor as seen here:

Construct your target HTML document in the WYSIWYG Mashup Designer by launching it from the Mashup menu as seen here:

You will be prompted to specify a port to run a special object server that is used to communicate with the WYSIWYG Mashup Designer. The WYSIWYG Mashup Designer will be launched in your default browser, as seen here:

The
<alt>
WYSIWYG Mashup Designer
is based on TinyMCE, the industry leading HTML blog editor. We have
created several TinyMCE plug-ins supporting the creation of Mashup
content for blogs, web sites, and App systems. For information on
TinyMCE, visit http://tinymce.moxiecode.com/.
Create your static content as you normally would. When you want to add dynamic content, select the "Mash" button to select previously defined Mashup content, as seen here:

The Mashup plug-in will launch a list of monitored Mashups, as seen here:

allowing you to view the remote content and insert it either as static or dynamic HTML content as seen here:

The
option to view the remote content in the "Content Viewer"
is only available when using the latest version of the Opera web
browser.
Insert the remote content either as static or dynamic content by selecting the appropriate hyperlink which will fetch the remote content and place it into the WYSIWYG Mashup Designer as seen here:

If
you use a browser other than the latest Opera web browser, you will
need to subsequently click on the Monitored
Mashup
dialog to close it. This seems to be a bug in the underlying TinyMCE
plug-in code.
You can now save the Mashup as a Dynamic XSL by selecting the "XSLT" button as seen here:

This invokes the Dynamic XSLT plug-in which makes AJAX calls to save the HTML content and in the process convert it to an XSLT document. The XSLT is displayed in a window as seen here:

And then use the popup from the new "XSL Source" window to launch the Mashup Designer for Mozilla Prism Apps as was described earlier in this document.
In
addition, you can use the various popup menus to interactively test
this Mashup in a browser, publish it as an RSS feed perhaps as a data
source for a Yahoo! Pipe, or use it as the content for a different
widget system… among a few other options as seen here:

Or invoke the Mashup Designer for Mozilla Prism Apps plug-in as seen here:

which is a short cut to saving first as an XSLT and then manually launching the Mozilla Prism Object Server. A new window or tab will be created to contain the Mashup Designer for Mozilla Prism Apps.
If you are an enterprise XML developer who requires fine-grained node level control—down to the attribute—of the target XML/XHTML output document, then
Construct your target document in the DOM Browser, or load a valid XHTML document into the DOM Browser. If you plan to transcode from multiple web sites or you are extracting a single piece of text content, then create a wrapper DIV as the first child of the BODY element.
Determine the styling requirements that your App should use. Encode this information directly on your DIV wrapper or within an appropriated file generated by the Mashup Designer such as mashupWorld.css. You can also specify many properties using the Designer as is discussed in the section “Defining Content Style Properties”.
The
following items are adapted from the StableDOM
product documentation located at
http://altmobile.com/pdf/StableDOM.pdf.
Decide which elements and text content should be extracted from the external HTML web sites.
Create any placeholder elements in the target document as necessary depending on the source item and the target DTD requirements.
For example, if you want to extract a <table> element from a remote web site and transcode it into an XHTML document, the XHTML DTD requires that the <table> must not be contained by a <p> element. So in this case, you should create a <div> placeholder in the target document as the parent for the new <table>.
Select the “Import Last Child from HTML Source” menu item from the parent element of the to-be-imported node as seen here:


This will launch the HTML Transformation Browser, allowing you to extract an HTML element or text content as needed.
In the below screen capture, we want to extract the paragraph text:

After selecting the “Extract text: Wed Dec…ST 2005” menu item from the popup, our target document will look like this:


Select the “Transform to Dynamic XSLT Source” menu item which cascades off the “XSLT” menu item which is found in the document node popup menu as seen here:

This displays the Dynamic XSLT source code which contains instructions to create both the static XHTML and dynamic XHTML using the special transcoding function getContent(url, xpath) as seen here:


The XSLT function getContent(url, xpath) simply calls the Java language function in HTMLUtil class as described in the Java language API section of the StableDOM product documentation. This diagram provides a view of HTML parsing pipeline through to the transcoding process and remote access by the App via AJAX:

During the generation of the Dynamic XSLT, the code generation component inspected the target document and transcoded accordingly. Other examples in the StableDOM product documentation describe how to transcode complex elements such as HTML tables and list.
Please
review the StableDOM
product documentation located at
http://altmobile.com/pdf/StableDOM.pdf
for more information on HTML Mashups. The XML
Transcoding
product documentation is located at
http://altmobile.com/pdf/XML%20Transcoding.pdf.
Review the DOM
Browser
product document to understand how to create enterprise Mashups that
integrate SQL data, Web Services data, and HTML content. It is
located at http://altmobile.com/pdf/DOM%20Browser.pdf.
And finally, our Mashup monitoring and metadata implementation is
documented here: http://altmobile.com/pdf/Mashup%20Tools.pdf.