High-Tech Humanities

Stephen W. Cote's Blog

<<<>>>

Site Upgrades

Including a new version of Engine - Hemi

steve's Profile - 2009/09/28 22:46

A brief note - I'm making significant revisions to the site, including the introduction of Hemi, the third major revision to Engine for Web Applications.

 

I cleaned up the site templates (A MasterPage, some static skeletons for HTTP Handlers, and XSL for the static documents) to remove extraneous HTML and tweak the navigation. In particular, session and login related items were pushed to the right, adjacent to the framework developer tool. I also cleaned up the CSS and reduced the amount of startup scripting used to instrument the Engine Gizmos, primarily by using better use of CSS as well as new features in Hemi.

Add Response | 1 Responses | submit to reddit

Distributed Web Application Components Part 2

A way to distribute modularized Web applications

steve's Profile - 2009/07/27 23:54

In Distributed Web Application Components, the Engine for Web Applications Distributed Component feature was introduced. In Part II, the DWAC Designer is highlighted to show how Distributed Web Application Component projects are constructed, and a few simple examples are included. I'll also introduce a more complex example: drag-and-drop with canvas.

 

The DWACDesigner is a general Web-based development tool for creating Application Components and Tasks; extending Application Components with Templates and Fragments; and creating Distributed Component project files. DWACDesigner persists data through the Core Web project (via the DWACHandler HttpHandler). Therefore, it is necessary to authenticate with a registered user account.

 

The designer is separated into tabs:

 

Explorer : Navigate through the Account Manager file system for your account, starting at the top of the DWAC directory.

 

Projects : DWAC Project builder. Assemble Components, Tasks, Templates, and Fragments into a project, test it, and publish it into a unified DWAC file.

 

Task Lists : Create lists of tasks for bootstrapping your application component and performing basic workflows.

 

Fragments : Create XHTML chunks, define script scoped to the parent Template, or create reusable libraries for use by other Templates and Fragments.

 

Components : Create Application Components that may optionally be bound to XHTML nodes, load templates, and manage transactions.

 

Templates : Create XHTML to define the interface to your application, import Fragments, and define script scoped to the parent Component.

 

Running : Why wait? Each builder can run a work-in-progress on the page. More importantly, the Engine Profiler includes debugging and test tools for drilling through the internals of the framework to the script you are working on. And, when you run a demo of your work-in-progress, example code is included so you only need to cut-and-paste, and it's ready for use.

 

To create a Simple Example:

1) Navigate to the DWAC Designer for your account: /DWAC/user-name. For example, my designer is located at /DWAC/steve/.

2) Click the Components tab, or select Components from the tree control, and click the new icon. The New Component Template will be loaded in a window component.

3) Enter a component name, such as ExampleComponent, and click the Create button.

4) In the Component Model, select the component_init function.

5) Within the function body, use the getContainer function to obtain a reference to the object this component will be bound to. Example: this.getContainer. Add some content to the container to test the component, such as: this.getContainer().innerHTML = "<b>Loaded</b>". Although the built-in designer runtime will create a container (a <div /> element), this is optional when using the component.

6) Click the Update button to save the changes to the component_init function.

7) Click the Save icon to save the new component. Notice that after saving, the path to the component is displayed.

8) Select Declarative from the Scripted/Declarative drop-down, and then click the Run button to test the component.

9) In the Running tab, click Show Example Info to view cut-and-paste example HTML. If you have set up the Engine framework for your own Web site, you can use the new component by copying the example, saving the XML file to your Web server, and modifying the appcomp_path as appropriate. If you select Scripted, the example code will be JavaScript, but the result should be the same.

 

When dealing with more complex examples, sometimes it's easier to flesh out the details in a favorite IDE, which was the case with the the component.canvas.xml component. This was written while working on the component.hierarchy.xml and component.hierarchy_decorator.xml components for a canvas and feature demonstration. After creating the components, I then wanted to easily re-use them. Using the Import feature on the Component builder, it was two-clicks to import and save the component for use within DWAC Designer. I then quickly crafted an Example Template to implement the components, and from there it was very easy to debug and test the components in various circumstances.

 

Next, I created an Example Project to link together the templates, components, and a fragment of script utilities imported from the TemplateTools.xml static file.

 

From the canvas example project file, I could publish the project into a single XML resource. During the publication process, the Project Builder validates that all referenced templates and fragments exist in the project, replaces the external URIs with internal tokens, ${dwac.path}, and uses a different linking capability better suited for same-file references. With the published file, the application can be delivered as one file, not five.

Add Response | 0 Responses | submit to reddit

Distributed Web Application Components

Building and deploying Web applications with Engine

steve's Profile - 2009/06/30 23:15

Abstraction plays a big part of the Engine for Web Applications framework. One derivative strength is Engine's flexibility when working with customizations, extensions, and other frameworks. Effectively widgets and extensions are made plug-and-play via the configuration. For example, Application Components may be instantiated via XHTML Component objects, which in turn may be auto-instrumented via the engine.config.xml file. These capabilities make it easy for developers to capture intent with their own concepts and tools; it is very easy to create new application paradigms.

 

Distributed Web Application Components is an umbrella term for describing existing Engine features and new tools for building, running, and debugging the components. Each Distributed Component is a repository of fragments, templates, components, and tasks, that can be authored and released as a single deliverable. The Engine framework includes everything needed to load and execute one or more DWAC projects.

 

Here are a few examples using the DWAC tools. Starting with a basic event-driven example: An extension to a text field to reflect keystrokes. At the moment, the tools are hosted with the Core Web project, but an anonymous version is coming soon. Until then, registered users can access the DWAC tools via /DWAC/{user-name}. For example, my DWAC workspace is located at /DWAC/steve/.

 

1) From the Component Builder, click the New icon.

2) Name the component Reflector, and specify the participation name as Reflect.

3) Optional, check the Include Transaction API to include an example of the transaction service.

dwac_7.jpg

4) Application Components, by default, are not configured for key stroke evnts. So, the component_init function is updated to add the event handler using the createHandler method to create a delegate, and the addEventListener helper method to attach the handler, _prehandle_keyup.

5) Click New Function and enter _handle_keyup, which is invoked by _prehandle_keyup, which in turn was attached as the event listener.

6) In the body of _handle_keyup, add a call to serve the transaction: this.serveTransaction("keypress",this);

7) Save the Reflector component, and take note of the DWAC Path. The Component is now available via the Core Web DWACHandler. For example, the named URI for my version is: /DWAC/steve/Components/Reflector

dwac_8.jpg

8) Create a new component named Reflected, and delete the component_init and component_destroy functions.

9) Add a new function named _handle_transaction. In the function body, copy the value from the TransactionPacket source (the this parameter in the serveTransaction call) into the component's container. org.cote.js.xml.setInnerXHTML(this.getContainer(),v.data.src.getContainer().value);

10) Save the Reflected component, and take note of the DWAC Path. For example, the named URI for my version is: /DWAC/steve/Components/Reflected

11) From the Template Builder, click the New icon and name the template Type Echo.

12) In the XHTML text field, add a new text field for the Reflector component: <input type = "text" acid = "Reflector" appcomp_path = "DWACPath" />

13) Below the text field, add a span tag for the Reflected component: <span acid = "Reflected" appcomp_path = "DWACPath"></span> Optionally, copy the <span /> tag a few times.

14) Save the Type Echo template. For example, the named URI for my template is /DWAC/steve/Templates/Type Echo

dwac_4.jpg

15) Click Run (either as Scripted or Declarative) to try out the new template in the Running tool.

dwac_5.jpg dwac_9.jpg

16) Click the Send to Active Source button to try debugging. Or, once the active source window is open, re-run the template and then select the Profiler tab to browse through the internal Engine object model for the running example.

dwac_6.jpg

 

I'll add more examples as I finish the tools for composting the DWAC files from the created modules.

Add Response | 0 Responses | submit to reddit

<<<>>>